Эх сурвалжийг харах

iio: imu: st_lsm6dsx: convert max_fifo_size in FIFO sample size

Express max fifo depth in ST_LSM6DSX_SAMPLE_SIZE instead of in bytes.
That change will be necessary to properly support more devices
in st_lsm6dsx driver

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lorenzo Bianconi 8 жил өмнө
parent
commit
8f2a88a2b2

+ 5 - 6
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c

@@ -156,21 +156,21 @@ static const struct st_lsm6dsx_fs_table_entry st_lsm6dsx_fs_table[] = {
 static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
 static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
 	{
 	{
 		.wai = 0x69,
 		.wai = 0x69,
-		.max_fifo_size = 8192,
+		.max_fifo_size = 1365,
 		.id = {
 		.id = {
 			[0] = ST_LSM6DS3_ID,
 			[0] = ST_LSM6DS3_ID,
 		},
 		},
 	},
 	},
 	{
 	{
 		.wai = 0x69,
 		.wai = 0x69,
-		.max_fifo_size = 4096,
+		.max_fifo_size = 682,
 		.id = {
 		.id = {
 			[0] = ST_LSM6DS3H_ID,
 			[0] = ST_LSM6DS3H_ID,
 		},
 		},
 	},
 	},
 	{
 	{
 		.wai = 0x6a,
 		.wai = 0x6a,
-		.max_fifo_size = 4096,
+		.max_fifo_size = 682,
 		.id = {
 		.id = {
 			[0] = ST_LSM6DSL_ID,
 			[0] = ST_LSM6DSL_ID,
 			[1] = ST_LSM6DSM_ID,
 			[1] = ST_LSM6DSM_ID,
@@ -462,10 +462,9 @@ static int st_lsm6dsx_set_watermark(struct iio_dev *iio_dev, unsigned int val)
 {
 {
 	struct st_lsm6dsx_sensor *sensor = iio_priv(iio_dev);
 	struct st_lsm6dsx_sensor *sensor = iio_priv(iio_dev);
 	struct st_lsm6dsx_hw *hw = sensor->hw;
 	struct st_lsm6dsx_hw *hw = sensor->hw;
-	int err, max_fifo_len;
+	int err;
 
 
-	max_fifo_len = hw->settings->max_fifo_size / ST_LSM6DSX_SAMPLE_SIZE;
-	if (val < 1 || val > max_fifo_len)
+	if (val < 1 || val > hw->settings->max_fifo_size)
 		return -EINVAL;
 		return -EINVAL;
 
 
 	err = st_lsm6dsx_update_watermark(sensor, val);
 	err = st_lsm6dsx_update_watermark(sensor, val);