Commit db817784 authored by Stephen Warren's avatar Stephen Warren Committed by Mark Brown

ASoC: WM8903: Remove conditionals checking pdata != NULL

The pdata pointer is now always valid. Remove any conditions that check
its validity.

This patch is mostly just removing an indentation level. One variable had
to be moved due to the removal of a scope, and one comment was split into
two. Viewing the patch with git show/diff -b will show that it's actually
very small.

Note that WM8903_MIC_BIAS_CONTROL_0 is now written unconditionally,
whereas it used to be written only if pdata was supplied. Since
defpdata.micdet_cfg = 0, this unconditional write simply echos the HW
defaults in the case where pdata is not supplied.

Based on work by John Bonesio, but significantly reworked since then.
Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent a0f203d3
......@@ -1842,7 +1842,7 @@ static void wm8903_init_gpio(struct snd_soc_codec *codec)
wm8903->gpio_chip.ngpio = WM8903_NUM_GPIO;
wm8903->gpio_chip.dev = codec->dev;
if (pdata && pdata->gpio_base)
if (pdata->gpio_base)
wm8903->gpio_chip.base = pdata->gpio_base;
else
wm8903->gpio_chip.base = -1;
......@@ -1878,6 +1878,7 @@ static int wm8903_probe(struct snd_soc_codec *codec)
int ret, i;
int trigger, irq_pol;
u16 val;
bool mic_gpio = false;
wm8903->codec = codec;
codec->control_data = wm8903->regmap;
......@@ -1888,10 +1889,7 @@ static int wm8903_probe(struct snd_soc_codec *codec)
return ret;
}
/* Set up GPIOs and microphone detection */
if (pdata) {
bool mic_gpio = false;
/* Set up GPIOs, detect if any are MIC detect outputs */
for (i = 0; i < ARRAY_SIZE(pdata->gpio_cfg); i++) {
if ((!pdata->gpio_cfg[i]) ||
(pdata->gpio_cfg[i] > WM8903_GPIO_CONFIG_ZERO))
......@@ -1913,6 +1911,7 @@ static int wm8903_probe(struct snd_soc_codec *codec)
}
}
/* Set up microphone detection */
snd_soc_write(codec, WM8903_MIC_BIAS_CONTROL_0,
pdata->micdet_cfg);
......@@ -1930,10 +1929,9 @@ static int wm8903_probe(struct snd_soc_codec *codec)
WARN_ON(!mic_gpio && (pdata->micdet_cfg & WM8903_MICDET_ENA));
wm8903->mic_delay = pdata->micdet_delay;
}
if (wm8903->irq) {
if (pdata && pdata->irq_active_low) {
if (pdata->irq_active_low) {
trigger = IRQF_TRIGGER_LOW;
irq_pol = WM8903_IRQ_POL;
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment