Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 216616
b: refs/heads/master
c: 4c14d78
h: refs/heads/master
v: v3
  • Loading branch information
Mark Brown committed Oct 7, 2010
1 parent e22dd17 commit af540af
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 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: de535a5be53a06738409538c471a10a9de357bdd
refs/heads/master: 4c14d78e8ad3bacfe1f70cb49ae17afcd658e368
2 changes: 1 addition & 1 deletion trunk/include/sound/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ struct snd_soc_jack_gpio {
int invert;
int debounce_time;
struct snd_soc_jack *jack;
struct work_struct work;
struct delayed_work work;

int (*jack_status_check)(void);
};
Expand Down
11 changes: 5 additions & 6 deletions trunk/sound/soc/soc-jack.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,6 @@ static void snd_soc_jack_gpio_detect(struct snd_soc_jack_gpio *gpio)
int enable;
int report;

if (gpio->debounce_time > 0)
mdelay(gpio->debounce_time);

enable = gpio_get_value(gpio->gpio);
if (gpio->invert)
enable = !enable;
Expand All @@ -211,7 +208,8 @@ static irqreturn_t gpio_handler(int irq, void *data)
{
struct snd_soc_jack_gpio *gpio = data;

schedule_work(&gpio->work);
schedule_delayed_work(&gpio->work,
msecs_to_jiffies(gpio->debounce_time));

return IRQ_HANDLED;
}
Expand All @@ -221,7 +219,7 @@ static void gpio_work(struct work_struct *work)
{
struct snd_soc_jack_gpio *gpio;

gpio = container_of(work, struct snd_soc_jack_gpio, work);
gpio = container_of(work, struct snd_soc_jack_gpio, work.work);
snd_soc_jack_gpio_detect(gpio);
}

Expand Down Expand Up @@ -262,7 +260,7 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
if (ret)
goto err;

INIT_WORK(&gpios[i].work, gpio_work);
INIT_DELAYED_WORK(&gpios[i].work, gpio_work);
gpios[i].jack = jack;

ret = request_irq(gpio_to_irq(gpios[i].gpio),
Expand Down Expand Up @@ -312,6 +310,7 @@ void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
gpio_unexport(gpios[i].gpio);
#endif
free_irq(gpio_to_irq(gpios[i].gpio), &gpios[i]);
cancel_delayed_work_sync(&gpios[i].work);
gpio_free(gpios[i].gpio);
gpios[i].jack = NULL;
}
Expand Down

0 comments on commit af540af

Please sign in to comment.