History

iio: cros_ec: Register to cros_ec_sensorhub when EC supports FIFO

When EC supports FIFO, each IIO device registers a callback, to put samples in the buffer when they arrives from the FIFO. When no FIFO, the user space app needs to call trigger_new, or better register a high precision timer.

Gwendal Grignou committed 6 years ago

Commit aa984f11 parent 69f07937 files · +119 −29Browse files

Showing the changes to include/linux (1 of 7 files). Show all

Unified · Split

include/linux/iio/common/cros_ec_sensors_core.h+9−1
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #include <linux/irqreturn.h>
1313 #include <linux/platform_data/cros_ec_commands.h>
1414 #include <linux/platform_data/cros_ec_proto.h>
15+#include <linux/platform_data/cros_ec_sensorhub.h>
1516
1617 enum {
1718 CROS_EC_SENSOR_X,
@@ -32,6 +33,8 @@ enum { · 14 unmodified lines
3233 /* Minimum sampling period to use when device is suspending */
3334 #define CROS_EC_MIN_SUSPEND_SAMPLING_FREQUENCY 1000 /* 1 second */
3435
36+typedef irqreturn_t (*cros_ec_sensors_capture_t)(int irq, void *p);
37+
3538 /**
3639 * struct cros_ec_sensors_core_state - state data for EC sensors IIO driver
3740 * @ec: cros EC device structure
@@ -87,9 +90,14 @@ int cros_ec_sensors_read_cmd(struct iio_dev *indio_dev, unsigned long scan_mask, · 49 unmodified lines
8790
8891 struct platform_device;
8992 int cros_ec_sensors_core_init(struct platform_device *pdev,
90− struct iio_dev *indio_dev, bool physical_device);
93+ struct iio_dev *indio_dev, bool physical_device,
94+ cros_ec_sensors_capture_t trigger_capture,
95+ cros_ec_sensorhub_push_data_cb_t push_data);
9196
9297 irqreturn_t cros_ec_sensors_capture(int irq, void *p);
98+int cros_ec_sensors_push_data(struct iio_dev *indio_dev,
99+ s16 *data,
100+ s64 timestamp);
93101
94102 int cros_ec_motion_send_host_cmd(struct cros_ec_sensors_core_state *st,
95103 u16 opt_length);