All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Michael Williamson <michael.williamson@criticallink.com>
Cc: alsa-devel@alsa-project.org, lars@metafoo.de, lrg@ti.com, leon@leon.nu
Subject: Re: [PATCH] ASoC: dsd1791: Introduce driver for TI DSD1791 stereo codec
Date: Tue, 20 Dec 2011 00:39:17 +0000	[thread overview]
Message-ID: <20111220003916.GE2860@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1324320810-17948-1-git-send-email-michael.williamson@criticallink.com>

On Mon, Dec 19, 2011 at 01:53:30PM -0500, Michael Williamson wrote:

> +/* DSD1791 register cache (16 through 23 are used) */
> +static const u8 dsd1791_reg[] = {
> +	[16] = 0xFF,
> +	[17] = 0xFF,
> +	[18] = 0x50,
> +	[19] = 0x00,
> +	[20] = 0x00,
> +	[21] = 0x01,
> +	[22] = 0x00,
> +	[23] = 0x00,
> +};

Use the regmap API.

> +	reg = snd_soc_read(codec, DSD1791_REG_AUDFMT);
> +	reg &= ~(DSD1791_FMT_MASK);
> +	reg |= fmt;
> +	return snd_soc_write(codec, DSD1791_REG_AUDFMT, reg);

snd_soc_update_bits().

> +static const struct snd_kcontrol_new dsd1791_snd_controls[] = {
> +	SOC_SINGLE("Left Playback Volume", DSD1791_REG_DIGATT_L, 0, 255, 0),
> +	SOC_SINGLE("Right Playback Volume", DSD1791_REG_DIGATT_R, 0, 255, 0),

This should be a single stereo control and you should supply dB data.

> +	/* enable attenuation control */
> +	reg = snd_soc_read(codec, DSD1791_REG_AUDFMT);
> +	reg |= 0x80;
> +	snd_soc_write(codec, DSD1791_REG_AUDFMT, reg);

This should probably be runtime controllable, or if it's got a good
reason for not being it should be using snd_soc_update_bits().

> +	snd_soc_add_controls(codec, dsd1791_snd_controls,
> +				ARRAY_SIZE(dsd1791_snd_controls));

Initialize the controls from the driver.

      parent reply	other threads:[~2011-12-20  0:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-19 18:53 [PATCH] ASoC: dsd1791: Introduce driver for TI DSD1791 stereo codec Michael Williamson
2011-12-19 21:44 ` Liam Girdwood
2011-12-19 22:26   ` Michael Williamson
2011-12-20  0:40     ` Mark Brown
2011-12-20  0:39 ` 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=20111220003916.GE2860@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=lars@metafoo.de \
    --cc=leon@leon.nu \
    --cc=lrg@ti.com \
    --cc=michael.williamson@criticallink.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.