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;
}
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;
}
}
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;
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);
}
}