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
116 [0] = { 27169, 0, -1 }, /* voltage */
117 [1] = { 806, 20475, -1 }, /* current, irange25 */
118 [2] = { 404, 20475, -1 }, /* current, irange50 */
119 [3] = { 8549, 0, -1 }, /* power, irange25 */
120 [4] = { 4279, 0, -1 }, /* power, irange50 */
124 [0] = { 6770, 0, -2 }, /* voltage, vrange 60V */
125 [1] = { 4062, 0, -2 }, /* voltage, vrange 100V */
126 [2] = { 1326, 20480, -1 }, /* current, vsense range 15mV */
127 [3] = { 663, 20480, -1 }, /* current, vsense range 30mV */
128 [4] = { 3512, 0, -2 }, /* power, vrange 60V, irange 15mV */
129 [5] = { 21071, 0, -3 }, /* power, vrange 100V, irange 15mV */
130 [6] = { 17561, 0, -3 }, /* power, vrange 60V, irange 30mV */
131 [7] = { 10535, 0, -3 }, /* power, vrange 100V, irange 30mV */
132 [8] = { 42, 31871, -1 }, /* temperature */
137 [0] = { 19199, 0, -2 }, /* voltage, vrange set */
138 [1] = { 6720, 0, -1 }, /* voltage, vrange not set */
139 [2] = { 807, 20475, -1 }, /* current */
143 [0] = { 19199, 0, -2 }, /* voltage, vrange set */
144 [1] = { 6720, 0, -1 }, /* voltage, vrange not set */
145 [2] = { 807, 20475, -1 }, /* current */
146 [3] = { 6043, 0, -2 }, /* power, vrange set */
147 [4] = { 2115, 0, -1 }, /* power, vrange not set */
151 [0] = { 19599, 0, -2 }, /* voltage */
152 [1] = { 800, 20475, -1 }, /* current */
153 [2] = { 6123, 0, -2 }, /* power */
154 [3] = { 42, 31880, -1 }, /* temperature */
158 [0] = { 3333, -1, 0 }, /* voltage, vrange 1.2V */
159 [1] = { 5552, -5, -1 }, /* voltage, vrange 7.4V */
160 [2] = { 19604, -50, -2 }, /* voltage, vrange 21V */
161 [3] = { 8000, -100, -2 }, /* current, irange25 */
162 [4] = { 4000, -100, -2 }, /* current, irange50 */
163 [5] = { 20000, -1000, -3 }, /* current, irange100 */
164 [6] = { 10000, -1000, -3 }, /* current, irange200 */
165 [7] = { 10417, 0, -1 }, /* power, 1.2V, irange25 */
166 [8] = { 5208, 0, -1 }, /* power, 1.2V, irange50 */
167 [9] = { 26042, 0, -2 }, /* power, 1.2V, irange100 */
168 [10] = { 13021, 0, -2 }, /* power, 1.2V, irange200 */
169 [11] = { 17351, 0, -2 }, /* power, 7.4V, irange25 */
170 [12] = { 8676, 0, -2 }, /* power, 7.4V, irange50 */
171 [13] = { 4338, 0, -2 }, /* power, 7.4V, irange100 */
172 [14] = { 21689, 0, -3 }, /* power, 7.4V, irange200 */
173 [15] = { 6126, 0, -2 }, /* power, 21V, irange25 */
174 [16] = { 30631, 0, -3 }, /* power, 21V, irange50 */
175 [17] = { 15316, 0, -3 }, /* power, 21V, irange100 */
176 [18] = { 7658, 0, -3 }, /* power, 21V, irange200 */
186 * The PMON configuration register is a 16-bit register only on chips in adm1275_read_samples()
187 * supporting power average sampling. On other chips it is an 8-bit in adm1275_read_samples()
190 if (data->have_power_sampling) { in adm1275_read_samples()
214 if (data->have_power_sampling) in adm1275_write_pmon_config()
222 * We still want to re-enable conversions if writing into in adm1275_write_pmon_config()
240 if (data->have_power_sampling) { in adm1275_write_samples()
265 return -ENXIO; in adm1275_read_word_data()
269 if (!data->have_uc_fault) in adm1275_read_word_data()
270 return -ENXIO; in adm1275_read_word_data()
275 if (!data->have_oc_fault) in adm1275_read_word_data()
276 return -ENXIO; in adm1275_read_word_data()
281 if (data->have_vout) in adm1275_read_word_data()
282 return -ENODATA; in adm1275_read_word_data()
287 if (data->have_vout) in adm1275_read_word_data()
288 return -ENODATA; in adm1275_read_word_data()
293 if (data->have_vout) in adm1275_read_word_data()
294 return -ENODATA; in adm1275_read_word_data()
299 if (!data->have_iout_min) in adm1275_read_word_data()
300 return -ENXIO; in adm1275_read_word_data()
317 if (!data->have_pin_min) in adm1275_read_word_data()
318 return -ENXIO; in adm1275_read_word_data()
323 if (!data->have_pin_max) in adm1275_read_word_data()
324 return -ENXIO; in adm1275_read_word_data()
329 if (!data->have_temp_max) in adm1275_read_word_data()
330 return -ENXIO; in adm1275_read_word_data()
339 if (!data->have_pin_max) in adm1275_read_word_data()
340 return -ENXIO; in adm1275_read_word_data()
343 if (!data->have_temp_max) in adm1275_read_word_data()
344 return -ENXIO; in adm1275_read_word_data()
347 if (!data->have_power_sampling) in adm1275_read_word_data()
348 return -ENXIO; in adm1275_read_word_data()
362 ret = -ENODATA; in adm1275_read_word_data()
376 return -ENXIO; in adm1275_write_word_data()
386 if (!ret && data->have_iout_min) in adm1275_write_word_data()
398 if (!ret && data->have_pin_min) in adm1275_write_word_data()
406 if (!data->have_power_sampling) in adm1275_write_word_data()
407 return -ENXIO; in adm1275_write_word_data()
417 ret = -ENODATA; in adm1275_write_word_data()
430 return -ENXIO; in adm1275_read_byte_data()
437 if (!data->have_oc_fault && !data->have_uc_fault) in adm1275_read_byte_data()
444 ret |= data->have_oc_fault ? in adm1275_read_byte_data()
449 if (data->have_vout) in adm1275_read_byte_data()
450 return -ENODATA; in adm1275_read_byte_data()
452 if (data->have_vaux_status) { in adm1275_read_byte_data()
461 } else if (data->have_mfr_vaux_status) { in adm1275_read_byte_data()
473 ret = -ENODATA; in adm1275_read_byte_data()
502 dev_err(&client->dev, "Failed to enable VOUT/TEMP1 monitoring\n"); in adm1275_enable_vout_temp()
519 int vindex = -1, voindex = -1, cindex = -1, pindex = -1; in adm1275_probe()
520 int tindex = -1; in adm1275_probe()
524 if (!i2c_check_functionality(client->adapter, in adm1275_probe()
527 return -ENODEV; in adm1275_probe()
531 dev_err(&client->dev, "Failed to read Manufacturer ID\n"); in adm1275_probe()
535 dev_err(&client->dev, "Unsupported Manufacturer ID\n"); in adm1275_probe()
536 return -ENODEV; in adm1275_probe()
541 dev_err(&client->dev, "Failed to read Manufacturer Model\n"); in adm1275_probe()
544 for (mid = adm1275_id; mid->name[0]; mid++) { in adm1275_probe()
545 if (!strncasecmp(mid->name, block_buffer, strlen(mid->name))) in adm1275_probe()
548 if (!mid->name[0]) { in adm1275_probe()
549 dev_err(&client->dev, "Unsupported device\n"); in adm1275_probe()
550 return -ENODEV; in adm1275_probe()
553 if (strcmp(client->name, mid->name) != 0) in adm1275_probe()
554 dev_notice(&client->dev, in adm1275_probe()
556 client->name, mid->name); in adm1275_probe()
558 if (mid->driver_data == adm1272 || mid->driver_data == adm1278 || in adm1275_probe()
559 mid->driver_data == adm1281 || mid->driver_data == adm1293 || in adm1275_probe()
560 mid->driver_data == adm1294) in adm1275_probe()
572 data = devm_kzalloc(&client->dev, sizeof(struct adm1275_data), in adm1275_probe()
575 return -ENOMEM; in adm1275_probe()
577 if (of_property_read_u32(client->dev.of_node, in adm1275_probe()
578 "shunt-resistor-micro-ohms", &shunt)) in adm1275_probe()
582 return -EINVAL; in adm1275_probe()
584 data->id = mid->driver_data; in adm1275_probe()
586 info = &data->info; in adm1275_probe()
588 info->pages = 1; in adm1275_probe()
589 info->format[PSC_VOLTAGE_IN] = direct; in adm1275_probe()
590 info->format[PSC_VOLTAGE_OUT] = direct; in adm1275_probe()
591 info->format[PSC_CURRENT_OUT] = direct; in adm1275_probe()
592 info->format[PSC_POWER] = direct; in adm1275_probe()
593 info->format[PSC_TEMPERATURE] = direct; in adm1275_probe()
594 info->func[0] = PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | in adm1275_probe()
597 info->read_word_data = adm1275_read_word_data; in adm1275_probe()
598 info->read_byte_data = adm1275_read_byte_data; in adm1275_probe()
599 info->write_word_data = adm1275_write_word_data; in adm1275_probe()
601 switch (data->id) { in adm1275_probe()
604 data->have_oc_fault = true; in adm1275_probe()
606 data->have_uc_fault = true; in adm1275_probe()
607 data->have_pin_max = true; in adm1275_probe()
608 data->have_vaux_status = true; in adm1275_probe()
622 dev_err(&client->dev, "Invalid input current range"); in adm1275_probe()
626 info->func[0] |= PMBUS_HAVE_VIN | PMBUS_HAVE_PIN in adm1275_probe()
629 info->func[0] |= in adm1275_probe()
633 data->have_vout = true; in adm1275_probe()
634 data->have_pin_max = true; in adm1275_probe()
635 data->have_temp_max = true; in adm1275_probe()
636 data->have_power_sampling = true; in adm1275_probe()
659 info->func[0] |= PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT | in adm1275_probe()
668 info->func[0] |= PMBUS_HAVE_VIN; in adm1275_probe()
672 data->have_oc_fault = true; in adm1275_probe()
674 data->have_uc_fault = true; in adm1275_probe()
675 data->have_vout = true; in adm1275_probe()
682 info->func[0] |= in adm1275_probe()
685 info->func[0] |= in adm1275_probe()
690 data->have_oc_fault = true; in adm1275_probe()
692 data->have_uc_fault = true; in adm1275_probe()
693 data->have_vout = true; in adm1275_probe()
694 data->have_pin_max = true; in adm1275_probe()
701 info->func[0] |= PMBUS_HAVE_VIN | PMBUS_HAVE_PIN in adm1275_probe()
704 info->func[0] |= in adm1275_probe()
709 data->have_vout = true; in adm1275_probe()
710 data->have_pin_max = true; in adm1275_probe()
711 data->have_temp_max = true; in adm1275_probe()
712 data->have_power_sampling = true; in adm1275_probe()
720 info->func[0] |= PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT | in adm1275_probe()
729 info->func[0] |= PMBUS_HAVE_VIN; in adm1275_probe()
733 data->have_iout_min = true; in adm1275_probe()
734 data->have_pin_min = true; in adm1275_probe()
735 data->have_pin_max = true; in adm1275_probe()
736 data->have_mfr_vaux_status = true; in adm1275_probe()
737 data->have_power_sampling = true; in adm1275_probe()
772 pindex = 7 + vindex * 4 + (cindex - 3); in adm1275_probe()
775 info->func[0] |= in adm1275_probe()
778 info->func[0] |= PMBUS_HAVE_PIN | in adm1275_probe()
783 dev_err(&client->dev, "Unsupported device\n"); in adm1275_probe()
784 return -ENODEV; in adm1275_probe()
787 if (data->have_power_sampling && in adm1275_probe()
788 of_property_read_u32(client->dev.of_node, in adm1275_probe()
789 "adi,power-sample-average", &avg) == 0) { in adm1275_probe()
792 dev_err(&client->dev, in adm1275_probe()
794 return -EINVAL; in adm1275_probe()
798 dev_err(&client->dev, in adm1275_probe()
805 if (of_property_read_u32(client->dev.of_node, in adm1275_probe()
806 "adi,volt-curr-sample-average", &avg) == 0) { in adm1275_probe()
809 dev_err(&client->dev, in adm1275_probe()
811 return -EINVAL; in adm1275_probe()
815 dev_err(&client->dev, in adm1275_probe()
825 info->m[PSC_VOLTAGE_IN] = coefficients[vindex].m; in adm1275_probe()
826 info->b[PSC_VOLTAGE_IN] = coefficients[vindex].b; in adm1275_probe()
827 info->R[PSC_VOLTAGE_IN] = coefficients[vindex].R; in adm1275_probe()
830 info->m[PSC_VOLTAGE_OUT] = coefficients[voindex].m; in adm1275_probe()
831 info->b[PSC_VOLTAGE_OUT] = coefficients[voindex].b; in adm1275_probe()
832 info->R[PSC_VOLTAGE_OUT] = coefficients[voindex].R; in adm1275_probe()
836 info->m[PSC_CURRENT_OUT] = in adm1275_probe()
838 info->b[PSC_CURRENT_OUT] = coefficients[cindex].b; in adm1275_probe()
839 info->R[PSC_CURRENT_OUT] = coefficients[cindex].R; in adm1275_probe()
842 info->m[PSC_POWER] = in adm1275_probe()
844 info->b[PSC_POWER] = coefficients[pindex].b; in adm1275_probe()
845 info->R[PSC_POWER] = coefficients[pindex].R; in adm1275_probe()
848 info->m[PSC_TEMPERATURE] = coefficients[tindex].m; in adm1275_probe()
849 info->b[PSC_TEMPERATURE] = coefficients[tindex].b; in adm1275_probe()
850 info->R[PSC_TEMPERATURE] = coefficients[tindex].R; in adm1275_probe()