Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Barry Song <21cnbao@gmail.com>
Cc: uclinux-dist-devel@blackfin.uclinux.org, alsa-devel@alsa-project.org
Subject: Re: [PATCH 1/3] new ad1836 codec driver based on asoc
Date: Wed, 12 Aug 2009 14:46:45 +0100	[thread overview]
Message-ID: <20090812134645.GC11898@rakim.wolfsonmicro.main> (raw)
In-Reply-To: <1250051574-25119-2-git-send-email-21cnbao@gmail.com>

On Wed, Aug 12, 2009 at 12:32:52PM +0800, Barry Song wrote:
> There has been  an ad1836 driver in sound/blackfin based on traditional alsa.
> The new driver is based on asoc. The architecture of ad1836 codec driver
> is very much like ad1938.

This is mostly good, a few relatively minor issues though.

> +	SOC_DOUBLE_R("DAC3  Volume", AD1836_DAC_L3_VOL,
> +			AD1836_DAC_R3_VOL, 0, 0x3FF, 0),

You've got an extra space in the volume control names which I'd expect
to confuse user space.

> +       { "DAC1OUT", "DAC1 Switch", "DAC" },
> +       { "DAC2OUT", "DAC2 Switch", "DAC" },

I'm surprised this works since the switches weren't declared as DAPM
controls but if the core supports it that's OK.

> +static int ad1836_set_tdm_slot(struct snd_soc_dai *dai,
> +		unsigned int mask, int slots)
> +{

This needs updating for the new set_tdm_slot() API but given that
there's only one possible configuration I'd suggest just removing it -
the function does nothing other than check its arguments.

> +	reg = codec->read(codec, AD1836_DAC_CTRL1);
> +	reg = (reg & (~AD1836_DAC_WORD_LEN_MASK)) | word_len;
> +	codec->write(codec, AD1836_DAC_CTRL1, reg);

Not essential but snd_soc_update_bits() does the read/modify/write cycle
for you.

> +static struct spi_driver ad1836_spi_driver = {
> +	.driver = {
> +		.name	= "ad1836-spi",

Just "ad1836" - the fact that it's controlled via SPI is clear from the
fact that this is a struct spi_driver.

> +	ret = snd_soc_register_codec(codec);
> +	if (ret != 0) {
> +		dev_err(codec->dev, "Failed to register codec: %d\n", ret);
> +		return ret;
> +	}
> +
> +	ret = snd_soc_register_dai(&ad1836_dai);
> +	if (ret != 0) {
> +		dev_err(codec->dev, "Failed to register DAI: %d\n", ret);
> +		snd_soc_unregister_codec(codec);
> +		return ret;
> +	}

Should also be freeing the private data structure on error.

> +struct snd_soc_codec_device soc_codec_dev_ad1836 = {
> +	.probe = 	ad1836_probe,
> +	.remove = 	ad1836_remove,
> +	/* The power management of ad1836 is very simple. There are
> +	 * only adc&dac 2 components to control. Dapm handles them.
> +	 */
> +	.suspend =      NULL,
> +	.resume =       NULL,

The power control will be handled by DAPM but your driver still needs to
restore things like the volume settings - when the driver is powered off
the register settings will be forgotten.

  parent reply	other threads:[~2009-08-12 13:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-12  4:32 [PATCH 0/3] patch sequence adds analog devices ad1836 asoc support Barry Song
2009-08-12  4:32 ` [PATCH 1/3] new ad1836 codec driver based on asoc Barry Song
2009-08-12  4:32   ` [PATCH 2/3] add set_tdm_slot in tdm dai to define the relationship between audio channel and tdm slot Barry Song
2009-08-12  4:32     ` [PATCH 3/3] new board driver to connect bfin-5xx with ad1836 codec Barry Song
2009-08-12 16:10       ` Mark Brown
2009-08-13  4:19         ` Barry Song
2009-08-12 13:56     ` [PATCH 2/3] add set_tdm_slot in tdm dai to define the relationship between audio channel and tdm slot Mark Brown
2009-08-13  4:16       ` Barry Song
2009-08-12 13:46   ` Mark Brown [this message]
2009-08-13  3:41     ` [PATCH 1/3] new ad1836 codec driver based on asoc Barry Song
2009-08-13  9:08       ` Mark Brown
2009-08-13  9:22         ` [Uclinux-dist-devel] " Mike Frysinger
2009-08-13  9:34           ` Mike Frysinger
2009-08-13  9:37         ` Barry Song
2009-08-13  9:46           ` Mark Brown
2009-08-13  9:52             ` Barry Song
2009-08-13 10:00               ` Mark Brown

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=20090812134645.GC11898@rakim.wolfsonmicro.main \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=21cnbao@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=uclinux-dist-devel@blackfin.uclinux.org \
    /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