Commit fac3f5e2 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: don't use codec hw_write on cx20442/omap-ams-delta

cx20442/omap-ams-delta driver is using codec hw_write/control_data,
but it is redundant code. This patch cleanup these
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 4fbd8d19
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
struct cx20442_priv { struct cx20442_priv {
void *control_data; struct tty_struct *tty;
struct regulator *por; struct regulator *por;
}; };
...@@ -163,9 +163,9 @@ static int cx20442_write(struct snd_soc_codec *codec, unsigned int reg, ...@@ -163,9 +163,9 @@ static int cx20442_write(struct snd_soc_codec *codec, unsigned int reg,
if (reg >= codec->driver->reg_cache_size) if (reg >= codec->driver->reg_cache_size)
return -EINVAL; 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 */ * 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; return -EIO;
old = reg_cache[reg]; old = reg_cache[reg];
...@@ -194,7 +194,7 @@ static int cx20442_write(struct snd_soc_codec *codec, unsigned int reg, ...@@ -194,7 +194,7 @@ static int cx20442_write(struct snd_soc_codec *codec, unsigned int reg,
return -ENOMEM; return -ENOMEM;
dev_dbg(codec->dev, "%s: %s\n", __func__, buf); 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 -EIO;
return 0; return 0;
...@@ -252,8 +252,7 @@ static void v253_close(struct tty_struct *tty) ...@@ -252,8 +252,7 @@ static void v253_close(struct tty_struct *tty)
cx20442 = snd_soc_codec_get_drvdata(codec); cx20442 = snd_soc_codec_get_drvdata(codec);
/* Prevent the codec driver from further accessing the modem */ /* Prevent the codec driver from further accessing the modem */
codec->hw_write = NULL; cx20442->tty = NULL;
cx20442->control_data = NULL;
codec->component.card->pop_time = 0; codec->component.card->pop_time = 0;
} }
...@@ -276,12 +275,11 @@ static void v253_receive(struct tty_struct *tty, ...@@ -276,12 +275,11 @@ static void v253_receive(struct tty_struct *tty,
cx20442 = snd_soc_codec_get_drvdata(codec); cx20442 = snd_soc_codec_get_drvdata(codec);
if (!cx20442->control_data) { if (!cx20442->tty) {
/* First modem response, complete setup procedure */ /* First modem response, complete setup procedure */
/* Set up codec driver access to modem controls */ /* Set up codec driver access to modem controls */
cx20442->control_data = tty; cx20442->tty = tty;
codec->hw_write = (hw_write_t)tty->ops->write;
codec->component.card->pop_time = 1; codec->component.card->pop_time = 1;
} }
} }
...@@ -367,10 +365,9 @@ static int cx20442_codec_probe(struct snd_soc_codec *codec) ...@@ -367,10 +365,9 @@ static int cx20442_codec_probe(struct snd_soc_codec *codec)
cx20442->por = regulator_get(codec->dev, "POR"); cx20442->por = regulator_get(codec->dev, "POR");
if (IS_ERR(cx20442->por)) if (IS_ERR(cx20442->por))
dev_warn(codec->dev, "failed to get the regulator"); dev_warn(codec->dev, "failed to get the regulator");
cx20442->control_data = NULL; cx20442->tty = NULL;
snd_soc_codec_set_drvdata(codec, cx20442); snd_soc_codec_set_drvdata(codec, cx20442);
codec->hw_write = NULL;
codec->component.card->pop_time = 0; codec->component.card->pop_time = 0;
return 0; return 0;
...@@ -381,8 +378,8 @@ static int cx20442_codec_remove(struct snd_soc_codec *codec) ...@@ -381,8 +378,8 @@ static int cx20442_codec_remove(struct snd_soc_codec *codec)
{ {
struct cx20442_priv *cx20442 = snd_soc_codec_get_drvdata(codec); struct cx20442_priv *cx20442 = snd_soc_codec_get_drvdata(codec);
if (cx20442->control_data) { if (cx20442->tty) {
struct tty_struct *tty = cx20442->control_data; struct tty_struct *tty = cx20442->tty;
tty_hangup(tty); tty_hangup(tty);
} }
......
...@@ -105,7 +105,7 @@ static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol, ...@@ -105,7 +105,7 @@ static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol,
int pin, changed = 0; int pin, changed = 0;
/* Refuse any mode changes if we are not able to control the codec. */ /* 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; return -EUNATCH;
if (ucontrol->value.enumerated.item[0] >= control->items) if (ucontrol->value.enumerated.item[0] >= control->items)
...@@ -345,7 +345,7 @@ static void cx81801_receive(struct tty_struct *tty, ...@@ -345,7 +345,7 @@ static void cx81801_receive(struct tty_struct *tty,
if (!codec) if (!codec)
return; return;
if (!codec->hw_write) { if (!codec->component.card->pop_time) {
/* First modem response, complete setup procedure */ /* First modem response, complete setup procedure */
/* Initialize timer used for config pulse generation */ /* Initialize timer used for config pulse generation */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment