alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Kuninori Morimoto <morimoto.kuninori@renesas.com>,
	alsa-devel@alsa-project.org, linux-sh@vger.kernel.org,
	Magnus Damm <damm@opensource.se>,
	Liam Girdwood <lrg@slimlogic.co.uk>
Subject: Re: [PATCH 1/4] ASoC: add a WM8978 codec driver
Date: Wed, 20 Jan 2010 20:17:26 +0000	[thread overview]
Message-ID: <20100120201726.GD7725@sirena.org.uk> (raw)
In-Reply-To: <Pine.LNX.4.64.1001191445520.4607@axis700.grange>

On Wed, Jan 20, 2010 at 08:50:59PM +0100, Guennadi Liakhovetski wrote:
> On Tue, 19 Jan 2010, Mark Brown wrote:

> > What do these comments refer to - do you mean to say that these are not
> > the actual chip register defaults?  The normal way to deal with those is

> No, I meant, that there's a "Value Update" bit in that register, usually 
> bit 8. So, that bit, of course, is not in default, but it was suggested to 
> me on IRC to set it in cache to force automatic value update.

Right, but it's better to set it in the cache by writing after the fact
rather than by changing the register defaults.  Like I say, that can
easily confuse things since sometimes people want to know the actual
default values.

> 
> > > +#define ARRAY_SINGLE(xreg, xshift, xtexts) SOC_ENUM_SINGLE(xreg, xshift, \
> > > +						ARRAY_SIZE(xtexts), xtexts)
> > 
> > This looks generic - please namespace it and add it to the header file,
> > other drivers can benefit from it.
> 
> SOC_ARRAY_SINGLE()?

How about SOC_ENUM_ARRAY() since it's really only useful for arrays?

> > > +#define MIXER_ARRAY(n, r, s, i, m) SND_SOC_DAPM_MIXER(n, r, s, i, \
> > > +							m, ARRAY_SIZE(m))

> > Again, this should be done somewhere generic.  Probably by going through
> > and changing the SND_SOC_DAPM_MIXER definition.

> Well, having discussed this privately and having looked at the heades, I'm 
> not sure, this is a good idea. First, there are

> SND_SOC_DAPM_PGA()
> SND_SOC_DAPM_MIXER()
> SND_SOC_DAPM_MIXER_NAMED_CTL()
> SND_SOC_DAPM_PGA_E()
> SND_SOC_DAPM_MIXER_E()
> SND_SOC_DAPM_MIXER_NAMED_CTL_E()

> - 6 macros that follow the pattern

> .kcontrols = wcontrols, .num_kcontrols = wncontrols,

That doesn't mean it's a good idea, though for PGAs note that the normal
case is that the array is omitted (and actually, thinking about this we
need an array omitted case for everything anyway).

> Changing only one of them would make the headers and the API look 
> inconsistent. Changing all of them... I really don't think we want to 
> endeavor this now, at least not me;) Besides, doing this locally is very 
> convenient, and is available to everyone - there's no space science 
> involved with this. One can be even as evil as doing

For maintainability of the subsystem it's really nice if a driver doing
bog standard things looks like it's doing bog standard things - neat
local tricks break the pattern recognition that helps a lot when looking
at multiple drivers.

> > > +	u16 power1 = snd_soc_read(codec, WM8978_POWER_MANAGEMENT_1) & ~3;
> > 
> > This bitmask maintains everything except the two LSB...
> > 
> > > +	switch (level) {
> > > +	case SND_SOC_BIAS_ON:
> > > +	case SND_SOC_BIAS_PREPARE:
> > > +		power1 |= 1;  /* VMID 75k */
> > > +		snd_soc_write(codec, WM8978_POWER_MANAGEMENT_1, power1);
> > > +		break;
> > > +	case SND_SOC_BIAS_STANDBY:
> > > +		power1 |= 0xC;
> > 
> > ...but this is also managing other bits.

> Right, bits 7-6 are either kept or set, nothing wrong with that.

That seems wrong - if they're being managed in the bias level
configuration they ought to be being turned off at some point.  If they
should be set all the time then set them during chip init.

  reply	other threads:[~2010-01-20 20:17 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-19  8:08 [PATCH 0/4] ALSA: SH: add ASoC driver for SIU audio engine, an audio codec and platform support Guennadi Liakhovetski
2010-01-19  8:08 ` [PATCH 1/4] ASoC: add a WM8978 codec driver Guennadi Liakhovetski
2010-01-19 10:46   ` [alsa-devel] " Liam Girdwood
2010-01-20 20:01     ` Guennadi Liakhovetski
2010-01-20 20:21       ` Mark Brown
2010-01-20 20:25       ` [alsa-devel] " Liam Girdwood
2010-01-19 10:57   ` Mark Brown
     [not found]   ` <20100119105729.GA32559@opensource.wolfsonmicro.com::587>
2010-01-20 19:50     ` Guennadi Liakhovetski
2010-01-20 20:17       ` Mark Brown [this message]
2010-01-22  8:35         ` [alsa-devel] " Guennadi Liakhovetski
2010-01-22 10:35           ` Mark Brown
2010-01-22 16:27   ` [PATCH 1/4 v2] " Guennadi Liakhovetski
2010-01-22 17:39     ` Liam Girdwood
2010-01-23 20:47     ` [alsa-devel] " Mark Brown
2010-01-26 13:04       ` Guennadi Liakhovetski
2010-01-26 13:26         ` Mark Brown
2010-01-26 14:08           ` Guennadi Liakhovetski
2010-01-26 15:22             ` [alsa-devel] " Mark Brown
2010-01-19  8:09 ` [PATCH 2/4] ASoC: add DAI and platform drivers for SH SIU and support for the Migo-R board Guennadi Liakhovetski
2010-01-19 11:13   ` [alsa-devel] " Liam Girdwood
2010-01-19 12:34   ` Mark Brown
2010-01-22 18:09   ` [PATCH 2a/4 v2] ASoC: add DAI and platform / DMA drivers for SH SIU Guennadi Liakhovetski
2010-01-25 13:58     ` Liam Girdwood
2010-01-25 15:06     ` Mark Brown
2010-01-22 18:17   ` [PATCH 2b/4 v2] ASoC: add support for the sh7722 Migo-R board Guennadi Liakhovetski
2010-01-25 13:21     ` Mark Brown
2010-01-25 13:47       ` [alsa-devel] " Liam Girdwood
2010-01-19  8:09 ` [PATCH 3/4] sh: add DMA slave definitions and SIU platform data to sh7722 setup Guennadi Liakhovetski
2010-01-19  8:09 ` [PATCH 4/4] sh: audio support for the sh7722 Migo-R board Guennadi Liakhovetski

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=20100120201726.GD7725@sirena.org.uk \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=damm@opensource.se \
    --cc=g.liakhovetski@gmx.de \
    --cc=linux-sh@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    --cc=morimoto.kuninori@renesas.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).