mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Peter Rosin <peda@lysator.liu.se>
Cc: alsa-devel@alsa-project.org, Liam Girdwood <lgirdwood@gmail.com>,
	linux-kernel@vger.kernel.org, Peter Rosin <peda@axentia.se>
Subject: Re: [PATCH 1/2] ASoC: tfa9879: New driver for NXP Semiconductors TFA9879 amplifier.
Date: Thu, 6 Nov 2014 13:37:20 +0000	[thread overview]
Message-ID: <20141106133720.GG8509@sirena.org.uk> (raw)
In-Reply-To: <1415278441-27866-2-git-send-email-peda@lysator.liu.se>

[-- Attachment #1: Type: text/plain, Size: 1578 bytes --]

On Thu, Nov 06, 2014 at 01:54:00PM +0100, Peter Rosin wrote:

> +#define TFA9879_REG(codec, reg, field, value)				\
> +	snd_soc_update_bits(codec, TFA9879_ ## reg,			\
> +			    TFA9879_ ## field ## _MASK,			\
> +			    (value) << TFA9879_ ## field ## _SHIFT)

Please don't do stuff like this, it just makes the code look more
obscure than it should be for people who work with multiple devices -
just use update_bits() directly.

> +static int tfa9879_prepare(struct snd_pcm_substream *substream,
> +			   struct snd_soc_dai *dai)
> +{
> +	struct snd_soc_codec *codec = dai->codec;
> +
> +	TFA9879_REG(codec, DEVICE_CONTROL, POWERUP, 1);

Use DAPM to manage power, you're probably looking for a supply widget.

> +	switch (params_format(params)) {
> +	case SNDRV_PCM_FORMAT_S16_LE:

Use params_width() rather than a specific memory layout.

> +	if (tfa9879->lsb_justified)
> +		TFA9879_REG(codec, SERIAL_INTERFACE_1, I2S_SET, i2s_set);

Why does this need to be reset every time, shouldn't we just be setting
the register in set_fmt().?

> +static int tfa9879_probe(struct snd_soc_codec *codec)
> +{
> +	struct tfa9879_priv *tfa9879 = snd_soc_codec_get_drvdata(codec);
> +
> +	codec->control_data = tfa9879->regmap;

This is redundant, just remove the entire function - ASoC will get the
regmap automatically.

> +	{ TFA9879_MISC_STATUS,		0x0000 }, /* 0x15, read-only */
> +};
> +
> +static bool tfa9879_volatile_register(struct device *dev, unsigned int reg)
> +{
> +	return reg == TFA9879_MISC_STATUS;

If the register is volatile it shouldn't have a default value provided.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  parent reply	other threads:[~2014-11-06 13:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-06 12:53 NXP Semiconductors TFA9879 Amplifier Driver Peter Rosin
2014-11-06 12:54 ` [PATCH 1/2] ASoC: tfa9879: New driver for NXP Semiconductors TFA9879 amplifier Peter Rosin
2014-11-06 13:27   ` [alsa-devel] " Lars-Peter Clausen
2014-11-06 13:37   ` Mark Brown [this message]
2014-11-06 14:37     ` Peter Rosin
2014-11-06 16:02       ` Mark Brown
2014-11-06 16:39         ` [v2] NXP Semiconductors TFA9879 Amplifier Driver Peter Rosin
2014-11-06 16:39           ` [PATCH v2] ASoC: tfa9879: New driver for NXP Semiconductors TFA9879 amplifier Peter Rosin
2014-11-07 11:17             ` Mark Brown
2014-11-08 13:40               ` NXP Semiconductors TFA9879 Amplifier Driver Peter Rosin
2014-11-08 13:40                 ` [PATCH v3] ASoC: tfa9879: New driver for NXP Semiconductors TFA9879 amplifier Peter Rosin
2014-11-09  9:46                   ` Mark Brown
2014-11-06 12:54 ` [PATCH 2/2] ASoC: tfa9879: Add bass and treble gain/freq controls Peter Rosin
2014-11-06 13:17   ` [alsa-devel] " Lars-Peter Clausen
2014-11-06 13:40   ` Mark Brown
2014-11-06 13:15 ` NXP Semiconductors TFA9879 Amplifier Driver Frans Klaver

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=20141106133720.GG8509@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peda@axentia.se \
    --cc=peda@lysator.liu.se \
    /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

all inboxes | Powered by JetHome®