From abddd185a0195988b8a5e802d55aff91783489de Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Wed, 12 Jul 2006 15:41:18 +1000 Subject: [POWERPC] sound: Constify & voidify get_property() Now that get_property() returns a void *, there's no need to cast its return value. Also, treat the return value as const, so we can constify get_property later. powerpc-specific sound driver changes. Signed-off-by: Jeremy Kerr Signed-off-by: Paul Mackerras --- sound/ppc/tumbler.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'sound/ppc/tumbler.c') diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c index 692c611..b94ecd0 100644 --- a/sound/ppc/tumbler.c +++ b/sound/ppc/tumbler.c @@ -1035,7 +1035,7 @@ static struct device_node *find_audio_device(const char *name) return NULL; for (np = np->child; np; np = np->sibling) { - char *property = get_property(np, "audio-gpio", NULL); + const char *property = get_property(np, "audio-gpio", NULL); if (property && strcmp(property, name) == 0) return np; } @@ -1062,7 +1062,8 @@ static long tumbler_find_device(const char *device, const char *platform, struct pmac_gpio *gp, int is_compatible) { struct device_node *node; - u32 *base, addr; + const u32 *base; + u32 addr; if (is_compatible) node = find_compatible_audio_device(device); @@ -1074,9 +1075,9 @@ static long tumbler_find_device(const char *device, const char *platform, return -ENODEV; } - base = (u32 *)get_property(node, "AAPL,address", NULL); + base = get_property(node, "AAPL,address", NULL); if (! base) { - base = (u32 *)get_property(node, "reg", NULL); + base = get_property(node, "reg", NULL); if (!base) { DBG("(E) cannot find address for device %s !\n", device); snd_printd("cannot find address for device %s\n", device); @@ -1090,13 +1091,13 @@ static long tumbler_find_device(const char *device, const char *platform, gp->addr = addr & 0x0000ffff; /* Try to find the active state, default to 0 ! */ - base = (u32 *)get_property(node, "audio-gpio-active-state", NULL); + base = get_property(node, "audio-gpio-active-state", NULL); if (base) { gp->active_state = *base; gp->active_val = (*base) ? 0x5 : 0x4; gp->inactive_val = (*base) ? 0x4 : 0x5; } else { - u32 *prop = NULL; + const u32 *prop = NULL; gp->active_state = 0; gp->active_val = 0x4; gp->inactive_val = 0x5; @@ -1105,7 +1106,7 @@ static long tumbler_find_device(const char *device, const char *platform, * as we don't yet have an interpreter for these things */ if (platform) - prop = (u32 *)get_property(node, platform, NULL); + prop = get_property(node, platform, NULL); if (prop) { if (prop[3] == 0x9 && prop[4] == 0x9) { gp->active_val = 0xd; -- cgit v1.1 From 2fd53a7e9b1392f9cc3002a24f3c13b2796e70c3 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Fri, 1 Sep 2006 17:15:36 +0200 Subject: [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: Andreas Schwab Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- sound/ppc/tumbler.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sound/ppc/tumbler.c') diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c index 6ae2d5b..cdff53e 100644 --- a/sound/ppc/tumbler.c +++ b/sound/ppc/tumbler.c @@ -190,7 +190,7 @@ static int check_audio_gpio(struct pmac_gpio *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) @@ -198,7 +198,8 @@ static int read_audio_gpio(struct pmac_gpio *gp) int ret; if (! gp->addr) return 0; - ret = ((do_gpio_read(gp) & 0x02) !=0); + ret = do_gpio_read(gp); + ret = (ret & 0x02) !=0; return ret == gp->active_state; } -- cgit v1.1