Loading drivers/hwmon/qpnp-adc-common.c +11 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,9 @@ #define PMI_CHG_SCALE_1 -138890 #define PMI_CHG_SCALE_2 391750000000 #define QPNP_VADC_HC_VREF_CODE 0x4000 #define QPNP_VADC_HC_VDD_REFERENCE_MV 1875 /* Clamp negative ADC code to 0 */ #define QPNP_VADC_HC_MAX_CODE 0x7FFF /* Units for temperature below (on x axis) is in 0.1DegC as required by the battery driver. Note the resolution used Loading Loading @@ -859,6 +862,8 @@ int32_t qpnp_adc_scale_pmic_therm(struct qpnp_vadc_chip *vadc, if (adc_properties->adc_hc) { /* (ADC code * vref_vadc (1.875V)) / 0x4000 */ if (adc_code > QPNP_VADC_HC_MAX_CODE) adc_code = 0; pmic_voltage = (int64_t) adc_code; pmic_voltage *= (int64_t) (adc_properties->adc_vdd_reference * 1000); Loading Loading @@ -959,6 +964,8 @@ int32_t qpnp_adc_tdkntcg_therm(struct qpnp_vadc_chip *chip, if (adc_properties->adc_hc) { /* (ADC code * vref_vadc (1.875V) * 1000) / (0x4000 * 1000) */ if (adc_code > QPNP_VADC_HC_MAX_CODE) adc_code = 0; xo_thm_voltage = (int64_t) adc_code; xo_thm_voltage *= (int64_t) (adc_properties->adc_vdd_reference * 1000); Loading Loading @@ -1194,6 +1201,8 @@ int32_t qpnp_adc_scale_therm_pu2(struct qpnp_vadc_chip *chip, if (adc_properties->adc_hc) { /* (ADC code * vref_vadc (1.875V) * 1000) / (0x4000 * 1000) */ if (adc_code > QPNP_VADC_HC_MAX_CODE) adc_code = 0; therm_voltage = (int64_t) adc_code; therm_voltage *= (int64_t) (adc_properties->adc_vdd_reference * 1000); Loading Loading @@ -1330,6 +1339,8 @@ int32_t qpnp_adc_scale_default(struct qpnp_vadc_chip *vadc, if (adc_properties->adc_hc) { /* (ADC code * vref_vadc (1.875V)) / 0x4000 */ if (adc_code > QPNP_VADC_HC_MAX_CODE) adc_code = 0; scale_voltage = (int64_t) adc_code; scale_voltage *= (adc_properties->adc_vdd_reference * 1000); scale_voltage = div64_s64(scale_voltage, Loading drivers/hwmon/qpnp-adc-voltage.c +383 −303 File changed.Preview size limit exceeded, changes collapsed. Show changes include/linux/qpnp/qpnp-adc.h +8 −1 Original line number Diff line number Diff line Loading @@ -242,6 +242,7 @@ enum qpnp_iadc_channels { #define QPNP_ADC_HWMON_NAME_LENGTH 64 #define QPNP_MAX_PROP_NAME_LEN 32 #define QPNP_THERMALNODE_NAME_LENGTH 25 #define QPNP_ADC_1P25_UV 1250000 /* Structure device for qpnp vadc */ struct qpnp_vadc_chip; Loading Loading @@ -1069,7 +1070,7 @@ struct qpnp_vadc_chan_properties { enum qpnp_adc_tm_channel_select tm_channel_select; enum qpnp_state_request state_request; enum qpnp_adc_calib_type calib_type; struct qpnp_vadc_linear_graph adc_graph[2]; struct qpnp_vadc_linear_graph adc_graph[ADC_HC_CAL_SEL_NONE]; }; /** Loading Loading @@ -1249,6 +1250,10 @@ struct qpnp_adc_drv { * @fast_avg_setup - Ability to provide single result from the ADC * that is an average of multiple measurements. * @trigger_channel - HW trigger channel for conversion sequencer. * @calib_type - Used to store the calibration type for the channel * absolute/ratiometric. * @cal_val - Used to determine if fresh calibration value or timer * updated calibration value is to be used. * @chan_prop - Represent the channel properties of the ADC. */ struct qpnp_adc_amux_properties { Loading @@ -1258,6 +1263,8 @@ struct qpnp_adc_amux_properties { uint32_t hw_settle_time; uint32_t fast_avg_setup; enum qpnp_vadc_trigger trigger_channel; enum qpnp_adc_calib_type calib_type; enum qpnp_adc_cal_val cal_val; struct qpnp_vadc_chan_properties chan_prop[0]; }; Loading Loading
drivers/hwmon/qpnp-adc-common.c +11 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,9 @@ #define PMI_CHG_SCALE_1 -138890 #define PMI_CHG_SCALE_2 391750000000 #define QPNP_VADC_HC_VREF_CODE 0x4000 #define QPNP_VADC_HC_VDD_REFERENCE_MV 1875 /* Clamp negative ADC code to 0 */ #define QPNP_VADC_HC_MAX_CODE 0x7FFF /* Units for temperature below (on x axis) is in 0.1DegC as required by the battery driver. Note the resolution used Loading Loading @@ -859,6 +862,8 @@ int32_t qpnp_adc_scale_pmic_therm(struct qpnp_vadc_chip *vadc, if (adc_properties->adc_hc) { /* (ADC code * vref_vadc (1.875V)) / 0x4000 */ if (adc_code > QPNP_VADC_HC_MAX_CODE) adc_code = 0; pmic_voltage = (int64_t) adc_code; pmic_voltage *= (int64_t) (adc_properties->adc_vdd_reference * 1000); Loading Loading @@ -959,6 +964,8 @@ int32_t qpnp_adc_tdkntcg_therm(struct qpnp_vadc_chip *chip, if (adc_properties->adc_hc) { /* (ADC code * vref_vadc (1.875V) * 1000) / (0x4000 * 1000) */ if (adc_code > QPNP_VADC_HC_MAX_CODE) adc_code = 0; xo_thm_voltage = (int64_t) adc_code; xo_thm_voltage *= (int64_t) (adc_properties->adc_vdd_reference * 1000); Loading Loading @@ -1194,6 +1201,8 @@ int32_t qpnp_adc_scale_therm_pu2(struct qpnp_vadc_chip *chip, if (adc_properties->adc_hc) { /* (ADC code * vref_vadc (1.875V) * 1000) / (0x4000 * 1000) */ if (adc_code > QPNP_VADC_HC_MAX_CODE) adc_code = 0; therm_voltage = (int64_t) adc_code; therm_voltage *= (int64_t) (adc_properties->adc_vdd_reference * 1000); Loading Loading @@ -1330,6 +1339,8 @@ int32_t qpnp_adc_scale_default(struct qpnp_vadc_chip *vadc, if (adc_properties->adc_hc) { /* (ADC code * vref_vadc (1.875V)) / 0x4000 */ if (adc_code > QPNP_VADC_HC_MAX_CODE) adc_code = 0; scale_voltage = (int64_t) adc_code; scale_voltage *= (adc_properties->adc_vdd_reference * 1000); scale_voltage = div64_s64(scale_voltage, Loading
drivers/hwmon/qpnp-adc-voltage.c +383 −303 File changed.Preview size limit exceeded, changes collapsed. Show changes
include/linux/qpnp/qpnp-adc.h +8 −1 Original line number Diff line number Diff line Loading @@ -242,6 +242,7 @@ enum qpnp_iadc_channels { #define QPNP_ADC_HWMON_NAME_LENGTH 64 #define QPNP_MAX_PROP_NAME_LEN 32 #define QPNP_THERMALNODE_NAME_LENGTH 25 #define QPNP_ADC_1P25_UV 1250000 /* Structure device for qpnp vadc */ struct qpnp_vadc_chip; Loading Loading @@ -1069,7 +1070,7 @@ struct qpnp_vadc_chan_properties { enum qpnp_adc_tm_channel_select tm_channel_select; enum qpnp_state_request state_request; enum qpnp_adc_calib_type calib_type; struct qpnp_vadc_linear_graph adc_graph[2]; struct qpnp_vadc_linear_graph adc_graph[ADC_HC_CAL_SEL_NONE]; }; /** Loading Loading @@ -1249,6 +1250,10 @@ struct qpnp_adc_drv { * @fast_avg_setup - Ability to provide single result from the ADC * that is an average of multiple measurements. * @trigger_channel - HW trigger channel for conversion sequencer. * @calib_type - Used to store the calibration type for the channel * absolute/ratiometric. * @cal_val - Used to determine if fresh calibration value or timer * updated calibration value is to be used. * @chan_prop - Represent the channel properties of the ADC. */ struct qpnp_adc_amux_properties { Loading @@ -1258,6 +1263,8 @@ struct qpnp_adc_amux_properties { uint32_t hw_settle_time; uint32_t fast_avg_setup; enum qpnp_vadc_trigger trigger_channel; enum qpnp_adc_calib_type calib_type; enum qpnp_adc_cal_val cal_val; struct qpnp_vadc_chan_properties chan_prop[0]; }; Loading