diff options
Diffstat (limited to 'drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c')
-rw-r--r-- | drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c index 1bc6efa47316..c62cacc04672 100644 --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c @@ -177,12 +177,11 @@ static ssize_t hwfifo_watermark_max_show(struct device *dev, static IIO_DEVICE_ATTR_RO(hwfifo_watermark_max, 0); -const struct attribute *cros_ec_sensor_fifo_attributes[] = { +static const struct attribute *cros_ec_sensor_fifo_attributes[] = { &iio_dev_attr_hwfifo_timeout.dev_attr.attr, &iio_dev_attr_hwfifo_watermark_max.dev_attr.attr, NULL, }; -EXPORT_SYMBOL_GPL(cros_ec_sensor_fifo_attributes); int cros_ec_sensors_push_data(struct iio_dev *indio_dev, s16 *data, @@ -241,6 +240,7 @@ static void cros_ec_sensors_core_clean(void *arg) * for backward compatibility. * @push_data: function to call when cros_ec_sensorhub receives * a sample for that sensor. + * @has_hw_fifo: Set true if this device has/uses a HW FIFO * * Return: 0 on success, -errno on failure. */ @@ -248,7 +248,8 @@ int cros_ec_sensors_core_init(struct platform_device *pdev, struct iio_dev *indio_dev, bool physical_device, cros_ec_sensors_capture_t trigger_capture, - cros_ec_sensorhub_push_data_cb_t push_data) + cros_ec_sensorhub_push_data_cb_t push_data, + bool has_hw_fifo) { struct device *dev = &pdev->dev; struct cros_ec_sensors_core_state *state = iio_priv(indio_dev); @@ -361,6 +362,10 @@ int cros_ec_sensors_core_init(struct platform_device *pdev, NULL); if (ret) return ret; + + if (has_hw_fifo) + iio_buffer_set_attrs(indio_dev->buffer, + cros_ec_sensor_fifo_attributes); } } |