Loading Documentation/devicetree/bindings/hwmon/qpnp-adc-voltage.txt +7 −1 Original line number Diff line number Diff line Loading @@ -13,7 +13,10 @@ Required properties: - address-cells : Must be one. - size-cells : Must be zero. - interrupts : The USR bank peripheral VADC interrupt. - interrupt-names : Should contain "eoc-int-en-set". - interrupt-names : Should contain "eoc-int-en-set" for EOC, "high-thr-en-set" for high threshold interrupts and "low-thr-en-set" for low threshold interrupts. High and low threshold interrupts are to be enabled if VADC_USR needs to support recurring measurement. - qcom,adc-bit-resolution : Bit resolution of the ADC. - qcom,adc-vdd-reference : Voltage reference used by the ADC. Loading @@ -25,6 +28,9 @@ Optional properties: - qcom,pmic-revid : Phandle pointing to the revision peripheral node. Use it to query the PMIC type and revision for applying the appropriate temperature compensation parameters. -qcom,vadc-meas-int-mode : Enable VADC_USR to handle requests to perform recurring measurements for any one supported channel along with supporting single conversion requests. Client required property: - qcom,<consumer name>-vadc : The phandle to the corresponding vadc device. Loading drivers/hwmon/qpnp-adc-voltage.c +467 −25 File changed.Preview size limit exceeded, changes collapsed. Show changes include/linux/qpnp/qpnp-adc.h +37 −1 Original line number Diff line number Diff line Loading @@ -251,7 +251,6 @@ enum qpnp_adc_scale_fn_type { SCALE_NONE, }; /** * enum qpnp_adc_tm_rscale_fn_type - Scaling function used to convert the * channels input voltage/temperature to corresponding ADC code that is Loading @@ -274,6 +273,20 @@ enum qpnp_adc_tm_rscale_fn_type { SCALE_RSCALE_NONE, }; /** * enum qpnp_vadc_rscale_fn_type - Scaling function used to convert the * channels input voltage/temperature to corresponding ADC code that is * applied for thresholds. Check the corresponding channels scaling to * determine the appropriate temperature/voltage units that are passed * to the scaling function. The order below should match the one in the * driver for qpnp_adc_scale_fn[]. */ enum qpnp_vadc_rscale_fn_type { SCALE_RVADC_ABSOLUTE = 0, SCALE_RVADC_PMIC_THERM = 3, SCALE_RVADC_SCALE_NONE, }; /** * enum qpnp_adc_fast_avg_ctl - Provides ability to obtain single result * from the ADC that is an average of multiple measurement Loading Loading @@ -1511,6 +1524,24 @@ int32_t qpnp_vbat_sns_comp_result(struct qpnp_vadc_chip *dev, * returns internal mapped PMIC number and revision id. */ int qpnp_adc_get_revid_version(struct device *dev); /** * qpnp_vadc_channel_monitor() - Configures kernel clients a channel to * monitor the corresponding ADC channel for threshold detection. * Driver passes the high/low voltage threshold along * with the notification callback once the set thresholds * are crossed. * @param: Structure pointer of qpnp_adc_tm_btm_param type. * Clients pass the low/high temperature along with the threshold * notification callback. */ int32_t qpnp_vadc_channel_monitor(struct qpnp_vadc_chip *chip, struct qpnp_adc_tm_btm_param *param); /** * qpnp_vadc_end_channel_monitor() - Disables recurring measurement mode for * VADC_USR and disables the bank. * @param: device instance for the VADC */ int32_t qpnp_vadc_end_channel_monitor(struct qpnp_vadc_chip *chip); #else static inline int32_t qpnp_vadc_read(struct qpnp_vadc_chip *dev, uint32_t channel, Loading Loading @@ -1656,6 +1687,11 @@ static inline int32_t qpnp_vbat_sns_comp_result(struct qpnp_vadc_chip *dev, { return -ENXIO; } static inline int qpnp_adc_get_revid_version(struct device *dev) { return -ENXIO; } static inline int32_t qpnp_vadc_channel_monitor(struct qpnp_vadc_chip *chip, struct qpnp_adc_tm_btm_param *param) { return -ENXIO; } static inline int32_t qpnp_vadc_end_channel_monitor(struct qpnp_vadc_chip *chip) { return -ENXIO; } #endif /* Public API */ Loading Loading
Documentation/devicetree/bindings/hwmon/qpnp-adc-voltage.txt +7 −1 Original line number Diff line number Diff line Loading @@ -13,7 +13,10 @@ Required properties: - address-cells : Must be one. - size-cells : Must be zero. - interrupts : The USR bank peripheral VADC interrupt. - interrupt-names : Should contain "eoc-int-en-set". - interrupt-names : Should contain "eoc-int-en-set" for EOC, "high-thr-en-set" for high threshold interrupts and "low-thr-en-set" for low threshold interrupts. High and low threshold interrupts are to be enabled if VADC_USR needs to support recurring measurement. - qcom,adc-bit-resolution : Bit resolution of the ADC. - qcom,adc-vdd-reference : Voltage reference used by the ADC. Loading @@ -25,6 +28,9 @@ Optional properties: - qcom,pmic-revid : Phandle pointing to the revision peripheral node. Use it to query the PMIC type and revision for applying the appropriate temperature compensation parameters. -qcom,vadc-meas-int-mode : Enable VADC_USR to handle requests to perform recurring measurements for any one supported channel along with supporting single conversion requests. Client required property: - qcom,<consumer name>-vadc : The phandle to the corresponding vadc device. Loading
drivers/hwmon/qpnp-adc-voltage.c +467 −25 File changed.Preview size limit exceeded, changes collapsed. Show changes
include/linux/qpnp/qpnp-adc.h +37 −1 Original line number Diff line number Diff line Loading @@ -251,7 +251,6 @@ enum qpnp_adc_scale_fn_type { SCALE_NONE, }; /** * enum qpnp_adc_tm_rscale_fn_type - Scaling function used to convert the * channels input voltage/temperature to corresponding ADC code that is Loading @@ -274,6 +273,20 @@ enum qpnp_adc_tm_rscale_fn_type { SCALE_RSCALE_NONE, }; /** * enum qpnp_vadc_rscale_fn_type - Scaling function used to convert the * channels input voltage/temperature to corresponding ADC code that is * applied for thresholds. Check the corresponding channels scaling to * determine the appropriate temperature/voltage units that are passed * to the scaling function. The order below should match the one in the * driver for qpnp_adc_scale_fn[]. */ enum qpnp_vadc_rscale_fn_type { SCALE_RVADC_ABSOLUTE = 0, SCALE_RVADC_PMIC_THERM = 3, SCALE_RVADC_SCALE_NONE, }; /** * enum qpnp_adc_fast_avg_ctl - Provides ability to obtain single result * from the ADC that is an average of multiple measurement Loading Loading @@ -1511,6 +1524,24 @@ int32_t qpnp_vbat_sns_comp_result(struct qpnp_vadc_chip *dev, * returns internal mapped PMIC number and revision id. */ int qpnp_adc_get_revid_version(struct device *dev); /** * qpnp_vadc_channel_monitor() - Configures kernel clients a channel to * monitor the corresponding ADC channel for threshold detection. * Driver passes the high/low voltage threshold along * with the notification callback once the set thresholds * are crossed. * @param: Structure pointer of qpnp_adc_tm_btm_param type. * Clients pass the low/high temperature along with the threshold * notification callback. */ int32_t qpnp_vadc_channel_monitor(struct qpnp_vadc_chip *chip, struct qpnp_adc_tm_btm_param *param); /** * qpnp_vadc_end_channel_monitor() - Disables recurring measurement mode for * VADC_USR and disables the bank. * @param: device instance for the VADC */ int32_t qpnp_vadc_end_channel_monitor(struct qpnp_vadc_chip *chip); #else static inline int32_t qpnp_vadc_read(struct qpnp_vadc_chip *dev, uint32_t channel, Loading Loading @@ -1656,6 +1687,11 @@ static inline int32_t qpnp_vbat_sns_comp_result(struct qpnp_vadc_chip *dev, { return -ENXIO; } static inline int qpnp_adc_get_revid_version(struct device *dev) { return -ENXIO; } static inline int32_t qpnp_vadc_channel_monitor(struct qpnp_vadc_chip *chip, struct qpnp_adc_tm_btm_param *param) { return -ENXIO; } static inline int32_t qpnp_vadc_end_channel_monitor(struct qpnp_vadc_chip *chip) { return -ENXIO; } #endif /* Public API */ Loading