diff options
author | Mark Brown | 2010-03-15 17:46:02 +0000 |
---|---|---|
committer | Mark Brown | 2010-03-16 15:56:34 +0000 |
commit | 73b34ead7429789f35eea147a3e185abd61c7d94 (patch) | |
tree | bc70d0508b5ca6caf276d42e733e79d6838c6e1a /sound/soc/codecs/wm8903.c | |
parent | da34183e640ed380f708bf9ebcd592afda619028 (diff) |
ASoC: Add GPIO configuration support for WM8903
Allow users to pass in a default configuration for the GPIOs of
the WM8903 as platform data. This allows configuration of the pin
muxing of the device.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc/codecs/wm8903.c')
-rw-r--r-- | sound/soc/codecs/wm8903.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index 3595bd57c4eb..36952d77c271 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -1531,7 +1531,7 @@ static __devinit int wm8903_i2c_probe(struct i2c_client *i2c, { struct wm8903_priv *wm8903; struct snd_soc_codec *codec; - int ret; + int ret, i; u16 val; wm8903 = kzalloc(sizeof(struct wm8903_priv), GFP_KERNEL); @@ -1578,6 +1578,17 @@ static __devinit int wm8903_i2c_probe(struct i2c_client *i2c, wm8903_reset(codec); + /* Set up GPIOs */ + if (pdata) { + for (i = 0; i < ARRAY_SIZE(pdata->gpio_cfg); i++) { + if (!pdata->gpio_cfg[i]) + continue; + + snd_soc_write(codec, WM8903_GPIO_CONTROL_1 + i, + pdata->gpio_cfg[i] & 0xffff); + } + } + /* power on device */ wm8903_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |