alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Lu Guanqun <guanqun.lu@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>, Koul Vinod <vinod.koul@intel.com>,
	ALSA <alsa-devel@alsa-project.org>, Liam Girdwood <lrg@ti.com>,
	Wang Xingchao <xingchao.wang@intel.com>
Subject: Re: [PATCH v2 01/10] ASoC: upd9976: Add Renesas uPD9976 codec driver
Date: Fri, 6 May 2011 11:17:27 +0100	[thread overview]
Message-ID: <20110506101726.GF23729@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <20110506054603.26312.42120.stgit@localhost>

On Fri, May 06, 2011 at 01:46:03PM +0800, Lu Guanqun wrote:

> +static inline unsigned int upd9976_read(struct snd_soc_codec *codec,
> +					unsigned int reg)
> +{
> +	u8 value = 0;
> +	int ret;
> +
> +	ret = intel_scu_ipc_ioread8(reg, &value);
> +	if (ret)
> +		dev_err(codec->dev,
> +			"upd9976 read of 0x%x failed, error: %d\n", reg, ret);
> +	return value;
> +}

Please factor this stuff out.

> +/*
> + * Mixing Volume: from -25 dB to 6 dB in 1 dB steps.
> + */
> +static DECLARE_TLV_DB_SCALE(mixer_tlv, -2500, 100, 0);
> +
> +/*
> + * Audio DAC Volume: From -84 dB to 10.5 dB in 0.75 steps.
> + */
> +static DECLARE_TLV_DB_SCALE(adac_tlv, -8400, 75, 0);
> +static const struct snd_kcontrol_new upd9976_snd_controls[] = {

Use of blank lines here is really odd.

> +	SOC_DOUBLE_R_TLV("Master Volume",
> +			 UPD9976_AUDIOLVOL, UPD9976_AUDIORVOL,
> +			 0, 0x7f, 1, adac_tlv),
> +	SOC_DOUBLE_R_TLV("PCM Volume",
> +			 UPD9976_HPSPRLVOL, UPD9976_HPSPRRVOL,
> +			 0, 0x1f, 1, mixer_tlv),

PCM would usually be a digital audio stream but this is a control for a
mixer.

> +static struct snd_soc_dai_driver upd9976_dais[] = {
> +{
> +	.name = "upd9976-audio",

Previous issue with naming still applies.

> +	case SND_SOC_BIAS_PREPARE:
> +		if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) {
> +			snd_soc_update_bits(codec, UPD9976_VAUDIOCNT,
> +					    0x27, 0x27);
> +			snd_soc_update_bits(codec, UPD9976_VREFPLL,
> +					    0x35, 0x35);
> +		}
> +		break;
> +
> +	case SND_SOC_BIAS_STANDBY:
> +		snd_soc_write(codec, UPD9976_VAUDIOCNT, 0x25);
> +		snd_soc_write(codec, UPD9976_VREFPLL, 0x10);
> +		break;
> +
> +	case SND_SOC_BIAS_OFF:
> +		snd_soc_write(codec, UPD9976_VREFPLL, 0);
> +		snd_soc_write(codec, UPD9976_VAUDIOCNT, 0x24);
> +		break;

This is all very magic and lots of what's going on (especially with
VAUDIOCNT) looks like it's actually trying to fiddle with bitmasks.

  reply	other threads:[~2011-05-06 10:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-06  5:45 [PATCH v2 00/10] ASoC Support For Moorestown Lu Guanqun
2011-05-06  5:46 ` [PATCH v2 01/10] ASoC: upd9976: Add Renesas uPD9976 codec driver Lu Guanqun
2011-05-06 10:17   ` Mark Brown [this message]
2011-05-07 14:21     ` Lu Guanqun
2011-05-07 14:27       ` Mark Brown
2011-05-07 14:43         ` Lu Guanqun
2011-05-06  5:46 ` [PATCH v2 02/10] ASoC: sst_platform: modify current cpu dai driver to suit the needs for moorestown platform Lu Guanqun
2011-05-06  5:46 ` [PATCH v2 03/10] ASoC: mrst_machine: add moorestown machine driver Lu Guanqun
2011-05-06  5:46 ` [PATCH v2 04/10] ASoC: upd9976: add capture ability for dai driver Lu Guanqun
2011-05-06  5:46 ` [PATCH v2 05/10] ASoC: upd9976: add DMIC support Lu Guanqun
2011-05-06 11:07   ` Mark Brown
2011-05-06  5:46 ` [PATCH v2 06/10] ASoC: upd9976: add Analog MIC support Lu Guanqun
2011-05-06  5:46 ` [PATCH v2 07/10] ASoC: upd9976: add jack detection function Lu Guanqun
2011-05-06 12:53   ` Mark Brown
2011-05-06  5:46 ` [PATCH v2 08/10] ASoC: mrst_machine: add capture functionality Lu Guanqun
2011-05-06  5:46 ` [PATCH v2 09/10] ASoC: mrst_machine: add jack detection support Lu Guanqun
2011-05-06  5:46 ` [PATCH v2 10/10] ASoC: mrst_machine: add initial config to machine driver Lu Guanqun
2011-05-06 12:54   ` 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=20110506101726.GF23729@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=guanqun.lu@intel.com \
    --cc=lrg@ti.com \
    --cc=tiwai@suse.de \
    --cc=vinod.koul@intel.com \
    --cc=xingchao.wang@intel.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).