Commit ded75664 authored by Jiri Kosina's avatar Jiri Kosina

Merge branch 'for-3.15/hid-sensor-hub' into for-linus

parents ad295b6d ca2ed12f
This diff is collapsed.
...@@ -38,29 +38,40 @@ static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig, ...@@ -38,29 +38,40 @@ static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig,
if (state) { if (state) {
if (sensor_hub_device_open(st->hsdev)) if (sensor_hub_device_open(st->hsdev))
return -EIO; return -EIO;
state_val = state_val = hid_sensor_get_usage_index(st->hsdev,
HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM; st->power_state.report_id,
report_val = st->power_state.index,
HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM; HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM);
report_val = hid_sensor_get_usage_index(st->hsdev,
st->report_state.report_id,
st->report_state.index,
HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM);
} else { } else {
sensor_hub_device_close(st->hsdev); sensor_hub_device_close(st->hsdev);
state_val = state_val = hid_sensor_get_usage_index(st->hsdev,
HID_USAGE_SENSOR_PROP_POWER_STATE_D4_POWER_OFF_ENUM; st->power_state.report_id,
report_val = st->power_state.index,
HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM; HID_USAGE_SENSOR_PROP_POWER_STATE_D4_POWER_OFF_ENUM);
report_val = hid_sensor_get_usage_index(st->hsdev,
st->report_state.report_id,
st->report_state.index,
HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM);
} }
st->data_ready = state; st->data_ready = state;
state_val += st->power_state.logical_minimum;
report_val += st->report_state.logical_minimum; if (state_val >= 0) {
sensor_hub_set_feature(st->hsdev, st->power_state.report_id, state_val += st->power_state.logical_minimum;
sensor_hub_set_feature(st->hsdev, st->power_state.report_id,
st->power_state.index, st->power_state.index,
(s32)state_val); (s32)state_val);
}
sensor_hub_set_feature(st->hsdev, st->report_state.report_id, if (report_val >= 0) {
report_val += st->report_state.logical_minimum;
sensor_hub_set_feature(st->hsdev, st->report_state.report_id,
st->report_state.index, st->report_state.index,
(s32)report_val); (s32)report_val);
}
return 0; return 0;
} }
......
...@@ -51,13 +51,15 @@ struct hid_sensor_hub_attribute_info { ...@@ -51,13 +51,15 @@ struct hid_sensor_hub_attribute_info {
* @hdev: Stores the hid instance. * @hdev: Stores the hid instance.
* @vendor_id: Vendor id of hub device. * @vendor_id: Vendor id of hub device.
* @product_id: Product id of hub device. * @product_id: Product id of hub device.
* @ref_cnt: Number of MFD clients have opened this device * @start_collection_index: Starting index for a phy type collection
* @end_collection_index: Last index for a phy type collection
*/ */
struct hid_sensor_hub_device { struct hid_sensor_hub_device {
struct hid_device *hdev; struct hid_device *hdev;
u32 vendor_id; u32 vendor_id;
u32 product_id; u32 product_id;
int ref_cnt; int start_collection_index;
int end_collection_index;
}; };
/** /**
...@@ -218,4 +220,7 @@ int hid_sensor_write_samp_freq_value(struct hid_sensor_common *st, ...@@ -218,4 +220,7 @@ int hid_sensor_write_samp_freq_value(struct hid_sensor_common *st,
int hid_sensor_read_samp_freq_value(struct hid_sensor_common *st, int hid_sensor_read_samp_freq_value(struct hid_sensor_common *st,
int *val1, int *val2); int *val1, int *val2);
int hid_sensor_get_usage_index(struct hid_sensor_hub_device *hsdev,
u32 report_id, int field_index, u32 usage_id);
#endif #endif
...@@ -130,15 +130,15 @@ ...@@ -130,15 +130,15 @@
#define HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS 0x1000 #define HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS 0x1000
/* Power state enumerations */ /* Power state enumerations */
#define HID_USAGE_SENSOR_PROP_POWER_STATE_UNDEFINED_ENUM 0x00 #define HID_USAGE_SENSOR_PROP_POWER_STATE_UNDEFINED_ENUM 0x200850
#define HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM 0x01 #define HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM 0x200851
#define HID_USAGE_SENSOR_PROP_POWER_STATE_D1_LOW_POWER_ENUM 0x02 #define HID_USAGE_SENSOR_PROP_POWER_STATE_D1_LOW_POWER_ENUM 0x200852
#define HID_USAGE_SENSOR_PROP_POWER_STATE_D2_STANDBY_WITH_WAKE_ENUM 0x03 #define HID_USAGE_SENSOR_PROP_POWER_STATE_D2_STANDBY_WITH_WAKE_ENUM 0x200853
#define HID_USAGE_SENSOR_PROP_POWER_STATE_D3_SLEEP_WITH_WAKE_ENUM 0x04 #define HID_USAGE_SENSOR_PROP_POWER_STATE_D3_SLEEP_WITH_WAKE_ENUM 0x200854
#define HID_USAGE_SENSOR_PROP_POWER_STATE_D4_POWER_OFF_ENUM 0x05 #define HID_USAGE_SENSOR_PROP_POWER_STATE_D4_POWER_OFF_ENUM 0x200855
/* Report State enumerations */ /* Report State enumerations */
#define HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM 0x00 #define HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM 0x200840
#define HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM 0x01 #define HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM 0x200841
#endif #endif
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