Thread (15 messages) flat view 15 messages, 4 authors, 2018-03-01

Re: [PATCH v1 2/4] ASoC: codecs: pcm179x: Add support for PCM1789

From: Mylène Josserand <hidden>
Date: 2018-03-01 07:47:29
Also in: alsa-devel, lkml

Hello,

On Tue, 27 Feb 2018 22:56:29 +0100
Thomas Petazzoni [off-list ref] wrote:
Hello,

On Tue, 27 Feb 2018 22:24:31 +0100, Mylène Josserand wrote:
quoted
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.
okay.
quoted
+	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?
Yep
quoted
+	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);
I will update my V2 with it.
quoted
+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.
Yep, thanks.
quoted
+	if (type == PCM1789)
+		return devm_snd_soc_register_component(dev,
+						       &soc_component_dev_pcm1789,
+						       &pcm1789_dai, 1);
+  
Perhaps a "else" here ?
Sure
quoted
 	return devm_snd_soc_register_component(dev,
 			&soc_component_dev_pcm179x, &pcm179x_dai, 1);  
Thanks!

Thomas
Thank you,

Mylène

-- 
Mylène Josserand, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help