alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: "Sit, Michael Wei Hong" <michael.wei.hong.sit@intel.com>
To: Dan Murphy <dmurphy@ti.com>
Cc: "pierre-louis.bossart@linux.intel.com"
	<pierre-louis.bossart@linux.intel.com>,
	"Rojewski, Cezary" <cezary.rojewski@intel.com>,
	"a-estrada@ti.com" <a-estrada@ti.com>,
	"Shevchenko, Andriy" <andriy.shevchenko@intel.com>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"Sia, Jee Heng" <jee.heng.sia@intel.com>,
	"tiwai@suse.com" <tiwai@suse.com>,
	"liam.r.girdwood@linux.intel.com"
	<liam.r.girdwood@linux.intel.com>,
	Mark Brown <broonie@kernel.org>,
	"zakkaye@ti.com" <zakkaye@ti.com>
Subject: RE: [PATCH 3/3] ASoC: codec: tlv3204: Moving GPIO reset and add ADC reset
Date: Tue, 4 Aug 2020 10:31:40 +0000	[thread overview]
Message-ID: <BYAPR11MB30465175B001D5B9B6D123889D4A0@BYAPR11MB3046.namprd11.prod.outlook.com> (raw)
In-Reply-To: <BYAPR11MB3046A6AB5E7E1A2E2795DD329D4D0@BYAPR11MB3046.namprd11.prod.outlook.com>



> -----Original Message-----
> From: Sit, Michael Wei Hong
> Sent: Monday, 3 August, 2020 9:54 AM
> To: Dan Murphy <dmurphy@ti.com>
> Cc: Mark Brown <broonie@kernel.org>; alsa-devel@alsa-
> project.org; tiwai@suse.com; pierre-louis.bossart@linux.intel.com;
> Rojewski, Cezary <cezary.rojewski@intel.com>; Shevchenko, Andriy
> <andriy.shevchenko@intel.com>; liam.r.girdwood@linux.intel.com;
> Sia, Jee Heng <jee.heng.sia@intel.com>; a-estrada@ti.com;
> zakkaye@ti.com
> Subject: RE: [PATCH 3/3] ASoC: codec: tlv3204: Moving GPIO reset
> and add ADC reset
> >
> > On 7/29/20 2:32 AM, Michael Sit Wei Hong wrote:
> > > Moving GPIO reset to a later stage and before clock registration
> to
> > > ensure that the host system and codec clocks are in sync. If the
> > > host register clock values prior to gpio reset, the last configured
> > > codec clock is registered to the host. The codec then gets gpio
> > > resetted setting the codec clocks to their default value, causing a
> mismatch.
> > > Host system will skip clock setting thinking the codec clocks are
> > > already at the requested rate.
> > >
> > > ADC reset is added to ensure the next audio capture does not
> have
> > > undesired artifacts. It is probably related to the original code
> > > where the probe function resets the ADC prior to 1st record.
> > >
> > > Signed-off-by: Michael Sit Wei Hong
> <michael.wei.hong.sit@intel.com>
> > > Reviewed-by: Sia Jee Heng <jee.heng.sia@intel.com>
> > > Reviewed-by: Pierre-Louis Bossart
> > > <pierre-louis.bossart@linux.intel.com>
> > > ---
> > >   sound/soc/codecs/tlv320aic32x4.c | 47
> ++++++++++++++++++++++++-
> > -------
> > >   1 file changed, 35 insertions(+), 12 deletions(-)
> > >
> > > diff --git a/sound/soc/codecs/tlv320aic32x4.c
> > > b/sound/soc/codecs/tlv320aic32x4.c
> > > index 5af438a00f95..37e14558d7c0 100644
> > > --- a/sound/soc/codecs/tlv320aic32x4.c
> > > +++ b/sound/soc/codecs/tlv320aic32x4.c
> > > @@ -50,6 +50,28 @@ struct aic32x4_priv {
> > >   	struct device *dev;
> > >   };
> > >
> > > +static int aic32x4_reset_adc(struct snd_soc_dapm_widget *w,
> > > +			     struct snd_kcontrol *kcontrol, int event)
> {
> > > +	struct snd_soc_component *component =
> > snd_soc_dapm_to_component(w->dapm);
> > > +	u32 adc_reg;
> > > +
> > > +	/*
> > > +	 * Workaround: the datasheet does not mention a required
> > programming
> > > +	 * sequence but experiments show the ADC needs to be
> reset
> > after each
> > > +	 * capture to avoid audible artifacts.
> > > +	 */
> > > +	switch (event) {
> > > +	case SND_SOC_DAPM_POST_PMD:
> > > +		adc_reg = snd_soc_component_read32(component,
> > AIC32X4_ADCSETUP);
> >
> > This gives me a build error
> >
> > sound/soc/codecs/tlv320aic32x4.c: In function
> 'aic32x4_reset_adc':
> > sound/soc/codecs/tlv320aic32x4.c:66:13: error: implicit
> declaration of
> > function 'snd_soc_component_read32'; did you mean
> > 'snd_soc_component_read'? [-Werror=implicit-function-
> declaration]
> >     66 |   adc_reg = snd_soc_component_read32(component,
> > AIC32X4_ADCSETUP);
> >        |             ^~~~~~~~~~~~~~~~~~~~~~~~
> >        |             snd_soc_component_read
> >
> > Also you should check the return to make sure it is valid.
> >
> > Dan
> >
> 
> Hi Dan,
> 
> This code patch is created based on the kernel version 5.8-rc4.
> The register reading and writing are copied from the function
> aic32x4_component_probe.
> May I know the version of the kernel you are applying the patch on?
> 
> Thanks,
> Regards,
> Michael

I have tried to build the kernel with the patches applied on
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
for-next branch and also on the linux-next branch from
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
Both of them are not throwing errors when I enable the config to build
the codec driver.

Can you double confirm the branch you are building the kernel from?

      parent reply	other threads:[~2020-08-04 10:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-29  7:32 [PATCH 0/3] ASoC: codec: tlv3204: Codec workaround Michael Sit Wei Hong
2020-07-29  7:32 ` [PATCH 1/3] ASoC: codec: tlv3204: Enable 24 bit audio support Michael Sit Wei Hong
2020-07-29  7:32 ` [PATCH 2/3] ASoC: codec: tlv3204: Increased maximum supported channels Michael Sit Wei Hong
2020-07-29  7:32 ` [PATCH 3/3] ASoC: codec: tlv3204: Moving GPIO reset and add ADC reset Michael Sit Wei Hong
2020-07-29 12:31   ` Dan Murphy
2020-07-30  5:46     ` Sit, Michael Wei Hong
2020-07-30 12:33       ` Mark Brown
2020-08-03  1:54         ` Sit, Michael Wei Hong
2020-08-03  8:15           ` Shevchenko, Andriy
2020-08-03 10:44           ` Mark Brown
2020-08-04 10:31           ` Sit, Michael Wei Hong [this message]

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=BYAPR11MB30465175B001D5B9B6D123889D4A0@BYAPR11MB3046.namprd11.prod.outlook.com \
    --to=michael.wei.hong.sit@intel.com \
    --cc=a-estrada@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=dmurphy@ti.com \
    --cc=jee.heng.sia@intel.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=tiwai@suse.com \
    --cc=zakkaye@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).