Commit c4bbb398 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull HID fixes from Jiri Kosina:

 - a few fixes to Sony driver (rmmod breakage, spinlock initialization),
   by Antonio Ospite, Frank Praznik and Jiri Kosina

 - fix for wMaxInputLength handling regression in i2c-hid, by Seth
   Forshee

 - IRQ safety spinlock fix in sensor hub driver, by Srinivas Pandruvada

 - IRQ level sensitivity fix to i2c-hid to be compliant with the spec,
   by Mika Westerberg

 - a couple device ID additions piggy-backing on top of that

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
  HID: microsoft: Add ID for NE7K wireless keyboard
  HID: i2c-hid: Limit reads to wMaxInputLength bytes for input events
  HID: sony: fix uninitialized per-controller spinlock
  HID: sony: initialize sony_dev_list_lock properly
  HID: sony: Fix a WARNING shown when rmmod-ing the driver
  HID: sensor-hub: correct dyn_callback_lock IRQ-safe change
  HID: hid-sensor-hub: Correct documentation
  HID: saitek: add USB ID for older R.A.T. 7
  HID: i2c-hid: The interrupt should be level sensitive
  HID: wacom: Add missing ABS_MISC event and feature declaration for 27QHD
parents c517d838 ef567cf9
...@@ -1872,6 +1872,7 @@ static const struct hid_device_id hid_have_special_driver[] = { ...@@ -1872,6 +1872,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE7K) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) },
...@@ -1926,6 +1927,7 @@ static const struct hid_device_id hid_have_special_driver[] = { ...@@ -1926,6 +1927,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
#endif #endif
#if IS_ENABLED(CONFIG_HID_SAITEK) #if IS_ENABLED(CONFIG_HID_SAITEK)
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) }, { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) },
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7_OLD) },
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7) }, { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7) },
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7) }, { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9) }, { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9) },
......
...@@ -654,6 +654,7 @@ ...@@ -654,6 +654,7 @@
#define USB_DEVICE_ID_MS_LK6K 0x00f9 #define USB_DEVICE_ID_MS_LK6K 0x00f9
#define USB_DEVICE_ID_MS_PRESENTER_8K_BT 0x0701 #define USB_DEVICE_ID_MS_PRESENTER_8K_BT 0x0701
#define USB_DEVICE_ID_MS_PRESENTER_8K_USB 0x0713 #define USB_DEVICE_ID_MS_PRESENTER_8K_USB 0x0713
#define USB_DEVICE_ID_MS_NE7K 0x071d
#define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K 0x0730 #define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K 0x0730
#define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500 0x076c #define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500 0x076c
#define USB_DEVICE_ID_MS_SURFACE_PRO_2 0x0799 #define USB_DEVICE_ID_MS_SURFACE_PRO_2 0x0799
...@@ -802,6 +803,7 @@ ...@@ -802,6 +803,7 @@
#define USB_VENDOR_ID_SAITEK 0x06a3 #define USB_VENDOR_ID_SAITEK 0x06a3
#define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17
#define USB_DEVICE_ID_SAITEK_PS1000 0x0621 #define USB_DEVICE_ID_SAITEK_PS1000 0x0621
#define USB_DEVICE_ID_SAITEK_RAT7_OLD 0x0ccb
#define USB_DEVICE_ID_SAITEK_RAT7 0x0cd7 #define USB_DEVICE_ID_SAITEK_RAT7 0x0cd7
#define USB_DEVICE_ID_SAITEK_MMO7 0x0cd0 #define USB_DEVICE_ID_SAITEK_MMO7 0x0cd0
......
...@@ -264,6 +264,8 @@ static const struct hid_device_id ms_devices[] = { ...@@ -264,6 +264,8 @@ static const struct hid_device_id ms_devices[] = {
.driver_data = MS_ERGONOMY }, .driver_data = MS_ERGONOMY },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP), { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP),
.driver_data = MS_ERGONOMY }, .driver_data = MS_ERGONOMY },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE7K),
.driver_data = MS_ERGONOMY },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K), { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K),
.driver_data = MS_ERGONOMY | MS_RDESC }, .driver_data = MS_ERGONOMY | MS_RDESC },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB), { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB),
......
...@@ -177,6 +177,8 @@ static int saitek_event(struct hid_device *hdev, struct hid_field *field, ...@@ -177,6 +177,8 @@ static int saitek_event(struct hid_device *hdev, struct hid_field *field,
static const struct hid_device_id saitek_devices[] = { static const struct hid_device_id saitek_devices[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000), { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000),
.driver_data = SAITEK_FIX_PS1000 }, .driver_data = SAITEK_FIX_PS1000 },
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7_OLD),
.driver_data = SAITEK_RELEASE_MODE_RAT7 },
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7), { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7),
.driver_data = SAITEK_RELEASE_MODE_RAT7 }, .driver_data = SAITEK_RELEASE_MODE_RAT7 },
{ HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9), { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9),
......
...@@ -135,8 +135,9 @@ static struct hid_sensor_hub_callbacks *sensor_hub_get_callback( ...@@ -135,8 +135,9 @@ static struct hid_sensor_hub_callbacks *sensor_hub_get_callback(
{ {
struct hid_sensor_hub_callbacks_list *callback; struct hid_sensor_hub_callbacks_list *callback;
struct sensor_hub_data *pdata = hid_get_drvdata(hdev); struct sensor_hub_data *pdata = hid_get_drvdata(hdev);
unsigned long flags;
spin_lock(&pdata->dyn_callback_lock); spin_lock_irqsave(&pdata->dyn_callback_lock, flags);
list_for_each_entry(callback, &pdata->dyn_callback_list, list) list_for_each_entry(callback, &pdata->dyn_callback_list, list)
if (callback->usage_id == usage_id && if (callback->usage_id == usage_id &&
(collection_index >= (collection_index >=
...@@ -145,10 +146,11 @@ static struct hid_sensor_hub_callbacks *sensor_hub_get_callback( ...@@ -145,10 +146,11 @@ static struct hid_sensor_hub_callbacks *sensor_hub_get_callback(
callback->hsdev->end_collection_index)) { callback->hsdev->end_collection_index)) {
*priv = callback->priv; *priv = callback->priv;
*hsdev = callback->hsdev; *hsdev = callback->hsdev;
spin_unlock(&pdata->dyn_callback_lock); spin_unlock_irqrestore(&pdata->dyn_callback_lock,
flags);
return callback->usage_callback; return callback->usage_callback;
} }
spin_unlock(&pdata->dyn_callback_lock); spin_unlock_irqrestore(&pdata->dyn_callback_lock, flags);
return NULL; return NULL;
} }
......
...@@ -804,7 +804,7 @@ union sixaxis_output_report_01 { ...@@ -804,7 +804,7 @@ union sixaxis_output_report_01 {
#define DS4_REPORT_0x81_SIZE 7 #define DS4_REPORT_0x81_SIZE 7
#define SIXAXIS_REPORT_0xF2_SIZE 18 #define SIXAXIS_REPORT_0xF2_SIZE 18
static spinlock_t sony_dev_list_lock; static DEFINE_SPINLOCK(sony_dev_list_lock);
static LIST_HEAD(sony_device_list); static LIST_HEAD(sony_device_list);
static DEFINE_IDA(sony_device_id_allocator); static DEFINE_IDA(sony_device_id_allocator);
...@@ -1944,6 +1944,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) ...@@ -1944,6 +1944,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
return -ENOMEM; return -ENOMEM;
} }
spin_lock_init(&sc->lock);
sc->quirks = quirks; sc->quirks = quirks;
hid_set_drvdata(hdev, sc); hid_set_drvdata(hdev, sc);
sc->hdev = hdev; sc->hdev = hdev;
...@@ -2147,8 +2149,8 @@ static void __exit sony_exit(void) ...@@ -2147,8 +2149,8 @@ static void __exit sony_exit(void)
{ {
dbg_hid("Sony:%s\n", __func__); dbg_hid("Sony:%s\n", __func__);
ida_destroy(&sony_device_id_allocator);
hid_unregister_driver(&sony_driver); hid_unregister_driver(&sony_driver);
ida_destroy(&sony_device_id_allocator);
} }
module_init(sony_init); module_init(sony_init);
module_exit(sony_exit); module_exit(sony_exit);
......
...@@ -370,7 +370,10 @@ static int i2c_hid_hwreset(struct i2c_client *client) ...@@ -370,7 +370,10 @@ static int i2c_hid_hwreset(struct i2c_client *client)
static void i2c_hid_get_input(struct i2c_hid *ihid) static void i2c_hid_get_input(struct i2c_hid *ihid)
{ {
int ret, ret_size; int ret, ret_size;
int size = ihid->bufsize; int size = le16_to_cpu(ihid->hdesc.wMaxInputLength);
if (size > ihid->bufsize)
size = ihid->bufsize;
ret = i2c_master_recv(ihid->client, ihid->inbuf, size); ret = i2c_master_recv(ihid->client, ihid->inbuf, size);
if (ret != size) { if (ret != size) {
...@@ -785,7 +788,7 @@ static int i2c_hid_init_irq(struct i2c_client *client) ...@@ -785,7 +788,7 @@ static int i2c_hid_init_irq(struct i2c_client *client)
dev_dbg(&client->dev, "Requesting IRQ: %d\n", client->irq); dev_dbg(&client->dev, "Requesting IRQ: %d\n", client->irq);
ret = request_threaded_irq(client->irq, NULL, i2c_hid_irq, ret = request_threaded_irq(client->irq, NULL, i2c_hid_irq,
IRQF_TRIGGER_FALLING | IRQF_ONESHOT, IRQF_TRIGGER_LOW | IRQF_ONESHOT,
client->name, ihid); client->name, ihid);
if (ret < 0) { if (ret < 0) {
dev_warn(&client->dev, dev_warn(&client->dev,
......
...@@ -778,6 +778,11 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) ...@@ -778,6 +778,11 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
input_report_abs(input, ABS_X, be16_to_cpup((__be16 *)&data[4])); input_report_abs(input, ABS_X, be16_to_cpup((__be16 *)&data[4]));
input_report_abs(input, ABS_Y, be16_to_cpup((__be16 *)&data[6])); input_report_abs(input, ABS_Y, be16_to_cpup((__be16 *)&data[6]));
input_report_abs(input, ABS_Z, be16_to_cpup((__be16 *)&data[8])); input_report_abs(input, ABS_Z, be16_to_cpup((__be16 *)&data[8]));
if ((data[2] & 0x07) | data[4] | data[5] | data[6] | data[7] | data[8] | data[9]) {
input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
} else {
input_report_abs(input, ABS_MISC, 0);
}
} else if (features->type == CINTIQ_HYBRID) { } else if (features->type == CINTIQ_HYBRID) {
/* /*
* Do not send hardware buttons under Android. They * Do not send hardware buttons under Android. They
...@@ -2725,9 +2730,9 @@ static const struct wacom_features wacom_features_0xF6 = ...@@ -2725,9 +2730,9 @@ static const struct wacom_features wacom_features_0xF6 =
.oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf8, .touch_max = 10, .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf8, .touch_max = 10,
.check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE };
static const struct wacom_features wacom_features_0x32A = static const struct wacom_features wacom_features_0x32A =
{ "Wacom Cintiq 27QHD", 119740, 67520, 2047, { "Wacom Cintiq 27QHD", 119740, 67520, 2047, 63,
63, WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET };
static const struct wacom_features wacom_features_0x32B = static const struct wacom_features wacom_features_0x32B =
{ "Wacom Cintiq 27QHD touch", 119740, 67520, 2047, 63, { "Wacom Cintiq 27QHD touch", 119740, 67520, 2047, 63,
WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
* @units: Measurment unit for this attribute. * @units: Measurment unit for this attribute.
* @unit_expo: Exponent used in the data. * @unit_expo: Exponent used in the data.
* @size: Size in bytes for data size. * @size: Size in bytes for data size.
* @logical_minimum: Logical minimum value for this attribute.
* @logical_maximum: Logical maximum value for this attribute.
*/ */
struct hid_sensor_hub_attribute_info { struct hid_sensor_hub_attribute_info {
u32 usage_id; u32 usage_id;
...@@ -146,6 +148,7 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev, ...@@ -146,6 +148,7 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
/** /**
* sensor_hub_input_attr_get_raw_value() - Synchronous read request * sensor_hub_input_attr_get_raw_value() - Synchronous read request
* @hsdev: Hub device instance.
* @usage_id: Attribute usage id of parent physical device as per spec * @usage_id: Attribute usage id of parent physical device as per spec
* @attr_usage_id: Attribute usage id as per spec * @attr_usage_id: Attribute usage id as per spec
* @report_id: Report id to look for * @report_id: Report id to look for
...@@ -160,6 +163,7 @@ int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev, ...@@ -160,6 +163,7 @@ int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev,
u32 attr_usage_id, u32 report_id); u32 attr_usage_id, u32 report_id);
/** /**
* sensor_hub_set_feature() - Feature set request * sensor_hub_set_feature() - Feature set request
* @hsdev: Hub device instance.
* @report_id: Report id to look for * @report_id: Report id to look for
* @field_index: Field index inside a report * @field_index: Field index inside a report
* @value: Value to set * @value: Value to set
...@@ -172,6 +176,7 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, ...@@ -172,6 +176,7 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
/** /**
* sensor_hub_get_feature() - Feature get request * sensor_hub_get_feature() - Feature get request
* @hsdev: Hub device instance.
* @report_id: Report id to look for * @report_id: Report id to look for
* @field_index: Field index inside a report * @field_index: Field index inside a report
* @value: Place holder for return value * @value: Place holder for return value
......
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