diff mbox series

[D/OEM-OSP-1,4/5] Input: elan_i2c - export the device id whitelist

Message ID 20191120094425.24179-5-aaron.ma@canonical.com
State New
Headers show
Series [B/OEM-B,1/3] HID: quirks: Fix keyboard + touchpad on Lenovo Miix 630 | expand

Commit Message

Aaron Ma Nov. 20, 2019, 9:44 a.m. UTC
From: Jeffrey Hugo <jeffrey.l.hugo@gmail.com>

BugLink: https://bugs.launchpad.net/bugs/1853246

Elan_i2c and hid-quirks work in conjunction to decide which devices each
driver will handle.  Elan_i2c has a whitelist of devices that should be
consumed by hid-quirks so that there is one master list of devices to
handoff between the drivers.  Put the ids in a header file so that
hid-quirks can consume it instead of duplicating the list.

Signed-off-by: Jeffrey Hugo <jeffrey.l.hugo@gmail.com>
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
(backported from commit 0828c1001399d5c5fcab547ef7b0a29c78d4bdf6)
Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
---
 drivers/input/mouse/elan_i2c_core.c | 50 +------------------
 include/linux/input/elan-i2c-ids.h  | 76 +++++++++++++++++++++++++++++
 2 files changed, 77 insertions(+), 49 deletions(-)
 create mode 100644 include/linux/input/elan-i2c-ids.h

Comments

You-Sheng Yang Nov. 21, 2019, 5:52 a.m. UTC | #1
On 2019-11-20 17:44, Aaron Ma wrote:
> From: Jeffrey Hugo <jeffrey.l.hugo@gmail.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1853246
> 
> Elan_i2c and hid-quirks work in conjunction to decide which devices each
> driver will handle.  Elan_i2c has a whitelist of devices that should be
> consumed by hid-quirks so that there is one master list of devices to
> handoff between the drivers.  Put the ids in a header file so that
> hid-quirks can consume it instead of duplicating the list.
> 
> Signed-off-by: Jeffrey Hugo <jeffrey.l.hugo@gmail.com>
> Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> (backported from commit 0828c1001399d5c5fcab547ef7b0a29c78d4bdf6)
> Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
> ---
>  drivers/input/mouse/elan_i2c_core.c | 50 +------------------
>  include/linux/input/elan-i2c-ids.h  | 76 +++++++++++++++++++++++++++++
>  2 files changed, 77 insertions(+), 49 deletions(-)
>  create mode 100644 include/linux/input/elan-i2c-ids.h
> 
> diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
> index ae012639ae1d..4592c9c2d0aa 100644
> --- a/drivers/input/mouse/elan_i2c_core.c
> +++ b/drivers/input/mouse/elan_i2c_core.c
> @@ -37,6 +37,7 @@
>  #include <linux/completion.h>
>  #include <linux/of.h>
>  #include <linux/property.h>
> +#include <linux/input/elan-i2c-ids.h>
>  #include <linux/regulator/consumer.h>
>  #include <asm/unaligned.h>
>  
> @@ -1333,55 +1334,6 @@ static const struct i2c_device_id elan_id[] = {
>  MODULE_DEVICE_TABLE(i2c, elan_id);
>  
>  #ifdef CONFIG_ACPI
> -static const struct acpi_device_id elan_acpi_id[] = {
> -	{ "ELAN0000", 0 },
> -	{ "ELAN0100", 0 },
> -	{ "ELAN0600", 0 },
> -	{ "ELAN0601", 0 },
> -	{ "ELAN0602", 0 },
> -	{ "ELAN0603", 0 },
> -	{ "ELAN0604", 0 },
> -	{ "ELAN0605", 0 },
> -	{ "ELAN0606", 0 },
> -	{ "ELAN0607", 0 },
> -	{ "ELAN0608", 0 },
> -	{ "ELAN0609", 0 },
> -	{ "ELAN060B", 0 },
> -	{ "ELAN060C", 0 },
> -	{ "ELAN060F", 0 },
> -	{ "ELAN0610", 0 },
> -	{ "ELAN0611", 0 },
> -	{ "ELAN0612", 0 },
> -	{ "ELAN0615", 0 },
> -	{ "ELAN0616", 0 },
> -	{ "ELAN0617", 0 },
> -	{ "ELAN0618", 0 },
> -	{ "ELAN0619", 0 },
> -	{ "ELAN061A", 0 },
> -/*	{ "ELAN061B", 0 }, not working on the Lenovo Legion Y7000 */

ditto.

You-Sheng Yang

> -	{ "ELAN061C", 0 },
> -	{ "ELAN061D", 0 },
> -	{ "ELAN061E", 0 },
> -	{ "ELAN061F", 0 },
> -	{ "ELAN0620", 0 },
> -	{ "ELAN0621", 0 },
> -	{ "ELAN0622", 0 },
> -	{ "ELAN0623", 0 },
> -	{ "ELAN0624", 0 },
> -	{ "ELAN0625", 0 },
> -	{ "ELAN0626", 0 },
> -	{ "ELAN0627", 0 },
> -	{ "ELAN0628", 0 },
> -	{ "ELAN0629", 0 },
> -	{ "ELAN062A", 0 },
> -	{ "ELAN062B", 0 },
> -	{ "ELAN062C", 0 },
> -	{ "ELAN062D", 0 },
> -	{ "ELAN0631", 0 },
> -	{ "ELAN0632", 0 },
> -	{ "ELAN1000", 0 },
> -	{ }
> -};
>  MODULE_DEVICE_TABLE(acpi, elan_acpi_id);
>  #endif
>  
> diff --git a/include/linux/input/elan-i2c-ids.h b/include/linux/input/elan-i2c-ids.h
> new file mode 100644
> index 000000000000..ceabb01a6a7d
> --- /dev/null
> +++ b/include/linux/input/elan-i2c-ids.h
> @@ -0,0 +1,76 @@
> +/*
> + * Elan I2C/SMBus Touchpad device whitelist
> + *
> + * Copyright (c) 2013 ELAN Microelectronics Corp.
> + *
> + * Author: æ維 (Duson Lin) <dusonlin@emc.com.tw>
> + * Author: KT Liao <kt.liao@emc.com.tw>
> + * Version: 1.6.3
> + *
> + * Based on cyapa driver:
> + * copyright (c) 2011-2012 Cypress Semiconductor, Inc.
> + * copyright (c) 2011-2012 Google, Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License version 2 as published
> + * by the Free Software Foundation.
> + *
> + * Trademarks are the property of their respective owners.
> + */
> +
> +#ifndef __ELAN_I2C_IDS_H
> +#define __ELAN_I2C_IDS_H
> +
> +#include <linux/mod_devicetable.h>
> +
> +static const struct acpi_device_id elan_acpi_id[] = {
> +	{ "ELAN0000", 0 },
> +	{ "ELAN0100", 0 },
> +	{ "ELAN0600", 0 },
> +	{ "ELAN0601", 0 },
> +	{ "ELAN0602", 0 },
> +	{ "ELAN0603", 0 },
> +	{ "ELAN0604", 0 },
> +	{ "ELAN0605", 0 },
> +	{ "ELAN0606", 0 },
> +	{ "ELAN0607", 0 },
> +	{ "ELAN0608", 0 },
> +	{ "ELAN0609", 0 },
> +	{ "ELAN060B", 0 },
> +	{ "ELAN060C", 0 },
> +	{ "ELAN060F", 0 },
> +	{ "ELAN0610", 0 },
> +	{ "ELAN0611", 0 },
> +	{ "ELAN0612", 0 },
> +	{ "ELAN0615", 0 },
> +	{ "ELAN0616", 0 },
> +	{ "ELAN0617", 0 },
> +	{ "ELAN0618", 0 },
> +	{ "ELAN0619", 0 },
> +	{ "ELAN061A", 0 },
> +	{ "ELAN061B", 0 },
> +	{ "ELAN061C", 0 },
> +	{ "ELAN061D", 0 },
> +	{ "ELAN061E", 0 },
> +	{ "ELAN061F", 0 },
> +	{ "ELAN0620", 0 },
> +	{ "ELAN0621", 0 },
> +	{ "ELAN0622", 0 },
> +	{ "ELAN0623", 0 },
> +	{ "ELAN0624", 0 },
> +	{ "ELAN0625", 0 },
> +	{ "ELAN0626", 0 },
> +	{ "ELAN0627", 0 },
> +	{ "ELAN0628", 0 },
> +	{ "ELAN0629", 0 },
> +	{ "ELAN062A", 0 },
> +	{ "ELAN062B", 0 },
> +	{ "ELAN062C", 0 },
> +	{ "ELAN062D", 0 },
> +	{ "ELAN0631", 0 },
> +	{ "ELAN0632", 0 },
> +	{ "ELAN1000", 0 },
> +	{ }
> +};
> +
> +#endif /* __ELAN_I2C_IDS_H */
>
diff mbox series

Patch

diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
index ae012639ae1d..4592c9c2d0aa 100644
--- a/drivers/input/mouse/elan_i2c_core.c
+++ b/drivers/input/mouse/elan_i2c_core.c
@@ -37,6 +37,7 @@ 
 #include <linux/completion.h>
 #include <linux/of.h>
 #include <linux/property.h>
+#include <linux/input/elan-i2c-ids.h>
 #include <linux/regulator/consumer.h>
 #include <asm/unaligned.h>
 
@@ -1333,55 +1334,6 @@  static const struct i2c_device_id elan_id[] = {
 MODULE_DEVICE_TABLE(i2c, elan_id);
 
 #ifdef CONFIG_ACPI
-static const struct acpi_device_id elan_acpi_id[] = {
-	{ "ELAN0000", 0 },
-	{ "ELAN0100", 0 },
-	{ "ELAN0600", 0 },
-	{ "ELAN0601", 0 },
-	{ "ELAN0602", 0 },
-	{ "ELAN0603", 0 },
-	{ "ELAN0604", 0 },
-	{ "ELAN0605", 0 },
-	{ "ELAN0606", 0 },
-	{ "ELAN0607", 0 },
-	{ "ELAN0608", 0 },
-	{ "ELAN0609", 0 },
-	{ "ELAN060B", 0 },
-	{ "ELAN060C", 0 },
-	{ "ELAN060F", 0 },
-	{ "ELAN0610", 0 },
-	{ "ELAN0611", 0 },
-	{ "ELAN0612", 0 },
-	{ "ELAN0615", 0 },
-	{ "ELAN0616", 0 },
-	{ "ELAN0617", 0 },
-	{ "ELAN0618", 0 },
-	{ "ELAN0619", 0 },
-	{ "ELAN061A", 0 },
-/*	{ "ELAN061B", 0 }, not working on the Lenovo Legion Y7000 */
-	{ "ELAN061C", 0 },
-	{ "ELAN061D", 0 },
-	{ "ELAN061E", 0 },
-	{ "ELAN061F", 0 },
-	{ "ELAN0620", 0 },
-	{ "ELAN0621", 0 },
-	{ "ELAN0622", 0 },
-	{ "ELAN0623", 0 },
-	{ "ELAN0624", 0 },
-	{ "ELAN0625", 0 },
-	{ "ELAN0626", 0 },
-	{ "ELAN0627", 0 },
-	{ "ELAN0628", 0 },
-	{ "ELAN0629", 0 },
-	{ "ELAN062A", 0 },
-	{ "ELAN062B", 0 },
-	{ "ELAN062C", 0 },
-	{ "ELAN062D", 0 },
-	{ "ELAN0631", 0 },
-	{ "ELAN0632", 0 },
-	{ "ELAN1000", 0 },
-	{ }
-};
 MODULE_DEVICE_TABLE(acpi, elan_acpi_id);
 #endif
 
diff --git a/include/linux/input/elan-i2c-ids.h b/include/linux/input/elan-i2c-ids.h
new file mode 100644
index 000000000000..ceabb01a6a7d
--- /dev/null
+++ b/include/linux/input/elan-i2c-ids.h
@@ -0,0 +1,76 @@ 
+/*
+ * Elan I2C/SMBus Touchpad device whitelist
+ *
+ * Copyright (c) 2013 ELAN Microelectronics Corp.
+ *
+ * Author: æ維 (Duson Lin) <dusonlin@emc.com.tw>
+ * Author: KT Liao <kt.liao@emc.com.tw>
+ * Version: 1.6.3
+ *
+ * Based on cyapa driver:
+ * copyright (c) 2011-2012 Cypress Semiconductor, Inc.
+ * copyright (c) 2011-2012 Google, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * Trademarks are the property of their respective owners.
+ */
+
+#ifndef __ELAN_I2C_IDS_H
+#define __ELAN_I2C_IDS_H
+
+#include <linux/mod_devicetable.h>
+
+static const struct acpi_device_id elan_acpi_id[] = {
+	{ "ELAN0000", 0 },
+	{ "ELAN0100", 0 },
+	{ "ELAN0600", 0 },
+	{ "ELAN0601", 0 },
+	{ "ELAN0602", 0 },
+	{ "ELAN0603", 0 },
+	{ "ELAN0604", 0 },
+	{ "ELAN0605", 0 },
+	{ "ELAN0606", 0 },
+	{ "ELAN0607", 0 },
+	{ "ELAN0608", 0 },
+	{ "ELAN0609", 0 },
+	{ "ELAN060B", 0 },
+	{ "ELAN060C", 0 },
+	{ "ELAN060F", 0 },
+	{ "ELAN0610", 0 },
+	{ "ELAN0611", 0 },
+	{ "ELAN0612", 0 },
+	{ "ELAN0615", 0 },
+	{ "ELAN0616", 0 },
+	{ "ELAN0617", 0 },
+	{ "ELAN0618", 0 },
+	{ "ELAN0619", 0 },
+	{ "ELAN061A", 0 },
+	{ "ELAN061B", 0 },
+	{ "ELAN061C", 0 },
+	{ "ELAN061D", 0 },
+	{ "ELAN061E", 0 },
+	{ "ELAN061F", 0 },
+	{ "ELAN0620", 0 },
+	{ "ELAN0621", 0 },
+	{ "ELAN0622", 0 },
+	{ "ELAN0623", 0 },
+	{ "ELAN0624", 0 },
+	{ "ELAN0625", 0 },
+	{ "ELAN0626", 0 },
+	{ "ELAN0627", 0 },
+	{ "ELAN0628", 0 },
+	{ "ELAN0629", 0 },
+	{ "ELAN062A", 0 },
+	{ "ELAN062B", 0 },
+	{ "ELAN062C", 0 },
+	{ "ELAN062D", 0 },
+	{ "ELAN0631", 0 },
+	{ "ELAN0632", 0 },
+	{ "ELAN1000", 0 },
+	{ }
+};
+
+#endif /* __ELAN_I2C_IDS_H */