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 | 16 |
1 files changed, 12 insertions, 4 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 ea480c1d4349..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 @@ -72,10 +72,13 @@ static void get_default_min_max_freq(enum motionsensor_type type, switch (type) { case MOTIONSENSE_TYPE_ACCEL: - case MOTIONSENSE_TYPE_GYRO: *min_freq = 12500; *max_freq = 100000; break; + case MOTIONSENSE_TYPE_GYRO: + *min_freq = 25000; + *max_freq = 100000; + break; case MOTIONSENSE_TYPE_MAG: *min_freq = 5000; *max_freq = 25000; @@ -174,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, @@ -238,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. */ @@ -245,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); @@ -358,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); } } |