linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@secretlab.ca>
To: Liam Girdwood <liam.girdwood@wolfsonmicro.com>
Cc: linuxppc-dev@ozlabs.org, alsa-devel@alsa-project.org,
	broonie@opensource.wolfsonmicro.com, timur@freescale.com
Subject: Re: [alsa-devel] [PATCH 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver
Date: Sat, 12 Jul 2008 00:00:18 -0600	[thread overview]
Message-ID: <20080712060018.GB23213@secretlab.ca> (raw)
In-Reply-To: <1214995713.4882.54.camel@localhost.localdomain>

On Wed, Jul 02, 2008 at 11:48:33AM +0100, Liam Girdwood wrote:
> On Tue, 2008-07-01 at 17:53 -0600, Grant Likely wrote:
> > From: Grant Likely <grant.likely@secretlab.ca>
> > 
> > ASoC Codec driver for the TLV320AIC26 device.  This driver uses the ASoC
> > v1 API, so I don't expect it to get merged as-is, but I want to get it
> > out there for review.
> > ---
> 
> Fwiw, I usually put all the codec registers defs in a separate header
> just in case we need to do any codec stuff in the machine driver.

okay, done

> > +	switch (params_rate(params)) {
> > +	 case 8000: fsref = 48000; divisor = AIC26_DIV_6; break;
> > +	 case 11025: fsref = 44100; divisor = AIC26_DIV_4; break;
> > +	 case 12000: fsref = 48000; divisor = AIC26_DIV_4; break;
> > +	 case 16000: fsref = 48000; divisor = AIC26_DIV_3; break;
> > +	 case 22050: fsref = 44100; divisor = AIC26_DIV_2; break;
> > +	 case 24000: fsref = 48000; divisor = AIC26_DIV_2; break;
> > +	 case 32000: fsref = 48000; divisor = AIC26_DIV_1_5; break;
> > +	 case 44100: fsref = 44100; divisor = AIC26_DIV_1; break;
> > +	 case 48000: fsref = 48000; divisor = AIC26_DIV_1; break;
> > +	 default: dev_dbg(&aic26->spi->dev, "bad rate\n"); return -EINVAL;
> > +	}
> > +
> 
> Indentation.

done.

> > +	/* Configure PLL */
> > +	pval = 1;
> > +	jval = (fsref == 44100) ? 7 : 8;
> > +	dval = (fsref == 44100) ? 5264 : 1920;
> > +	qval = 0;
> > +	reg = 0x8000 | qval << 11 | pval << 8 | jval << 2;
> > +	aic26_reg_write(codec, AIC26_REG_PLL_PROG1, reg);
> > +	reg = dval << 2;
> > +	aic26_reg_write(codec, AIC26_REG_PLL_PROG2, reg);
> > +
> 
> PLL/FLL/clock config is usually done in a separate function
> (codec_set_pll(), callable by machine driver) so that we can change
> clocks depending on the available machine clocks and srate. 
> 
> > +	/* Power up CODEC */
> > +	aic26_reg_write(codec, AIC26_REG_POWER_CTRL, 0);
> > +
> 
> Codec domain (i.e Bias power) PM stuff should be done in
> codec_dapm_event(). This allows us to power the codec on when we do
> things like sidetone (with no active playback or capture stream).
> 

Ugh, I'm going to have to leave these two for now.  I don't understand
enough about the ASoC structure yet to understand what it should look
like.  I'll probably need help, but I don't think I can get it sorted
out before the merge window.

Do these two comments need to be addressed before the driver is merged?

> > +static ssize_t aic26_regs_show(struct device *dev,
> > +				struct device_attribute *attr, char *buf)
> > +{
> > +	struct aic26 *aic26 = dev_get_drvdata(dev);
> > +	char *idx = buf;
> > +	int cache_flag, addr, page, i, reg;
> > +
> > +	cache_flag = (strcmp(attr->attr.name, "regs_cache") == 0);
> > +
> > +	for (page = 0; page < 3; page++) {
> > +		for (i = 0; i < 0x20; i++) {
> > +			addr = AIC26_PAGE_ADDR(page, i);
> > +			if (i % 8 == 0)
> > +				idx += sprintf(idx, "%i:%.2i:", page,i);
> > +			if (cache_flag)
> > +				reg = aic26_reg_read_cache(&aic26->codec, addr);
> > +			else
> > +				reg = aic26_reg_read(&aic26->codec, addr);
> > +			idx += sprintf(idx, " %.4x", reg);
> > +			if (i % 8 == 7)
> > +				idx += sprintf(idx, "\n");
> > +		}
> > +	}
> > +	return idx - buf;
> > +}
> > +
> 
> The soc_core already has a codec reg dump sysfs file, so we don't need
> this.

Hmmm, I haven't been able to find this; either in the code or on a live
running system.  Where is the common reg dump implemented.

Thanks for the comments.
g.

  reply	other threads:[~2008-07-12  6:00 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-01 23:53 [PATCH 1/3] ALSA SoC: Add OpenFirmware helper for matching bus and codec drivers Grant Likely
2008-07-01 23:53 ` [PATCH 2/3] ALSA SoC: Add mpc5200-psc I2S driver Grant Likely
2008-07-02 10:34   ` [alsa-devel] " Liam Girdwood
2008-07-02 13:51   ` Jon Smirl
2008-07-03 16:28     ` Grant Likely
2008-07-04 11:03       ` Timur Tabi
2008-07-04 14:41         ` Grant Likely
2008-07-05  1:28         ` David Gibson
2008-07-02 15:19   ` Jon Smirl
2008-07-03 16:30     ` Grant Likely
2008-07-06 17:56   ` Jon Smirl
2008-07-07 10:59     ` Mark Brown
2008-07-07 13:23       ` Jon Smirl
2008-07-12  6:26         ` Grant Likely
2008-07-07 16:32   ` Jon Smirl
2008-07-12  6:30     ` Grant Likely
2008-07-09  8:22   ` new to sound world
2008-07-01 23:53 ` [PATCH 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver Grant Likely
2008-07-02 10:48   ` [alsa-devel] " Liam Girdwood
2008-07-12  6:00     ` Grant Likely [this message]
2008-07-12 17:36       ` Mark Brown
2008-07-12 18:13         ` Grant Likely
2008-07-17 23:31         ` Grant Likely
2008-07-18  9:58           ` Mark Brown
2008-07-18 16:14             ` Grant Likely
2008-07-02 13:52   ` Jon Smirl
2008-07-02 16:08     ` Liam Girdwood
2008-07-04 20:49   ` Mark Brown
2008-07-04 23:44     ` Grant Likely
2008-07-02  9:50 ` [alsa-devel] [PATCH 1/3] ALSA SoC: Add OpenFirmware helper for matching bus and codec drivers Takashi Iwai
2008-07-02 15:48   ` Grant Likely
2008-07-02 15:57     ` Liam Girdwood
2008-07-02 13:50 ` Jon Smirl
2008-07-02 15:27 ` Jon Smirl
2008-07-03 16:33   ` Grant Likely
2008-07-04 11:05     ` Timur Tabi

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=20080712060018.GB23213@secretlab.ca \
    --to=grant.likely@secretlab.ca \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=liam.girdwood@wolfsonmicro.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=timur@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 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).