From 380b107bbf9449ddea0637cefe65a6cbf7b6ca84 Mon Sep 17 00:00:00 2001 From: Nuno Sá Date: Tue, 7 Jan 2020 13:17:04 +0200 Subject: iio: adis: Introduce timeouts structure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The adis library only allows to define a `startup_delay` which for some devices is enough. However, other devices define different timeouts with significantly different timings which could lead to devices to not wait enough time or to wait a lot more than necessary (which is not efficient). This patch introduces a new timeout struct that must be passed into `adis_init()`. There are mainly, for now, three timeouts used. This is also an introductory patch with the goal of refactoring `adis_initial_startup()`. New driver's (eg: adis16480, adis16460) are replicating code for the device initial setup. With some changes (being this the first one) we can pass this to `adis_initial_startup()`. Signed-off-by: Nuno Sá Signed-off-by: Alexandru Ardelean Signed-off-by: Jonathan Cameron --- include/linux/iio/imu/adis.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/linux/iio') diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h index 4b5bc0e06e69..853dc8c8365c 100644 --- a/include/linux/iio/imu/adis.h +++ b/include/linux/iio/imu/adis.h @@ -22,6 +22,17 @@ struct adis; struct adis_burst; +/** + * struct adis_timeouts - ADIS chip variant timeouts + * @reset_ms - Wait time after rst pin goes inactive + * @sw_reset_ms - Wait time after sw reset command + * @self_test_ms - Wait time after self test command + */ +struct adis_timeout { + u16 reset_ms; + u16 sw_reset_ms; + u16 self_test_ms; +}; /** * struct adis_data - ADIS chip variant specific data * @read_delay: SPI delay for read operations in us @@ -32,6 +43,7 @@ struct adis_burst; * @diag_stat_reg: Register address of the DIAG_STAT register * @status_error_msgs: Array of error messgaes * @status_error_mask: + * @timeouts: Chip specific delays */ struct adis_data { unsigned int read_delay; @@ -45,6 +57,7 @@ struct adis_data { unsigned int self_test_mask; bool self_test_no_autoclear; unsigned int startup_delay; + const struct adis_timeout *timeouts; const char * const *status_error_msgs; unsigned int status_error_mask; -- cgit v1.2.3-70-g09d2