aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/hid-sensor-hub.h
diff options
context:
space:
mode:
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>2015-02-19 18:31:25 -0500
committerJiri Kosina <jkosina@suse.cz>2015-02-23 09:11:38 -0500
commite651a1da442ae02a50081e38309dea5e89da2d41 (patch)
treed4871274ef43f665a473a2a076b4c43343b5465b /include/linux/hid-sensor-hub.h
parent870fd0f5df4e131467612cc46db46fc3b69fd706 (diff)
HID: hid-sensor-hub: Allow parallel synchronous reads
Current implementation only allows one outstanding synchronous read. This is a performance hit when user mode is requesting raw reads of sensor attributes on multiple sensors together. This change changes the mutex lock to per hid sensor hub device instead of global lock. Although request to hid sensor hub is serialized, there can be multiple outstanding read requests pending for responses via hid reports. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'include/linux/hid-sensor-hub.h')
-rw-r--r--include/linux/hid-sensor-hub.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h
index 51f7ccadf923..60a34277ddf2 100644
--- a/include/linux/hid-sensor-hub.h
+++ b/include/linux/hid-sensor-hub.h
@@ -47,19 +47,43 @@ struct hid_sensor_hub_attribute_info {
47}; 47};
48 48
49/** 49/**
50 * struct sensor_hub_pending - Synchronous read pending information
51 * @status: Pending status true/false.
52 * @ready: Completion synchronization data.
53 * @usage_id: Usage id for physical device, E.g. Gyro usage id.
54 * @attr_usage_id: Usage Id of a field, E.g. X-AXIS for a gyro.
55 * @raw_size: Response size for a read request.
56 * @raw_data: Place holder for received response.
57 */
58struct sensor_hub_pending {
59 bool status;
60 struct completion ready;
61 u32 usage_id;
62 u32 attr_usage_id;
63 int raw_size;
64 u8 *raw_data;
65};
66
67/**
50 * struct hid_sensor_hub_device - Stores the hub instance data 68 * struct hid_sensor_hub_device - Stores the hub instance data
51 * @hdev: Stores the hid instance. 69 * @hdev: Stores the hid instance.
52 * @vendor_id: Vendor id of hub device. 70 * @vendor_id: Vendor id of hub device.
53 * @product_id: Product id of hub device. 71 * @product_id: Product id of hub device.
72 * @usage: Usage id for this hub device instance.
54 * @start_collection_index: Starting index for a phy type collection 73 * @start_collection_index: Starting index for a phy type collection
55 * @end_collection_index: Last index for a phy type collection 74 * @end_collection_index: Last index for a phy type collection
75 * @mutex: synchronizing mutex.
76 * @pending: Holds information of pending sync read request.
56 */ 77 */
57struct hid_sensor_hub_device { 78struct hid_sensor_hub_device {
58 struct hid_device *hdev; 79 struct hid_device *hdev;
59 u32 vendor_id; 80 u32 vendor_id;
60 u32 product_id; 81 u32 product_id;
82 u32 usage;
61 int start_collection_index; 83 int start_collection_index;
62 int end_collection_index; 84 int end_collection_index;
85 struct mutex mutex;
86 struct sensor_hub_pending pending;
63}; 87};
64 88
65/** 89/**