Lines Matching +full:page +full:- +full:mode +full:- +full:read +full:- +full:delay

1 // SPDX-License-Identifier: GPL-2.0-or-later
17 #include <linux/delay.h>
53 static ushort delay = ZL6100_WAIT_TIME; variable
54 module_param(delay, ushort, 0644);
55 MODULE_PARM_DESC(delay, "Delay between chip accesses in uS");
57 /* Convert linear sensor value to milli-units */
69 /* scale result to milli-units */ in zl6100_l2d()
75 val >>= -exponent; in zl6100_l2d()
94 val = -val; in zl6100_d2l()
103 while (val < MIN_MANTISSA && exponent > -15) { in zl6100_d2l()
104 exponent--; in zl6100_d2l()
108 /* Convert mantissa from milli-units to units */ in zl6100_d2l()
117 mantissa = -mantissa; in zl6100_d2l()
123 static int zl6100_read_word_data(struct i2c_client *client, int page, in zl6100_read_word_data() argument
130 if (page >= info->pages) in zl6100_read_word_data()
131 return -ENXIO; in zl6100_read_word_data()
133 if (data->id == zl2005) { in zl6100_read_word_data()
142 return -ENXIO; in zl6100_read_word_data()
160 return -ENXIO; in zl6100_read_word_data()
165 ret = pmbus_read_word_data(client, page, phase, vreg); in zl6100_read_word_data()
181 static int zl6100_read_byte_data(struct i2c_client *client, int page, int reg) in zl6100_read_byte_data() argument
186 if (page >= info->pages) in zl6100_read_byte_data()
187 return -ENXIO; in zl6100_read_byte_data()
208 ret = pmbus_read_byte_data(client, page, reg); in zl6100_read_byte_data()
215 static int zl6100_write_word_data(struct i2c_client *client, int page, int reg, in zl6100_write_word_data() argument
221 if (page >= info->pages) in zl6100_write_word_data()
222 return -ENXIO; in zl6100_write_word_data()
245 return -ENXIO; in zl6100_write_word_data()
249 return pmbus_write_word_data(client, page, vreg, word); in zl6100_write_word_data()
287 if (!i2c_check_functionality(client->adapter, in zl6100_probe()
290 return -ENODEV; in zl6100_probe()
295 dev_err(&client->dev, "Failed to read device ID\n"); in zl6100_probe()
299 dev_info(&client->dev, "Device ID %s\n", device_id); in zl6100_probe()
302 for (mid = zl6100_id; mid->name[0]; mid++) { in zl6100_probe()
303 if (!strncasecmp(mid->name, device_id, strlen(mid->name))) in zl6100_probe()
306 if (!mid->name[0]) { in zl6100_probe()
307 dev_err(&client->dev, "Unsupported device\n"); in zl6100_probe()
308 return -ENODEV; in zl6100_probe()
310 if (strcmp(client->name, mid->name) != 0) in zl6100_probe()
311 dev_notice(&client->dev, in zl6100_probe()
313 client->name, mid->name); in zl6100_probe()
315 data = devm_kzalloc(&client->dev, sizeof(struct zl6100_data), in zl6100_probe()
318 return -ENOMEM; in zl6100_probe()
320 data->id = mid->driver_data; in zl6100_probe()
327 udelay(delay); in zl6100_probe()
329 info = &data->info; in zl6100_probe()
331 info->pages = 1; in zl6100_probe()
332 info->func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT in zl6100_probe()
342 if (data->id == zl2004 || data->id == zl8802 || data->id == zl9101 || in zl6100_probe()
343 data->id == zl9117 || data->id == zls4009) in zl6100_probe()
344 info->func[0] |= PMBUS_HAVE_VMON | PMBUS_HAVE_STATUS_VMON; in zl6100_probe()
350 * shared outputs. If the module is in shared output mode, only one in zl6100_probe()
353 if (data->id == zl8802) { in zl6100_probe()
354 info->pages = 2; in zl6100_probe()
355 info->func[0] |= PMBUS_HAVE_IIN; in zl6100_probe()
361 udelay(delay); in zl6100_probe()
364 info->func[1] |= PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT; in zl6100_probe()
366 info->func[1] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT in zl6100_probe()
374 udelay(delay); in zl6100_probe()
381 info->func[i] |= PMBUS_HAVE_TEMP2; in zl6100_probe()
383 udelay(delay); in zl6100_probe()
390 info->func[0] |= PMBUS_HAVE_TEMP3; in zl6100_probe()
397 info->func[0] |= PMBUS_HAVE_TEMP2; in zl6100_probe()
400 udelay(delay); in zl6100_probe()
402 info->access_delay = delay; in zl6100_probe()
403 info->read_word_data = zl6100_read_word_data; in zl6100_probe()
404 info->read_byte_data = zl6100_read_byte_data; in zl6100_probe()
405 info->write_word_data = zl6100_write_word_data; in zl6100_probe()