@@ -22,8 +22,6 @@ enum chips { zl2004, zl2005, zl2006, zl2008, zl2105, zl2106, zl6100, zl6105,
22
22
23
23
struct zl6100_data {
24
24
int id ;
25
- ktime_t access ; /* chip access time */
26
- int delay ; /* Delay between chip accesses in uS */
27
25
struct pmbus_driver_info info ;
28
26
};
29
27
@@ -122,16 +120,6 @@ static u16 zl6100_d2l(long val)
122
120
return (mantissa & 0x7ff ) | ((exponent << 11 ) & 0xf800 );
123
121
}
124
122
125
- /* Some chips need a delay between accesses */
126
- static inline void zl6100_wait (const struct zl6100_data * data )
127
- {
128
- if (data -> delay ) {
129
- s64 delta = ktime_us_delta (ktime_get (), data -> access );
130
- if (delta < data -> delay )
131
- udelay (data -> delay - delta );
132
- }
133
- }
134
-
135
123
static int zl6100_read_word_data (struct i2c_client * client , int page ,
136
124
int phase , int reg )
137
125
{
@@ -174,9 +162,7 @@ static int zl6100_read_word_data(struct i2c_client *client, int page,
174
162
break ;
175
163
}
176
164
177
- zl6100_wait (data );
178
165
ret = pmbus_read_word_data (client , page , phase , vreg );
179
- data -> access = ktime_get ();
180
166
if (ret < 0 )
181
167
return ret ;
182
168
@@ -195,14 +181,11 @@ static int zl6100_read_word_data(struct i2c_client *client, int page,
195
181
static int zl6100_read_byte_data (struct i2c_client * client , int page , int reg )
196
182
{
197
183
const struct pmbus_driver_info * info = pmbus_get_driver_info (client );
198
- struct zl6100_data * data = to_zl6100_data (info );
199
184
int ret , status ;
200
185
201
186
if (page >= info -> pages )
202
187
return - ENXIO ;
203
188
204
- zl6100_wait (data );
205
-
206
189
switch (reg ) {
207
190
case PMBUS_VIRT_STATUS_VMON :
208
191
ret = pmbus_read_byte_data (client , 0 ,
@@ -225,7 +208,6 @@ static int zl6100_read_byte_data(struct i2c_client *client, int page, int reg)
225
208
ret = pmbus_read_byte_data (client , page , reg );
226
209
break ;
227
210
}
228
- data -> access = ktime_get ();
229
211
230
212
return ret ;
231
213
}
@@ -234,8 +216,7 @@ static int zl6100_write_word_data(struct i2c_client *client, int page, int reg,
234
216
u16 word )
235
217
{
236
218
const struct pmbus_driver_info * info = pmbus_get_driver_info (client );
237
- struct zl6100_data * data = to_zl6100_data (info );
238
- int ret , vreg ;
219
+ int vreg ;
239
220
240
221
if (page >= info -> pages )
241
222
return - ENXIO ;
@@ -265,27 +246,7 @@ static int zl6100_write_word_data(struct i2c_client *client, int page, int reg,
265
246
vreg = reg ;
266
247
}
267
248
268
- zl6100_wait (data );
269
- ret = pmbus_write_word_data (client , page , vreg , word );
270
- data -> access = ktime_get ();
271
-
272
- return ret ;
273
- }
274
-
275
- static int zl6100_write_byte (struct i2c_client * client , int page , u8 value )
276
- {
277
- const struct pmbus_driver_info * info = pmbus_get_driver_info (client );
278
- struct zl6100_data * data = to_zl6100_data (info );
279
- int ret ;
280
-
281
- if (page >= info -> pages )
282
- return - ENXIO ;
283
-
284
- zl6100_wait (data );
285
- ret = pmbus_write_byte (client , page , value );
286
- data -> access = ktime_get ();
287
-
288
- return ret ;
249
+ return pmbus_write_word_data (client , page , vreg , word );
289
250
}
290
251
291
252
static const struct i2c_device_id zl6100_id [] = {
@@ -363,14 +324,7 @@ static int zl6100_probe(struct i2c_client *client)
363
324
* supported chips are known to require a wait time between I2C
364
325
* accesses.
365
326
*/
366
- data -> delay = delay ;
367
-
368
- /*
369
- * Since there was a direct I2C device access above, wait before
370
- * accessing the chip again.
371
- */
372
- data -> access = ktime_get ();
373
- zl6100_wait (data );
327
+ udelay (delay );
374
328
375
329
info = & data -> info ;
376
330
@@ -404,8 +358,7 @@ static int zl6100_probe(struct i2c_client *client)
404
358
if (ret < 0 )
405
359
return ret ;
406
360
407
- data -> access = ktime_get ();
408
- zl6100_wait (data );
361
+ udelay (delay );
409
362
410
363
if (ret & ZL8802_MFR_PHASES_MASK )
411
364
info -> func [1 ] |= PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT ;
@@ -418,8 +371,7 @@ static int zl6100_probe(struct i2c_client *client)
418
371
if (ret < 0 )
419
372
return ret ;
420
373
421
- data -> access = ktime_get ();
422
- zl6100_wait (data );
374
+ udelay (delay );
423
375
424
376
ret = i2c_smbus_read_word_data (client , ZL8802_MFR_USER_CONFIG );
425
377
if (ret < 0 )
@@ -428,8 +380,7 @@ static int zl6100_probe(struct i2c_client *client)
428
380
if (ret & ZL8802_MFR_XTEMP_ENABLE_2 )
429
381
info -> func [i ] |= PMBUS_HAVE_TEMP2 ;
430
382
431
- data -> access = ktime_get ();
432
- zl6100_wait (data );
383
+ udelay (delay );
433
384
}
434
385
ret = i2c_smbus_read_word_data (client , ZL8802_MFR_USER_GLOBAL_CONFIG );
435
386
if (ret < 0 )
@@ -446,13 +397,12 @@ static int zl6100_probe(struct i2c_client *client)
446
397
info -> func [0 ] |= PMBUS_HAVE_TEMP2 ;
447
398
}
448
399
449
- data -> access = ktime_get ();
450
- zl6100_wait (data );
400
+ udelay (delay );
451
401
402
+ info -> access_delay = delay ;
452
403
info -> read_word_data = zl6100_read_word_data ;
453
404
info -> read_byte_data = zl6100_read_byte_data ;
454
405
info -> write_word_data = zl6100_write_word_data ;
455
- info -> write_byte = zl6100_write_byte ;
456
406
457
407
return pmbus_do_probe (client , info );
458
408
}
0 commit comments