Compare commits
10 Commits
cc41a32079
...
82f289d6e7
| Author | SHA1 | Date |
|---|---|---|
|
|
82f289d6e7 | |
|
|
d3d9ce28c6 | |
|
|
79f5488fd2 | |
|
|
44aa423b2c | |
|
|
293de8964e | |
|
|
3fa766c549 | |
|
|
e457babab4 | |
|
|
9c210e3060 | |
|
|
cc4802bd26 | |
|
|
dd00fe93ca |
|
|
@ -1,3 +1,22 @@
|
||||||
|
system76-dkms (1.0.21-jdm1) jammy; urgency=medium
|
||||||
|
|
||||||
|
* Disable integration with the nv_hda driver
|
||||||
|
|
||||||
|
-- Jesse McDonald <jesse@jessemcdonald.info> Tue, 25 Nov 2025 00:25:19 -0600
|
||||||
|
|
||||||
|
system76-dkms (1.0.21) jammy; urgency=medium
|
||||||
|
|
||||||
|
* Add oryp13
|
||||||
|
|
||||||
|
-- Tim Crawford <tcrawford@system76.com> Tue, 16 Sep 2025 13:04:08 -0600
|
||||||
|
|
||||||
|
system76-dkms (1.0.20) focal; urgency=medium
|
||||||
|
|
||||||
|
* Refactor code
|
||||||
|
* Add addw5
|
||||||
|
|
||||||
|
-- Jeremy Soller <jeremy@system76.com> Tue, 01 Jul 2025 11:27:12 -0600
|
||||||
|
|
||||||
system76-dkms (1.0.19) focal; urgency=medium
|
system76-dkms (1.0.19) focal; urgency=medium
|
||||||
|
|
||||||
* Add serw14
|
* Add serw14
|
||||||
|
|
|
||||||
27
src/ap-led.c
27
src/ap-led.c
|
|
@ -1,20 +1,8 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* ap_led.c
|
* ap_led.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017 Jeremy Soller <jeremy@system76.com>
|
* Copyright (C) 2017 Jeremy Soller <jeremy@system76.com>
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static enum led_brightness ap_led_brightness = 1;
|
static enum led_brightness ap_led_brightness = 1;
|
||||||
|
|
@ -65,7 +53,7 @@ static struct led_classdev ap_led = {
|
||||||
|
|
||||||
static ssize_t ap_led_invert_show(struct device *dev, struct device_attribute *attr, char *buf)
|
static ssize_t ap_led_invert_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
return sprintf(buf, "%d\n", (int)ap_led_invert);
|
return sysfs_emit(buf, "%d\n", (int)ap_led_invert);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t ap_led_invert_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size)
|
static ssize_t ap_led_invert_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size)
|
||||||
|
|
@ -110,12 +98,13 @@ static int __init ap_led_init(struct device *dev)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = led_classdev_register(dev, &ap_led);
|
err = devm_led_classdev_register(dev, &ap_led);
|
||||||
if (unlikely(err)) {
|
if (err < 0) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device_create_file(ap_led.dev, &ap_led_invert_dev_attr) != 0) {
|
err = device_create_file(ap_led.dev, &ap_led_invert_dev_attr);
|
||||||
|
if (err < 0) {
|
||||||
pr_err("failed to create ap_led_invert\n");
|
pr_err("failed to create ap_led_invert\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -127,8 +116,4 @@ static int __init ap_led_init(struct device *dev)
|
||||||
static void __exit ap_led_exit(void)
|
static void __exit ap_led_exit(void)
|
||||||
{
|
{
|
||||||
device_remove_file(ap_led.dev, &ap_led_invert_dev_attr);
|
device_remove_file(ap_led.dev, &ap_led_invert_dev_attr);
|
||||||
|
|
||||||
if (!IS_ERR_OR_NULL(ap_led.dev)) {
|
|
||||||
led_classdev_unregister(&ap_led);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
102
src/hwmon.c
102
src/hwmon.c
|
|
@ -1,22 +1,10 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* fan.c
|
* fan.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017 Jeremy Soller <jeremy@system76.com>
|
* Copyright (C) 2017 Jeremy Soller <jeremy@system76.com>
|
||||||
* Copyright (C) 2014-2016 Arnoud Willemsen <mail@lynthium.com>
|
* Copyright (C) 2014-2016 Arnoud Willemsen <mail@lynthium.com>
|
||||||
* Copyright (C) 2013-2015 TUXEDO Computers GmbH <tux@tuxedocomputers.com>
|
* Copyright (C) 2013-2015 TUXEDO Computers GmbH <tux@tuxedocomputers.com>
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define EXPERIMENTAL
|
#define EXPERIMENTAL
|
||||||
|
|
@ -27,12 +15,13 @@ struct s76_hwmon {
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct s76_hwmon *s76_hwmon = NULL;
|
static struct s76_hwmon *s76_hwmon;
|
||||||
|
|
||||||
static int s76_read_fan(int idx)
|
static int s76_read_fan(int idx)
|
||||||
{
|
{
|
||||||
u8 value;
|
u8 value;
|
||||||
int raw_rpm;
|
int raw_rpm;
|
||||||
|
|
||||||
ec_read(0xd0 + 0x2 * idx, &value);
|
ec_read(0xd0 + 0x2 * idx, &value);
|
||||||
raw_rpm = value << 8;
|
raw_rpm = value << 8;
|
||||||
ec_read(0xd1 + 0x2 * idx, &value);
|
ec_read(0xd1 + 0x2 * idx, &value);
|
||||||
|
|
@ -45,6 +34,7 @@ static int s76_read_fan(int idx)
|
||||||
static int s76_read_pwm(int idx)
|
static int s76_read_pwm(int idx)
|
||||||
{
|
{
|
||||||
u8 value;
|
u8 value;
|
||||||
|
|
||||||
ec_read(0xce + idx, &value);
|
ec_read(0xce + idx, &value);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
@ -52,26 +42,23 @@ static int s76_read_pwm(int idx)
|
||||||
static int s76_write_pwm(int idx, u8 duty)
|
static int s76_write_pwm(int idx, u8 duty)
|
||||||
{
|
{
|
||||||
u8 values[] = {idx + 1, duty};
|
u8 values[] = {idx + 1, duty};
|
||||||
|
|
||||||
return ec_transaction(0x99, values, sizeof(values), NULL, 0);
|
return ec_transaction(0x99, values, sizeof(values), NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int s76_write_pwm_auto(int idx)
|
static int s76_write_pwm_auto(int idx)
|
||||||
{
|
{
|
||||||
u8 values[] = {0xff, idx + 1};
|
u8 values[] = {0xff, idx + 1};
|
||||||
return ec_transaction(0x99, values, sizeof(values), NULL, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ssize_t s76_hwmon_show_name(struct device *dev,
|
return ec_transaction(0x99, values, sizeof(values), NULL, 0);
|
||||||
struct device_attribute *attr, char *buf)
|
|
||||||
{
|
|
||||||
return sprintf(buf, S76_DRIVER_NAME "\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t s76_hwmon_show_fan_input(struct device *dev,
|
static ssize_t s76_hwmon_show_fan_input(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
int index = to_sensor_dev_attr(attr)->index;
|
int index = to_sensor_dev_attr(attr)->index;
|
||||||
return sprintf(buf, "%i\n", s76_read_fan(index));
|
|
||||||
|
return sysfs_emit(buf, "%i\n", s76_read_fan(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t s76_hwmon_show_fan_label(struct device *dev,
|
static ssize_t s76_hwmon_show_fan_label(struct device *dev,
|
||||||
|
|
@ -79,9 +66,9 @@ static ssize_t s76_hwmon_show_fan_label(struct device *dev,
|
||||||
{
|
{
|
||||||
switch (to_sensor_dev_attr(attr)->index) {
|
switch (to_sensor_dev_attr(attr)->index) {
|
||||||
case 0:
|
case 0:
|
||||||
return sprintf(buf, "CPU fan\n");
|
return sysfs_emit(buf, "CPU fan\n");
|
||||||
case 1:
|
case 1:
|
||||||
return sprintf(buf, "GPU fan\n");
|
return sysfs_emit(buf, "GPU fan\n");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -92,7 +79,8 @@ static ssize_t s76_hwmon_show_pwm(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
int index = to_sensor_dev_attr(attr)->index;
|
int index = to_sensor_dev_attr(attr)->index;
|
||||||
return sprintf(buf, "%i\n", s76_read_pwm(index));
|
|
||||||
|
return sysfs_emit(buf, "%i\n", s76_read_pwm(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t s76_hwmon_set_pwm(struct device *dev,
|
static ssize_t s76_hwmon_set_pwm(struct device *dev,
|
||||||
|
|
@ -118,7 +106,8 @@ static ssize_t s76_hwmon_show_pwm_enable(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
int index = to_sensor_dev_attr(attr)->index;
|
int index = to_sensor_dev_attr(attr)->index;
|
||||||
return sprintf(buf, "%i\n", pwm_enabled[index]);
|
|
||||||
|
return sysfs_emit(buf, "%i\n", pwm_enabled[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t s76_hwmon_set_pwm_enable(struct device *dev,
|
static ssize_t s76_hwmon_set_pwm_enable(struct device *dev,
|
||||||
|
|
@ -159,14 +148,15 @@ static ssize_t s76_hwmon_show_temp1_input(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
u8 value;
|
u8 value;
|
||||||
|
|
||||||
ec_read(0x07, &value);
|
ec_read(0x07, &value);
|
||||||
return sprintf(buf, "%i\n", value * 1000);
|
return sysfs_emit(buf, "%i\n", value * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t s76_hwmon_show_temp1_label(struct device *dev,
|
static ssize_t s76_hwmon_show_temp1_label(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
return sprintf(buf, "CPU temperature\n");
|
return sysfs_emit(buf, "CPU temperature\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL
|
#ifdef EXPERIMENTAL
|
||||||
|
|
@ -174,37 +164,36 @@ static ssize_t s76_hwmon_show_temp2_input(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
u8 value;
|
u8 value;
|
||||||
|
|
||||||
ec_read(0xcd, &value);
|
ec_read(0xcd, &value);
|
||||||
return sprintf(buf, "%i\n", value * 1000);
|
return sysfs_emit(buf, "%i\n", value * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t s76_hwmon_show_temp2_label(struct device *dev,
|
static ssize_t s76_hwmon_show_temp2_label(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
return sprintf(buf, "GPU temperature\n");
|
return sysfs_emit(buf, "GPU temperature\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static SENSOR_DEVICE_ATTR(name, S_IRUGO, s76_hwmon_show_name, NULL, 0);
|
static SENSOR_DEVICE_ATTR(fan1_input, 0444, s76_hwmon_show_fan_input, NULL, 0);
|
||||||
static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, s76_hwmon_show_fan_input, NULL, 0);
|
static SENSOR_DEVICE_ATTR(fan1_label, 0444, s76_hwmon_show_fan_label, NULL, 0);
|
||||||
static SENSOR_DEVICE_ATTR(fan1_label, S_IRUGO, s76_hwmon_show_fan_label, NULL, 0);
|
static SENSOR_DEVICE_ATTR(pwm1, 0644, s76_hwmon_show_pwm, s76_hwmon_set_pwm, 0);
|
||||||
static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, s76_hwmon_show_pwm, s76_hwmon_set_pwm, 0);
|
static SENSOR_DEVICE_ATTR(pwm1_enable, 0644, s76_hwmon_show_pwm_enable, s76_hwmon_set_pwm_enable, 0);
|
||||||
static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, s76_hwmon_show_pwm_enable, s76_hwmon_set_pwm_enable, 0);
|
|
||||||
#ifdef EXPERIMENTAL
|
#ifdef EXPERIMENTAL
|
||||||
static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, s76_hwmon_show_fan_input, NULL, 1);
|
static SENSOR_DEVICE_ATTR(fan2_input, 0444, s76_hwmon_show_fan_input, NULL, 1);
|
||||||
static SENSOR_DEVICE_ATTR(fan2_label, S_IRUGO, s76_hwmon_show_fan_label, NULL, 1);
|
static SENSOR_DEVICE_ATTR(fan2_label, 0444, s76_hwmon_show_fan_label, NULL, 1);
|
||||||
static SENSOR_DEVICE_ATTR(pwm2, S_IRUGO | S_IWUSR, s76_hwmon_show_pwm, s76_hwmon_set_pwm, 1);
|
static SENSOR_DEVICE_ATTR(pwm2, 0644, s76_hwmon_show_pwm, s76_hwmon_set_pwm, 1);
|
||||||
static SENSOR_DEVICE_ATTR(pwm2_enable, S_IRUGO | S_IWUSR, s76_hwmon_show_pwm_enable, s76_hwmon_set_pwm_enable, 1);
|
static SENSOR_DEVICE_ATTR(pwm2_enable, 0644, s76_hwmon_show_pwm_enable, s76_hwmon_set_pwm_enable, 1);
|
||||||
#endif
|
#endif
|
||||||
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, s76_hwmon_show_temp1_input, NULL, 0);
|
static SENSOR_DEVICE_ATTR(temp1_input, 0444, s76_hwmon_show_temp1_input, NULL, 0);
|
||||||
static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, s76_hwmon_show_temp1_label, NULL, 0);
|
static SENSOR_DEVICE_ATTR(temp1_label, 0444, s76_hwmon_show_temp1_label, NULL, 0);
|
||||||
#ifdef EXPERIMENTAL
|
#ifdef EXPERIMENTAL
|
||||||
static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, s76_hwmon_show_temp2_input, NULL, 1);
|
static SENSOR_DEVICE_ATTR(temp2_input, 0444, s76_hwmon_show_temp2_input, NULL, 1);
|
||||||
static SENSOR_DEVICE_ATTR(temp2_label, S_IRUGO, s76_hwmon_show_temp2_label, NULL, 1);
|
static SENSOR_DEVICE_ATTR(temp2_label, 0444, s76_hwmon_show_temp2_label, NULL, 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct attribute *hwmon_default_attributes[] = {
|
static struct attribute *hwmon_default_attributes[] = {
|
||||||
&sensor_dev_attr_name.dev_attr.attr,
|
|
||||||
&sensor_dev_attr_fan1_input.dev_attr.attr,
|
&sensor_dev_attr_fan1_input.dev_attr.attr,
|
||||||
&sensor_dev_attr_fan1_label.dev_attr.attr,
|
&sensor_dev_attr_fan1_label.dev_attr.attr,
|
||||||
&sensor_dev_attr_pwm1.dev_attr.attr,
|
&sensor_dev_attr_pwm1.dev_attr.attr,
|
||||||
|
|
@ -224,9 +213,10 @@ static struct attribute *hwmon_default_attributes[] = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct attribute_group hwmon_default_attrgroup = {
|
static const struct attribute_group hwmon_default_group = {
|
||||||
.attrs = hwmon_default_attributes,
|
.attrs = hwmon_default_attributes,
|
||||||
};
|
};
|
||||||
|
__ATTRIBUTE_GROUPS(hwmon_default);
|
||||||
|
|
||||||
static int s76_hwmon_reboot_callback(struct notifier_block *nb,
|
static int s76_hwmon_reboot_callback(struct notifier_block *nb,
|
||||||
unsigned long action, void *data)
|
unsigned long action, void *data)
|
||||||
|
|
@ -244,23 +234,16 @@ static struct notifier_block s76_hwmon_reboot_notifier = {
|
||||||
|
|
||||||
static int s76_hwmon_init(struct device *dev)
|
static int s76_hwmon_init(struct device *dev)
|
||||||
{
|
{
|
||||||
int ret;
|
s76_hwmon = devm_kzalloc(dev, sizeof(*s76_hwmon), GFP_KERNEL);
|
||||||
|
|
||||||
s76_hwmon = kzalloc(sizeof(*s76_hwmon), GFP_KERNEL);
|
|
||||||
if (!s76_hwmon)
|
if (!s76_hwmon)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
s76_hwmon->dev = hwmon_device_register(dev);
|
|
||||||
|
s76_hwmon->dev = devm_hwmon_device_register_with_groups(dev, S76_DRIVER_NAME, NULL, hwmon_default_groups);
|
||||||
if (IS_ERR(s76_hwmon->dev)) {
|
if (IS_ERR(s76_hwmon->dev)) {
|
||||||
ret = PTR_ERR(s76_hwmon->dev);
|
return PTR_ERR(s76_hwmon->dev);
|
||||||
s76_hwmon->dev = NULL;
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = sysfs_create_group(&s76_hwmon->dev->kobj, &hwmon_default_attrgroup);
|
(void)devm_register_reboot_notifier(dev, &s76_hwmon_reboot_notifier);
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
register_reboot_notifier(&s76_hwmon_reboot_notifier);
|
|
||||||
s76_write_pwm_auto(0);
|
s76_write_pwm_auto(0);
|
||||||
#ifdef EXPERIMENTAL
|
#ifdef EXPERIMENTAL
|
||||||
s76_write_pwm_auto(1);
|
s76_write_pwm_auto(1);
|
||||||
|
|
@ -270,16 +253,13 @@ static int s76_hwmon_init(struct device *dev)
|
||||||
|
|
||||||
static int s76_hwmon_fini(struct device *dev)
|
static int s76_hwmon_fini(struct device *dev)
|
||||||
{
|
{
|
||||||
if (!s76_hwmon || !s76_hwmon->dev)
|
if (!s76_hwmon || IS_ERR_OR_NULL(s76_hwmon->dev))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
s76_write_pwm_auto(0);
|
s76_write_pwm_auto(0);
|
||||||
#ifdef EXPERIMENTAL
|
#ifdef EXPERIMENTAL
|
||||||
s76_write_pwm_auto(1);
|
s76_write_pwm_auto(1);
|
||||||
#endif
|
#endif
|
||||||
unregister_reboot_notifier(&s76_hwmon_reboot_notifier);
|
|
||||||
sysfs_remove_group(&s76_hwmon->dev->kobj, &hwmon_default_attrgroup);
|
|
||||||
hwmon_device_unregister(s76_hwmon->dev);
|
|
||||||
kfree(s76_hwmon);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
50
src/input.c
50
src/input.c
|
|
@ -1,22 +1,10 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* input.c
|
* input.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017 Jeremy Soller <jeremy@system76.com>
|
* Copyright (C) 2017 Jeremy Soller <jeremy@system76.com>
|
||||||
* Copyright (C) 2014-2016 Arnoud Willemsen <mail@lynthium.com>
|
* Copyright (C) 2014-2016 Arnoud Willemsen <mail@lynthium.com>
|
||||||
* Copyright (C) 2013-2015 TUXEDO Computers GmbH <tux@tuxedocomputers.com>
|
* Copyright (C) 2013-2015 TUXEDO Computers GmbH <tux@tuxedocomputers.com>
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define AIRPLANE_KEY KEY_WLAN
|
#define AIRPLANE_KEY KEY_WLAN
|
||||||
|
|
@ -51,7 +39,7 @@ static const struct kernel_param_ops param_ops_poll_freq = {
|
||||||
|
|
||||||
static unsigned char param_poll_freq = POLL_FREQ_DEFAULT;
|
static unsigned char param_poll_freq = POLL_FREQ_DEFAULT;
|
||||||
#define param_check_poll_freq param_check_byte
|
#define param_check_poll_freq param_check_byte
|
||||||
module_param_named(poll_freq, param_poll_freq, poll_freq, S_IRUSR);
|
module_param_named(poll_freq, param_poll_freq, poll_freq, 0400);
|
||||||
MODULE_PARM_DESC(poll_freq, "Set polling frequency");
|
MODULE_PARM_DESC(poll_freq, "Set polling frequency");
|
||||||
|
|
||||||
static struct task_struct *s76_input_polling_task;
|
static struct task_struct *s76_input_polling_task;
|
||||||
|
|
@ -120,7 +108,7 @@ static int s76_input_open(struct input_dev *dev)
|
||||||
s76_input_polling_thread,
|
s76_input_polling_thread,
|
||||||
NULL, "system76-polld");
|
NULL, "system76-polld");
|
||||||
|
|
||||||
if (unlikely(IS_ERR(s76_input_polling_task))) {
|
if (IS_ERR(s76_input_polling_task)) {
|
||||||
res = PTR_ERR(s76_input_polling_task);
|
res = PTR_ERR(s76_input_polling_task);
|
||||||
s76_input_polling_task = NULL;
|
s76_input_polling_task = NULL;
|
||||||
pr_err("Could not create polling thread: %d\n", res);
|
pr_err("Could not create polling thread: %d\n", res);
|
||||||
|
|
@ -133,7 +121,7 @@ static int s76_input_open(struct input_dev *dev)
|
||||||
|
|
||||||
static void s76_input_close(struct input_dev *dev)
|
static void s76_input_close(struct input_dev *dev)
|
||||||
{
|
{
|
||||||
if (unlikely(IS_ERR_OR_NULL(s76_input_polling_task))) {
|
if (IS_ERR_OR_NULL(s76_input_polling_task)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -143,11 +131,10 @@ static void s76_input_close(struct input_dev *dev)
|
||||||
|
|
||||||
static int __init s76_input_init(struct device *dev)
|
static int __init s76_input_init(struct device *dev)
|
||||||
{
|
{
|
||||||
int err;
|
|
||||||
u8 byte;
|
u8 byte;
|
||||||
|
|
||||||
s76_input_device = input_allocate_device();
|
s76_input_device = devm_input_allocate_device(dev);
|
||||||
if (unlikely(!s76_input_device)) {
|
if (!s76_input_device) {
|
||||||
pr_err("Error allocating input device\n");
|
pr_err("Error allocating input device\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
@ -155,8 +142,8 @@ static int __init s76_input_init(struct device *dev)
|
||||||
s76_input_device->name = "System76 Hotkeys";
|
s76_input_device->name = "System76 Hotkeys";
|
||||||
s76_input_device->phys = "system76/input0";
|
s76_input_device->phys = "system76/input0";
|
||||||
s76_input_device->id.bustype = BUS_HOST;
|
s76_input_device->id.bustype = BUS_HOST;
|
||||||
s76_input_device->dev.parent = dev;
|
|
||||||
set_bit(EV_KEY, s76_input_device->evbit);
|
set_bit(EV_KEY, s76_input_device->evbit);
|
||||||
|
|
||||||
if (driver_flags & DRIVER_AP_KEY) {
|
if (driver_flags & DRIVER_AP_KEY) {
|
||||||
set_bit(AIRPLANE_KEY, s76_input_device->keybit);
|
set_bit(AIRPLANE_KEY, s76_input_device->keybit);
|
||||||
ec_read(0xDB, &byte);
|
ec_read(0xDB, &byte);
|
||||||
|
|
@ -169,26 +156,5 @@ static int __init s76_input_init(struct device *dev)
|
||||||
s76_input_device->open = s76_input_open;
|
s76_input_device->open = s76_input_open;
|
||||||
s76_input_device->close = s76_input_close;
|
s76_input_device->close = s76_input_close;
|
||||||
|
|
||||||
err = input_register_device(s76_input_device);
|
return input_register_device(s76_input_device);
|
||||||
if (unlikely(err)) {
|
|
||||||
pr_err("Error registering input device\n");
|
|
||||||
goto err_free_input_device;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
err_free_input_device:
|
|
||||||
input_free_device(s76_input_device);
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void __exit s76_input_exit(void)
|
|
||||||
{
|
|
||||||
if (unlikely(!s76_input_device)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
input_unregister_device(s76_input_device);
|
|
||||||
s76_input_device = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
40
src/kb-led.c
40
src/kb-led.c
|
|
@ -1,20 +1,8 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* kb_led.c
|
* kb_led.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017 Jeremy Soller <jeremy@system76.com>
|
* Copyright (C) 2017 Jeremy Soller <jeremy@system76.com>
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SET_KB_LED 0x67
|
#define SET_KB_LED 0x67
|
||||||
|
|
@ -31,7 +19,7 @@ enum kb_led_region {
|
||||||
KB_LED_REGION_EXTRA,
|
KB_LED_REGION_EXTRA,
|
||||||
};
|
};
|
||||||
|
|
||||||
static enum led_brightness kb_led_brightness = 0;
|
static enum led_brightness kb_led_brightness;
|
||||||
|
|
||||||
static enum led_brightness kb_led_toggle_brightness = 72;
|
static enum led_brightness kb_led_toggle_brightness = 72;
|
||||||
|
|
||||||
|
|
@ -44,7 +32,7 @@ static union kb_led_color kb_led_regions[] = {
|
||||||
{ .rgb = 0xFFFFFF }
|
{ .rgb = 0xFFFFFF }
|
||||||
};
|
};
|
||||||
|
|
||||||
static int kb_led_colors_i = 0;
|
static int kb_led_colors_i;
|
||||||
|
|
||||||
static union kb_led_color kb_led_colors[] = {
|
static union kb_led_color kb_led_colors[] = {
|
||||||
{ .rgb = 0xFFFFFF },
|
{ .rgb = 0xFFFFFF },
|
||||||
|
|
@ -63,7 +51,7 @@ static enum led_brightness kb_led_get(struct led_classdev *led_cdev)
|
||||||
|
|
||||||
static int kb_led_set(struct led_classdev *led_cdev, enum led_brightness value)
|
static int kb_led_set(struct led_classdev *led_cdev, enum led_brightness value)
|
||||||
{
|
{
|
||||||
pr_debug("kb_led_set %d\n", (int)value);
|
pr_debug("%s %d\n", __func__, (int)value);
|
||||||
|
|
||||||
if (!s76_wmbb(SET_KB_LED, 0xF4000000 | value, NULL)) {
|
if (!s76_wmbb(SET_KB_LED, 0xF4000000 | value, NULL)) {
|
||||||
kb_led_brightness = value;
|
kb_led_brightness = value;
|
||||||
|
|
@ -113,7 +101,7 @@ static void kb_led_color_set(enum kb_led_region region, union kb_led_color color
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
u8 *buf;
|
u8 *buf;
|
||||||
|
|
||||||
buf = (u8 *)kzalloc(8, GFP_KERNEL);
|
buf = kzalloc(8, GFP_KERNEL);
|
||||||
|
|
||||||
pr_debug("%s %d %06X\n", __func__, (int)region, (int)color.rgb);
|
pr_debug("%s %d %06X\n", __func__, (int)region, (int)color.rgb);
|
||||||
|
|
||||||
|
|
@ -179,7 +167,7 @@ static struct led_classdev kb_led = {
|
||||||
|
|
||||||
static ssize_t kb_led_color_show(enum kb_led_region region, char *buf)
|
static ssize_t kb_led_color_show(enum kb_led_region region, char *buf)
|
||||||
{
|
{
|
||||||
return sprintf(buf, "%06X\n", (int)kb_led_regions[region].rgb);
|
return sysfs_emit(buf, "%06X\n", (int)kb_led_regions[region].rgb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t kb_led_color_store(enum kb_led_region region, const char *buf, size_t size)
|
static ssize_t kb_led_color_store(enum kb_led_region region, const char *buf, size_t size)
|
||||||
|
|
@ -280,21 +268,21 @@ static struct device_attribute kb_led_color_extra_dev_attr = {
|
||||||
|
|
||||||
static void kb_led_enable(void)
|
static void kb_led_enable(void)
|
||||||
{
|
{
|
||||||
pr_debug("kb_led_enable\n");
|
pr_debug("%s\n", __func__);
|
||||||
|
|
||||||
s76_wmbb(SET_KB_LED, 0xE007F001, NULL);
|
s76_wmbb(SET_KB_LED, 0xE007F001, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void kb_led_disable(void)
|
static void kb_led_disable(void)
|
||||||
{
|
{
|
||||||
pr_debug("kb_led_disable\n");
|
pr_debug("%s\n", __func__);
|
||||||
|
|
||||||
s76_wmbb(SET_KB_LED, 0xE0003001, NULL);
|
s76_wmbb(SET_KB_LED, 0xE0003001, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void kb_led_suspend(void)
|
static void kb_led_suspend(void)
|
||||||
{
|
{
|
||||||
pr_debug("kb_led_suspend\n");
|
pr_debug("%s\n", __func__);
|
||||||
|
|
||||||
// Disable keyboard backlight
|
// Disable keyboard backlight
|
||||||
kb_led_disable();
|
kb_led_disable();
|
||||||
|
|
@ -304,7 +292,7 @@ static void kb_led_resume(void)
|
||||||
{
|
{
|
||||||
enum kb_led_region region;
|
enum kb_led_region region;
|
||||||
|
|
||||||
pr_debug("kb_led_resume\n");
|
pr_debug("%s\n", __func__);
|
||||||
|
|
||||||
// Disable keyboard backlight
|
// Disable keyboard backlight
|
||||||
kb_led_disable();
|
kb_led_disable();
|
||||||
|
|
@ -328,7 +316,7 @@ static int __init kb_led_init(struct device *dev)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = led_classdev_register(dev, &kb_led);
|
err = devm_led_classdev_register(dev, &kb_led);
|
||||||
if (unlikely(err)) {
|
if (unlikely(err)) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
@ -360,15 +348,11 @@ static void __exit kb_led_exit(void)
|
||||||
device_remove_file(kb_led.dev, &kb_led_color_right_dev_attr);
|
device_remove_file(kb_led.dev, &kb_led_color_right_dev_attr);
|
||||||
device_remove_file(kb_led.dev, &kb_led_color_center_dev_attr);
|
device_remove_file(kb_led.dev, &kb_led_color_center_dev_attr);
|
||||||
device_remove_file(kb_led.dev, &kb_led_color_left_dev_attr);
|
device_remove_file(kb_led.dev, &kb_led_color_left_dev_attr);
|
||||||
|
|
||||||
if (!IS_ERR_OR_NULL(kb_led.dev)) {
|
|
||||||
led_classdev_unregister(&kb_led);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void kb_wmi_brightness(enum led_brightness value)
|
static void kb_wmi_brightness(enum led_brightness value)
|
||||||
{
|
{
|
||||||
pr_debug("kb_wmi_brightness %d\n", (int)value);
|
pr_debug("%s %d\n", __func__, (int)value);
|
||||||
|
|
||||||
kb_led_set(&kb_led, value);
|
kb_led_set(&kb_led, value);
|
||||||
led_classdev_notify_brightness_hw_changed(&kb_led, value);
|
led_classdev_notify_brightness_hw_changed(&kb_led, value);
|
||||||
|
|
|
||||||
17
src/nv_hda.c
17
src/nv_hda.c
|
|
@ -1,19 +1,7 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/* Based on bbswitch,
|
/* Based on bbswitch,
|
||||||
* Copyright (C) 2011-2013 Bumblebee Project
|
* Copyright (C) 2011-2013 Bumblebee Project
|
||||||
* Author: Peter Wu <lekensteyn@gmail.com>
|
* Author: Peter Wu <lekensteyn@gmail.com>
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
@ -23,7 +11,7 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct pci_dev *dis_dev;
|
static struct pci_dev *dis_dev;
|
||||||
static struct pci_dev *sub_dev = NULL;
|
static struct pci_dev *sub_dev;
|
||||||
|
|
||||||
// Returns 1 if the card is disabled, 0 if enabled
|
// Returns 1 if the card is disabled, 0 if enabled
|
||||||
static int is_card_disabled(void)
|
static int is_card_disabled(void)
|
||||||
|
|
@ -66,6 +54,7 @@ static int is_card_disabled(void)
|
||||||
static void nv_hda_off(void)
|
static void nv_hda_off(void)
|
||||||
{
|
{
|
||||||
u32 cfg_word;
|
u32 cfg_word;
|
||||||
|
|
||||||
if (is_card_disabled()) {
|
if (is_card_disabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,10 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* system76.c
|
* system76.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017 Jeremy Soller <jeremy@system76.com>
|
* Copyright (C) 2017 Jeremy Soller <jeremy@system76.com>
|
||||||
* Copyright (C) 2014-2016 Arnoud Willemsen <mail@lynthium.com>
|
* Copyright (C) 2014-2016 Arnoud Willemsen <mail@lynthium.com>
|
||||||
* Copyright (C) 2013-2015 TUXEDO Computers GmbH <tux@tuxedocomputers.com>
|
* Copyright (C) 2013-2015 TUXEDO Computers GmbH <tux@tuxedocomputers.com>
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define S76_DRIVER_NAME KBUILD_MODNAME
|
#define S76_DRIVER_NAME KBUILD_MODNAME
|
||||||
|
|
@ -61,7 +49,7 @@
|
||||||
|
|
||||||
#define DRIVER_INPUT (DRIVER_AP_KEY | DRIVER_OLED)
|
#define DRIVER_INPUT (DRIVER_AP_KEY | DRIVER_OLED)
|
||||||
|
|
||||||
static uint64_t driver_flags = 0;
|
static uint64_t driver_flags;
|
||||||
|
|
||||||
struct platform_device *s76_platform_device;
|
struct platform_device *s76_platform_device;
|
||||||
|
|
||||||
|
|
@ -103,7 +91,9 @@ static int s76_wmbb(u32 method_id, u32 arg, u32 *retval)
|
||||||
#include "input.c"
|
#include "input.c"
|
||||||
#include "kb-led.c"
|
#include "kb-led.c"
|
||||||
#include "hwmon.c"
|
#include "hwmon.c"
|
||||||
|
#ifdef S76_WANTS_NV_HDA
|
||||||
#include "nv_hda.c"
|
#include "nv_hda.c"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
|
||||||
static void s76_wmi_notify(union acpi_object *obj, void *context)
|
static void s76_wmi_notify(union acpi_object *obj, void *context)
|
||||||
|
|
@ -115,7 +105,7 @@ static void s76_wmi_notify(u32 value, void *context)
|
||||||
|
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
|
||||||
if (obj->type != ACPI_TYPE_INTEGER) {
|
if (obj->type != ACPI_TYPE_INTEGER) {
|
||||||
pr_debug("Unexpected WMI event (%0#6x)\n", obj);
|
pr_debug("Unexpected WMI event (%0#6x)\n", obj->type);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
@ -210,10 +200,12 @@ static int __init s76_probe(struct platform_device *dev)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef S76_WANTS_NV_HDA
|
||||||
err = nv_hda_init(&dev->dev);
|
err = nv_hda_init(&dev->dev);
|
||||||
if (unlikely(err)) {
|
if (unlikely(err)) {
|
||||||
pr_err("Could not register NVIDIA audio device\n");
|
pr_err("Could not register NVIDIA audio device\n");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
err = wmi_install_notify_handler(S76_EVENT_GUID, s76_wmi_notify, NULL);
|
err = wmi_install_notify_handler(S76_EVENT_GUID, s76_wmi_notify, NULL);
|
||||||
if (unlikely(ACPI_FAILURE(err))) {
|
if (unlikely(ACPI_FAILURE(err))) {
|
||||||
|
|
@ -240,15 +232,14 @@ static int s76_remove(struct platform_device *dev)
|
||||||
{
|
{
|
||||||
wmi_remove_notify_handler(S76_EVENT_GUID);
|
wmi_remove_notify_handler(S76_EVENT_GUID);
|
||||||
|
|
||||||
|
#ifdef S76_WANTS_NV_HDA
|
||||||
nv_hda_exit();
|
nv_hda_exit();
|
||||||
|
#endif
|
||||||
#ifdef S76_HAS_HWMON
|
#ifdef S76_HAS_HWMON
|
||||||
if (driver_flags & DRIVER_HWMON) {
|
if (driver_flags & DRIVER_HWMON) {
|
||||||
s76_hwmon_fini(&dev->dev);
|
s76_hwmon_fini(&dev->dev);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (driver_flags & DRIVER_INPUT) {
|
|
||||||
s76_input_exit();
|
|
||||||
}
|
|
||||||
if (driver_flags & (DRIVER_KB_LED_WMI | DRIVER_KB_LED)) {
|
if (driver_flags & (DRIVER_KB_LED_WMI | DRIVER_KB_LED)) {
|
||||||
kb_led_exit();
|
kb_led_exit();
|
||||||
}
|
}
|
||||||
|
|
@ -261,9 +252,9 @@ static int s76_remove(struct platform_device *dev)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int s76_suspend(struct platform_device *dev, pm_message_t status)
|
static int s76_suspend(struct device *dev)
|
||||||
{
|
{
|
||||||
pr_debug("s76_suspend\n");
|
pr_debug("%s\n", __func__);
|
||||||
|
|
||||||
if (driver_flags & (DRIVER_KB_LED_WMI | DRIVER_KB_LED)) {
|
if (driver_flags & (DRIVER_KB_LED_WMI | DRIVER_KB_LED)) {
|
||||||
kb_led_suspend();
|
kb_led_suspend();
|
||||||
|
|
@ -272,9 +263,9 @@ static int s76_suspend(struct platform_device *dev, pm_message_t status)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int s76_resume(struct platform_device *dev)
|
static int s76_resume(struct device *dev)
|
||||||
{
|
{
|
||||||
pr_debug("s76_resume\n");
|
pr_debug("%s\n", __func__);
|
||||||
|
|
||||||
msleep(2000);
|
msleep(2000);
|
||||||
|
|
||||||
|
|
@ -296,13 +287,22 @@ static int s76_resume(struct platform_device *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
|
||||||
|
static DEFINE_SIMPLE_DEV_PM_OPS(s76_pm, s76_suspend, s76_resume);
|
||||||
|
#else
|
||||||
|
static SIMPLE_DEV_PM_OPS(s76_pm, s76_suspend, s76_resume);
|
||||||
|
#endif
|
||||||
|
|
||||||
static struct platform_driver s76_platform_driver = {
|
static struct platform_driver s76_platform_driver = {
|
||||||
.remove = s76_remove,
|
.remove = s76_remove,
|
||||||
.suspend = s76_suspend,
|
|
||||||
.resume = s76_resume,
|
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = S76_DRIVER_NAME,
|
.name = S76_DRIVER_NAME,
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
|
||||||
|
.pm = pm_sleep_ptr(&s76_pm),
|
||||||
|
#else
|
||||||
|
.pm = pm_ptr(&s76_pm),
|
||||||
|
#endif
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -338,6 +338,7 @@ static struct dmi_system_id s76_dmi_table[] __initdata = {
|
||||||
DMI_TABLE_LEGACY("bonw13", DRIVER_HWMON | DRIVER_KB_LED_WMI),
|
DMI_TABLE_LEGACY("bonw13", DRIVER_HWMON | DRIVER_KB_LED_WMI),
|
||||||
DMI_TABLE("addw1", DRIVER_AP_LED | DRIVER_KB_LED_WMI | DRIVER_OLED),
|
DMI_TABLE("addw1", DRIVER_AP_LED | DRIVER_KB_LED_WMI | DRIVER_OLED),
|
||||||
DMI_TABLE("addw2", DRIVER_AP_LED | DRIVER_KB_LED_WMI | DRIVER_OLED),
|
DMI_TABLE("addw2", DRIVER_AP_LED | DRIVER_KB_LED_WMI | DRIVER_OLED),
|
||||||
|
DMI_TABLE("addw5", DRIVER_HWMON | DRIVER_KB_LED_WMI),
|
||||||
DMI_TABLE("bonw15-b", DRIVER_HWMON | DRIVER_KB_LED_WMI),
|
DMI_TABLE("bonw15-b", DRIVER_HWMON | DRIVER_KB_LED_WMI),
|
||||||
DMI_TABLE("bonw16", DRIVER_HWMON | DRIVER_KB_LED_WMI),
|
DMI_TABLE("bonw16", DRIVER_HWMON | DRIVER_KB_LED_WMI),
|
||||||
DMI_TABLE("darp5", DRIVER_AP_LED | DRIVER_HWMON | DRIVER_KB_LED_WMI),
|
DMI_TABLE("darp5", DRIVER_AP_LED | DRIVER_HWMON | DRIVER_KB_LED_WMI),
|
||||||
|
|
@ -357,6 +358,7 @@ static struct dmi_system_id s76_dmi_table[] __initdata = {
|
||||||
DMI_TABLE("oryp4-b", DRIVER_AP_KEY | DRIVER_AP_LED | DRIVER_HWMON | DRIVER_KB_LED_WMI),
|
DMI_TABLE("oryp4-b", DRIVER_AP_KEY | DRIVER_AP_LED | DRIVER_HWMON | DRIVER_KB_LED_WMI),
|
||||||
DMI_TABLE("oryp5", DRIVER_AP_LED | DRIVER_HWMON | DRIVER_KB_LED_WMI),
|
DMI_TABLE("oryp5", DRIVER_AP_LED | DRIVER_HWMON | DRIVER_KB_LED_WMI),
|
||||||
DMI_TABLE("oryp6", DRIVER_AP_LED | DRIVER_KB_LED_WMI),
|
DMI_TABLE("oryp6", DRIVER_AP_LED | DRIVER_KB_LED_WMI),
|
||||||
|
DMI_TABLE("oryp13", DRIVER_AP_KEY | DRIVER_HWMON | DRIVER_KB_LED_WMI),
|
||||||
DMI_TABLE("pang10", DRIVER_AP_KEY | DRIVER_AP_WMI | DRIVER_KB_LED_WMI),
|
DMI_TABLE("pang10", DRIVER_AP_KEY | DRIVER_AP_WMI | DRIVER_KB_LED_WMI),
|
||||||
DMI_TABLE("pang11", DRIVER_AP_KEY | DRIVER_AP_WMI | DRIVER_KB_LED_WMI),
|
DMI_TABLE("pang11", DRIVER_AP_KEY | DRIVER_AP_WMI | DRIVER_KB_LED_WMI),
|
||||||
DMI_TABLE("serw11", DRIVER_AP_KEY | DRIVER_AP_LED | DRIVER_HWMON | DRIVER_KB_LED_WMI),
|
DMI_TABLE("serw11", DRIVER_AP_KEY | DRIVER_AP_LED | DRIVER_HWMON | DRIVER_KB_LED_WMI),
|
||||||
|
|
@ -392,7 +394,7 @@ static int __init s76_init(void)
|
||||||
s76_platform_device =
|
s76_platform_device =
|
||||||
platform_create_bundle(&s76_platform_driver, s76_probe, NULL, 0, NULL, 0);
|
platform_create_bundle(&s76_platform_driver, s76_probe, NULL, 0, NULL, 0);
|
||||||
|
|
||||||
if (unlikely(IS_ERR(s76_platform_device))) {
|
if (IS_ERR(s76_platform_device)) {
|
||||||
return PTR_ERR(s76_platform_device);
|
return PTR_ERR(s76_platform_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue