From: Richard Fitzgerald <rf@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,
lars@metafoo.de, patches@linaro.org
Subject: Re: [PATCHv6 3/9] ASOC: wm8971: modify the control of deemphasis
Date: Mon, 1 Dec 2014 10:04:59 +0000 [thread overview]
Message-ID: <20141201100459.GA18129@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1417416721-17271-3-git-send-email-xavier.hsu@linaro.org>
On Mon, Dec 01, 2014 at 02:51:55PM +0800, Xavier Hsu wrote:
> We add a switch for automatic updating
> the frequency of wm8971.
>
> Signed-off-by: Xavier Hsu <xavier.hsu@linaro.org>
> Signed-off-by: Andy Green <andy.green@linaro.org>
> ---
> sound/soc/codecs/wm8971.c | 75 +++++++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 72 insertions(+), 3 deletions(-)
> mode change 100644 => 100755 sound/soc/codecs/wm8971.c
>
> diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c
> old mode 100644
> new mode 100755
> index 60c90c6..b5cb636
> --- a/sound/soc/codecs/wm8971.c
> +++ b/sound/soc/codecs/wm8971.c
> @@ -40,6 +40,11 @@ static struct workqueue_struct *wm8971_workq;
> /* codec private data */
> struct wm8971_priv {
> unsigned int sysclk;
> +
> + /* De-emphasis */
> + struct mutex deemph_mutex;
> + int playback_fs;
> + bool deemph;
> };
>
> /*
> @@ -104,7 +109,6 @@ static const char const *wm8971_alc_func[] = {"Off", "Right",
> "Left", "Stereo"};
> static const char const *wm8971_ng_type[] = {"Constant PGA Gain",
> "Mute ADC Output"};
> -static const char const *wm8971_deemp[] = {"None", "32kHz", "44.1kHz", "48kHz"};
> static const char const *wm8971_mono_mux[] = {"Stereo", "Mono (Left)",
> "Mono (Right)", "Digital Mono"};
> static const char const *wm8971_dac_phase[] = {"Non Inverted", "Inverted"};
> @@ -118,6 +122,66 @@ static const char const *wm8971_rpga_sel[] = {"Line", "Mic", "NC",
> "Differential"};
> static const char const *wm8971_adcpol[] = {"Normal", "L Invert",
> "R Invert", "L + R Invert"};
> +static const char const *wm8971_deemp[] = {"None", "32kHz",
> + "44.1kHz", "48kHz"};
This is the same as the original version of the array that you've deleted.
I'm guess from the code below that you intended to change this to an
array of integers, messed up, and didn't bother to test that your patch
compiled before posting it up here.
> +
> +static int wm8971_set_deemph(struct snd_soc_codec *codec)
> +{
> + struct wm8971_priv *wm8971 = snd_soc_codec_get_drvdata(codec);
> + int val = 0, i, best = 0;
> +
> + /* If we're using deemphasis select the nearest available sample
> + * rate.
> + */
> + if (wm8971->deemph) {
> + best = 1;
> + for (i = 2; i < ARRAY_SIZE(wm8971_deemp); i++) {
> + if (abs(wm8971_deemp[i] - wm8971->playback_fs) <
> + abs(wm8971_deemp[best] - wm8971->playback_fs))
wm8971_deemp[i] is a string and then you try to subtract a value from it.
I wouldn't expect that to even compile (at least not without warnings), and
if it does compile I can't imagine what the result would be and I doubt it
is what you wanted.
I'm not even sure what you were trying to do here.
> + best = i;
> + }
> + val = best << 1;
> + }
> +
> + dev_dbg(codec->dev, "Set deemphasis %d (%dHz)\n",
> + best, wm8971_deemp[best]);
> +
wm_8971_deemp[best] is a string
next prev parent reply other threads:[~2014-12-01 10:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-01 6:51 [PATCHv6 1/9] ASOC: wm8971: clean for checkpatch --strict Xavier Hsu
2014-12-01 6:51 ` [PATCHv6 2/9] ASOC: wm8971: use SOC_ENUM_SINGLE_DECL to replace SOC_ENUM_SINGLE Xavier Hsu
2014-12-01 6:51 ` [PATCHv6 3/9] ASOC: wm8971: modify the control of deemphasis Xavier Hsu
2014-12-01 10:04 ` Richard Fitzgerald [this message]
2014-12-02 7:54 ` Xavier Hsu
2014-12-01 6:51 ` [PATCHv6 4/9] ASOC: wm8971: add TLV information Xavier Hsu
2014-12-01 6:51 ` [PATCHv6 5/9] ASOC: wm8971: improve the function of wm8971_set_dai_fmt() Xavier Hsu
2014-12-01 6:51 ` [PATCHv6 6/9] ASOC: wm8971: add constraint for setting set_sysclk() Xavier Hsu
2014-12-01 6:51 ` [PATCHv6 7/9] ASOC: wm8971: use msleep to replace work queue Xavier Hsu
2014-12-01 6:52 ` [PATCHv6 8/9] ASOC: wm8971: use regcache_sync to replace snd_soc_cache_sync Xavier Hsu
2014-12-01 6:52 ` [PATCHv6 9/9] ASOC: wm8971: add WM8973 support to WM8971 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=20141201100459.GA18129@opensource.wolfsonmicro.com \
--to=rf@opensource.wolfsonmicro.com \
--cc=alsa-devel@alsa-project.org \
--cc=andy.green@linaro.org \
--cc=lars@metafoo.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.