Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 647
b: refs/heads/master
c: 4be8dc7
h: refs/heads/master
i:
  645: f649916
  643: c08c42a
  639: 013b7b9
v: v3
  • Loading branch information
Benjamin Herrenschmidt authored and Linus Torvalds committed May 1, 2005
1 parent f4fc8c3 commit f7b0328
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 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: 1bdacf88ebd7969fecbbf4c5b388cc094871222e
refs/heads/master: 4be8dc7ff69182610b40a078b9815bcdf27e0c49
23 changes: 17 additions & 6 deletions trunk/sound/ppc/tumbler.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,22 @@ static void write_audio_gpio(pmac_gpio_t *gp, int active)
if (! gp->addr)
return;
active = active ? gp->active_val : gp->inactive_val;

do_gpio_write(gp, active);
DBG("(I) gpio %x write %d\n", gp->addr, active);
}

static int check_audio_gpio(pmac_gpio_t *gp)
{
int ret;

if (! gp->addr)
return 0;

ret = do_gpio_read(gp);

return (ret & 0xd) == (gp->active_val & 0xd);
}

static int read_audio_gpio(pmac_gpio_t *gp)
{
int ret;
Expand Down Expand Up @@ -683,7 +694,7 @@ static int tumbler_get_mute_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_
}
if (gp == NULL)
return -EINVAL;
ucontrol->value.integer.value[0] = ! read_audio_gpio(gp);
ucontrol->value.integer.value[0] = !check_audio_gpio(gp);
return 0;
}

Expand Down Expand Up @@ -711,7 +722,7 @@ static int tumbler_put_mute_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_
}
if (gp == NULL)
return -EINVAL;
val = ! read_audio_gpio(gp);
val = ! check_audio_gpio(gp);
if (val != ucontrol->value.integer.value[0]) {
write_audio_gpio(gp, ! ucontrol->value.integer.value[0]);
return 1;
Expand Down Expand Up @@ -897,11 +908,11 @@ static int tumbler_detect_lineout(pmac_t *chip)

static void check_mute(pmac_t *chip, pmac_gpio_t *gp, int val, int do_notify, snd_kcontrol_t *sw)
{
//pmac_tumbler_t *mix = chip->mixer_data;
if (val != read_audio_gpio(gp)) {
if (check_audio_gpio(gp) != val) {
write_audio_gpio(gp, val);
if (do_notify)
snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &sw->id);
snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
&sw->id);
}
}

Expand Down

0 comments on commit f7b0328

Please sign in to comment.