Commit 752b7764 authored by Mark Brown's avatar Mark Brown

ASoC: tlv320aic32x4: Move GPIO acquisition to I2C probe

This is more idiomatic and interacts better with deferred probe.
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 4a10c2ac
...@@ -617,16 +617,11 @@ static int aic32x4_probe(struct snd_soc_codec *codec) ...@@ -617,16 +617,11 @@ static int aic32x4_probe(struct snd_soc_codec *codec)
{ {
struct aic32x4_priv *aic32x4 = snd_soc_codec_get_drvdata(codec); struct aic32x4_priv *aic32x4 = snd_soc_codec_get_drvdata(codec);
u32 tmp_reg; u32 tmp_reg;
int ret;
codec->hw_write = (hw_write_t) i2c_master_send; codec->hw_write = (hw_write_t) i2c_master_send;
codec->control_data = aic32x4->control_data; codec->control_data = aic32x4->control_data;
if (aic32x4->rstn_gpio >= 0) { if (aic32x4->rstn_gpio >= 0) {
ret = devm_gpio_request_one(codec->dev, aic32x4->rstn_gpio,
GPIOF_OUT_INIT_LOW, "tlv320aic32x4 rstn");
if (ret != 0)
return ret;
ndelay(10); ndelay(10);
gpio_set_value(aic32x4->rstn_gpio, 1); gpio_set_value(aic32x4->rstn_gpio, 1);
} }
...@@ -735,6 +730,13 @@ static int aic32x4_i2c_probe(struct i2c_client *i2c, ...@@ -735,6 +730,13 @@ static int aic32x4_i2c_probe(struct i2c_client *i2c,
aic32x4->rstn_gpio = -1; aic32x4->rstn_gpio = -1;
} }
if (aic32x4->rstn_gpio >= 0) {
ret = devm_gpio_request_one(&i2c->dev, aic32x4->rstn_gpio,
GPIOF_OUT_INIT_LOW, "tlv320aic32x4 rstn");
if (ret != 0)
return ret;
}
ret = snd_soc_register_codec(&i2c->dev, ret = snd_soc_register_codec(&i2c->dev,
&soc_codec_dev_aic32x4, &aic32x4_dai, 1); &soc_codec_dev_aic32x4, &aic32x4_dai, 1);
return ret; return ret;
......
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