Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 363185
b: refs/heads/master
c: e2c0f47
h: refs/heads/master
i:
  363183: 8443e63
v: v3
  • Loading branch information
Charles Keepax authored and Mark Brown committed Apr 2, 2013
1 parent 50ee5bd commit e6dcbce
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 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: a3e2078d6a14bc67e733f7dbd32d1bc4051c9d90
refs/heads/master: e2c0f476ec90dbb020b1da7e399072e062ad6c9e
28 changes: 18 additions & 10 deletions trunk/drivers/extcon/extcon-arizona.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,22 +737,30 @@ static irqreturn_t arizona_micdet(int irq, void *data)
{
struct arizona_extcon_info *info = data;
struct arizona *arizona = info->arizona;
unsigned int val, lvl;
unsigned int val = 0, lvl;
int ret, i, key;

mutex_lock(&info->lock);

ret = regmap_read(arizona->regmap, ARIZONA_MIC_DETECT_3, &val);
if (ret != 0) {
dev_err(arizona->dev, "Failed to read MICDET: %d\n", ret);
mutex_unlock(&info->lock);
return IRQ_NONE;
}
for (i = 0; i < 10 && !(val & 0x7fc); i++) {
ret = regmap_read(arizona->regmap, ARIZONA_MIC_DETECT_3, &val);
if (ret != 0) {
dev_err(arizona->dev, "Failed to read MICDET: %d\n", ret);
mutex_unlock(&info->lock);
return IRQ_NONE;
}

dev_dbg(arizona->dev, "MICDET: %x\n", val);

dev_dbg(arizona->dev, "MICDET: %x\n", val);
if (!(val & ARIZONA_MICD_VALID)) {
dev_warn(arizona->dev, "Microphone detection state invalid\n");
mutex_unlock(&info->lock);
return IRQ_NONE;
}
}

if (!(val & ARIZONA_MICD_VALID)) {
dev_warn(arizona->dev, "Microphone detection state invalid\n");
if (i == 10 && !(val & 0x7fc)) {
dev_err(arizona->dev, "Failed to get valid MICDET value\n");
mutex_unlock(&info->lock);
return IRQ_NONE;
}
Expand Down

0 comments on commit e6dcbce

Please sign in to comment.