Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F112553092
D48985.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D48985.diff
View Options
diff --git a/sys/dev/acpi_support/acpi_asus_wmi.c b/sys/dev/acpi_support/acpi_asus_wmi.c
--- a/sys/dev/acpi_support/acpi_asus_wmi.c
+++ b/sys/dev/acpi_support/acpi_asus_wmi.c
@@ -99,9 +99,11 @@
#define ASUS_WMI_DEVID_CARDREADER 0x00080013
#define ASUS_WMI_DEVID_TOUCHPAD 0x00100011
#define ASUS_WMI_DEVID_TOUCHPAD_LED 0x00100012
+#define ASUS_WMI_DEVID_TUF_RGB_MODE 0x00100056
#define ASUS_WMI_DEVID_THERMAL_CTRL 0x00110011
#define ASUS_WMI_DEVID_FAN_CTRL 0x00110012
#define ASUS_WMI_DEVID_PROCESSOR_STATE 0x00120012
+#define ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY 0x00120075
/* DSTS masks */
#define ASUS_WMI_DSTS_STATUS_BIT 0x00000001
@@ -129,6 +131,8 @@
bool event_queue;
struct cdev *kbd_bkl;
uint32_t kbd_bkl_level;
+ uint32_t tuf_rgb_mode;
+ uint32_t ttp_mode;
#ifdef EVDEV_SUPPORT
struct evdev_dev *evdev;
#endif
@@ -272,6 +276,12 @@
.dev_id = ASUS_WMI_DEVID_PROCESSOR_STATE,
.flag_rdonly = 1
},
+ {
+ .name = "throttle_thermal_policy",
+ .dev_id = ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY,
+ .description = "Throttle Thermal Policy "
+ "(0 - default, 1 - overboost, 2 - silent)",
+ },
{ NULL, 0, NULL, 0 }
};
@@ -365,7 +375,7 @@
int arg, int oldarg);
static int acpi_asus_wmi_sysctl_get(struct acpi_asus_wmi_softc *sc, int dev_id);
static int acpi_asus_wmi_evaluate_method(device_t wmi_dev, int method,
- UINT32 arg0, UINT32 arg1, UINT32 *retval);
+ UINT32 arg0, UINT32 arg1, UINT32 arg2, UINT32 *retval);
static int acpi_wpi_asus_get_devstate(struct acpi_asus_wmi_softc *sc,
UINT32 dev_id, UINT32 *retval);
static int acpi_wpi_asus_set_devstate(struct acpi_asus_wmi_softc *sc,
@@ -528,14 +538,14 @@
/* Initialize. */
if (!acpi_asus_wmi_evaluate_method(sc->wmi_dev,
- ASUS_WMI_METHODID_INIT, 0, 0, &val) && bootverbose)
+ ASUS_WMI_METHODID_INIT, 0, 0, 0, &val) && bootverbose)
device_printf(dev, "Initialization: %#x\n", val);
if (!acpi_asus_wmi_evaluate_method(sc->wmi_dev,
- ASUS_WMI_METHODID_SPEC, 0, 0x9, &val) && bootverbose)
+ ASUS_WMI_METHODID_SPEC, 0, 0x9, 0, &val) && bootverbose)
device_printf(dev, "WMI BIOS version: %d.%d\n",
val >> 16, val & 0xFF);
if (!acpi_asus_wmi_evaluate_method(sc->wmi_dev,
- ASUS_WMI_METHODID_SFUN, 0, 0, &val) && bootverbose)
+ ASUS_WMI_METHODID_SFUN, 0, 0, 0, &val) && bootverbose)
device_printf(dev, "SFUN value: %#x\n", val);
ACPI_SERIAL_BEGIN(asus_wmi);
@@ -720,6 +730,13 @@
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
ACPI_SERIAL_ASSERT(asus_wmi);
+ switch(dev_id) {
+ case ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY:
+ return (sc->ttp_mode);
+ default:
+ break;
+ }
+
acpi_wpi_asus_get_devstate(sc, dev_id, &val);
switch(dev_id) {
@@ -758,6 +775,10 @@
if (arg != 0)
arg |= 0x80;
break;
+ case ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY:
+ arg = min(0x2, arg);
+ sc->ttp_mode = arg;
+ break;
}
acpi_wpi_asus_set_devstate(sc, dev_id, arg, NULL);
@@ -848,6 +869,31 @@
acpi_wpi_asus_set_devstate(sc,
ASUS_WMI_DEVID_TOUCHPAD, val, NULL);
}
+ /* Throttle thermal policy control. */
+ if (code == 0xae) {
+ sc->ttp_mode++;
+ if (sc->ttp_mode > 2)
+ sc->ttp_mode = 0;
+ acpi_wpi_asus_set_devstate(sc,
+ ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY,
+ sc->ttp_mode, NULL);
+ }
+ /* TUF laptop RGB mode control. */
+ if (code == 0xb3) {
+ const uint32_t cmd = 0xb4; /* Save to BIOS */
+ const uint32_t r = 0xff, g = 0xff, b = 0xff;
+ const uint32_t speed = 0xeb; /* Medium */
+ if (sc->tuf_rgb_mode < 2)
+ sc->tuf_rgb_mode++;
+ else if (sc->tuf_rgb_mode == 2)
+ sc->tuf_rgb_mode = 10;
+ else sc->tuf_rgb_mode = 0;
+ acpi_asus_wmi_evaluate_method(sc->wmi_dev,
+ ASUS_WMI_METHODID_DEVS,
+ ASUS_WMI_DEVID_TUF_RGB_MODE,
+ cmd | (sc->tuf_rgb_mode << 8) | (r << 16) | (g << 24),
+ b | (speed << 8), NULL);
+ }
}
}
@@ -882,9 +928,9 @@
static int
acpi_asus_wmi_evaluate_method(device_t wmi_dev, int method,
- UINT32 arg0, UINT32 arg1, UINT32 *retval)
+ UINT32 arg0, UINT32 arg1, UINT32 arg2, UINT32 *retval)
{
- UINT32 params[2] = { arg0, arg1 };
+ UINT32 params[3] = { arg0, arg1, arg2 };
UINT32 result;
ACPI_OBJECT *obj;
ACPI_BUFFER in = { sizeof(params), ¶ms };
@@ -912,7 +958,7 @@
{
return (acpi_asus_wmi_evaluate_method(sc->wmi_dev,
- sc->dsts_id, dev_id, 0, retval));
+ sc->dsts_id, dev_id, 0, 0, retval));
}
static int
@@ -921,7 +967,7 @@
{
return (acpi_asus_wmi_evaluate_method(sc->wmi_dev,
- ASUS_WMI_METHODID_DEVS, dev_id, ctrl_param, retval));
+ ASUS_WMI_METHODID_DEVS, dev_id, ctrl_param, 0, retval));
}
static int
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 20, 6:33 PM (21 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17209375
Default Alt Text
D48985.diff (4 KB)
Attached To
Mode
D48985: acpi_asus_wmi(4): Handle TUF-specific hotkeys internally
Attached
Detach File
Event Timeline
Log In to Comment