Lines Matching +full:delay +full:- +full:us
1 // SPDX-License-Identifier: GPL-2.0-or-later
8 * extensive empirical testing has revealed that auto-detection of
9 * limit-registers will fail in a random fashion unless the delay
10 * parameter is set to above about 80us. The default delay is set
11 * to 100us to include some safety margin.
21 #include <linux/delay.h>
35 int delay; /* Delay between chip accesses in us */ member
41 #define MAX15301_WAIT_TIME 100 /* us */
43 static ushort delay = MAX15301_WAIT_TIME; variable
44 module_param(delay, ushort, 0644);
45 MODULE_PARM_DESC(delay, "Delay between chip accesses in us");
58 /* This chip needs a delay between accesses */
61 if (data->delay) { in max15301_wait()
62 s64 delta = ktime_us_delta(ktime_get(), data->access); in max15301_wait()
64 if (delta < data->delay) in max15301_wait()
65 udelay(data->delay - delta); in max15301_wait()
77 return -ENXIO; in max15301_read_word_data()
80 return -ENXIO; in max15301_read_word_data()
84 data->access = ktime_get(); in max15301_read_word_data()
96 return -ENXIO; in max15301_read_byte_data()
100 data->access = ktime_get(); in max15301_read_byte_data()
113 return -ENXIO; in max15301_write_word_data()
116 return -ENXIO; in max15301_write_word_data()
120 data->access = ktime_get(); in max15301_write_word_data()
132 return -ENXIO; in max15301_write_byte()
136 data->access = ktime_get(); in max15301_write_byte()
148 if (!i2c_check_functionality(client->adapter, in max15301_probe()
151 return -ENODEV; in max15301_probe()
155 dev_err(&client->dev, "Failed to read Device Id\n"); in max15301_probe()
158 for (mid = max15301_id; mid->name[0]; mid++) { in max15301_probe()
159 if (!strncasecmp(mid->name, device_id, strlen(mid->name))) in max15301_probe()
162 if (!mid->name[0]) { in max15301_probe()
163 dev_err(&client->dev, "Unsupported device\n"); in max15301_probe()
164 return -ENODEV; in max15301_probe()
167 max15301_data.delay = delay; in max15301_probe()
169 info->read_byte_data = max15301_read_byte_data; in max15301_probe()
170 info->read_word_data = max15301_read_word_data; in max15301_probe()
171 info->write_byte = max15301_write_byte; in max15301_probe()
172 info->write_word_data = max15301_write_word_data; in max15301_probe()