diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2023-12-26 09:25:16 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2023-12-26 09:25:16 +0000 |
commit | 8d612a60cdedcbea0222e139bd50b64c2f85c4ea (patch) | |
tree | 61668f9b6358bff39524f18edeaea69202d213c0 | |
parent | 9661fc36d44d5877da769bd023c950a57b2b3a79 (diff) |
Apple machines with multiple speakers typically have the shutdown pin of
the digital amplifier codecs wired up to a single GPIO. This is apparently
problematic for Linux and Asahi Linux changed their device trees to use a
regulator instead to such that reference counting makes sure that shutdown
isn't asserted until all codecs are ready for it. Follow suit, even though
our regulator code doesn't do the proper reference counting yet.
ok patrick@
-rw-r--r-- | sys/dev/fdt/sncodec.c | 7 | ||||
-rw-r--r-- | sys/dev/fdt/tascodec.c | 5 |
2 files changed, 9 insertions, 3 deletions
diff --git a/sys/dev/fdt/sncodec.c b/sys/dev/fdt/sncodec.c index adbd2a88fe0..7f7efe09ff9 100644 --- a/sys/dev/fdt/sncodec.c +++ b/sys/dev/fdt/sncodec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sncodec.c,v 1.3 2023/07/09 12:32:22 kettenis Exp $ */ +/* $OpenBSD: sncodec.c,v 1.4 2023/12/26 09:25:15 kettenis Exp $ */ /* * Copyright (c) 2023 Mark Kettenis <kettenis@openbsd.org> * @@ -26,6 +26,7 @@ #include <dev/ofw/openfirm.h> #include <dev/ofw/ofw_gpio.h> #include <dev/ofw/ofw_misc.h> +#include <dev/ofw/ofw_regulator.h> #include <dev/ofw/fdt.h> #include <dev/i2c/i2cvar.h> @@ -136,6 +137,8 @@ sncodec_attach(struct device *parent, struct device *self, void *aux) printf("\n"); + regulator_enable(OF_getpropint(node, "SDZ-supply", 0)); + sdz_gpiolen = OF_getproplen(node, "shutdown-gpios"); if (sdz_gpiolen > 0) { sdz_gpio = malloc(sdz_gpiolen, M_TEMP, M_WAITOK); @@ -146,7 +149,7 @@ sncodec_attach(struct device *parent, struct device *self, void *aux) free(sdz_gpio, M_TEMP, sdz_gpiolen); delay(1000); } - + /* Set volume to a reasonable level. */ sc->sc_dvc = DVC_LVL_30DB; sc->sc_mute = MODE_CTRL_MODE_ACTIVE; diff --git a/sys/dev/fdt/tascodec.c b/sys/dev/fdt/tascodec.c index 1c63afd3990..9769aa10693 100644 --- a/sys/dev/fdt/tascodec.c +++ b/sys/dev/fdt/tascodec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tascodec.c,v 1.7 2023/07/15 13:35:17 kettenis Exp $ */ +/* $OpenBSD: tascodec.c,v 1.8 2023/12/26 09:25:15 kettenis Exp $ */ /* * Copyright (c) 2022 Mark Kettenis <kettenis@openbsd.org> * @@ -26,6 +26,7 @@ #include <dev/ofw/openfirm.h> #include <dev/ofw/ofw_gpio.h> #include <dev/ofw/ofw_misc.h> +#include <dev/ofw/ofw_regulator.h> #include <dev/ofw/fdt.h> #include <dev/i2c/i2cvar.h> @@ -127,6 +128,8 @@ tascodec_attach(struct device *parent, struct device *self, void *aux) printf("\n"); + regulator_enable(OF_getpropint(node, "SDZ-supply", 0)); + sdz_gpiolen = OF_getproplen(node, "shutdown-gpios"); if (sdz_gpiolen > 0) { sdz_gpio = malloc(sdz_gpiolen, M_TEMP, M_WAITOK); |