aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2005-05-01 11:58:43 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-01 11:58:43 -0400
commit4be8dc7ff69182610b40a078b9815bcdf27e0c49 (patch)
tree7719a011ea6af530e6055cddee9470e7cb8098f2
parent1bdacf88ebd7969fecbbf4c5b388cc094871222e (diff)
[PATCH] ppc64: improve g5 sound headphone mute
This patch fixes a couple more issues with the management of the GPIOs dealing with headphone and line out mute on the G5. It should fix the remaining problems of people not getting any sound out of the headphone jack. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--sound/ppc/tumbler.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c
index c71807e069ee..f3e010793a6a 100644
--- a/sound/ppc/tumbler.c
+++ b/sound/ppc/tumbler.c
@@ -177,11 +177,22 @@ static void write_audio_gpio(pmac_gpio_t *gp, int active)
177 if (! gp->addr) 177 if (! gp->addr)
178 return; 178 return;
179 active = active ? gp->active_val : gp->inactive_val; 179 active = active ? gp->active_val : gp->inactive_val;
180
181 do_gpio_write(gp, active); 180 do_gpio_write(gp, active);
182 DBG("(I) gpio %x write %d\n", gp->addr, active); 181 DBG("(I) gpio %x write %d\n", gp->addr, active);
183} 182}
184 183
184static int check_audio_gpio(pmac_gpio_t *gp)
185{
186 int ret;
187
188 if (! gp->addr)
189 return 0;
190
191 ret = do_gpio_read(gp);
192
193 return (ret & 0xd) == (gp->active_val & 0xd);
194}
195
185static int read_audio_gpio(pmac_gpio_t *gp) 196static int read_audio_gpio(pmac_gpio_t *gp)
186{ 197{
187 int ret; 198 int ret;
@@ -683,7 +694,7 @@ static int tumbler_get_mute_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_
683 } 694 }
684 if (gp == NULL) 695 if (gp == NULL)
685 return -EINVAL; 696 return -EINVAL;
686 ucontrol->value.integer.value[0] = ! read_audio_gpio(gp); 697 ucontrol->value.integer.value[0] = !check_audio_gpio(gp);
687 return 0; 698 return 0;
688} 699}
689 700
@@ -711,7 +722,7 @@ static int tumbler_put_mute_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_
711 } 722 }
712 if (gp == NULL) 723 if (gp == NULL)
713 return -EINVAL; 724 return -EINVAL;
714 val = ! read_audio_gpio(gp); 725 val = ! check_audio_gpio(gp);
715 if (val != ucontrol->value.integer.value[0]) { 726 if (val != ucontrol->value.integer.value[0]) {
716 write_audio_gpio(gp, ! ucontrol->value.integer.value[0]); 727 write_audio_gpio(gp, ! ucontrol->value.integer.value[0]);
717 return 1; 728 return 1;
@@ -897,11 +908,11 @@ static int tumbler_detect_lineout(pmac_t *chip)
897 908
898static void check_mute(pmac_t *chip, pmac_gpio_t *gp, int val, int do_notify, snd_kcontrol_t *sw) 909static void check_mute(pmac_t *chip, pmac_gpio_t *gp, int val, int do_notify, snd_kcontrol_t *sw)
899{ 910{
900 //pmac_tumbler_t *mix = chip->mixer_data; 911 if (check_audio_gpio(gp) != val) {
901 if (val != read_audio_gpio(gp)) {
902 write_audio_gpio(gp, val); 912 write_audio_gpio(gp, val);
903 if (do_notify) 913 if (do_notify)
904 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &sw->id); 914 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
915 &sw->id);
905 } 916 }
906} 917}
907 918