All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Zeng Zhaoming <zhaoming.zeng@freescale.com>
Cc: alsa-devel@alsa-project.org, s.hauer@pengutronix.de,
	Zeng Zhaoming <zengzm.kernel@gmail.com>,
	lrg@slimlogic.co.uk, arnaud.patard@rtp-net.org,
	linuxzsc@gmail.com
Subject: Re: [PATCH v2] ASoC: Add FreeScale SGTL5000 codec suppor
Date: Tue, 18 Jan 2011 11:02:55 +0000	[thread overview]
Message-ID: <20110118110255.GB26498@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <20110118023255.GA9481@ubuntu.localdomain>

On Tue, Jan 18, 2011 at 10:32:55AM +0800, Zeng Zhaoming wrote:
> On Mon 2011-01-17 15:32:11, Mark Brown wrote:

> > It's not clear why you're storing some of this stuff in the private data
> > - for example, capture_channels is only referred to in the place where
> > it is set (so you may as well use the original value) and small_pop is
> > set unconditionally (it looks like the intention was to have platform
> > data for it?).

> yes, you are right. lrclk and capture_channels fields can be remove.
> small_pop is a configurable option of platform data.

Your patch unconditionally sets small_pop, there's no configuration via
platform data or otherwise.

> > of event and never turns anything off.  If this can't just be set once
> > at startup then a comment explaining why an event is needed would be
> > good.

> the odd code is cuased by:

Please note what I'm saying about making the code clear.

> > > +     case SND_SOC_DAPM_PRE_PMU:
> > > +             snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER,
> > > +                     SGTL5000_VAG_POWERUP|SGTL5000_DAC_POWERUP,
> > > +                     SGTL5000_VAG_POWERUP|SGTL5000_DAC_POWERUP);
> > > +             break;
> > > +
> > > +     case SND_SOC_DAPM_POST_PMD:
> > > +             snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER,
> > > +                     SGTL5000_DAC_POWERUP, 0);
> > > +             break;

> > Why does the powerdown not disable VAG_POWERUP?  My first thought was
> > that VAG_POWERUP ought to be a supply widget...

> My first version, VAG_POWERUP is a supply widget, but spec says:
> The headphone (and/or lineout) powerup should be set BEFORE clearing this bit.

> But the powerdown sequence go against it.
> So I turn to powerup VAG with DAC, and powerdown it before HP and Line_out.

The above doesn't seem to tie in with your code terribly well.  A
frequent issue throughout this code is that you're doing a bunch of
unusual stuff and it's really not clear what the code is supposed to do,
please work to make the code more comprehensible.  This is a problem
both from a legibility point of view and from the point of view of being
likely to break if the core changes.

The same issue applies to a lot of the other concerns I raised, for
brevity I've cut most of the discussion - in general the major issue
with the code is that it's really hard to read.

> > > +     switch (sys_fs / sgtl5000->lrclk) {
> > > +     case 4:
> > > +             clk_ctl |= SGTL5000_RATE_MODE_DIV_4 << SGTL5000_RATE_MODE_SHIFT;
> > > +             break;
> > > +     case 2:
> > > +             clk_ctl |= SGTL5000_RATE_MODE_DIV_2 << SGTL5000_RATE_MODE_SHIFT;
> > > +             break;
> > > +     default:
> > > +             break;
> > > +     }

> > I'd expect to see this error out if it can't find an appropriate
> > divider?

> the default means sys_fs / lrclk = 1, not a error.

So what happens when sys_fs / lrclk is not 1?  If nothing else the above
code needs to be *much* clearer.

      reply	other threads:[~2011-01-18 11:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-17  6:48 [PATCH v2] ASoC: Add FreeScale SGTL5000 codec suppor Zeng Zhaoming
2011-01-17 15:32 ` Mark Brown
2011-01-18  2:32   ` Zeng Zhaoming
2011-01-18 11:02     ` Mark Brown [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=20110118110255.GB26498@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=arnaud.patard@rtp-net.org \
    --cc=linuxzsc@gmail.com \
    --cc=lrg@slimlogic.co.uk \
    --cc=s.hauer@pengutronix.de \
    --cc=zengzm.kernel@gmail.com \
    --cc=zhaoming.zeng@freescale.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.