diff --git a/dmi.c b/dmi.c
index 562a314..91acf5a 100644
--- a/dmi.c
+++ b/dmi.c
@@ -38,7 +38,7 @@ static int __init s76_dmi_matched(const struct dmi_system_id *id)
}
static struct dmi_system_id s76_dmi_table[] __initdata = {
- DMI_TABLE("bonw13", kb_full_color_ops),
+ DMI_TABLE("bonw13", kb_full_color_with_extra_ops),
{}
};
diff --git a/fan.c b/fan.c
index 758a413..e797037 100644
--- a/fan.c
+++ b/fan.c
@@ -19,6 +19,8 @@
* along with this program. If not, see .
*/
+//#define EXPERIMENTAL
+
#if S76_HAS_HWMON
struct s76_hwmon {
struct device *dev;
diff --git a/input.c b/input.c
index e7a823d..c0a7701 100644
--- a/input.c
+++ b/input.c
@@ -55,12 +55,23 @@ MODULE_PARM_DESC(poll_freq, "Set polling frequency");
static struct task_struct *s76_input_polling_task;
+static void s76_input_airplane_key(void) {
+ mutex_lock(&s76_input_report_mutex);
+
+ input_report_key(s76_input_device, AIRPLANE_KEY, 1);
+ input_sync(s76_input_device);
+
+ input_report_key(s76_input_device, AIRPLANE_KEY, 0);
+ input_sync(s76_input_device);
+
+ mutex_unlock(&s76_input_report_mutex);
+}
+
static int s76_input_polling_thread(void *data) {
S76_INFO("Polling thread started (PID: %i), polling at %i Hz\n",
current->pid, param_poll_freq);
while (!kthread_should_stop()) {
-
u8 byte;
ec_read(0xDB, &byte);
@@ -69,22 +80,9 @@ static int s76_input_polling_thread(void *data) {
S76_INFO("Airplane-Mode Hotkey pressed (EC)\n");
- mutex_lock(&s76_input_report_mutex);
-
- input_report_key(s76_input_device, AIRPLANE_KEY, 1);
- input_sync(s76_input_device);
-
- input_report_key(s76_input_device, AIRPLANE_KEY, 0);
- input_sync(s76_input_device);
-
- S76_INFO("Led status: %d",
- airplane_led_get(&airplane_led));
-
- airplane_led_set(&airplane_led,
- (airplane_led_get(&airplane_led) ? 0 : 1));
-
- mutex_unlock(&s76_input_report_mutex);
+ s76_input_airplane_key();
}
+
msleep_interruptible(1000 / param_poll_freq);
}
@@ -93,7 +91,7 @@ static int s76_input_polling_thread(void *data) {
return 0;
}
-static void airplane_wmi(void) {
+static void s76_input_airplane_wmi(void) {
S76_INFO("Airplane-Mode Hotkey pressed (WMI)\n");
if (s76_input_polling_task) {
@@ -102,15 +100,7 @@ static void airplane_wmi(void) {
s76_input_polling_task = NULL;
}
- mutex_lock(&s76_input_report_mutex);
-
- input_report_key(s76_input_device, AIRPLANE_KEY, 1);
- input_sync(s76_input_device);
-
- input_report_key(s76_input_device, AIRPLANE_KEY, 0);
- input_sync(s76_input_device);
-
- mutex_unlock(&s76_input_report_mutex);
+ s76_input_airplane_key();
}
static int s76_input_open(struct input_dev *dev)
diff --git a/kb.c b/kb.c
index ae0d3a4..8f3c41e 100644
--- a/kb.c
+++ b/kb.c
@@ -93,7 +93,6 @@ module_param_array_named(kb_color, param_kb_color, kb_color,
¶m_kb_color_num, S_IRUSR);
MODULE_PARM_DESC(kb_color, "Set the color(s) of the keyboard (sections)");
-
static int param_set_kb_brightness(const char *val,
const struct kernel_param *kp)
{
diff --git a/led.c b/led.c
index 4dc2b0b..794fab2 100644
--- a/led.c
+++ b/led.c
@@ -19,10 +19,6 @@
* along with this program. If not, see .
*/
-static bool param_led_invert;
-module_param_named(led_invert, param_led_invert, bool, 0);
-MODULE_PARM_DESC(led_invert, "Invert airplane mode LED state.");
-
static struct workqueue_struct *led_workqueue;
static struct _led_work {
@@ -39,10 +35,7 @@ static void airplane_led_update(struct work_struct *work)
ec_read(0xD9, &byte);
- if (param_led_invert)
- ec_write(0xD9, w->wk ? byte & ~0x40 : byte | 0x40);
- else
- ec_write(0xD9, w->wk ? byte | 0x40 : byte & ~0x40);
+ ec_write(0xD9, w->wk ? byte & ~0x40 : byte | 0x40);
/* wmbb 0x6C 1 (?) */
}
@@ -53,10 +46,7 @@ static enum led_brightness airplane_led_get(struct led_classdev *led_cdev)
ec_read(0xD9, &byte);
- if (param_led_invert)
- return byte & 0x40 ? LED_OFF : LED_FULL;
- else
- return byte & 0x40 ? LED_FULL : LED_OFF;
+ return byte & 0x40 ? LED_OFF : LED_FULL;
}
/* must not sleep */
@@ -79,8 +69,6 @@ static struct led_classdev airplane_led = {
static int __init s76_led_init(void)
{
int err;
-
- param_led_invert = TRUE;
led_workqueue = create_singlethread_workqueue("led_workqueue");
if (unlikely(!led_workqueue))
diff --git a/system76.c b/system76.c
index b0ec458..7260e7c 100644
--- a/system76.c
+++ b/system76.c
@@ -26,8 +26,6 @@
#define S76_DRIVER_NAME KBUILD_MODNAME
#define pr_fmt(fmt) S76_DRIVER_NAME ": " fmt
-//#define EXPERIMENTAL
-
#include
#include
#include
@@ -53,7 +51,6 @@
__func__, __LINE__, ##__VA_ARGS__)
#define S76_EVENT_GUID "ABBC0F6B-8EA1-11D1-00A0-C90629100000"
-#define S76_EMAIL_GUID "ABBC0F6C-8EA1-11D1-00A0-C90629100000"
#define S76_GET_GUID "ABBC0F6D-8EA1-11D1-00A0-C90629100000"
#define S76_HAS_HWMON (defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE)))
@@ -139,32 +136,35 @@ static int __init s76_init(void)
platform_create_bundle(&s76_platform_driver,
s76_wmi_probe, NULL, 0, NULL, 0);
- if (unlikely(IS_ERR(s76_platform_device)))
+ if (unlikely(IS_ERR(s76_platform_device))) {
return PTR_ERR(s76_platform_device);
+ }
- // err = s76_input_init();
- // if (unlikely(err))
- // S76_ERROR("Could not register input device\n");
+ err = s76_input_init();
+ if (unlikely(err)) {
+ S76_ERROR("Could not register input device\n");
+ }
err = s76_led_init();
- if (unlikely(err))
+ if (unlikely(err)) {
S76_ERROR("Could not register LED device\n");
-
- if (device_create_file(&s76_platform_device->dev,
- &dev_attr_kb_brightness) != 0)
+ }
+
+ if (device_create_file(&s76_platform_device->dev, &dev_attr_kb_brightness) != 0) {
S76_ERROR("Sysfs attribute creation failed for brightness\n");
-
- if (device_create_file(&s76_platform_device->dev,
- &dev_attr_kb_state) != 0)
+ }
+
+ if (device_create_file(&s76_platform_device->dev, &dev_attr_kb_state) != 0) {
S76_ERROR("Sysfs attribute creation failed for state\n");
-
- if (device_create_file(&s76_platform_device->dev,
- &dev_attr_kb_mode) != 0)
+ }
+
+ if (device_create_file(&s76_platform_device->dev, &dev_attr_kb_mode) != 0) {
S76_ERROR("Sysfs attribute creation failed for mode\n");
-
- if (device_create_file(&s76_platform_device->dev,
- &dev_attr_kb_color) != 0)
+ }
+
+ if (device_create_file(&s76_platform_device->dev, &dev_attr_kb_color) != 0) {
S76_ERROR("Sysfs attribute creation failed for color\n");
+ }
#ifdef S76_HAS_HWMON
s76_hwmon_init(&s76_platform_device->dev);
@@ -175,17 +175,17 @@ static int __init s76_init(void)
static void __exit s76_exit(void)
{
- s76_led_exit();
- // s76_input_exit();
+ #ifdef S76_HAS_HWMON
+ s76_hwmon_fini(&s76_platform_device->dev);
+ #endif
-#ifdef S76_HAS_HWMON
- s76_hwmon_fini(&s76_platform_device->dev);
-#endif
- device_remove_file(&s76_platform_device->dev,
- &dev_attr_kb_brightness);
- device_remove_file(&s76_platform_device->dev, &dev_attr_kb_state);
- device_remove_file(&s76_platform_device->dev, &dev_attr_kb_mode);
device_remove_file(&s76_platform_device->dev, &dev_attr_kb_color);
+ device_remove_file(&s76_platform_device->dev, &dev_attr_kb_mode);
+ device_remove_file(&s76_platform_device->dev, &dev_attr_kb_state);
+ device_remove_file(&s76_platform_device->dev, &dev_attr_kb_brightness);
+
+ s76_led_exit();
+ s76_input_exit();
platform_device_unregister(s76_platform_device);
platform_driver_unregister(&s76_platform_driver);
diff --git a/wmi.c b/wmi.c
index 890bed0..b7ce398 100644
--- a/wmi.c
+++ b/wmi.c
@@ -34,7 +34,7 @@ static void s76_wmi_notify(u32 value, void *context)
switch (event) {
case 0xF4:
- airplane_wmi();
+ s76_input_airplane_wmi();
break;
default:
kb_wmi(event);