Lines Matching refs:ret

133 	int ret = pmbus_read_word_data(client, page, phase, reg);  in mp2975_read_word_helper()  local
135 return (ret > 0) ? ret & mask : ret; in mp2975_read_word_helper()
199 int ph_curr, ret; in mp2975_read_phase() local
201 ret = pmbus_read_word_data(client, page, phase, reg); in mp2975_read_phase()
202 if (ret < 0) in mp2975_read_phase()
203 return ret; in mp2975_read_phase()
206 ret >>= 8; in mp2975_read_phase()
207 ret &= 0xff; in mp2975_read_phase()
219 ph_curr = ret * 100 - 9800; in mp2975_read_phase()
228 ret = pmbus_read_word_data(client, page, phase, PMBUS_READ_IOUT); in mp2975_read_phase()
229 if (ret < 0) in mp2975_read_phase()
230 return ret; in mp2975_read_phase()
232 return max_t(int, DIV_ROUND_CLOSEST(ret, data->info.phases[page]), in mp2975_read_phase()
240 int ret; in mp2975_read_phases() local
245 ret = mp2975_read_phase(client, data, page, phase, in mp2975_read_phases()
249 ret = mp2975_read_phase(client, data, page, phase, in mp2975_read_phases()
253 ret = mp2975_read_phase(client, data, page, phase, in mp2975_read_phases()
262 ret = mp2975_read_phase(client, data, page, phase, in mp2975_read_phases()
266 ret = mp2975_read_phase(client, data, page, phase, in mp2975_read_phases()
270 ret = mp2975_read_phase(client, data, page, phase, in mp2975_read_phases()
274 ret = mp2975_read_phase(client, data, page, phase, in mp2975_read_phases()
278 ret = mp2975_read_phase(client, data, page, phase, in mp2975_read_phases()
282 ret = mp2975_read_phase(client, data, page, phase, in mp2975_read_phases()
289 return ret; in mp2975_read_phases()
297 int ret; in mp2973_read_word_data() local
302 ret = pmbus_read_word_data(client, page, phase, reg); in mp2973_read_word_data()
303 ret ^= PB_STATUS_POWER_GOOD_N; in mp2973_read_word_data()
306 ret = mp2975_read_word_helper(client, page, phase, reg, in mp2973_read_word_data()
310 ret = mp2975_read_word_helper(client, page, phase, reg, in mp2973_read_word_data()
312 if (ret < 0) in mp2973_read_word_data()
313 return ret; in mp2973_read_word_data()
315 ret = DIV_ROUND_CLOSEST(ret, MP2975_VIN_UV_LIMIT_UNIT); in mp2973_read_word_data()
321 ret = mp2975_read_word_helper(client, page, phase, in mp2973_read_word_data()
324 if (ret < 0) in mp2973_read_word_data()
325 return ret; in mp2973_read_word_data()
327 ret = data->vout_max[page] + 50 * (ret + 1); in mp2973_read_word_data()
330 ret = mp2975_read_word_helper(client, page, phase, reg, in mp2973_read_word_data()
332 if (ret < 0) in mp2973_read_word_data()
333 return ret; in mp2973_read_word_data()
334 ret = mp2975_vid2direct(info->vrm_version[page], ret); in mp2973_read_word_data()
337 ret = pmbus_read_word_data(client, page, phase, in mp2973_read_word_data()
341 ret = pmbus_read_word_data(client, page, phase, in mp2973_read_word_data()
345 ret = mp2975_read_word_helper(client, page, phase, in mp2973_read_word_data()
348 if (ret < 0) in mp2973_read_word_data()
349 return ret; in mp2973_read_word_data()
351 if (ret & MP2973_MFR_OCP_LEVEL_RES) in mp2973_read_word_data()
352 ret = 2 * (ret & MP2973_OCP_TOTAL_CUR_MASK); in mp2973_read_word_data()
354 ret = ret & MP2973_OCP_TOTAL_CUR_MASK; in mp2973_read_word_data()
356 ret = mp2975_data2reg_linear11(ret * info->phases[page] * 1000); in mp2973_read_word_data()
377 return ret; in mp2973_read_word_data()
385 int ret; in mp2975_read_word_data() local
389 ret = mp2975_read_word_helper(client, page, phase, reg, in mp2975_read_word_data()
393 ret = mp2975_read_word_helper(client, page, phase, reg, in mp2975_read_word_data()
395 if (ret < 0) in mp2975_read_word_data()
396 return ret; in mp2975_read_word_data()
398 ret = DIV_ROUND_CLOSEST(ret, MP2975_VIN_UV_LIMIT_UNIT); in mp2975_read_word_data()
407 ret = mp2975_read_word_helper(client, page, phase, in mp2975_read_word_data()
410 if (ret < 0) in mp2975_read_word_data()
411 return ret; in mp2975_read_word_data()
413 ret = min_t(int, data->vout_max[page] + 50 * (ret + 1), in mp2975_read_word_data()
417 ret = mp2975_read_word_helper(client, page, phase, in mp2975_read_word_data()
420 if (ret < 0) in mp2975_read_word_data()
421 return ret; in mp2975_read_word_data()
423 ret = DIV_ROUND_CLOSEST(data->vref[page] * 10 - 50 * in mp2975_read_word_data()
424 (ret + 1) * data->vout_scale, 10); in mp2975_read_word_data()
427 ret = mp2975_read_word_helper(client, page, phase, in mp2975_read_word_data()
430 if (ret < 0) in mp2975_read_word_data()
431 return ret; in mp2975_read_word_data()
433 ret = DIV_ROUND_CLOSEST(ret, 4); in mp2975_read_word_data()
436 ret = mp2975_read_word_helper(client, page, phase, in mp2975_read_word_data()
439 if (ret < 0) in mp2975_read_word_data()
440 return ret; in mp2975_read_word_data()
442 ret = DIV_ROUND_CLOSEST(ret, 4); in mp2975_read_word_data()
445 ret = mp2975_read_phases(client, data, page, phase); in mp2975_read_word_data()
446 if (ret < 0) in mp2975_read_word_data()
447 return ret; in mp2975_read_word_data()
471 return ret; in mp2975_read_word_data()
477 int ret; in mp2975_identify_multiphase_rail2() local
483 ret = i2c_smbus_write_byte_data(client, PMBUS_PAGE, 2); in mp2975_identify_multiphase_rail2()
484 if (ret < 0) in mp2975_identify_multiphase_rail2()
485 return ret; in mp2975_identify_multiphase_rail2()
487 ret = i2c_smbus_read_word_data(client, MP2975_MFR_VR_MULTI_CONFIG_R2); in mp2975_identify_multiphase_rail2()
488 if (ret < 0) in mp2975_identify_multiphase_rail2()
489 return ret; in mp2975_identify_multiphase_rail2()
491 ret &= GENMASK(2, 0); in mp2975_identify_multiphase_rail2()
492 return (ret >= data->max_phases[1]) ? data->max_phases[1] : ret; in mp2975_identify_multiphase_rail2()
517 int num_phases2, ret; in mp2975_identify_multiphase() local
519 ret = i2c_smbus_write_byte_data(client, PMBUS_PAGE, 2); in mp2975_identify_multiphase()
520 if (ret < 0) in mp2975_identify_multiphase()
521 return ret; in mp2975_identify_multiphase()
524 ret = i2c_smbus_read_word_data(client, MP2975_MFR_VR_MULTI_CONFIG_R1); in mp2975_identify_multiphase()
525 if (ret <= 0) in mp2975_identify_multiphase()
526 return ret; in mp2975_identify_multiphase()
528 info->phases[0] = ret & GENMASK(3, 0); in mp2975_identify_multiphase()
557 int ret; in mp2975_identify_vid() local
560 ret = i2c_smbus_read_word_data(client, reg); in mp2975_identify_vid()
561 if (ret < 0) in mp2975_identify_vid()
562 return ret; in mp2975_identify_vid()
564 if (ret & imvp_bit) { in mp2975_identify_vid()
567 } else if (ret & vr_bit) { in mp2975_identify_vid()
582 int ret; in mp2975_identify_rails_vid() local
584 ret = i2c_smbus_write_byte_data(client, PMBUS_PAGE, 2); in mp2975_identify_rails_vid()
585 if (ret < 0) in mp2975_identify_rails_vid()
586 return ret; in mp2975_identify_rails_vid()
589 ret = mp2975_identify_vid(client, data, info, in mp2975_identify_rails_vid()
592 if (ret < 0) in mp2975_identify_rails_vid()
593 return ret; in mp2975_identify_rails_vid()
597 ret = mp2975_identify_vid(client, data, info, in mp2975_identify_rails_vid()
602 return ret; in mp2975_identify_rails_vid()
609 int ret; in mp2973_identify_rails_vid() local
611 ret = i2c_smbus_write_byte_data(client, PMBUS_PAGE, 2); in mp2973_identify_rails_vid()
612 if (ret < 0) in mp2973_identify_rails_vid()
613 return ret; in mp2973_identify_rails_vid()
616 ret = mp2975_identify_vid(client, data, info, in mp2973_identify_rails_vid()
620 if (ret < 0) in mp2973_identify_rails_vid()
621 return ret; in mp2973_identify_rails_vid()
625 ret = mp2975_identify_vid(client, data, info, in mp2973_identify_rails_vid()
630 return ret; in mp2973_identify_rails_vid()
637 int i, ret; in mp2975_current_sense_gain_get() local
646 ret = i2c_smbus_write_byte_data(client, PMBUS_PAGE, i); in mp2975_current_sense_gain_get()
647 if (ret < 0) in mp2975_current_sense_gain_get()
648 return ret; in mp2975_current_sense_gain_get()
649 ret = i2c_smbus_read_word_data(client, in mp2975_current_sense_gain_get()
651 if (ret < 0) in mp2975_current_sense_gain_get()
652 return ret; in mp2975_current_sense_gain_get()
654 switch ((ret & MP2975_DRMOS_KCS) >> 12) { in mp2975_current_sense_gain_get()
677 int ret; in mp2975_vref_get() local
679 ret = i2c_smbus_write_byte_data(client, PMBUS_PAGE, 3); in mp2975_vref_get()
680 if (ret < 0) in mp2975_vref_get()
681 return ret; in mp2975_vref_get()
684 ret = i2c_smbus_read_word_data(client, MP2975_MFR_READ_VREF_R1); in mp2975_vref_get()
685 if (ret < 0) in mp2975_vref_get()
686 return ret; in mp2975_vref_get()
688 data->vref[0] = ret * data->vid_step[0]; in mp2975_vref_get()
692 ret = i2c_smbus_read_word_data(client, MP2975_MFR_READ_VREF_R2); in mp2975_vref_get()
693 if (ret < 0) in mp2975_vref_get()
694 return ret; in mp2975_vref_get()
696 data->vref[1] = ret * data->vid_step[1]; in mp2975_vref_get()
705 int ret; in mp2975_vref_offset_get() local
707 ret = i2c_smbus_read_word_data(client, MP2975_MFR_OVP_TH_SET); in mp2975_vref_offset_get()
708 if (ret < 0) in mp2975_vref_offset_get()
709 return ret; in mp2975_vref_offset_get()
711 switch ((ret & GENMASK(5, 3)) >> 3) { in mp2975_vref_offset_get()
731 int ret; in mp2975_vout_max_get() local
734 ret = i2c_smbus_read_word_data(client, PMBUS_VOUT_MAX); in mp2975_vout_max_get()
735 if (ret < 0) in mp2975_vout_max_get()
736 return ret; in mp2975_vout_max_get()
738 data->vout_max[page] = mp2975_vid2direct(info->vrm_version[page], ret & in mp2975_vout_max_get()
747 int ret, i; in mp2975_set_vout_format() local
751 ret = i2c_smbus_read_word_data(client, MP2975_MFR_DC_LOOP_CTRL); in mp2975_set_vout_format()
752 if (ret < 0) in mp2975_set_vout_format()
753 return ret; in mp2975_set_vout_format()
754 if (ret & MP2975_VOUT_FORMAT) { in mp2975_set_vout_format()
755 ret &= ~MP2975_VOUT_FORMAT; in mp2975_set_vout_format()
756 ret = i2c_smbus_write_word_data(client, MP2975_MFR_DC_LOOP_CTRL, ret); in mp2975_set_vout_format()
759 ret = i2c_smbus_read_word_data(client, MP2973_MFR_RESO_SET); in mp2975_set_vout_format()
760 if (ret < 0) in mp2975_set_vout_format()
761 return ret; in mp2975_set_vout_format()
762 i = ret; in mp2975_set_vout_format()
771 if (i != ret) in mp2975_set_vout_format()
772 ret = i2c_smbus_write_word_data(client, MP2973_MFR_RESO_SET, i); in mp2975_set_vout_format()
774 return ret; in mp2975_set_vout_format()
781 int thres_dev, sense_ampl, ret; in mp2975_vout_ov_scale_get() local
783 ret = i2c_smbus_write_byte_data(client, PMBUS_PAGE, 0); in mp2975_vout_ov_scale_get()
784 if (ret < 0) in mp2975_vout_ov_scale_get()
785 return ret; in mp2975_vout_ov_scale_get()
792 ret = i2c_smbus_read_word_data(client, MP2975_MFR_APS_DECAY_ADV); in mp2975_vout_ov_scale_get()
793 if (ret < 0) in mp2975_vout_ov_scale_get()
794 return ret; in mp2975_vout_ov_scale_get()
795 thres_dev = ret & MP2975_PRT_THRES_DIV_OV_EN ? MP2975_PROT_DEV_OV_ON : in mp2975_vout_ov_scale_get()
799 ret = i2c_smbus_read_word_data(client, PMBUS_VOUT_SCALE_LOOP); in mp2975_vout_ov_scale_get()
800 if (ret < 0) in mp2975_vout_ov_scale_get()
801 return ret; in mp2975_vout_ov_scale_get()
802 sense_ampl = ret & MP2975_SENSE_AMPL ? MP2975_SENSE_AMPL_HALF : in mp2975_vout_ov_scale_get()
815 int i, ret; in mp2975_vout_per_rail_config_get() local
818 ret = i2c_smbus_write_byte_data(client, PMBUS_PAGE, i); in mp2975_vout_per_rail_config_get()
819 if (ret < 0) in mp2975_vout_per_rail_config_get()
823 ret = mp2975_set_vout_format(client, data, i); in mp2975_vout_per_rail_config_get()
824 if (ret < 0) in mp2975_vout_per_rail_config_get()
825 return ret; in mp2975_vout_per_rail_config_get()
828 ret = mp2975_vout_max_get(client, data, info, i); in mp2975_vout_per_rail_config_get()
829 if (ret < 0) in mp2975_vout_per_rail_config_get()
830 return ret; in mp2975_vout_per_rail_config_get()
837 ret = mp2975_vref_offset_get(client, data, i); in mp2975_vout_per_rail_config_get()
838 if (ret < 0) in mp2975_vout_per_rail_config_get()
839 return ret; in mp2975_vout_per_rail_config_get()
904 int ret; in mp2975_probe() local
927 ret = mp2975_identify_multiphase_rail2(client, data); in mp2975_probe()
928 if (ret < 0) in mp2975_probe()
929 return ret; in mp2975_probe()
931 if (ret) { in mp2975_probe()
934 data->info.phases[1] = ret; in mp2975_probe()
941 ret = mp2975_identify_multiphase(client, data, info); in mp2975_probe()
942 if (ret) in mp2975_probe()
943 return ret; in mp2975_probe()
947 ret = mp2975_identify_rails_vid(client, data, info); in mp2975_probe()
948 if (ret < 0) in mp2975_probe()
949 return ret; in mp2975_probe()
952 ret = mp2975_current_sense_gain_get(client, data); in mp2975_probe()
953 if (ret) in mp2975_probe()
954 return ret; in mp2975_probe()
957 ret = mp2975_vref_get(client, data, info); in mp2975_probe()
958 if (ret) in mp2975_probe()
959 return ret; in mp2975_probe()
962 ret = mp2975_vout_ov_scale_get(client, data, info); in mp2975_probe()
963 if (ret < 0) in mp2975_probe()
964 return ret; in mp2975_probe()
967 ret = mp2973_identify_rails_vid(client, data, info); in mp2975_probe()
968 if (ret < 0) in mp2975_probe()
969 return ret; in mp2975_probe()
973 ret = mp2975_vout_per_rail_config_get(client, data, info); in mp2975_probe()
974 if (ret) in mp2975_probe()
975 return ret; in mp2975_probe()