summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8903.c
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2011-12-02 23:08:37 +0100
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-12-06 11:29:22 +0100
commita0f203d384fadacba514748cd0095efeadeed96c (patch)
tree30fa69763a7eb33567b92625a81819ea01d538e0 /sound/soc/codecs/wm8903.c
parentMerge branch 'for-3.2' into for-3.3 (diff)
downloadlinux-a0f203d384fadacba514748cd0095efeadeed96c.tar.xz
linux-a0f203d384fadacba514748cd0095efeadeed96c.zip
ASoC: WM8903: Fix platform data gpio_cfg confusion
wm8903_platform_data.gpio_cfg[] was intended to be interpreted as follows: 0: Don't touch this GPIO's configuration register 1..7fff: Write that value to the GPIO's configuration register 8000: Write zero to the GPIO's configuration register other: Undefined (invalid) The rationale is that platform data is usually global data, and a value of zero means that the field wasn't explicitly set to anything (e.g. because the field was new to the pdata type, and existing users weren't update to initialize it) and hence the value zero should be ignored. 0x8000 is an explicit way to get 0 in the register. The code worked this way until commit 7cfe561 "ASoC: wm8903: Expose GPIOs through gpiolib", where the behaviour was changed due to my lack of awareness of the above rationale. This patch reverts to the intended behaviour, and updates all in-tree users to use the correct scheme. This also makes WM8903 consistent with other devices that use a similar scheme. WM8903_GPIO_NO_CONFIG is also renamed to WM8903_GPIO_CONFIG_ZERO so that its name accurately reflects its purpose. Signed-off-by: Stephen Warren <swarren@nvidia.com> Cc: Olof Johansson <olof@lixom.net> Cc: Colin Cross <ccross@android.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/wm8903.c')
-rw-r--r--sound/soc/codecs/wm8903.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
index e6ecede576dc..184b67730c39 100644
--- a/sound/soc/codecs/wm8903.c
+++ b/sound/soc/codecs/wm8903.c
@@ -1893,7 +1893,8 @@ static int wm8903_probe(struct snd_soc_codec *codec)
bool mic_gpio = false;
for (i = 0; i < ARRAY_SIZE(pdata->gpio_cfg); i++) {
- if (pdata->gpio_cfg[i] > 0x7fff)
+ if ((!pdata->gpio_cfg[i]) ||
+ (pdata->gpio_cfg[i] > WM8903_GPIO_CONFIG_ZERO))
continue;
snd_soc_write(codec, WM8903_GPIO_CONTROL_1 + i,