Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 316233
b: refs/heads/master
c: b7c95d9
h: refs/heads/master
i:
  316231: 5181e95
v: v3
  • Loading branch information
Mark Brown committed Jun 12, 2012
1 parent 0d27363 commit 606f15c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 35 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e373cbfb2f7d194e48d528794b3b99274d4c1a97
refs/heads/master: b7c95d9146c8201740e2ce9dca7fb1eb8b7b0053
65 changes: 31 additions & 34 deletions trunk/sound/soc/codecs/wm8903.c
Original file line number Diff line number Diff line change
Expand Up @@ -1895,9 +1895,7 @@ static void wm8903_free_gpio(struct wm8903_priv *wm8903)
static int wm8903_probe(struct snd_soc_codec *codec)
{
struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
struct wm8903_platform_data *pdata = wm8903->pdata;
int ret;
int trigger, irq_pol;
u16 val;

wm8903->codec = codec;
Expand All @@ -1909,32 +1907,6 @@ static int wm8903_probe(struct snd_soc_codec *codec)
return ret;
}

if (wm8903->irq) {
if (pdata->irq_active_low) {
trigger = IRQF_TRIGGER_LOW;
irq_pol = WM8903_IRQ_POL;
} else {
trigger = IRQF_TRIGGER_HIGH;
irq_pol = 0;
}

snd_soc_update_bits(codec, WM8903_INTERRUPT_CONTROL,
WM8903_IRQ_POL, irq_pol);

ret = request_threaded_irq(wm8903->irq, NULL, wm8903_irq,
trigger | IRQF_ONESHOT,
"wm8903", wm8903);
if (ret != 0) {
dev_err(codec->dev, "Failed to request IRQ: %d\n",
ret);
return ret;
}

/* Enable write sequencer interrupts */
snd_soc_update_bits(codec, WM8903_INTERRUPT_STATUS_1_MASK,
WM8903_IM_WSEQ_BUSY_EINT, 0);
}

/* power on device */
wm8903_set_bias_level(codec, SND_SOC_BIAS_STANDBY);

Expand Down Expand Up @@ -1975,11 +1947,7 @@ static int wm8903_probe(struct snd_soc_codec *codec)
/* power down chip */
static int wm8903_remove(struct snd_soc_codec *codec)
{
struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);

wm8903_set_bias_level(codec, SND_SOC_BIAS_OFF);
if (wm8903->irq)
free_irq(wm8903->irq, wm8903);

return 0;
}
Expand Down Expand Up @@ -2089,8 +2057,9 @@ static __devinit int wm8903_i2c_probe(struct i2c_client *i2c,
{
struct wm8903_platform_data *pdata = dev_get_platdata(&i2c->dev);
struct wm8903_priv *wm8903;
int trigger;
bool mic_gpio = false;
unsigned int val;
unsigned int val, irq_pol;
int ret, i;

wm8903 = devm_kzalloc(&i2c->dev, sizeof(struct wm8903_priv),
Expand All @@ -2108,7 +2077,6 @@ static __devinit int wm8903_i2c_probe(struct i2c_client *i2c,
}

i2c_set_clientdata(i2c, wm8903);
wm8903->irq = i2c->irq;

/* If no platform data was supplied, create storage for defaults */
if (pdata) {
Expand Down Expand Up @@ -2202,6 +2170,33 @@ static __devinit int wm8903_i2c_probe(struct i2c_client *i2c,

wm8903->mic_delay = pdata->micdet_delay;

if (i2c->irq) {
if (pdata->irq_active_low) {
trigger = IRQF_TRIGGER_LOW;
irq_pol = WM8903_IRQ_POL;
} else {
trigger = IRQF_TRIGGER_HIGH;
irq_pol = 0;
}

regmap_update_bits(wm8903->regmap, WM8903_INTERRUPT_CONTROL,
WM8903_IRQ_POL, irq_pol);

ret = request_threaded_irq(i2c->irq, NULL, wm8903_irq,
trigger | IRQF_ONESHOT,
"wm8903", wm8903);
if (ret != 0) {
dev_err(wm8903->dev, "Failed to request IRQ: %d\n",
ret);
return ret;
}

/* Enable write sequencer interrupts */
regmap_update_bits(wm8903->regmap,
WM8903_INTERRUPT_STATUS_1_MASK,
WM8903_IM_WSEQ_BUSY_EINT, 0);
}

ret = snd_soc_register_codec(&i2c->dev,
&soc_codec_dev_wm8903, &wm8903_dai, 1);
if (ret != 0)
Expand All @@ -2216,6 +2211,8 @@ static __devexit int wm8903_i2c_remove(struct i2c_client *client)
{
struct wm8903_priv *wm8903 = i2c_get_clientdata(client);

if (client->irq)
free_irq(client->irq, wm8903);
wm8903_free_gpio(wm8903);
snd_soc_unregister_codec(&client->dev);

Expand Down

0 comments on commit 606f15c

Please sign in to comment.