Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 216591
b: refs/heads/master
c: 45e6550
h: refs/heads/master
i:
  216589: 6d7ec23
  216587: 274ef82
  216583: 6f20500
  216575: c6c1946
v: v3
  • Loading branch information
Mark Brown committed Sep 29, 2010
1 parent 59e38ca commit 573dac7
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 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: ea738bade2111568a4e6b4b454e2dcd028bc17f6
refs/heads/master: 45e655047fd64ba7eb52d14ef5acc41763c8ea34
2 changes: 2 additions & 0 deletions trunk/include/sound/wm8962.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
struct wm8962_pdata {
u32 gpio_init[WM8962_MAX_GPIO];

bool irq_active_low;

bool spk_mono; /* Speaker outputs tied together as mono */
};

Expand Down
60 changes: 59 additions & 1 deletion trunk/sound/soc/codecs/wm8962.c
Original file line number Diff line number Diff line change
Expand Up @@ -1461,6 +1461,29 @@ static struct snd_soc_dai_driver wm8962_dai = {
.symmetric_rates = 1,
};

static irqreturn_t wm8962_irq(int irq, void *data)
{
struct snd_soc_codec *codec = data;
int mask;
int active;

mask = snd_soc_read(codec, WM8962_INTERRUPT_STATUS_2);

active = snd_soc_read(codec, WM8962_INTERRUPT_STATUS_2);
active &= ~mask;

if (active & WM8962_FIFOS_ERR_EINT)
dev_err(codec->dev, "FIFO error\n");

if (active & WM8962_TEMP_SHUT_EINT)
dev_crit(codec->dev, "Thermal shutdown\n");

/* Acknowledge the interrupts */
snd_soc_write(codec, WM8962_INTERRUPT_STATUS_2, active);

return IRQ_HANDLED;
}

#ifdef CONFIG_PM
static int wm8962_resume(struct snd_soc_codec *codec)
{
Expand Down Expand Up @@ -1632,7 +1655,9 @@ static int wm8962_probe(struct snd_soc_codec *codec)
int ret;
struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec);
struct wm8962_pdata *pdata = dev_get_platdata(codec->dev);
int i;
struct i2c_client *i2c = container_of(codec->dev, struct i2c_client,
dev);
int i, trigger, irq_pol;

wm8962->codec = codec;

Expand Down Expand Up @@ -1748,6 +1773,34 @@ static int wm8962_probe(struct snd_soc_codec *codec)

wm8962_init_beep(codec);

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

snd_soc_update_bits(codec, WM8962_INTERRUPT_CONTROL,
WM8962_IRQ_POL, irq_pol);

ret = request_threaded_irq(i2c->irq, NULL, wm8962_irq,
trigger | IRQF_ONESHOT,
"wm8962", codec);
if (ret != 0) {
dev_err(codec->dev, "Failed to request IRQ %d: %d\n",
i2c->irq, ret);
/* Non-fatal */
} else {
/* Enable error reporting IRQs by default */
snd_soc_update_bits(codec,
WM8962_INTERRUPT_STATUS_2_MASK,
WM8962_TEMP_SHUT_EINT |
WM8962_FIFOS_ERR_EINT, 0);
}
}

return 0;

err_enable:
Expand All @@ -1762,8 +1815,13 @@ static int wm8962_probe(struct snd_soc_codec *codec)
static int wm8962_remove(struct snd_soc_codec *codec)
{
struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec);
struct i2c_client *i2c = container_of(codec->dev, struct i2c_client,
dev);
int i;

if (i2c->irq)
free_irq(i2c->irq, codec);

wm8962_free_beep(codec);
for (i = 0; i < ARRAY_SIZE(wm8962->supplies); i++)
regulator_unregister_notifier(wm8962->supplies[i].consumer,
Expand Down

0 comments on commit 573dac7

Please sign in to comment.