Skip to contentSkip to conversation

Update Freescale MPC8610 codec driver naming

PATCH Applied Timur Tabi 2 participants 2 messages Jun 2, 2008 – Jun 3, 2008

Subsystems (3)
lore
Share & tools
lore

Timur Tabi

author
#0 lore raw

PATCH v2 1/1 Update Freescale MPC8610 codec driver naming

Change the Freescale MPC8610 HPCD codec and fabric drivers to use the codec name and id, instead of just the name, to match codec instances. Previously, the codec and fabric drivers would create a name string based on the I2C bus and address. Instead, keep the name as "cs4270" and combine the bus and address into a unique number.

---

My patch, "Add CS4270 i2c data to fsl_soc.c" must be applied for these drivers to work.

 sound/soc/codecs/cs4270.c    |   21 ++++--
 sound/soc/fsl/mpc8610_hpcd.c |  147 +++++++++++++++++++++---------------------
 2 files changed, 88 insertions(+), 80 deletions(-)
sound/soc/codecs/cs4270.c +14 -7
index 410fed5..df3294d 100644
@@ -23,6 +23,8 @@
  * 7) The only supported control is volume and hardware mute (if enabled)
  */
 
+#define DEBUG
+
 #include <linux/module.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -119,7 +121,6 @@
  */
 struct cs4270_private {
 	struct snd_soc_codec codec;
-	char name[16];
 	unsigned int mclk;
 	unsigned int mode;
 	struct snd_soc_dai *dai;
@@ -557,9 +558,6 @@ static int cs4270_i2c_probe(struct i2c_client *client,
 		goto error;
 	}
 
-	sprintf(cs4270->name, "%s@%s", dev_driver_string(&client->dev),
-		dev_name(&client->dev));
-
 	/* Initialize the playback and capture stream data.  The sample rate
 	 * fields are initialized later when the fabric driver calls
 	 * cs4270_set_dai_sysclk().  Hopefully, this won't cause any problems.
@@ -574,14 +572,19 @@ static int cs4270_i2c_probe(struct i2c_client *client,
 	cs4270->capture.channels_max = 2;
 	cs4270->capture.formats = CS4270_FORMATS;
 
+	/* Register the codec */
+
 	codec = &cs4270->codec;
 
 	mutex_init(&codec->mutex);
 	INIT_LIST_HEAD(&codec->list);
 	INIT_LIST_HEAD(&codec->dai_list);
-	codec->name = cs4270->name;
+
+	codec->name = "cs4270";
+	codec->num = client->adapter->nr << 16 | client->addr;
 
 	snd_soc_card_config_codec(codec, NULL, NULL, client);
+
 	codec->init = cs4270_codec_init;
 	codec->reg_cache = cs4270->reg_cache;
 	codec->codec_read = cs4270_read_reg_cache;
@@ -593,8 +596,12 @@ static int cs4270_i2c_probe(struct i2c_client *client,
 		dev_err(&client->dev, "failed to register card\n");
 		goto error;
 	}
-	memset(&dai_new, 0, sizeof(dai_new));
-	dai_new.name = cs4270->name;
+
+	/* Register the codec DAI */
+
+        memset(&dai_new, 0, sizeof(dai_new));
+	dai_new.name = codec->name;
+	dai_new.id = codec->num;
 	dai_new.playback = &cs4270->playback;
 	dai_new.capture = &cs4270->capture;
 	dai_new.ops = &dai_ops;
sound/soc/fsl/mpc8610_hpcd.c +74 -73

211 lines not on this page · raw message

Signature · 1 line
1.5.5
Applied
#1 lore raw
Quoted 5 lines · Timur Tabi

Change the Freescale MPC8610 HPCD codec and fabric drivers to use the codec name and id, instead of just the name, to match codec instances. Previously, the codec and fabric drivers would create a name string based on the I2C bus and address. Instead, keep the name as "cs4270" and combine the bus and address into a unique number.

Applied, thanks.