On Fri, 2009-11-06 at 13:20 +0000, Mark Brown wrote:
On Thu, Nov 05, 2009 at 08:08:30PM +0000, Liam Girdwood wrote:
On Thu, 2009-11-05 at 21:28 +0200, Jarkko Nikula wrote:
Would be nice if both the divider and frame size are calculated dynamically based on CLKSRG frequency and sample rate.
This does sound like a useful feature and should probably exist in soc-core for other platforms too.
A lot of drivers would probably have trouble using this due to the number of different constraints in the dividers that can be set up that random hardware has - it'd probably take more effort to finesse things than it's worth - but a utility function for mostly unconstrained hardware would be good.
I was thinking more generic here. e.g. additions to soc.h :-
static inline int snd_soc_get_framesize(int clock, struct snd_pcm_hw_params *params);
A caller could vary clock based upon it's divider options. Error would be returned if there was not enough bandwidth.
and
static inline int snd_soc_get_divider(int clock, struct snd_pcm_hw_params *params);
This would return the integer divider required or bandwidth error.
and
static inline int snd_soc_get_min_clock(struct snd_pcm_hw_params *params);
return min bit clock required for params.
Liam