Skip to content

Commit 4af164c

Browse files
stephan-ghdlezcano
authored andcommitted
thermal/drivers/qcom/tsens-v0_1: Add MSM8909 data
The MSM8909 SoC has 5 thermal sensors in a TSENS v0.1 block. Like MDM9607 it uses a non-standard default slope value of 3000 [1] and needs per-sensor "correction factors" to workaround issues with the factory calibration [2]. [1]: https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/blob/LA.UM.7.7.c26-09100-8x09.0/arch/arm/boot/dts/qcom/msm8909.dtsi#L476 [2]: https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/commit/6df022c6d0c2c1b4a5a6c2124dba4d57910c0911 Reviewed-by: Konrad Dybcio <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Signed-off-by: Stephan Gerhold <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent ba3bcfe commit 4af164c

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

drivers/thermal/qcom/tsens-v0_1.c

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,27 @@ static int __init init_8226(struct tsens_priv *priv)
219219
return init_common(priv);
220220
}
221221

222+
static int __init init_8909(struct tsens_priv *priv)
223+
{
224+
int i;
225+
226+
for (i = 0; i < priv->num_sensors; ++i)
227+
priv->sensor[i].slope = 3000;
228+
229+
priv->sensor[0].p1_calib_offset = 0;
230+
priv->sensor[0].p2_calib_offset = 0;
231+
priv->sensor[1].p1_calib_offset = -10;
232+
priv->sensor[1].p2_calib_offset = -6;
233+
priv->sensor[2].p1_calib_offset = 0;
234+
priv->sensor[2].p2_calib_offset = 0;
235+
priv->sensor[3].p1_calib_offset = -9;
236+
priv->sensor[3].p2_calib_offset = -9;
237+
priv->sensor[4].p1_calib_offset = -8;
238+
priv->sensor[4].p2_calib_offset = -10;
239+
240+
return init_common(priv);
241+
}
242+
222243
static int __init init_8939(struct tsens_priv *priv) {
223244
priv->sensor[0].slope = 2911;
224245
priv->sensor[1].slope = 2789;
@@ -255,7 +276,7 @@ static int __init init_9607(struct tsens_priv *priv)
255276
return init_common(priv);
256277
}
257278

258-
/* v0.1: 8226, 8916, 8939, 8974, 9607 */
279+
/* v0.1: 8226, 8909, 8916, 8939, 8974, 9607 */
259280

260281
static struct tsens_features tsens_v0_1_feat = {
261282
.ver_major = VER_0_1,
@@ -323,6 +344,19 @@ struct tsens_plat_data data_8226 = {
323344
.fields = tsens_v0_1_regfields,
324345
};
325346

347+
static const struct tsens_ops ops_8909 = {
348+
.init = init_8909,
349+
.calibrate = tsens_calibrate_common,
350+
.get_temp = get_temp_common,
351+
};
352+
353+
struct tsens_plat_data data_8909 = {
354+
.num_sensors = 5,
355+
.ops = &ops_8909,
356+
.feat = &tsens_v0_1_feat,
357+
.fields = tsens_v0_1_regfields,
358+
};
359+
326360
static const struct tsens_ops ops_8916 = {
327361
.init = init_common,
328362
.calibrate = calibrate_8916,

drivers/thermal/qcom/tsens.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,9 @@ static const struct of_device_id tsens_table[] = {
11121112
}, {
11131113
.compatible = "qcom,msm8226-tsens",
11141114
.data = &data_8226,
1115+
}, {
1116+
.compatible = "qcom,msm8909-tsens",
1117+
.data = &data_8909,
11151118
}, {
11161119
.compatible = "qcom,msm8916-tsens",
11171120
.data = &data_8916,

drivers/thermal/qcom/tsens.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ int get_temp_common(const struct tsens_sensor *s, int *temp);
639639
extern struct tsens_plat_data data_8960;
640640

641641
/* TSENS v0.1 targets */
642-
extern struct tsens_plat_data data_8226, data_8916, data_8939, data_8974, data_9607;
642+
extern struct tsens_plat_data data_8226, data_8909, data_8916, data_8939, data_8974, data_9607;
643643

644644
/* TSENS v1 targets */
645645
extern struct tsens_plat_data data_tsens_v1, data_8976, data_8956;

0 commit comments

Comments
 (0)