From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: Xavier Hsu <xavier.hsu@linaro.org>
Cc: Andy Green <andy.green@linaro.org>,
alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com,
patches@linaro.org
Subject: Re: [PATCHv3 5/9] Using the constraint based on wm8971_set_dai_sysclk
Date: Tue, 2 Sep 2014 10:28:10 +0100 [thread overview]
Message-ID: <20140902092810.GC12043@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1409628470-13059-5-git-send-email-xavier.hsu@linaro.org>
On Tue, Sep 02, 2014 at 11:27:46AM +0800, Xavier Hsu wrote:
> This patch improves WM8971.
> We use the constraint based on the function of
> wm8971_set_dai_sysclk().
>
> Any comments about improving the patch are welcome.
> Thanks.
Comments like this are probably best put after the --- as they
don't need to appear in the change log.
>
> Signed-off-by: Xavier Hsu <xavier.hsu@linaro.org>
> Signed-off-by: Andy Green <andy.green@linaro.org>
> ---
> sound/soc/codecs/wm8971.c | 77 +++++++++++++++++++++++++++++++++++++++++----
> 1 file changed, 71 insertions(+), 6 deletions(-)
>
> diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c
> index 64ed226..20cfdd3 100755
> --- a/sound/soc/codecs/wm8971.c
> +++ b/sound/soc/codecs/wm8971.c
> @@ -41,6 +41,7 @@ static struct workqueue_struct *wm8971_workq;
> /* codec private data */
> struct wm8971_priv {
> unsigned int sysclk;
> + struct snd_pcm_hw_constraint_list *sysclk_constraints;
> int playback_fs;
> bool deemph;
> };
> @@ -528,6 +529,53 @@ static int get_coeff(int mclk, int rate)
> return -EINVAL;
> }
>
> +/* The set of rates we can generate from the above for each SYSCLK */
> +static const unsigned int rates_12288[] = {
> + 8000, 12000, 16000, 24000, 32000, 48000, 96000
> +};
> +
> +static struct snd_pcm_hw_constraint_list constraints_12288 = {
> + .count = ARRAY_SIZE(rates_12288),
> + .list = rates_12288,
> +};
> +
> +static const unsigned int rates_112896[] = {
> + 8000, 11025, 22050, 44100, 88200
> +};
> +
> +static struct snd_pcm_hw_constraint_list constraints_112896 = {
> + .count = ARRAY_SIZE(rates_112896),
> + .list = rates_112896,
> +};
> +
> +static const unsigned int rates_18432[] = {
> + 8000, 12000, 16000, 24000, 32000, 48000, 96000
> +};
> +
> +static struct snd_pcm_hw_constraint_list constraints_18432 = {
> + .count = ARRAY_SIZE(rates_18432),
> + .list = rates_18432,
> +};
This one is identical to the 12288 array, why not combine them
and call them the 48k array?
> +
> +static const unsigned int rates_169344[] = {
> + 8000, 11025, 22050, 44100, 88200
> +};
This one is identical to the 112896 array, why not combine them
and call them the 44k1 array?
> +
> +static struct snd_pcm_hw_constraint_list constraints_169344 = {
> + .count = ARRAY_SIZE(rates_169344),
> + .list = rates_169344,
> +};
> +
> +static const unsigned int rates_12[] = {
> + 8000, 11025, 12000, 16000, 22050, 2400, 32000, 41100, 48000,
Typo 0 missing ^^^^
> + 48000, 88235, 96000,
> +};
> +
> +static struct snd_pcm_hw_constraint_list constraints_12 = {
> + .count = ARRAY_SIZE(rates_12),
> + .list = rates_12,
> +};
> +
> static int wm8971_set_dai_sysclk(struct snd_soc_dai *codec_dai,
> int clk_id, unsigned int freq, int dir)
> {
> @@ -535,15 +583,32 @@ static int wm8971_set_dai_sysclk(struct snd_soc_dai *codec_dai,
> struct wm8971_priv *wm8971 = snd_soc_codec_get_drvdata(codec);
>
> switch (freq) {
> - case 11289600:
> - case 12000000:
> case 12288000:
> - case 16934400:
> + case 24576000:
> + wm8971->sysclk_constraints = &constraints_12288;
> + break;
> + case 11289600:
> + case 22579200:
> + wm8971->sysclk_constraints = &constraints_112896;
> + break;
> case 18432000:
> - wm8971->sysclk = freq;
> - return 0;
> + wm8971->sysclk_constraints = &constraints_18432;
> + break;
> + case 16934400:
> + case 33868800:
> + wm8971->sysclk_constraints = &constraints_169344;
> + break;
> + case 12000000:
> + case 24000000:
> + wm8971->sysclk_constraints = &constraints_12;
> + break;
> + default:
> + return -EINVAL;
> }
> - return -EINVAL;
You pick out the constraints here but you never actually set them
with snd_pcm_hw_constraint_list?
> +
> + wm8971->sysclk = freq;
> +
> + return 0;
> }
>
> static int wm8971_set_dai_fmt(struct snd_soc_dai *codec_dai,
> --
Thanks,
Charles
next prev parent reply other threads:[~2014-09-02 9:35 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-02 3:27 [PATCHv3 1/9] Clean WM8971 through checkpatch Xavier Hsu
2014-09-02 3:27 ` [PATCHv3 2/9] WM8971 uses SOC_ENUM_SINGLE_DECL to replace SOC_ENUM_SINGLE Xavier Hsu
2014-09-02 9:33 ` Charles Keepax
2014-09-02 14:56 ` Lars-Peter Clausen
2014-09-04 3:53 ` Xavier Hsu
2014-09-02 3:27 ` [PATCHv3 3/9] WM8971 uses TLV information Xavier Hsu
2014-09-02 9:47 ` Charles Keepax
2014-09-02 3:27 ` [PATCHv3 4/9] Improve wm8971_set_dai_fmt Xavier Hsu
2014-09-02 9:48 ` Charles Keepax
2014-09-02 3:27 ` [PATCHv3 5/9] Using the constraint based on wm8971_set_dai_sysclk Xavier Hsu
2014-09-02 9:28 ` Charles Keepax [this message]
2014-09-04 9:13 ` [alsa-devel] " Xavier Hsu
2014-09-02 3:27 ` [PATCHv3 6/9] WM8971 uses msleep to replace work queue Xavier Hsu
2014-09-02 10:00 ` Charles Keepax
2014-09-05 3:09 ` Xavier Hsu
2014-09-02 3:27 ` [PATCHv3 7/9] WM8971 improves the function of regmap Xavier Hsu
2014-09-02 11:03 ` Charles Keepax
2014-09-03 19:19 ` Lars-Peter Clausen
2014-09-11 3:21 ` Xavier Hsu
2014-09-11 7:06 ` Lars-Peter Clausen
2014-09-02 3:27 ` [PATCHv3 8/9] WM8971 adds kcontrol functions Xavier Hsu
2014-09-02 12:41 ` Charles Keepax
2014-09-11 3:35 ` Xavier Hsu
2014-09-02 3:27 ` [PATCHv3 9/9] ASOC add WM8973 support to WM8971 Xavier Hsu
2014-09-02 12:38 ` Charles Keepax
-- strict thread matches above, loose matches on Subject: below --
2014-09-02 3:30 [PATCHv3 1/9] Clean WM8971 through checkpatch Xavier Hsu
2014-09-02 3:30 ` [PATCHv3 5/9] Using the constraint based on wm8971_set_dai_sysclk Xavier Hsu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140902092810.GC12043@opensource.wolfsonmicro.com \
--to=ckeepax@opensource.wolfsonmicro.com \
--cc=alsa-devel@alsa-project.org \
--cc=andy.green@linaro.org \
--cc=patches@linaro.org \
--cc=patches@opensource.wolfsonmicro.com \
--cc=xavier.hsu@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).