From: "thermal-bot for Jishnu Prakash" <tip-bot2@linutronix.de>
To: linux-pm@vger.kernel.org
Cc: Jishnu Prakash <quic_jprakash@quicinc.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
rui.zhang@intel.com, amitk@kernel.org
Subject: [thermal: thermal/next] iio: adc: qcom-vadc-common: add reverse scaling for PMIC5 Gen2 ADC_TM
Date: Thu, 19 May 2022 12:44:24 -0000 [thread overview]
Message-ID: <165296426440.4207.8401342073909749449.tip-bot2@tip-bot2> (raw)
In-Reply-To: <1648991869-20899-3-git-send-email-quic_jprakash@quicinc.com>
The following commit has been merged into the thermal/next branch of thermal:
Commit-ID: 238e34ad7d5ce36939ac1442c98c7cbb7771f4de
Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//238e34ad7d5ce36939ac1442c98c7cbb7771f4de
Author: Jishnu Prakash <quic_jprakash@quicinc.com>
AuthorDate: Sun, 03 Apr 2022 18:47:47 +05:30
Committer: Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Thu, 19 May 2022 12:11:51 +02:00
iio: adc: qcom-vadc-common: add reverse scaling for PMIC5 Gen2 ADC_TM
Add reverse scaling function for PMIC5 Gen2 ADC_TM, to convert
temperature to raw ADC code, for setting thresholds for
thermistor channels.
Signed-off-by: Jishnu Prakash <quic_jprakash@quicinc.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/1648991869-20899-3-git-send-email-quic_jprakash@quicinc.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
drivers/iio/adc/qcom-vadc-common.c | 11 +++++++++++
include/linux/iio/adc/qcom-vadc-common.h | 2 ++
2 files changed, 13 insertions(+)
diff --git a/drivers/iio/adc/qcom-vadc-common.c b/drivers/iio/adc/qcom-vadc-common.c
index 6c6aec8..d5209f3 100644
--- a/drivers/iio/adc/qcom-vadc-common.c
+++ b/drivers/iio/adc/qcom-vadc-common.c
@@ -677,6 +677,17 @@ u16 qcom_adc_tm5_temp_volt_scale(unsigned int prescale_ratio,
}
EXPORT_SYMBOL(qcom_adc_tm5_temp_volt_scale);
+u16 qcom_adc_tm5_gen2_temp_res_scale(int temp)
+{
+ int64_t resistance;
+
+ resistance = qcom_vadc_map_temp_voltage(adcmap7_100k,
+ ARRAY_SIZE(adcmap7_100k), temp);
+
+ return div64_s64(resistance * RATIO_MAX_ADC7, resistance + R_PU_100K);
+}
+EXPORT_SYMBOL(qcom_adc_tm5_gen2_temp_res_scale);
+
int qcom_adc5_hw_scale(enum vadc_scale_fn_type scaletype,
unsigned int prescale_ratio,
const struct adc5_data *data,
diff --git a/include/linux/iio/adc/qcom-vadc-common.h b/include/linux/iio/adc/qcom-vadc-common.h
index ce78d48..aa21b03 100644
--- a/include/linux/iio/adc/qcom-vadc-common.h
+++ b/include/linux/iio/adc/qcom-vadc-common.h
@@ -152,6 +152,8 @@ int qcom_adc5_hw_scale(enum vadc_scale_fn_type scaletype,
u16 qcom_adc_tm5_temp_volt_scale(unsigned int prescale_ratio,
u32 full_scale_code_volt, int temp);
+u16 qcom_adc_tm5_gen2_temp_res_scale(int temp);
+
int qcom_adc5_prescaling_from_dt(u32 num, u32 den);
int qcom_adc5_hw_settle_time_from_dt(u32 value, const unsigned int *hw_settle);
next prev parent reply other threads:[~2022-05-19 12:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-03 13:17 [RESEND PATCH V5 0/4] thermal: qcom: Add support for PMIC5 Gen2 ADC_TM Jishnu Prakash
2022-04-03 13:17 ` [RESEND PATCH V5 1/4] dt-bindings: thermal: qcom: add PMIC5 Gen2 ADC_TM bindings Jishnu Prakash
2022-05-19 12:44 ` [thermal: thermal/next] " thermal-bot for Jishnu Prakash
2022-04-03 13:17 ` [RESEND PATCH V5 2/4] iio: adc: qcom-vadc-common: add reverse scaling for PMIC5 Gen2 ADC_TM Jishnu Prakash
2022-05-19 12:44 ` thermal-bot for Jishnu Prakash [this message]
2022-04-03 13:17 ` [RESEND PATCH V5 3/4] thermal: qcom: Add support for multiple generations of devices Jishnu Prakash
2022-05-19 12:44 ` [thermal: thermal/next] thermal/drivers/qcom: " thermal-bot for Jishnu Prakash
2022-04-03 13:17 ` [RESEND PATCH V5 4/4] thermal: qcom: add support for PMIC5 Gen2 ADCTM Jishnu Prakash
2022-05-19 12:44 ` [thermal: thermal/next] thermal/drivers/qcom: Add " thermal-bot for Jishnu Prakash
2022-04-06 12:27 ` [RESEND PATCH V5 0/4] thermal: qcom: Add support for PMIC5 Gen2 ADC_TM Daniel Lezcano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=165296426440.4207.8401342073909749449.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=Jonathan.Cameron@huawei.com \
--cc=amitk@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=linux-pm@vger.kernel.org \
--cc=quic_jprakash@quicinc.com \
--cc=rui.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox