diff options
author | Lee Jones <lee.jones@linaro.org> | 2013-11-19 05:58:17 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-11-19 13:41:06 -0500 |
commit | 63e6d43bf80d3861dcda7ff4f37590f8de583156 (patch) | |
tree | 53db144dd03a82a6f34fd6e653e9972d6c42fb60 /sound/soc | |
parent | 9645083ca5ef365b7b750cf219bb20b61bb925f8 (diff) |
ASoC: ab8500: Revert to using custom I/O functions
It's been reported that these break audio on Snowball so revert them
until a Snowball user has time to investigate.
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/codecs/ab8500-codec.c | 66 |
1 files changed, 34 insertions, 32 deletions
diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c index a0394a8f2257..79902179c657 100644 --- a/sound/soc/codecs/ab8500-codec.c +++ b/sound/soc/codecs/ab8500-codec.c | |||
@@ -126,8 +126,6 @@ struct ab8500_codec_drvdata_dbg { | |||
126 | 126 | ||
127 | /* Private data for AB8500 device-driver */ | 127 | /* Private data for AB8500 device-driver */ |
128 | struct ab8500_codec_drvdata { | 128 | struct ab8500_codec_drvdata { |
129 | struct regmap *regmap; | ||
130 | |||
131 | /* Sidetone */ | 129 | /* Sidetone */ |
132 | long *sid_fir_values; | 130 | long *sid_fir_values; |
133 | enum sid_state sid_status; | 131 | enum sid_state sid_status; |
@@ -168,34 +166,48 @@ static inline const char *amic_type_str(enum amic_type type) | |||
168 | */ | 166 | */ |
169 | 167 | ||
170 | /* Read a register from the audio-bank of AB8500 */ | 168 | /* Read a register from the audio-bank of AB8500 */ |
171 | static int ab8500_codec_read_reg(void *context, unsigned int reg, | 169 | static unsigned int ab8500_codec_read_reg(struct snd_soc_codec *codec, |
172 | unsigned int *value) | 170 | unsigned int reg) |
173 | { | 171 | { |
174 | struct device *dev = context; | ||
175 | int status; | 172 | int status; |
173 | unsigned int value = 0; | ||
176 | 174 | ||
177 | u8 value8; | 175 | u8 value8; |
178 | status = abx500_get_register_interruptible(dev, AB8500_AUDIO, | 176 | status = abx500_get_register_interruptible(codec->dev, AB8500_AUDIO, |
179 | reg, &value8); | 177 | reg, &value8); |
180 | *value = (unsigned int)value8; | 178 | if (status < 0) { |
179 | dev_err(codec->dev, | ||
180 | "%s: ERROR: Register (0x%02x:0x%02x) read failed (%d).\n", | ||
181 | __func__, (u8)AB8500_AUDIO, (u8)reg, status); | ||
182 | } else { | ||
183 | dev_dbg(codec->dev, | ||
184 | "%s: Read 0x%02x from register 0x%02x:0x%02x\n", | ||
185 | __func__, value8, (u8)AB8500_AUDIO, (u8)reg); | ||
186 | value = (unsigned int)value8; | ||
187 | } | ||
181 | 188 | ||
182 | return status; | 189 | return value; |
183 | } | 190 | } |
184 | 191 | ||
185 | /* Write to a register in the audio-bank of AB8500 */ | 192 | /* Write to a register in the audio-bank of AB8500 */ |
186 | static int ab8500_codec_write_reg(void *context, unsigned int reg, | 193 | static int ab8500_codec_write_reg(struct snd_soc_codec *codec, |
187 | unsigned int value) | 194 | unsigned int reg, unsigned int value) |
188 | { | 195 | { |
189 | struct device *dev = context; | 196 | int status; |
190 | 197 | ||
191 | return abx500_set_register_interruptible(dev, AB8500_AUDIO, | 198 | status = abx500_set_register_interruptible(codec->dev, AB8500_AUDIO, |
192 | reg, value); | 199 | reg, value); |
193 | } | 200 | if (status < 0) |
201 | dev_err(codec->dev, | ||
202 | "%s: ERROR: Register (%02x:%02x) write failed (%d).\n", | ||
203 | __func__, (u8)AB8500_AUDIO, (u8)reg, status); | ||
204 | else | ||
205 | dev_dbg(codec->dev, | ||
206 | "%s: Wrote 0x%02x into register %02x:%02x\n", | ||
207 | __func__, (u8)value, (u8)AB8500_AUDIO, (u8)reg); | ||
194 | 208 | ||
195 | static const struct regmap_config ab8500_codec_regmap = { | 209 | return status; |
196 | .reg_read = ab8500_codec_read_reg, | 210 | } |
197 | .reg_write = ab8500_codec_write_reg, | ||
198 | }; | ||
199 | 211 | ||
200 | /* | 212 | /* |
201 | * Controls - DAPM | 213 | * Controls - DAPM |
@@ -2473,13 +2485,9 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec) | |||
2473 | 2485 | ||
2474 | dev_dbg(dev, "%s: Enter.\n", __func__); | 2486 | dev_dbg(dev, "%s: Enter.\n", __func__); |
2475 | 2487 | ||
2476 | snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP); | ||
2477 | |||
2478 | /* Setup AB8500 according to board-settings */ | 2488 | /* Setup AB8500 according to board-settings */ |
2479 | pdata = dev_get_platdata(dev->parent); | 2489 | pdata = dev_get_platdata(dev->parent); |
2480 | 2490 | ||
2481 | codec->control_data = drvdata->regmap; | ||
2482 | |||
2483 | if (np) { | 2491 | if (np) { |
2484 | if (!pdata) | 2492 | if (!pdata) |
2485 | pdata = devm_kzalloc(dev, | 2493 | pdata = devm_kzalloc(dev, |
@@ -2557,6 +2565,9 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec) | |||
2557 | 2565 | ||
2558 | static struct snd_soc_codec_driver ab8500_codec_driver = { | 2566 | static struct snd_soc_codec_driver ab8500_codec_driver = { |
2559 | .probe = ab8500_codec_probe, | 2567 | .probe = ab8500_codec_probe, |
2568 | .read = ab8500_codec_read_reg, | ||
2569 | .write = ab8500_codec_write_reg, | ||
2570 | .reg_word_size = sizeof(u8), | ||
2560 | .controls = ab8500_ctrls, | 2571 | .controls = ab8500_ctrls, |
2561 | .num_controls = ARRAY_SIZE(ab8500_ctrls), | 2572 | .num_controls = ARRAY_SIZE(ab8500_ctrls), |
2562 | .dapm_widgets = ab8500_dapm_widgets, | 2573 | .dapm_widgets = ab8500_dapm_widgets, |
@@ -2579,15 +2590,6 @@ static int ab8500_codec_driver_probe(struct platform_device *pdev) | |||
2579 | drvdata->anc_status = ANC_UNCONFIGURED; | 2590 | drvdata->anc_status = ANC_UNCONFIGURED; |
2580 | dev_set_drvdata(&pdev->dev, drvdata); | 2591 | dev_set_drvdata(&pdev->dev, drvdata); |
2581 | 2592 | ||
2582 | drvdata->regmap = devm_regmap_init(&pdev->dev, NULL, &pdev->dev, | ||
2583 | &ab8500_codec_regmap); | ||
2584 | if (IS_ERR(drvdata->regmap)) { | ||
2585 | status = PTR_ERR(drvdata->regmap); | ||
2586 | dev_err(&pdev->dev, "%s: Failed to allocate regmap: %d\n", | ||
2587 | __func__, status); | ||
2588 | return status; | ||
2589 | } | ||
2590 | |||
2591 | dev_dbg(&pdev->dev, "%s: Register codec.\n", __func__); | 2593 | dev_dbg(&pdev->dev, "%s: Register codec.\n", __func__); |
2592 | status = snd_soc_register_codec(&pdev->dev, &ab8500_codec_driver, | 2594 | status = snd_soc_register_codec(&pdev->dev, &ab8500_codec_driver, |
2593 | ab8500_codec_dai, | 2595 | ab8500_codec_dai, |