All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: "Mylène Josserand" <mylene.josserand@bootlin.com>
Cc: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org,
	mark.rutland@arm.com, perex@perex.cz, tiwai@suse.com,
	alsa-devel@alsa-project.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, alexandre.belloni@bootlin.com
Subject: Re: [PATCH v1 2/4] ASoC: codecs: pcm179x: Add support for PCM1789
Date: Tue, 27 Feb 2018 22:56:29 +0100	[thread overview]
Message-ID: <20180227225629.5cc4e802@windsurf.lan> (raw)
In-Reply-To: <20180227212433.2189-3-mylene.josserand@bootlin.com>

Hello,

On Tue, 27 Feb 2018 22:24:31 +0100, Mylène Josserand wrote:

> diff --git a/sound/soc/codecs/pcm179x-i2c.c b/sound/soc/codecs/pcm179x-i2c.c
> index 795a0657c097..83a2e1508df8 100644
> --- a/sound/soc/codecs/pcm179x-i2c.c
> +++ b/sound/soc/codecs/pcm179x-i2c.c
> @@ -26,10 +26,13 @@
>  static int pcm179x_i2c_probe(struct i2c_client *client,
>  			      const struct i2c_device_id *id)
>  {
> -	struct regmap *regmap;
> +	struct regmap *regmap = NULL;

I don't think this change is useful, since regmap is always initialized
below anyway.


> +	if (mute)
> +		val = ~(PCM1789_MUTE_L_EN | PCM1789_MUTE_R_EN);

That's not really useful with regmap_update_bits() which already does
the masking, no?

> +	else
> +		val = PCM1789_MUTE_L_EN | PCM1789_MUTE_R_EN;
> +	ret = regmap_update_bits(priv->regmap, PCM1789_SOFT_MUTE,
> +				 PCM1789_MUTE_MASK, val);

Couldn't this be:

	if (mute)
		val = 0;
	else
		val = PCM1789_MUTE_MASK;

	ret = regmap_update_bits(priv->regmap, PCM1789_SOFT_MUTE,
				 PCM1789_MUTE_MASK, val);


> +static struct snd_soc_dai_driver pcm1789_dai = {
> +	.name = "pcm1789-hifi",
> +	.playback = {
> +		.stream_name = "Playback",
> +		.channels_min = 2,
> +		.channels_max = 2,
> +		.rates = SNDRV_PCM_RATE_CONTINUOUS,
> +		.rate_min = 10000,
> +		.rate_max = 200000,
> +		.formats = PCM1792A_FORMATS, },

Nit: the closing curly brace should be on a separate line.


> +	if (type == PCM1789)
> +		return devm_snd_soc_register_component(dev,
> +						       &soc_component_dev_pcm1789,
> +						       &pcm1789_dai, 1);
> +

Perhaps a "else" here ?

>  	return devm_snd_soc_register_component(dev,
>  			&soc_component_dev_pcm179x, &pcm179x_dai, 1);

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com

  reply	other threads:[~2018-02-27 21:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-27 21:24 [PATCH v1 0/4] ASoC: Add support for DAC PCM1789 Mylène Josserand
2018-02-27 21:24 ` [PATCH v1 1/4] ASoC: codecs: pcm179x: Add PCM1789 id Mylène Josserand
2018-02-27 21:51   ` Thomas Petazzoni
2018-03-01  7:43     ` Mylène Josserand
2018-03-01  7:43       ` Mylène Josserand
2018-03-01  9:04       ` Michael Nazzareno Trimarchi
2018-03-01  9:04         ` [alsa-devel] " Michael Nazzareno Trimarchi
2018-03-01 13:53         ` Mylène Josserand
2018-02-27 21:24 ` [PATCH v1 2/4] ASoC: codecs: pcm179x: Add support for PCM1789 Mylène Josserand
2018-02-27 21:56   ` Thomas Petazzoni [this message]
2018-03-01  7:47     ` Mylène Josserand
2018-03-01  7:47       ` Mylène Josserand
2018-02-27 21:24 ` [PATCH v1 3/4] ASoC: codecs: pcm179x: Add reset gpio Mylène Josserand
2018-02-27 22:02   ` Thomas Petazzoni
2018-03-01  7:48     ` Mylène Josserand
2018-03-01  7:48       ` Mylène Josserand
2018-02-27 22:30   ` Fabio Estevam
2018-03-01  8:13     ` Mylène Josserand
2018-02-27 21:24 ` [PATCH v1 4/4] ASoC: codecs: pcm179x: Add trigger function to perform a reset Mylène Josserand

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=20180227225629.5cc4e802@windsurf.lan \
    --to=thomas.petazzoni@bootlin.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mylene.josserand@bootlin.com \
    --cc=perex@perex.cz \
    --cc=robh+dt@kernel.org \
    --cc=tiwai@suse.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.