Commit 2fd53a7e authored by Andreas Schwab's avatar Andreas Schwab Committed by Jaroslav Kysela

[ALSA] [PPC,SOUND] Fix audio gpio state detection

When booting with line out or headphone plugged, you won't hear anything.
The problem is that after reset all channels are muted, but the actual
value of the gpio port doesn't exactly match the active_val settings as
expected by check_audio_gpio.  For example, the line_mute port is set to
7, but check_audio_gpio would expect 0xd or 0xf, thus its return value
indicates that it is not active, even though it is.  AFAICS only looking
at the low bit is enough to determine whether the port is active.
Signed-off-by: default avatarAndreas Schwab <schwab@suse.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent 927fc866
...@@ -190,7 +190,7 @@ static int check_audio_gpio(struct pmac_gpio *gp) ...@@ -190,7 +190,7 @@ static int check_audio_gpio(struct pmac_gpio *gp)
ret = do_gpio_read(gp); ret = do_gpio_read(gp);
return (ret & 0xd) == (gp->active_val & 0xd); return (ret & 0x1) == (gp->active_val & 0x1);
} }
static int read_audio_gpio(struct pmac_gpio *gp) static int read_audio_gpio(struct pmac_gpio *gp)
...@@ -198,7 +198,8 @@ static int read_audio_gpio(struct pmac_gpio *gp) ...@@ -198,7 +198,8 @@ static int read_audio_gpio(struct pmac_gpio *gp)
int ret; int ret;
if (! gp->addr) if (! gp->addr)
return 0; return 0;
ret = ((do_gpio_read(gp) & 0x02) !=0); ret = do_gpio_read(gp);
ret = (ret & 0x02) !=0;
return ret == gp->active_state; return ret == gp->active_state;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment