Message ID | 87lho21gah.wl%kuninori.morimoto.gx@renesas.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Kuninori, Thanks for your reply. On Mon, Oct 27, 2014 at 3:56 AM, Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> wrote: > Current simple-card already has mclk_fs support on hw_param. Thought some more about it, indeed I can change my I2S master driver to just use constant factor to derive MCLK frequency from the requested sample rate. > So, we can add similar method ? > Below is my idea. priv->xxx is new option here. Hardcoding it seemed a bit awkward to me as well as providing full lookup table to map sample rate to MCLK frequency in the device tree. So I'll stick with the mclk_fs feature for now. > Or you can update mclk_fs feature somehow ?
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 4f192ee..5d943a1 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -43,14 +43,21 @@ static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream, struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_dai *codec_dai = rtd->codec_dai; struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card); - unsigned int mclk; + unsigned int mclk = 0; int ret = 0; if (priv->mclk_fs) { mclk = params_rate(params) * priv->mclk_fs; + } else if (priv->xxx) { + if (0 == (12288000 % params_rate(params))) + mclk = 12288000; + if (0 == (11289600 % params_rate(params))) + mclk = 11289600; + } + + if (mclk) ret = snd_soc_dai_set_sysclk(codec_dai, 0, mclk, SND_SOC_CLOCK_IN); - } return ret; }