All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Rosin <peda@lysator.liu.se>
To: alsa-devel@alsa-project.org
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	linux-kernel@vger.kernel.org, Peter Rosin <peda@axentia.se>
Subject: NXP Semiconductors TFA9879 Amplifier Driver
Date: Sat,  8 Nov 2014 14:40:16 +0100	[thread overview]
Message-ID: <1415454017-4146-1-git-send-email-peda@lysator.liu.se> (raw)
In-Reply-To: <20141107111737.GJ8509@sirena.org.uk>

Mark Brown wrote:
> On Thu, Nov 06, 2014 at 05:39:45PM +0100, Peter Rosin wrote:
> 
> > +	{ TFA9879_MISC_STATUS,		0x0000 }, /* 0x15, read-only
> */
> 
> The fix here is the wrong way round - if the device is reporting status
> here there should be no default and there should be a volatile operation
> (though it's not the end of the world to omit that if it's not used).
> 
> Otherwise this looks good.

Ok, I think I finally see what you mean...

Diff since v2 below.

Cheers,
Peter

diff --git a/sound/soc/codecs/tfa9879.c b/sound/soc/codecs/tfa9879.c
index c48022639a29..16f1b71edb55 100644
--- a/sound/soc/codecs/tfa9879.c
+++ b/sound/soc/codecs/tfa9879.c
@@ -182,9 +182,13 @@ static struct reg_default tfa9879_regs[] = {
 	{ TFA9879_HIGH_PASS_FILTER,	0x0004 }, /* 0x12 */
 	{ TFA9879_VOLUME_CONTROL,	0x10bd }, /* 0x13 */
 	{ TFA9879_MISC_CONTROL,		0x0000 }, /* 0x14 */
-	{ TFA9879_MISC_STATUS,		0x0000 }, /* 0x15, read-only */
 };
 
+static bool tfa9879_volatile_reg(struct device *dev, unsigned int reg)
+{
+	return reg == TFA9879_MISC_STATUS;
+}
+
 static const DECLARE_TLV_DB_SCALE(volume_tlv, -7050, 50, 1);
 static const DECLARE_TLV_DB_SCALE(tb_gain_tlv, -1800, 200, 0);
 static const char * const tb_freq_text[] = {
@@ -240,6 +244,7 @@ static const struct regmap_config tfa9879_regmap = {
 	.reg_bits = 8,
 	.val_bits = 16,
 
+	.volatile_reg = tfa9879_volatile_reg,
 	.max_register = TFA9879_MISC_STATUS,
 	.reg_defaults = tfa9879_regs,
 	.num_reg_defaults = ARRAY_SIZE(tfa9879_regs),
@@ -285,7 +290,7 @@ static int tfa9879_i2c_probe(struct i2c_client *i2c,
 		return PTR_ERR(tfa9879->regmap);
 
 	/* Ensure the device is in reset state */
-	for (i = 0; i < ARRAY_SIZE(tfa9879_regs) - 1; i++)
+	for (i = 0; i < ARRAY_SIZE(tfa9879_regs); i++)
 		regmap_write(tfa9879->regmap,
 			     tfa9879_regs[i].reg, tfa9879_regs[i].def);
 


WARNING: multiple messages have this Message-ID (diff)
From: Peter Rosin <peda@lysator.liu.se>
To: alsa-devel@alsa-project.org
Cc: Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Peter Rosin <peda@axentia.se>,
	linux-kernel@vger.kernel.org
Subject: NXP Semiconductors TFA9879 Amplifier Driver
Date: Sat,  8 Nov 2014 14:40:16 +0100	[thread overview]
Message-ID: <1415454017-4146-1-git-send-email-peda@lysator.liu.se> (raw)
In-Reply-To: <20141107111737.GJ8509@sirena.org.uk>

Mark Brown wrote:
> On Thu, Nov 06, 2014 at 05:39:45PM +0100, Peter Rosin wrote:
> 
> > +	{ TFA9879_MISC_STATUS,		0x0000 }, /* 0x15, read-only
> */
> 
> The fix here is the wrong way round - if the device is reporting status
> here there should be no default and there should be a volatile operation
> (though it's not the end of the world to omit that if it's not used).
> 
> Otherwise this looks good.

Ok, I think I finally see what you mean...

Diff since v2 below.

Cheers,
Peter

diff --git a/sound/soc/codecs/tfa9879.c b/sound/soc/codecs/tfa9879.c
index c48022639a29..16f1b71edb55 100644
--- a/sound/soc/codecs/tfa9879.c
+++ b/sound/soc/codecs/tfa9879.c
@@ -182,9 +182,13 @@ static struct reg_default tfa9879_regs[] = {
 	{ TFA9879_HIGH_PASS_FILTER,	0x0004 }, /* 0x12 */
 	{ TFA9879_VOLUME_CONTROL,	0x10bd }, /* 0x13 */
 	{ TFA9879_MISC_CONTROL,		0x0000 }, /* 0x14 */
-	{ TFA9879_MISC_STATUS,		0x0000 }, /* 0x15, read-only */
 };
 
+static bool tfa9879_volatile_reg(struct device *dev, unsigned int reg)
+{
+	return reg == TFA9879_MISC_STATUS;
+}
+
 static const DECLARE_TLV_DB_SCALE(volume_tlv, -7050, 50, 1);
 static const DECLARE_TLV_DB_SCALE(tb_gain_tlv, -1800, 200, 0);
 static const char * const tb_freq_text[] = {
@@ -240,6 +244,7 @@ static const struct regmap_config tfa9879_regmap = {
 	.reg_bits = 8,
 	.val_bits = 16,
 
+	.volatile_reg = tfa9879_volatile_reg,
 	.max_register = TFA9879_MISC_STATUS,
 	.reg_defaults = tfa9879_regs,
 	.num_reg_defaults = ARRAY_SIZE(tfa9879_regs),
@@ -285,7 +290,7 @@ static int tfa9879_i2c_probe(struct i2c_client *i2c,
 		return PTR_ERR(tfa9879->regmap);
 
 	/* Ensure the device is in reset state */
-	for (i = 0; i < ARRAY_SIZE(tfa9879_regs) - 1; i++)
+	for (i = 0; i < ARRAY_SIZE(tfa9879_regs); i++)
 		regmap_write(tfa9879->regmap,
 			     tfa9879_regs[i].reg, tfa9879_regs[i].def);
 

  reply	other threads:[~2014-11-08 13:40 UTC|newest]

Thread overview: 21+ 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:53 ` 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
2014-11-06 14:37     ` Peter Rosin
2014-11-06 16:02       ` Mark Brown
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           ` 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               ` Peter Rosin [this message]
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 12:54   ` 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=1415454017-4146-1-git-send-email-peda@lysator.liu.se \
    --to=peda@lysator.liu.se \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peda@axentia.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 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.