Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Adam Thomson <Adam.Thomson@diasemi.com>
Cc: alsa-devel@alsa-project.org, Michal Hajduk <Michal.Hajduk@diasemi.com>
Subject: Re: [PATCH v2 2/2] ASoC: codecs: Add DA732x codec driver
Date: Mon, 4 Jun 2012 15:30:44 +0100	[thread overview]
Message-ID: <20120604143043.GI7538@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <201205311426.q4VEQOpN009947@sw-eng-lt-apt-vm1>


[-- Attachment #1.1: Type: text/plain, Size: 2769 bytes --]

On Thu, May 31, 2012 at 03:18:01PM +0100, Adam Thomson wrote:
> This patch adds support for the Dialog DA732x audio codec.

A few small things below, very minor and easy to correct though.

> +	{ DA732X_REG_STATUS_EXT		, 0x00 },
> +	{ DA732X_REG_STATUS		, 0x00 },

> +	{ DA732X_REG_MBOX0		, 0x00 },
> +	{ DA732X_REG_MBOX1		, 0x00 },
> +	{ DA732X_REG_MBOX2		, 0x00 },
> +	{ DA732X_REG_MBOX_STATUS	, 0x00 },

> +	{ DA732X_REG_ID			, 0x00 },

> +	{ DA732X_REG_DMA_STATUS		, 0x00 },
> +	{ DA732X_REG_BROWNOUT		, 0x00 },

I would be very surprised if some or all of the above regsters aren't
volatile and therefore shouldn't have default specified.

> +static int da732x_hpf_set(struct snd_kcontrol *kcontrol,
> +			  struct snd_ctl_elem_value *ucontrol)

Why doesn't a standard enum work for this?

> +	/* High Pass Filters */
> +	SOC_ENUM_EXT("DAC1 High Pass Filter Mode Switch",
> +		     da732x_dac1_hpf_mode_enum, da732x_hpf_get, da732x_hpf_set),

This shouldn't be a Switch, it's an enumeration.  Switches are plain
boolean controls.

> +	SOC_SINGLE("ADC1 Equalizer Switch", DA732X_REG_ADC1_EQ5,
> +		   DA732X_EQ_EN_SHIFT, DA732X_EQ_EN_MAX, DA732X_NO_INVERT),
> +	SOC_SINGLE_TLV("ADC1 EQ Band 1 Volume", DA732X_REG_ADC1_EQ12,
> +		       DA732X_EQ_BAND1_SHIFT, DA732X_EQ_VOL_VAL_MAX,
> +		       DA732X_INVERT, eq_band_pga_tlv),

I'd suggest calling the Switch "ADC1 EQ Switch" for consistency with the
gains for the bands (or expanding EQ in the gains but that'll make for a
lot of really long control names).

> +	case SND_SOC_DAPM_POST_PMU:
> +		if (w->reg == DA732X_REG_ADC1_PD)
> +			snd_soc_update_bits(codec, DA732X_REG_CLK_EN3,
> +					    DA732X_ADCA_BB_CLK_EN,
> +					    DA732X_ADCA_BB_CLK_EN);
> +		else
> +			snd_soc_update_bits(codec, DA732X_REG_CLK_EN3,
> +					    DA732X_ADCC_BB_CLK_EN,
> +					    DA732X_ADCC_BB_CLK_EN);

This reads like it should be a switch statement.  The effect will be the
same but it's a bit clearer.

> +	da732x->regmap = devm_regmap_init_i2c(i2c, &da732x_regmap);
> +	if (IS_ERR(da732x->regmap)) {
> +		ret = PTR_ERR(da732x->regmap);
> +		dev_err(&i2c->dev, "Failed to initialize regmap\n");
> +		goto err;
> +	}
> +
> +	ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_da732x,
> +				     da732x_dai, ARRAY_SIZE(da732x_dai));

The register cache defaults make it look like there's a device ID
(or possibly chip revision?) register - it'd be good practice to read it
here and either verify that it has the expected value or log it
depending on which it is.

> +static const struct i2c_device_id da732x_i2c_id[] = {
> +	{ "da732x", 0},
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(i2c, da732x_i2c_id);

Good practice would be to enumerate all the device IDs (so users can
just register devices) but it doesn't really matter.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



       reply	other threads:[~2012-06-04 14:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201205311426.q4VEQOpN009947@sw-eng-lt-apt-vm1>
2012-06-04 14:30 ` Mark Brown [this message]
2012-06-06 10:36 [PATCH v2 2/2] ASoC: codecs: Add DA732x codec driver Adam Thomson

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=20120604143043.GI7538@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=Adam.Thomson@diasemi.com \
    --cc=Michal.Hajduk@diasemi.com \
    --cc=alsa-devel@alsa-project.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