From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: "Reddy, MR Swami" <MR.Swami.Reddy@ti.com>
Cc: "Ujfalusi, Peter" <peter.ujfalusi@ti.com>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
"Girdwood, Liam" <lrg@ti.com>
Subject: Re: [PATCH] ASoC: Add support for TI LM49453 Audio codec
Date: Fri, 27 Jan 2012 14:35:26 +0000 [thread overview]
Message-ID: <20120127143525.GA15596@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <290463D19D2E064191F1F96ECA480A89434AAB3793@EXMAIL02.scwf.nsc.com>
[-- Attachment #1.1: Type: text/plain, Size: 5931 bytes --]
On Fri, Jan 27, 2012 at 05:46:02AM -0800, Reddy, MR Swami wrote:
Overall this is a substantial improvement on your last version but
there's still quite a few issues here. Looking at some of the issues
I'm concerned about how you're testing this, there are some things here
that I'd expect the core to complain about when you load the driver.
> +/* Register default values for LM49453 river. */
> +static const u8 lm49453_reg_defs[LM49453_MAX_REGISTER] = {
Please use the regmap API as previously requested. If anything this is
going backwards as you've used a big table rather than
[reg] = value
but really, use the regmap API. The long term goal is to remove the
register cache from ASoC completely.
> +static const struct snd_kcontrol_new lm49453_headset_left_mixer[] = {
> +SOC_DAPM_SINGLE("Port1_1 HPL Switch", LM49453_P0_DACHPL1_REG, 0, 1, 0),
These controls are all going to end up called "HPL Mixer Port1_1 HPL
Switch" and so on which probably isn't what you want. You shouldn't
have the "HPL" in any of the individual mixer controls, the prefixing is
enough to let the user know this is affecting the HPL mixer. The same
issue applies to all your mixer controls.
> +static const struct snd_kcontrol_new lm49453_snd_controls[] = {
> + SOC_DAPM_ENUM("Mic2Mode Capture Route", lm49453_mic2mode_enum),
> + SOC_DAPM_ENUM("DMIC12 Capture Route", lm49453_dmic12_cfg_enum),
> + SOC_DAPM_ENUM("DMIC34 Capture Route", lm49453_dmic34_cfg_enum),
Why are these appearing as regular controls? DAPM controls should be
attached to widgets...
> + /* Sidetone supports mono only */
> + SOC_SINGLE_TLV("Sidetone ADCL Volume", LM49453_P0_STN_VOL_ADCL_REG,
> + 0, 0x3F, 0, digital_tlv),
> + SOC_SINGLE_TLV("Sidetone ADCR Volume", LM49453_P0_STN_VOL_ADCR_REG,
> + 0, 0x3F, 0, digital_tlv),
> + SOC_SINGLE_TLV("Sidetone DMIC1L Volume", LM49453_P0_STN_VOL_DMIC1L_REG,
> + 0, 0x3F, 0, digital_tlv),
> + SOC_SINGLE_TLV("Sidetone DMIC1R Volume", LM49453_P0_STN_VOL_DMIC1R_REG,
> + 0, 0x3F, 0, digital_tlv),
> + SOC_SINGLE_TLV("Sidetone DMIC2L Volume", LM49453_P0_STN_VOL_DMIC2L_REG,
> + 0, 0x3F, 0, digital_tlv),
> + SOC_SINGLE_TLV("Sidetone DMIC2R Volume", LM49453_P0_STN_VOL_DMIC2R_REG,
> + 0, 0x3F, 0, digital_tlv),
These should probably line up with the relevant mixer controls.
> + SND_SOC_DAPM_INPUT("AMIC1"), /* Headset mic */
Why is this specifically the headset mic?
> + /* HP mapping */
> + { "HPL Mixer", "PORT1_1_RX_LVL Volume", "PORT1_1_RX" },
> + { "HPL Mixer", "PORT1_2_RX_LVL Volume", "PORT1_2_RX" },
> + { "HPL Mixer", "PORT1_3_RX_LVL Volume", "PORT1_3_RX"},
> + { "HPL Mixer", "PORT1_4_RX_LVL Volume", "PORT1_4_RX" },
> + { "HPL Mixer", "PORT1_5_RX_LVL Volume", "PORT1_5_RX" },
> + { "HPL Mixer", "PORT1_6_RX_LVL Volume", "PORT1_6_RX" },
> + { "HPL Mixer", "PORT1_7_RX_LVL Volume", "PORT1_7_RX" },
> + { "HPL Mixer", "PORT1_8_RX_LVL Volume", "PORT1_8_RX" },
This doesn't line up with the switches that are in the DAPM controls for
the mixers, the Volume controls are nothing to do with DAPM.
> + { "Port2_1 Mixer", "Port1_1 Port2_1 Switch", "PORT1_1_RX_LVL Volume" },
PORT1_1_RX_LVL Volume is not a DAPM widget. I'm very surprised this
driver manages to register without generating errors, how have you
tested this?
> + snd_soc_write(codec, LM49453_P0_FLL_REF_FREQL_REG,
> + LM49453_FLL_REF_FREQ_VAL & 0xff);
> + snd_soc_write(codec, LM49453_P0_FLL_REF_FREQH_REG,
> + (LM49453_FLL_REF_FREQ_VAL >> 8) & 0xff);
> +
> + snd_soc_write(codec, LM49453_P0_VCO_TARGETLL_REG,
> + LM49453_VCO_TARGET_VAL & 0xff);
> + snd_soc_write(codec, LM49453_P0_VCO_TARGETLH_REG,
> + (LM49453_VCO_TARGET_VAL >> 8) & 0xff);
> + snd_soc_write(codec, LM49453_P0_VCO_TARGETHL_REG,
> + (LM49453_VCO_TARGET_VAL >> 16) & 0xff);
> + snd_soc_write(codec, LM49453_P0_VCO_TARGETHH_REG,
> + (LM49453_VCO_TARGET_VAL >> 24) & 0xff);
This appears to completely ignore the parameters the user passed in, how
can this ever work?
> +static int lm49453_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id,
> + unsigned int freq, int dir)
> +{
> + struct snd_soc_codec *codec = dai->codec;
> + struct lm49453_priv *lm49453 = snd_soc_codec_get_drvdata(codec);
> +
> + switch (freq) {
> + case 12288000: /* Platform System Clock */
What does this comment mean?
> +static int lm49453_startup(struct snd_pcm_substream *substream,
> + struct snd_soc_dai *codec_dai)
> +{
> + unsigned int startup_mask;
> + struct snd_soc_codec *codec = codec_dai->codec;
> + dev_dbg(codec->dev, "lm49453_startup\n");
> +
> + startup_mask = LM49453_PMC_SETUP_CHIP_EN | LM49453_PMC_SETUP_PLL_EN;
> + snd_soc_update_bits(codec, LM49453_P0_PMC_SETUP_REG, startup_mask,
> + startup_mask);
This looks like it should be DAPM or bias level manaement, and indeed
CHIP_EN is disabled by bias management.
> +static int lm49453_hp_mute(struct snd_soc_dai *dai, int mute)
> +{
> + snd_soc_update_bits(dai->codec, LM49453_P0_DAC_DSP_REG, BIT(1)|BIT(0),
> + BIT(1)|BIT(0));
> + return 0;
> +}
This completely ignores the mute parameter.
> +static int __init lm49453_modinit(void)
> +{
> + int ret;
> + ret = i2c_add_driver(&lm49453_i2c_driver);
> + if (ret != 0)
> + pr_err("Failed to register LM49453 I2C driver: %d\n", ret);
> +
> + return ret;
> +}
> +module_init(lm49453_modinit);
Use module_i2c_driver.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
next parent reply other threads:[~2012-01-27 14:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <290463D19D2E064191F1F96ECA480A89434AAB3793@EXMAIL02.scwf.nsc.com>
2012-01-27 14:35 ` Mark Brown [this message]
2012-02-02 14:30 [PATCH ] ASoC: Add support for TI LM49453 Audio codec Reddy, MR Swami
2012-02-02 23:14 ` Mark Brown
2012-02-03 12:19 ` Reddy, MR Swami
2012-02-03 13:25 ` Mark Brown
2012-02-03 13:33 ` M R Swami Reddy
2012-02-03 13:55 ` Mark Brown
2012-02-03 14:44 ` M R Swami Reddy
2012-02-03 14:54 ` Mark Brown
-- strict thread matches above, loose matches on Subject: below --
2012-01-31 11:59 [PATCH] " Reddy, MR Swami
2012-01-31 20:12 ` Mark Brown
[not found] <290463D19D2E064191F1F96ECA480A89434A67486B@EXMAIL02.scwf.nsc.com>
2012-01-03 21:17 ` Mark Brown
[not found] ` <290463D19D2E064191F1F96ECA480A89434A7595BC@EXMAIL02.scwf.nsc.com>
2012-01-05 6:17 ` Mark Brown
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=20120127143525.GA15596@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.com \
--cc=MR.Swami.Reddy@ti.com \
--cc=alsa-devel@alsa-project.org \
--cc=lrg@ti.com \
--cc=peter.ujfalusi@ti.com \
/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).