Lines Matching +full:wait +full:- +full:on +full:- +full:read
1 // SPDX-License-Identifier: GPL-2.0+
48 * accuracy. So we just check each address in a hopefully non-intrusive mode
52 * 0x08 (Verified on T1040RDB-PA,T4240RDB-PB,X-T4240RDB-16GPA)
53 * 0x09 (Verified on T1040RDB-PA)
54 * 0x38 (Verified on T2080QDS, T2081QDS, T4240RDB)
73 return -1; in find_ir_chip_on_i2c()
82 * read_voltage from sensor on I2C bus
88 /* If an INA220 chip is available, we can use it to read back the voltage
92 #define WAIT_FOR_ADC 532 /* wait for 532 microseconds for ADC */
95 #define WAIT_FOR_ADC 138 /* wait for 138 microseconds for ADC */
111 printf("VID: failed to read core voltage\n"); in read_voltage_from_INA220()
117 return -1; in read_voltage_from_INA220()
131 /* read voltage from IR */
144 printf("VID: failed to read vcpu\n"); in read_voltage_from_IR()
150 return -1; in read_voltage_from_IR()
168 voltage_read -= board_vdd_drop_compensation(); in read_voltage_from_IR()
175 /* read the current value of the LTC Regulator Voltage */
189 /*read the output voltage using PMBus command READ_VOUT*/ in read_voltage_from_LTC()
193 printf("VID: failed to read the volatge\n"); in read_voltage_from_LTC()
214 return -1; in read_voltage()
230 /* wait until voltage starts to reach the target. Voltage slew in wait_for_new_voltage()
240 abs(vdd - vdd_current) > (IR_VDD_STEP_UP + IR_VDD_STEP_DOWN) && in wait_for_new_voltage()
246 return -1; in wait_for_new_voltage()
262 /* wait until voltage is stable */ in wait_for_voltage_stable()
268 abs(vdd - vdd_current) > ADC_MIN_ACCURACY && in wait_for_voltage_stable()
269 timeout > 0; timeout--) { in wait_for_voltage_stable()
275 return -1; in wait_for_voltage_stable()
282 int wait, vdd_last; in set_voltage_to_IR() local
291 vid = DIV_ROUND_UP(vdd - 265, 5); in set_voltage_to_IR()
293 vid = DIV_ROUND_UP(vdd - 245, 5); in set_voltage_to_IR()
300 return -1; in set_voltage_to_IR()
302 wait = wait_for_new_voltage(vdd, i2caddress); in set_voltage_to_IR()
303 if (wait < 0) in set_voltage_to_IR()
304 return -1; in set_voltage_to_IR()
305 debug("VID: Waited %d us\n", wait * NUM_READINGS * WAIT_FOR_ADC); in set_voltage_to_IR()
309 return -1; in set_voltage_to_IR()
326 /* 5-byte buffer which needs to be sent following the in set_voltage_to_LTC()
337 return -1; in set_voltage_to_LTC()
340 /* Wait for the volatge to get to the desired value */ in set_voltage_to_LTC()
344 printf("VID: Couldn't read sensor abort VID adjust\n"); in set_voltage_to_LTC()
345 return -1; in set_voltage_to_LTC()
347 count--; in set_voltage_to_LTC()
348 temp = vdd_last - vdd_target; in set_voltage_to_LTC()
357 int vdd_last = -1; in set_voltage()
502 ret = -1; in adjust_vdd()
509 printf("VID: Could not find voltage regulator on I2C.\n"); in adjust_vdd()
510 ret = -1; in adjust_vdd()
514 debug("VID: IR Chip found on I2C address 0x%02x\n", i2caddress); in adjust_vdd()
517 /* check IR chip work on Intel mode*/ in adjust_vdd()
522 printf("VID: failed to read IR chip mode.\n"); in adjust_vdd()
523 ret = -1; in adjust_vdd()
528 ret = -1; in adjust_vdd()
534 fusesr = in_le32(&gur->dcfg_fusesr); in adjust_vdd()
566 ret = -1; in adjust_vdd()
573 * Read voltage monitor to check real voltage. in adjust_vdd()
577 printf("VID: Couldn't read sensor abort VID adjustment\n"); in adjust_vdd()
578 ret = -1; in adjust_vdd()
600 vdd_last > vdd_target + (IR_VDD_STEP_DOWN - 1)) { in adjust_vdd()
601 vdd_current -= IR_VDD_STEP_DOWN; in adjust_vdd()
607 ret = -1; in adjust_vdd()
615 ret = -1; in adjust_vdd()
674 ret = -1; in adjust_vdd()
681 printf("VID: Could not find voltage regulator on I2C.\n"); in adjust_vdd()
682 ret = -1; in adjust_vdd()
686 debug("VID: IR Chip found on I2C address 0x%02x\n", i2caddress); in adjust_vdd()
689 /* check IR chip work on Intel mode*/ in adjust_vdd()
694 printf("VID: failed to read IR chip mode.\n"); in adjust_vdd()
695 ret = -1; in adjust_vdd()
700 ret = -1; in adjust_vdd()
706 fusesr = in_be32(&gur->dcfg_fusesr); in adjust_vdd()
709 * --------------------------------------- in adjust_vdd()
711 * |-------------------------------------| in adjust_vdd()
712 * | 5b00000 | 5b00001-5b11110 | 5b11111 | in adjust_vdd()
713 * ---------------+---------+-----------------+---------| in adjust_vdd()
715 * | A |----------+---------+-----------------+---------| in adjust_vdd()
719 * | A |----------+---------+-----------------+---------| in adjust_vdd()
722 * ------------------------------------------------------ in adjust_vdd()
763 * Read voltage monitor to check real voltage. in adjust_vdd()
767 printf("VID: Couldn't read sensor abort VID adjustment\n"); in adjust_vdd()
768 ret = -1; in adjust_vdd()
785 vdd_last > vdd_target + (IR_VDD_STEP_DOWN - 1)) { in adjust_vdd()
786 vdd_current -= IR_VDD_STEP_DOWN; in adjust_vdd()
794 ret = -1; in adjust_vdd()
812 return -1; in print_vdd()
818 printf("VID: Could not find voltage regulator on I2C.\n"); in print_vdd()
822 debug("VID: IR Chip found on I2C address 0x%02x\n", i2caddress); in print_vdd()
827 * Read voltage monitor to check real voltage. in print_vdd()
831 printf("VID: Couldn't read sensor abort VID adjustment\n"); in print_vdd()
838 return ret < 0 ? -1 : 0; in print_vdd()
872 " - override with the voltage specified in mV, eg. 1050"
877 "read VDD",
878 " - Read the voltage specified in mV"