From bb05b80cf5ebb900937bf2792f34b7bcd8e9a702 Mon Sep 17 00:00:00 2001 From: Nate Lawson Date: Sat, 2 Jun 2007 19:37:27 +0000 Subject: [PATCH] Mute the main audio during reboot/shutdown. This prevents a burst of static on the speakers of my Panasonic Y4. It might make sense to do this in the mixer rc.d script as well. --- sys/dev/acpi_support/acpi_panasonic.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/sys/dev/acpi_support/acpi_panasonic.c b/sys/dev/acpi_support/acpi_panasonic.c index 14ddd838148..c076aaf6cbb 100644 --- a/sys/dev/acpi_support/acpi_panasonic.c +++ b/sys/dev/acpi_support/acpi_panasonic.c @@ -79,6 +79,7 @@ typedef int hkey_fn_t(ACPI_HANDLE, int, UINT32 *); static int acpi_panasonic_probe(device_t dev); static int acpi_panasonic_attach(device_t dev); static int acpi_panasonic_detach(device_t dev); +static void acpi_panasonic_shutdown(device_t dev); static int acpi_panasonic_sysctl(SYSCTL_HANDLER_ARGS); static ACPI_INTEGER acpi_panasonic_sinf(ACPI_HANDLE h, ACPI_INTEGER index); static void acpi_panasonic_sset(ACPI_HANDLE h, ACPI_INTEGER index, @@ -114,6 +115,7 @@ static device_method_t acpi_panasonic_methods[] = { DEVMETHOD(device_probe, acpi_panasonic_probe), DEVMETHOD(device_attach, acpi_panasonic_attach), DEVMETHOD(device_detach, acpi_panasonic_detach), + DEVMETHOD(device_shutdown, acpi_panasonic_shutdown), {0, 0} }; @@ -181,7 +183,7 @@ acpi_panasonic_attach(device_t dev) } #endif - /* Handle notifies */ + /* Handle notifies */ status = AcpiInstallNotifyHandler(sc->handle, ACPI_DEVICE_NOTIFY, acpi_panasonic_notify, sc); if (ACPI_FAILURE(status)) { @@ -218,6 +220,18 @@ acpi_panasonic_detach(device_t dev) return (0); } +static void +acpi_panasonic_shutdown(device_t dev) +{ + struct acpi_panasonic_softc *sc; + int mute; + + /* Mute the main audio during reboot to prevent static burst to speaker. */ + sc = device_get_softc(dev); + mute = 1; + hkey_sound_mute(sc->handle, HKEY_SET, &mute); +} + static int acpi_panasonic_sysctl(SYSCTL_HANDLER_ARGS) { @@ -230,7 +244,7 @@ acpi_panasonic_sysctl(SYSCTL_HANDLER_ARGS) function = oidp->oid_arg2; handler = sysctl_table[function].handler; - /* Get the current value from the appropriate function. */ + /* Get the current value from the appropriate function. */ ACPI_SERIAL_BEGIN(panasonic); error = handler(sc->handle, HKEY_GET, &arg); if (error != 0)