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.
Showing the changes to include/linux (1 of 7 files). Show all
Unified · Split
| @@ -12,6 +12,7 @@ · 11 unmodified lines | |||
| 12 | #include <linux/irqreturn.h> | 12 | #include <linux/irqreturn.h> |
| 13 | #include <linux/platform_data/cros_ec_commands.h> | 13 | #include <linux/platform_data/cros_ec_commands.h> |
| 14 | #include <linux/platform_data/cros_ec_proto.h> | 14 | #include <linux/platform_data/cros_ec_proto.h> |
| 15 | #include <linux/platform_data/cros_ec_sensorhub.h> | ||
| 15 | 16 | ||
| 16 | enum { | 17 | enum { |
| 17 | CROS_EC_SENSOR_X, | 18 | CROS_EC_SENSOR_X, |
| @@ -32,6 +33,8 @@ enum { · 14 unmodified lines | |||
| 32 | /* Minimum sampling period to use when device is suspending */ | 33 | /* Minimum sampling period to use when device is suspending */ |
| 33 | #define CROS_EC_MIN_SUSPEND_SAMPLING_FREQUENCY 1000 /* 1 second */ | 34 | #define CROS_EC_MIN_SUSPEND_SAMPLING_FREQUENCY 1000 /* 1 second */ |
| 34 | 35 | ||
| 36 | typedef irqreturn_t (*cros_ec_sensors_capture_t)(int irq, void *p); | ||
| 37 | |||
| 35 | /** | 38 | /** |
| 36 | * struct cros_ec_sensors_core_state - state data for EC sensors IIO driver | 39 | * struct cros_ec_sensors_core_state - state data for EC sensors IIO driver |
| 37 | * @ec: cros EC device structure | 40 | * @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 | |||
| 87 | 90 | ||
| 88 | struct platform_device; | 91 | struct platform_device; |
| 89 | int cros_ec_sensors_core_init(struct platform_device *pdev, | 92 | 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); | ||
| 91 | 96 | ||
| 92 | irqreturn_t cros_ec_sensors_capture(int irq, void *p); | 97 | 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); | ||
| 93 | 101 | ||
| 94 | int cros_ec_motion_send_host_cmd(struct cros_ec_sensors_core_state *st, | 102 | int cros_ec_motion_send_host_cmd(struct cros_ec_sensors_core_state *st, |
| 95 | u16 opt_length); | 103 | u16 opt_length); |