All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: tim.howe@cirrus.com
Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com,
	paul.handrigan@cirrus.com
Subject: Re: [PATCH v5] ASoC: cs53l30: Add support for Cirrus Logic CS53L30
Date: Mon, 28 Mar 2016 10:51:50 +0100	[thread overview]
Message-ID: <20160328095150.GB2350@sirena.org.uk> (raw)
In-Reply-To: <1458082066-2859-1-git-send-email-tim.howe@cirrus.com>


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

On Tue, Mar 15, 2016 at 05:47:46PM -0500, tim.howe@cirrus.com wrote:

> +/* ADC Preamp gain select */
> +static const char * const cs53l30_preamp_gain_sel_text[] = {
> +	"0dB", "10dB", "20dB"};
> +
> +static const struct soc_enum adc1a_preamp_gain_enum =
> +	SOC_ENUM_SINGLE(CS53L30_ADC1A_AFE_CTL, 6,
> +		ARRAY_SIZE(cs53l30_preamp_gain_sel_text),
> +		cs53l30_preamp_gain_sel_text);

Why are you writing volume controls as enums?  Please use normal volume
controls with TLV information.

> +/* Set MIC Bias Voltage Control */
> +static const char * const cs53l30_micbias_text[] = {
> +	"HiZ", "1.8V", "2.75V"};

Why is this exposed to userspace and not platform data like other bias
controls?  The voltage to use will normally be determined by the
hardware design and the enable/disable should be managed via DAPM.

> +	case SND_SOC_DAPM_PRE_PMU:
> +		regmap_update_bits(priv->regmap, CS53L30_ASP1_CTL,
> +				   CS53L30_ASP1_3ST, 0);
> +		break;
> +	case SND_SOC_DAPM_POST_PMD:
> +		regmap_update_bits(priv->regmap, CS53L30_ASP1_CTL,
> +				   CS53L30_ASP1_3ST, 1);
> +		break;

Could this be a supply widget?

> +	regmap_read(priv->regmap, CS53L30_MCLKCTL, &mclk_ctl);
> +	mclk_ctl &= ~CS53L30_MCLK_DIV;
> +	mclk_ctl |= cs53l30_mclkx_coeffs[mclkx_coeff].mclkdiv;
> +
> +	regmap_update_bits(priv->regmap, CS53L30_MCLKCTL, CS53L30_MCLK_DIV,
> +			   mclk_ctl << CS53L30_MCLK_DIV);

You're using regmap_update_bits() but still implementing a manual
read/modify write cycle.  Just use regmap_update_bits.

> +	regmap_read(priv->regmap, CS53L30_ASPCFG_CTL, &asp_config_ctl);
> +
> +	switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
> +	case SND_SOC_DAIFMT_CBM_CFM:
> +		asp_config_ctl |= CS53L30_ASP_MS;

> +	priv->asp_config_ctl = asp_config_ctl;

The driver appears to be mixing use of priv->asp_config_ctl and the
physical value, that seems likely to go wrong somewhere along the line.
Either the variable is authorative and we should always work from that
then write it to the device when needed or the device is authorative but
currently we're mixing both.

> +	regmap_update_bits(priv->regmap, CS53L30_ASPCFG_CTL,
> +			   CS53L30_ASP_RATE_MASK, priv->asp_config_ctl);

We also write out via update_bits but don't specify all the bits
sometimes...

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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



  reply	other threads:[~2016-03-29  7:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-15 22:47 [PATCH v5] ASoC: cs53l30: Add support for Cirrus Logic CS53L30 tim.howe
2016-03-28  9:51 ` Mark Brown [this message]
2016-05-17 23:43 ` Nicolin Chen
2016-05-31 16:53   ` Mark Brown
2016-05-31 17:10     ` Caleb Crome
2016-05-31 17:33       ` Handrigan, Paul
2016-05-31 17:35       ` Mark Brown
2016-05-31 22:32         ` Caleb Crome
2016-06-02 17:17           ` Mark Brown
2016-06-02 17:40             ` Caleb Crome
2016-06-02 18:40               ` Mark Brown
2016-06-05 16:48                 ` Caleb Crome
2016-06-06 18:11                   ` 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=20160328095150.GB2350@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=lgirdwood@gmail.com \
    --cc=paul.handrigan@cirrus.com \
    --cc=tim.howe@cirrus.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.