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
2222 struct adis;
2323 struct adis_burst;
2424
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+};
2536 /**
2637 * struct adis_data - ADIS chip variant specific data
2738 * @read_delay: SPI delay for read operations in us
@@ -32,6 +43,7 @@ struct adis_burst; · 4 unmodified lines
3243 * @diag_stat_reg: Register address of the DIAG_STAT register
3344 * @status_error_msgs: Array of error messgaes
3445 * @status_error_mask:
46+ * @timeouts: Chip specific delays
3547 */
3648 struct adis_data {
3749 unsigned int read_delay;
@@ -45,6 +57,7 @@ struct adis_data { · 7 unmodified lines
4557 unsigned int self_test_mask;
4658 bool self_test_no_autoclear;
4759 unsigned int startup_delay;
60+ const struct adis_timeout *timeouts;
4861
4962 const char * const *status_error_msgs;
5063 unsigned int status_error_mask;