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
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
16enum {17enum {
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
36typedef 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 driver39 * struct cros_ec_sensors_core_state - state data for EC sensors IIO driver
37 * @ec: cros EC device structure40 * @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
88struct platform_device;91struct platform_device;
89int cros_ec_sensors_core_init(struct platform_device *pdev,92int 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
92irqreturn_t cros_ec_sensors_capture(int irq, void *p);97irqreturn_t cros_ec_sensors_capture(int irq, void *p);
98int cros_ec_sensors_push_data(struct iio_dev *indio_dev,
99 s16 *data,
100 s64 timestamp);
93 101
94int cros_ec_motion_send_host_cmd(struct cros_ec_sensors_core_state *st,102int cros_ec_motion_send_host_cmd(struct cros_ec_sensors_core_state *st,
95 u16 opt_length);103 u16 opt_length);