All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] ASoC: don't use codec hw_write - step [3/6]
@ 2017-11-09  0:18 Kuninori Morimoto
  2017-11-09  0:19 ` [PATCH 1/6] ASoC: don't use codec hw_write on uda1380 Kuninori Morimoto
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Kuninori Morimoto @ 2017-11-09  0:18 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon


Hi Mark

These are 3/6 step of prepare patches for "replace component".

Some codec drivers are using codec->hw_write, codec->control_data,
but these are very redundant code, and component doesn't want to
have such code.
These patches cleanup it.

You can check whole replace component patch-set on below.
This is one of them

	Subject: Prepare to covert Codec/Platform into Component
	Date: Fri, 01 Sep 2017 14:18:11 +0900

Kuninori Morimoto (6):
  ASoC: don't use codec hw_write on uda1380
  ASoC: don't use codec hw_write on tlv320dac33
  ASoC: don't use codec hw_write on cx20442/omap-ams-delta
  ASoC: don't use codec hw_write on twl6040
  ASoC: don't use codec hw_write on max98926
  ASoC: don't use codec hw_write on max98927

 sound/soc/codecs/cx20442.c     | 23 ++++++++++-------------
 sound/soc/codecs/max98926.c    |  2 +-
 sound/soc/codecs/max98927.c    |  1 -
 sound/soc/codecs/tlv320dac33.c | 12 +++++-------
 sound/soc/codecs/twl6040.c     | 16 ++++++++--------
 sound/soc/codecs/uda1380.c     | 20 ++++++++++----------
 sound/soc/omap/ams-delta.c     |  4 ++--
 7 files changed, 36 insertions(+), 42 deletions(-)

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

* [PATCH 1/6] ASoC: don't use codec hw_write on uda1380
  2017-11-09  0:18 [PATCH 0/6] ASoC: don't use codec hw_write - step [3/6] Kuninori Morimoto
@ 2017-11-09  0:19 ` Kuninori Morimoto
  2017-11-09  0:19 ` [PATCH 2/6] ASoC: don't use codec hw_write on tlv320dac33 Kuninori Morimoto
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Kuninori Morimoto @ 2017-11-09  0:19 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

uda1380 driver is using codec hw_write/control_data,
but it is redundant code. This patch cleanup these

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/codecs/uda1380.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c
index 926c81a..4444802 100644
--- a/sound/soc/codecs/uda1380.c
+++ b/sound/soc/codecs/uda1380.c
@@ -37,7 +37,7 @@ struct uda1380_priv {
 	struct snd_soc_codec *codec;
 	unsigned int dac_clk;
 	struct work_struct work;
-	void *control_data;
+	struct i2c_client *i2c;
 };
 
 /*
@@ -92,6 +92,7 @@ static inline void uda1380_write_reg_cache(struct snd_soc_codec *codec,
 static int uda1380_write(struct snd_soc_codec *codec, unsigned int reg,
 	unsigned int value)
 {
+	struct uda1380_priv *uda1380 = snd_soc_codec_get_drvdata(codec);
 	u8 data[3];
 
 	/* data is
@@ -111,10 +112,10 @@ static int uda1380_write(struct snd_soc_codec *codec, unsigned int reg,
 	if (!snd_soc_codec_is_active(codec) && (reg >= UDA1380_MVOL))
 		return 0;
 	pr_debug("uda1380: hw write %x val %x\n", reg, value);
-	if (codec->hw_write(codec->control_data, data, 3) == 3) {
+	if (i2c_master_send(uda1380->i2c, data, 3) == 3) {
 		unsigned int val;
-		i2c_master_send(codec->control_data, data, 1);
-		i2c_master_recv(codec->control_data, data, 2);
+		i2c_master_send(uda1380->i2c, data, 1);
+		i2c_master_recv(uda1380->i2c, data, 2);
 		val = (data[0]<<8) | data[1];
 		if (val != value) {
 			pr_debug("uda1380: READ BACK VAL %x\n",
@@ -130,6 +131,7 @@ static int uda1380_write(struct snd_soc_codec *codec, unsigned int reg,
 
 static void uda1380_sync_cache(struct snd_soc_codec *codec)
 {
+	struct uda1380_priv *uda1380 = snd_soc_codec_get_drvdata(codec);
 	int reg;
 	u8 data[3];
 	u16 *cache = codec->reg_cache;
@@ -139,7 +141,7 @@ static void uda1380_sync_cache(struct snd_soc_codec *codec)
 		data[0] = reg;
 		data[1] = (cache[reg] & 0xff00) >> 8;
 		data[2] = cache[reg] & 0x00ff;
-		if (codec->hw_write(codec->control_data, data, 3) != 3)
+		if (i2c_master_send(uda1380->i2c, data, 3) != 3)
 			dev_err(codec->dev, "%s: write to reg 0x%x failed\n",
 				__func__, reg);
 	}
@@ -148,6 +150,7 @@ static void uda1380_sync_cache(struct snd_soc_codec *codec)
 static int uda1380_reset(struct snd_soc_codec *codec)
 {
 	struct uda1380_platform_data *pdata = codec->dev->platform_data;
+	struct uda1380_priv *uda1380 = snd_soc_codec_get_drvdata(codec);
 
 	if (gpio_is_valid(pdata->gpio_reset)) {
 		gpio_set_value(pdata->gpio_reset, 1);
@@ -160,7 +163,7 @@ static int uda1380_reset(struct snd_soc_codec *codec)
 		data[1] = 0;
 		data[2] = 0;
 
-		if (codec->hw_write(codec->control_data, data, 3) != 3) {
+		if (i2c_master_send(uda1380->i2c, data, 3) != 3) {
 			dev_err(codec->dev, "%s: failed\n", __func__);
 			return -EIO;
 		}
@@ -695,9 +698,6 @@ static int uda1380_probe(struct snd_soc_codec *codec)
 
 	uda1380->codec = codec;
 
-	codec->hw_write = (hw_write_t)i2c_master_send;
-	codec->control_data = uda1380->control_data;
-
 	if (!gpio_is_valid(pdata->gpio_power)) {
 		ret = uda1380_reset(codec);
 		if (ret)
@@ -772,7 +772,7 @@ static int uda1380_i2c_probe(struct i2c_client *i2c,
 	}
 
 	i2c_set_clientdata(i2c, uda1380);
-	uda1380->control_data = i2c;
+	uda1380->i2c = i2c;
 
 	ret =  snd_soc_register_codec(&i2c->dev,
 			&soc_codec_dev_uda1380, uda1380_dai, ARRAY_SIZE(uda1380_dai));
-- 
1.9.1

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

* [PATCH 2/6] ASoC: don't use codec hw_write on tlv320dac33
  2017-11-09  0:18 [PATCH 0/6] ASoC: don't use codec hw_write - step [3/6] Kuninori Morimoto
  2017-11-09  0:19 ` [PATCH 1/6] ASoC: don't use codec hw_write on uda1380 Kuninori Morimoto
@ 2017-11-09  0:19 ` Kuninori Morimoto
  2017-11-09  1:04 ` [PATCH 3/6] ASoC: don't use codec hw_write on cx20442/omap-ams-delta Kuninori Morimoto
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Kuninori Morimoto @ 2017-11-09  0:19 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

uda1380 driver is using codec hw_write/control_data,
but it is redundant code. This patch cleanup these

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/codecs/tlv320dac33.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
index 5b94a15..80a2641 100644
--- a/sound/soc/codecs/tlv320dac33.c
+++ b/sound/soc/codecs/tlv320dac33.c
@@ -121,7 +121,7 @@ struct tlv320dac33_priv {
 	unsigned int uthr;
 
 	enum dac33_state state;
-	void *control_data;
+	struct i2c_client *i2c;
 };
 
 static const u8 dac33_reg[DAC33_CACHEREGNUM] = {
@@ -200,7 +200,7 @@ static int dac33_read(struct snd_soc_codec *codec, unsigned int reg,
 
 	/* If powered off, return the cached value */
 	if (dac33->chip_power) {
-		val = i2c_smbus_read_byte_data(codec->control_data, value[0]);
+		val = i2c_smbus_read_byte_data(dac33->i2c, value[0]);
 		if (val < 0) {
 			dev_err(codec->dev, "Read failed (%d)\n", val);
 			value[0] = dac33_read_reg_cache(codec, reg);
@@ -233,7 +233,7 @@ static int dac33_write(struct snd_soc_codec *codec, unsigned int reg,
 
 	dac33_write_reg_cache(codec, data[0], data[1]);
 	if (dac33->chip_power) {
-		ret = codec->hw_write(codec->control_data, data, 2);
+		ret = i2c_master_send(dac33->i2c, data, 2);
 		if (ret != 2)
 			dev_err(codec->dev, "Write failed (%d)\n", ret);
 		else
@@ -280,7 +280,7 @@ static int dac33_write16(struct snd_soc_codec *codec, unsigned int reg,
 	if (dac33->chip_power) {
 		/* We need to set autoincrement mode for 16 bit writes */
 		data[0] |= DAC33_I2C_ADDR_AUTOINC;
-		ret = codec->hw_write(codec->control_data, data, 3);
+		ret = i2c_master_send(dac33->i2c, data, 3);
 		if (ret != 3)
 			dev_err(codec->dev, "Write failed (%d)\n", ret);
 		else
@@ -1379,8 +1379,6 @@ static int dac33_soc_probe(struct snd_soc_codec *codec)
 	struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
 	int ret = 0;
 
-	codec->control_data = dac33->control_data;
-	codec->hw_write = (hw_write_t) i2c_master_send;
 	dac33->codec = codec;
 
 	/* Read the tlv320dac33 ID registers */
@@ -1499,7 +1497,7 @@ static int dac33_i2c_probe(struct i2c_client *client,
 	if (dac33 == NULL)
 		return -ENOMEM;
 
-	dac33->control_data = client;
+	dac33->i2c = client;
 	mutex_init(&dac33->mutex);
 	spin_lock_init(&dac33->lock);
 
-- 
1.9.1

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

* [PATCH 3/6] ASoC: don't use codec hw_write on cx20442/omap-ams-delta
  2017-11-09  0:18 [PATCH 0/6] ASoC: don't use codec hw_write - step [3/6] Kuninori Morimoto
  2017-11-09  0:19 ` [PATCH 1/6] ASoC: don't use codec hw_write on uda1380 Kuninori Morimoto
  2017-11-09  0:19 ` [PATCH 2/6] ASoC: don't use codec hw_write on tlv320dac33 Kuninori Morimoto
@ 2017-11-09  1:04 ` Kuninori Morimoto
  2017-11-09  1:04 ` [PATCH 4/6] ASoC: don't use codec hw_write on twl6040 Kuninori Morimoto
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Kuninori Morimoto @ 2017-11-09  1:04 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

cx20442/omap-ams-delta driver is using codec hw_write/control_data,
but it is redundant code. This patch cleanup these

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/codecs/cx20442.c | 23 ++++++++++-------------
 sound/soc/omap/ams-delta.c |  4 ++--
 2 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c
index 46b1fbb..2083f7e 100644
--- a/sound/soc/codecs/cx20442.c
+++ b/sound/soc/codecs/cx20442.c
@@ -26,7 +26,7 @@
 
 
 struct cx20442_priv {
-	void *control_data;
+	struct tty_struct *tty;
 	struct regulator *por;
 };
 
@@ -163,9 +163,9 @@ static int cx20442_write(struct snd_soc_codec *codec, unsigned int reg,
 	if (reg >= codec->driver->reg_cache_size)
 		return -EINVAL;
 
-	/* hw_write and control_data pointers required for talking to the modem
+	/* tty and write pointers required for talking to the modem
 	 * are expected to be set by the line discipline initialization code */
-	if (!codec->hw_write || !cx20442->control_data)
+	if (!cx20442->tty || !cx20442->tty->ops->write)
 		return -EIO;
 
 	old = reg_cache[reg];
@@ -194,7 +194,7 @@ static int cx20442_write(struct snd_soc_codec *codec, unsigned int reg,
 		return -ENOMEM;
 
 	dev_dbg(codec->dev, "%s: %s\n", __func__, buf);
-	if (codec->hw_write(cx20442->control_data, buf, len) != len)
+	if (cx20442->tty->ops->write(cx20442->tty, buf, len) != len)
 		return -EIO;
 
 	return 0;
@@ -252,8 +252,7 @@ static void v253_close(struct tty_struct *tty)
 	cx20442 = snd_soc_codec_get_drvdata(codec);
 
 	/* Prevent the codec driver from further accessing the modem */
-	codec->hw_write = NULL;
-	cx20442->control_data = NULL;
+	cx20442->tty = NULL;
 	codec->component.card->pop_time = 0;
 }
 
@@ -276,12 +275,11 @@ static void v253_receive(struct tty_struct *tty,
 
 	cx20442 = snd_soc_codec_get_drvdata(codec);
 
-	if (!cx20442->control_data) {
+	if (!cx20442->tty) {
 		/* First modem response, complete setup procedure */
 
 		/* Set up codec driver access to modem controls */
-		cx20442->control_data = tty;
-		codec->hw_write = (hw_write_t)tty->ops->write;
+		cx20442->tty = tty;
 		codec->component.card->pop_time = 1;
 	}
 }
@@ -367,10 +365,9 @@ static int cx20442_codec_probe(struct snd_soc_codec *codec)
 	cx20442->por = regulator_get(codec->dev, "POR");
 	if (IS_ERR(cx20442->por))
 		dev_warn(codec->dev, "failed to get the regulator");
-	cx20442->control_data = NULL;
+	cx20442->tty = NULL;
 
 	snd_soc_codec_set_drvdata(codec, cx20442);
-	codec->hw_write = NULL;
 	codec->component.card->pop_time = 0;
 
 	return 0;
@@ -381,8 +378,8 @@ static int cx20442_codec_remove(struct snd_soc_codec *codec)
 {
 	struct cx20442_priv *cx20442 = snd_soc_codec_get_drvdata(codec);
 
-	if (cx20442->control_data) {
-		struct tty_struct *tty = cx20442->control_data;
+	if (cx20442->tty) {
+		struct tty_struct *tty = cx20442->tty;
 		tty_hangup(tty);
 	}
 
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index 6c49f3d..faf85d0 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -105,7 +105,7 @@ static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol,
 	int pin, changed = 0;
 
 	/* Refuse any mode changes if we are not able to control the codec. */
-	if (!cx20442_codec->hw_write)
+	if (!cx20442_codec->component.card->pop_time)
 		return -EUNATCH;
 
 	if (ucontrol->value.enumerated.item[0] >= control->items)
@@ -345,7 +345,7 @@ static void cx81801_receive(struct tty_struct *tty,
 	if (!codec)
 		return;
 
-	if (!codec->hw_write) {
+	if (!codec->component.card->pop_time) {
 		/* First modem response, complete setup procedure */
 
 		/* Initialize timer used for config pulse generation */
-- 
1.9.1

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

* [PATCH 4/6] ASoC: don't use codec hw_write on twl6040
  2017-11-09  0:18 [PATCH 0/6] ASoC: don't use codec hw_write - step [3/6] Kuninori Morimoto
                   ` (2 preceding siblings ...)
  2017-11-09  1:04 ` [PATCH 3/6] ASoC: don't use codec hw_write on cx20442/omap-ams-delta Kuninori Morimoto
@ 2017-11-09  1:04 ` Kuninori Morimoto
  2017-11-09  1:04 ` [PATCH 5/6] ASoC: don't use codec hw_write on max98926 Kuninori Morimoto
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Kuninori Morimoto @ 2017-11-09  1:04 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

twl6040 driver is using codec hw_write/control_data,
but it is redundant code. This patch cleanup these

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/codecs/twl6040.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index 1773ff8..a8e6941 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -106,10 +106,12 @@ struct twl6040_data {
 	{ .count = ARRAY_SIZE(hp_rates), .list = hp_rates, },
 };
 
+#define to_twl6040(codec)	dev_get_drvdata((codec)->dev->parent)
+
 static unsigned int twl6040_read(struct snd_soc_codec *codec, unsigned int reg)
 {
 	struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);
-	struct twl6040 *twl6040 = codec->control_data;
+	struct twl6040 *twl6040 = to_twl6040(codec);
 	u8 value;
 
 	if (reg >= TWL6040_CACHEREGNUM)
@@ -171,7 +173,7 @@ static inline void twl6040_update_dl12_cache(struct snd_soc_codec *codec,
 static int twl6040_write(struct snd_soc_codec *codec,
 			unsigned int reg, unsigned int value)
 {
-	struct twl6040 *twl6040 = codec->control_data;
+	struct twl6040 *twl6040 = to_twl6040(codec);
 
 	if (reg >= TWL6040_CACHEREGNUM)
 		return -EIO;
@@ -572,7 +574,7 @@ int twl6040_get_trim_value(struct snd_soc_codec *codec, enum twl6040_trim trim)
 
 int twl6040_get_hs_step_size(struct snd_soc_codec *codec)
 {
-	struct twl6040 *twl6040 = codec->control_data;
+	struct twl6040 *twl6040 = to_twl6040(codec);
 
 	if (twl6040_get_revid(twl6040) < TWL6040_REV_ES1_3)
 		/* For ES under ES_1.3 HS step is 2 mV */
@@ -830,7 +832,7 @@ int twl6040_get_hs_step_size(struct snd_soc_codec *codec)
 static int twl6040_set_bias_level(struct snd_soc_codec *codec,
 				enum snd_soc_bias_level level)
 {
-	struct twl6040 *twl6040 = codec->control_data;
+	struct twl6040 *twl6040 = to_twl6040(codec);
 	struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);
 	int ret = 0;
 
@@ -922,7 +924,7 @@ static int twl6040_prepare(struct snd_pcm_substream *substream,
 			struct snd_soc_dai *dai)
 {
 	struct snd_soc_codec *codec = dai->codec;
-	struct twl6040 *twl6040 = codec->control_data;
+	struct twl6040 *twl6040 = to_twl6040(codec);
 	struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);
 	int ret;
 
@@ -964,7 +966,7 @@ static int twl6040_set_dai_sysclk(struct snd_soc_dai *codec_dai,
 static void twl6040_mute_path(struct snd_soc_codec *codec, enum twl6040_dai_id id,
 			     int mute)
 {
-	struct twl6040 *twl6040 = codec->control_data;
+	struct twl6040 *twl6040 = to_twl6040(codec);
 	struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);
 	int hslctl, hsrctl, earctl;
 	int hflctl, hfrctl;
@@ -1108,7 +1110,6 @@ static int twl6040_digital_mute(struct snd_soc_dai *dai, int mute)
 static int twl6040_probe(struct snd_soc_codec *codec)
 {
 	struct twl6040_data *priv;
-	struct twl6040 *twl6040 = dev_get_drvdata(codec->dev->parent);
 	struct platform_device *pdev = to_platform_device(codec->dev);
 	int ret = 0;
 
@@ -1119,7 +1120,6 @@ static int twl6040_probe(struct snd_soc_codec *codec)
 	snd_soc_codec_set_drvdata(codec, priv);
 
 	priv->codec = codec;
-	codec->control_data = twl6040;
 
 	priv->plug_irq = platform_get_irq(pdev, 0);
 	if (priv->plug_irq < 0) {
-- 
1.9.1

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

* [PATCH 5/6] ASoC: don't use codec hw_write on max98926
  2017-11-09  0:18 [PATCH 0/6] ASoC: don't use codec hw_write - step [3/6] Kuninori Morimoto
                   ` (3 preceding siblings ...)
  2017-11-09  1:04 ` [PATCH 4/6] ASoC: don't use codec hw_write on twl6040 Kuninori Morimoto
@ 2017-11-09  1:04 ` Kuninori Morimoto
  2017-11-09  1:05 ` [PATCH 6/6] ASoC: don't use codec hw_write on max98927 Kuninori Morimoto
  2017-11-10 21:27 ` [PATCH 0/6] ASoC: don't use codec hw_write - step [3/6] Mark Brown
  6 siblings, 0 replies; 10+ messages in thread
From: Kuninori Morimoto @ 2017-11-09  1:04 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

max98926 driver is using codec hw_write/control_data,
but it is redundant code. This patch cleanup these

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/codecs/max98926.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/max98926.c b/sound/soc/codecs/max98926.c
index 03d07bf..7b1d1b0 100644
--- a/sound/soc/codecs/max98926.c
+++ b/sound/soc/codecs/max98926.c
@@ -490,7 +490,7 @@ static int max98926_probe(struct snd_soc_codec *codec)
 	struct max98926_priv *max98926 = snd_soc_codec_get_drvdata(codec);
 
 	max98926->codec = codec;
-	codec->control_data = max98926->regmap;
+
 	/* Hi-Z all the slots */
 	regmap_write(max98926->regmap, MAX98926_DOUT_HIZ_CFG4, 0xF0);
 	return 0;
-- 
1.9.1

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

* [PATCH 6/6] ASoC: don't use codec hw_write on max98927
  2017-11-09  0:18 [PATCH 0/6] ASoC: don't use codec hw_write - step [3/6] Kuninori Morimoto
                   ` (4 preceding siblings ...)
  2017-11-09  1:04 ` [PATCH 5/6] ASoC: don't use codec hw_write on max98926 Kuninori Morimoto
@ 2017-11-09  1:05 ` Kuninori Morimoto
  2017-11-10 21:27 ` [PATCH 0/6] ASoC: don't use codec hw_write - step [3/6] Mark Brown
  6 siblings, 0 replies; 10+ messages in thread
From: Kuninori Morimoto @ 2017-11-09  1:05 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

max98927 driver is using codec hw_write/control_data,
but it is redundant code. This patch cleanup these

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/codecs/max98927.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sound/soc/codecs/max98927.c b/sound/soc/codecs/max98927.c
index a1d3935..f701fdc 100644
--- a/sound/soc/codecs/max98927.c
+++ b/sound/soc/codecs/max98927.c
@@ -682,7 +682,6 @@ static int max98927_probe(struct snd_soc_codec *codec)
 	struct max98927_priv *max98927 = snd_soc_codec_get_drvdata(codec);
 
 	max98927->codec = codec;
-	codec->control_data = max98927->regmap;
 
 	/* Software Reset */
 	regmap_write(max98927->regmap,
-- 
1.9.1

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

* Re: [PATCH 0/6] ASoC: don't use codec hw_write - step [3/6]
  2017-11-09  0:18 [PATCH 0/6] ASoC: don't use codec hw_write - step [3/6] Kuninori Morimoto
                   ` (5 preceding siblings ...)
  2017-11-09  1:05 ` [PATCH 6/6] ASoC: don't use codec hw_write on max98927 Kuninori Morimoto
@ 2017-11-10 21:27 ` Mark Brown
  2017-11-13  0:20   ` Kuninori Morimoto
  6 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2017-11-10 21:27 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA, Simon


[-- Attachment #1.1: Type: text/plain, Size: 282 bytes --]

On Thu, Nov 09, 2017 at 12:18:26AM +0000, Kuninori Morimoto wrote:
> 
> Hi Mark
> 
> These are 3/6 step of prepare patches for "replace component".
> 

This series looks basically fine but I'll wait till after the merge
window before applying it in case there's any issue.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

* Re: [PATCH 0/6] ASoC: don't use codec hw_write - step [3/6]
  2017-11-10 21:27 ` [PATCH 0/6] ASoC: don't use codec hw_write - step [3/6] Mark Brown
@ 2017-11-13  0:20   ` Kuninori Morimoto
  0 siblings, 0 replies; 10+ messages in thread
From: Kuninori Morimoto @ 2017-11-13  0:20 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon


Hi Mark

> > Hi Mark
> > 
> > These are 3/6 step of prepare patches for "replace component".
> > 
> 
> This series looks basically fine but I'll wait till after the merge
> window before applying it in case there's any issue.

OK, thanks
I'm looking forward to it

Best regards
---
Kuninori Morimoto

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

* [PATCH 4/6] ASoC: don't use codec hw_write on twl6040
  2017-09-01  5:42 ` [PATCH 0/6] ASoC don't use codec hw_write/read Kuninori Morimoto
@ 2017-09-01  5:45   ` Kuninori Morimoto
  0 siblings, 0 replies; 10+ messages in thread
From: Kuninori Morimoto @ 2017-09-01  5:45 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Lars-Peter


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

twl6040 driver is using codec hw_write/control_data,
but it is redundant code. This patch cleanup these

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/codecs/twl6040.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index 1773ff8..a8e6941 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -106,10 +106,12 @@ struct twl6040_data {
 	{ .count = ARRAY_SIZE(hp_rates), .list = hp_rates, },
 };
 
+#define to_twl6040(codec)	dev_get_drvdata((codec)->dev->parent)
+
 static unsigned int twl6040_read(struct snd_soc_codec *codec, unsigned int reg)
 {
 	struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);
-	struct twl6040 *twl6040 = codec->control_data;
+	struct twl6040 *twl6040 = to_twl6040(codec);
 	u8 value;
 
 	if (reg >= TWL6040_CACHEREGNUM)
@@ -171,7 +173,7 @@ static inline void twl6040_update_dl12_cache(struct snd_soc_codec *codec,
 static int twl6040_write(struct snd_soc_codec *codec,
 			unsigned int reg, unsigned int value)
 {
-	struct twl6040 *twl6040 = codec->control_data;
+	struct twl6040 *twl6040 = to_twl6040(codec);
 
 	if (reg >= TWL6040_CACHEREGNUM)
 		return -EIO;
@@ -572,7 +574,7 @@ int twl6040_get_trim_value(struct snd_soc_codec *codec, enum twl6040_trim trim)
 
 int twl6040_get_hs_step_size(struct snd_soc_codec *codec)
 {
-	struct twl6040 *twl6040 = codec->control_data;
+	struct twl6040 *twl6040 = to_twl6040(codec);
 
 	if (twl6040_get_revid(twl6040) < TWL6040_REV_ES1_3)
 		/* For ES under ES_1.3 HS step is 2 mV */
@@ -830,7 +832,7 @@ int twl6040_get_hs_step_size(struct snd_soc_codec *codec)
 static int twl6040_set_bias_level(struct snd_soc_codec *codec,
 				enum snd_soc_bias_level level)
 {
-	struct twl6040 *twl6040 = codec->control_data;
+	struct twl6040 *twl6040 = to_twl6040(codec);
 	struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);
 	int ret = 0;
 
@@ -922,7 +924,7 @@ static int twl6040_prepare(struct snd_pcm_substream *substream,
 			struct snd_soc_dai *dai)
 {
 	struct snd_soc_codec *codec = dai->codec;
-	struct twl6040 *twl6040 = codec->control_data;
+	struct twl6040 *twl6040 = to_twl6040(codec);
 	struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);
 	int ret;
 
@@ -964,7 +966,7 @@ static int twl6040_set_dai_sysclk(struct snd_soc_dai *codec_dai,
 static void twl6040_mute_path(struct snd_soc_codec *codec, enum twl6040_dai_id id,
 			     int mute)
 {
-	struct twl6040 *twl6040 = codec->control_data;
+	struct twl6040 *twl6040 = to_twl6040(codec);
 	struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);
 	int hslctl, hsrctl, earctl;
 	int hflctl, hfrctl;
@@ -1108,7 +1110,6 @@ static int twl6040_digital_mute(struct snd_soc_dai *dai, int mute)
 static int twl6040_probe(struct snd_soc_codec *codec)
 {
 	struct twl6040_data *priv;
-	struct twl6040 *twl6040 = dev_get_drvdata(codec->dev->parent);
 	struct platform_device *pdev = to_platform_device(codec->dev);
 	int ret = 0;
 
@@ -1119,7 +1120,6 @@ static int twl6040_probe(struct snd_soc_codec *codec)
 	snd_soc_codec_set_drvdata(codec, priv);
 
 	priv->codec = codec;
-	codec->control_data = twl6040;
 
 	priv->plug_irq = platform_get_irq(pdev, 0);
 	if (priv->plug_irq < 0) {
-- 
1.9.1

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

end of thread, other threads:[~2017-11-13  0:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-09  0:18 [PATCH 0/6] ASoC: don't use codec hw_write - step [3/6] Kuninori Morimoto
2017-11-09  0:19 ` [PATCH 1/6] ASoC: don't use codec hw_write on uda1380 Kuninori Morimoto
2017-11-09  0:19 ` [PATCH 2/6] ASoC: don't use codec hw_write on tlv320dac33 Kuninori Morimoto
2017-11-09  1:04 ` [PATCH 3/6] ASoC: don't use codec hw_write on cx20442/omap-ams-delta Kuninori Morimoto
2017-11-09  1:04 ` [PATCH 4/6] ASoC: don't use codec hw_write on twl6040 Kuninori Morimoto
2017-11-09  1:04 ` [PATCH 5/6] ASoC: don't use codec hw_write on max98926 Kuninori Morimoto
2017-11-09  1:05 ` [PATCH 6/6] ASoC: don't use codec hw_write on max98927 Kuninori Morimoto
2017-11-10 21:27 ` [PATCH 0/6] ASoC: don't use codec hw_write - step [3/6] Mark Brown
2017-11-13  0:20   ` Kuninori Morimoto
  -- strict thread matches above, loose matches on Subject: below --
2017-09-01  5:25 Prepare to covert Codec/Platform into Component Kuninori Morimoto
2017-09-01  5:42 ` [PATCH 0/6] ASoC don't use codec hw_write/read Kuninori Morimoto
2017-09-01  5:45   ` [PATCH 4/6] ASoC: don't use codec hw_write on twl6040 Kuninori Morimoto

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.