Commit 740bebf4 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid

Pull HID fixes from Jiri Kosina:

 - fix for Intel-ISH driver to make sure it gets aoutoloaded only on
   matching devices and not universally (Thomas Weißschuh)

 - fix for Wacom driver reporting invalid contact under certain
   circumstances (Jason Gerecke)

 - probing fix for ft260 dirver (Michael Zaidman)

 - fix for generic keycode remapping (Thomas Weißschuh)

 - fix for division by zero in hid-magicmouse (Claudia Pellegrino)

 - other tiny assorted fixes and new device IDs

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
  HID: multitouch: Fix Iiyama ProLite T1931SAW (0eef:0001 again!)
  HID: nintendo: eliminate dead datastructures in !CONFIG_NINTENDO_FF case
  HID: magicmouse: prevent division by 0 on scroll
  HID: thrustmaster: fix sparse warnings
  HID: Ignore battery for Elan touchscreen on HP Envy X360 15-eu0xxx
  HID: input: set usage type to key on keycode remap
  HID: input: Fix parsing of HID_CP_CONSUMER_CONTROL fields
  HID: ft260: fix i2c probing for hwmon devices
  Revert "HID: hid-asus.c: Maps key 0x35 (display off) to KEY_SCREENLOCK"
  HID: intel-ish-hid: fix module device-id handling
  mod_devicetable: fix kdocs for ishtp_device_id
  HID: wacom: Use "Confidence" flag to prevent reporting invalid contacts
  HID: nintendo: unlock on error in joycon_leds_create()
  platform/x86: isthp_eclite: only load for matching devices
  platform/chrome: chros_ec_ishtp: only load for matching devices
  HID: intel-ish-hid: hid-client: only load for matching devices
  HID: intel-ish-hid: fw-loader: only load for matching devices
  HID: intel-ish-hid: use constants for modaliases
  HID: intel-ish-hid: add support for MODULE_DEVICE_TABLE()
parents 5d9f4cf3 32bea357
...@@ -854,7 +854,7 @@ static int asus_input_mapping(struct hid_device *hdev, ...@@ -854,7 +854,7 @@ static int asus_input_mapping(struct hid_device *hdev,
switch (usage->hid & HID_USAGE) { switch (usage->hid & HID_USAGE) {
case 0x10: asus_map_key_clear(KEY_BRIGHTNESSDOWN); break; case 0x10: asus_map_key_clear(KEY_BRIGHTNESSDOWN); break;
case 0x20: asus_map_key_clear(KEY_BRIGHTNESSUP); break; case 0x20: asus_map_key_clear(KEY_BRIGHTNESSUP); break;
case 0x35: asus_map_key_clear(KEY_SCREENLOCK); break; case 0x35: asus_map_key_clear(KEY_DISPLAY_OFF); break;
case 0x6c: asus_map_key_clear(KEY_SLEEP); break; case 0x6c: asus_map_key_clear(KEY_SLEEP); break;
case 0x7c: asus_map_key_clear(KEY_MICMUTE); break; case 0x7c: asus_map_key_clear(KEY_MICMUTE); break;
case 0x82: asus_map_key_clear(KEY_CAMERA); break; case 0x82: asus_map_key_clear(KEY_CAMERA); break;
......
...@@ -966,24 +966,23 @@ static int ft260_probe(struct hid_device *hdev, const struct hid_device_id *id) ...@@ -966,24 +966,23 @@ static int ft260_probe(struct hid_device *hdev, const struct hid_device_id *id)
mutex_init(&dev->lock); mutex_init(&dev->lock);
init_completion(&dev->wait); init_completion(&dev->wait);
ret = ft260_xfer_status(dev);
if (ret)
ft260_i2c_reset(hdev);
i2c_set_adapdata(&dev->adap, dev);
ret = i2c_add_adapter(&dev->adap); ret = i2c_add_adapter(&dev->adap);
if (ret) { if (ret) {
hid_err(hdev, "failed to add i2c adapter\n"); hid_err(hdev, "failed to add i2c adapter\n");
goto err_hid_close; goto err_hid_close;
} }
i2c_set_adapdata(&dev->adap, dev);
ret = sysfs_create_group(&hdev->dev.kobj, &ft260_attr_group); ret = sysfs_create_group(&hdev->dev.kobj, &ft260_attr_group);
if (ret < 0) { if (ret < 0) {
hid_err(hdev, "failed to create sysfs attrs\n"); hid_err(hdev, "failed to create sysfs attrs\n");
goto err_i2c_free; goto err_i2c_free;
} }
ret = ft260_xfer_status(dev);
if (ret)
ft260_i2c_reset(hdev);
return 0; return 0;
err_i2c_free: err_i2c_free:
......
...@@ -397,6 +397,7 @@ ...@@ -397,6 +397,7 @@
#define USB_DEVICE_ID_TOSHIBA_CLICK_L9W 0x0401 #define USB_DEVICE_ID_TOSHIBA_CLICK_L9W 0x0401
#define USB_DEVICE_ID_HP_X2 0x074d #define USB_DEVICE_ID_HP_X2 0x074d
#define USB_DEVICE_ID_HP_X2_10_COVER 0x0755 #define USB_DEVICE_ID_HP_X2_10_COVER 0x0755
#define I2C_DEVICE_ID_HP_ENVY_X360_15 0x2d05
#define I2C_DEVICE_ID_HP_SPECTRE_X360_15 0x2817 #define I2C_DEVICE_ID_HP_SPECTRE_X360_15 0x2817
#define USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN 0x2706 #define USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN 0x2706
#define I2C_DEVICE_ID_SURFACE_GO_TOUCHSCREEN 0x261A #define I2C_DEVICE_ID_SURFACE_GO_TOUCHSCREEN 0x261A
......
...@@ -160,6 +160,7 @@ static int hidinput_setkeycode(struct input_dev *dev, ...@@ -160,6 +160,7 @@ static int hidinput_setkeycode(struct input_dev *dev,
if (usage) { if (usage) {
*old_keycode = usage->type == EV_KEY ? *old_keycode = usage->type == EV_KEY ?
usage->code : KEY_RESERVED; usage->code : KEY_RESERVED;
usage->type = EV_KEY;
usage->code = ke->keycode; usage->code = ke->keycode;
clear_bit(*old_keycode, dev->keybit); clear_bit(*old_keycode, dev->keybit);
...@@ -324,6 +325,8 @@ static const struct hid_device_id hid_battery_quirks[] = { ...@@ -324,6 +325,8 @@ static const struct hid_device_id hid_battery_quirks[] = {
HID_BATTERY_QUIRK_IGNORE }, HID_BATTERY_QUIRK_IGNORE },
{ HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN), { HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN),
HID_BATTERY_QUIRK_IGNORE }, HID_BATTERY_QUIRK_IGNORE },
{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_ENVY_X360_15),
HID_BATTERY_QUIRK_IGNORE },
{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_SPECTRE_X360_15), { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_SPECTRE_X360_15),
HID_BATTERY_QUIRK_IGNORE }, HID_BATTERY_QUIRK_IGNORE },
{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_SURFACE_GO_TOUCHSCREEN), { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_SURFACE_GO_TOUCHSCREEN),
...@@ -650,10 +653,9 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel ...@@ -650,10 +653,9 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
code += KEY_MACRO1; code += KEY_MACRO1;
else else
code += BTN_TRIGGER_HAPPY - 0x1e; code += BTN_TRIGGER_HAPPY - 0x1e;
} else { break;
goto ignore;
} }
break; fallthrough;
default: default:
switch (field->physical) { switch (field->physical) {
case HID_GD_MOUSE: case HID_GD_MOUSE:
......
...@@ -256,8 +256,11 @@ static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tda ...@@ -256,8 +256,11 @@ static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tda
unsigned long now = jiffies; unsigned long now = jiffies;
int step_x = msc->touches[id].scroll_x - x; int step_x = msc->touches[id].scroll_x - x;
int step_y = msc->touches[id].scroll_y - y; int step_y = msc->touches[id].scroll_y - y;
int step_hr = ((64 - (int)scroll_speed) * msc->scroll_accel) / int step_hr =
SCROLL_HR_STEPS; max_t(int,
((64 - (int)scroll_speed) * msc->scroll_accel) /
SCROLL_HR_STEPS,
1);
int step_x_hr = msc->touches[id].scroll_x_hr - x; int step_x_hr = msc->touches[id].scroll_x_hr - x;
int step_y_hr = msc->touches[id].scroll_y_hr - y; int step_y_hr = msc->touches[id].scroll_y_hr - y;
......
...@@ -1888,6 +1888,11 @@ static const struct hid_device_id mt_devices[] = { ...@@ -1888,6 +1888,11 @@ static const struct hid_device_id mt_devices[] = {
MT_USB_DEVICE(USB_VENDOR_ID_CVTOUCH, MT_USB_DEVICE(USB_VENDOR_ID_CVTOUCH,
USB_DEVICE_ID_CVTOUCH_SCREEN) }, USB_DEVICE_ID_CVTOUCH_SCREEN) },
/* eGalax devices (SAW) */
{ .driver_data = MT_CLS_EXPORT_ALL_INPUTS,
MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER) },
/* eGalax devices (resistive) */ /* eGalax devices (resistive) */
{ .driver_data = MT_CLS_EGALAX, { .driver_data = MT_CLS_EGALAX,
MT_USB_DEVICE(USB_VENDOR_ID_DWAV, MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
......
...@@ -189,6 +189,7 @@ struct joycon_rumble_amp_data { ...@@ -189,6 +189,7 @@ struct joycon_rumble_amp_data {
u16 amp; u16 amp;
}; };
#if IS_ENABLED(CONFIG_NINTENDO_FF)
/* /*
* These tables are from * These tables are from
* https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/rumble_data_table.md * https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/rumble_data_table.md
...@@ -289,6 +290,10 @@ static const struct joycon_rumble_amp_data joycon_rumble_amplitudes[] = { ...@@ -289,6 +290,10 @@ static const struct joycon_rumble_amp_data joycon_rumble_amplitudes[] = {
{ 0xc2, 0x8070, 940 }, { 0xc4, 0x0071, 960 }, { 0xc6, 0x8071, 981 }, { 0xc2, 0x8070, 940 }, { 0xc4, 0x0071, 960 }, { 0xc6, 0x8071, 981 },
{ 0xc8, 0x0072, joycon_max_rumble_amp } { 0xc8, 0x0072, joycon_max_rumble_amp }
}; };
static const u16 JC_RUMBLE_DFLT_LOW_FREQ = 160;
static const u16 JC_RUMBLE_DFLT_HIGH_FREQ = 320;
#endif /* IS_ENABLED(CONFIG_NINTENDO_FF) */
static const u16 JC_RUMBLE_PERIOD_MS = 50;
/* States for controller state machine */ /* States for controller state machine */
enum joycon_ctlr_state { enum joycon_ctlr_state {
...@@ -397,9 +402,6 @@ struct joycon_input_report { ...@@ -397,9 +402,6 @@ struct joycon_input_report {
#define JC_RUMBLE_DATA_SIZE 8 #define JC_RUMBLE_DATA_SIZE 8
#define JC_RUMBLE_QUEUE_SIZE 8 #define JC_RUMBLE_QUEUE_SIZE 8
static const u16 JC_RUMBLE_DFLT_LOW_FREQ = 160;
static const u16 JC_RUMBLE_DFLT_HIGH_FREQ = 320;
static const u16 JC_RUMBLE_PERIOD_MS = 50;
static const unsigned short JC_RUMBLE_ZERO_AMP_PKT_CNT = 5; static const unsigned short JC_RUMBLE_ZERO_AMP_PKT_CNT = 5;
static const char * const joycon_player_led_names[] = { static const char * const joycon_player_led_names[] = {
...@@ -1850,8 +1852,10 @@ static int joycon_leds_create(struct joycon_ctlr *ctlr) ...@@ -1850,8 +1852,10 @@ static int joycon_leds_create(struct joycon_ctlr *ctlr)
d_name, d_name,
"green", "green",
joycon_player_led_names[i]); joycon_player_led_names[i]);
if (!name) if (!name) {
mutex_unlock(&joycon_input_num_mutex);
return -ENOMEM; return -ENOMEM;
}
led = &ctlr->leds[i]; led = &ctlr->leds[i];
led->name = name; led->name = name;
...@@ -1864,6 +1868,7 @@ static int joycon_leds_create(struct joycon_ctlr *ctlr) ...@@ -1864,6 +1868,7 @@ static int joycon_leds_create(struct joycon_ctlr *ctlr)
ret = devm_led_classdev_register(&hdev->dev, led); ret = devm_led_classdev_register(&hdev->dev, led);
if (ret) { if (ret) {
hid_err(hdev, "Failed registering %s LED\n", led->name); hid_err(hdev, "Failed registering %s LED\n", led->name);
mutex_unlock(&joycon_input_num_mutex);
return ret; return ret;
} }
} }
......
...@@ -205,7 +205,7 @@ static void thrustmaster_model_handler(struct urb *urb) ...@@ -205,7 +205,7 @@ static void thrustmaster_model_handler(struct urb *urb)
struct tm_wheel *tm_wheel = hid_get_drvdata(hdev); struct tm_wheel *tm_wheel = hid_get_drvdata(hdev);
uint16_t model = 0; uint16_t model = 0;
int i, ret; int i, ret;
const struct tm_wheel_info *twi = 0; const struct tm_wheel_info *twi = NULL;
if (urb->status) { if (urb->status) {
hid_err(hdev, "URB to get model id failed with error %d\n", urb->status); hid_err(hdev, "URB to get model id failed with error %d\n", urb->status);
...@@ -238,7 +238,7 @@ static void thrustmaster_model_handler(struct urb *urb) ...@@ -238,7 +238,7 @@ static void thrustmaster_model_handler(struct urb *urb)
tm_wheel->usb_dev, tm_wheel->usb_dev,
usb_sndctrlpipe(tm_wheel->usb_dev, 0), usb_sndctrlpipe(tm_wheel->usb_dev, 0),
(char *)tm_wheel->change_request, (char *)tm_wheel->change_request,
0, 0, // We do not expect any response from the wheel NULL, 0, // We do not expect any response from the wheel
thrustmaster_change_handler, thrustmaster_change_handler,
hdev hdev
); );
...@@ -272,7 +272,7 @@ static void thrustmaster_remove(struct hid_device *hdev) ...@@ -272,7 +272,7 @@ static void thrustmaster_remove(struct hid_device *hdev)
static int thrustmaster_probe(struct hid_device *hdev, const struct hid_device_id *id) static int thrustmaster_probe(struct hid_device *hdev, const struct hid_device_id *id)
{ {
int ret = 0; int ret = 0;
struct tm_wheel *tm_wheel = 0; struct tm_wheel *tm_wheel = NULL;
ret = hid_parse(hdev); ret = hid_parse(hdev);
if (ret) { if (ret) {
......
...@@ -76,9 +76,12 @@ enum ish_loader_commands { ...@@ -76,9 +76,12 @@ enum ish_loader_commands {
#define LOADER_XFER_MODE_ISHTP BIT(1) #define LOADER_XFER_MODE_ISHTP BIT(1)
/* ISH Transport Loader client unique GUID */ /* ISH Transport Loader client unique GUID */
static const guid_t loader_ishtp_guid = static const struct ishtp_device_id loader_ishtp_id_table[] = {
GUID_INIT(0xc804d06a, 0x55bd, 0x4ea7, { .guid = GUID_INIT(0xc804d06a, 0x55bd, 0x4ea7,
0xad, 0xed, 0x1e, 0x31, 0x22, 0x8c, 0x76, 0xdc); 0xad, 0xed, 0x1e, 0x31, 0x22, 0x8c, 0x76, 0xdc) },
{ }
};
MODULE_DEVICE_TABLE(ishtp, loader_ishtp_id_table);
#define FILENAME_SIZE 256 #define FILENAME_SIZE 256
...@@ -880,7 +883,7 @@ static int loader_init(struct ishtp_cl *loader_ishtp_cl, int reset) ...@@ -880,7 +883,7 @@ static int loader_init(struct ishtp_cl *loader_ishtp_cl, int reset)
fw_client = fw_client =
ishtp_fw_cl_get_client(ishtp_get_ishtp_device(loader_ishtp_cl), ishtp_fw_cl_get_client(ishtp_get_ishtp_device(loader_ishtp_cl),
&loader_ishtp_guid); &loader_ishtp_id_table[0].guid);
if (!fw_client) { if (!fw_client) {
dev_err(cl_data_to_dev(client_data), dev_err(cl_data_to_dev(client_data),
"ISH client uuid not found\n"); "ISH client uuid not found\n");
...@@ -1057,7 +1060,7 @@ static int loader_ishtp_cl_reset(struct ishtp_cl_device *cl_device) ...@@ -1057,7 +1060,7 @@ static int loader_ishtp_cl_reset(struct ishtp_cl_device *cl_device)
static struct ishtp_cl_driver loader_ishtp_cl_driver = { static struct ishtp_cl_driver loader_ishtp_cl_driver = {
.name = "ish-loader", .name = "ish-loader",
.guid = &loader_ishtp_guid, .id = loader_ishtp_id_table,
.probe = loader_ishtp_cl_probe, .probe = loader_ishtp_cl_probe,
.remove = loader_ishtp_cl_remove, .remove = loader_ishtp_cl_remove,
.reset = loader_ishtp_cl_reset, .reset = loader_ishtp_cl_reset,
...@@ -1083,4 +1086,3 @@ MODULE_DESCRIPTION("ISH ISH-TP Host firmware Loader Client Driver"); ...@@ -1083,4 +1086,3 @@ MODULE_DESCRIPTION("ISH ISH-TP Host firmware Loader Client Driver");
MODULE_AUTHOR("Rushikesh S Kadam <rushikesh.s.kadam@intel.com>"); MODULE_AUTHOR("Rushikesh S Kadam <rushikesh.s.kadam@intel.com>");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_ALIAS("ishtp:*");
...@@ -12,9 +12,12 @@ ...@@ -12,9 +12,12 @@
#include "ishtp-hid.h" #include "ishtp-hid.h"
/* ISH Transport protocol (ISHTP in short) GUID */ /* ISH Transport protocol (ISHTP in short) GUID */
static const guid_t hid_ishtp_guid = static const struct ishtp_device_id hid_ishtp_id_table[] = {
GUID_INIT(0x33AECD58, 0xB679, 0x4E54, { .guid = GUID_INIT(0x33AECD58, 0xB679, 0x4E54,
0x9B, 0xD9, 0xA0, 0x4D, 0x34, 0xF0, 0xC2, 0x26); 0x9B, 0xD9, 0xA0, 0x4D, 0x34, 0xF0, 0xC2, 0x26), },
{ }
};
MODULE_DEVICE_TABLE(ishtp, hid_ishtp_id_table);
/* Rx ring buffer pool size */ /* Rx ring buffer pool size */
#define HID_CL_RX_RING_SIZE 32 #define HID_CL_RX_RING_SIZE 32
...@@ -662,7 +665,7 @@ static int hid_ishtp_cl_init(struct ishtp_cl *hid_ishtp_cl, int reset) ...@@ -662,7 +665,7 @@ static int hid_ishtp_cl_init(struct ishtp_cl *hid_ishtp_cl, int reset)
ishtp_set_tx_ring_size(hid_ishtp_cl, HID_CL_TX_RING_SIZE); ishtp_set_tx_ring_size(hid_ishtp_cl, HID_CL_TX_RING_SIZE);
ishtp_set_rx_ring_size(hid_ishtp_cl, HID_CL_RX_RING_SIZE); ishtp_set_rx_ring_size(hid_ishtp_cl, HID_CL_RX_RING_SIZE);
fw_client = ishtp_fw_cl_get_client(dev, &hid_ishtp_guid); fw_client = ishtp_fw_cl_get_client(dev, &hid_ishtp_id_table[0].guid);
if (!fw_client) { if (!fw_client) {
dev_err(cl_data_to_dev(client_data), dev_err(cl_data_to_dev(client_data),
"ish client uuid not found\n"); "ish client uuid not found\n");
...@@ -945,7 +948,7 @@ static const struct dev_pm_ops hid_ishtp_pm_ops = { ...@@ -945,7 +948,7 @@ static const struct dev_pm_ops hid_ishtp_pm_ops = {
static struct ishtp_cl_driver hid_ishtp_cl_driver = { static struct ishtp_cl_driver hid_ishtp_cl_driver = {
.name = "ish-hid", .name = "ish-hid",
.guid = &hid_ishtp_guid, .id = hid_ishtp_id_table,
.probe = hid_ishtp_cl_probe, .probe = hid_ishtp_cl_probe,
.remove = hid_ishtp_cl_remove, .remove = hid_ishtp_cl_remove,
.reset = hid_ishtp_cl_reset, .reset = hid_ishtp_cl_reset,
...@@ -981,4 +984,3 @@ MODULE_AUTHOR("Daniel Drubin <daniel.drubin@intel.com>"); ...@@ -981,4 +984,3 @@ MODULE_AUTHOR("Daniel Drubin <daniel.drubin@intel.com>");
MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>"); MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("ishtp:*");
...@@ -241,7 +241,7 @@ static int ishtp_cl_bus_match(struct device *dev, struct device_driver *drv) ...@@ -241,7 +241,7 @@ static int ishtp_cl_bus_match(struct device *dev, struct device_driver *drv)
struct ishtp_cl_device *device = to_ishtp_cl_device(dev); struct ishtp_cl_device *device = to_ishtp_cl_device(dev);
struct ishtp_cl_driver *driver = to_ishtp_cl_driver(drv); struct ishtp_cl_driver *driver = to_ishtp_cl_driver(drv);
return guid_equal(driver->guid, return guid_equal(&driver->id[0].guid,
&device->fw_client->props.protocol_name); &device->fw_client->props.protocol_name);
} }
...@@ -350,7 +350,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a, ...@@ -350,7 +350,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
{ {
int len; int len;
len = snprintf(buf, PAGE_SIZE, "ishtp:%s\n", dev_name(dev)); len = snprintf(buf, PAGE_SIZE, ISHTP_MODULE_PREFIX "%s\n", dev_name(dev));
return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len; return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
} }
static DEVICE_ATTR_RO(modalias); static DEVICE_ATTR_RO(modalias);
...@@ -363,7 +363,7 @@ ATTRIBUTE_GROUPS(ishtp_cl_dev); ...@@ -363,7 +363,7 @@ ATTRIBUTE_GROUPS(ishtp_cl_dev);
static int ishtp_cl_uevent(struct device *dev, struct kobj_uevent_env *env) static int ishtp_cl_uevent(struct device *dev, struct kobj_uevent_env *env)
{ {
if (add_uevent_var(env, "MODALIAS=ishtp:%s", dev_name(dev))) if (add_uevent_var(env, "MODALIAS=" ISHTP_MODULE_PREFIX "%s", dev_name(dev)))
return -ENOMEM; return -ENOMEM;
return 0; return 0;
} }
......
...@@ -2603,6 +2603,9 @@ static void wacom_wac_finger_event(struct hid_device *hdev, ...@@ -2603,6 +2603,9 @@ static void wacom_wac_finger_event(struct hid_device *hdev,
return; return;
switch (equivalent_usage) { switch (equivalent_usage) {
case HID_DG_CONFIDENCE:
wacom_wac->hid_data.confidence = value;
break;
case HID_GD_X: case HID_GD_X:
wacom_wac->hid_data.x = value; wacom_wac->hid_data.x = value;
break; break;
...@@ -2635,7 +2638,8 @@ static void wacom_wac_finger_event(struct hid_device *hdev, ...@@ -2635,7 +2638,8 @@ static void wacom_wac_finger_event(struct hid_device *hdev,
} }
if (usage->usage_index + 1 == field->report_count) { if (usage->usage_index + 1 == field->report_count) {
if (equivalent_usage == wacom_wac->hid_data.last_slot_field) if (equivalent_usage == wacom_wac->hid_data.last_slot_field &&
wacom_wac->hid_data.confidence)
wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input); wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input);
} }
} }
...@@ -2653,6 +2657,8 @@ static void wacom_wac_finger_pre_report(struct hid_device *hdev, ...@@ -2653,6 +2657,8 @@ static void wacom_wac_finger_pre_report(struct hid_device *hdev,
wacom_wac->is_invalid_bt_frame = false; wacom_wac->is_invalid_bt_frame = false;
hid_data->confidence = true;
for (i = 0; i < report->maxfield; i++) { for (i = 0; i < report->maxfield; i++) {
struct hid_field *field = report->field[i]; struct hid_field *field = report->field[i];
int j; int j;
......
...@@ -301,6 +301,7 @@ struct hid_data { ...@@ -301,6 +301,7 @@ struct hid_data {
bool barrelswitch; bool barrelswitch;
bool barrelswitch2; bool barrelswitch2;
bool serialhi; bool serialhi;
bool confidence;
int x; int x;
int y; int y;
int pressure; int pressure;
......
...@@ -41,9 +41,12 @@ enum cros_ec_ish_channel { ...@@ -41,9 +41,12 @@ enum cros_ec_ish_channel {
#define ISHTP_SEND_TIMEOUT (3 * HZ) #define ISHTP_SEND_TIMEOUT (3 * HZ)
/* ISH Transport CrOS EC ISH client unique GUID */ /* ISH Transport CrOS EC ISH client unique GUID */
static const guid_t cros_ish_guid = static const struct ishtp_device_id cros_ec_ishtp_id_table[] = {
GUID_INIT(0x7b7154d0, 0x56f4, 0x4bdc, { .guid = GUID_INIT(0x7b7154d0, 0x56f4, 0x4bdc,
0xb0, 0xd8, 0x9e, 0x7c, 0xda, 0xe0, 0xd6, 0xa0); 0xb0, 0xd8, 0x9e, 0x7c, 0xda, 0xe0, 0xd6, 0xa0), },
{ }
};
MODULE_DEVICE_TABLE(ishtp, cros_ec_ishtp_id_table);
struct header { struct header {
u8 channel; u8 channel;
...@@ -389,7 +392,7 @@ static int cros_ish_init(struct ishtp_cl *cros_ish_cl) ...@@ -389,7 +392,7 @@ static int cros_ish_init(struct ishtp_cl *cros_ish_cl)
ishtp_set_tx_ring_size(cros_ish_cl, CROS_ISH_CL_TX_RING_SIZE); ishtp_set_tx_ring_size(cros_ish_cl, CROS_ISH_CL_TX_RING_SIZE);
ishtp_set_rx_ring_size(cros_ish_cl, CROS_ISH_CL_RX_RING_SIZE); ishtp_set_rx_ring_size(cros_ish_cl, CROS_ISH_CL_RX_RING_SIZE);
fw_client = ishtp_fw_cl_get_client(dev, &cros_ish_guid); fw_client = ishtp_fw_cl_get_client(dev, &cros_ec_ishtp_id_table[0].guid);
if (!fw_client) { if (!fw_client) {
dev_err(cl_data_to_dev(client_data), dev_err(cl_data_to_dev(client_data),
"ish client uuid not found\n"); "ish client uuid not found\n");
...@@ -765,7 +768,7 @@ static SIMPLE_DEV_PM_OPS(cros_ec_ishtp_pm_ops, cros_ec_ishtp_suspend, ...@@ -765,7 +768,7 @@ static SIMPLE_DEV_PM_OPS(cros_ec_ishtp_pm_ops, cros_ec_ishtp_suspend,
static struct ishtp_cl_driver cros_ec_ishtp_driver = { static struct ishtp_cl_driver cros_ec_ishtp_driver = {
.name = "cros_ec_ishtp", .name = "cros_ec_ishtp",
.guid = &cros_ish_guid, .id = cros_ec_ishtp_id_table,
.probe = cros_ec_ishtp_probe, .probe = cros_ec_ishtp_probe,
.remove = cros_ec_ishtp_remove, .remove = cros_ec_ishtp_remove,
.reset = cros_ec_ishtp_reset, .reset = cros_ec_ishtp_reset,
...@@ -791,4 +794,3 @@ MODULE_DESCRIPTION("ChromeOS EC ISHTP Client Driver"); ...@@ -791,4 +794,3 @@ MODULE_DESCRIPTION("ChromeOS EC ISHTP Client Driver");
MODULE_AUTHOR("Rushikesh S Kadam <rushikesh.s.kadam@intel.com>"); MODULE_AUTHOR("Rushikesh S Kadam <rushikesh.s.kadam@intel.com>");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_ALIAS("ishtp:*");
...@@ -93,9 +93,12 @@ struct ishtp_opregion_dev { ...@@ -93,9 +93,12 @@ struct ishtp_opregion_dev {
}; };
/* eclite ishtp client UUID: 6a19cc4b-d760-4de3-b14d-f25ebd0fbcd9 */ /* eclite ishtp client UUID: 6a19cc4b-d760-4de3-b14d-f25ebd0fbcd9 */
static const guid_t ecl_ishtp_guid = static const struct ishtp_device_id ecl_ishtp_id_table[] = {
GUID_INIT(0x6a19cc4b, 0xd760, 0x4de3, { .guid = GUID_INIT(0x6a19cc4b, 0xd760, 0x4de3,
0xb1, 0x4d, 0xf2, 0x5e, 0xbd, 0xf, 0xbc, 0xd9); 0xb1, 0x4d, 0xf2, 0x5e, 0xbd, 0xf, 0xbc, 0xd9), },
{ }
};
MODULE_DEVICE_TABLE(ishtp, ecl_ishtp_id_table);
/* ACPI DSM UUID: 91d936a7-1f01-49c6-a6b4-72f00ad8d8a5 */ /* ACPI DSM UUID: 91d936a7-1f01-49c6-a6b4-72f00ad8d8a5 */
static const guid_t ecl_acpi_guid = static const guid_t ecl_acpi_guid =
...@@ -462,7 +465,7 @@ static int ecl_ishtp_cl_init(struct ishtp_cl *ecl_ishtp_cl) ...@@ -462,7 +465,7 @@ static int ecl_ishtp_cl_init(struct ishtp_cl *ecl_ishtp_cl)
ishtp_set_tx_ring_size(ecl_ishtp_cl, ECL_CL_TX_RING_SIZE); ishtp_set_tx_ring_size(ecl_ishtp_cl, ECL_CL_TX_RING_SIZE);
ishtp_set_rx_ring_size(ecl_ishtp_cl, ECL_CL_RX_RING_SIZE); ishtp_set_rx_ring_size(ecl_ishtp_cl, ECL_CL_RX_RING_SIZE);
fw_client = ishtp_fw_cl_get_client(dev, &ecl_ishtp_guid); fw_client = ishtp_fw_cl_get_client(dev, &ecl_ishtp_id_table[0].guid);
if (!fw_client) { if (!fw_client) {
dev_err(cl_data_to_dev(opr_dev), "fw client not found\n"); dev_err(cl_data_to_dev(opr_dev), "fw client not found\n");
return -ENOENT; return -ENOENT;
...@@ -674,7 +677,7 @@ static const struct dev_pm_ops ecl_ishtp_pm_ops = { ...@@ -674,7 +677,7 @@ static const struct dev_pm_ops ecl_ishtp_pm_ops = {
static struct ishtp_cl_driver ecl_ishtp_cl_driver = { static struct ishtp_cl_driver ecl_ishtp_cl_driver = {
.name = "ishtp-eclite", .name = "ishtp-eclite",
.guid = &ecl_ishtp_guid, .id = ecl_ishtp_id_table,
.probe = ecl_ishtp_cl_probe, .probe = ecl_ishtp_cl_probe,
.remove = ecl_ishtp_cl_remove, .remove = ecl_ishtp_cl_remove,
.reset = ecl_ishtp_cl_reset, .reset = ecl_ishtp_cl_reset,
...@@ -698,4 +701,3 @@ MODULE_DESCRIPTION("ISH ISHTP eclite client opregion driver"); ...@@ -698,4 +701,3 @@ MODULE_DESCRIPTION("ISH ISHTP eclite client opregion driver");
MODULE_AUTHOR("K Naduvalath, Sumesh <sumesh.k.naduvalath@intel.com>"); MODULE_AUTHOR("K Naduvalath, Sumesh <sumesh.k.naduvalath@intel.com>");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_ALIAS("ishtp:*");
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#define _INTEL_ISH_CLIENT_IF_H_ #define _INTEL_ISH_CLIENT_IF_H_
#include <linux/device.h> #include <linux/device.h>
#include <linux/uuid.h> #include <linux/mod_devicetable.h>
struct ishtp_cl_device; struct ishtp_cl_device;
struct ishtp_device; struct ishtp_device;
...@@ -40,7 +40,7 @@ enum cl_state { ...@@ -40,7 +40,7 @@ enum cl_state {
struct ishtp_cl_driver { struct ishtp_cl_driver {
struct device_driver driver; struct device_driver driver;
const char *name; const char *name;
const guid_t *guid; const struct ishtp_device_id *id;
int (*probe)(struct ishtp_cl_device *dev); int (*probe)(struct ishtp_cl_device *dev);
void (*remove)(struct ishtp_cl_device *dev); void (*remove)(struct ishtp_cl_device *dev);
int (*reset)(struct ishtp_cl_device *dev); int (*reset)(struct ishtp_cl_device *dev);
......
...@@ -895,4 +895,18 @@ struct dfl_device_id { ...@@ -895,4 +895,18 @@ struct dfl_device_id {
kernel_ulong_t driver_data; kernel_ulong_t driver_data;
}; };
/* ISHTP (Integrated Sensor Hub Transport Protocol) */
#define ISHTP_MODULE_PREFIX "ishtp:"
/**
* struct ishtp_device_id - ISHTP device identifier
* @guid: GUID of the device.
* @driver_data: pointer to driver specific data
*/
struct ishtp_device_id {
guid_t guid;
kernel_ulong_t driver_data;
};
#endif /* LINUX_MOD_DEVICETABLE_H */ #endif /* LINUX_MOD_DEVICETABLE_H */
...@@ -259,5 +259,8 @@ int main(void) ...@@ -259,5 +259,8 @@ int main(void)
DEVID_FIELD(dfl_device_id, type); DEVID_FIELD(dfl_device_id, type);
DEVID_FIELD(dfl_device_id, feature_id); DEVID_FIELD(dfl_device_id, feature_id);
DEVID(ishtp_device_id);
DEVID_FIELD(ishtp_device_id, guid);
return 0; return 0;
} }
...@@ -115,6 +115,17 @@ static inline void add_uuid(char *str, uuid_le uuid) ...@@ -115,6 +115,17 @@ static inline void add_uuid(char *str, uuid_le uuid)
uuid.b[12], uuid.b[13], uuid.b[14], uuid.b[15]); uuid.b[12], uuid.b[13], uuid.b[14], uuid.b[15]);
} }
static inline void add_guid(char *str, guid_t guid)
{
int len = strlen(str);
sprintf(str + len, "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
guid.b[3], guid.b[2], guid.b[1], guid.b[0],
guid.b[5], guid.b[4], guid.b[7], guid.b[6],
guid.b[8], guid.b[9], guid.b[10], guid.b[11],
guid.b[12], guid.b[13], guid.b[14], guid.b[15]);
}
/** /**
* Check that sizeof(device_id type) are consistent with size of section * Check that sizeof(device_id type) are consistent with size of section
* in .o file. If in-consistent then userspace and kernel does not agree * in .o file. If in-consistent then userspace and kernel does not agree
...@@ -1380,6 +1391,18 @@ static int do_mhi_entry(const char *filename, void *symval, char *alias) ...@@ -1380,6 +1391,18 @@ static int do_mhi_entry(const char *filename, void *symval, char *alias)
return 1; return 1;
} }
/* Looks like: ishtp:{guid} */
static int do_ishtp_entry(const char *filename, void *symval, char *alias)
{
DEF_FIELD(symval, ishtp_device_id, guid);
strcpy(alias, ISHTP_MODULE_PREFIX "{");
add_guid(alias, guid);
strcat(alias, "}");
return 1;
}
static int do_auxiliary_entry(const char *filename, void *symval, char *alias) static int do_auxiliary_entry(const char *filename, void *symval, char *alias)
{ {
DEF_FIELD_ADDR(symval, auxiliary_device_id, name); DEF_FIELD_ADDR(symval, auxiliary_device_id, name);
...@@ -1499,6 +1522,7 @@ static const struct devtable devtable[] = { ...@@ -1499,6 +1522,7 @@ static const struct devtable devtable[] = {
{"auxiliary", SIZE_auxiliary_device_id, do_auxiliary_entry}, {"auxiliary", SIZE_auxiliary_device_id, do_auxiliary_entry},
{"ssam", SIZE_ssam_device_id, do_ssam_entry}, {"ssam", SIZE_ssam_device_id, do_ssam_entry},
{"dfl", SIZE_dfl_device_id, do_dfl_entry}, {"dfl", SIZE_dfl_device_id, do_dfl_entry},
{"ishtp", SIZE_ishtp_device_id, do_ishtp_entry},
}; };
/* Create MODULE_ALIAS() statements. /* Create MODULE_ALIAS() statements.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment