diff options
author | rpaulo <rpaulo@FreeBSD.org> | 2008-11-04 11:52:50 +0000 |
---|---|---|
committer | rpaulo <rpaulo@FreeBSD.org> | 2008-11-04 11:52:50 +0000 |
commit | 85b1030aa82414ee7bfcb7727583f5dae5ddb472 (patch) | |
tree | 1edcfe8c94b9c99f46b5fb2cd3088219f741fd1c | |
parent | 27790fa127c2ee176eabb84aa31f0d3054d60e89 (diff) | |
download | FreeBSD-src-85b1030aa82414ee7bfcb7727583f5dae5ddb472.zip FreeBSD-src-85b1030aa82414ee7bfcb7727583f5dae5ddb472.tar.gz |
Add support for Asus A8Sr notebooks.
PR: 128553
Submitted by: Eygene Ryabinkin <rea-fbsd at codelabs.ru>
Reviewed by: philip
MFC after: 2 months
-rw-r--r-- | etc/devd.conf | 22 | ||||
-rw-r--r-- | sys/dev/acpi_support/acpi_asus.c | 75 |
2 files changed, 97 insertions, 0 deletions
diff --git a/etc/devd.conf b/etc/devd.conf index 395273a..ed37752 100644 --- a/etc/devd.conf +++ b/etc/devd.conf @@ -255,6 +255,28 @@ notify 10 { action "/etc/rc.resume acpi $notify"; }; +# The next blocks enable volume hotkeys that can be found on the Asus laptops +notify 0 { + match "system" "ACPI"; + match "subsystem" "ASUS"; + match "notify" "0x32"; + action "mixer 0"; +}; + +notify 0 { + match "system" "ACPI"; + match "subsystem"i "ASUS"; + match "notify" "0x31"; + action "mixer vol -10"; +}; + +notify 0 { + match "system" "ACPI"; + match "subsystem" "ASUS"; + match "notify" "0x30"; + action "mixer vol +10"; +}; + # The next blocks enable volume hotkeys that can be found on the Asus EeePC # The four keys above the keyboard notify 0x1a through to 0x1d respectively notify 0 { diff --git a/sys/dev/acpi_support/acpi_asus.c b/sys/dev/acpi_support/acpi_asus.c index b81bfb2..cb3ded9 100644 --- a/sys/dev/acpi_support/acpi_asus.c +++ b/sys/dev/acpi_support/acpi_asus.c @@ -93,6 +93,9 @@ struct acpi_asus_model { char *wlan_set; void (*n_func)(ACPI_HANDLE, UINT32, void *); + + char *lcdd; + void (*lcdd_n_func)(ACPI_HANDLE, UINT32, void *); }; struct acpi_asus_led { @@ -113,6 +116,7 @@ struct acpi_asus_led { struct acpi_asus_softc { device_t dev; ACPI_HANDLE handle; + ACPI_HANDLE lcdd_handle; struct acpi_asus_model *model; struct sysctl_ctx_list sysctl_ctx; @@ -133,6 +137,9 @@ struct acpi_asus_softc { int s_wlan; }; +static void acpi_asus_lcdd_notify(ACPI_HANDLE h, UINT32 notify, + void *context); + /* * We can identify Asus laptops from the string they return * as a result of calling the ATK0100 'INIT' method. @@ -205,6 +212,20 @@ static struct acpi_asus_model acpi_asus_models[] = { .disp_set = "SDSP" }, { + .name = "A8SR", + .bled_set = "BLED", + .mled_set = "MLED", + .wled_set = "WLED", + .lcd_get = NULL, + .lcd_set = "\\_SB.PCI0.SBRG.EC0._Q10", + .brn_get = "GPLV", + .brn_set = "SPLV", + .disp_get = "\\_SB.PCI0.P0P1.VGA.GETD", + .disp_set = "SDSP", + .lcdd = "\\_SB.PCI0.P0P1.VGA.LCDD", + .lcdd_n_func = acpi_asus_lcdd_notify + }, + { .name = "D1x", .mled_set = "MLED", .lcd_get = "\\GP11", @@ -762,6 +783,22 @@ acpi_asus_attach(device_t dev) AcpiInstallNotifyHandler(sc->handle, ACPI_SYSTEM_NOTIFY, sc->model->n_func, dev); + /* Find and hook the 'LCDD' object */ + if (sc->model->lcdd != NULL && sc->model->lcdd_n_func != NULL) { + ACPI_STATUS res; + + sc->lcdd_handle = NULL; + res = AcpiGetHandle((sc->model->lcdd[0] == '\\' ? + NULL : sc->handle), sc->model->lcdd, &(sc->lcdd_handle)); + if (ACPI_SUCCESS(res)) { + AcpiInstallNotifyHandler((sc->lcdd_handle), + ACPI_DEVICE_NOTIFY, sc->model->lcdd_n_func, dev); + } else { + printf("%s: unable to find LCD device '%s'\n", + __func__, sc->model->lcdd); + } + } + return (0); } @@ -796,6 +833,13 @@ acpi_asus_detach(device_t dev) /* Remove notify handler */ AcpiRemoveNotifyHandler(sc->handle, ACPI_SYSTEM_NOTIFY, acpi_asus_notify); + + if (sc->lcdd_handle) { + KASSERT(sc->model->lcdd_n_func != NULL, + ("model->lcdd_n_func is NULL, but lcdd_handle is non-zero")); + AcpiRemoveNotifyHandler((sc->lcdd_handle), + ACPI_DEVICE_NOTIFY, sc->model->lcdd_n_func); + } /* Free sysctl tree */ sysctl_ctx_free(&sc->sysctl_ctx); @@ -1165,6 +1209,12 @@ acpi_asus_notify(ACPI_HANDLE h, UINT32 notify, void *context) } else if (notify == 0x34) { sc->s_lcd = 0; ACPI_VPRINT(sc->dev, acpi_sc, "LCD turned off\n"); + } else if (notify == 0x86) { + acpi_asus_sysctl_set(sc, ACPI_ASUS_METHOD_BRN, sc->s_brn-1); + ACPI_VPRINT(sc->dev, acpi_sc, "Brightness decreased\n"); + } else if (notify == 0x87) { + acpi_asus_sysctl_set(sc, ACPI_ASUS_METHOD_BRN, sc->s_brn+1); + ACPI_VPRINT(sc->dev, acpi_sc, "Brightness increased\n"); } else { /* Notify devd(8) */ acpi_UserNotify("ASUS", h, notify); @@ -1173,6 +1223,31 @@ acpi_asus_notify(ACPI_HANDLE h, UINT32 notify, void *context) } static void +acpi_asus_lcdd_notify(ACPI_HANDLE h, UINT32 notify, void *context) +{ + struct acpi_asus_softc *sc; + struct acpi_softc *acpi_sc; + + ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); + + sc = device_get_softc((device_t)context); + acpi_sc = acpi_device_get_parent_softc(sc->dev); + + ACPI_SERIAL_BEGIN(asus); + switch (notify) { + case 0x87: + acpi_asus_sysctl_set(sc, ACPI_ASUS_METHOD_BRN, sc->s_brn-1); + ACPI_VPRINT(sc->dev, acpi_sc, "Brightness decreased\n"); + break; + case 0x86: + acpi_asus_sysctl_set(sc, ACPI_ASUS_METHOD_BRN, sc->s_brn+1); + ACPI_VPRINT(sc->dev, acpi_sc, "Brightness increased\n"); + break; + } + ACPI_SERIAL_END(asus); +} + +static void acpi_asus_eeepc_notify(ACPI_HANDLE h, UINT32 notify, void *context) { struct acpi_asus_softc *sc; |