diff mbox

ASoC: rt5640: Add minimal support for RT5642

Message ID 1397654176-5736-1-git-send-email-jarkko.nikula@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jarkko Nikula April 16, 2014, 1:16 p.m. UTC
We have been using rt5640.c codec driver with RT5642 codec chip before commit
022d21f004c1 ("ASoC: rt5640: add rt5639 support"). That commits starts using
device ID reading in reset register for adding device specific controls and
routes runtime.

Now since device ID appears to be different between RT5640 and RT5642 the
driver doesn't add those controls and routes that are valid also on RT5642.

Fix this by adding a device ID found by debugging and minimal code for
supporting RT5642.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 sound/soc/codecs/rt5640.c | 2 ++
 sound/soc/codecs/rt5640.h | 1 +
 2 files changed, 3 insertions(+)

Comments

Bard Liao April 17, 2014, 1:59 a.m. UTC | #1
> -----Original Message-----
> From: Jarkko Nikula [mailto:jarkko.nikula@linux.intel.com]
> Sent: Wednesday, April 16, 2014 9:16 PM
> To: alsa-devel@alsa-project.org
> Cc: Mark Brown; Oder Chiou; Bard Liao; Liam Girdwood; Jarkko Nikula
> Subject: [PATCH] ASoC: rt5640: Add minimal support for RT5642
> 
> We have been using rt5640.c codec driver with RT5642 codec chip before commit
> 022d21f004c1 ("ASoC: rt5640: add rt5639 support"). That commits starts using
> device ID reading in reset register for adding device specific controls and routes
> runtime.
> 
> Now since device ID appears to be different between RT5640 and RT5642 the
> driver doesn't add those controls and routes that are valid also on RT5642.
> 
> Fix this by adding a device ID found by debugging and minimal code for supporting
> RT5642.
> 
> 
>  #define RT5639_RESET_ID				0x0008
>  #define RT5640_RESET_ID				0x000c
> +#define RT5642_RESET_ID				0x0006
> 

Actually, the device is store in bit 1 and 2. So we need a mask when reading the device ID.
I will send another patch for doing it.

> ------Please consider the environment before printing this e-mail.
diff mbox

Patch

diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
index b947c820697d..ffde5bf11789 100644
--- a/sound/soc/codecs/rt5640.c
+++ b/sound/soc/codecs/rt5640.c
@@ -2000,6 +2000,7 @@  static int rt5640_probe(struct snd_soc_codec *codec)
 
 	switch (snd_soc_read(codec, RT5640_RESET)) {
 	case RT5640_RESET_ID:
+	case RT5642_RESET_ID:
 		snd_soc_add_codec_controls(codec,
 			rt5640_specific_snd_controls,
 			ARRAY_SIZE(rt5640_specific_snd_controls));
@@ -2150,6 +2151,7 @@  static const struct regmap_config rt5640_regmap = {
 static const struct i2c_device_id rt5640_i2c_id[] = {
 	{ "rt5640", 0 },
 	{ "rt5639", 0 },
+	{ "rt5642", 0 },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, rt5640_i2c_id);
diff --git a/sound/soc/codecs/rt5640.h b/sound/soc/codecs/rt5640.h
index 3b50459a83b4..d31faeaa637e 100644
--- a/sound/soc/codecs/rt5640.h
+++ b/sound/soc/codecs/rt5640.h
@@ -16,6 +16,7 @@ 
 
 #define RT5639_RESET_ID				0x0008
 #define RT5640_RESET_ID				0x000c
+#define RT5642_RESET_ID				0x0006
 
 /* Info */
 #define RT5640_RESET				0x00