CVS commit: src/sys/arch/macppc/dev

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:06:06 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
Output is always 16bit, the internal audio data type may differ.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 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.65 src/sys/arch/macppc/dev/snapper.c:1.66
--- src/sys/arch/macppc/dev/snapper.c:1.65	Thu Jun  2 16:22:27 2022
+++ src/sys/arch/macppc/dev/snapper.c	Mon Dec 11 13:06:06 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: snapper.c,v 1.65 2022/06/02 16:22:27 macallan Exp $	*/
+/*	$NetBSD: snapper.c,v 1.66 2023/12/11 13:06:06 mlelstv 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 
-__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.65 2022/06/02 16:22:27 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.66 2023/12/11 13:06:06 mlelstv Exp $");
 
 #include 
 #include 
@@ -187,7 +187,7 @@ snapper_volume(audio_filter_arg_t *arg)
 {
 	struct snapper_softc *sc;
 	const aint_t *src;
-	aint_t *dst;
+	int16_t *dst;
 	u_int sample_count;
 	u_int i;
 



CVS commit: src/sys/arch/macppc/dev

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:06:06 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
Output is always 16bit, the internal audio data type may differ.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 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.



CVS commit: src/sys/arch/macppc/dev

2023-09-24 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Sep 24 10:59:24 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: zs.c

Log Message:
pass NULL to the second dbdma_alloc() expected argement.
it was not adjusted after it acquired one 7 years ago.

fixes ZS_TXDMA enabled build for macppc.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/macppc/dev/zs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/macppc/dev

2023-09-24 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Sep 24 10:59:24 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: zs.c

Log Message:
pass NULL to the second dbdma_alloc() expected argement.
it was not adjusted after it acquired one 7 years ago.

fixes ZS_TXDMA enabled build for macppc.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/macppc/dev/zs.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/zs.c
diff -u src/sys/arch/macppc/dev/zs.c:1.58 src/sys/arch/macppc/dev/zs.c:1.59
--- src/sys/arch/macppc/dev/zs.c:1.58	Sat Sep 23 12:48:23 2023
+++ src/sys/arch/macppc/dev/zs.c	Sun Sep 24 10:59:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs.c,v 1.58 2023/09/23 12:48:23 andvar Exp $	*/
+/*	$NetBSD: zs.c,v 1.59 2023/09/24 10:59:24 andvar Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998 Bill Studenmund
@@ -49,7 +49,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.58 2023/09/23 12:48:23 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.59 2023/09/24 10:59:24 andvar Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -259,7 +259,7 @@ zsc_attach(device_t parent, device_t sel
 #ifdef ZS_TXDMA
 		zsc->zsc_txdmareg[channel] = mapiodev(regs[2], regs[3], false);
 		zsc->zsc_txdmacmd[channel] =
-			dbdma_alloc(sizeof(dbdma_command_t) * 3);
+			dbdma_alloc(sizeof(dbdma_command_t) * 3, NULL);
 		memset(zsc->zsc_txdmacmd[channel], 0,
 			sizeof(dbdma_command_t) * 3);
 		dbdma_reset(zsc->zsc_txdmareg[channel]);



CVS commit: src/sys/arch/macppc/dev

2023-09-24 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Sep 24 10:51:28 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: valkyriefb.c

Log Message:
define i variable in for loop.
valkyriefb_attach() doesn't have one defined in the function scope.

fixes VALKYRIEFB_DEBUG enabled build for macppc.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/macppc/dev/valkyriefb.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/valkyriefb.c
diff -u src/sys/arch/macppc/dev/valkyriefb.c:1.8 src/sys/arch/macppc/dev/valkyriefb.c:1.9
--- src/sys/arch/macppc/dev/valkyriefb.c:1.8	Wed Feb 16 23:49:26 2022
+++ src/sys/arch/macppc/dev/valkyriefb.c	Sun Sep 24 10:51:28 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: valkyriefb.c,v 1.8 2022/02/16 23:49:26 riastradh Exp $	*/
+/*	$NetBSD: valkyriefb.c,v 1.9 2023/09/24 10:51:28 andvar Exp $	*/
 
 /*
  * Copyright (c) 2012 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: valkyriefb.c,v 1.8 2022/02/16 23:49:26 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: valkyriefb.c,v 1.9 2023/09/24 10:51:28 andvar Exp $");
 
 #include 
 #include 
@@ -209,7 +209,7 @@ valkyriefb_attach(device_t parent, devic
 	aprint_verbose_dev(sc->sc_dev, "waiting for videopll...\n");
 	sc->sc_base = (uint8_t *)ca->ca_reg[0];
 #ifdef VALKYRIEFB_DEBUG
-	for (i = 0; i < 0x40; i += 8) {
+	for (int i = 0; i < 0x40; i += 8) {
 		aprint_error_dev(sc->sc_dev, "%02x: %02x\n", i,
 		valkyriefb_read_reg(sc, i));
 	}



CVS commit: src/sys/arch/macppc/dev

2023-09-24 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Sep 24 10:51:28 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: valkyriefb.c

Log Message:
define i variable in for loop.
valkyriefb_attach() doesn't have one defined in the function scope.

fixes VALKYRIEFB_DEBUG enabled build for macppc.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/macppc/dev/valkyriefb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/macppc/dev

2023-09-24 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Sep 24 08:20:06 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: mesh.c

Log Message:
define i variable in for loop.
mesh_msgin() doesn't have one defined in the function scope.

fixes MESH_DEBUG enabled build for macppc.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/macppc/dev/mesh.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/macppc/dev

2023-09-24 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Sep 24 08:20:06 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: mesh.c

Log Message:
define i variable in for loop.
mesh_msgin() doesn't have one defined in the function scope.

fixes MESH_DEBUG enabled build for macppc.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/macppc/dev/mesh.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/mesh.c
diff -u src/sys/arch/macppc/dev/mesh.c:1.42 src/sys/arch/macppc/dev/mesh.c:1.43
--- src/sys/arch/macppc/dev/mesh.c:1.42	Sat Aug  7 16:18:57 2021
+++ src/sys/arch/macppc/dev/mesh.c	Sun Sep 24 08:20:06 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mesh.c,v 1.42 2021/08/07 16:18:57 thorpej Exp $	*/
+/*	$NetBSD: mesh.c,v 1.43 2023/09/24 08:20:06 andvar Exp $	*/
 
 /*-
  * Copyright (c) 2000	Tsubai Masanari.
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mesh.c,v 1.42 2021/08/07 16:18:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mesh.c,v 1.43 2023/09/24 08:20:06 andvar Exp $");
 
 #include 
 #include 
@@ -694,7 +694,7 @@ mesh_msgin(struct mesh_softc *sc, struct
 gotit:
 #ifdef MESH_DEBUG
 	printf("msgin:");
-	for (i = 0; i < sc->sc_imsglen; i++)
+	for (int i = 0; i < sc->sc_imsglen; i++)
 		printf(" 0x%02x", sc->sc_imsg[i]);
 	printf("\n");
 #endif



CVS commit: src/sys/arch/macppc/dev

2023-09-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Sep  6 08:14:42 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: cuda.c

Log Message:
yet another tsleep/wakeup -> cv_*


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/macppc/dev/cuda.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/cuda.c
diff -u src/sys/arch/macppc/dev/cuda.c:1.29 src/sys/arch/macppc/dev/cuda.c:1.30
--- src/sys/arch/macppc/dev/cuda.c:1.29	Sat Aug  7 16:18:57 2021
+++ src/sys/arch/macppc/dev/cuda.c	Wed Sep  6 08:14:42 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: cuda.c,v 1.29 2021/08/07 16:18:57 thorpej Exp $ */
+/*	$NetBSD: cuda.c,v 1.30 2023/09/06 08:14:42 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cuda.c,v 1.29 2021/08/07 16:18:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cuda.c,v 1.30 2023/09/06 08:14:42 macallan Exp $");
 
 #include 
 #include 
@@ -93,7 +93,8 @@ struct cuda_softc {
 	/* time */
 	uint32_t sc_tod;
 	uint32_t sc_autopoll;
-	uint32_t sc_todev;
+	kcondvar_t sc_todev;
+	kmutex_t sc_todevmtx;
 	/* ADB */
 	void (*sc_adb_handler)(void *, int, uint8_t *);
 	void *sc_adb_cookie;
@@ -197,6 +198,9 @@ cuda_attach(device_t parent, device_t se
 	sc->sc_error = 0;
 	sc->sc_i2c_read_len = 0;
 
+	cv_init(>sc_todev, "cuda_event");
+	mutex_init(>sc_todevmtx, MUTEX_DEFAULT, IPL_NONE);
+
 	if (bus_space_map(sc->sc_memt, ca->ca_reg[0] + ca->ca_baseaddr,
 	ca->ca_reg[1], 0, >sc_memh) != 0) {
 
@@ -728,7 +732,8 @@ cuda_error_handler(void *cookie, int len
 	 * byte 3 seems to be the failed command
 	 */
 	sc->sc_error = 1;
-	wakeup(>sc_todev);
+	DPRINTF("cuda error %02x %02x %02x %02x\n", data[0], data[1], data[2], data[3]);
+	cv_signal(>sc_todev);
 	return 0;
 }
 
@@ -763,7 +768,7 @@ cuda_todr_handler(void *cookie, int len,
 			sc->sc_iic_done = len;
 			break;
 	}
-	wakeup(>sc_todev);
+	cv_signal(>sc_todev);
 	return 0;
 }
 
@@ -781,7 +786,10 @@ cuda_todr_get(todr_chip_handle_t tch, st
 		cuda_send(sc, 0, 2, cmd);
 
 		while ((sc->sc_tod == 0) && (cnt < 10)) {
-			tsleep(>sc_todev, 0, "todr", 10);
+			mutex_enter(>sc_todevmtx);
+			cv_timedwait(>sc_todev, >sc_todevmtx, hz);
+			mutex_exit(>sc_todevmtx);
+
 			cnt++;
 		}
 
@@ -817,7 +825,9 @@ cuda_todr_set(todr_chip_handle_t tch, st
 	sc->sc_tod = 0;
 	if (cuda_send(sc, 0, 6, cmd) == 0) {
 		while (sc->sc_tod == 0) {
-			tsleep(>sc_todev, 0, "todr", 10);
+			mutex_enter(>sc_todevmtx);
+			cv_timedwait(>sc_todev, >sc_todevmtx, hz);
+			mutex_exit(>sc_todevmtx);
 		}
 		return 0;
 	}
@@ -874,8 +884,11 @@ cuda_autopoll(void *cookie, int flag)
 	while(sc->sc_autopoll == -1) {
 		if (sc->sc_polling || cold) {
 			cuda_poll(sc);
-		} else
-			tsleep(>sc_todev, 0, "autopoll", 100);
+		} else {
+			mutex_enter(>sc_todevmtx);
+			cv_timedwait(>sc_todev, >sc_todevmtx, hz);
+			mutex_exit(>sc_todevmtx);
+		}
 	}
 }
 	
@@ -962,8 +975,11 @@ cuda_i2c_exec(void *cookie, i2c_op_t op,
 	while ((sc->sc_iic_done == 0) && (sc->sc_error == 0)) {
 		if (sc->sc_polling || cold) {
 			cuda_poll(sc);
-		} else
-			tsleep(>sc_todev, 0, "i2c", 1000);
+		} else {
+			mutex_enter(>sc_todevmtx);
+			cv_timedwait(>sc_todev, >sc_todevmtx, hz);
+			mutex_exit(>sc_todevmtx);
+		}
 	}
 
 	if (sc->sc_error) {
@@ -988,8 +1004,11 @@ cuda_i2c_exec(void *cookie, i2c_op_t op,
 		while ((sc->sc_iic_done == 0) && (sc->sc_error == 0)) {
 			if (sc->sc_polling || cold) {
 cuda_poll(sc);
-			} else
-tsleep(>sc_todev, 0, "i2c", 1000);
+			} else {
+mutex_enter(>sc_todevmtx);
+cv_timedwait(>sc_todev, >sc_todevmtx, hz);
+mutex_exit(>sc_todevmtx);
+			}
 		}
 
 		if (sc->sc_error) {



CVS commit: src/sys/arch/macppc/dev

2023-09-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Sep  6 08:14:42 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: cuda.c

Log Message:
yet another tsleep/wakeup -> cv_*


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/macppc/dev/cuda.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/macppc/dev

2023-08-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug 30 08:38:51 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: awacs.c

Log Message:
don't abuse the interrupt lock for waits in the event thread


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/macppc/dev/awacs.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/awacs.c
diff -u src/sys/arch/macppc/dev/awacs.c:1.51 src/sys/arch/macppc/dev/awacs.c:1.52
--- src/sys/arch/macppc/dev/awacs.c:1.51	Fri Mar  5 07:15:53 2021
+++ src/sys/arch/macppc/dev/awacs.c	Wed Aug 30 08:38:51 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: awacs.c,v 1.51 2021/03/05 07:15:53 rin Exp $	*/
+/*	$NetBSD: awacs.c,v 1.52 2023/08/30 08:38:51 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: awacs.c,v 1.51 2021/03/05 07:15:53 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awacs.c,v 1.52 2023/08/30 08:38:51 macallan Exp $");
 
 #include 
 #include 
@@ -102,6 +102,7 @@ struct awacs_softc {
 	struct dbdma_command *sc_idmacmd;
 
 	kmutex_t sc_lock;
+	kmutex_t sc_event_lock;
 	kmutex_t sc_intr_lock;
 };
 
@@ -375,6 +376,7 @@ awacs_attach(device_t parent, device_t s
 	intr_xname);
 
 	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_NONE);
+	mutex_init(>sc_event_lock, MUTEX_DEFAULT, IPL_NONE);
 	mutex_init(>sc_intr_lock, MUTEX_DEFAULT, IPL_AUDIO);
 
 	cv_init(>sc_event, "awacs_wait");
@@ -1274,9 +1276,10 @@ awacs_thread(void *cookie)
 {
 	struct awacs_softc *sc = cookie;
 	
-	mutex_enter(>sc_intr_lock);
 	while (1) {
-		cv_timedwait(>sc_event, >sc_intr_lock, hz);
+		mutex_enter(>sc_event_lock);
+		cv_timedwait(>sc_event, >sc_event_lock, hz);
+		mutex_exit(>sc_event_lock);
 		if (sc->sc_output_wanted == sc->sc_output_mask)
 			continue;
 



CVS commit: src/sys/arch/macppc/dev

2023-08-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug 30 08:38:51 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: awacs.c

Log Message:
don't abuse the interrupt lock for waits in the event thread


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/macppc/dev/awacs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/macppc/dev

2023-08-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug 30 07:42:41 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: pmu.c

Log Message:
remove ancient #if 0 block
NFC


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/macppc/dev/pmu.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/pmu.c
diff -u src/sys/arch/macppc/dev/pmu.c:1.40 src/sys/arch/macppc/dev/pmu.c:1.41
--- src/sys/arch/macppc/dev/pmu.c:1.40	Tue Aug 22 06:43:34 2023
+++ src/sys/arch/macppc/dev/pmu.c	Wed Aug 30 07:42:41 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmu.c,v 1.40 2023/08/22 06:43:34 macallan Exp $ */
+/*	$NetBSD: pmu.c,v 1.41 2023/08/30 07:42:41 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.40 2023/08/22 06:43:34 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.41 2023/08/30 07:42:41 macallan Exp $");
 
 #include 
 #include 
@@ -762,21 +762,6 @@ done:
 	return 1;
 }
 
-#if 0
-static int
-pmu_error_handler(void *cookie, int len, uint8_t *data)
-{
-	struct pmu_softc *sc = cookie;
-
-	/* 
-	 * something went wrong
-	 * byte 3 seems to be the failed command
-	 */
-	sc->sc_error = 1;
-	wakeup(>sc_todev);
-	return 0;
-}
-#endif
 #define DIFF19041970 2082844800
 
 static int



CVS commit: src/sys/arch/macppc/dev

2023-08-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug 30 07:42:41 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: pmu.c

Log Message:
remove ancient #if 0 block
NFC


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/macppc/dev/pmu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/macppc/dev

2023-08-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Aug 22 06:43:34 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: pmu.c

Log Message:
tsleep()/wakeup() -> cv_*


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/macppc/dev/pmu.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/pmu.c
diff -u src/sys/arch/macppc/dev/pmu.c:1.39 src/sys/arch/macppc/dev/pmu.c:1.40
--- src/sys/arch/macppc/dev/pmu.c:1.39	Sat Aug  7 16:18:58 2021
+++ src/sys/arch/macppc/dev/pmu.c	Tue Aug 22 06:43:34 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmu.c,v 1.39 2021/08/07 16:18:58 thorpej Exp $ */
+/*	$NetBSD: pmu.c,v 1.40 2023/08/22 06:43:34 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.39 2021/08/07 16:18:58 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.40 2023/08/22 06:43:34 macallan Exp $");
 
 #include 
 #include 
@@ -36,6 +36,7 @@ __KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.39
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -105,7 +106,8 @@ struct pmu_softc {
 	lwp_t *sc_thread;
 	int sc_pending;
 	/* signalling the event thread */
-	int sc_event;
+	kcondvar_t sc_event;
+	kmutex_t sc_evmtx;
 	/* ADB */
 	void (*sc_adb_handler)(void *, int, uint8_t *);
 	void *sc_adb_cookie;
@@ -296,6 +298,9 @@ pmu_attach(device_t parent, device_t sel
 	sc->sc_button = 0;
 	sc->sc_env_mask = 0xff;
 
+	cv_init(>sc_event, "pmu_event");
+	mutex_init(>sc_evmtx, MUTEX_DEFAULT, IPL_NONE);
+	
 	/*
 	 * core99 PowerMacs like to send environment messages with the lid
 	 * switch bit set - since that doesn't make any sense here and it
@@ -699,14 +704,14 @@ pmu_intr(void *arg)
 		DPRINTF("brightness: %d volume %d\n", resp[2], resp[3]);
 		sc->sc_brightness_wanted = resp[2];
 		sc->sc_volume_wanted = resp[3];
-		wakeup(>sc_event);
+		cv_signal(>sc_event);
 		goto done;
 	}
 	if (resp[1] & PMU_INT_PCEJECT) {
 		/* deal with PCMCIA eject buttons */
 		DPRINTF("card eject %d\n", resp[3]);
 		atomic_or_32(>sc_pending, (resp[3] & 3));
-		wakeup(>sc_event);
+		cv_signal(>sc_event);
 		goto done;
 	}
 	if (resp[1] & PMU_INT_BATTERY) {
@@ -719,7 +724,7 @@ pmu_intr(void *arg)
 	}
 	if (resp[1] & PMU_INT_ENVIRONMENT) {
 		uint8_t diff;
-#ifdef PMU_VERBOSE
+#ifdef PMU_DEBUG
 		/* deal with environment messages */
 		printf("environment:");
 		for (i = 2; i < len; i++)
@@ -732,12 +737,12 @@ pmu_intr(void *arg)
 		if (diff & PMU_ENV_LID_CLOSED) {
 			sc->sc_lid_closed = (resp[2] & PMU_ENV_LID_CLOSED) != 0;
 			atomic_or_32(>sc_pending, PMU_EV_LID);
-			wakeup(>sc_event);
+			cv_signal(>sc_event);
 		}
 		if (diff & PMU_ENV_POWER_BUTTON) {
 			sc->sc_button = (resp[2] & PMU_ENV_POWER_BUTTON) != 0;
 			atomic_or_32(>sc_pending, PMU_EV_BUTTON);
-			wakeup(>sc_event);
+			cv_signal(>sc_event);
 		}
 		goto done;
 	}
@@ -1054,7 +1059,8 @@ pmu_thread(void *cookie)
 	int ticks = hz, i;
 	
 	while (1) {
-		tsleep(>sc_event, PWAIT, "wait", ticks);
+		mutex_enter(>sc_evmtx);
+		cv_timedwait(>sc_event, >sc_evmtx, ticks);
 		if ((sc->sc_pending & 3) != 0) {
 			DPRINTF("eject %d\n", sc->sc_pending & 3);
 			for (i = 1; i < 3; i++) {
@@ -1062,7 +1068,7 @@ pmu_thread(void *cookie)
 	pmu_eject_card(sc, i);
 			}
 		}
-
+		mutex_exit(>sc_evmtx);
 		/* see if we need to update brightness */
 		if (sc->sc_brightness_wanted != sc->sc_brightness) {
 			pmu_update_brightness(sc);



CVS commit: src/sys/arch/macppc/dev

2023-08-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Aug 22 06:43:34 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: pmu.c

Log Message:
tsleep()/wakeup() -> cv_*


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/macppc/dev/pmu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/macppc/dev

2022-12-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Dec 28 07:34:42 UTC 2022

Modified Files:
src/sys/arch/macppc/dev: obio.c

Log Message:
one more skiplist entry...


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/macppc/dev/obio.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/obio.c
diff -u src/sys/arch/macppc/dev/obio.c:1.52 src/sys/arch/macppc/dev/obio.c:1.53
--- src/sys/arch/macppc/dev/obio.c:1.52	Wed Dec 28 07:12:36 2022
+++ src/sys/arch/macppc/dev/obio.c	Wed Dec 28 07:34:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: obio.c,v 1.52 2022/12/28 07:12:36 macallan Exp $	*/
+/*	$NetBSD: obio.c,v 1.53 2022/12/28 07:34:42 macallan Exp $	*/
 
 /*-
  * Copyright (C) 1998	Internet Research Institute, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.52 2022/12/28 07:12:36 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.53 2022/12/28 07:34:42 macallan Exp $");
 
 #include 
 #include 
@@ -281,6 +281,7 @@ static const char * const skiplist[] = {
 	"interrupt-controller",
 	"chrp,open-pic",
 	"open-pic",
+	"mpic",
 	"gpio",
 	"escc-legacy",
 	"timer",



CVS commit: src/sys/arch/macppc/dev

2022-12-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Dec 28 07:34:42 UTC 2022

Modified Files:
src/sys/arch/macppc/dev: obio.c

Log Message:
one more skiplist entry...


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/macppc/dev/obio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/macppc/dev

2022-12-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Dec 28 07:18:29 UTC 2022

Modified Files:
src/sys/arch/macppc/dev: uni-n.c

Log Message:
don't complain about mpic and dart not being configured
mpic is handled elsewhere, dart is an iommu we don't use yet


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/macppc/dev/uni-n.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/macppc/dev

2022-12-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Dec 28 07:18:29 UTC 2022

Modified Files:
src/sys/arch/macppc/dev: uni-n.c

Log Message:
don't complain about mpic and dart not being configured
mpic is handled elsewhere, dart is an iommu we don't use yet


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/macppc/dev/uni-n.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/uni-n.c
diff -u src/sys/arch/macppc/dev/uni-n.c:1.12 src/sys/arch/macppc/dev/uni-n.c:1.13
--- src/sys/arch/macppc/dev/uni-n.c:1.12	Sat Jan 22 11:49:16 2022
+++ src/sys/arch/macppc/dev/uni-n.c	Wed Dec 28 07:18:29 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: uni-n.c,v 1.12 2022/01/22 11:49:16 thorpej Exp $	*/
+/*	$NetBSD: uni-n.c,v 1.13 2022/12/28 07:18:29 macallan Exp $	*/
 
 /*-
  * Copyright (C) 2005 Michael Lorenz.
@@ -31,7 +31,7 @@
  */
  
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uni-n.c,v 1.12 2022/01/22 11:49:16 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uni-n.c,v 1.13 2022/12/28 07:18:29 macallan Exp $");
 
 #include 
 #include 
@@ -63,6 +63,17 @@ CFATTACH_DECL_NEW(uni_n, sizeof(struct u
 static uint8_t eeprom[2][160];
 #endif
 
+static const char *skiplist[] = {
+	"openpic",
+	"chrp,open-pic",
+	"open-pic",
+	"mpic",
+	"dart",
+	"u3-dart",
+	"u4-dart",
+	NULL
+};
+
 int
 uni_n_match(device_t parent, cfdata_t cf, void *aux)
 {
@@ -108,7 +119,7 @@ uni_n_attach(device_t parent, device_t s
 #if NFCU > 0
 	/*
 	 * zero out eeprom blocks, then see if we have valid data
-	 * doing this here because the EEPROMs are dangling from out i2c bus
+	 * doing this here because the EEPROMs are dangling from our i2c bus
 	 * but we can get all the data just from looking at the properties
 	 */
 	memset(eeprom, 0, sizeof(eeprom));
@@ -116,6 +127,7 @@ uni_n_attach(device_t parent, device_t s
 	OF_getprop(cpuid, "cpuid", eeprom[0], sizeof(eeprom[0]));
 	if (eeprom[0][1] != 0)
 		aprint_normal_dev(self, "found EEPROM data for CPU 0\n");
+
 	cpuid = OF_finddevice("/u3/i2c/cpuid@a2");
 	OF_getprop(cpuid, "cpuid", eeprom[1], sizeof(eeprom[1]));
 	if (eeprom[1][1] != 0)
@@ -131,6 +143,7 @@ uni_n_attach(device_t parent, device_t s
 
 	devhandle_t selfh = device_handle(self);
 	for (child = OF_child(node); child; child = OF_peer(child)) {
+		if (of_compatible(child, skiplist)) continue;
 		namelen = OF_getprop(child, "name", name, sizeof(name));
 		if (namelen < 0)
 			continue;



CVS commit: src/sys/arch/macppc/dev

2022-12-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Dec 28 07:12:36 UTC 2022

Modified Files:
src/sys/arch/macppc/dev: obio.c

Log Message:
suppress 'not configured' message for mpic on G5s


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/macppc/dev/obio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/macppc/dev

2022-12-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Dec 28 07:12:36 UTC 2022

Modified Files:
src/sys/arch/macppc/dev: obio.c

Log Message:
suppress 'not configured' message for mpic on G5s


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/macppc/dev/obio.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/obio.c
diff -u src/sys/arch/macppc/dev/obio.c:1.51 src/sys/arch/macppc/dev/obio.c:1.52
--- src/sys/arch/macppc/dev/obio.c:1.51	Sat Jan 22 11:49:16 2022
+++ src/sys/arch/macppc/dev/obio.c	Wed Dec 28 07:12:36 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: obio.c,v 1.51 2022/01/22 11:49:16 thorpej Exp $	*/
+/*	$NetBSD: obio.c,v 1.52 2022/12/28 07:12:36 macallan Exp $	*/
 
 /*-
  * Copyright (C) 1998	Internet Research Institute, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.51 2022/01/22 11:49:16 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.52 2022/12/28 07:12:36 macallan Exp $");
 
 #include 
 #include 
@@ -279,6 +279,8 @@ obio_attach(device_t parent, device_t se
 
 static const char * const skiplist[] = {
 	"interrupt-controller",
+	"chrp,open-pic",
+	"open-pic",
 	"gpio",
 	"escc-legacy",
 	"timer",



CVS commit: src/sys/arch/macppc/dev

2022-09-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 18 11:08:29 UTC 2022

Modified Files:
src/sys/arch/macppc/dev: if_gm.c

Log Message:
Eliminate use of IFF_OACTIVE.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/macppc/dev/if_gm.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/if_gm.c
diff -u src/sys/arch/macppc/dev/if_gm.c:1.58 src/sys/arch/macppc/dev/if_gm.c:1.59
--- src/sys/arch/macppc/dev/if_gm.c:1.58	Fri Mar  5 07:15:53 2021
+++ src/sys/arch/macppc/dev/if_gm.c	Sun Sep 18 11:08:29 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gm.c,v 1.58 2021/03/05 07:15:53 rin Exp $	*/
+/*	$NetBSD: if_gm.c,v 1.59 2022/09/18 11:08:29 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gm.c,v 1.58 2021/03/05 07:15:53 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gm.c,v 1.59 2022/09/18 11:08:29 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -75,6 +75,7 @@ struct gmac_softc {
 	struct gmac_dma *sc_txlist;
 	struct gmac_dma *sc_rxlist;
 	int sc_txnext;
+	bool sc_txbusy;
 	int sc_rxlast;
 	void *sc_txbuf[NTXBUF];
 	void *sc_rxbuf[NRXBUF];
@@ -337,7 +338,7 @@ gmac_tint(struct gmac_softc *sc)
 {
 	struct ifnet *ifp = >sc_if;
 
-	ifp->if_flags &= ~IFF_OACTIVE;
+	sc->sc_txbusy = false;
 	ifp->if_timer = 0;
 	if_schedule_deferred_start(ifp);
 }
@@ -446,13 +447,10 @@ gmac_start(struct ifnet *ifp)
 	int i, tlen;
 	volatile struct gmac_dma *dp;
 
-	if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+	if ((ifp->if_flags & IFF_RUNNING) == 0)
 		return;
 
-	for (;;) {
-		if (ifp->if_flags & IFF_OACTIVE)
-			break;
-
+	while (!sc->sc_txbusy) {
 		IFQ_DEQUEUE(>if_snd, m);
 		if (m == 0)
 			break;
@@ -489,7 +487,7 @@ gmac_start(struct ifnet *ifp)
 		if (i == NTXBUF)
 			i = 0;
 		if (i == gmac_read_reg(sc, GMAC_TXDMACOMPLETE)) {
-			ifp->if_flags |= IFF_OACTIVE;
+			sc->sc_txbusy = true;
 			break;
 		}
 	}
@@ -732,7 +730,7 @@ gmac_init(struct gmac_softc *sc)
 	gmac_write_reg(sc, GMAC_INTMASK, ~(GMAC_INT_TXEMPTY | GMAC_INT_RXDONE));
 
 	ifp->if_flags |= IFF_RUNNING;
-	ifp->if_flags &= ~IFF_OACTIVE;
+	sc->sc_txbusy = false;
 	ifp->if_timer = 0;
 
 	callout_reset(>sc_tick_ch, 1, gmac_mii_tick, sc);



CVS commit: src/sys/arch/macppc/dev

2022-09-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 18 11:08:29 UTC 2022

Modified Files:
src/sys/arch/macppc/dev: if_gm.c

Log Message:
Eliminate use of IFF_OACTIVE.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/macppc/dev/if_gm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/macppc/dev

2022-09-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 18 10:59:22 UTC 2022

Modified Files:
src/sys/arch/macppc/dev: if_bm.c

Log Message:
Eliminate use of IFF_OACTIVE.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/macppc/dev/if_bm.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/if_bm.c
diff -u src/sys/arch/macppc/dev/if_bm.c:1.64 src/sys/arch/macppc/dev/if_bm.c:1.65
--- src/sys/arch/macppc/dev/if_bm.c:1.64	Fri Mar  5 07:15:53 2021
+++ src/sys/arch/macppc/dev/if_bm.c	Sun Sep 18 10:59:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bm.c,v 1.64 2021/03/05 07:15:53 rin Exp $	*/
+/*	$NetBSD: if_bm.c,v 1.65 2022/09/18 10:59:22 thorpej Exp $	*/
 
 /*-
  * Copyright (C) 1998, 1999, 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.64 2021/03/05 07:15:53 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.65 2022/09/18 10:59:22 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -90,6 +90,7 @@ struct bmac_softc {
 	void *sc_rxbuf;
 	int sc_rxlast;
 	int sc_flags;
+	bool sc_txbusy;
 	struct mii_data sc_mii;
 	u_char sc_enaddr[6];
 };
@@ -382,7 +383,7 @@ bmac_init(struct bmac_softc *sc)
 	bmac_write_reg(sc, INTDISABLE, NormalIntEvents);
 
 	ifp->if_flags |= IFF_RUNNING;
-	ifp->if_flags &= ~IFF_OACTIVE;
+	sc->sc_txbusy = false;
 	ifp->if_timer = 0;
 
 	data = sc->sc_txbuf;
@@ -440,7 +441,7 @@ bmac_intr(void *v)
 #endif
 
 	if (stat & IntFrameSent) {
-		sc->sc_if.if_flags &= ~IFF_OACTIVE;
+		sc->sc_txbusy = false;
 		sc->sc_if.if_timer = 0;
 		if_statinc(>sc_if, if_opackets);
 		if_schedule_deferred_start(>sc_if);
@@ -561,13 +562,10 @@ bmac_start(struct ifnet *ifp)
 	struct mbuf *m;
 	int tlen;
 
-	if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+	if ((ifp->if_flags & IFF_RUNNING) == 0)
 		return;
 
-	while (1) {
-		if (ifp->if_flags & IFF_OACTIVE)
-			return;
-
+	while (!sc->sc_txbusy) {
 		IFQ_DEQUEUE(>if_snd, m);
 		if (m == 0)
 			break;
@@ -577,7 +575,7 @@ bmac_start(struct ifnet *ifp)
 		 */
 		bpf_mtap(ifp, m, BPF_D_OUT);
 
-		ifp->if_flags |= IFF_OACTIVE;
+		sc->sc_txbusy = true;
 		tlen = bmac_put(sc, sc->sc_txbuf, m);
 
 		/* 5 seconds to watch for failing to transmit */



CVS commit: src/sys/arch/macppc/dev

2022-09-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 18 10:59:22 UTC 2022

Modified Files:
src/sys/arch/macppc/dev: if_bm.c

Log Message:
Eliminate use of IFF_OACTIVE.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/macppc/dev/if_bm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/macppc/dev

2022-09-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 18 10:54:53 UTC 2022

Modified Files:
src/sys/arch/macppc/dev: am79c950.c if_mcvar.h

Log Message:
Eliminate use of IFF_OACTIVE.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/macppc/dev/am79c950.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/macppc/dev/if_mcvar.h

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/am79c950.c
diff -u src/sys/arch/macppc/dev/am79c950.c:1.50 src/sys/arch/macppc/dev/am79c950.c:1.51
--- src/sys/arch/macppc/dev/am79c950.c:1.50	Tue Oct 20 18:17:58 2020
+++ src/sys/arch/macppc/dev/am79c950.c	Sun Sep 18 10:54:52 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: am79c950.c,v 1.50 2020/10/20 18:17:58 roy Exp $	*/
+/*	$NetBSD: am79c950.c,v 1.51 2022/09/18 10:54:52 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1997 David Huang 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: am79c950.c,v 1.50 2020/10/20 18:17:58 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: am79c950.c,v 1.51 2022/09/18 10:54:52 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -250,13 +250,10 @@ mcstart(struct ifnet *ifp)
 	struct mc_softc	*sc = ifp->if_softc;
 	struct mbuf	*m;
 
-	if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+	if ((ifp->if_flags & IFF_RUNNING) == 0)
 		return;
 
-	while (1) {
-		if (ifp->if_flags & IFF_OACTIVE)
-			return;
-
+	while (!sc->sc_txbusy) {
 		IF_DEQUEUE(>if_snd, m);
 		if (m == 0)
 			return;
@@ -268,7 +265,7 @@ mcstart(struct ifnet *ifp)
 		bpf_mtap(ifp, m, BPF_D_OUT);
 
 		/* Copy the mbuf chain into the transmit buffer. */
-		ifp->if_flags |= IFF_OACTIVE;
+		sc->sc_txbusy = true;
 		maceput(sc, m);
 
 		if_statinc(ifp, if_opackets);		/* # of pkts */
@@ -348,7 +345,7 @@ mcinit(struct mc_softc *sc)
 
 	/* Flag interface as "running" */
 	sc->sc_if.if_flags |= IFF_RUNNING;
-	sc->sc_if.if_flags &= ~IFF_OACTIVE;
+	sc->sc_txbusy = false;
 
 	splx(s);
 	return 0;
@@ -515,7 +512,7 @@ mc_tint(struct mc_softc *sc)
 	}
 	IF_STAT_PUTREF(>sc_if);
 
-	sc->sc_if.if_flags &= ~IFF_OACTIVE;
+	sc->sc_txbusy = false;
 	sc->sc_if.if_timer = 0;
 	if_schedule_deferred_start(>sc_if);
 }

Index: src/sys/arch/macppc/dev/if_mcvar.h
diff -u src/sys/arch/macppc/dev/if_mcvar.h:1.13 src/sys/arch/macppc/dev/if_mcvar.h:1.14
--- src/sys/arch/macppc/dev/if_mcvar.h:1.13	Tue Jul 26 08:36:02 2011
+++ src/sys/arch/macppc/dev/if_mcvar.h	Sun Sep 18 10:54:52 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mcvar.h,v 1.13 2011/07/26 08:36:02 macallan Exp $	*/
+/*	$NetBSD: if_mcvar.h,v 1.14 2022/09/18 10:54:52 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1997 David Huang 
@@ -86,6 +86,7 @@ struct mc_softc {
 	u_char		*sc_txbuf, *sc_rxbuf;
 	int		sc_txbuf_phys, sc_rxbuf_phys;
 	int		sc_tail;
+	bool		sc_txbusy;
 
 	int		sc_node;
 	dbdma_regmap_t	*sc_txdma;



CVS commit: src/sys/arch/macppc/dev

2022-09-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 18 10:54:53 UTC 2022

Modified Files:
src/sys/arch/macppc/dev: am79c950.c if_mcvar.h

Log Message:
Eliminate use of IFF_OACTIVE.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/macppc/dev/am79c950.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/macppc/dev/if_mcvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/macppc/dev

2022-06-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Jun 29 17:59:40 UTC 2022

Modified Files:
src/sys/arch/macppc/dev: ki2c.c

Log Message:
Use old limit of 32 + 32 bytes to keep combining buffer on stack.
There are no devices on this platform that need more and for larger
values, the driver should be better rewritten.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/macppc/dev/ki2c.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/macppc/dev

2022-06-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Jun 29 17:59:40 UTC 2022

Modified Files:
src/sys/arch/macppc/dev: ki2c.c

Log Message:
Use old limit of 32 + 32 bytes to keep combining buffer on stack.
There are no devices on this platform that need more and for larger
values, the driver should be better rewritten.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/macppc/dev/ki2c.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/ki2c.c
diff -u src/sys/arch/macppc/dev/ki2c.c:1.32 src/sys/arch/macppc/dev/ki2c.c:1.33
--- src/sys/arch/macppc/dev/ki2c.c:1.32	Sat Aug  7 16:18:57 2021
+++ src/sys/arch/macppc/dev/ki2c.c	Wed Jun 29 17:59:40 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ki2c.c,v 1.32 2021/08/07 16:18:57 thorpej Exp $	*/
+/*	$NetBSD: ki2c.c,v 1.33 2022/06/29 17:59:40 mlelstv Exp $	*/
 /*	Id: ki2c.c,v 1.7 2002/10/05 09:56:05 tsubai Exp	*/
 
 /*-
@@ -44,6 +44,9 @@
 #define DPRINTF while (0) printf
 #endif
 
+#define KI2C_EXEC_MAX_CMDLEN	32
+#define KI2C_EXEC_MAX_BUFLEN	32
+
 int ki2c_match(device_t, cfdata_t, void *);
 void ki2c_attach(device_t, device_t, void *);
 inline uint8_t ki2c_readreg(struct ki2c_softc *, int);
@@ -393,7 +396,7 @@ ki2c_i2c_exec(void *cookie, i2c_op_t op,
 	int i;
 	size_t w_len;
 	uint8_t *wp;
-	uint8_t wrbuf[I2C_EXEC_MAX_CMDLEN + I2C_EXEC_MAX_CMDLEN];
+	uint8_t wrbuf[KI2C_EXEC_MAX_CMDLEN + KI2C_EXEC_MAX_CMDLEN];
 	uint8_t channel;
 
 	/*
@@ -404,6 +407,13 @@ ki2c_i2c_exec(void *cookie, i2c_op_t op,
 	if (cmdlen == 0 && buflen == 0)
 		return -1;
 
+	/*
+	 * Transaction could be much larger now. Bail if it exceeds our
+	 * small combining buffer, we don't expect such devices.
+	 */
+	if (cmdlen + buflen > sizeof(wrbuf))
+		return -1;
+
 	channel = (addr & 0xf80) ? 0x10 : 0x00;
 	addr &= 0x7f;
 	



CVS commit: src/sys/arch/macppc/dev

2022-06-02 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jun  2 16:22:27 UTC 2022

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
check platform-do-*-mute properties to find out the resp. GPIO's polarity
now this works properly on pmac7,3


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 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.64 src/sys/arch/macppc/dev/snapper.c:1.65
--- src/sys/arch/macppc/dev/snapper.c:1.64	Wed Jun  1 06:05:47 2022
+++ src/sys/arch/macppc/dev/snapper.c	Thu Jun  2 16:22:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: snapper.c,v 1.64 2022/06/01 06:05:47 martin Exp $	*/
+/*	$NetBSD: snapper.c,v 1.65 2022/06/02 16:22:27 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 
-__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.64 2022/06/01 06:05:47 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.65 2022/06/02 16:22:27 macallan Exp $");
 
 #include 
 #include 
@@ -1962,9 +1962,9 @@ gpio_write(bus_size_t addr, int val)
 	obio_write_1(addr, data);
 }
 
-#define headphone_active 0	/* XXX OF */
-#define lineout_active 0	/* XXX OF */
-#define amp_active 0		/* XXX OF */
+int headphone_active = 0;
+int lineout_active = 0;
+int amp_active = 0;
 
 static void
 snapper_mute_speaker(struct snapper_softc *sc, int mute)
@@ -1977,9 +1977,9 @@ snapper_mute_speaker(struct snapper_soft
 		if (mute)
 			x = amp_active;		/* mute */
 		else
-			x = !amp_active;	/* unmute */
-		if (x != gpio_read(amp_mute))
-			gpio_write(amp_mute, x);
+			x = amp_active ^ 1;	/* unmute */
+
+		gpio_write(amp_mute, x);
 
 		DPRINTF("%d\n", gpio_read(amp_mute));
 	}
@@ -1996,9 +1996,9 @@ snapper_mute_headphone(struct snapper_so
 		if (mute)
 			x = headphone_active;	/* mute */
 		else
-			x = !headphone_active;	/* unmute */
-		if (x != gpio_read(headphone_mute))
-			gpio_write(headphone_mute, x);
+			x = headphone_active ^ 1;	/* unmute */
+
+		gpio_write(headphone_mute, x);
 
 		DPRINTF("%d\n", gpio_read(headphone_mute));
 	}
@@ -2015,9 +2015,9 @@ snapper_mute_lineout(struct snapper_soft
 		if (mute)
 			x = lineout_active;	/* mute */
 		else
-			x = !lineout_active;	/* unmute */
-		if (x != gpio_read(lineout_mute))
-			gpio_write(lineout_mute, x);
+			x = lineout_active ^ 1;	/* unmute */
+
+		gpio_write(lineout_mute, x);
 
 		DPRINTF("%d\n", gpio_read(lineout_mute));
 	}
@@ -2134,7 +2134,7 @@ snapper_init(struct snapper_softc *sc, i
 {
 	int gpio;
 	int headphone_detect_intr, lineout_detect_intr;
-	uint32_t gpio_base, reg[1], fcreg;
+	uint32_t gpio_base, reg[1], fcreg, buf[8];
 	char intr_xname[INTRDEVNAMEBUF];
 #ifdef SNAPPER_DEBUG
 	char fcr[32];
@@ -2182,12 +2182,26 @@ snapper_init(struct snapper_softc *sc, i
 
 		/* gpio5 */
 		if (strcmp(audio_gpio, "headphone-mute") == 0 ||
-		strcmp(name, "headphone-mute") == 0)
+		strcmp(name, "headphone-mute") == 0) {
 			headphone_mute = addr;
+			if (OF_getprop(gpio,
+			"platform-do-headphone-mute", buf, 20) == 20) {
+headphone_active = buf[3] & 1;
+DPRINTF("platform-do-headphone-mute %d\n",
+headphone_active);
+			}
+		}
 		/* gpio6 */
 		if (strcmp(audio_gpio, "amp-mute") == 0 ||
-		strcmp(name, "amp-mute") == 0)
+		strcmp(name, "amp-mute") == 0) {
 			amp_mute = addr;
+			if (OF_getprop(gpio,
+			"platform-do-amp-mute", buf, 20) == 20) {
+amp_active = buf[3] & 1;
+DPRINTF("platform-do-amp-mute %d\n",
+amp_active);
+			}
+		}
 		/* extint-gpio15 */
 		if (strcmp(audio_gpio, "headphone-detect") == 0 ||
 		strcmp(name, "headphone-detect") == 0) {
@@ -2201,8 +2215,15 @@ snapper_init(struct snapper_softc *sc, i
 		}
 		if (strcmp(audio_gpio, "lineout-mute") == 0 ||
 		strcmp(name, "lineout-mute") == 0 ||
-		strcmp(name, "line-output-mute") == 0)
+		strcmp(name, "line-output-mute") == 0) {
 			lineout_mute = addr;
+			if (OF_getprop(gpio,
+			"platform-do-lineout-mute", buf, 20) == 20) {
+lineout_active = buf[3] & 1;
+DPRINTF("platform-do-lineout-mute %d\n",
+lineout_active);
+			}
+		}
 		if (strcmp(audio_gpio, "lineout-detect") == 0 ||
 		strcmp(name, "lineout-detect") == 0 ||
 		strcmp(name, "line-output-detect") == 0) {
@@ -2242,8 +2263,8 @@ snapper_init(struct snapper_softc *sc, i
 	if (headphone_detect_intr != -1) {
 		snprintf(intr_xname, sizeof(intr_xname), "%s headphone",
 		device_xname(sc->sc_dev));
-		intr_establish_xname(headphone_detect_intr, IST_EDGE, IPL_AUDIO,
-		snapper_cint, sc, intr_xname);
+		intr_establish_xname(headphone_detect_intr, IST_EDGE,
+		IPL_AUDIO, snapper_cint, sc, intr_xname);
 	}
 
 	if (lineout_detect_intr != -1) {



CVS commit: src/sys/arch/macppc/dev

2022-06-02 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jun  2 16:22:27 UTC 2022

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
check platform-do-*-mute properties to find out the resp. GPIO's polarity
now this works properly on pmac7,3


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 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.



CVS commit: src/sys/arch/macppc/dev

2022-06-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun  1 06:05:47 UTC 2022

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
Revert previous, the mask is intented to be like sc_output_mask, a bitmask
of active ports.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 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.63 src/sys/arch/macppc/dev/snapper.c:1.64
--- src/sys/arch/macppc/dev/snapper.c:1.63	Wed Jun  1 05:47:37 2022
+++ src/sys/arch/macppc/dev/snapper.c	Wed Jun  1 06:05:47 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: snapper.c,v 1.63 2022/06/01 05:47:37 martin Exp $	*/
+/*	$NetBSD: snapper.c,v 1.64 2022/06/01 06:05:47 martin 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 
-__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.63 2022/06/01 05:47:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.64 2022/06/01 06:05:47 martin Exp $");
 
 #include 
 #include 
@@ -1274,11 +1274,11 @@ snapper_query_devinfo(void *h, mixer_dev
 		dip->prev = dip->next = AUDIO_MIXER_LAST;
 		dip->un.s.num_mem = 3;
 		strcpy(dip->un.s.member[0].label.name, AudioNspeaker);
-		dip->un.s.member[0].mask = (1 << 1)|(1 << 2);
+		dip->un.s.member[0].mask = 1 << 0;
 		strcpy(dip->un.s.member[1].label.name, AudioNheadphone);
-		dip->un.s.member[1].mask = (1 << 0)|(1 << 2);
+		dip->un.s.member[1].mask = 1 << 1;
 		strcpy(dip->un.s.member[2].label.name, AudioNline);
-		dip->un.s.member[2].mask = (1 << 0)|(1 << 1);
+		dip->un.s.member[2].mask = 1 << 2;
 		return 0;
 
 	case SNAPPER_VOL_OUTPUT:



CVS commit: src/sys/arch/macppc/dev

2022-06-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun  1 06:05:47 UTC 2022

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
Revert previous, the mask is intented to be like sc_output_mask, a bitmask
of active ports.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 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.



CVS commit: src/sys/arch/macppc/dev

2022-05-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun  1 05:47:37 UTC 2022

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
In SNAPPER_OUTPUT_SELECT the "mask" is a bitmap of muted outputs, not
active outputs.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 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.62 src/sys/arch/macppc/dev/snapper.c:1.63
--- src/sys/arch/macppc/dev/snapper.c:1.62	Wed Jun  1 05:42:52 2022
+++ src/sys/arch/macppc/dev/snapper.c	Wed Jun  1 05:47:37 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: snapper.c,v 1.62 2022/06/01 05:42:52 martin Exp $	*/
+/*	$NetBSD: snapper.c,v 1.63 2022/06/01 05:47:37 martin 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 
-__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.62 2022/06/01 05:42:52 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.63 2022/06/01 05:47:37 martin Exp $");
 
 #include 
 #include 
@@ -1274,11 +1274,11 @@ snapper_query_devinfo(void *h, mixer_dev
 		dip->prev = dip->next = AUDIO_MIXER_LAST;
 		dip->un.s.num_mem = 3;
 		strcpy(dip->un.s.member[0].label.name, AudioNspeaker);
-		dip->un.s.member[0].mask = 1 << 0;
+		dip->un.s.member[0].mask = (1 << 1)|(1 << 2);
 		strcpy(dip->un.s.member[1].label.name, AudioNheadphone);
-		dip->un.s.member[1].mask = 1 << 1;
+		dip->un.s.member[1].mask = (1 << 0)|(1 << 2);
 		strcpy(dip->un.s.member[2].label.name, AudioNline);
-		dip->un.s.member[2].mask = 1 << 2;
+		dip->un.s.member[2].mask = (1 << 0)|(1 << 1);
 		return 0;
 
 	case SNAPPER_VOL_OUTPUT:



CVS commit: src/sys/arch/macppc/dev

2022-05-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun  1 05:47:37 UTC 2022

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
In SNAPPER_OUTPUT_SELECT the "mask" is a bitmap of muted outputs, not
active outputs.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 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.



CVS commit: src/sys/arch/macppc/dev

2022-05-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun  1 05:42:52 UTC 2022

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
Recognize the OF labels used for line output and headphone output on a
G5 powermac 7,3.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 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.61 src/sys/arch/macppc/dev/snapper.c:1.62
--- src/sys/arch/macppc/dev/snapper.c:1.61	Sat Aug  7 16:18:58 2021
+++ src/sys/arch/macppc/dev/snapper.c	Wed Jun  1 05:42:52 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: snapper.c,v 1.61 2021/08/07 16:18:58 thorpej Exp $	*/
+/*	$NetBSD: snapper.c,v 1.62 2022/06/01 05:42:52 martin 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 
-__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.61 2021/08/07 16:18:58 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.62 2022/06/01 05:42:52 martin Exp $");
 
 #include 
 #include 
@@ -2200,10 +2200,12 @@ snapper_init(struct snapper_softc *sc, i
 			}
 		}
 		if (strcmp(audio_gpio, "lineout-mute") == 0 ||
-		strcmp(name, "lineout-mute") == 0)
+		strcmp(name, "lineout-mute") == 0 ||
+		strcmp(name, "line-output-mute") == 0)
 			lineout_mute = addr;
 		if (strcmp(audio_gpio, "lineout-detect") == 0 ||
-		strcmp(name, "lineout-detect") == 0) {
+		strcmp(name, "lineout-detect") == 0 ||
+		strcmp(name, "line-output-detect") == 0) {
 			uint32_t act = 0;
 			lineout_detect = addr;
 			OF_getprop(gpio, "audio-gpio-active-state", , 4);



CVS commit: src/sys/arch/macppc/dev

2022-05-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun  1 05:42:52 UTC 2022

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
Recognize the OF labels used for line output and headphone output on a
G5 powermac 7,3.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 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.



CVS commit: src/sys/arch/macppc/dev

2022-02-10 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Feb 11 04:23:19 UTC 2022

Modified Files:
src/sys/arch/macppc/dev: apm.c

Log Message:
Remove some #ifdef __OpenBSD__ code that's not complete and thus doesn't
serve much point in existing here.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/macppc/dev/apm.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/apm.c
diff -u src/sys/arch/macppc/dev/apm.c:1.31 src/sys/arch/macppc/dev/apm.c:1.32
--- src/sys/arch/macppc/dev/apm.c:1.31	Sun Sep 26 16:36:19 2021
+++ src/sys/arch/macppc/dev/apm.c	Fri Feb 11 04:23:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: apm.c,v 1.31 2021/09/26 16:36:19 thorpej Exp $	*/
+/*	$NetBSD: apm.c,v 1.32 2022/02/11 04:23:18 thorpej Exp $	*/
 /*	$OpenBSD: apm.c,v 1.5 2002/06/07 07:13:59 miod Exp $	*/
 
 /*-
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: apm.c,v 1.31 2021/09/26 16:36:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apm.c,v 1.32 2022/02/11 04:23:18 thorpej Exp $");
 
 #include "apm.h"
 
@@ -49,18 +49,10 @@ __KERNEL_RCSID(0, "$NetBSD: apm.c,v 1.31
 #include 
 #include 
 #include 
-#ifdef __OpenBSD__
-#include 
-#endif
-#ifdef __NetBSD__
 #include 
 #include 
 #include 
-#endif
 
-#ifdef __OpenBSD__
-#include 
-#endif
 #include 
 #include 
 
@@ -77,9 +69,6 @@ __KERNEL_RCSID(0, "$NetBSD: apm.c,v 1.31
 
 struct apm_softc {
 	struct selinfo sc_rsel;
-#ifdef __OpenBSD__
-	struct klist sc_note;
-#endif
 	intsc_flags;
 	int	event_count;
 	int	event_ptr;
@@ -93,31 +82,19 @@ struct apm_softc {
  * APM module.  This is both the APM thread itself, as well as
  * user context.
  */
-#ifdef __NetBSD__
 #define	APM_LOCK(apmsc)		mutex_enter(&(apmsc)->sc_lock)
 #define	APM_UNLOCK(apmsc)	mutex_exit(&(apmsc)->sc_lock)
-#else
-#define APM_LOCK(apmsc)
-#define APM_UNLOCK(apmsc)
-#endif
 
 int apmmatch(device_t, cfdata_t, void *);
 void apmattach(device_t, device_t, void *);
 
-#ifdef __NetBSD__
 #if 0
 static int	apm_record_event(struct apm_softc *, u_int);
 #endif
-#endif
 
 CFATTACH_DECL_NEW(apm, sizeof(struct apm_softc),
 apmmatch, apmattach, NULL, NULL);
 
-#ifdef __OpenBSD__
-struct cfdriver apm_cd = {
-	NULL, "apm", DV_DULL
-};
-#else
 extern struct cfdriver apm_cd;
 
 dev_type_open(apmopen);
@@ -140,7 +117,6 @@ const struct cdevsw apm_cdevsw = {
 	.d_discard = nodiscard,
 	.d_flag = 0
 };
-#endif
 
 int	apm_evindex;
 
@@ -365,7 +341,6 @@ apmioctl(dev_t dev, u_long cmd, void *da
 	return error;
 }
 
-#ifdef __NetBSD__
 #if 0
 /*
  * return 0 if the user will notice and handle the event,
@@ -410,7 +385,6 @@ apmpoll(dev_t dev, int events, struct lw
 
 	return (revents);
 }
-#endif
 
 static void
 filt_apmrdetach(struct knote *kn)



CVS commit: src/sys/arch/macppc/dev

2022-02-10 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Feb 11 04:23:19 UTC 2022

Modified Files:
src/sys/arch/macppc/dev: apm.c

Log Message:
Remove some #ifdef __OpenBSD__ code that's not complete and thus doesn't
serve much point in existing here.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/macppc/dev/apm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/macppc/dev

2021-09-11 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Sep 11 16:29:18 UTC 2021

Modified Files:
src/sys/arch/macppc/dev: obiofan.c

Log Message:
fix license copypasta
NFC


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/macppc/dev/obiofan.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/obiofan.c
diff -u src/sys/arch/macppc/dev/obiofan.c:1.1 src/sys/arch/macppc/dev/obiofan.c:1.2
--- src/sys/arch/macppc/dev/obiofan.c:1.1	Fri Sep 10 23:32:17 2021
+++ src/sys/arch/macppc/dev/obiofan.c	Sat Sep 11 16:29:18 2021
@@ -1,8 +1,7 @@
-/*	$NetBSD: obiofan.c,v 1.1 2021/09/10 23:32:17 macallan Exp $	*/
-/*	Id: ki2c.c,v 1.7 2002/10/05 09:56:05 tsubai Exp	*/
+/*	$NetBSD: obiofan.c,v 1.2 2021/09/11 16:29:18 macallan Exp $	*/
 
 /*-
- * Copyright (c) 2006 Michael Lorenz
+ * Copyright (c) 2021 Michael Lorenz
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without



CVS commit: src/sys/arch/macppc/dev

2021-09-11 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Sep 11 16:29:18 UTC 2021

Modified Files:
src/sys/arch/macppc/dev: obiofan.c

Log Message:
fix license copypasta
NFC


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/macppc/dev/obiofan.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/macppc/dev

2019-11-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Nov 23 05:13:11 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: psoc.c

Log Message:
don't invalidate sensors every time we fail to read fan speeds


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/macppc/dev/psoc.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/psoc.c
diff -u src/sys/arch/macppc/dev/psoc.c:1.2 src/sys/arch/macppc/dev/psoc.c:1.3
--- src/sys/arch/macppc/dev/psoc.c:1.2	Fri Nov 22 05:16:54 2019
+++ src/sys/arch/macppc/dev/psoc.c	Sat Nov 23 05:13:11 2019
@@ -1,7 +1,7 @@
- /* $NetBSD: psoc.c,v 1.2 2019/11/22 05:16:54 macallan Exp $ */
+ /* $NetBSD: psoc.c,v 1.3 2019/11/23 05:13:11 macallan Exp $ */
 
 /*-
- * Copyright (c) 2018 Michael Lorenz
+ * Copyright (c) 2019 Michael Lorenz
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.2 2019/11/22 05:16:54 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.3 2019/11/23 05:13:11 macallan Exp $");
 
 #include 
 #include 
@@ -159,7 +159,7 @@ psoc_sensors_refresh(struct sysmon_envsy
 {
 	struct psoc_softc *sc = sme->sme_cookie;
 	uint8_t cmd = 6;
-	uint8_t buf[0x28], *bptr;
+	uint8_t buf[0x28];
 	int error = 1, data;
 
 	if ( edata->private < 0x20) {
@@ -183,26 +183,24 @@ psoc_sensors_refresh(struct sysmon_envsy
 			psoc_dump(sc);
 #endif
 	} else {
-		cmd = 0x20;
+		cmd = edata->private;
 		iic_acquire_bus(sc->sc_i2c, 0);
 		error = iic_exec(sc->sc_i2c, I2C_OP_READ_WITH_STOP,
-			sc->sc_addr, , 1, buf, 12, 0);
+			sc->sc_addr, , 1, buf, 3, 0);
 		iic_release_bus(sc->sc_i2c, 0);
 		if (error) return;
-		if (edata->private >= 0x20) {
-			bptr = [edata->private - 0x20];
-			switch (bptr[0] & 0xf0) {
-case 0x50:
-	data = bptr[edata->private - 0x20];
-	edata->value_cur = ((bptr[2] & 0x3f) << 6) | (bptr[1] & 0x3f);
-	break;
-case 0x60:
-	edata->value_cur = 0;
-	break;
-default:
-	error = -1;
-			}	
-		}
+		switch (buf[0] & 0xf0) {
+			case 0x50:
+data = buf[edata->private - 0x20];
+edata->value_cur = ((buf[2] & 0x3f) << 6) |
+		(buf[1] & 0x3f);
+break;
+			case 0x60:
+edata->value_cur = 0;
+break;
+			default:
+error = 0;
+		}	
 	}
 	if (error) {
 		edata->state = ENVSYS_SINVALID;



CVS commit: src/sys/arch/macppc/dev

2019-11-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Nov 23 05:13:11 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: psoc.c

Log Message:
don't invalidate sensors every time we fail to read fan speeds


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/macppc/dev/psoc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/macppc/dev

2019-11-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Nov 22 05:16:54 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: psoc.c

Log Message:
report fan speeds
disclaimer:
this is guesswork obtained from watching temperatures, listening to fan noise
and staring at register dumps. Use with caution.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/macppc/dev/psoc.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/psoc.c
diff -u src/sys/arch/macppc/dev/psoc.c:1.1 src/sys/arch/macppc/dev/psoc.c:1.2
--- src/sys/arch/macppc/dev/psoc.c:1.1	Fri Nov  1 17:51:56 2019
+++ src/sys/arch/macppc/dev/psoc.c	Fri Nov 22 05:16:54 2019
@@ -1,4 +1,4 @@
- /* $NetBSD: psoc.c,v 1.1 2019/11/01 17:51:56 macallan Exp $ */
+ /* $NetBSD: psoc.c,v 1.2 2019/11/22 05:16:54 macallan Exp $ */
 
 /*-
  * Copyright (c) 2018 Michael Lorenz
@@ -30,15 +30,19 @@
  * fan controller found in 1GHz TiBook
  *
  * register values from OF:
- * fan1 - 0x20 ( status ), 0x31 ( data)
+ * fan1 - 0x20 ( status ), 0x31 ( data )
  * fan2 - 0x26 ( status ), 0x45 ( data )
- * fan3 - 0x59
+ * fan status byte 0:
+ * 0x5* - fan is running, 0x6* - fan stopped
+ * byte 1: unknown, 0x80 seems always set, lower bits seem to fluctuate
+ * byte 2: lower 6 bit seem to indicate speed
+ * fan speed may be lower 6 bit of byte 2 and lower 6 of byte 1 
  * temperature sensors start at 6, two bytes each, first appears to be
  * the temperature in degrees Celsius
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.1 2019/11/01 17:51:56 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psoc.c,v 1.2 2019/11/22 05:16:54 macallan Exp $");
 
 #include 
 #include 
@@ -71,6 +75,8 @@ static void	psoc_attach(device_t, device
 
 static void	psoc_sensors_refresh(struct sysmon_envsys *, envsys_data_t *);
 
+static void	psoc_dump(struct psoc_softc *);
+
 CFATTACH_DECL_NEW(psoc, sizeof(struct psoc_softc),
 psoc_match, psoc_attach, NULL, NULL);
 
@@ -98,7 +104,7 @@ psoc_attach(device_t parent, device_t se
 	struct i2c_attach_args *ia = aux;
 	char path[256];
 	envsys_data_t *s;
-	int error, ih, r;
+	int error, ih, r, i;
 
 	sc->sc_dev = self;
 	sc->sc_i2c = ia->ia_tag;
@@ -122,19 +128,8 @@ psoc_attach(device_t parent, device_t se
 	sc->sc_sme->sme_refresh = psoc_sensors_refresh;
 	sc->sc_nsensors = 0;
 
-	int i, j;
-	uint8_t data, cmd;
-	for (i = 0; i < 0x7f; i+= 8) {
-		printf("%02x:", i);
-		for (j = 0; j < 8; j++) {
-			cmd = i + j;
-			data = 0;
-			iic_exec(sc->sc_i2c, I2C_OP_READ_WITH_STOP,
-			sc->sc_addr, , 1, , 1, 0);
-			printf(" %02x", data);
-		}
-		printf("\n");
-	}
+	psoc_dump(sc);
+
 	for (i = 0; i < 4; i++) {
 		r = i * 2 + 6;
 		s = >sc_sensors[sc->sc_nsensors];
@@ -145,8 +140,8 @@ psoc_attach(device_t parent, device_t se
 		sysmon_envsys_sensor_attach(sc->sc_sme, s);
 		sc->sc_nsensors++;
 	}
-#if 0
-	for (r = 0x31; r < 0x50; r += 0x14) {
+
+	for (r = 0x20; r < 0x2b; r += 0x06) {
 		s = >sc_sensors[sc->sc_nsensors];
 		s->state = ENVSYS_SINVALID;
 		s->units = ENVSYS_SFANRPM;
@@ -155,7 +150,7 @@ psoc_attach(device_t parent, device_t se
 		sysmon_envsys_sensor_attach(sc->sc_sme, s);
 		sc->sc_nsensors++;
 	}
-#endif
+
 	sysmon_envsys_register(sc->sc_sme);
 }
 
@@ -164,8 +159,8 @@ psoc_sensors_refresh(struct sysmon_envsy
 {
 	struct psoc_softc *sc = sme->sme_cookie;
 	uint8_t cmd = 6;
-	uint8_t buf[0x28];
-	int error = 1, data, i;
+	uint8_t buf[0x28], *bptr;
+	int error = 1, data;
 
 	if ( edata->private < 0x20) {
 		cmd = 0;
@@ -183,19 +178,30 @@ psoc_sensors_refresh(struct sysmon_envsy
 			/* Celsius -> microkelvin */
 			edata->value_cur = ((int)data * 100) + 27315;
 		}
+#ifdef PSOC_DEBUG
+		if (edata->private == 6)
+			psoc_dump(sc);
+#endif
 	} else {
-		cmd = 0x31;
+		cmd = 0x20;
 		iic_acquire_bus(sc->sc_i2c, 0);
 		error = iic_exec(sc->sc_i2c, I2C_OP_READ_WITH_STOP,
-			sc->sc_addr, , 1, buf, 0x28, 0);
+			sc->sc_addr, , 1, buf, 12, 0);
 		iic_release_bus(sc->sc_i2c, 0);
 		if (error) return;
-		if (edata->private > 0) {
-			data = buf[edata->private - 0x20];
-			edata->value_cur = data;
-			for (i = 0; i < 14; i++)
-printf(" %02x", buf[edata->private - 0x31 + i]);
-			printf("\n");
+		if (edata->private >= 0x20) {
+			bptr = [edata->private - 0x20];
+			switch (bptr[0] & 0xf0) {
+case 0x50:
+	data = bptr[edata->private - 0x20];
+	edata->value_cur = ((bptr[2] & 0x3f) << 6) | (bptr[1] & 0x3f);
+	break;
+case 0x60:
+	edata->value_cur = 0;
+	break;
+default:
+	error = -1;
+			}	
 		}
 	}
 	if (error) {
@@ -204,3 +210,21 @@ psoc_sensors_refresh(struct sysmon_envsy
 		edata->state = ENVSYS_SVALID;
 	}
 }
+
+static void
+psoc_dump(struct psoc_softc *sc)
+{
+	int i, j;
+	uint8_t data, cmd;
+	for (i = 0x20; i < 0x5f; i+= 8) {
+		printf("%02x:", i);
+		for (j = 0; j < 8; j++) {
+			cmd = i + j;
+			data = 0;
+			iic_exec(sc->sc_i2c, I2C_OP_READ_WITH_STOP,

CVS commit: src/sys/arch/macppc/dev

2019-11-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Nov 22 05:16:54 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: psoc.c

Log Message:
report fan speeds
disclaimer:
this is guesswork obtained from watching temperatures, listening to fan noise
and staring at register dumps. Use with caution.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/macppc/dev/psoc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/macppc/dev

2019-09-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 20 21:24:34 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
various minor fixes and updates:
- add (very) basic ONYX support. Treat as 16bit codec with software volume
  control. Makes basic audio work on PCIe G5
- correctly detect TAS3001 without 'compatible' property, now this works on
  Quicksilver
- mute line input on TAS3001 - it's unconnected on Quicksilver and causes noise
- make more of an effort to match codecs to i2sbus instances, needed on G5 and
  some other models with software 'modems'


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 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.52 src/sys/arch/macppc/dev/snapper.c:1.53
--- src/sys/arch/macppc/dev/snapper.c:1.52	Sat Jun  8 08:02:37 2019
+++ src/sys/arch/macppc/dev/snapper.c	Fri Sep 20 21:24:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: snapper.c,v 1.52 2019/06/08 08:02:37 isaki Exp $	*/
+/*	$NetBSD: snapper.c,v 1.53 2019/09/20 21:24:34 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 
-__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.52 2019/06/08 08:02:37 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.53 2019/09/20 21:24:34 macallan Exp $");
 
 #include 
 #include 
@@ -55,7 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: snapper.c,v 
 
 #include 
 #include 
-
+//#define SNAPPER_DEBUG
 #ifdef SNAPPER_DEBUG
 # define DPRINTF printf
 #else
@@ -66,9 +66,12 @@ __KERNEL_RCSID(0, "$NetBSD: snapper.c,v 
 
 struct snapper_softc {
 	device_t sc_dev;
-	int sc_mode;		  // 0 for TAS3004
+	int sc_mode;
+#define SNAPPER_IS_TAS3004	0 // codec is TAS3004
 #define SNAPPER_IS_TAS3001	1 // codec is TAS3001
-#define SNAPPER_SWVOL		2 // software codec
+#define SNAPPER_IS_PCM3052	2 // codec is PCM3052
+#define SNAPPER_IS_CS8416	3 // codec is CS8416
+#define SNAPPER_SWVOL		4 // software codec
 	
 	int sc_node;
 
@@ -475,6 +478,21 @@ static const struct audio_format tumbler
 };
 #define TUMBLER_NFORMATS	__arraycount(tumbler_formats)
 
+/* OF hands us the codec in 16bit mode, run with it for now */
+static const struct audio_format onyx_formats[] = {
+	{
+		.mode		= AUMODE_PLAY | AUMODE_RECORD,
+		.encoding	= AUDIO_ENCODING_SLINEAR_BE,
+		.validbits	= 16,
+		.precision	= 16,
+		.channels	= 2,
+		.channel_mask	= AUFMT_STEREO,
+		.frequency_type	= 3,
+		.frequency	= { 44100, 48000, 96000 },
+	},
+};
+#define ONYX_NFORMATS	__arraycount(onyx_formats)
+
 static bus_size_t amp_mute;
 static bus_size_t headphone_mute;
 static bus_size_t audio_hw_reset;
@@ -492,6 +510,16 @@ static uint8_t headphone_detect_active;
 /* I2S_INT register definitions */
 #define I2S_INT_CLKSTOPPEND 0x0100  /* clock-stop interrupt pending */
 
+/* I2S_WORDSIZE register definitions */
+#define INPUT_STEREO(2 << 24)
+#define INPUT_MONO  (1 << 24)
+#define INPUT_16BIT (0 << 16)
+#define INPUT_24BIT (3 << 16)
+#define OUTPUT_STEREO   (2 << 8)
+#define OUTPUT_MONO (1 << 8)
+#define OUTPUT_16BIT(0 << 0)
+#define OUTPUT_24BIT(3 << 0)
+
 /* FCR(0x3c) bits */
 #define KEYLARGO_FCR1   0x3c
 #define  I2S0CLKEN  0x1000
@@ -639,6 +667,9 @@ snapper_match(device_t parent, struct cf
 	if (strcmp(compat, "AOAK2") == 0)
 		return 1;
 		
+	if (strcmp(compat, "AOAbase") == 0)
+		return 1;
+
 	if (OF_getprop(soundchip, "platform-tas-codec-ref",
 	, sizeof soundcodec) == sizeof soundcodec)
 		return 1;
@@ -664,6 +695,8 @@ snapper_attach(device_t parent, device_t
 	memset(compat, 0, sizeof compat);
 	OF_getprop(OF_child(soundbus), "compatible", compat, sizeof compat);
 
+	sc->sc_mode = SNAPPER_IS_TAS3004;
+
 	if (strcmp(compat, "tumbler") == 0)
 		sc->sc_mode = SNAPPER_IS_TAS3001;
 	sc->sc_swvol_l = 255;
@@ -718,8 +751,8 @@ snapper_attach(device_t parent, device_t
 	oirq = intr[2];
 	iirq = intr[4];
 	/* cirq_type = intr[1] ? IST_LEVEL : IST_EDGE; */
-	oirq_type = intr[3] ? IST_LEVEL : IST_EDGE;
-	iirq_type = intr[5] ? IST_LEVEL : IST_EDGE;
+	oirq_type = (intr[3] & 1) ? IST_LEVEL : IST_EDGE;
+	iirq_type = (intr[5] & 1) ? IST_LEVEL : IST_EDGE;
 
 	/* intr_establish(cirq, cirq_type, IPL_AUDIO, snapper_intr, sc); */
 	intr_establish(oirq, oirq_type, IPL_AUDIO, snapper_intr, sc);
@@ -743,25 +776,79 @@ snapper_defer(device_t dev)
 	device_t dv;
 	deviter_t di;
 	struct deq_softc *deq;
+	char prop[64], next[64], codec[64], *cref;
+	int codec_node, soundbus, sound, ok, deqnode = 0;
 	
 	sc = device_private(dev);
+
+	/* look for platform-*-codec-ref node */
+
+	/*
+	 * XXX
+	 * there can be more than one i2sbus, the one we want just so happens
+	 * to be the first we see
+	 */
+	soundbus = 

CVS commit: src/sys/arch/macppc/dev

2019-09-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 20 21:24:34 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
various minor fixes and updates:
- add (very) basic ONYX support. Treat as 16bit codec with software volume
  control. Makes basic audio work on PCIe G5
- correctly detect TAS3001 without 'compatible' property, now this works on
  Quicksilver
- mute line input on TAS3001 - it's unconnected on Quicksilver and causes noise
- make more of an effort to match codecs to i2sbus instances, needed on G5 and
  some other models with software 'modems'


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 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.



CVS commit: src/sys/arch/macppc/dev

2019-09-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 20 17:25:11 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: deq.c

Log Message:
identify TAS3001 from i2c address if there is no 'compatible' property


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/macppc/dev/deq.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/deq.c
diff -u src/sys/arch/macppc/dev/deq.c:1.16 src/sys/arch/macppc/dev/deq.c:1.17
--- src/sys/arch/macppc/dev/deq.c:1.16	Tue Jun 26 06:03:57 2018
+++ src/sys/arch/macppc/dev/deq.c	Fri Sep 20 17:25:11 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: deq.c,v 1.16 2018/06/26 06:03:57 thorpej Exp $	*/
+/*	$NetBSD: deq.c,v 1.17 2019/09/20 17:25:11 macallan Exp $	*/
 
 /*-
  * Copyright (C) 2005 Michael Lorenz
@@ -32,7 +32,7 @@
  */
  
 #include 
-__KERNEL_RCSID(0, "$NetBSD: deq.c,v 1.16 2018/06/26 06:03:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: deq.c,v 1.17 2019/09/20 17:25:11 macallan Exp $");
 
 #include 
 #include 
@@ -88,11 +88,14 @@ deq_attach(device_t parent, device_t sel
 	sc->sc_address = ia->ia_addr;
 	sc->sc_i2c = ia->ia_tag;
 	if (OF_getprop(sc->sc_node, "compatible", name, 256) <= 0) {
-		/* deq has no 'compatible' on my iBook G4 */
+		/* deq has no 'compatible' on my iBook G4 or Quicksilver */
 		switch (sc->sc_address) {
 			case 0x35:
 strcpy(name, "tas3004");
 break;
+			case 0x34:
+strcpy(name, "tas3001");
+break;
 			default:
 strcpy(name, "unknown");
 		}



CVS commit: src/sys/arch/macppc/dev

2019-09-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 20 17:25:11 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: deq.c

Log Message:
identify TAS3001 from i2c address if there is no 'compatible' property


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/macppc/dev/deq.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/macppc/dev

2019-08-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Aug 15 22:35:39 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: ki2c.c

Log Message:
pass sensor location info to drivers if we can find it


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/macppc/dev/ki2c.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/ki2c.c
diff -u src/sys/arch/macppc/dev/ki2c.c:1.25 src/sys/arch/macppc/dev/ki2c.c:1.26
--- src/sys/arch/macppc/dev/ki2c.c:1.25	Thu Mar  8 21:53:20 2018
+++ src/sys/arch/macppc/dev/ki2c.c	Thu Aug 15 22:35:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ki2c.c,v 1.25 2018/03/08 21:53:20 macallan Exp $	*/
+/*	$NetBSD: ki2c.c,v 1.26 2019/08/15 22:35:39 macallan Exp $	*/
 /*	Id: ki2c.c,v 1.7 2002/10/05 09:56:05 tsubai Exp	*/
 
 /*-
@@ -84,13 +84,13 @@ ki2c_attach(device_t parent, device_t se
 	struct ki2c_softc *sc = device_private(self);
 	struct confargs *ca = aux;
 	int node = ca->ca_node;
-	uint32_t addr, channel;
+	uint32_t addr, channel, reg;
 	int rate, child, /*namelen,*/ i2cbus;
 	struct i2cbus_attach_args iba;
 	prop_dictionary_t dict = device_properties(self);
 	prop_array_t cfg;
-	int devs;
-	char compat[256];
+	int devs, devc;
+	char compat[256], num[8], descr[32];
 	prop_dictionary_t dev;
 	prop_data_t data;
 	char name[32];
@@ -178,6 +178,18 @@ ki2c_attach(device_t parent, device_t se
 		prop_object_release(data);
 		prop_dictionary_set_uint32(dev, "addr", addr);
 		prop_dictionary_set_uint64(dev, "cookie", devs);
+		/* look for location info for sensors */
+		devc = OF_child(devs);
+		while (devc != 0) {
+			if (OF_getprop(devc, "reg", , 4) < 4) goto nope;
+			if (OF_getprop(devc, "location", descr, 32) <= 0)
+goto nope;
+			DPRINTF("found '%s' at %02x\n", descr, reg);
+			snprintf(num, 7, "s%02x", reg);
+			prop_dictionary_set_cstring(dev, num, descr);
+		nope:
+			devc = OF_peer(devc);
+		}
 		prop_array_add(cfg, dev);
 		prop_object_release(dev);
 	skip:



CVS commit: src/sys/arch/macppc/dev

2019-08-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Aug 15 22:35:39 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: ki2c.c

Log Message:
pass sensor location info to drivers if we can find it


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/macppc/dev/ki2c.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/macppc/dev

2019-05-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu May 16 23:39:37 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
switch the default input to line in, to avoid feedback noise on laptops
should probably just mute the input, I need to read the datasheet again...


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 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.50 src/sys/arch/macppc/dev/snapper.c:1.51
--- src/sys/arch/macppc/dev/snapper.c:1.50	Wed May  8 13:40:15 2019
+++ src/sys/arch/macppc/dev/snapper.c	Thu May 16 23:39:37 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: snapper.c,v 1.50 2019/05/08 13:40:15 isaki Exp $	*/
+/*	$NetBSD: snapper.c,v 1.51 2019/05/16 23:39:37 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 
-__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.50 2019/05/08 13:40:15 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.51 2019/05/16 23:39:37 macallan Exp $");
 
 #include 
 #include 
@@ -680,7 +680,7 @@ snapper_attach(device_t parent, device_t
 	sc->sc_baseaddr = ca->ca_baseaddr;
 
 	OF_getprop(soundbus, "reg", reg, sizeof reg);
-	/* deal with messed up properties on PowerMac7,3 abd friends */
+	/* deal with messed up properties on PowerMac7,3 and friends */
 	if (reg[0] == 0) {
 		reg[0] += ca->ca_reg[0];
 		reg[2] += ca->ca_reg[2];
@@ -1702,7 +1702,7 @@ const struct tas3004_reg tas3004_initdat
 	{ 0x10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },	/* BIQUAD */
 	{ 0, 0, 0 },		/* LLB_GAIN */
 	{ 0, 0, 0 },		/* RLB_GAIN */
-	{ DEQ_ACR_ADM | DEQ_ACR_LRB | DEQ_ACR_INP_B },		/* ACR - right channel of input B is the microphone */
+	{ 0 },			/* ACR - line in */
 	{ 2 }			/* MCR2 - AllPass mode since we don't use the equalizer anyway */
 };
 
@@ -2031,10 +2031,10 @@ snapper_init(struct snapper_softc *sc, i
 	snapper_set_bass(sc, 128);
 	snapper_set_treble(sc, 128);
 
-	/* Record source defaults to microphone.  This reflects the
+	/* Record source defaults to line in.  This reflects the
 	 * default value for the ACR (see tas3004_initdata).
 	 */
-	sc->sc_record_source = 1 << 0;
+	sc->sc_record_source = 1 << 1;
 	
 	/* We mute the analog input for now */
 	sc->mixer[0] = 128;



CVS commit: src/sys/arch/macppc/dev

2019-05-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu May 16 23:39:37 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
switch the default input to line in, to avoid feedback noise on laptops
should probably just mute the input, I need to read the datasheet again...


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 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.



Re: CVS commit: src/sys/arch/macppc/dev

2016-05-22 Thread Michael
Hello,

On Mon, 23 May 2016 01:45:42 +
"Chuck Silvers"  wrote:

> Module Name:  src
> Committed By: chs
> Date: Mon May 23 01:45:41 UTC 2016
> 
> Modified Files:
>   src/sys/arch/macppc/dev: ofb.c
> 
> Log Message:
> remove unused variables.

ofb has been obsolete for years ( genfb is more or less MI ofb ) - I
should just cvs rm it.

have fun
Michael


Re: CVS commit: src/sys/arch/macppc/dev

2009-09-26 Thread Izumi Tsutsui
 Module Name:  src
 Committed By: tsutsui
 Date: Sat Sep 26 15:45:28 UTC 2009
 
 Modified Files:
   src/sys/arch/macppc/dev: mesh.c
 
 Log Message:
 Split device_t/softc. Tested on Apus2000.
 :
 Module Name:  src
 Committed By: tsutsui
 Date: Sat Sep 26 15:46:48 UTC 2009
 
 Modified Files:
   src/sys/arch/macppc/dev: esp.c
 
 Log Message:
 Split device_t/softc. Compile test only, but similar to mesh.c.

Um, these should be:
 Replace shutdownhook_establish(9) with pmf_device_register1(9).

Fixed in repository.
---
Izumi Tsutsui