Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 784fff0d authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "dt-bindings: iio: Add IIO channel numbers for SMB1398"

parents 5765b29e 55463a63
Loading
Loading
Loading
Loading
+20 −3
Original line number Diff line number Diff line
@@ -909,9 +909,26 @@ static int qcom_vadc_scale_hw_smb1398_temp(
				const struct adc5_data *data,
				u16 adc_code, int *result_mdec)
{
	*result_mdec = qcom_vadc_scale_code_voltage_factor(adc_code * 100,
			prescale, data, PMIC5_SMB1398_TEMP_SCALE_FACTOR);
	*result_mdec = PMIC5_SMB1398_TEMP_CONSTANT - *result_mdec;
	s64 voltage = 0, adc_vdd_ref_mv = 1875;
	u64 temp;

	if (adc_code > VADC5_MAX_CODE)
		adc_code = 0;

	/* (ADC code * vref_vadc (1.875V)) / full_scale_code */
	voltage = (s64) adc_code * adc_vdd_ref_mv * 1000;
	voltage = div64_s64(voltage, data->full_scale_code_volt);
	if (voltage > 0) {
		temp = voltage * prescale->den;
		temp *= 100;
		do_div(temp, prescale->num * PMIC5_SMB1398_TEMP_SCALE_FACTOR);
		voltage = temp;
	} else {
		voltage = 0;
	}

	voltage = voltage - PMIC5_SMB1398_TEMP_CONSTANT;
	*result_mdec = voltage;

	return 0;
}
+19 −1
Original line number Diff line number Diff line
@@ -122,4 +122,22 @@

#define PSY_IIO_TYPEC_ACCESSORY_MODE		0x64

/* CHARGE PUMP */
#define PSY_IIO_CP_STATUS1			0x65
#define PSY_IIO_CP_STATUS2			0x66
#define PSY_IIO_CP_ENABLE			0x67
#define PSY_IIO_CP_SWITCHER_EN			0x68
#define PSY_IIO_CP_DIE_TEMP			0x69
#define PSY_IIO_CP_ISNS				0x6a
#define PSY_IIO_CP_ISNS_SLAVE			0x6b
#define PSY_IIO_CP_TOGGLE_SWITCHER		0x6c
#define PSY_IIO_CP_ILIM				0x6d
#define PSY_IIO_CHIP_VERSION			0x6e
#define PSY_IIO_PARALLEL_MODE			0x6f
#define PSY_IIO_PARALLEL_OUTPUT_MODE		0x70
#define PSY_IIO_MIN_ICL				0x71

#define PSY_IIO_CP_INPUT_CURRENT_MAX		0x72
#define PSY_IIO_CURRENT_CAPABILITY		0x73

#endif /* __QTI_POWER_SUPPLY_IIO_H__ */