mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Change the prototype of soc_widget_read
@ 2014-01-14 23:31 Arun Shamanna Lakshmi
  2014-01-14 23:31 ` [PATCH] ASoC: dapm: Change " Arun Shamanna Lakshmi
  0 siblings, 1 reply; 3+ messages in thread
From: Arun Shamanna Lakshmi @ 2014-01-14 23:31 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: perex, tiwai, alsa-devel, linux-kernel, Arun Shamanna Lakshmi

soc_widget_read API returns the register data and it is possible
that a register can contain 0xffffffff at any point of time.
In such cases snd_soc_widget_write is not called after the read
operation inside snd_soc_update_bits_locked API. Thus, change
the prototype of soc_widget_read to return only the error code
and pass the register data through the pointer argument.

Arun Shamanna Lakshmi (1):
  ASoC: dapm: Change prototype of soc_widget_read

 sound/soc/soc-dapm.c |   26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] ASoC: dapm: Change prototype of soc_widget_read
  2014-01-14 23:31 [PATCH] Change the prototype of soc_widget_read Arun Shamanna Lakshmi
@ 2014-01-14 23:31 ` Arun Shamanna Lakshmi
  2014-01-15 11:44   ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Arun Shamanna Lakshmi @ 2014-01-14 23:31 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: perex, tiwai, alsa-devel, linux-kernel, Arun Shamanna Lakshmi

soc_widget_read API returns the register data and it is possible
that a register can contain 0xffffffff. Thus, change the prototype
of soc_widget_read to return only the error code and pass the reg
data through pointer argument.

Signed-off-by: Arun Shamanna Lakshmi <aruns@nvidia.com>
---
 sound/soc/soc-dapm.c |   26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 51b4c19..2a44fe9 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -371,12 +371,16 @@ static void dapm_reset(struct snd_soc_card *card)
 	}
 }
 
-static int soc_widget_read(struct snd_soc_dapm_widget *w, int reg)
+static int soc_widget_read(struct snd_soc_dapm_widget *w, int reg,
+	unsigned int *value)
 {
-	if (w->codec)
-		return snd_soc_read(w->codec, reg);
-	else if (w->platform)
-		return snd_soc_platform_read(w->platform, reg);
+	if (w->codec) {
+		*value = snd_soc_read(w->codec, reg);
+		return 0;
+	} else if (w->platform) {
+		*value = snd_soc_platform_read(w->platform, reg);
+		return 0;
+	}
 
 	dev_err(w->dapm->dev, "ASoC: no valid widget read method\n");
 	return -1;
@@ -430,13 +434,12 @@ static int soc_widget_update_bits_locked(struct snd_soc_dapm_widget *w,
 			return ret;
 	} else {
 		soc_widget_lock(w);
-		ret = soc_widget_read(w, reg);
+		ret = soc_widget_read(w, reg, &old);
 		if (ret < 0) {
 			soc_widget_unlock(w);
 			return ret;
 		}
 
-		old = ret;
 		new = (old & ~mask) | (value & mask);
 		change = old != new;
 		if (change) {
@@ -513,7 +516,7 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w,
 		unsigned int invert = mc->invert;
 
 		if (reg != SND_SOC_NOPM) {
-			val = soc_widget_read(w, reg);
+			soc_widget_read(w, reg, &val);
 			val = (val >> shift) & mask;
 			if (invert)
 				val = max - val;
@@ -529,7 +532,7 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w,
 			w->kcontrol_news[i].private_value;
 		int val, item;
 
-		val = soc_widget_read(w, e->reg);
+		soc_widget_read(w, e->reg, &val);
 		item = (val >> e->shift_l) & e->mask;
 
 		if (item < e->max && !strcmp(p->name, e->texts[item]))
@@ -558,7 +561,7 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w,
 			w->kcontrol_news[i].private_value;
 		int val, item;
 
-		val = soc_widget_read(w, e->reg);
+		soc_widget_read(w, e->reg, &val);
 		val = (val >> e->shift_l) & e->mask;
 		for (item = 0; item < e->max; item++) {
 			if (val == e->values[item])
@@ -2782,7 +2785,8 @@ int snd_soc_dapm_new_widgets(struct snd_soc_card *card)
 
 		/* Read the initial power state from the device */
 		if (w->reg >= 0) {
-			val = soc_widget_read(w, w->reg) >> w->shift;
+			soc_widget_read(w, w->reg, &val);
+			val = val >> w->shift;
 			val &= w->mask;
 			if (val == w->on_val)
 				w->power = 1;
-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: dapm: Change prototype of soc_widget_read
  2014-01-14 23:31 ` [PATCH] ASoC: dapm: Change " Arun Shamanna Lakshmi
@ 2014-01-15 11:44   ` Mark Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2014-01-15 11:44 UTC (permalink / raw)
  To: Arun Shamanna Lakshmi; +Cc: lgirdwood, perex, tiwai, alsa-devel, linux-kernel

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

On Tue, Jan 14, 2014 at 03:31:54PM -0800, Arun Shamanna Lakshmi wrote:
> soc_widget_read API returns the register data and it is possible
> that a register can contain 0xffffffff. Thus, change the prototype
> of soc_widget_read to return only the error code and pass the reg
> data through pointer argument.

Applied, thanks.  Don't send cover letters for single patches, if there
is anything extra in there put it in the changelog or after the --- but
otherwise it's just an extra mail to read.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-15 11:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-14 23:31 [PATCH] Change the prototype of soc_widget_read Arun Shamanna Lakshmi
2014-01-14 23:31 ` [PATCH] ASoC: dapm: Change " Arun Shamanna Lakshmi
2014-01-15 11:44   ` Mark Brown

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®