diff options
| -rw-r--r-- | sound/soc/codecs/tlv320aic31xx.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c index 655c99db2426..858cb8be445f 100644 --- a/sound/soc/codecs/tlv320aic31xx.c +++ b/sound/soc/codecs/tlv320aic31xx.c | |||
| @@ -1055,6 +1055,22 @@ static int aic31xx_regulator_event(struct notifier_block *nb, | |||
| 1055 | return 0; | 1055 | return 0; |
| 1056 | } | 1056 | } |
| 1057 | 1057 | ||
| 1058 | static int aic31xx_reset(struct aic31xx_priv *aic31xx) | ||
| 1059 | { | ||
| 1060 | int ret = 0; | ||
| 1061 | |||
| 1062 | if (aic31xx->gpio_reset) { | ||
| 1063 | gpiod_set_value(aic31xx->gpio_reset, 1); | ||
| 1064 | ndelay(10); /* At least 10ns */ | ||
| 1065 | gpiod_set_value(aic31xx->gpio_reset, 0); | ||
| 1066 | } else { | ||
| 1067 | ret = regmap_write(aic31xx->regmap, AIC31XX_RESET, 1); | ||
| 1068 | } | ||
| 1069 | mdelay(1); /* At least 1ms */ | ||
| 1070 | |||
| 1071 | return ret; | ||
| 1072 | } | ||
| 1073 | |||
| 1058 | static void aic31xx_clk_on(struct snd_soc_codec *codec) | 1074 | static void aic31xx_clk_on(struct snd_soc_codec *codec) |
| 1059 | { | 1075 | { |
| 1060 | struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); | 1076 | struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); |
| @@ -1098,11 +1114,13 @@ static int aic31xx_power_on(struct snd_soc_codec *codec) | |||
| 1098 | if (ret) | 1114 | if (ret) |
| 1099 | return ret; | 1115 | return ret; |
| 1100 | 1116 | ||
| 1101 | if (aic31xx->gpio_reset) { | ||
| 1102 | gpiod_set_value(aic31xx->gpio_reset, 0); | ||
| 1103 | udelay(100); | ||
| 1104 | } | ||
| 1105 | regcache_cache_only(aic31xx->regmap, false); | 1117 | regcache_cache_only(aic31xx->regmap, false); |
| 1118 | |||
| 1119 | /* Reset device registers for a consistent power-on like state */ | ||
| 1120 | ret = aic31xx_reset(aic31xx); | ||
| 1121 | if (ret < 0) | ||
| 1122 | dev_err(aic31xx->dev, "Could not reset device: %d\n", ret); | ||
| 1123 | |||
| 1106 | ret = regcache_sync(aic31xx->regmap); | 1124 | ret = regcache_sync(aic31xx->regmap); |
| 1107 | if (ret) { | 1125 | if (ret) { |
| 1108 | dev_err(codec->dev, | 1126 | dev_err(codec->dev, |
