summaryrefslogtreecommitdiff
path: root/drivers/thermal/qcom/tsens-v1.c
diff options
context:
space:
mode:
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>2023-01-01 21:40:23 +0200
committerDaniel Lezcano <daniel.lezcano@linaro.org>2023-01-16 11:22:30 +0100
commit498d245749ce35b21121cf5297547fca64bc52db (patch)
treef7441e0433eda5380b372dcc0e6241508eec22dc /drivers/thermal/qcom/tsens-v1.c
parent903238a33c116edf5f64f7a3fd246e6169cccfa6 (diff)
thermal/drivers/tsens: Support using nvmem cells for calibration data
Add a unified function using nvmem cells for parsing the calibration data rather than parsing the calibration blob manually. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://lore.kernel.org/r/20230101194034.831222-10-dmitry.baryshkov@linaro.org Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Diffstat (limited to 'drivers/thermal/qcom/tsens-v1.c')
-rw-r--r--drivers/thermal/qcom/tsens-v1.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/thermal/qcom/tsens-v1.c b/drivers/thermal/qcom/tsens-v1.c
index 83c2853546d0..5bba75a845c5 100644
--- a/drivers/thermal/qcom/tsens-v1.c
+++ b/drivers/thermal/qcom/tsens-v1.c
@@ -143,7 +143,11 @@ static int calibrate_v1(struct tsens_priv *priv)
u32 p1[10], p2[10];
u32 mode = 0, lsb = 0, msb = 0;
u32 *qfprom_cdata;
- int i;
+ int i, ret;
+
+ ret = tsens_calibrate_common(priv);
+ if (!ret)
+ return 0;
qfprom_cdata = (u32 *)qfprom_read(priv->dev, "calib");
if (IS_ERR(qfprom_cdata))
@@ -209,6 +213,11 @@ static int calibrate_8976(struct tsens_priv *priv)
u32 p1[11], p2[11];
int mode = 0, tmp = 0;
u32 *qfprom_cdata;
+ int ret;
+
+ ret = tsens_calibrate_common(priv);
+ if (!ret)
+ return 0;
qfprom_cdata = (u32 *)qfprom_read(priv->dev, "calib");
if (IS_ERR(qfprom_cdata))