Lines Matching +full:gain +full:- +full:milli
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Hardware monitoring driver for MPS Multi-phase Digital VR Controllers
138 return -ENODATA; in mp2975_read_byte_data()
157 return 250 + (val - 1) * 5; in mp2975_vid2direct()
161 return 500 + (val - 1) * 10; in mp2975_vid2direct()
165 return 200 + (val - 1) * 10; in mp2975_vid2direct()
168 return -EINVAL; in mp2975_vid2direct()
176 /* Converts a milli-unit DIRECT value to LINEAR11 format */
192 while (val < MIN_LIN_MANTISSA && exponent > -15) { in mp2975_data2reg_linear11()
193 exponent--; in mp2975_data2reg_linear11()
197 /* Convert mantissa from milli-units to units */ in mp2975_data2reg_linear11()
202 mantissa = -mantissa; in mp2975_data2reg_linear11()
225 * - Kcs is the DrMOS current sense gain of power stage, which is in mp2975_read_phase()
226 * obtained from the register MP2975_MFR_VR_CONFIG1, bits 13-12 with in mp2975_read_phase()
227 * the following selection of DrMOS (data->curr_sense_gain[page]): in mp2975_read_phase()
228 * 00b - 5µA/A, 01b - 8.5µA/A, 10b - 9.7µA/A, 11b - 10µA/A. in mp2975_read_phase()
229 * - Rcs is the internal phase current sense resistor which is constant in mp2975_read_phase()
232 ph_curr = ret * 100 - 9800; in mp2975_read_phase()
245 return max_t(int, DIV_ROUND_CLOSEST(ret, data->info.phases[page]), in mp2975_read_phase()
246 DIV_ROUND_CLOSEST(ph_curr, data->curr_sense_gain[page])); in mp2975_read_phase()
270 return -ENODATA; in mp2975_read_phases()
299 return -ENODATA; in mp2975_read_phases()
340 ret = data->vout_max[page] + 50 * (ret + 1); in mp2973_read_word_data()
347 ret = mp2975_vid2direct(info->vrm_version[page], ret); in mp2973_read_word_data()
369 ret = mp2975_data2reg_linear11(ret * info->phases[page] * 1000); in mp2973_read_word_data()
385 return -ENXIO; in mp2973_read_word_data()
387 return -ENODATA; in mp2973_read_word_data()
400 return -ENODATA; in mp2973_write_word_data()
403 * Vendor-specific SMBALERT_MASK register with 16 maskable bits. in mp2973_write_word_data()
489 * Register provides two values for over-voltage protection in mp2975_read_word_data()
491 * minimum of these two values is provided as over-voltage in mp2975_read_word_data()
500 ret = min_t(int, data->vout_max[page] + 50 * (ret + 1), in mp2975_read_word_data()
501 data->vout_ov_fixed[page]); in mp2975_read_word_data()
510 ret = DIV_ROUND_CLOSEST(data->vref[page] * 10 - 50 * in mp2975_read_word_data()
511 (ret + 1) * data->vout_scale, 10); in mp2975_read_word_data()
553 return -ENXIO; in mp2975_read_word_data()
555 return -ENODATA; in mp2975_read_word_data()
567 * Identify multiphase for rail 2 - could be from 0 to data->max_phases[1]. in mp2975_identify_multiphase_rail2()
579 return (ret >= data->max_phases[1]) ? data->max_phases[1] : ret; in mp2975_identify_multiphase_rail2()
586 for (i = 0 ; i < info->phases[0]; i++) in mp2975_set_phase_rail1()
587 info->pfunc[i] = PMBUS_HAVE_IOUT; in mp2975_set_phase_rail1()
597 info->pfunc[MP2975_MAX_PHASE_RAIL1 - i] = PMBUS_HAVE_IOUT; in mp2975_set_phase_rail2()
610 /* Identify multiphase for rail 1 - could be from 1 to data->max_phases[0]. */ in mp2975_identify_multiphase()
615 info->phases[0] = ret & GENMASK(3, 0); in mp2975_identify_multiphase()
622 * 1 operates with 1-phase DCM. When rail 2 phase count is configured in mp2975_identify_multiphase()
625 if (info->phases[0] > data->max_phases[0]) in mp2975_identify_multiphase()
626 return -EINVAL; in mp2975_identify_multiphase()
628 if (data->chip_id == mp2975) { in mp2975_identify_multiphase()
630 num_phases2 = min(data->max_phases[0] - info->phases[0], in mp2975_identify_multiphase()
631 data->max_phases[1]); in mp2975_identify_multiphase()
632 if (info->phases[1] && info->phases[1] <= num_phases2) in mp2975_identify_multiphase()
652 info->vrm_version[page] = imvp9; in mp2975_identify_vid()
653 data->vid_step[page] = MP2975_PROT_DEV_OV_OFF; in mp2975_identify_vid()
655 info->vrm_version[page] = vr12; in mp2975_identify_vid()
656 data->vid_step[page] = MP2975_PROT_DEV_OV_ON; in mp2975_identify_vid()
658 info->vrm_version[page] = vr13; in mp2975_identify_vid()
659 data->vid_step[page] = MP2975_PROT_DEV_OV_OFF; in mp2975_identify_vid()
683 if (info->phases[1]) in mp2975_identify_rails_vid()
711 if (info->phases[1]) in mp2973_identify_rails_vid()
727 * Obtain DrMOS current sense gain of power stage from the register in mp2975_current_sense_gain_get()
728 * MP2975_MFR_VR_CONFIG1, bits 13-12. The value is selected as below: in mp2975_current_sense_gain_get()
729 * 00b - 5µA/A, 01b - 8.5µA/A, 10b - 9.7µA/A, 11b - 10µA/A. Other in mp2975_current_sense_gain_get()
732 for (i = 0 ; i < data->info.pages; i++) { in mp2975_current_sense_gain_get()
743 data->curr_sense_gain[i] = 50; in mp2975_current_sense_gain_get()
746 data->curr_sense_gain[i] = 85; in mp2975_current_sense_gain_get()
749 data->curr_sense_gain[i] = 97; in mp2975_current_sense_gain_get()
752 data->curr_sense_gain[i] = 100; in mp2975_current_sense_gain_get()
775 data->vref[0] = ret * data->vid_step[0]; in mp2975_vref_get()
778 if (data->info.pages == MP2975_PAGE_NUM) { in mp2975_vref_get()
783 data->vref[1] = ret * data->vid_step[1]; in mp2975_vref_get()
800 data->vref_off[page] = 140; in mp2975_vref_offset_get()
803 data->vref_off[page] = 220; in mp2975_vref_offset_get()
806 data->vref_off[page] = 400; in mp2975_vref_offset_get()
809 return -EINVAL; in mp2975_vref_offset_get()
820 /* Get maximum reference voltage of VID-DAC in VID format. */ in mp2975_vout_max_get()
825 data->vout_max[page] = mp2975_vid2direct(info->vrm_version[page], ret & in mp2975_vout_max_get()
837 if (data->chip_id == mp2975) { in mp2975_set_vout_format()
875 * Get divider for over- and under-voltage protection thresholds in mp2975_vout_ov_scale_get()
885 /* Select the gain of remote sense amplifier. */ in mp2975_vout_ov_scale_get()
892 data->vout_scale = sense_ampl * thres_dev; in mp2975_vout_ov_scale_get()
904 for (i = 0; i < data->info.pages; i++) { in mp2975_vout_per_rail_config_get()
920 if (data->chip_id != mp2975) in mp2975_vout_per_rail_config_get()
929 * Set over-voltage fixed value. Thresholds are provided as in mp2975_vout_per_rail_config_get()
931 * exposed as over-voltage critical threshold. in mp2975_vout_per_rail_config_get()
933 data->vout_ov_fixed[i] = data->vref[i] + in mp2975_vout_per_rail_config_get()
934 DIV_ROUND_CLOSEST(data->vref_off[i] * in mp2975_vout_per_rail_config_get()
935 data->vout_scale, in mp2975_vout_per_rail_config_get()
1004 return -ENODEV; in mp2975_probe()
1006 data = devm_kzalloc(&client->dev, sizeof(struct mp2975_data), in mp2975_probe()
1009 return -ENOMEM; in mp2975_probe()
1011 data->chip_id = ddinfo->chip_id; in mp2975_probe()
1013 memcpy(data->max_phases, mp2975_max_phases[data->chip_id], in mp2975_probe()
1014 sizeof(data->max_phases)); in mp2975_probe()
1016 memcpy(&data->info, ddinfo->info, sizeof(data->info)); in mp2975_probe()
1018 info = &data->info; in mp2975_probe()
1027 data->info.pages = MP2975_PAGE_NUM; in mp2975_probe()
1028 data->info.phases[1] = ret; in mp2975_probe()
1029 data->info.func[1] = MP2975_RAIL2_FUNC; in mp2975_probe()
1031 data->info.num_regulators = MP2975_PAGE_NUM; in mp2975_probe()
1039 if (data->chip_id == mp2975) { in mp2975_probe()
1045 /* Obtain current sense gain of power stage. */ in mp2975_probe()
1055 /* Obtain vout over-voltage scales. */ in mp2975_probe()