Module Name: src Committed By: macallan Date: Sat Apr 11 01:42:56 UTC 2020
Modified Files: src/sys/arch/macppc/dev: snapper.c Log Message: don't try to read a 32bit property into a uint8_t. Now headphone detection works properly on machines which have the gpio's polarity reversed, like Quicksilver and TiBook. To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/sys/arch/macppc/dev/snapper.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/macppc/dev/snapper.c diff -u src/sys/arch/macppc/dev/snapper.c:1.53 src/sys/arch/macppc/dev/snapper.c:1.54 --- src/sys/arch/macppc/dev/snapper.c:1.53 Fri Sep 20 21:24:34 2019 +++ src/sys/arch/macppc/dev/snapper.c Sat Apr 11 01:42:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: snapper.c,v 1.53 2019/09/20 21:24:34 macallan Exp $ */ +/* $NetBSD: snapper.c,v 1.54 2020/04/11 01:42:56 macallan Exp $ */ /* Id: snapper.c,v 1.11 2002/10/31 17:42:13 tsubai Exp */ /* Id: i2s.c,v 1.12 2005/01/15 14:32:35 tsubai Exp */ @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.53 2019/09/20 21:24:34 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.54 2020/04/11 01:42:56 macallan Exp $"); #include <sys/param.h> #include <sys/audioio.h> @@ -497,7 +497,7 @@ static bus_size_t amp_mute; static bus_size_t headphone_mute; static bus_size_t audio_hw_reset; static bus_size_t headphone_detect; -static uint8_t headphone_detect_active; +static uint8_t headphone_detect_active = 0; /* I2S registers */ @@ -2091,9 +2091,10 @@ snapper_init(struct snapper_softc *sc, i /* extint-gpio15 */ if (strcmp(audio_gpio, "headphone-detect") == 0 || strcmp(name, "headphone-detect") == 0) { + uint32_t act; headphone_detect = addr; - OF_getprop(gpio, "audio-gpio-active-state", - &headphone_detect_active, 4); + OF_getprop(gpio, "audio-gpio-active-state", &act, 4); + headphone_detect_active = act; if (OF_getprop(gpio, "interrupts", intr, 8) == 8) { headphone_detect_intr = intr[0]; }