* [PATCH v2 0/3] asus_wmi: Support of ASUS TUF laptops on Ryzen CPUs
@ 2019-11-04 21:34 Leonid Maksymchuk
2019-11-04 21:37 ` [PATCH v2 1/3] platform/x86: asus_wmi: Fix return value of fan_boost_mode_store Leonid Maksymchuk
` (3 more replies)
0 siblings, 4 replies; 13+ messages in thread
From: Leonid Maksymchuk @ 2019-11-04 21:34 UTC (permalink / raw)
To: linux-kernel
Cc: platform-driver-x86, acpi4asus-user, chiu, yurii.pavlovskyi,
kristian, andy, dvhart, corentin.chary, Leonid Maksymchuk
Hi,
this patch series adds support of ASUS TUF laptops on Ryzen CPUs to existing
asus_wmi platform driver and also fixes minor bug.
v2: fixed indentation.
Leonid Maksymchuk (3):
asus_wmi: Fix return value of fan_boost_mode_store
asus_wmi: Add support for fan boost mode on FX505DY/FX705DY
asus_wmi: Set default fan boost mode to normal
drivers/platform/x86/asus-wmi.c | 57 ++++++++++++++++++++++--------
include/linux/platform_data/x86/asus-wmi.h | 1 +
2 files changed, 43 insertions(+), 15 deletions(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2 1/3] platform/x86: asus_wmi: Fix return value of fan_boost_mode_store
2019-11-04 21:34 [PATCH v2 0/3] asus_wmi: Support of ASUS TUF laptops on Ryzen CPUs Leonid Maksymchuk
@ 2019-11-04 21:37 ` Leonid Maksymchuk
2019-11-04 21:38 ` [PATCH v2 2/3] platform/x86: asus_wmi: Support fan boost mode on FX505DY/FX705DY Leonid Maksymchuk
` (2 subsequent siblings)
3 siblings, 0 replies; 13+ messages in thread
From: Leonid Maksymchuk @ 2019-11-04 21:37 UTC (permalink / raw)
To: linux-kernel
Cc: platform-driver-x86, acpi4asus-user, chiu, yurii.pavlovskyi,
kristian, andy, dvhart, corentin.chary, Leonid Maksymchuk
Function fan_boost_mode_store should return number of bytes written
but instead it returns return value of kstrtou8 which is 0 if
conversion is succefull. This leads to infinite loop after any
write to it's SysFS entry.
Fixes: b096f626a682 ("platform/x86: asus-wmi: Switch fan boost mode")
Signed-off-by: Leonid Maksymchuk <leonmaxx@gmail.com>
---
drivers/platform/x86/asus-wmi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 821b08e..723aa4d 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -1718,7 +1718,7 @@ static ssize_t fan_boost_mode_store(struct device *dev,
asus->fan_boost_mode = new_mode;
fan_boost_mode_write(asus);
- return result;
+ return count;
}
// Fan boost mode: 0 - normal, 1 - overboost, 2 - silent
--
1.8.3.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 2/3] platform/x86: asus_wmi: Support fan boost mode on FX505DY/FX705DY
2019-11-04 21:34 [PATCH v2 0/3] asus_wmi: Support of ASUS TUF laptops on Ryzen CPUs Leonid Maksymchuk
2019-11-04 21:37 ` [PATCH v2 1/3] platform/x86: asus_wmi: Fix return value of fan_boost_mode_store Leonid Maksymchuk
@ 2019-11-04 21:38 ` Leonid Maksymchuk
2019-11-05 0:00 ` kbuild test robot
2019-11-07 17:15 ` Andy Shevchenko
2019-11-04 21:39 ` [PATCH v2 3/3] platform/x86: asus_wmi: Set default fan boost mode to normal Leonid Maksymchuk
2019-11-06 7:21 ` [PATCH v2 0/3] asus_wmi: Support of ASUS TUF laptops on Ryzen CPUs Andy Shevchenko
3 siblings, 2 replies; 13+ messages in thread
From: Leonid Maksymchuk @ 2019-11-04 21:38 UTC (permalink / raw)
To: linux-kernel
Cc: platform-driver-x86, acpi4asus-user, chiu, yurii.pavlovskyi,
kristian, andy, dvhart, corentin.chary, Leonid Maksymchuk
On ASUS FX505DY/FX705DY laptops fan boost mode is same as in other
TUF laptop models but have different ACPI device ID and different key
code.
Signed-off-by: Leonid Maksymchuk <leonmaxx@gmail.com>
---
drivers/platform/x86/asus-wmi.c | 42 ++++++++++++++++++++----------
include/linux/platform_data/x86/asus-wmi.h | 1 +
2 files changed, 29 insertions(+), 14 deletions(-)
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 723aa4d..f4e5840 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -61,6 +61,7 @@
#define NOTIFY_KBD_BRTDWN 0xc5
#define NOTIFY_KBD_BRTTOGGLE 0xc7
#define NOTIFY_KBD_FBM 0x99
+#define NOTIFY_KBD_FBM_2 0xae
#define ASUS_WMI_FNLOCK_BIOS_DISABLED BIT(0)
@@ -194,7 +195,7 @@ struct asus_wmi {
int fan_pwm_mode;
int agfn_pwm;
- bool fan_boost_mode_available;
+ int fan_boost_mode_available;
u8 fan_boost_mode_mask;
u8 fan_boost_mode;
@@ -1616,24 +1617,33 @@ static int fan_boost_mode_check_present(struct asus_wmi *asus)
u32 result;
int err;
- asus->fan_boost_mode_available = false;
+ asus->fan_boost_mode_available = 0;
err = asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_FAN_BOOST_MODE,
&result);
- if (err) {
- if (err == -ENODEV)
- return 0;
- else
- return err;
+
+ if (err == 0 &&
+ (result & ASUS_WMI_DSTS_PRESENCE_BIT) &&
+ (result & ASUS_FAN_BOOST_MODES_MASK)) {
+ asus->fan_boost_mode_available = 1;
+ asus->fan_boost_mode_mask = result & ASUS_FAN_BOOST_MODES_MASK;
+ return 0;
}
- if ((result & ASUS_WMI_DSTS_PRESENCE_BIT) &&
+ err = asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_FAN_BOOST_MODE_2,
+ &result);
+
+ if (err == 0 &&
+ (result & ASUS_WMI_DSTS_PRESENCE_BIT) &&
(result & ASUS_FAN_BOOST_MODES_MASK)) {
- asus->fan_boost_mode_available = true;
+ asus->fan_boost_mode_available = 2;
asus->fan_boost_mode_mask = result & ASUS_FAN_BOOST_MODES_MASK;
}
- return 0;
+ if (err == -ENODEV)
+ return 0;
+
+ return err;
}
static int fan_boost_mode_write(struct asus_wmi *asus)
@@ -1641,12 +1651,15 @@ static int fan_boost_mode_write(struct asus_wmi *asus)
int err;
u8 value;
u32 retval;
+ u32 dev_id = asus->fan_boost_mode_available == 1 ?
+ ASUS_WMI_DEVID_FAN_BOOST_MODE :
+ ASUS_WMI_DEVID_FAN_BOOST_MODE_2;
value = asus->fan_boost_mode;
pr_info("Set fan boost mode: %u\n", value);
- err = asus_wmi_set_devstate(ASUS_WMI_DEVID_FAN_BOOST_MODE, value,
- &retval);
+ err = asus_wmi_set_devstate(dev_id, value, &retval);
+
if (err) {
pr_warn("Failed to set fan boost mode: %d\n", err);
return err;
@@ -2000,7 +2013,8 @@ static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus)
return;
}
- if (asus->fan_boost_mode_available && code == NOTIFY_KBD_FBM) {
+ if (asus->fan_boost_mode_available &&
+ (code == NOTIFY_KBD_FBM || code == NOTIFY_KBD_FBM_2) {
fan_boost_mode_switch_next(asus);
return;
}
@@ -2177,7 +2191,7 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj,
else if (attr == &dev_attr_als_enable.attr)
devid = ASUS_WMI_DEVID_ALS_ENABLE;
else if (attr == &dev_attr_fan_boost_mode.attr)
- ok = asus->fan_boost_mode_available;
+ ok = asus->fan_boost_mode_available != 0;
if (devid != -1)
ok = !(asus_wmi_get_devstate_simple(asus, devid) < 0);
diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h
index 60249e2..714782b 100644
--- a/include/linux/platform_data/x86/asus-wmi.h
+++ b/include/linux/platform_data/x86/asus-wmi.h
@@ -58,6 +58,7 @@
#define ASUS_WMI_DEVID_LIGHT_SENSOR 0x00050022 /* ?? */
#define ASUS_WMI_DEVID_LIGHTBAR 0x00050025
#define ASUS_WMI_DEVID_FAN_BOOST_MODE 0x00110018
+#define ASUS_WMI_DEVID_FAN_BOOST_MODE_2 0x00120075
/* Misc */
#define ASUS_WMI_DEVID_CAMERA 0x00060013
--
1.8.3.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 3/3] platform/x86: asus_wmi: Set default fan boost mode to normal
2019-11-04 21:34 [PATCH v2 0/3] asus_wmi: Support of ASUS TUF laptops on Ryzen CPUs Leonid Maksymchuk
2019-11-04 21:37 ` [PATCH v2 1/3] platform/x86: asus_wmi: Fix return value of fan_boost_mode_store Leonid Maksymchuk
2019-11-04 21:38 ` [PATCH v2 2/3] platform/x86: asus_wmi: Support fan boost mode on FX505DY/FX705DY Leonid Maksymchuk
@ 2019-11-04 21:39 ` Leonid Maksymchuk
2019-11-06 7:03 ` Andy Shevchenko
2019-11-06 7:21 ` [PATCH v2 0/3] asus_wmi: Support of ASUS TUF laptops on Ryzen CPUs Andy Shevchenko
3 siblings, 1 reply; 13+ messages in thread
From: Leonid Maksymchuk @ 2019-11-04 21:39 UTC (permalink / raw)
To: linux-kernel
Cc: platform-driver-x86, acpi4asus-user, chiu, yurii.pavlovskyi,
kristian, andy, dvhart, corentin.chary, Leonid Maksymchuk
Set default fan boost mode to normal for multiple reasons:
1) existing code assumes that laptop started in normal mode and that is
not always correct.
2) FX705DY/FX505DY starts in silent mode and under heavy CPU load it
overheats and drops CPU frequency to 399MHz [1]. Setting fan mode to
normal avoids overheating.
[1] Link: https://bugzilla.kernel.org/show_bug.cgi?id=203733
Signed-off-by: Leonid Maksymchuk <leonmaxx@gmail.com>
---
drivers/platform/x86/asus-wmi.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index f4e5840..70c5fbb 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -1674,6 +1674,18 @@ static int fan_boost_mode_write(struct asus_wmi *asus)
return 0;
}
+static int fan_boost_mode_set_default(struct asus_wmi *asus)
+{
+ int result = 0;
+
+ if (asus->fan_boost_mode_available) {
+ asus->fan_boost_mode = ASUS_FAN_BOOST_MODE_NORMAL;
+ result = fan_boost_mode_write(asus);
+ }
+
+ return result;
+}
+
static int fan_boost_mode_switch_next(struct asus_wmi *asus)
{
u8 mask = asus->fan_boost_mode_mask;
@@ -2450,6 +2462,7 @@ static int asus_wmi_add(struct platform_device *pdev)
err = fan_boost_mode_check_present(asus);
if (err)
goto fail_fan_boost_mode;
+ fan_boost_mode_set_default(asus);
err = asus_wmi_sysfs_init(asus->platform_device);
if (err)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2 2/3] platform/x86: asus_wmi: Support fan boost mode on FX505DY/FX705DY
2019-11-04 21:38 ` [PATCH v2 2/3] platform/x86: asus_wmi: Support fan boost mode on FX505DY/FX705DY Leonid Maksymchuk
2019-11-05 0:00 ` kbuild test robot
@ 2019-11-05 0:00 ` kbuild test robot
1 sibling, 0 replies; 13+ messages in thread
From: kbuild test robot @ 2019-11-05 0:00 UTC (permalink / raw)
To: Leonid Maksymchuk
Cc: kbuild-all, linux-kernel, platform-driver-x86, acpi4asus-user,
chiu, yurii.pavlovskyi, kristian, andy, dvhart, corentin.chary,
Leonid Maksymchuk
[-- Attachment #1: Type: text/plain, Size: 4011 bytes --]
Hi Leonid,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v5.4-rc6 next-20191031]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Leonid-Maksymchuk/asus_wmi-Support-of-ASUS-TUF-laptops-on-Ryzen-CPUs/20191105-054154
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git a99d8080aaf358d5d23581244e5da23b35e340b9
config: x86_64-rhel (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/platform/x86/asus-wmi.c: In function 'asus_wmi_handle_event_code':
>> drivers/platform/x86/asus-wmi.c:2017:57: error: expected ')' before '{' token
(code == NOTIFY_KBD_FBM || code == NOTIFY_KBD_FBM_2) {
^
>> drivers/platform/x86/asus-wmi.c:2028:1: error: expected expression before '}' token
}
^
At top level:
drivers/platform/x86/asus-wmi.c:1909:12: warning: 'is_display_toggle' defined but not used [-Wunused-function]
static int is_display_toggle(int code)
^~~~~~~~~~~~~~~~~
drivers/platform/x86/asus-wmi.c:1677:12: warning: 'fan_boost_mode_switch_next' defined but not used [-Wunused-function]
static int fan_boost_mode_switch_next(struct asus_wmi *asus)
^~~~~~~~~~~~~~~~~~~~~~~~~~
vim +2017 drivers/platform/x86/asus-wmi.c
1966
1967 static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus)
1968 {
1969 int orig_code;
1970 unsigned int key_value = 1;
1971 bool autorelease = 1;
1972
1973 orig_code = code;
1974
1975 if (asus->driver->key_filter) {
1976 asus->driver->key_filter(asus->driver, &code, &key_value,
1977 &autorelease);
1978 if (code == ASUS_WMI_KEY_IGNORE)
1979 return;
1980 }
1981
1982 if (code >= NOTIFY_BRNUP_MIN && code <= NOTIFY_BRNUP_MAX)
1983 code = ASUS_WMI_BRN_UP;
1984 else if (code >= NOTIFY_BRNDOWN_MIN && code <= NOTIFY_BRNDOWN_MAX)
1985 code = ASUS_WMI_BRN_DOWN;
1986
1987 if (code == ASUS_WMI_BRN_DOWN || code == ASUS_WMI_BRN_UP) {
1988 if (acpi_video_get_backlight_type() == acpi_backlight_vendor) {
1989 asus_wmi_backlight_notify(asus, orig_code);
1990 return;
1991 }
1992 }
1993
1994 if (code == NOTIFY_KBD_BRTUP) {
1995 kbd_led_set_by_kbd(asus, asus->kbd_led_wk + 1);
1996 return;
1997 }
1998 if (code == NOTIFY_KBD_BRTDWN) {
1999 kbd_led_set_by_kbd(asus, asus->kbd_led_wk - 1);
2000 return;
2001 }
2002 if (code == NOTIFY_KBD_BRTTOGGLE) {
2003 if (asus->kbd_led_wk == asus->kbd_led.max_brightness)
2004 kbd_led_set_by_kbd(asus, 0);
2005 else
2006 kbd_led_set_by_kbd(asus, asus->kbd_led_wk + 1);
2007 return;
2008 }
2009
2010 if (code == NOTIFY_FNLOCK_TOGGLE) {
2011 asus->fnlock_locked = !asus->fnlock_locked;
2012 asus_wmi_fnlock_update(asus);
2013 return;
2014 }
2015
2016 if (asus->fan_boost_mode_available &&
> 2017 (code == NOTIFY_KBD_FBM || code == NOTIFY_KBD_FBM_2) {
2018 fan_boost_mode_switch_next(asus);
2019 return;
2020 }
2021
2022 if (is_display_toggle(code) && asus->driver->quirks->no_display_toggle)
2023 return;
2024
2025 if (!sparse_keymap_report_event(asus->inputdev, code,
2026 key_value, autorelease))
2027 pr_info("Unknown key %x pressed\n", code);
> 2028 }
2029
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 43775 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 2/3] platform/x86: asus_wmi: Support fan boost mode on FX505DY/FX705DY
@ 2019-11-05 0:00 ` kbuild test robot
0 siblings, 0 replies; 13+ messages in thread
From: kbuild test robot @ 2019-11-05 0:00 UTC (permalink / raw)
Cc: kbuild-all, linux-kernel, platform-driver-x86, acpi4asus-user,
chiu, yurii.pavlovskyi, kristian, andy, dvhart, corentin.chary,
Leonid Maksymchuk
[-- Attachment #1: Type: text/plain, Size: 4011 bytes --]
Hi Leonid,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v5.4-rc6 next-20191031]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Leonid-Maksymchuk/asus_wmi-Support-of-ASUS-TUF-laptops-on-Ryzen-CPUs/20191105-054154
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git a99d8080aaf358d5d23581244e5da23b35e340b9
config: x86_64-rhel (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/platform/x86/asus-wmi.c: In function 'asus_wmi_handle_event_code':
>> drivers/platform/x86/asus-wmi.c:2017:57: error: expected ')' before '{' token
(code == NOTIFY_KBD_FBM || code == NOTIFY_KBD_FBM_2) {
^
>> drivers/platform/x86/asus-wmi.c:2028:1: error: expected expression before '}' token
}
^
At top level:
drivers/platform/x86/asus-wmi.c:1909:12: warning: 'is_display_toggle' defined but not used [-Wunused-function]
static int is_display_toggle(int code)
^~~~~~~~~~~~~~~~~
drivers/platform/x86/asus-wmi.c:1677:12: warning: 'fan_boost_mode_switch_next' defined but not used [-Wunused-function]
static int fan_boost_mode_switch_next(struct asus_wmi *asus)
^~~~~~~~~~~~~~~~~~~~~~~~~~
vim +2017 drivers/platform/x86/asus-wmi.c
1966
1967 static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus)
1968 {
1969 int orig_code;
1970 unsigned int key_value = 1;
1971 bool autorelease = 1;
1972
1973 orig_code = code;
1974
1975 if (asus->driver->key_filter) {
1976 asus->driver->key_filter(asus->driver, &code, &key_value,
1977 &autorelease);
1978 if (code == ASUS_WMI_KEY_IGNORE)
1979 return;
1980 }
1981
1982 if (code >= NOTIFY_BRNUP_MIN && code <= NOTIFY_BRNUP_MAX)
1983 code = ASUS_WMI_BRN_UP;
1984 else if (code >= NOTIFY_BRNDOWN_MIN && code <= NOTIFY_BRNDOWN_MAX)
1985 code = ASUS_WMI_BRN_DOWN;
1986
1987 if (code == ASUS_WMI_BRN_DOWN || code == ASUS_WMI_BRN_UP) {
1988 if (acpi_video_get_backlight_type() == acpi_backlight_vendor) {
1989 asus_wmi_backlight_notify(asus, orig_code);
1990 return;
1991 }
1992 }
1993
1994 if (code == NOTIFY_KBD_BRTUP) {
1995 kbd_led_set_by_kbd(asus, asus->kbd_led_wk + 1);
1996 return;
1997 }
1998 if (code == NOTIFY_KBD_BRTDWN) {
1999 kbd_led_set_by_kbd(asus, asus->kbd_led_wk - 1);
2000 return;
2001 }
2002 if (code == NOTIFY_KBD_BRTTOGGLE) {
2003 if (asus->kbd_led_wk == asus->kbd_led.max_brightness)
2004 kbd_led_set_by_kbd(asus, 0);
2005 else
2006 kbd_led_set_by_kbd(asus, asus->kbd_led_wk + 1);
2007 return;
2008 }
2009
2010 if (code == NOTIFY_FNLOCK_TOGGLE) {
2011 asus->fnlock_locked = !asus->fnlock_locked;
2012 asus_wmi_fnlock_update(asus);
2013 return;
2014 }
2015
2016 if (asus->fan_boost_mode_available &&
> 2017 (code == NOTIFY_KBD_FBM || code == NOTIFY_KBD_FBM_2) {
2018 fan_boost_mode_switch_next(asus);
2019 return;
2020 }
2021
2022 if (is_display_toggle(code) && asus->driver->quirks->no_display_toggle)
2023 return;
2024
2025 if (!sparse_keymap_report_event(asus->inputdev, code,
2026 key_value, autorelease))
2027 pr_info("Unknown key %x pressed\n", code);
> 2028 }
2029
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 43775 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 2/3] platform/x86: asus_wmi: Support fan boost mode on FX505DY/FX705DY
@ 2019-11-05 0:00 ` kbuild test robot
0 siblings, 0 replies; 13+ messages in thread
From: kbuild test robot @ 2019-11-05 0:00 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 4119 bytes --]
Hi Leonid,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v5.4-rc6 next-20191031]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Leonid-Maksymchuk/asus_wmi-Support-of-ASUS-TUF-laptops-on-Ryzen-CPUs/20191105-054154
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git a99d8080aaf358d5d23581244e5da23b35e340b9
config: x86_64-rhel (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/platform/x86/asus-wmi.c: In function 'asus_wmi_handle_event_code':
>> drivers/platform/x86/asus-wmi.c:2017:57: error: expected ')' before '{' token
(code == NOTIFY_KBD_FBM || code == NOTIFY_KBD_FBM_2) {
^
>> drivers/platform/x86/asus-wmi.c:2028:1: error: expected expression before '}' token
}
^
At top level:
drivers/platform/x86/asus-wmi.c:1909:12: warning: 'is_display_toggle' defined but not used [-Wunused-function]
static int is_display_toggle(int code)
^~~~~~~~~~~~~~~~~
drivers/platform/x86/asus-wmi.c:1677:12: warning: 'fan_boost_mode_switch_next' defined but not used [-Wunused-function]
static int fan_boost_mode_switch_next(struct asus_wmi *asus)
^~~~~~~~~~~~~~~~~~~~~~~~~~
vim +2017 drivers/platform/x86/asus-wmi.c
1966
1967 static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus)
1968 {
1969 int orig_code;
1970 unsigned int key_value = 1;
1971 bool autorelease = 1;
1972
1973 orig_code = code;
1974
1975 if (asus->driver->key_filter) {
1976 asus->driver->key_filter(asus->driver, &code, &key_value,
1977 &autorelease);
1978 if (code == ASUS_WMI_KEY_IGNORE)
1979 return;
1980 }
1981
1982 if (code >= NOTIFY_BRNUP_MIN && code <= NOTIFY_BRNUP_MAX)
1983 code = ASUS_WMI_BRN_UP;
1984 else if (code >= NOTIFY_BRNDOWN_MIN && code <= NOTIFY_BRNDOWN_MAX)
1985 code = ASUS_WMI_BRN_DOWN;
1986
1987 if (code == ASUS_WMI_BRN_DOWN || code == ASUS_WMI_BRN_UP) {
1988 if (acpi_video_get_backlight_type() == acpi_backlight_vendor) {
1989 asus_wmi_backlight_notify(asus, orig_code);
1990 return;
1991 }
1992 }
1993
1994 if (code == NOTIFY_KBD_BRTUP) {
1995 kbd_led_set_by_kbd(asus, asus->kbd_led_wk + 1);
1996 return;
1997 }
1998 if (code == NOTIFY_KBD_BRTDWN) {
1999 kbd_led_set_by_kbd(asus, asus->kbd_led_wk - 1);
2000 return;
2001 }
2002 if (code == NOTIFY_KBD_BRTTOGGLE) {
2003 if (asus->kbd_led_wk == asus->kbd_led.max_brightness)
2004 kbd_led_set_by_kbd(asus, 0);
2005 else
2006 kbd_led_set_by_kbd(asus, asus->kbd_led_wk + 1);
2007 return;
2008 }
2009
2010 if (code == NOTIFY_FNLOCK_TOGGLE) {
2011 asus->fnlock_locked = !asus->fnlock_locked;
2012 asus_wmi_fnlock_update(asus);
2013 return;
2014 }
2015
2016 if (asus->fan_boost_mode_available &&
> 2017 (code == NOTIFY_KBD_FBM || code == NOTIFY_KBD_FBM_2) {
2018 fan_boost_mode_switch_next(asus);
2019 return;
2020 }
2021
2022 if (is_display_toggle(code) && asus->driver->quirks->no_display_toggle)
2023 return;
2024
2025 if (!sparse_keymap_report_event(asus->inputdev, code,
2026 key_value, autorelease))
2027 pr_info("Unknown key %x pressed\n", code);
> 2028 }
2029
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 43775 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 3/3] platform/x86: asus_wmi: Set default fan boost mode to normal
2019-11-04 21:39 ` [PATCH v2 3/3] platform/x86: asus_wmi: Set default fan boost mode to normal Leonid Maksymchuk
@ 2019-11-06 7:03 ` Andy Shevchenko
0 siblings, 0 replies; 13+ messages in thread
From: Andy Shevchenko @ 2019-11-06 7:03 UTC (permalink / raw)
To: Leonid Maksymchuk
Cc: Linux Kernel Mailing List, Platform Driver, acpi4asus-user,
Chris Chiu, Yurii Pavlovskyi, Kristian Klausen, Andy Shevchenko,
Darren Hart, Corentin Chary
On Mon, Nov 4, 2019 at 11:39 PM Leonid Maksymchuk <leonmaxx@gmail.com> wrote:
>
> Set default fan boost mode to normal for multiple reasons:
>
> 1) existing code assumes that laptop started in normal mode and that is
> not always correct.
> 2) FX705DY/FX505DY starts in silent mode and under heavy CPU load it
> overheats and drops CPU frequency to 399MHz [1]. Setting fan mode to
> normal avoids overheating.
>
> [1] Link: https://bugzilla.kernel.org/show_bug.cgi?id=203733
>
> Signed-off-by: Leonid Maksymchuk <leonmaxx@gmail.com>
> +static int fan_boost_mode_set_default(struct asus_wmi *asus)
> +{
> + int result = 0;
> +
> + if (asus->fan_boost_mode_available) {
> + asus->fan_boost_mode = ASUS_FAN_BOOST_MODE_NORMAL;
> + result = fan_boost_mode_write(asus);
> + }
> +
> + return result;
> +}
This can be refactored
if (!foo)
return 0;
...
return bar(asus);
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 2/3] platform/x86: asus_wmi: Support fan boost mode on FX505DY/FX705DY
2019-11-05 0:00 ` kbuild test robot
@ 2019-11-06 7:04 ` Andy Shevchenko
-1 siblings, 0 replies; 13+ messages in thread
From: Andy Shevchenko @ 2019-11-06 7:04 UTC (permalink / raw)
To: kbuild test robot
Cc: Leonid Maksymchuk, kbuild-all, Linux Kernel Mailing List,
Platform Driver, acpi4asus-user, Chris Chiu, Yurii Pavlovskyi,
Kristian Klausen, Andy Shevchenko, Darren Hart, Corentin Chary
On Tue, Nov 5, 2019 at 2:01 AM kbuild test robot <lkp@intel.com> wrote:
>
> Hi Leonid,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on linus/master]
> [also build test ERROR on v5.4-rc6 next-20191031]
Leonid, I may not accept patches that contributor didn't even compile.
How had you tested?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 2/3] platform/x86: asus_wmi: Support fan boost mode on FX505DY/FX705DY
@ 2019-11-06 7:04 ` Andy Shevchenko
0 siblings, 0 replies; 13+ messages in thread
From: Andy Shevchenko @ 2019-11-06 7:04 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 383 bytes --]
On Tue, Nov 5, 2019 at 2:01 AM kbuild test robot <lkp@intel.com> wrote:
>
> Hi Leonid,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on linus/master]
> [also build test ERROR on v5.4-rc6 next-20191031]
Leonid, I may not accept patches that contributor didn't even compile.
How had you tested?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 0/3] asus_wmi: Support of ASUS TUF laptops on Ryzen CPUs
2019-11-04 21:34 [PATCH v2 0/3] asus_wmi: Support of ASUS TUF laptops on Ryzen CPUs Leonid Maksymchuk
` (2 preceding siblings ...)
2019-11-04 21:39 ` [PATCH v2 3/3] platform/x86: asus_wmi: Set default fan boost mode to normal Leonid Maksymchuk
@ 2019-11-06 7:21 ` Andy Shevchenko
3 siblings, 0 replies; 13+ messages in thread
From: Andy Shevchenko @ 2019-11-06 7:21 UTC (permalink / raw)
To: Leonid Maksymchuk
Cc: Linux Kernel Mailing List, Platform Driver, acpi4asus-user,
Chris Chiu, Yurii Pavlovskyi, Kristian Klausen, Andy Shevchenko,
Darren Hart, Corentin Chary
On Mon, Nov 4, 2019 at 11:34 PM Leonid Maksymchuk <leonmaxx@gmail.com> wrote:
>
> Hi,
>
> this patch series adds support of ASUS TUF laptops on Ryzen CPUs to existing
> asus_wmi platform driver and also fixes minor bug.
>
> v2: fixed indentation.
Usual versioning
RFC [RFC v2, ...]
v1
v2, ...
Okay, next one will be v3 to avoid overlapping.
I'll take first patch later, but I also will give more comments to patch 2.
Please, give me time to review it properly.
>
> Leonid Maksymchuk (3):
> asus_wmi: Fix return value of fan_boost_mode_store
> asus_wmi: Add support for fan boost mode on FX505DY/FX705DY
> asus_wmi: Set default fan boost mode to normal
>
> drivers/platform/x86/asus-wmi.c | 57 ++++++++++++++++++++++--------
> include/linux/platform_data/x86/asus-wmi.h | 1 +
> 2 files changed, 43 insertions(+), 15 deletions(-)
>
> --
> 1.8.3.1
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 2/3] platform/x86: asus_wmi: Support fan boost mode on FX505DY/FX705DY
2019-11-04 21:38 ` [PATCH v2 2/3] platform/x86: asus_wmi: Support fan boost mode on FX505DY/FX705DY Leonid Maksymchuk
2019-11-05 0:00 ` kbuild test robot
@ 2019-11-07 17:15 ` Andy Shevchenko
2019-11-07 18:31 ` Leonid Maksymchuk
1 sibling, 1 reply; 13+ messages in thread
From: Andy Shevchenko @ 2019-11-07 17:15 UTC (permalink / raw)
To: Leonid Maksymchuk
Cc: Linux Kernel Mailing List, Platform Driver, acpi4asus-user,
Chris Chiu, Yurii Pavlovskyi, Kristian Klausen, Andy Shevchenko,
Darren Hart, Corentin Chary
On Mon, Nov 4, 2019 at 11:38 PM Leonid Maksymchuk <leonmaxx@gmail.com> wrote:
> On ASUS FX505DY/FX705DY laptops fan boost mode is same as in other
> TUF laptop models but have different ACPI device ID and different key
> code.
> + if (err == 0 &&
> + (result & ASUS_WMI_DSTS_PRESENCE_BIT) &&
> + (result & ASUS_FAN_BOOST_MODES_MASK)) {
> + asus->fan_boost_mode_available = 1;
> + asus->fan_boost_mode_mask = result & ASUS_FAN_BOOST_MODES_MASK;
> + return 0;
> }
>
> - if ((result & ASUS_WMI_DSTS_PRESENCE_BIT) &&
> + err = asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_FAN_BOOST_MODE_2,
> + &result);
> +
> + if (err == 0 &&
> + (result & ASUS_WMI_DSTS_PRESENCE_BIT) &&
> (result & ASUS_FAN_BOOST_MODES_MASK)) {
> - asus->fan_boost_mode_available = true;
> + asus->fan_boost_mode_available = 2;
> asus->fan_boost_mode_mask = result & ASUS_FAN_BOOST_MODES_MASK;
> }
The above differs only in one value to give and one value to set, I
suppose you may introduce an additional helper to it
> + if (err == -ENODEV)
> + return 0;
This should be explained or even separated to another patch. It
changes behaviour of the original code, why?
> + u32 dev_id = asus->fan_boost_mode_available == 1 ?
> + ASUS_WMI_DEVID_FAN_BOOST_MODE :
> + ASUS_WMI_DEVID_FAN_BOOST_MODE_2;
I would prefer to see
if (...)
call with mode
else
call with mode_2
below.
> - err = asus_wmi_set_devstate(ASUS_WMI_DEVID_FAN_BOOST_MODE, value,
> - &retval);
> + err = asus_wmi_set_devstate(dev_id, value, &retval);
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 2/3] platform/x86: asus_wmi: Support fan boost mode on FX505DY/FX705DY
2019-11-07 17:15 ` Andy Shevchenko
@ 2019-11-07 18:31 ` Leonid Maksymchuk
0 siblings, 0 replies; 13+ messages in thread
From: Leonid Maksymchuk @ 2019-11-07 18:31 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Linux Kernel Mailing List, Platform Driver, acpi4asus-user,
Chris Chiu, Yurii Pavlovskyi, Kristian Klausen, Andy Shevchenko,
Darren Hart, Corentin Chary
Thanks for review, I will do suggested changes.
> > + if (err == 0 &&
> > + (result & ASUS_WMI_DSTS_PRESENCE_BIT) &&
> > + (result & ASUS_FAN_BOOST_MODES_MASK)) {
> > + asus->fan_boost_mode_available = 1;
> > + asus->fan_boost_mode_mask = result & ASUS_FAN_BOOST_MODES_MASK;
> > + return 0;
> > }
> >
> > - if ((result & ASUS_WMI_DSTS_PRESENCE_BIT) &&
> > + err = asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_FAN_BOOST_MODE_2,
> > + &result);
> > +
> > + if (err == 0 &&
> > + (result & ASUS_WMI_DSTS_PRESENCE_BIT) &&
> > (result & ASUS_FAN_BOOST_MODES_MASK)) {
> > - asus->fan_boost_mode_available = true;
> > + asus->fan_boost_mode_available = 2;
> > asus->fan_boost_mode_mask = result & ASUS_FAN_BOOST_MODES_MASK;
> > }
>
> The above differs only in one value to give and one value to set, I
> suppose you may introduce an additional helper to it
Maybe it's better to add additional argument with index to
fan_boost_mode_check_present and
call it twice?
> > + if (err == -ENODEV)
> > + return 0;
>
> This should be explained or even separated to another patch. It
> changes behaviour of the original code, why?
>
Original code also have this check to continue module initialization
when fan_boost_mode device
is not present. It's return value is checked in asus_wmi_add()
function and it'll fail module probing.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2019-11-07 18:31 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-04 21:34 [PATCH v2 0/3] asus_wmi: Support of ASUS TUF laptops on Ryzen CPUs Leonid Maksymchuk
2019-11-04 21:37 ` [PATCH v2 1/3] platform/x86: asus_wmi: Fix return value of fan_boost_mode_store Leonid Maksymchuk
2019-11-04 21:38 ` [PATCH v2 2/3] platform/x86: asus_wmi: Support fan boost mode on FX505DY/FX705DY Leonid Maksymchuk
2019-11-05 0:00 ` kbuild test robot
2019-11-05 0:00 ` kbuild test robot
2019-11-05 0:00 ` kbuild test robot
2019-11-06 7:04 ` Andy Shevchenko
2019-11-06 7:04 ` Andy Shevchenko
2019-11-07 17:15 ` Andy Shevchenko
2019-11-07 18:31 ` Leonid Maksymchuk
2019-11-04 21:39 ` [PATCH v2 3/3] platform/x86: asus_wmi: Set default fan boost mode to normal Leonid Maksymchuk
2019-11-06 7:03 ` Andy Shevchenko
2019-11-06 7:21 ` [PATCH v2 0/3] asus_wmi: Support of ASUS TUF laptops on Ryzen CPUs Andy Shevchenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.