Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/macppc/dev don't try to read a 32bit property into ...



details:   https://anonhg.NetBSD.org/src/rev/da81a36db684
branches:  trunk
changeset: 1009049:da81a36db684
user:      macallan <macallan%NetBSD.org@localhost>
date:      Sat Apr 11 01:42:56 2020 +0000

description:
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.

diffstat:

 sys/arch/macppc/dev/snapper.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (40 lines):

diff -r 0cf844d69dca -r da81a36db684 sys/arch/macppc/dev/snapper.c
--- a/sys/arch/macppc/dev/snapper.c     Fri Apr 10 23:58:48 2020 +0000
+++ b/sys/arch/macppc/dev/snapper.c     Sat Apr 11 01:42:56 2020 +0000
@@ -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 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 @@
                /* 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];
                        }



Home | Main Index | Thread Index | Old Index