mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: max98090: Add check for CODEC type
@ 2014-07-04  9:12 Tushar Behera
  2014-07-04  9:12 ` [PATCH 2/2] ASoC: max98090: Remove redundant max98090_handle_pdata() Tushar Behera
  2014-07-04 19:30 ` [PATCH 1/2] ASoC: max98090: Add check for CODEC type Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Tushar Behera @ 2014-07-04  9:12 UTC (permalink / raw)
  To: linux-kernel, alsa-devel; +Cc: tiwai, perex, broonie, lgirdwood, trblinux

CODEC type (MAX98090/MAX98091) can be specified from device-tree file,
it can also be obtained from the CODEC during runtime.

Add an explicit check to figure out if both are matching, else print
a message warning about the same.

Signed-off-by: Tushar Behera <tushar.b@samsung.com>
---
 sound/soc/codecs/max98090.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index ca74f502..1ed06d9 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -2215,6 +2215,7 @@ static int max98090_probe(struct snd_soc_codec *codec)
 {
 	struct max98090_priv *max98090 = snd_soc_codec_get_drvdata(codec);
 	struct max98090_cdata *cdata;
+	enum max98090_type devtype;
 	int ret = 0;
 
 	dev_dbg(codec->dev, "max98090_probe\n");
@@ -2250,16 +2251,21 @@ static int max98090_probe(struct snd_soc_codec *codec)
 	}
 
 	if ((ret >= M98090_REVA) && (ret <= M98090_REVA + 0x0f)) {
-		max98090->devtype = MAX98090;
+		devtype = MAX98090;
 		dev_info(codec->dev, "MAX98090 REVID=0x%02x\n", ret);
 	} else if ((ret >= M98091_REVA) && (ret <= M98091_REVA + 0x0f)) {
-		max98090->devtype = MAX98091;
+		devtype = MAX98091;
 		dev_info(codec->dev, "MAX98091 REVID=0x%02x\n", ret);
 	} else {
-		max98090->devtype = MAX98090;
+		devtype = MAX98090;
 		dev_err(codec->dev, "Unrecognized revision 0x%02x\n", ret);
 	}
 
+	if (max98090->devtype != devtype) {
+		dev_warn(codec->dev, "Mismatch in DT specified CODEC type.\n");
+		max98090->devtype = devtype;
+	}
+
 	max98090->jack_state = M98090_JACK_STATE_NO_HEADSET;
 
 	INIT_DELAYED_WORK(&max98090->jack_work, max98090_jack_work);
-- 
1.7.9.5


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

* [PATCH 2/2] ASoC: max98090: Remove redundant max98090_handle_pdata()
  2014-07-04  9:12 [PATCH 1/2] ASoC: max98090: Add check for CODEC type Tushar Behera
@ 2014-07-04  9:12 ` Tushar Behera
  2014-07-04 19:30 ` [PATCH 1/2] ASoC: max98090: Add check for CODEC type Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Tushar Behera @ 2014-07-04  9:12 UTC (permalink / raw)
  To: linux-kernel, alsa-devel; +Cc: tiwai, perex, broonie, lgirdwood, trblinux

max98090_handle_pdata() is not doing anything other than printing
a message if pdata is not valid. This can be removed.

Signed-off-by: Tushar Behera <tushar.b@samsung.com>
---
 sound/soc/codecs/max98090.c |   13 -------------
 1 file changed, 13 deletions(-)

diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index 1ed06d9..b2b3286 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -2200,17 +2200,6 @@ static struct snd_soc_dai_driver max98090_dai[] = {
 }
 };
 
-static void max98090_handle_pdata(struct snd_soc_codec *codec)
-{
-	struct max98090_priv *max98090 = snd_soc_codec_get_drvdata(codec);
-	struct max98090_pdata *pdata = max98090->pdata;
-
-	if (!pdata) {
-		dev_err(codec->dev, "No platform data\n");
-		return;
-	}
-}
-
 static int max98090_probe(struct snd_soc_codec *codec)
 {
 	struct max98090_priv *max98090 = snd_soc_codec_get_drvdata(codec);
@@ -2310,8 +2299,6 @@ static int max98090_probe(struct snd_soc_codec *codec)
 	snd_soc_update_bits(codec, M98090_REG_MIC_BIAS_VOLTAGE,
 		M98090_MBVSEL_MASK, M98090_MBVSEL_2V8);
 
-	max98090_handle_pdata(codec);
-
 	max98090_add_widgets(codec);
 
 err_access:
-- 
1.7.9.5


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

* Re: [PATCH 1/2] ASoC: max98090: Add check for CODEC type
  2014-07-04  9:12 [PATCH 1/2] ASoC: max98090: Add check for CODEC type Tushar Behera
  2014-07-04  9:12 ` [PATCH 2/2] ASoC: max98090: Remove redundant max98090_handle_pdata() Tushar Behera
@ 2014-07-04 19:30 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2014-07-04 19:30 UTC (permalink / raw)
  To: Tushar Behera; +Cc: linux-kernel, alsa-devel, tiwai, perex, lgirdwood, trblinux

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

On Fri, Jul 04, 2014 at 02:42:16PM +0530, Tushar Behera wrote:
> CODEC type (MAX98090/MAX98091) can be specified from device-tree file,
> it can also be obtained from the CODEC during runtime.

Applied both, thanks.

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

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

end of thread, other threads:[~2014-07-04 19:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-04  9:12 [PATCH 1/2] ASoC: max98090: Add check for CODEC type Tushar Behera
2014-07-04  9:12 ` [PATCH 2/2] ASoC: max98090: Remove redundant max98090_handle_pdata() Tushar Behera
2014-07-04 19:30 ` [PATCH 1/2] ASoC: max98090: Add check for CODEC type 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®