Merge branch 'for-4.1/sensor-hub' into for-linus
authorJiri Kosina <jkosina@suse.cz>
Mon, 13 Apr 2015 21:43:34 +0000 (23:43 +0200)
committerJiri Kosina <jkosina@suse.cz>
Mon, 13 Apr 2015 21:43:34 +0000 (23:43 +0200)
Conflicts:
drivers/iio/common/hid-sensors/hid-sensor-trigger.c
include/linux/hid-sensor-hub.h

12 files changed:
1  2 
drivers/hid/Kconfig
drivers/hid/Makefile
drivers/hid/hid-sensor-hub.c
drivers/iio/accel/hid-sensor-accel-3d.c
drivers/iio/common/hid-sensors/hid-sensor-trigger.c
drivers/iio/gyro/hid-sensor-gyro-3d.c
drivers/iio/light/hid-sensor-als.c
drivers/iio/light/hid-sensor-prox.c
drivers/iio/magnetometer/hid-sensor-magn-3d.c
drivers/iio/orientation/hid-sensor-incl-3d.c
drivers/iio/pressure/hid-sensor-press.c
include/linux/hid-sensor-hub.h

Simple merge
Simple merge
index e54ce1097e2cc57f5049cf852016087a32534c47,ecdcb5ac91f92ae97386931a9e4a6361238544e2..c3f6f1e311ea0d98da6981669e292e085552a927
@@@ -135,11 -116,11 +116,12 @@@ static struct hid_sensor_hub_callbacks 
  {
        struct hid_sensor_hub_callbacks_list *callback;
        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)
-               if (callback->usage_id == usage_id &&
+               if ((callback->usage_id == usage_id ||
+                    callback->usage_id == HID_USAGE_SENSOR_COLLECTION) &&
                        (collection_index >=
                                callback->hsdev->start_collection_index) &&
                        (collection_index <
index 2f1d535b94c45d08a1824f17081466bace1ea14a,910e82a7d06ef750166882256a1a13697693476a..610fc98f88efa4f05fd996505f45411756a50fb1
@@@ -80,11 -77,8 +81,11 @@@ static int _hid_sensor_power_state(stru
        }
  
        sensor_hub_get_feature(st->hsdev, st->power_state.report_id,
-                                       st->power_state.index,
-                                       &state_val);
+                              st->power_state.index,
+                              sizeof(state_val), &state_val);
 +      if (state && poll_value)
 +              msleep_interruptible(poll_value * 2);
 +
        return 0;
  }
  EXPORT_SYMBOL(hid_sensor_power_state);
Simple merge
Simple merge
Simple merge
index 4173a8fdad9efd052870b8738547ac1fa1962526,4a2fdbabfcf1f554c77b7ed52c9ef5c02f2214bc..0408421d885f9433c61149e2769bdd3c08192522
@@@ -152,21 -173,29 +176,30 @@@ int sensor_hub_input_get_attribute_info
  * @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.
@@@ -176,16 -205,17 +209,18 @@@ int sensor_hub_set_feature(struct hid_s
  
  /**
  * 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 */