All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liam Girdwood <liam.r.girdwood@linux.intel.com>
To: Sergey Kiselev <skiselev@gmail.com>
Cc: alsa-devel@alsa-project.org, Mark Brown <broonie@kernel.org>,
	Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Subject: Re: ASoC: PATCH: wm8731 - reinitialize regmap cache after hardware reset
Date: Thu, 28 May 2015 17:52:46 +0100	[thread overview]
Message-ID: <1432831966.2726.63.camel@loki> (raw)
In-Reply-To: <CA+abuVebbr9Cif_SfB+JcNhUOMV70fdWa-Q-nk+gFv9H5MRtgQ@mail.gmail.com>

Hi Sergey,

Best to always CC Mark on any ASoC patches, I've also added Richard from
Wolfson. Best to read submitting patches from the Documentation
directory too :) 

On Thu, 2015-05-28 at 09:34 -0700, Sergey Kiselev wrote:
> Hi,
> 
> I am working on a machine driver that uses wm8731 codec and I've
> noticed that it will not work after rmmod/modprobe of that machine
> driver. The issue is that wm8731_probe() resets the hardware, but it
> doesn't reinitialize the regmap cache to the default values.
> 
> The patch below fixes this issue.
> 
> I also skimmed through other codecs, and some of them might have
> similar issue (wm8510.c, wm8711.c, wm8750.c, wm8753.c, wm8940.c,
> wm8960.c, wm8971.c, wm8974.c, wm8988.c, wm8990.c)
> 

Richard, can Wolfson take care of these ones. I guess some of the older
codecs have no way to reset the registers ?

> Another way to avoid this issue might be resetting the codec in the
> *_spi_probe()/*_i2c_probe(), so that it only gets reset once when
> codec is loading.
> 
> Thanks in advance for any comments/suggestions on the patch.
> 
> Thanks,
> Sergey
> 
> Signed-off-by: Sergey Kiselev <skiselev@gmail.com>
> 
> diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
> index 2245b6a..76af75b 100644
> --- a/sound/soc/codecs/wm8731.c
> +++ b/sound/soc/codecs/wm8731.c
> @@ -84,7 +84,7 @@ static bool wm8731_writeable(struct device *dev,
> unsigned int reg)
>   return reg <= WM8731_RESET;
>  }
> 
> -#define wm8731_reset(c) snd_soc_write(c, WM8731_RESET, 0)

I would have expected this to reset the register values so I'm not sure
why it's failing in your case ?

> +static int wm8731_reset(struct snd_soc_codec *codec);
> 
>  static const char *wm8731_input_select[] = {"Line In", "Mic"};
> 
> @@ -665,6 +665,21 @@ static const struct regmap_config wm8731_regmap = {
>   .num_reg_defaults = ARRAY_SIZE(wm8731_reg_defaults),
>  };
> 
> +static int wm8731_reset(struct snd_soc_codec *codec)
> +{
> + int ret;
> + struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
> +
> + ret = snd_soc_write(codec, WM8731_RESET, 0);
> +
> + if (ret != 0)
> + return ret;
> +
> + regmap_reinit_cache(wm8731->regmap, &wm8731_regmap);
> +
> + return 0;
> +}
> +

Your mailer has screwed up the formatting here :(

>  #if defined(CONFIG_SPI_MASTER)
>  static int wm8731_spi_probe(struct spi_device *spi)
>  {

Liam

  reply	other threads:[~2015-05-28 16:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-28 16:34 ASoC: PATCH: wm8731 - reinitialize regmap cache after hardware reset Sergey Kiselev
2015-05-28 16:52 ` Liam Girdwood [this message]
2015-05-28 19:26   ` Mark Brown
     [not found]     ` <CA+abuVeO4=au_X0Z_MjPsq40b1fHbjezKRy_fTOgQ=SzmaPK5Q@mail.gmail.com>
     [not found]       ` <20150528145548.fa5a0f2d78c0bb2549088fc2@intel.com>
2015-05-29  9:32         ` Mark Brown
2015-06-02 11:55 ` Charles Keepax

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=1432831966.2726.63.camel@loki \
    --to=liam.r.girdwood@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=rf@opensource.wolfsonmicro.com \
    --cc=skiselev@gmail.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 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.