mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-09 08:02:05 +00:00
Merge branch 'for-4.1/sensor-hub' into for-linus
Conflicts: drivers/iio/common/hid-sensors/hid-sensor-trigger.c include/linux/hid-sensor-hub.h
This commit is contained in:
commit
2e455c27bd
17 changed files with 1153 additions and 109 deletions
|
@ -48,20 +48,44 @@ struct hid_sensor_hub_attribute_info {
|
|||
s32 logical_maximum;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct sensor_hub_pending - Synchronous read pending information
|
||||
* @status: Pending status true/false.
|
||||
* @ready: Completion synchronization data.
|
||||
* @usage_id: Usage id for physical device, E.g. Gyro usage id.
|
||||
* @attr_usage_id: Usage Id of a field, E.g. X-AXIS for a gyro.
|
||||
* @raw_size: Response size for a read request.
|
||||
* @raw_data: Place holder for received response.
|
||||
*/
|
||||
struct sensor_hub_pending {
|
||||
bool status;
|
||||
struct completion ready;
|
||||
u32 usage_id;
|
||||
u32 attr_usage_id;
|
||||
int raw_size;
|
||||
u8 *raw_data;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct hid_sensor_hub_device - Stores the hub instance data
|
||||
* @hdev: Stores the hid instance.
|
||||
* @vendor_id: Vendor id of hub device.
|
||||
* @product_id: Product id of hub device.
|
||||
* @usage: Usage id for this hub device instance.
|
||||
* @start_collection_index: Starting index for a phy type collection
|
||||
* @end_collection_index: Last index for a phy type collection
|
||||
* @mutex: synchronizing mutex.
|
||||
* @pending: Holds information of pending sync read request.
|
||||
*/
|
||||
struct hid_sensor_hub_device {
|
||||
struct hid_device *hdev;
|
||||
u32 vendor_id;
|
||||
u32 product_id;
|
||||
u32 usage;
|
||||
int start_collection_index;
|
||||
int end_collection_index;
|
||||
struct mutex mutex;
|
||||
struct sensor_hub_pending pending;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -152,40 +176,51 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
|
|||
* @usage_id: Attribute usage id of parent physical device as per spec
|
||||
* @attr_usage_id: Attribute usage id as per spec
|
||||
* @report_id: Report id to look for
|
||||
* @flag: Synchronous or asynchronous read
|
||||
*
|
||||
* Issues a synchronous read request for an input attribute. Returns
|
||||
* data upto 32 bits. Since client can get events, so this call should
|
||||
* not be used for data paths, this will impact performance.
|
||||
* Issues a synchronous or asynchronous read request for an input attribute.
|
||||
* Returns data upto 32 bits.
|
||||
*/
|
||||
|
||||
enum sensor_hub_read_flags {
|
||||
SENSOR_HUB_SYNC,
|
||||
SENSOR_HUB_ASYNC,
|
||||
};
|
||||
|
||||
int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev,
|
||||
u32 usage_id,
|
||||
u32 attr_usage_id, u32 report_id);
|
||||
u32 usage_id,
|
||||
u32 attr_usage_id, u32 report_id,
|
||||
enum sensor_hub_read_flags flag
|
||||
);
|
||||
|
||||
/**
|
||||
* sensor_hub_set_feature() - Feature set request
|
||||
* @hsdev: Hub device instance.
|
||||
* @report_id: Report id to look for
|
||||
* @field_index: Field index inside a report
|
||||
* @value: Value to set
|
||||
* @buffer_size: size of the buffer
|
||||
* @buffer: buffer to use in the feature set
|
||||
*
|
||||
* Used to set a field in feature report. For example this can set polling
|
||||
* interval, sensitivity, activate/deactivate state.
|
||||
*/
|
||||
int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
|
||||
u32 field_index, s32 value);
|
||||
u32 field_index, int buffer_size, void *buffer);
|
||||
|
||||
/**
|
||||
* sensor_hub_get_feature() - Feature get request
|
||||
* @hsdev: Hub device instance.
|
||||
* @report_id: Report id to look for
|
||||
* @field_index: Field index inside a report
|
||||
* @value: Place holder for return value
|
||||
* @buffer_size: size of the buffer
|
||||
* @buffer: buffer to copy output
|
||||
*
|
||||
* Used to get a field in feature report. For example this can get polling
|
||||
* interval, sensitivity, activate/deactivate state.
|
||||
* interval, sensitivity, activate/deactivate state. On success it returns
|
||||
* number of bytes copied to buffer. On failure, it returns value < 0.
|
||||
*/
|
||||
int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
|
||||
u32 field_index, s32 *value);
|
||||
u32 field_index, int buffer_size, void *buffer);
|
||||
|
||||
/* hid-sensor-attributes */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue