Lines Matching +full:- +full:30 +full:mv
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Hardware monitoring driver for Analog Devices ADM1275 Hot-Swap Controller
110 [0] = { 27169, 0, -1 }, /* voltage */
111 [1] = { 806, 20475, -1 }, /* current, irange25 */
112 [2] = { 404, 20475, -1 }, /* current, irange50 */
113 [3] = { 8549, 0, -1 }, /* power, irange25 */
114 [4] = { 4279, 0, -1 }, /* power, irange50 */
118 [0] = { 6770, 0, -2 }, /* voltage, vrange 60V */
119 [1] = { 4062, 0, -2 }, /* voltage, vrange 100V */
120 [2] = { 1326, 20480, -1 }, /* current, vsense range 15mV */
121 [3] = { 663, 20480, -1 }, /* current, vsense range 30mV */
122 [4] = { 3512, 0, -2 }, /* power, vrange 60V, irange 15mV */
123 [5] = { 21071, 0, -3 }, /* power, vrange 100V, irange 15mV */
124 [6] = { 17561, 0, -3 }, /* power, vrange 60V, irange 30mV */
125 [7] = { 10535, 0, -3 }, /* power, vrange 100V, irange 30mV */
126 [8] = { 42, 31871, -1 }, /* temperature */
131 [0] = { 19199, 0, -2 }, /* voltage, vrange set */
132 [1] = { 6720, 0, -1 }, /* voltage, vrange not set */
133 [2] = { 807, 20475, -1 }, /* current */
137 [0] = { 19199, 0, -2 }, /* voltage, vrange set */
138 [1] = { 6720, 0, -1 }, /* voltage, vrange not set */
139 [2] = { 807, 20475, -1 }, /* current */
140 [3] = { 6043, 0, -2 }, /* power, vrange set */
141 [4] = { 2115, 0, -1 }, /* power, vrange not set */
145 [0] = { 19599, 0, -2 }, /* voltage */
146 [1] = { 800, 20475, -1 }, /* current */
147 [2] = { 6123, 0, -2 }, /* power */
148 [3] = { 42, 31880, -1 }, /* temperature */
152 [0] = { 3333, -1, 0 }, /* voltage, vrange 1.2V */
153 [1] = { 5552, -5, -1 }, /* voltage, vrange 7.4V */
154 [2] = { 19604, -50, -2 }, /* voltage, vrange 21V */
155 [3] = { 8000, -100, -2 }, /* current, irange25 */
156 [4] = { 4000, -100, -2 }, /* current, irange50 */
157 [5] = { 20000, -1000, -3 }, /* current, irange100 */
158 [6] = { 10000, -1000, -3 }, /* current, irange200 */
159 [7] = { 10417, 0, -1 }, /* power, 1.2V, irange25 */
160 [8] = { 5208, 0, -1 }, /* power, 1.2V, irange50 */
161 [9] = { 26042, 0, -2 }, /* power, 1.2V, irange100 */
162 [10] = { 13021, 0, -2 }, /* power, 1.2V, irange200 */
163 [11] = { 17351, 0, -2 }, /* power, 7.4V, irange25 */
164 [12] = { 8676, 0, -2 }, /* power, 7.4V, irange50 */
165 [13] = { 4338, 0, -2 }, /* power, 7.4V, irange100 */
166 [14] = { 21689, 0, -3 }, /* power, 7.4V, irange200 */
167 [15] = { 6126, 0, -2 }, /* power, 21V, irange25 */
168 [16] = { 30631, 0, -3 }, /* power, 21V, irange50 */
169 [17] = { 15316, 0, -3 }, /* power, 21V, irange100 */
170 [18] = { 7658, 0, -3 }, /* power, 21V, irange200 */
180 * The PMON configuration register is a 16-bit register only on chips in adm1275_read_pmon_config()
181 * supporting power average sampling. On other chips it is an 8-bit in adm1275_read_pmon_config()
184 if (data->have_power_sampling) { in adm1275_read_pmon_config()
206 if (data->have_power_sampling) { in adm1275_write_pmon_config()
219 if (data->have_power_sampling) in adm1275_write_pmon_config()
237 return -ENXIO; in adm1275_read_word_data()
241 if (!data->have_uc_fault) in adm1275_read_word_data()
242 return -ENXIO; in adm1275_read_word_data()
247 if (!data->have_oc_fault) in adm1275_read_word_data()
248 return -ENXIO; in adm1275_read_word_data()
253 if (data->have_vout) in adm1275_read_word_data()
254 return -ENODATA; in adm1275_read_word_data()
259 if (data->have_vout) in adm1275_read_word_data()
260 return -ENODATA; in adm1275_read_word_data()
265 if (data->have_vout) in adm1275_read_word_data()
266 return -ENODATA; in adm1275_read_word_data()
271 if (!data->have_iout_min) in adm1275_read_word_data()
272 return -ENXIO; in adm1275_read_word_data()
289 if (!data->have_pin_min) in adm1275_read_word_data()
290 return -ENXIO; in adm1275_read_word_data()
295 if (!data->have_pin_max) in adm1275_read_word_data()
296 return -ENXIO; in adm1275_read_word_data()
301 if (!data->have_temp_max) in adm1275_read_word_data()
302 return -ENXIO; in adm1275_read_word_data()
311 if (!data->have_pin_max) in adm1275_read_word_data()
312 return -ENXIO; in adm1275_read_word_data()
315 if (!data->have_temp_max) in adm1275_read_word_data()
316 return -ENXIO; in adm1275_read_word_data()
319 if (!data->have_power_sampling) in adm1275_read_word_data()
320 return -ENXIO; in adm1275_read_word_data()
334 ret = -ENODATA; in adm1275_read_word_data()
348 return -ENXIO; in adm1275_write_word_data()
358 if (!ret && data->have_iout_min) in adm1275_write_word_data()
370 if (!ret && data->have_pin_min) in adm1275_write_word_data()
378 if (!data->have_power_sampling) in adm1275_write_word_data()
379 return -ENXIO; in adm1275_write_word_data()
391 ret = -ENODATA; in adm1275_write_word_data()
404 return -ENXIO; in adm1275_read_byte_data()
411 if (!data->have_oc_fault && !data->have_uc_fault) in adm1275_read_byte_data()
418 ret |= data->have_oc_fault ? in adm1275_read_byte_data()
423 if (data->have_vout) in adm1275_read_byte_data()
424 return -ENODATA; in adm1275_read_byte_data()
426 if (data->have_vaux_status) { in adm1275_read_byte_data()
435 } else if (data->have_mfr_vaux_status) { in adm1275_read_byte_data()
447 ret = -ENODATA; in adm1275_read_byte_data()
475 int vindex = -1, voindex = -1, cindex = -1, pindex = -1; in adm1275_probe()
476 int tindex = -1; in adm1275_probe()
480 if (!i2c_check_functionality(client->adapter, in adm1275_probe()
483 return -ENODEV; in adm1275_probe()
487 dev_err(&client->dev, "Failed to read Manufacturer ID\n"); in adm1275_probe()
491 dev_err(&client->dev, "Unsupported Manufacturer ID\n"); in adm1275_probe()
492 return -ENODEV; in adm1275_probe()
497 dev_err(&client->dev, "Failed to read Manufacturer Model\n"); in adm1275_probe()
500 for (mid = adm1275_id; mid->name[0]; mid++) { in adm1275_probe()
501 if (!strncasecmp(mid->name, block_buffer, strlen(mid->name))) in adm1275_probe()
504 if (!mid->name[0]) { in adm1275_probe()
505 dev_err(&client->dev, "Unsupported device\n"); in adm1275_probe()
506 return -ENODEV; in adm1275_probe()
509 if (strcmp(client->name, mid->name) != 0) in adm1275_probe()
510 dev_notice(&client->dev, in adm1275_probe()
512 client->name, mid->name); in adm1275_probe()
514 if (mid->driver_data == adm1272 || mid->driver_data == adm1278 || in adm1275_probe()
515 mid->driver_data == adm1293 || mid->driver_data == adm1294) in adm1275_probe()
527 data = devm_kzalloc(&client->dev, sizeof(struct adm1275_data), in adm1275_probe()
530 return -ENOMEM; in adm1275_probe()
532 if (of_property_read_u32(client->dev.of_node, in adm1275_probe()
533 "shunt-resistor-micro-ohms", &shunt)) in adm1275_probe()
537 return -EINVAL; in adm1275_probe()
539 data->id = mid->driver_data; in adm1275_probe()
541 info = &data->info; in adm1275_probe()
543 info->pages = 1; in adm1275_probe()
544 info->format[PSC_VOLTAGE_IN] = direct; in adm1275_probe()
545 info->format[PSC_VOLTAGE_OUT] = direct; in adm1275_probe()
546 info->format[PSC_CURRENT_OUT] = direct; in adm1275_probe()
547 info->format[PSC_POWER] = direct; in adm1275_probe()
548 info->format[PSC_TEMPERATURE] = direct; in adm1275_probe()
549 info->func[0] = PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | in adm1275_probe()
552 info->read_word_data = adm1275_read_word_data; in adm1275_probe()
553 info->read_byte_data = adm1275_read_byte_data; in adm1275_probe()
554 info->write_word_data = adm1275_write_word_data; in adm1275_probe()
556 switch (data->id) { in adm1275_probe()
559 data->have_oc_fault = true; in adm1275_probe()
561 data->have_uc_fault = true; in adm1275_probe()
562 data->have_pin_max = true; in adm1275_probe()
563 data->have_vaux_status = true; in adm1275_probe()
577 dev_err(&client->dev, "Invalid input current range"); in adm1275_probe()
581 info->func[0] |= PMBUS_HAVE_VIN | PMBUS_HAVE_PIN in adm1275_probe()
584 info->func[0] |= in adm1275_probe()
588 data->have_vout = true; in adm1275_probe()
589 data->have_pin_max = true; in adm1275_probe()
590 data->have_temp_max = true; in adm1275_probe()
591 data->have_power_sampling = true; in adm1275_probe()
614 info->func[0] |= PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT | in adm1275_probe()
626 dev_err(&client->dev, in adm1275_probe()
628 return -ENODEV; in adm1275_probe()
632 info->func[0] |= PMBUS_HAVE_VIN; in adm1275_probe()
636 data->have_oc_fault = true; in adm1275_probe()
638 data->have_uc_fault = true; in adm1275_probe()
639 data->have_vout = true; in adm1275_probe()
646 info->func[0] |= in adm1275_probe()
649 info->func[0] |= in adm1275_probe()
654 data->have_oc_fault = true; in adm1275_probe()
656 data->have_uc_fault = true; in adm1275_probe()
657 data->have_vout = true; in adm1275_probe()
658 data->have_pin_max = true; in adm1275_probe()
665 info->func[0] |= PMBUS_HAVE_VIN | PMBUS_HAVE_PIN in adm1275_probe()
668 info->func[0] |= in adm1275_probe()
672 data->have_vout = true; in adm1275_probe()
673 data->have_pin_max = true; in adm1275_probe()
674 data->have_temp_max = true; in adm1275_probe()
675 data->have_power_sampling = true; in adm1275_probe()
683 info->func[0] |= PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT | in adm1275_probe()
695 dev_err(&client->dev, in adm1275_probe()
697 return -ENODEV; in adm1275_probe()
702 info->func[0] |= PMBUS_HAVE_VIN; in adm1275_probe()
706 data->have_iout_min = true; in adm1275_probe()
707 data->have_pin_min = true; in adm1275_probe()
708 data->have_pin_max = true; in adm1275_probe()
709 data->have_mfr_vaux_status = true; in adm1275_probe()
710 data->have_power_sampling = true; in adm1275_probe()
745 pindex = 7 + vindex * 4 + (cindex - 3); in adm1275_probe()
748 info->func[0] |= in adm1275_probe()
751 info->func[0] |= PMBUS_HAVE_PIN | in adm1275_probe()
756 dev_err(&client->dev, "Unsupported device\n"); in adm1275_probe()
757 return -ENODEV; in adm1275_probe()
760 if (data->have_power_sampling && in adm1275_probe()
761 of_property_read_u32(client->dev.of_node, in adm1275_probe()
762 "adi,power-sample-average", &avg) == 0) { in adm1275_probe()
765 dev_err(&client->dev, in adm1275_probe()
767 return -EINVAL; in adm1275_probe()
772 dev_err(&client->dev, in adm1275_probe()
779 if (of_property_read_u32(client->dev.of_node, in adm1275_probe()
780 "adi,volt-curr-sample-average", &avg) == 0) { in adm1275_probe()
783 dev_err(&client->dev, in adm1275_probe()
785 return -EINVAL; in adm1275_probe()
790 dev_err(&client->dev, in adm1275_probe()
800 info->m[PSC_VOLTAGE_IN] = coefficients[vindex].m; in adm1275_probe()
801 info->b[PSC_VOLTAGE_IN] = coefficients[vindex].b; in adm1275_probe()
802 info->R[PSC_VOLTAGE_IN] = coefficients[vindex].R; in adm1275_probe()
805 info->m[PSC_VOLTAGE_OUT] = coefficients[voindex].m; in adm1275_probe()
806 info->b[PSC_VOLTAGE_OUT] = coefficients[voindex].b; in adm1275_probe()
807 info->R[PSC_VOLTAGE_OUT] = coefficients[voindex].R; in adm1275_probe()
811 info->m[PSC_CURRENT_OUT] = in adm1275_probe()
813 info->b[PSC_CURRENT_OUT] = coefficients[cindex].b; in adm1275_probe()
814 info->R[PSC_CURRENT_OUT] = coefficients[cindex].R; in adm1275_probe()
817 info->m[PSC_POWER] = in adm1275_probe()
819 info->b[PSC_POWER] = coefficients[pindex].b; in adm1275_probe()
820 info->R[PSC_POWER] = coefficients[pindex].R; in adm1275_probe()
823 info->m[PSC_TEMPERATURE] = coefficients[tindex].m; in adm1275_probe()
824 info->b[PSC_TEMPERATURE] = coefficients[tindex].b; in adm1275_probe()
825 info->R[PSC_TEMPERATURE] = coefficients[tindex].R; in adm1275_probe()