diff options
-rw-r--r-- | sys/arch/macppc/dev/onyx.c | 21 | ||||
-rw-r--r-- | sys/arch/macppc/dev/snapper.c | 14 |
2 files changed, 24 insertions, 11 deletions
diff --git a/sys/arch/macppc/dev/onyx.c b/sys/arch/macppc/dev/onyx.c index 60fe68518d0..65a794201b4 100644 --- a/sys/arch/macppc/dev/onyx.c +++ b/sys/arch/macppc/dev/onyx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: onyx.c,v 1.4 2005/11/20 19:54:04 brad Exp $ */ +/* $OpenBSD: onyx.c,v 1.5 2005/12/17 00:04:10 kettenis Exp $ */ /*- * Copyright (c) 2005 Tsubai Masanari. All rights reserved. @@ -120,8 +120,8 @@ int onyx_match(struct device *parent, void *match, void *aux) { struct confargs *ca = aux; - int soundbus, soundchip; - char compat[32]; + int soundbus, soundchip, soundcodec; + int32_t layout = 0; if (strcmp(ca->ca_name, "i2s") != 0) return (0); @@ -130,10 +130,19 @@ onyx_match(struct device *parent, void *match, void *aux) (soundchip = OF_child(soundbus)) == 0) return (0); - bzero(compat, sizeof compat); - OF_getprop(soundchip, "compatible", compat, sizeof compat); + if (OF_getprop(soundchip, "platform-onyx-codec-ref", + &soundcodec, sizeof soundcodec)) + return (1); - if (strcmp(compat, "AOAbase") == 0) + /* + * Apple really messed up. First and second generation iMac + * G5 (PowerMac8,1 and PowerMac8,2) have a "deq" i2c device + * listed in the OF device tree, which is a telltale sign of + * snapper(4). But in reality that chip isn't there. So we + * match on "layout-id" instead. + */ + if (OF_getprop(soundchip, "layout-id", &layout, sizeof layout) && + (layout == 0x2d || layout == 0x56)) return (1); return (0); diff --git a/sys/arch/macppc/dev/snapper.c b/sys/arch/macppc/dev/snapper.c index 7012502cfb3..0459670f007 100644 --- a/sys/arch/macppc/dev/snapper.c +++ b/sys/arch/macppc/dev/snapper.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snapper.c,v 1.25 2005/11/05 04:26:22 brad Exp $ */ +/* $OpenBSD: snapper.c,v 1.26 2005/12/17 00:04:10 kettenis Exp $ */ /* $NetBSD: snapper.c,v 1.1 2003/12/27 02:19:34 grant Exp $ */ /*- @@ -282,7 +282,7 @@ int snapper_match(struct device *parent, void *match, void *aux) { struct confargs *ca = aux; - int soundbus, soundchip; + int soundbus, soundchip, soundcodec; char compat[32]; if (strcmp(ca->ca_name, "i2s") != 0) @@ -295,10 +295,14 @@ snapper_match(struct device *parent, void *match, void *aux) bzero(compat, sizeof compat); OF_getprop(soundchip, "compatible", compat, sizeof compat); - if (strcmp(compat, "snapper") != 0) - return (0); + if (strcmp(compat, "snapper")) + return (1); + + if (OF_getprop(soundchip, "platform-tas-codec-ref", + &soundcodec, sizeof soundcodec)) + return (1); - return (1); + return (0); } void |