diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-23 08:58:23 +0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-23 08:58:23 +0400 |
commit | 4988abf1749241bc80600a6b3283d03898d2717c (patch) | |
tree | 9660d892d024b8df5b685f3724ed50afdeed77b2 /drivers/hid/hid-sensor-hub.c | |
parent | fe41c2c018b8af9b370a40845f547e22894ff68a (diff) | |
parent | 62813858fb5d1fb661433d7884668aa111115a35 (diff) | |
download | linux-4988abf1749241bc80600a6b3283d03898d2717c.tar.xz |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Pull HID updates from Jiri Kosina:
- quite some work on hid-sony driver in order to have DualShock 4
device properly supported, from Frank Praznik
- fixed support for suspending I2C conntected devices, from Mika
Westerberg
- regression fix for 0xff05 usage on Microsoft Ergonomy, from Jiri
Kosina
- support for Synaptics HD touchscreen, from AceLan Kao
- workaround for USB 3.0 problem for logitech-dj connected devices,
from Benjamin Tisssoires
- support for Logitech Dual Action pads, from Vitaly Katraew
- quite a few other assorted fixes and device ID additions
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (33 commits)
HID: sony: Use colors for the Dualshock 4 LED names
HID: sony: Add annotated HID descriptor for the Dualshock 4
HID: sony: Cache the output report for the Dualshock 4
HID: sony: Map gyroscopes and accelerometers to axes
HID: sony: Fix spacing in the device definitions.
HID: sony: Use standard output reports instead of raw reports to send data to the Dualshock 4.
HID: sony: Use separate identifiers for USB and Bluetooth connected Dualshock 4 controllers.
HID: hid-holtek-mouse: add new a070 mouse
HID: hid-sensor-hub: Fix buggy report descriptors
HID: logitech-dj: Fix USB 3.0 issue
HID: sony: Rename worker function
HID: sony: Add LED controls for the Dualshock 4
HID: sony: Add force-feedback support for the Dualshock 4
HID: hidraw: make comment more accurate and nicer
HID: sony: fix error return code
HID: input: fix input sysfs path for hid devices
HID: debug: add labels for some new buttons
HID: remove SIS entries from hid_have_special_driver[]
HID: microsoft: no fallthrough in MS ergonomy 0xff05 usage
HID: add support for SiS multitouch panel in the touch monitor LG 23ET83V
...
Diffstat (limited to 'drivers/hid/hid-sensor-hub.c')
-rw-r--r-- | drivers/hid/hid-sensor-hub.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index 8fab82829f8b..46f4480035bc 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c @@ -26,6 +26,8 @@ #include <linux/hid-sensor-hub.h> #include "hid-ids.h" +#define HID_SENSOR_HUB_ENUM_QUIRK 0x01 + /** * struct sensor_hub_pending - Synchronous read pending information * @status: Pending status true/false. @@ -64,6 +66,7 @@ struct sensor_hub_data { spinlock_t dyn_callback_lock; struct mfd_cell *hid_sensor_hub_client_devs; int hid_sensor_client_cnt; + unsigned long quirks; }; /** @@ -497,6 +500,40 @@ void sensor_hub_device_close(struct hid_sensor_hub_device *hsdev) } EXPORT_SYMBOL_GPL(sensor_hub_device_close); +static __u8 *sensor_hub_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int *rsize) +{ + int index; + struct sensor_hub_data *sd = hid_get_drvdata(hdev); + unsigned char report_block[] = { + 0x0a, 0x16, 0x03, 0x15, 0x00, 0x25, 0x05}; + unsigned char power_block[] = { + 0x0a, 0x19, 0x03, 0x15, 0x00, 0x25, 0x05}; + + if (!(sd->quirks & HID_SENSOR_HUB_ENUM_QUIRK)) { + hid_dbg(hdev, "No Enum quirks\n"); + return rdesc; + } + + /* Looks for power and report state usage id and force to 1 */ + for (index = 0; index < *rsize; ++index) { + if (((*rsize - index) > sizeof(report_block)) && + !memcmp(&rdesc[index], report_block, + sizeof(report_block))) { + rdesc[index + 4] = 0x01; + index += sizeof(report_block); + } + if (((*rsize - index) > sizeof(power_block)) && + !memcmp(&rdesc[index], power_block, + sizeof(power_block))) { + rdesc[index + 4] = 0x01; + index += sizeof(power_block); + } + } + + return rdesc; +} + static int sensor_hub_probe(struct hid_device *hdev, const struct hid_device_id *id) { @@ -520,6 +557,7 @@ static int sensor_hub_probe(struct hid_device *hdev, return -ENOMEM; } hid_set_drvdata(hdev, sd); + sd->quirks = id->driver_data; sd->hsdev->hdev = hdev; sd->hsdev->vendor_id = hdev->vendor; sd->hsdev->product_id = hdev->product; @@ -621,6 +659,12 @@ static void sensor_hub_remove(struct hid_device *hdev) } static const struct hid_device_id sensor_hub_devices[] = { + { HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, USB_VENDOR_ID_INTEL_0, + USB_DEVICE_ID_INTEL_HID_SENSOR), + .driver_data = HID_SENSOR_HUB_ENUM_QUIRK}, + { HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, USB_VENDOR_ID_INTEL_1, + USB_DEVICE_ID_INTEL_HID_SENSOR), + .driver_data = HID_SENSOR_HUB_ENUM_QUIRK}, { HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, HID_ANY_ID, HID_ANY_ID) }, { } @@ -633,6 +677,7 @@ static struct hid_driver sensor_hub_driver = { .probe = sensor_hub_probe, .remove = sensor_hub_remove, .raw_event = sensor_hub_raw_event, + .report_fixup = sensor_hub_report_fixup, #ifdef CONFIG_PM .suspend = sensor_hub_suspend, .resume = sensor_hub_resume, |