adis16501 and adis1657x support
Subsystems (5)
v4 cover adis16501 and adis1657x support
Add adis16501 and adis1657x support in adis16475.
Ramona Gradinariu (10):
dt-bindings: iio: imu: Add ADIS16501 compatibles
drivers: iio: imu: Add support for ADIS16501
iio: imu: adis16475: Re-define ADIS16475_DATA
iio: imu: adis_buffer: Add buffer setup API with buffer attributes
iio: imu: adis16475: Create push single sample API
drivers: iio: imu: adis16475: generic computation for sample rate
iio: imu: adis_trigger: Allow level interrupts for FIFO readings
iio: imu: adis16475: Re-define ADIS16475_DATA
dt-bindings: iio: imu: Add ADIS1657X family devices compatibles
drivers: iio: imu: Add support for adis1657x family
.../bindings/iio/imu/adi,adis16475.yaml | 31 + drivers/iio/imu/Kconfig | 4 +- drivers/iio/imu/adis16475.c | 810 +++++++++++++++--- drivers/iio/imu/adis_buffer.c | 32 +- drivers/iio/imu/adis_trigger.c | 37 +- include/linux/iio/imu/adis.h | 20 +- 6 files changed, 792 insertions(+), 142 deletions(-)
--
2.34.1
PATCH v4 1/10 dt-bindings: iio: imu: Add ADIS16501 compatibles
Add ADIS16501 compatible. Similarly to other ADIS1650X devices, ADIS16501 supports sync-mode values [0,2].
There are two differences between ADIS16501 and ADIS16477-2:
- ADIS16501 does not support pulse sync mode
- the delta velocity scale value is different
---
no changes in v4
Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml +2 -0
@@ -30,6 +30,7 @@ properties: - adi,adis16467-2 - adi,adis16467-3 - adi,adis16500 + - adi,adis16501 - adi,adis16505-1 - adi,adis16505-2 - adi,adis16505-3
@@ -90,6 +91,7 @@ allOf: contains: enum: - adi,adis16500 + - adi,adis16501 - adi,adis16505-1 - adi,adis16505-2 - adi,adis16505-3
--
2.34.1
PATCH v4 2/10 drivers: iio: imu: Add support for ADIS16501
In reply to Ramona GradinariuAdd support for ADIS16501 device in already existing ADIS16475 driver.
---
no changes in v4
drivers/iio/imu/Kconfig | 4 ++-- drivers/iio/imu/adis16475.c | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-)
drivers/iio/imu/Kconfig +2 -2
@@ -36,8 +36,8 @@ config ADIS16475 select IIO_ADIS_LIB_BUFFER if IIO_BUFFER help Say yes here to build support for Analog Devices ADIS16470, ADIS16475, - ADIS16477, ADIS16465, ADIS16467, ADIS16500, ADIS16505, ADIS16507 inertial - sensors. + ADIS16477, ADIS16465, ADIS16467, ADIS16500, ADIS16501, ADIS16505, + ADIS16507 inertial sensors. To compile this driver as a module, choose M here: the module will be called adis16475.
drivers/iio/imu/adis16475.c +23 -0
@@ -661,6 +661,7 @@ enum adis16475_variant {ADIS16467_2 ,ADIS16467_3 ,ADIS16500 , +ADIS16501 ,ADIS16505_1 ,ADIS16505_2 , ADIS16505_3,
@@ -980,6 +981,25 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, .adis_data = ADIS16475_DATA(16500, &adis1650x_timeouts), }, + [ADIS16501] = { + .name = "adis16501", + .num_channels = ARRAY_SIZE(adis16477_channels), + .channels = adis16477_channels, + .gyro_max_val = 1, + .gyro_max_scale = IIO_RAD_TO_DEGREE(40 << 16), + .accel_max_val = 1, + .accel_max_scale = IIO_M_S_2_TO_G(800 << 16), + .temp_scale = 100, + .deltang_max_val = IIO_DEGREE_TO_RAD(720), + .deltvel_max_val = 125, + .int_clk = 2000, + .max_dec = 1999, + .sync = adis16475_sync_mode, +/* pulse sync not supported */ + .num_sync = ARRAY_SIZE(adis16475_sync_mode) - 1, + .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, + .adis_data = ADIS16475_DATA(16501, &adis1650x_timeouts), + }, [ADIS16505_1] = { .name = "adis16505-1", .num_channels = ARRAY_SIZE(adis16477_channels),
@@ -1482,6 +1502,8 @@ static const struct of_device_id adis16475_of_match[] = { .data = &adis16475_chip_info[ADIS16467_3] }, { .compatible = "adi,adis16500", .data = &adis16475_chip_info[ADIS16500] }, + { .compatible = "adi,adis16501", + .data = &adis16475_chip_info[ADIS16501] }, { .compatible = "adi,adis16505-1", .data = &adis16475_chip_info[ADIS16505_1] }, { .compatible = "adi,adis16505-2",
@@ -1513,6 +1535,7 @@ static const struct spi_device_id adis16475_ids[] = { { "adis16467-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16467_2] }, { "adis16467-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16467_3] }, { "adis16500", (kernel_ulong_t)&adis16475_chip_info[ADIS16500] }, + { "adis16501", (kernel_ulong_t)&adis16475_chip_info[ADIS16501] }, { "adis16505-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16505_1] }, { "adis16505-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16505_2] }, { "adis16505-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16505_3] },
--
2.34.1
Re: [PATCH v4 02/10] drivers: iio: imu: Add support for ADIS16501
Quoted 5 lines · Ramona Gradinariu
Add support for ADIS16501 device in already existing ADIS16475 driver.
Signed-off-by Ramona Gradinariu <[email protected]>---
Quoted 80 lines
no changes in v4
drivers/iio/imu/Kconfig | 4 ++--drivers/iio/imu/adis16475.c| 23 +++++++++++++++++++++++2 files changed, 25 insertions(+), 2 deletions(-)drivers/iio/imu/Kconfig +0
-0@@ -36,8 +36,8 @@ config ADIS16475select
IIO_ADIS_LIB_BUFFERifIIO_BUFFER
help
Say yes here to build support for Analog Devices ADIS16470, ADIS16475,drivers/iio/imu/Kconfig +0
-1- ADIS16477, ADIS16465, ADIS16467, ADIS16500, ADIS16505, ADIS16507inertial
drivers/iio/imu/Kconfig +2
-1- sensors. + ADIS16477, ADIS16465, ADIS16467, ADIS16500, ADIS16501, ADIS16505, + ADIS16507 inertial sensors.To compile this driver as a module, choose M here: the module will be called adis16475.
drivers/iio/imu/adis16475.c +20
-0@@ -661,6 +661,7 @@ enum adis16475_variant { ADIS16467_2, ADIS16467_3, ADIS16500, +ADIS16501 , ADIS16505_1, ADIS16505_2, ADIS16505_3,@@ -980,6 +981,25 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, .adis_data = ADIS16475_DATA(16500, &adis1650x_timeouts), }, + [ADIS16501] = { + .name = "adis16501", + .num_channels = ARRAY_SIZE(adis16477_channels), + .channels = adis16477_channels, + .gyro_max_val = 1, + .gyro_max_scale = IIO_RAD_TO_DEGREE(40 << 16), + .accel_max_val = 1, + .accel_max_scale = IIO_M_S_2_TO_G(800 << 16), + .temp_scale = 100, + .deltang_max_val = IIO_DEGREE_TO_RAD(720), + .deltvel_max_val = 125, + .int_clk = 2000, + .max_dec = 1999, + .sync = adis16475_sync_mode, +/* pulse sync not supported */ + .num_sync = ARRAY_SIZE(adis16475_sync_mode) - 1, + .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, + .adis_data = ADIS16475_DATA(16501, &adis1650x_timeouts), + }, [ADIS16505_1] = { .name = "adis16505-1",.num_channels =
ARRAY_SIZE(adis16477_channels),drivers/iio/imu/adis16475.c +3
-1@@ -1482,6 +1502,8 @@ static const struct of_device_id adis16475_of_match[] = { .data = &adis16475_chip_info[ADIS16467_3] }, { .compatible = "adi,adis16500", .data = &adis16475_chip_info[ADIS16500] }, + { .compatible = "adi,adis16501", + .data = &adis16475_chip_info[ADIS16501] }, { .compatible = "adi,adis16505-1", .data = &adis16475_chip_info[ADIS16505_1] }, { .compatible = "adi,adis16505-2",@@ -1513,6 +1535,7 @@ static const struct spi_device_id adis16475_ids[] = { { "adis16467-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16467_2] }, { "adis16467-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16467_3] }, { "adis16500", (kernel_ulong_t)&adis16475_chip_info[ADIS16500] }, + { "adis16501", (kernel_ulong_t)&adis16475_chip_info[ADIS16501] }, { "adis16505-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16505_1] }, { "adis16505-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16505_2] }, { "adis16505-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16505_3] }, --2.34.1
PATCH v4 3/10 iio: imu: adis16475: Re-define ADIS16475_DATA
In reply to Ramona GradinariuRe-define ADIS16475_DATA such that it takes _burst_max_len and _burst_max_speed_hz as parameters.
---
no changes in v4
drivers/iio/imu/adis16475.c | 136 +++++++++++++++++++++++------------- 1 file changed, 89 insertions(+), 47 deletions(-)
drivers/iio/imu/adis16475.c +89 -47
@@ -690,32 +690,32 @@ static const char * const adis16475_status_error_msgs[] = { [ADIS16475_DIAG_STAT_CLK] = "Clock error", }; -#define ADIS16475_DATA (_prod_id, _timeouts) \ -{ \ - .msc_ctrl_reg = ADIS16475_REG_MSG_CTRL, \ - .glob_cmd_reg = ADIS16475_REG_GLOB_CMD, \ - .diag_stat_reg = ADIS16475_REG_DIAG_STAT, \ - .prod_id_reg = ADIS16475_REG_PROD_ID, \ - .prod_id = (_prod_id), \ - .self_test_mask = BIT(2), \ - .self_test_reg = ADIS16475_REG_GLOB_CMD, \ - .cs_change_delay = 16, \ - .read_delay = 5, \ - .write_delay = 5, \ - .status_error_msgs = adis16475_status_error_msgs, \ - .status_error_mask = BIT(ADIS16475_DIAG_STAT_DATA_PATH) | \ - BIT(ADIS16475_DIAG_STAT_FLASH_MEM) | \ - BIT(ADIS16475_DIAG_STAT_SPI) | \ - BIT(ADIS16475_DIAG_STAT_STANDBY) | \ - BIT(ADIS16475_DIAG_STAT_SENSOR) | \ - BIT(ADIS16475_DIAG_STAT_MEMORY) | \ - BIT(ADIS16475_DIAG_STAT_CLK), \ - .unmasked_drdy = true, \ - .timeouts = (_timeouts), \ - .burst_reg_cmd = ADIS16475_REG_GLOB_CMD, \ - .burst_len = ADIS16475_BURST_MAX_DATA, \ - .burst_max_len = ADIS16475_BURST32_MAX_DATA, \ - .burst_max_speed_hz = ADIS16475_BURST_MAX_SPEED \ +#define ADIS16475_DATA (_prod_id, _timeouts, _burst_max_len, _burst_max_speed_hz) \ +{ \ + .msc_ctrl_reg = ADIS16475_REG_MSG_CTRL, \ + .glob_cmd_reg = ADIS16475_REG_GLOB_CMD, \ + .diag_stat_reg = ADIS16475_REG_DIAG_STAT, \ + .prod_id_reg = ADIS16475_REG_PROD_ID, \ + .prod_id = (_prod_id), \ + .self_test_mask = BIT(2), \ + .self_test_reg = ADIS16475_REG_GLOB_CMD, \ + .cs_change_delay = 16, \ + .read_delay = 5, \ + .write_delay = 5, \ + .status_error_msgs = adis16475_status_error_msgs, \ + .status_error_mask = BIT(ADIS16475_DIAG_STAT_DATA_PATH) | \ + BIT(ADIS16475_DIAG_STAT_FLASH_MEM) | \ + BIT(ADIS16475_DIAG_STAT_SPI) | \ + BIT(ADIS16475_DIAG_STAT_STANDBY) | \ + BIT(ADIS16475_DIAG_STAT_SENSOR) | \ + BIT(ADIS16475_DIAG_STAT_MEMORY) | \ + BIT(ADIS16475_DIAG_STAT_CLK), \ + .unmasked_drdy = true, \ + .timeouts = (_timeouts), \ + .burst_reg_cmd = ADIS16475_REG_GLOB_CMD, \ + .burst_len = ADIS16475_BURST_MAX_DATA, \ + .burst_max_len = _burst_max_len, \ + .burst_max_speed_hz = _burst_max_speed_hz \ }static const struct adis16475_sync adis16475_sync_mode[] = {
@@ -753,7 +753,9 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .max_dec = 1999, .sync = adis16475_sync_mode, .num_sync = ARRAY_SIZE(adis16475_sync_mode), - .adis_data = ADIS16475_DATA(16470, &adis16475_timeouts), + .adis_data =ADIS16475_DATA (16470 , &adis16475_timeouts, +ADIS16475_BURST32_MAX_DATA , + ADIS16475_BURST_MAX_SPEED), }, [ADIS16475_1] = { .name = "adis16475-1",
@@ -770,7 +772,9 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .max_dec = 1999, .sync = adis16475_sync_mode, .num_sync = ARRAY_SIZE(adis16475_sync_mode), - .adis_data = ADIS16475_DATA(16475, &adis16475_timeouts), + .adis_data =ADIS16475_DATA (16475 , &adis16475_timeouts, +ADIS16475_BURST32_MAX_DATA , + ADIS16475_BURST_MAX_SPEED), }, [ADIS16475_2] = { .name = "adis16475-2",
@@ -787,7 +791,9 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .max_dec = 1999, .sync = adis16475_sync_mode, .num_sync = ARRAY_SIZE(adis16475_sync_mode), - .adis_data = ADIS16475_DATA(16475, &adis16475_timeouts), + .adis_data =ADIS16475_DATA (16475 , &adis16475_timeouts, +ADIS16475_BURST32_MAX_DATA , + ADIS16475_BURST_MAX_SPEED), }, [ADIS16475_3] = { .name = "adis16475-3",
@@ -804,7 +810,9 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .max_dec = 1999, .sync = adis16475_sync_mode, .num_sync = ARRAY_SIZE(adis16475_sync_mode), - .adis_data = ADIS16475_DATA(16475, &adis16475_timeouts), + .adis_data =ADIS16475_DATA (16475 , &adis16475_timeouts, +ADIS16475_BURST32_MAX_DATA , + ADIS16475_BURST_MAX_SPEED), }, [ADIS16477_1] = { .name = "adis16477-1",
@@ -822,7 +830,9 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .sync = adis16475_sync_mode, .num_sync = ARRAY_SIZE(adis16475_sync_mode), .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, - .adis_data = ADIS16475_DATA(16477, &adis16475_timeouts), + .adis_data =ADIS16475_DATA (16477 , &adis16475_timeouts, +ADIS16475_BURST32_MAX_DATA , + ADIS16475_BURST_MAX_SPEED), }, [ADIS16477_2] = { .name = "adis16477-2",
@@ -840,7 +850,9 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .sync = adis16475_sync_mode, .num_sync = ARRAY_SIZE(adis16475_sync_mode), .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, - .adis_data = ADIS16475_DATA(16477, &adis16475_timeouts), + .adis_data =ADIS16475_DATA (16477 , &adis16475_timeouts, +ADIS16475_BURST32_MAX_DATA , + ADIS16475_BURST_MAX_SPEED), }, [ADIS16477_3] = { .name = "adis16477-3",
@@ -858,7 +870,9 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .sync = adis16475_sync_mode, .num_sync = ARRAY_SIZE(adis16475_sync_mode), .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, - .adis_data = ADIS16475_DATA(16477, &adis16475_timeouts), + .adis_data =ADIS16475_DATA (16477 , &adis16475_timeouts, +ADIS16475_BURST32_MAX_DATA , + ADIS16475_BURST_MAX_SPEED), }, [ADIS16465_1] = { .name = "adis16465-1",
@@ -875,7 +889,9 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .max_dec = 1999, .sync = adis16475_sync_mode, .num_sync = ARRAY_SIZE(adis16475_sync_mode), - .adis_data = ADIS16475_DATA(16465, &adis16475_timeouts), + .adis_data =ADIS16475_DATA (16465 , &adis16475_timeouts, +ADIS16475_BURST32_MAX_DATA , + ADIS16475_BURST_MAX_SPEED), }, [ADIS16465_2] = { .name = "adis16465-2",
@@ -892,7 +908,9 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .max_dec = 1999, .sync = adis16475_sync_mode, .num_sync = ARRAY_SIZE(adis16475_sync_mode), - .adis_data = ADIS16475_DATA(16465, &adis16475_timeouts), + .adis_data =ADIS16475_DATA (16465 , &adis16475_timeouts, +ADIS16475_BURST32_MAX_DATA , + ADIS16475_BURST_MAX_SPEED), }, [ADIS16465_3] = { .name = "adis16465-3",
@@ -909,7 +927,9 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .max_dec = 1999, .sync = adis16475_sync_mode, .num_sync = ARRAY_SIZE(adis16475_sync_mode), - .adis_data = ADIS16475_DATA(16465, &adis16475_timeouts), + .adis_data =ADIS16475_DATA (16465 , &adis16475_timeouts, +ADIS16475_BURST32_MAX_DATA , + ADIS16475_BURST_MAX_SPEED), }, [ADIS16467_1] = { .name = "adis16467-1",
@@ -926,7 +946,9 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .max_dec = 1999, .sync = adis16475_sync_mode, .num_sync = ARRAY_SIZE(adis16475_sync_mode), - .adis_data = ADIS16475_DATA(16467, &adis16475_timeouts), + .adis_data =ADIS16475_DATA (16467 , &adis16475_timeouts, +ADIS16475_BURST32_MAX_DATA , + ADIS16475_BURST_MAX_SPEED), }, [ADIS16467_2] = { .name = "adis16467-2",
@@ -943,7 +965,9 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .max_dec = 1999, .sync = adis16475_sync_mode, .num_sync = ARRAY_SIZE(adis16475_sync_mode), - .adis_data = ADIS16475_DATA(16467, &adis16475_timeouts), + .adis_data =ADIS16475_DATA (16467 , &adis16475_timeouts, +ADIS16475_BURST32_MAX_DATA , + ADIS16475_BURST_MAX_SPEED), }, [ADIS16467_3] = { .name = "adis16467-3",
@@ -960,7 +984,9 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .max_dec = 1999, .sync = adis16475_sync_mode, .num_sync = ARRAY_SIZE(adis16475_sync_mode), - .adis_data = ADIS16475_DATA(16467, &adis16475_timeouts), + .adis_data =ADIS16475_DATA (16467 , &adis16475_timeouts, +ADIS16475_BURST32_MAX_DATA , + ADIS16475_BURST_MAX_SPEED), }, [ADIS16500] = { .name = "adis16500",
@@ -979,7 +1005,9 @@ static const struct adis16475_chip_info adis16475_chip_info[] = {/* pulse sync not supported */ .num_sync = ARRAY_SIZE(adis16475_sync_mode) - 1, .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, - .adis_data = ADIS16475_DATA(16500, &adis1650x_timeouts), + .adis_data =ADIS16475_DATA (16500 , &adis1650x_timeouts, +ADIS16475_BURST32_MAX_DATA , + ADIS16475_BURST_MAX_SPEED), }, [ADIS16501] = { .name = "adis16501",
@@ -998,7 +1026,9 @@ static const struct adis16475_chip_info adis16475_chip_info[] = {/* pulse sync not supported */ .num_sync = ARRAY_SIZE(adis16475_sync_mode) - 1, .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, - .adis_data = ADIS16475_DATA(16501, &adis1650x_timeouts), + .adis_data =ADIS16475_DATA (16501 , &adis1650x_timeouts, +ADIS16475_BURST32_MAX_DATA , + ADIS16475_BURST_MAX_SPEED), }, [ADIS16505_1] = { .name = "adis16505-1",
@@ -1017,7 +1047,9 @@ static const struct adis16475_chip_info adis16475_chip_info[] = {/* pulse sync not supported */ .num_sync = ARRAY_SIZE(adis16475_sync_mode) - 1, .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, - .adis_data = ADIS16475_DATA(16505, &adis1650x_timeouts), + .adis_data =ADIS16475_DATA (16505 , &adis1650x_timeouts, +ADIS16475_BURST32_MAX_DATA , + ADIS16475_BURST_MAX_SPEED), }, [ADIS16505_2] = { .name = "adis16505-2",
@@ -1036,7 +1068,9 @@ static const struct adis16475_chip_info adis16475_chip_info[] = {/* pulse sync not supported */ .num_sync = ARRAY_SIZE(adis16475_sync_mode) - 1, .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, - .adis_data = ADIS16475_DATA(16505, &adis1650x_timeouts), + .adis_data =ADIS16475_DATA (16505 , &adis1650x_timeouts, +ADIS16475_BURST32_MAX_DATA , + ADIS16475_BURST_MAX_SPEED), }, [ADIS16505_3] = { .name = "adis16505-3",
@@ -1055,7 +1089,9 @@ static const struct adis16475_chip_info adis16475_chip_info[] = {/* pulse sync not supported */ .num_sync = ARRAY_SIZE(adis16475_sync_mode) - 1, .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, - .adis_data = ADIS16475_DATA(16505, &adis1650x_timeouts), + .adis_data =ADIS16475_DATA (16505 , &adis1650x_timeouts, +ADIS16475_BURST32_MAX_DATA , + ADIS16475_BURST_MAX_SPEED), }, [ADIS16507_1] = { .name = "adis16507-1",
@@ -1074,7 +1110,9 @@ static const struct adis16475_chip_info adis16475_chip_info[] = {/* pulse sync not supported */ .num_sync = ARRAY_SIZE(adis16475_sync_mode) - 1, .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, - .adis_data = ADIS16475_DATA(16507, &adis1650x_timeouts), + .adis_data =ADIS16475_DATA (16507 , &adis1650x_timeouts, +ADIS16475_BURST32_MAX_DATA , + ADIS16475_BURST_MAX_SPEED), }, [ADIS16507_2] = { .name = "adis16507-2",
@@ -1093,7 +1131,9 @@ static const struct adis16475_chip_info adis16475_chip_info[] = {/* pulse sync not supported */ .num_sync = ARRAY_SIZE(adis16475_sync_mode) - 1, .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, - .adis_data = ADIS16475_DATA(16507, &adis1650x_timeouts), + .adis_data =ADIS16475_DATA (16507 , &adis1650x_timeouts, +ADIS16475_BURST32_MAX_DATA , + ADIS16475_BURST_MAX_SPEED), }, [ADIS16507_3] = { .name = "adis16507-3",
@@ -1112,7 +1152,9 @@ static const struct adis16475_chip_info adis16475_chip_info[] = {/* pulse sync not supported */ .num_sync = ARRAY_SIZE(adis16475_sync_mode) - 1, .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, - .adis_data = ADIS16475_DATA(16507, &adis1650x_timeouts), + .adis_data =ADIS16475_DATA (16507 , &adis1650x_timeouts, +ADIS16475_BURST32_MAX_DATA , + ADIS16475_BURST_MAX_SPEED), }, };
--
2.34.1
PATCH v4 4/10 iio: imu: adis_buffer: Add buffer setup API with buffer attributes
In reply to Ramona GradinariuAdd new API called devm_adis_setup_buffer_and_trigger_with_attrs() which also takes buffer attributes as a parameter.
Rewrite devm_adis_setup_buffer_and_trigger() implementation such that it calls devm_adis_setup_buffer_and_trigger_with_attrs() with buffer attributes parameter NULL
---
no changes in v4
drivers/iio/imu/adis_buffer.c | 32 ++++++++++++++++++-------------- include/linux/iio/imu/adis.h | 19 +++++++++++++++---- 2 files changed, 33 insertions(+), 18 deletions(-)
drivers/iio/imu/adis_buffer.c +18 -14
@@ -175,31 +175,36 @@ static void adis_buffer_cleanup(void *arg) }/** -* devm_adis_setup_buffer_and_trigger() - Sets up buffer and trigger for -* the managed adis device +* devm_adis_setup_buffer_and_trigger_with_attrs() - Sets up buffer and trigger +* for the managed adis device with buffer attributes. * @adis: The adis device * @indio_dev: The IIO device -* @trigger_handler: Optional trigger handler, may be NULL. +* @trigger_handler: Trigger handler: should handle the buffer readings. +* @ops: Optional buffer setup functions, may be NULL. +* @buffer_attrs: Extra buffer attributes. * * Returns 0 on success, a negative error code otherwise. * -* This function sets up the buffer and trigger for a adis devices. If -* 'trigger_handler' is NULL the default trigger handler will be used. The -* default trigger handler will simply read the registers assigned to the -* currently active channels. +* This function sets up the buffer (with buffer setup functions and extra +* buffer attributes) and trigger for a adis devices with buffer attributes. */ int -devm_adis_setup_buffer_and_trigger (struct adis *adis,struct iio_dev *indio_dev, -irq_handler_t trigger_handler) +devm_adis_setup_buffer_and_trigger_with_attrs (struct adis *adis,struct iio_dev *indio_dev, +irq_handler_t trigger_handler, +const struct iio_buffer_setup_ops *ops, +const struct iio_dev_attr **buffer_attrs) {int ret;if (!trigger_handler) trigger_handler = adis_trigger_handler; - ret =devm_iio_triggered_buffer_setup (&adis->spi->dev, indio_dev, - &iio_pollfunc_store_time, - trigger_handler,NULL ); + ret =devm_iio_triggered_buffer_setup_ext (&adis->spi->dev, indio_dev, + &iio_pollfunc_store_time, + trigger_handler, +IIO_BUFFER_DIRECTION_IN , + ops, + buffer_attrs);if (ret)return ret;
@@ -212,5 +217,4 @@ devm_adis_setup_buffer_and_trigger(struct adis *adis, struct iio_dev *indio_dev,return devm_add_action_or_reset (&adis->spi->dev, adis_buffer_cleanup, adis); } -EXPORT_SYMBOL_NS_GPL (devm_adis_setup_buffer_and_trigger,IIO_ADISLIB ); - +EXPORT_SYMBOL_NS_GPL (devm_adis_setup_buffer_and_trigger_with_attrs,IIO_ADISLIB );
include/linux/iio/imu/adis.h +15 -4
@@ -21,6 +21,7 @@#define ADIS_REG_PAGE_ID 0x00struct adis ; +struct iio_dev_attr ;/** * struct adis_timeouts - ADIS chip variant timeouts
@@ -515,11 +516,19 @@ int adis_single_conversion(struct iio_dev *indio_dev,#define ADIS_ROT_CHAN (mod, addr, si, info_sep, info_all, bits) \ ADIS_MOD_CHAN(IIO_ROT, mod, addr, si, info_sep, info_all, bits) +#define devm_adis_setup_buffer_and_trigger (adis, indio_dev, trigger_handler) \ + devm_adis_setup_buffer_and_trigger_with_attrs((adis), (indio_dev), \ + (trigger_handler), NULL, \ + NULL) +#ifdef CONFIG_IIO_ADIS_LIB_BUFFER int -devm_adis_setup_buffer_and_trigger (struct adis *adis,struct iio_dev *indio_dev, -irq_handler_t trigger_handler); +devm_adis_setup_buffer_and_trigger_with_attrs (struct adis *adis, +struct iio_dev *indio_dev, +irq_handler_t trigger_handler, +const struct iio_buffer_setup_ops *ops, +const struct iio_dev_attr **buffer_attrs);int devm_adis_probe_trigger (struct adis *adis,struct iio_dev *indio_dev);
@@ -529,8 +538,10 @@ int adis_update_scan_mode(struct iio_dev *indio_dev,#else /* CONFIG_IIO_BUFFER */ static inline int -devm_adis_setup_buffer_and_trigger (struct adis *adis,struct iio_dev *indio_dev, -irq_handler_t trigger_handler) +devm_adis_setup_buffer_and_trigger_with_attrs (struct adis *adis,struct iio_dev *indio_dev, +irq_handler_t trigger_handler, +const struct iio_buffer_setup_ops *ops, +const struct iio_dev_attr **buffer_attrs) {return 0 ; }
--
2.34.1
Re: [PATCH v4 04/10] iio: imu: adis_buffer: Add buffer setup API with buffer attributes
Quoted 8 lines · Ramona Gradinariu
Add new API called
devm_adis_setup_buffer_and_trigger_with_attrs()which also takes buffer attributes as a parameter.
Rewritedevm_adis_setup_buffer_and_trigger()implementation such that it callsdevm_adis_setup_buffer_and_trigger_with_attrs()with buffer attributes parameter NULLSigned-off-by Ramona Gradinariu <[email protected]>---
Quoted 124 lines
no changes in v4
drivers/iio/imu/adis_buffer.c | 32 ++++++++++++++++++-------------- include/linux/iio/imu/adis.h | 19 +++++++++++++++----2 files changed, 33 insertions(+), 18 deletions(-)drivers/iio/imu/adis_buffer.c +7
-7@@ -175,31 +175,36 @@ static void adis_buffer_cleanup(void *arg) } /** -* devm_adis_setup_buffer_and_trigger() - Sets up buffer and trigger for -* the managed adis device +* devm_adis_setup_buffer_and_trigger_with_attrs() - Sets up buffer and trigger +* for the managed adis device with buffer attributes. * @adis: The adis device * @indio_dev: The IIO device -* @trigger_handler: Optional trigger handler, may be NULL. +* @trigger_handler: Trigger handler: should handle the buffer readings. +* @ops: Optional buffer setup functions, may be NULL. +* @buffer_attrs: Extra buffer attributes. * * Returns 0 on success, a negative error code otherwise. * -* This function sets up the buffer and trigger for a adis devices. If -* 'trigger_handler' is NULL the default trigger handler will be used. The -* default trigger handler will simply read the registers assigned to the -* currently active channels. +* This function sets up the buffer (with buffer setup functions and extra +* buffer attributes) and trigger for a adis devices with buffer attributes. */ int
drivers/iio/imu/adis_buffer.c +1
-2-devm_adis_setup_buffer_and_trigger(struct adis *adis, struct iio_dev *indio_dev, - irq_handler_t trigger_handler) +devm_adis_setup_buffer_and_trigger_with_attrs(struct adis *adis, struct iio_dev
*indio_dev,drivers/iio/imu/adis_buffer.c +2
-0+ irq_handler_t trigger_handler, + const struct iio_buffer_setup_ops*ops,
drivers/iio/imu/adis_buffer.c +1
-0+ const struct iio_dev_attr**buffer_attrs)
{
int ret;if (!trigger_handler)
trigger_handler=adis_trigger_handler;drivers/iio/imu/adis_buffer.c +6
-3- ret =devm_iio_triggered_buffer_setup (&adis->spi->dev, indio_dev, - &iio_pollfunc_store_time, - trigger_handler, NULL); + ret =devm_iio_triggered_buffer_setup_ext (&adis->spi->dev, indio_dev, + &iio_pollfunc_store_time, + trigger_handler, + IIO_BUFFER_DIRECTION_IN, + ops, + buffer_attrs);if (ret)
return ret;drivers/iio/imu/adis_buffer.c +1
-2@@ -212,5 +217,4 @@ devm_adis_setup_buffer_and_trigger(struct adis *adis, struct iio_dev *indio_dev, return devm_add_action_or_reset(&adis->spi->dev, adis_buffer_cleanup, adis); } -EXPORT_SYMBOL_NS_GPL (devm_adis_setup_buffer_and_trigger,IIO_ADISLIB ); - +EXPORT_SYMBOL_NS_GPL (devm_adis_setup_buffer_and_trigger_with_attrs,IIO_ADISLIB );include/linux/iio/imu/adis.h +6
-0@@ -21,6 +21,7 @@ #define ADIS_REG_PAGE_ID 0x00 struct adis; +struct iio_dev_attr ; /*** struct adis_timeouts - ADIS chip variant timeouts @@ -515,11 +516,19 @@ int adis_single_conversion(struct iio_dev *indio_dev, #define ADIS_ROT_CHAN(mod, addr, si, info_sep, info_all, bits) \ ADIS_MOD_CHAN(IIO_ROT, mod, addr, si, info_sep, info_all, bits) +#define devm_adis_setup_buffer_and_trigger (adis, indio_dev, trigger_handler) \ + devm_adis_setup_buffer_and_trigger_with_attrs((adis), (indio_dev), \ + (trigger_handler), NULL, \ + NULL) + #ifdef CONFIG_IIO_ADIS_LIB_BUFFERint
include/linux/iio/imu/adis.h +4
-2-devm_adis_setup_buffer_and_trigger(struct adis *adis, struct iio_dev *indio_dev, - irq_handler_t trigger_handler); +devm_adis_setup_buffer_and_trigger_with_attrs(struct adis *adis, + struct iio_dev *indio_dev, + irq_handler_t trigger_handler, + const struct iio_buffer_setup_ops*ops,
include/linux/iio/imu/adis.h +1
-0+ const struct iio_dev_attr**buffer_attrs);
int
devm_adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev);include/linux/iio/imu/adis.h +0
-0@@ -529,8 +538,10 @@ int adis_update_scan_mode(struct iio_dev *indio_dev, #else /* CONFIG_IIO_BUFFER */static inline int
include/linux/iio/imu/adis.h +1
-2-devm_adis_setup_buffer_and_trigger(struct adis *adis, struct iio_dev *indio_dev, - irq_handler_t trigger_handler) +devm_adis_setup_buffer_and_trigger_with_attrs(struct adis *adis, struct iio_dev
*indio_dev,include/linux/iio/imu/adis.h +2
-0+ irq_handler_t trigger_handler, + const struct iio_buffer_setup_ops*ops,
include/linux/iio/imu/adis.h +1
-0+ const struct iio_dev_attr**buffer_attrs)
{
return 0;
}
--
2.34.1
Jonathan Cameron
maintainerRe: [PATCH v4 04/10] iio: imu: adis_buffer: Add buffer setup API with buffer attributes
In reply to Ramona GradinariuQuoted 23 lines
/**
- *devm_adis_setup_buffer_and_trigger()- Sets up buffer and trigger for
- * the managed adis device
+ *devm_adis_setup_buffer_and_trigger_with_attrs()- Sets up buffer and trigger
+ * for the managed adis device with buffer attributes.
* @adis: The adis device
* @indio_dev: The IIO device
- * @trigger_handler: Optional trigger handler, may be NULL.
+ * @trigger_handler: Trigger handler: should handle the buffer readings.
+ * @ops: Optional buffer setup functions, may be NULL.
+ * @buffer_attrs: Extra buffer attributes.
*
* Returns 0 on success, a negative error code otherwise.
*
- * This function sets up the buffer and trigger for a adis devices. If
- * 'trigger_handler' is NULL the default trigger handler will be used. The
- * default trigger handler will simply read the registers assigned to the
- * currently active channels.
+ * This function sets up the buffer (with buffer setup functions and extra
+ * buffer attributes) and trigger for a adis devices with buffer attributes. */
int
drivers/iio/imu/adis_buffer.c static void adis_buffer_cleanup(void *arg) · line 192
Quoted 3 lines
drivers/iio/imu/adis_buffer.c +1
-2-devm_adis_setup_buffer_and_trigger(struct adis *adis, struct iio_dev *indio_dev, - irq_handler_t trigger_handler) +devm_adis_setup_buffer_and_trigger_with_attrs(struct adis *adis, struct iio_dev *indio_dev,
Trivial, but as you are doing a v5 anyway for Nuno's feedback please add a line break after adis,
Whilst for the following lines readability would be hurt by breaking the lines that isn't true for this first line.
Quoted 4 lines
drivers/iio/imu/adis_buffer.c +3
-0+irq_handler_t trigger_handler, + const struct iio_buffer_setup_ops *ops, + const struct iio_dev_attr **buffer_attrs) {
PATCH v4 5/10 iio: imu: adis16475: Create push single sample API
In reply to Ramona GradinariuCreate push single sample API reposnsible for pushing a single sample into the buffer.
This is a preparation patch for FIFO support where more than one sample has to be pushed in the trigger handler.
---
no changes in v4
drivers/iio/imu/adis16475.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/iio/imu/adis16475.c +10 -2
@@ -1249,9 +1249,8 @@ static void adis16475_burst32_check(struct adis16475 *st) } } -static irqreturn_t adis16475_trigger_handler (int irq,void *p) +static int adis16475_push_single_sample (struct iio_poll_func *pf) { -struct iio_poll_func *pf = p;struct iio_dev *indio_dev = pf->indio_dev;struct adis16475 *st =iio_priv (indio_dev);struct adis *adis = &st->adis;
@@ -1340,6 +1339,15 @@ static irqreturn_t adis16475_trigger_handler(int irq, void *p)* array. */ adis16475_burst32_check (st); +return ret; +} + +static irqreturn_t adis16475_trigger_handler (int irq,void *p) +{ +struct iio_poll_func *pf = p; +struct iio_dev *indio_dev = pf->indio_dev; + +adis16475_push_single_sample (pf);iio_trigger_notify_done (indio_dev->trig);return IRQ_HANDLED ;
--
2.34.1
Re: [PATCH v4 05/10] iio: imu: adis16475: Create push single sample API
Quoted 7 lines · Ramona Gradinariu
Create push single sample API reposnsible for pushing a single sample into the buffer.
This is a preparation patch for FIFO support where more than one sample has to be pushed in the trigger handler.Signed-off-by Ramona Gradinariu <[email protected]>---
Quoted 39 lines
no changes in v4
drivers/iio/imu/adis16475.c | 12 ++++++++++--1 file changed, 10 insertions(+), 2 deletions(-)drivers/iio/imu/adis16475.c +10
-2@@ -1249,9 +1249,8 @@ static void adis16475_burst32_check(struct adis16475 *st) } } -static irqreturn_t adis16475_trigger_handler (int irq,void *p) +static int adis16475_push_single_sample (struct iio_poll_func *pf) { -struct iio_poll_func *pf = p; struct iio_dev *indio_dev = pf->indio_dev; struct adis16475 *st = iio_priv(indio_dev); struct adis *adis = &st->adis;@@ -1340,6 +1339,15 @@ static irqreturn_t adis16475_trigger_handler(int irq, void*p) * array. */ adis16475_burst32_check(st); +return ret; +} + +static irqreturn_t adis16475_trigger_handler (int irq,void *p) +{ +struct iio_poll_func *pf = p; +struct iio_dev *indio_dev = pf->indio_dev; + +adis16475_push_single_sample (pf); iio_trigger_notify_done(indio_dev->trig);return
IRQ_HANDLED;
--
2.34.1
PATCH v4 6/10 drivers: iio: imu: adis16475: generic computation for sample rate
In reply to Ramona GradinariuCurrently adis16475 supports a sample rate between 1900 and 2100 Hz. This patch changes the setting of sample rate from hardcoded values to a generic computation based on the internal clock frequency. This is a preparatory patch for adding support for adis1657x family devices which allow sample rates between 3900 and 4100 Hz.
---
no changes in v4
drivers/iio/imu/adis16475.c | 39 +++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 17 deletions(-)
drivers/iio/imu/adis16475.c +22 -17
@@ -310,6 +310,9 @@ static int adis16475_set_freq(struct adis16475 *st, const u32 freq)u16 dec;int ret;u32 sample_rate = st->clk_freq; +/* The optimal sample rate for the supported IMUs is between int_clk - 100 and int_clk + 100. */ +u32 max_sample_rate = st->info->int_clk *1000 +100000 ; +u32 min_sample_rate = st->info->int_clk *1000 -100000 ;if (!freq)return -EINVAL ;
@@ -317,8 +320,9 @@ static int adis16475_set_freq(struct adis16475 *st, const u32 freq)adis_dev_lock (&st->adis);/* * When using sync scaled mode, the input clock needs to be scaled so that we have -* an IMU sample rate between (optimally) 1900 and 2100. After this, we can use the -* decimation filter to lower the sampling rate in order to get what the user wants. +* an IMU sample rate between (optimally) int_clk - 100 and int_clk + 100. +* After this, we can use the decimation filter to lower the sampling rate in order +* to get what the user wants. * Optimally, the user sample rate is a multiple of both the IMU sample rate and * the input clock. Hence, calculating the sync_scale dynamically gives us better * chances of achieving a perfect/integer value for DEC_RATE. The math here is:
@@ -336,23 +340,24 @@ static int adis16475_set_freq(struct adis16475 *st, const u32 freq)* solution. In this case, we get the highest multiple of the input clock * lower than the IMU max sample rate. */ -if (scaled_rate >2100000 ) - scaled_rate =2100000 / st->clk_freq * st->clk_freq; +if (scaled_rate > max_sample_rate) + scaled_rate = max_sample_rate / st->clk_freq * st->clk_freq;else - scaled_rate =2100000 / scaled_rate * scaled_rate; + scaled_rate = max_sample_rate / scaled_rate * scaled_rate;/* * This is not an hard requirement but it's not advised to run the IMU -* with a sample rate lower than 1900Hz due to possible undersampling -* issues. However, there are users that might really want to take the risk. -* Hence, we provide a module parameter for them. If set, we allow sample -* rates lower than 1.9KHz. By default, we won't allow this and we just roundup -* the rate to the next multiple of the input clock bigger than 1.9KHz. This -* is done like this as in some cases (when DEC_RATE is 0) might give -* us the closest value to the one desired by the user... +* with a sample rate lower than internal clock frequency, due to possible +* undersampling issues. However, there are users that might really want +* to take the risk. Hence, we provide a module parameter for them. If set, +* we allow sample rates lower than internal clock frequency. +* By default, we won't allow this and we just roundup the rate to the next +* multiple of the input clock. This is done like this as in some cases +* (when DEC_RATE is 0) might give us the closest value to the one desired +* by the user... */ -if (scaled_rate <1900000 && !low_rate_allow) - scaled_rate =roundup (1900000 , st->clk_freq); +if (scaled_rate < min_sample_rate && !low_rate_allow) + scaled_rate =roundup (min_sample_rate, st->clk_freq); sync_scale = scaled_rate / st->clk_freq; ret =__adis_write_reg_16 (&st->adis,ADIS16475_REG_UP_SCALE , sync_scale);
@@ -1359,6 +1364,7 @@ static int adis16475_config_sync_mode(struct adis16475 *st)struct device *dev = &st->adis.spi->dev;const struct adis16475_sync *sync;u32 sync_mode; +u16 max_sample_rate = st->info->int_clk +100 ;/* default to internal clk */ st->clk_freq = st->info->int_clk *1000 ;
@@ -1398,10 +1404,9 @@ static int adis16475_config_sync_mode(struct adis16475 *st)/* * In sync scaled mode, the IMU sample rate is the clk_freq * sync_scale. * Hence, default the IMU sample rate to the highest multiple of the input -* clock lower than the IMU max sample rate. The optimal range is -* 1900-2100 sps... +* clock lower than the IMU max sample rate. */ - up_scale =2100 / st->clk_freq; + up_scale = max_sample_rate / st->clk_freq; ret = __adis_write_reg_16(&st->adis, ADIS16475_REG_UP_SCALE,
--
2.34.1
Re: [PATCH v4 06/10] drivers: iio: imu: adis16475: generic computation for sample rate
Quoted 8 lines · Ramona Gradinariu
Currently adis16475 supports a sample rate between 1900 and 2100 Hz. This patch changes the setting of sample rate from hardcoded values to a generic computation based on the internal clock frequency. This is a preparatory patch for adding support for adis1657x family devices which allow sample rates between 3900 and 4100 Hz.
Signed-off-by Ramona Gradinariu <[email protected]>---
Quoted 121 lines
no changes in v4
drivers/iio/imu/adis16475.c | 39 +++++++++++++++++++++----------------1 file changed, 22 insertions(+), 17 deletions(-)drivers/iio/imu/adis16475.c +1
-0@@ -310,6 +310,9 @@ static int adis16475_set_freq(struct adis16475 *st, const u32 freq) u16 dec; int ret; u32 sample_rate = st->clk_freq; +/* The optimal sample rate for the supported IMUs is between int_clk - 100 and
int_clk+ 100. */drivers/iio/imu/adis16475.c +2
-0+ u32 max_sample_rate = st->info->int_clk * 1000 + 100000; + u32 min_sample_rate = st->info->int_clk * 1000 - 100000;if (!freq)
return-EINVAL;drivers/iio/imu/adis16475.c +0
-0@@ -317,8 +320,9 @@ static int adis16475_set_freq(struct adis16475 *st, const u32 freq) adis_dev_lock(&st->adis); /** When using sync scaled mode, the input clock needs to be scaled so that we have
drivers/iio/imu/adis16475.c +0
-1-* an IMU sample rate between (optimally) 1900 and 2100. After this, we can use the
drivers/iio/imu/adis16475.c +0
-1-* decimation filter to lower the sampling rate in order to get what the user wants.
drivers/iio/imu/adis16475.c +2
-0+* an IMU sample rate between (optimally) int_clk - 100 and int_clk + 100. +* After this, we can use the decimation filter to lower the sampling rate in order
drivers/iio/imu/adis16475.c +1
-0+* to get what the user wants. * Optimally, the user sample rate is a multiple of both the IMU sample rate and
* the input clock. Hence, calculating thesync_scaledynamically gives us better
* chances of achieving a perfect/integer value forDEC_RATE. The math here is:drivers/iio/imu/adis16475.c +0
-0@@ -336,23 +340,24 @@ static int adis16475_set_freq(struct adis16475 *st, const u32 freq) * solution. In this case, we get the highest multiple of theinput clock
* lower than the IMU max sample rate. */drivers/iio/imu/adis16475.c +2
-2-if (scaled_rate >2100000 ) - scaled_rate =2100000 / st->clk_freq * st->clk_freq; +if (scaled_rate > max_sample_rate) + scaled_rate = max_sample_rate / st->clk_freq * st-Quoted 1 line
clk_freq;else
drivers/iio/imu/adis16475.c +1
-1- scaled_rate =2100000 / scaled_rate * scaled_rate; + scaled_rate = max_sample_rate / scaled_rate * scaled_rate;/*
* This is not an hard requirement but it's not advised to run the IMUdrivers/iio/imu/adis16475.c +0
-1-* with a sample rate lower than 1900Hz due to possible undersampling
drivers/iio/imu/adis16475.c +0
-1-* issues. However, there are users that might really want to take the risk.
drivers/iio/imu/adis16475.c +0
-1-* Hence, we provide a module parameter for them. If set, we allow sample
drivers/iio/imu/adis16475.c +0
-1-* rates lower than 1.9KHz. By default, we won't allow this and we just roundup
drivers/iio/imu/adis16475.c +0
-1-* the rate to the next multiple of the input clock bigger than 1.9KHz. This
drivers/iio/imu/adis16475.c +0
-1-* is done like this as in some cases (when DEC_RATE is 0) might give
drivers/iio/imu/adis16475.c +1
-1-* us the closest value to the one desired by the user... +* with a sample rate lower than internal clock frequency, due to possible
drivers/iio/imu/adis16475.c +1
-0+* undersampling issues. However, there are users that might really want
drivers/iio/imu/adis16475.c +1
-0+* to take the risk. Hence, we provide a module parameter for them. If set,
drivers/iio/imu/adis16475.c +2
-0+* we allow sample rates lower than internal clock frequency. +* By default, we won't allow this and we just roundup the rate to the next
drivers/iio/imu/adis16475.c +1
-0+ * multiple of the input clock. This is done like this as in somecases
drivers/iio/imu/adis16475.c +1
-0+* (when DEC_RATE is 0) might give us the closest value to the one desired
drivers/iio/imu/adis16475.c +1
-0+* by the user... */
drivers/iio/imu/adis16475.c +2
-2-if (scaled_rate <1900000 && !low_rate_allow) - scaled_rate =roundup (1900000 , st->clk_freq); +if (scaled_rate < min_sample_rate && !low_rate_allow) + scaled_rate =roundup (min_sample_rate, st->clk_freq);
sync_scale=scaled_rate/st->clk_freq;
ret =__adis_write_reg_16(&st->adis, ADIS16475_REG_UP_SCALE, sync_scale);drivers/iio/imu/adis16475.c +1
-0@@ -1359,6 +1364,7 @@ static int adis16475_config_sync_mode(struct adis16475 *st) struct device *dev = &st->adis.spi->dev; const struct adis16475_sync *sync; u32 sync_mode; +u16 max_sample_rate = st->info->int_clk +100 ; /* default to internal clk */ st->clk_freq = st->info->int_clk * 1000;@@ -1398,10 +1404,9 @@ static int adis16475_config_sync_mode(struct adis16475 *st) /** In sync scaled mode, the IMU sample rate is the
clk_freq*sync_scale.
* Hence, default the IMU sample rate to the highest multiple of the inputdrivers/iio/imu/adis16475.c +0
-1-* clock lower than the IMU max sample rate. The optimal range is
drivers/iio/imu/adis16475.c +1
-1-* 1900-2100 sps... +* clock lower than the IMU max sample rate. */
drivers/iio/imu/adis16475.c +1
-1- up_scale =2100 / st->clk_freq; + up_scale = max_sample_rate / st->clk_freq;ret = __adis_write_reg_16(&st->adis,
ADIS16475_REG_UP_SCALE, --
2.34.1
PATCH v4 7/10 iio: imu: adis_trigger: Allow level interrupts for FIFO readings
In reply to Ramona GradinariuCurrently, adis library allows configuration only for edge interrupts, needed for data ready sampling.
This patch removes the restriction for level interrupts for devices which have FIFO support.
Furthermore, in case of devices which have FIFO support, devm_request_threaded_irq is used for interrupt allocation, to avoid flooding the processor with the FIFO watermark level interrupt, which is active until enough data has been read from the FIFO.
--- drivers/iio/imu/adis_trigger.c | 37 ++++++++++++++++++++++++---------- include/linux/iio/imu/adis.h | 1 + 2 files changed, 27 insertions(+), 11 deletions(-)
drivers/iio/imu/adis_trigger.c +26 -11
@@ -34,17 +34,24 @@ static int adis_validate_irq_flag(struct adis *adis)if (adis->data->unmasked_drdy) adis->irq_flag |=IRQF_NO_AUTOEN ;/* -* Typically this devices have data ready either on the rising edge or -* on the falling edge of the data ready pin. This checks enforces that -* one of those is set in the drivers... It defaults to -* IRQF_TRIGGER_RISING for backward compatibility with devices that -* don't support changing the pin polarity. +* Typically adis devices without FIFO have data ready either on the +* rising edge or on the falling edge of the data ready pin. +* IMU devices with FIFO support have the watermark pin level driven +* either high or low when the FIFO is filled with the desired number +* of samples. +* It defaults to IRQF_TRIGGER_RISING for backward compatibility with +* devices that don't support changing the pin polarity. */ if (direction ==IRQF_TRIGGER_NONE ) { adis->irq_flag |=IRQF_TRIGGER_RISING ;return 0 ; }else if (direction !=IRQF_TRIGGER_RISING && - direction !=IRQF_TRIGGER_FALLING ) { + direction !=IRQF_TRIGGER_FALLING && !adis->data->has_fifo) { +dev_err (&adis->spi->dev,"Invalid IRQ mask: %08lx\n" , + adis->irq_flag); +return -EINVAL ; + }else if (direction !=IRQF_TRIGGER_HIGH && + direction !=IRQF_TRIGGER_LOW && adis->data->has_fifo) {dev_err (&adis->spi->dev,"Invalid IRQ mask: %08lx\n" , adis->irq_flag);return -EINVAL ;
@@ -77,11 +84,19 @@ int devm_adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev)if (ret)return ret; - ret =devm_request_irq (&adis->spi->dev, adis->spi->irq, - &iio_trigger_generic_data_rdy_poll, - adis->irq_flag, - indio_dev->name, - adis->trig); +if (adis->data->has_fifo) + ret =devm_request_threaded_irq (&adis->spi->dev, adis->spi->irq, +NULL , + &iio_trigger_generic_data_rdy_poll, + adis->irq_flag |IRQF_ONESHOT , + indio_dev->name, + adis->trig); +else + ret =devm_request_irq (&adis->spi->dev, adis->spi->irq, + &iio_trigger_generic_data_rdy_poll, + adis->irq_flag, + indio_dev->name, + adis->trig);if (ret)return ret;
include/linux/iio/imu/adis.h +1 -0
@@ -85,6 +85,7 @@ struct adis_data {bool unmasked_drdy;bool has_paging; +bool has_fifo;unsigned int burst_reg_cmd;unsigned int burst_len;
Signature · 1 line
2.34.1
Re: [PATCH v4 07/10] iio: imu: adis_trigger: Allow level interrupts for FIFO readings
Quoted 11 lines · Ramona Gradinariu
Currently, adis library allows configuration only for edge interrupts, needed for data ready sampling.
This patch removes the restriction for level interrupts for devices which have FIFO support.
Furthermore, in case of devices which have FIFO support,devm_request_threaded_irqis used for interrupt allocation, to avoid flooding the processor with the FIFO watermark level interrupt, which is active until enough data has been read from the FIFO.Signed-off-by Ramona Gradinariu <[email protected]>---
(much better, IMO, commit message :))
Quoted 78 lines
drivers/iio/imu/adis_trigger.c | 37 ++++++++++++++++++++++++---------- include/linux/iio/imu/adis.h | 1 +
2 files changed, 27 insertions(+), 11 deletions(-)drivers/iio/imu/adis_trigger.c +13
-6@@ -34,17 +34,24 @@ static int adis_validate_irq_flag(struct adis *adis) if (adis->data->unmasked_drdy) adis->irq_flag |= IRQF_NO_AUTOEN; /* - * Typically this devices have data ready either on the rising edge or - * on the falling edge of the data ready pin. This checks enforces that - * one of those is set in the drivers... It defaults to - * IRQF_TRIGGER_RISING for backward compatibility with devices that - * don't support changing the pin polarity. + * Typically adis devices without FIFO have data ready either on the + * rising edge or on the falling edge of the data ready pin. + * IMU devices with FIFO support have the watermark pin level driven + * either high or low when the FIFO is filled with the desired number + * of samples. + * It defaults to IRQF_TRIGGER_RISING for backward compatibility with + * devices that don't support changing the pin polarity. */ if (direction == IRQF_TRIGGER_NONE) { adis->irq_flag |= IRQF_TRIGGER_RISING; return 0; } else if (direction != IRQF_TRIGGER_RISING && - direction != IRQF_TRIGGER_FALLING) { + direction != IRQF_TRIGGER_FALLING && !adis->data->has_fifo) { +dev_err (&adis->spi->dev,"Invalid IRQ mask: %08lx\n" , + adis->irq_flag); +return -EINVAL ; + }else if (direction !=IRQF_TRIGGER_HIGH && + direction != IRQF_TRIGGER_LOW && adis->data->has_fifo) { dev_err(&adis->spi->dev, "Invalid IRQ mask: %08lx\n", adis->irq_flag); return -EINVAL;@@ -77,11 +84,19 @@ int devm_adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev) if (ret) return ret;drivers/iio/imu/adis_trigger.c +4
-5- ret =devm_request_irq (&adis->spi->dev, adis->spi->irq, - &iio_trigger_generic_data_rdy_poll, - adis->irq_flag, - indio_dev->name, - adis->trig); +if (adis->data->has_fifo) + ret =devm_request_threaded_irq (&adis->spi->dev, adis->spi->irq, +NULL , + &iio_trigger_generic_data_rdy_poll,
drivers/iio/imu/adis_trigger.c +9
-0+ adis->irq_flag |IRQF_ONESHOT , + indio_dev->name, + adis->trig); + else + ret =devm_request_irq (&adis->spi->dev, adis->spi->irq, + &iio_trigger_generic_data_rdy_poll, + adis->irq_flag, + indio_dev->name, + adis->trig);if (ret)
return ret;include/linux/iio/imu/adis.h +0
-0@@ -85,6 +85,7 @@ struct adis_data { bool unmasked_drdy;
boolhas_paging;include/linux/iio/imu/adis.h +1
-0+bool has_fifo;
unsigned intburst_reg_cmd;
unsigned intburst_len;
PATCH v4 8/10 iio: imu: adis16475: Re-define ADIS16475_DATA
In reply to Ramona GradinariuRe-define ADIS16475_DATA such that it takes _has_fifo as parameter.
--- drivers/iio/imu/adis16475.c | 95 +++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 47 deletions(-)
drivers/iio/imu/adis16475.c +48 -47
@@ -695,32 +695,33 @@ static const char * const adis16475_status_error_msgs[] = { [ADIS16475_DIAG_STAT_CLK] = "Clock error", }; -#define ADIS16475_DATA (_prod_id, _timeouts, _burst_max_len, _burst_max_speed_hz) \ -{ \ - .msc_ctrl_reg = ADIS16475_REG_MSG_CTRL, \ - .glob_cmd_reg = ADIS16475_REG_GLOB_CMD, \ - .diag_stat_reg = ADIS16475_REG_DIAG_STAT, \ - .prod_id_reg = ADIS16475_REG_PROD_ID, \ - .prod_id = (_prod_id), \ - .self_test_mask = BIT(2), \ - .self_test_reg = ADIS16475_REG_GLOB_CMD, \ - .cs_change_delay = 16, \ - .read_delay = 5, \ - .write_delay = 5, \ - .status_error_msgs = adis16475_status_error_msgs, \ - .status_error_mask = BIT(ADIS16475_DIAG_STAT_DATA_PATH) | \ - BIT(ADIS16475_DIAG_STAT_FLASH_MEM) | \ - BIT(ADIS16475_DIAG_STAT_SPI) | \ - BIT(ADIS16475_DIAG_STAT_STANDBY) | \ - BIT(ADIS16475_DIAG_STAT_SENSOR) | \ - BIT(ADIS16475_DIAG_STAT_MEMORY) | \ - BIT(ADIS16475_DIAG_STAT_CLK), \ - .unmasked_drdy = true, \ - .timeouts = (_timeouts), \ - .burst_reg_cmd = ADIS16475_REG_GLOB_CMD, \ - .burst_len = ADIS16475_BURST_MAX_DATA, \ - .burst_max_len = _burst_max_len, \ - .burst_max_speed_hz = _burst_max_speed_hz \ +#define ADIS16475_DATA (_prod_id, _timeouts, _burst_max_len, _burst_max_speed_hz, _has_fifo) \ +{ \ + .msc_ctrl_reg = ADIS16475_REG_MSG_CTRL, \ + .glob_cmd_reg = ADIS16475_REG_GLOB_CMD, \ + .diag_stat_reg = ADIS16475_REG_DIAG_STAT, \ + .prod_id_reg = ADIS16475_REG_PROD_ID, \ + .prod_id = (_prod_id), \ + .self_test_mask = BIT(2), \ + .self_test_reg = ADIS16475_REG_GLOB_CMD, \ + .cs_change_delay = 16, \ + .read_delay = 5, \ + .write_delay = 5, \ + .status_error_msgs = adis16475_status_error_msgs, \ + .status_error_mask = BIT(ADIS16475_DIAG_STAT_DATA_PATH) | \ + BIT(ADIS16475_DIAG_STAT_FLASH_MEM) | \ + BIT(ADIS16475_DIAG_STAT_SPI) | \ + BIT(ADIS16475_DIAG_STAT_STANDBY) | \ + BIT(ADIS16475_DIAG_STAT_SENSOR) | \ + BIT(ADIS16475_DIAG_STAT_MEMORY) | \ + BIT(ADIS16475_DIAG_STAT_CLK), \ + .unmasked_drdy = true, \ + .has_fifo = _has_fifo, \ + .timeouts = (_timeouts), \ + .burst_reg_cmd = ADIS16475_REG_GLOB_CMD, \ + .burst_len = ADIS16475_BURST_MAX_DATA, \ + .burst_max_len = _burst_max_len, \ + .burst_max_speed_hz = _burst_max_speed_hz \ }static const struct adis16475_sync adis16475_sync_mode[] = {
@@ -760,7 +761,7 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .num_sync = ARRAY_SIZE(adis16475_sync_mode), .adis_data =ADIS16475_DATA (16470 , &adis16475_timeouts,ADIS16475_BURST32_MAX_DATA , - ADIS16475_BURST_MAX_SPEED), + ADIS16475_BURST_MAX_SPEED, false), }, [ADIS16475_1] = { .name = "adis16475-1",
@@ -779,7 +780,7 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .num_sync = ARRAY_SIZE(adis16475_sync_mode), .adis_data =ADIS16475_DATA (16475 , &adis16475_timeouts,ADIS16475_BURST32_MAX_DATA , - ADIS16475_BURST_MAX_SPEED), + ADIS16475_BURST_MAX_SPEED, false), }, [ADIS16475_2] = { .name = "adis16475-2",
@@ -798,7 +799,7 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .num_sync = ARRAY_SIZE(adis16475_sync_mode), .adis_data =ADIS16475_DATA (16475 , &adis16475_timeouts,ADIS16475_BURST32_MAX_DATA , - ADIS16475_BURST_MAX_SPEED), + ADIS16475_BURST_MAX_SPEED, false), }, [ADIS16475_3] = { .name = "adis16475-3",
@@ -817,7 +818,7 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .num_sync = ARRAY_SIZE(adis16475_sync_mode), .adis_data =ADIS16475_DATA (16475 , &adis16475_timeouts,ADIS16475_BURST32_MAX_DATA , - ADIS16475_BURST_MAX_SPEED), + ADIS16475_BURST_MAX_SPEED, false), }, [ADIS16477_1] = { .name = "adis16477-1",
@@ -837,7 +838,7 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, .adis_data =ADIS16475_DATA (16477 , &adis16475_timeouts,ADIS16475_BURST32_MAX_DATA , - ADIS16475_BURST_MAX_SPEED), + ADIS16475_BURST_MAX_SPEED, false), }, [ADIS16477_2] = { .name = "adis16477-2",
@@ -857,7 +858,7 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, .adis_data =ADIS16475_DATA (16477 , &adis16475_timeouts,ADIS16475_BURST32_MAX_DATA , - ADIS16475_BURST_MAX_SPEED), + ADIS16475_BURST_MAX_SPEED, false), }, [ADIS16477_3] = { .name = "adis16477-3",
@@ -877,7 +878,7 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, .adis_data =ADIS16475_DATA (16477 , &adis16475_timeouts,ADIS16475_BURST32_MAX_DATA , - ADIS16475_BURST_MAX_SPEED), + ADIS16475_BURST_MAX_SPEED, false), }, [ADIS16465_1] = { .name = "adis16465-1",
@@ -896,7 +897,7 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .num_sync = ARRAY_SIZE(adis16475_sync_mode), .adis_data =ADIS16475_DATA (16465 , &adis16475_timeouts,ADIS16475_BURST32_MAX_DATA , - ADIS16475_BURST_MAX_SPEED), + ADIS16475_BURST_MAX_SPEED, false), }, [ADIS16465_2] = { .name = "adis16465-2",
@@ -915,7 +916,7 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .num_sync = ARRAY_SIZE(adis16475_sync_mode), .adis_data =ADIS16475_DATA (16465 , &adis16475_timeouts,ADIS16475_BURST32_MAX_DATA , - ADIS16475_BURST_MAX_SPEED), + ADIS16475_BURST_MAX_SPEED, false), }, [ADIS16465_3] = { .name = "adis16465-3",
@@ -934,7 +935,7 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .num_sync = ARRAY_SIZE(adis16475_sync_mode), .adis_data =ADIS16475_DATA (16465 , &adis16475_timeouts,ADIS16475_BURST32_MAX_DATA , - ADIS16475_BURST_MAX_SPEED), + ADIS16475_BURST_MAX_SPEED, false), }, [ADIS16467_1] = { .name = "adis16467-1",
@@ -953,7 +954,7 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .num_sync = ARRAY_SIZE(adis16475_sync_mode), .adis_data =ADIS16475_DATA (16467 , &adis16475_timeouts,ADIS16475_BURST32_MAX_DATA , - ADIS16475_BURST_MAX_SPEED), + ADIS16475_BURST_MAX_SPEED, false), }, [ADIS16467_2] = { .name = "adis16467-2",
@@ -972,7 +973,7 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .num_sync = ARRAY_SIZE(adis16475_sync_mode), .adis_data =ADIS16475_DATA (16467 , &adis16475_timeouts,ADIS16475_BURST32_MAX_DATA , - ADIS16475_BURST_MAX_SPEED), + ADIS16475_BURST_MAX_SPEED, false), }, [ADIS16467_3] = { .name = "adis16467-3",
@@ -991,7 +992,7 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .num_sync = ARRAY_SIZE(adis16475_sync_mode), .adis_data =ADIS16475_DATA (16467 , &adis16475_timeouts,ADIS16475_BURST32_MAX_DATA , - ADIS16475_BURST_MAX_SPEED), + ADIS16475_BURST_MAX_SPEED, false), }, [ADIS16500] = { .name = "adis16500",
@@ -1012,7 +1013,7 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, .adis_data =ADIS16475_DATA (16500 , &adis1650x_timeouts,ADIS16475_BURST32_MAX_DATA , - ADIS16475_BURST_MAX_SPEED), + ADIS16475_BURST_MAX_SPEED, false), }, [ADIS16501] = { .name = "adis16501",
@@ -1033,7 +1034,7 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, .adis_data =ADIS16475_DATA (16501 , &adis1650x_timeouts,ADIS16475_BURST32_MAX_DATA , - ADIS16475_BURST_MAX_SPEED), + ADIS16475_BURST_MAX_SPEED, false), }, [ADIS16505_1] = { .name = "adis16505-1",
@@ -1054,7 +1055,7 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, .adis_data =ADIS16475_DATA (16505 , &adis1650x_timeouts,ADIS16475_BURST32_MAX_DATA , - ADIS16475_BURST_MAX_SPEED), + ADIS16475_BURST_MAX_SPEED, false), }, [ADIS16505_2] = { .name = "adis16505-2",
@@ -1075,7 +1076,7 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, .adis_data =ADIS16475_DATA (16505 , &adis1650x_timeouts,ADIS16475_BURST32_MAX_DATA , - ADIS16475_BURST_MAX_SPEED), + ADIS16475_BURST_MAX_SPEED, false), }, [ADIS16505_3] = { .name = "adis16505-3",
@@ -1096,7 +1097,7 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, .adis_data =ADIS16475_DATA (16505 , &adis1650x_timeouts,ADIS16475_BURST32_MAX_DATA , - ADIS16475_BURST_MAX_SPEED), + ADIS16475_BURST_MAX_SPEED, false), }, [ADIS16507_1] = { .name = "adis16507-1",
@@ -1117,7 +1118,7 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, .adis_data =ADIS16475_DATA (16507 , &adis1650x_timeouts,ADIS16475_BURST32_MAX_DATA , - ADIS16475_BURST_MAX_SPEED), + ADIS16475_BURST_MAX_SPEED, false), }, [ADIS16507_2] = { .name = "adis16507-2",
@@ -1138,7 +1139,7 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, .adis_data =ADIS16475_DATA (16507 , &adis1650x_timeouts,ADIS16475_BURST32_MAX_DATA , - ADIS16475_BURST_MAX_SPEED), + ADIS16475_BURST_MAX_SPEED, false), }, [ADIS16507_3] = { .name = "adis16507-3",
@@ -1159,7 +1160,7 @@ static const struct adis16475_chip_info adis16475_chip_info[] = { .flags = ADIS16475_HAS_BURST32 | ADIS16475_HAS_BURST_DELTA_DATA, .adis_data =ADIS16475_DATA (16507 , &adis1650x_timeouts,ADIS16475_BURST32_MAX_DATA , - ADIS16475_BURST_MAX_SPEED), + ADIS16475_BURST_MAX_SPEED, false), }, };
Signature · 1 line
2.34.1
Re: [PATCH v4 08/10] iio: imu: adis16475: Re-define ADIS16475_DATA
Quoted 4 lines · Ramona Gradinariu
Re-define
ADIS16475_DATAsuch that it takes_has_fifoas parameter.Signed-off-by Ramona Gradinariu <[email protected]>---
I may be missing something but do we actually need to patches redefining the macro? If I'm not missing nothing the first patch is only relevant for the new ADIS devices which are added in patch 10. So maybe squash both patches changing the macro.
- Nuno Sá
Jonathan Cameron
maintainerRe: [PATCH v4 08/10] iio: imu: adis16475: Re-define ADIS16475_DATA
Quoted 12 lines · On Fri, 24 May 2024 12:47:38 +0200 Nuno Sá <[email protected]> wrote:
Quoted 4 lines · Ramona Gradinariu
Re-define
ADIS16475_DATAsuch that it takes_has_fifoas parameter.Signed-off-by Ramona Gradinariu <[email protected]>---
I may be missing something but do we actually need to patches redefining the macro? If I'm not missing nothing the first patch is only relevant for the new ADIS devices which are added in patch 10. So maybe squash both patches changing the macro.
- Nuno Sá
If that's not possible for some reason, give them both slightly more detailed patch titles. It's confusing to have them identical!
I'd prefer them squashed as Nuno suggested.
PATCH v4 9/10 dt-bindings: iio: imu: Add ADIS1657X family devices compatibles
In reply to Ramona GradinariuAdd ADIS1657X family devices compatibles and specify the according maximum SPI baudrate.
Similarly to other ADIS1650X devices, ADIS1657X supports sync-mode values [0,2].
Each newly added device has a different angular velocity/linear acceleration/ delta velocity scale combination, as follows:
Accel dynamic range sensitivity:
- 262144000 LSB/g: ADIS16575
- 52428800 LSB/g: ADIS16576, ADIS16577
Gyro dynamic range sensitivity:
- 2621440 LSB/deg/sec: ADIS1575-2, ADIS1576-2, ADIS1577-2
- 655360 LSB/deg/sec: ADIS1575-3, ADIS1576-3, ADIS1577-3 Delta velocity sensitivity:
- 2^15/100 LSB/m/sec: ADIS16575
- 2^15/125 LSB/m/sec: ADIS16576
- 2^15/400 LSB/m/sec: ADIS16577
Each ADIS1657X device supports FIFO usage and a sample-rate of 4.1KHz, meanwhile the already existing devices do not support FIFO usage and have a maximum sample-rate of 2.1KHz.
---
no changes in v4
.../bindings/iio/imu/adi,adis16475.yaml | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+)
Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml +29 -0
@@ -37,6 +37,12 @@ properties: - adi,adis16507-1 - adi,adis16507-2 - adi,adis16507-3 + - adi,adis16575-2 + - adi,adis16575-3 + - adi,adis16576-2 + - adi,adis16576-3 + - adi,adis16577-2 + - adi,adis16577-3 reg: maxItems: 1
@@ -98,6 +104,12 @@ allOf: - adi,adis16507-1 - adi,adis16507-2 - adi,adis16507-3 + - adi,adis16575-2 + - adi,adis16575-3 + - adi,adis16576-2 + - adi,adis16576-3 + - adi,adis16577-2 + - adi,adis16577-3 then: properties:
@@ -114,6 +126,23 @@ allOf: dependencies: adi,sync-mode: [ clocks ] + - if: + properties: + compatible: + contains: + enum: + - adi,adis16575-2 + - adi,adis16575-3 + - adi,adis16576-2 + - adi,adis16576-3 + - adi,adis16577-2 + - adi,adis16577-3 + + then: + properties: + spi-max-frequency: + maximum: 15000000 + unevaluatedProperties: false examples:
--
2.34.1