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()`.
Showing the changes to include/linux (1 of 11 files). Show all
Unified · Split
| @@ -22,6 +22,17 @@ · 21 unmodified lines | |||
| 22 | struct adis; | 22 | struct adis; |
| 23 | struct adis_burst; | 23 | struct 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 | */ | ||
| 31 | struct 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 data | 37 | * struct adis_data - ADIS chip variant specific data |
| 27 | * @read_delay: SPI delay for read operations in us | 38 | * @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 register | 43 | * @diag_stat_reg: Register address of the DIAG_STAT register |
| 33 | * @status_error_msgs: Array of error messgaes | 44 | * @status_error_msgs: Array of error messgaes |
| 34 | * @status_error_mask: | 45 | * @status_error_mask: |
| 46 | * @timeouts: Chip specific delays | ||
| 35 | */ | 47 | */ |
| 36 | struct adis_data { | 48 | struct 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; |