diff options
author | Charles Keepax <ckeepax@opensource.wolfsonmicro.com> | 2017-04-06 08:52:13 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-04-06 14:27:56 -0400 |
commit | 77b329d1943d38a5acdbaf9d57754975bce701d4 (patch) | |
tree | 9d8b61d903736a3006229c15d16b03d2249d7dac | |
parent | 2c84afb52ebea59e9862fcb8234126b7ae1d1960 (diff) |
ASoC: cs35l35: Correct handling of PDN_DONE with external boost
When using an external boost supply the PDN_DONE bit is not set, update
the handling in this case to use to use an appropriate fixed delay.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Brian Austin <brian.austin@cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | include/sound/cs35l35.h | 2 | ||||
-rw-r--r-- | sound/soc/codecs/cs35l35.c | 32 |
2 files changed, 26 insertions, 8 deletions
diff --git a/include/sound/cs35l35.h b/include/sound/cs35l35.h index 983c610eba2e..88744bbd6728 100644 --- a/include/sound/cs35l35.h +++ b/include/sound/cs35l35.h | |||
@@ -96,6 +96,8 @@ struct cs35l35_platform_data { | |||
96 | int adv_channel; | 96 | int adv_channel; |
97 | /* Shared Boost for stereo */ | 97 | /* Shared Boost for stereo */ |
98 | bool shared_bst; | 98 | bool shared_bst; |
99 | /* Specifies this amp is using an external boost supply */ | ||
100 | bool ext_bst; | ||
99 | /* ClassH Algorithm */ | 101 | /* ClassH Algorithm */ |
100 | struct classh_cfg classh_algo; | 102 | struct classh_cfg classh_algo; |
101 | /* Monitor Config */ | 103 | /* Monitor Config */ |
diff --git a/sound/soc/codecs/cs35l35.c b/sound/soc/codecs/cs35l35.c index 1db07a6296a4..6ecb7ddae9cf 100644 --- a/sound/soc/codecs/cs35l35.c +++ b/sound/soc/codecs/cs35l35.c | |||
@@ -162,6 +162,27 @@ static bool cs35l35_precious_register(struct device *dev, unsigned int reg) | |||
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
165 | static int cs35l35_wait_for_pdn(struct cs35l35_private *cs35l35) | ||
166 | { | ||
167 | int ret; | ||
168 | |||
169 | if (cs35l35->pdata.ext_bst) { | ||
170 | usleep_range(5000, 5500); | ||
171 | return 0; | ||
172 | } | ||
173 | |||
174 | reinit_completion(&cs35l35->pdn_done); | ||
175 | |||
176 | ret = wait_for_completion_timeout(&cs35l35->pdn_done, | ||
177 | msecs_to_jiffies(100)); | ||
178 | if (ret == 0) { | ||
179 | dev_err(cs35l35->dev, "PDN_DONE did not complete\n"); | ||
180 | return -ETIMEDOUT; | ||
181 | } | ||
182 | |||
183 | return 0; | ||
184 | } | ||
185 | |||
165 | static int cs35l35_sdin_event(struct snd_soc_dapm_widget *w, | 186 | static int cs35l35_sdin_event(struct snd_soc_dapm_widget *w, |
166 | struct snd_kcontrol *kcontrol, int event) | 187 | struct snd_kcontrol *kcontrol, int event) |
167 | { | 188 | { |
@@ -191,14 +212,7 @@ static int cs35l35_sdin_event(struct snd_soc_dapm_widget *w, | |||
191 | regmap_update_bits(cs35l35->regmap, CS35L35_AMP_DIG_VOL_CTL, | 212 | regmap_update_bits(cs35l35->regmap, CS35L35_AMP_DIG_VOL_CTL, |
192 | CS35L35_AMP_DIGSFT_MASK, 0); | 213 | CS35L35_AMP_DIGSFT_MASK, 0); |
193 | 214 | ||
194 | reinit_completion(&cs35l35->pdn_done); | 215 | ret = cs35l35_wait_for_pdn(cs35l35); |
195 | |||
196 | ret = wait_for_completion_timeout(&cs35l35->pdn_done, | ||
197 | msecs_to_jiffies(100)); | ||
198 | if (ret == 0) { | ||
199 | dev_err(codec->dev, "TIMEOUT PDN_DONE did not complete in 100ms\n"); | ||
200 | ret = -ETIMEDOUT; | ||
201 | } | ||
202 | 216 | ||
203 | regmap_update_bits(cs35l35->regmap, CS35L35_CLK_CTL1, | 217 | regmap_update_bits(cs35l35->regmap, CS35L35_CLK_CTL1, |
204 | CS35L35_MCLK_DIS_MASK, | 218 | CS35L35_MCLK_DIS_MASK, |
@@ -1198,6 +1212,8 @@ static int cs35l35_handle_of_data(struct i2c_client *i2c_client, | |||
1198 | "cirrus,shared-boost"); | 1212 | "cirrus,shared-boost"); |
1199 | } | 1213 | } |
1200 | 1214 | ||
1215 | pdata->ext_bst = of_property_read_bool(np, "cirrus,external-boost"); | ||
1216 | |||
1201 | pdata->gain_zc = of_property_read_bool(np, "cirrus,amp-gain-zc"); | 1217 | pdata->gain_zc = of_property_read_bool(np, "cirrus,amp-gain-zc"); |
1202 | 1218 | ||
1203 | classh = of_get_child_by_name(np, "cirrus,classh-internal-algo"); | 1219 | classh = of_get_child_by_name(np, "cirrus,classh-internal-algo"); |