* [PATCH] HID: i2c-hid: Enable touchpad wakeup from Suspend-to-Idle
@ 2020-05-18 9:35 Kai-Heng Feng
2020-05-18 11:28 ` kbuild test robot
0 siblings, 1 reply; 3+ messages in thread
From: Kai-Heng Feng @ 2020-05-18 9:35 UTC (permalink / raw)
To: jikos, benjamin.tissoires
Cc: Kai-Heng Feng, Hans de Goede, Aaron Ma, HungNien Chen,
Pavel Balan, Daniel Playfair Cal, You-Sheng Yang,
open list:HID CORE LAYER, open list
Many laptops have the ability to be woken up from Suspend-to-Idle by
touchpad. This is also the default behavior on other OSes.
So let's enable the wakeup support if the system defaults to use
Suspend-to-Idle.
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
drivers/hid/i2c-hid/i2c-hid-core.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c
index 294c84e136d7..cac82971a668 100644
--- a/drivers/hid/i2c-hid/i2c-hid-core.c
+++ b/drivers/hid/i2c-hid/i2c-hid-core.c
@@ -1072,6 +1072,11 @@ static int i2c_hid_probe(struct i2c_client *client,
i2c_hid_acpi_fix_up_power(&client->dev);
+ if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
+ device_set_wakeup_capable(&client->dev, true);
+ device_wakeup_enable(&client->dev);
+ }
+
device_enable_async_suspend(&client->dev);
/* Make sure there is something at this address */
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] HID: i2c-hid: Enable touchpad wakeup from Suspend-to-Idle
2020-05-18 9:35 [PATCH] HID: i2c-hid: Enable touchpad wakeup from Suspend-to-Idle Kai-Heng Feng
@ 2020-05-18 11:28 ` kbuild test robot
0 siblings, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2020-05-18 11:28 UTC (permalink / raw)
To: Kai-Heng Feng, jikos, benjamin.tissoires
Cc: kbuild-all, Kai-Heng Feng, Hans de Goede, Aaron Ma,
HungNien Chen, Pavel Balan, Daniel Playfair Cal, You-Sheng Yang,
open list:HID CORE LAYER, open list
[-- Attachment #1: Type: text/plain, Size: 7397 bytes --]
Hi Kai-Heng,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v5.7-rc6 next-20200515]
[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/Kai-Heng-Feng/HID-i2c-hid-Enable-touchpad-wakeup-from-Suspend-to-Idle/20200518-173725
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b9bbe6ed63b2b9f2c9ee5cbd0f2c946a2723f4ce
config: parisc-randconfig-r031-20200518 (attached as .config)
compiler: hppa64-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
All error/warnings (new ones prefixed by >>, old ones prefixed by <<):
In file included from include/linux/kernel.h:11,
from include/linux/list.h:9,
from include/linux/module.h:12,
from drivers/hid/i2c-hid/i2c-hid-core.c:21:
drivers/hid/i2c-hid/i2c-hid-core.c: In function 'i2c_hid_probe':
>> drivers/hid/i2c-hid/i2c-hid-core.c:1075:6: error: 'acpi_gbl_FADT' undeclared (first use in this function)
1075 | if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
| ^~~~~~~~~~~~~
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
>> drivers/hid/i2c-hid/i2c-hid-core.c:1075:2: note: in expansion of macro 'if'
1075 | if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
| ^~
drivers/hid/i2c-hid/i2c-hid-core.c:1075:6: note: each undeclared identifier is reported only once for each function it appears in
1075 | if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
| ^~~~~~~~~~~~~
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
>> drivers/hid/i2c-hid/i2c-hid-core.c:1075:2: note: in expansion of macro 'if'
1075 | if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
| ^~
vim +/acpi_gbl_FADT +1075 drivers/hid/i2c-hid/i2c-hid-core.c
995
996 static int i2c_hid_probe(struct i2c_client *client,
997 const struct i2c_device_id *dev_id)
998 {
999 int ret;
1000 struct i2c_hid *ihid;
1001 struct hid_device *hid;
1002 __u16 hidRegister;
1003 struct i2c_hid_platform_data *platform_data = client->dev.platform_data;
1004
1005 dbg_hid("HID probe called for i2c 0x%02x\n", client->addr);
1006
1007 if (!client->irq) {
1008 dev_err(&client->dev,
1009 "HID over i2c has not been provided an Int IRQ\n");
1010 return -EINVAL;
1011 }
1012
1013 if (client->irq < 0) {
1014 if (client->irq != -EPROBE_DEFER)
1015 dev_err(&client->dev,
1016 "HID over i2c doesn't have a valid IRQ\n");
1017 return client->irq;
1018 }
1019
1020 ihid = devm_kzalloc(&client->dev, sizeof(*ihid), GFP_KERNEL);
1021 if (!ihid)
1022 return -ENOMEM;
1023
1024 if (client->dev.of_node) {
1025 ret = i2c_hid_of_probe(client, &ihid->pdata);
1026 if (ret)
1027 return ret;
1028 } else if (!platform_data) {
1029 ret = i2c_hid_acpi_pdata(client, &ihid->pdata);
1030 if (ret)
1031 return ret;
1032 } else {
1033 ihid->pdata = *platform_data;
1034 }
1035
1036 /* Parse platform agnostic common properties from ACPI / device tree */
1037 i2c_hid_fwnode_probe(client, &ihid->pdata);
1038
1039 ihid->pdata.supplies[0].supply = "vdd";
1040 ihid->pdata.supplies[1].supply = "vddl";
1041
1042 ret = devm_regulator_bulk_get(&client->dev,
1043 ARRAY_SIZE(ihid->pdata.supplies),
1044 ihid->pdata.supplies);
1045 if (ret)
1046 return ret;
1047
1048 ret = regulator_bulk_enable(ARRAY_SIZE(ihid->pdata.supplies),
1049 ihid->pdata.supplies);
1050 if (ret < 0)
1051 return ret;
1052
1053 if (ihid->pdata.post_power_delay_ms)
1054 msleep(ihid->pdata.post_power_delay_ms);
1055
1056 i2c_set_clientdata(client, ihid);
1057
1058 ihid->client = client;
1059
1060 hidRegister = ihid->pdata.hid_descriptor_address;
1061 ihid->wHIDDescRegister = cpu_to_le16(hidRegister);
1062
1063 init_waitqueue_head(&ihid->wait);
1064 mutex_init(&ihid->reset_lock);
1065
1066 /* we need to allocate the command buffer without knowing the maximum
1067 * size of the reports. Let's use HID_MIN_BUFFER_SIZE, then we do the
1068 * real computation later. */
1069 ret = i2c_hid_alloc_buffers(ihid, HID_MIN_BUFFER_SIZE);
1070 if (ret < 0)
1071 goto err_regulator;
1072
1073 i2c_hid_acpi_fix_up_power(&client->dev);
1074
> 1075 if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
1076 device_set_wakeup_capable(&client->dev, true);
1077 device_wakeup_enable(&client->dev);
1078 }
1079
1080 device_enable_async_suspend(&client->dev);
1081
1082 /* Make sure there is something at this address */
1083 ret = i2c_smbus_read_byte(client);
1084 if (ret < 0) {
1085 dev_dbg(&client->dev, "nothing at this address: %d\n", ret);
1086 ret = -ENXIO;
1087 goto err_regulator;
1088 }
1089
1090 ret = i2c_hid_fetch_hid_descriptor(ihid);
1091 if (ret < 0)
1092 goto err_regulator;
1093
1094 ret = i2c_hid_init_irq(client);
1095 if (ret < 0)
1096 goto err_regulator;
1097
1098 hid = hid_allocate_device();
1099 if (IS_ERR(hid)) {
1100 ret = PTR_ERR(hid);
1101 goto err_irq;
1102 }
1103
1104 ihid->hid = hid;
1105
1106 hid->driver_data = client;
1107 hid->ll_driver = &i2c_hid_ll_driver;
1108 hid->dev.parent = &client->dev;
1109 hid->bus = BUS_I2C;
1110 hid->version = le16_to_cpu(ihid->hdesc.bcdVersion);
1111 hid->vendor = le16_to_cpu(ihid->hdesc.wVendorID);
1112 hid->product = le16_to_cpu(ihid->hdesc.wProductID);
1113
1114 snprintf(hid->name, sizeof(hid->name), "%s %04hX:%04hX",
1115 client->name, hid->vendor, hid->product);
1116 strlcpy(hid->phys, dev_name(&client->dev), sizeof(hid->phys));
1117
1118 ihid->quirks = i2c_hid_lookup_quirk(hid->vendor, hid->product);
1119
1120 ret = hid_add_device(hid);
1121 if (ret) {
1122 if (ret != -ENODEV)
1123 hid_err(client, "can't add hid device: %d\n", ret);
1124 goto err_mem_free;
1125 }
1126
1127 return 0;
1128
1129 err_mem_free:
1130 hid_destroy_device(hid);
1131
1132 err_irq:
1133 free_irq(client->irq, ihid);
1134
1135 err_regulator:
1136 regulator_bulk_disable(ARRAY_SIZE(ihid->pdata.supplies),
1137 ihid->pdata.supplies);
1138 i2c_hid_free_buffers(ihid);
1139 return ret;
1140 }
1141
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33225 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] HID: i2c-hid: Enable touchpad wakeup from Suspend-to-Idle
@ 2020-05-18 11:28 ` kbuild test robot
0 siblings, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2020-05-18 11:28 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 7601 bytes --]
Hi Kai-Heng,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v5.7-rc6 next-20200515]
[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/Kai-Heng-Feng/HID-i2c-hid-Enable-touchpad-wakeup-from-Suspend-to-Idle/20200518-173725
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b9bbe6ed63b2b9f2c9ee5cbd0f2c946a2723f4ce
config: parisc-randconfig-r031-20200518 (attached as .config)
compiler: hppa64-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
All error/warnings (new ones prefixed by >>, old ones prefixed by <<):
In file included from include/linux/kernel.h:11,
from include/linux/list.h:9,
from include/linux/module.h:12,
from drivers/hid/i2c-hid/i2c-hid-core.c:21:
drivers/hid/i2c-hid/i2c-hid-core.c: In function 'i2c_hid_probe':
>> drivers/hid/i2c-hid/i2c-hid-core.c:1075:6: error: 'acpi_gbl_FADT' undeclared (first use in this function)
1075 | if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
| ^~~~~~~~~~~~~
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
>> drivers/hid/i2c-hid/i2c-hid-core.c:1075:2: note: in expansion of macro 'if'
1075 | if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
| ^~
drivers/hid/i2c-hid/i2c-hid-core.c:1075:6: note: each undeclared identifier is reported only once for each function it appears in
1075 | if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
| ^~~~~~~~~~~~~
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
>> drivers/hid/i2c-hid/i2c-hid-core.c:1075:2: note: in expansion of macro 'if'
1075 | if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
| ^~
vim +/acpi_gbl_FADT +1075 drivers/hid/i2c-hid/i2c-hid-core.c
995
996 static int i2c_hid_probe(struct i2c_client *client,
997 const struct i2c_device_id *dev_id)
998 {
999 int ret;
1000 struct i2c_hid *ihid;
1001 struct hid_device *hid;
1002 __u16 hidRegister;
1003 struct i2c_hid_platform_data *platform_data = client->dev.platform_data;
1004
1005 dbg_hid("HID probe called for i2c 0x%02x\n", client->addr);
1006
1007 if (!client->irq) {
1008 dev_err(&client->dev,
1009 "HID over i2c has not been provided an Int IRQ\n");
1010 return -EINVAL;
1011 }
1012
1013 if (client->irq < 0) {
1014 if (client->irq != -EPROBE_DEFER)
1015 dev_err(&client->dev,
1016 "HID over i2c doesn't have a valid IRQ\n");
1017 return client->irq;
1018 }
1019
1020 ihid = devm_kzalloc(&client->dev, sizeof(*ihid), GFP_KERNEL);
1021 if (!ihid)
1022 return -ENOMEM;
1023
1024 if (client->dev.of_node) {
1025 ret = i2c_hid_of_probe(client, &ihid->pdata);
1026 if (ret)
1027 return ret;
1028 } else if (!platform_data) {
1029 ret = i2c_hid_acpi_pdata(client, &ihid->pdata);
1030 if (ret)
1031 return ret;
1032 } else {
1033 ihid->pdata = *platform_data;
1034 }
1035
1036 /* Parse platform agnostic common properties from ACPI / device tree */
1037 i2c_hid_fwnode_probe(client, &ihid->pdata);
1038
1039 ihid->pdata.supplies[0].supply = "vdd";
1040 ihid->pdata.supplies[1].supply = "vddl";
1041
1042 ret = devm_regulator_bulk_get(&client->dev,
1043 ARRAY_SIZE(ihid->pdata.supplies),
1044 ihid->pdata.supplies);
1045 if (ret)
1046 return ret;
1047
1048 ret = regulator_bulk_enable(ARRAY_SIZE(ihid->pdata.supplies),
1049 ihid->pdata.supplies);
1050 if (ret < 0)
1051 return ret;
1052
1053 if (ihid->pdata.post_power_delay_ms)
1054 msleep(ihid->pdata.post_power_delay_ms);
1055
1056 i2c_set_clientdata(client, ihid);
1057
1058 ihid->client = client;
1059
1060 hidRegister = ihid->pdata.hid_descriptor_address;
1061 ihid->wHIDDescRegister = cpu_to_le16(hidRegister);
1062
1063 init_waitqueue_head(&ihid->wait);
1064 mutex_init(&ihid->reset_lock);
1065
1066 /* we need to allocate the command buffer without knowing the maximum
1067 * size of the reports. Let's use HID_MIN_BUFFER_SIZE, then we do the
1068 * real computation later. */
1069 ret = i2c_hid_alloc_buffers(ihid, HID_MIN_BUFFER_SIZE);
1070 if (ret < 0)
1071 goto err_regulator;
1072
1073 i2c_hid_acpi_fix_up_power(&client->dev);
1074
> 1075 if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
1076 device_set_wakeup_capable(&client->dev, true);
1077 device_wakeup_enable(&client->dev);
1078 }
1079
1080 device_enable_async_suspend(&client->dev);
1081
1082 /* Make sure there is something at this address */
1083 ret = i2c_smbus_read_byte(client);
1084 if (ret < 0) {
1085 dev_dbg(&client->dev, "nothing at this address: %d\n", ret);
1086 ret = -ENXIO;
1087 goto err_regulator;
1088 }
1089
1090 ret = i2c_hid_fetch_hid_descriptor(ihid);
1091 if (ret < 0)
1092 goto err_regulator;
1093
1094 ret = i2c_hid_init_irq(client);
1095 if (ret < 0)
1096 goto err_regulator;
1097
1098 hid = hid_allocate_device();
1099 if (IS_ERR(hid)) {
1100 ret = PTR_ERR(hid);
1101 goto err_irq;
1102 }
1103
1104 ihid->hid = hid;
1105
1106 hid->driver_data = client;
1107 hid->ll_driver = &i2c_hid_ll_driver;
1108 hid->dev.parent = &client->dev;
1109 hid->bus = BUS_I2C;
1110 hid->version = le16_to_cpu(ihid->hdesc.bcdVersion);
1111 hid->vendor = le16_to_cpu(ihid->hdesc.wVendorID);
1112 hid->product = le16_to_cpu(ihid->hdesc.wProductID);
1113
1114 snprintf(hid->name, sizeof(hid->name), "%s %04hX:%04hX",
1115 client->name, hid->vendor, hid->product);
1116 strlcpy(hid->phys, dev_name(&client->dev), sizeof(hid->phys));
1117
1118 ihid->quirks = i2c_hid_lookup_quirk(hid->vendor, hid->product);
1119
1120 ret = hid_add_device(hid);
1121 if (ret) {
1122 if (ret != -ENODEV)
1123 hid_err(client, "can't add hid device: %d\n", ret);
1124 goto err_mem_free;
1125 }
1126
1127 return 0;
1128
1129 err_mem_free:
1130 hid_destroy_device(hid);
1131
1132 err_irq:
1133 free_irq(client->irq, ihid);
1134
1135 err_regulator:
1136 regulator_bulk_disable(ARRAY_SIZE(ihid->pdata.supplies),
1137 ihid->pdata.supplies);
1138 i2c_hid_free_buffers(ihid);
1139 return ret;
1140 }
1141
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 33225 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-18 11:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-18 9:35 [PATCH] HID: i2c-hid: Enable touchpad wakeup from Suspend-to-Idle Kai-Heng Feng
2020-05-18 11:28 ` kbuild test robot
2020-05-18 11:28 ` kbuild test robot
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.