History

iio: adis: Introduce timeouts structure

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()`.

Nuno Sá committed 6 years ago

Commit 380b1071 parent 687d39d11 files · +227 −7Browse files

Showing the changes to include/linux (1 of 11 files). Show all

Unified · Split

include/linux/iio/imu/adis.h+13−0
@@ -22,6 +22,17 @@ · 21 unmodified lines
22struct adis;22struct adis;
23struct adis_burst;23struct adis_burst;
24 24
25/**
26 * struct adis_timeouts - ADIS chip variant timeouts
27 * @reset_ms - Wait time after rst pin goes inactive
28 * @sw_reset_ms - Wait time after sw reset command
29 * @self_test_ms - Wait time after self test command
30 */
31struct adis_timeout {
32 u16 reset_ms;
33 u16 sw_reset_ms;
34 u16 self_test_ms;
35};
25/**36/**
26 * struct adis_data - ADIS chip variant specific data37 * struct adis_data - ADIS chip variant specific data
27 * @read_delay: SPI delay for read operations in us38 * @read_delay: SPI delay for read operations in us
@@ -32,6 +43,7 @@ struct adis_burst; · 4 unmodified lines
32 * @diag_stat_reg: Register address of the DIAG_STAT register43 * @diag_stat_reg: Register address of the DIAG_STAT register
33 * @status_error_msgs: Array of error messgaes44 * @status_error_msgs: Array of error messgaes
34 * @status_error_mask:45 * @status_error_mask:
46 * @timeouts: Chip specific delays
35 */47 */
36struct adis_data {48struct adis_data {
37 unsigned int read_delay;49 unsigned int read_delay;
@@ -45,6 +57,7 @@ struct adis_data { · 7 unmodified lines
45 unsigned int self_test_mask;57 unsigned int self_test_mask;
46 bool self_test_no_autoclear;58 bool self_test_no_autoclear;
47 unsigned int startup_delay;59 unsigned int startup_delay;
60 const struct adis_timeout *timeouts;
48 61
49 const char * const *status_error_msgs;62 const char * const *status_error_msgs;
50 unsigned int status_error_mask;63 unsigned int status_error_mask;