NetBSD-Bugs archive

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

port-macppc/59673: PMG5 11,2: multiple channel-0 node confuses ki2c(4) driver



>Number:         59673
>Category:       port-macppc
>Synopsis:       PMG5 11,2: multiple channel-0 node confuses ki2c(4) driver
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-macppc-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 28 09:55:00 +0000 2025
>Originator:     Rin Okuyama
>Release:        11.9.3
>Organization:
Internet Initiative Japan Inc.
>Environment:
NetBSD g5.local 11.99.3 NetBSD 11.99.3 (G5) #17: Wed Sep 24 23:24:08 JST 2025  rin@sakaizumii.local:/home/rin/src/sys/arch/macppc/compile/G5 macppc powerpc
>Description:
Power Mac G5 11,2 has multiple channel-0 nodes for ki2c1, which confuses the driver.

Full dmesg (patched kernel) and `ofwctl -pv` log are provided here:

https://gist.github.com/rokuyama/1d90c9af42d97a84870b93bf0daad682
https://gist.github.com/rokuyama/079eebc318ad9417665f2c023527dac4

Here, i2c@18000 has two child node i2c-bus@0 (channel 0): The first one
has two audio codec's, whereas the second one has only one.

If the second one is skipped with this patch:

```
diff --git a/sys/arch/macppc/dev/ki2c.c b/sys/arch/macppc/dev/ki2c.c
index f4c2d29765a..68fc0450325 100644
--- a/sys/arch/macppc/dev/ki2c.c
+++ b/sys/arch/macppc/dev/ki2c.c
@@ -104,6 +104,17 @@ ki2c_init_channel(struct ki2c_softc *sc, int channel, int node)
 {
 	struct ki2c_channel *ch = &sc->sc_channels[channel];
 
+	/*
+	 * XXX
+	 * Power Mac G5 11,2 has two channel-0 nodes for ki2c1.
+	 *
+	 * The first one has two audio codec's, while the second one has
+	 * only one. So, use the first one here.
+	 */
+
+	if (ch->ch_sc != NULL)
+		return;
+
 	iic_tag_init(&ch->ch_i2c);
 	ch->ch_i2c.ic_channel = channel;
 	ch->ch_i2c.ic_cookie = ch;
```

the two codec's work just fine as shown in dmesg:

```
ki2c1 at obio0 irq 27
iic1 at ki2c1 bus 0: I2C bus
deq0 at iic1 addr 0x46 Audio Codec (pcm3052)
deq1 at iic1 addr 0x12 Audio Codec (cs8416)
snapper0 at obio0 offset 0x0: irq 28,11,12
snapper0: codec: PCM3052 / ONYX
audio0 at snapper0: playback, capture, full duplex
audio0: slinear_be:16 2ch 48000Hz, blk 12288 bytes (64ms) for playback
audio0: slinear_be:16 2ch 48000Hz, blk 12288 bytes (64ms) for recording
```

Without the above-mentioned patch, LOCKDEBUG crashes kernel for
multiple iic_tag_init() for channel 0.
>How-To-Repeat:
Run LOCKDEBUG kernel on Power Mac G5 11,2.
>Fix:
Workaround provided above.



Home | Main Index | Thread Index | Old Index