kernel: bump 5.15 to 5.15.100
[openwrt/openwrt.git] / target / linux / ipq807x / patches-5.15 / 0044-v6.2-thermal-drivers-tsens-Add-IPQ8074-support.patch
1 From 0164d794cbc58488a7321272e95958d10cf103a4 Mon Sep 17 00:00:00 2001
2 From: Robert Marko <robimarko@gmail.com>
3 Date: Fri, 19 Aug 2022 00:02:44 +0200
4 Subject: [PATCH] thermal/drivers/tsens: Add IPQ8074 support
5
6 Qualcomm IPQ8074 uses tsens v2.3 IP, however unlike other tsens v2 IP
7 it only has one IRQ, that is used for up/low as well as critical.
8 It also does not support negative trip temperatures.
9
10 Signed-off-by: Robert Marko <robimarko@gmail.com>
11 Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
12 Link: https://lore.kernel.org/r/20220818220245.338396-4-robimarko@gmail.com
13 Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
14 ---
15 drivers/thermal/qcom/tsens-v2.c | 17 +++++++++++++++++
16 drivers/thermal/qcom/tsens.c | 3 +++
17 drivers/thermal/qcom/tsens.h | 2 +-
18 3 files changed, 21 insertions(+), 1 deletion(-)
19
20 --- a/drivers/thermal/qcom/tsens-v2.c
21 +++ b/drivers/thermal/qcom/tsens-v2.c
22 @@ -39,6 +39,17 @@ static struct tsens_features tsens_v2_fe
23 .trip_max_temp = 120000,
24 };
25
26 +static struct tsens_features ipq8074_feat = {
27 + .ver_major = VER_2_X,
28 + .crit_int = 1,
29 + .combo_int = 1,
30 + .adc = 0,
31 + .srot_split = 1,
32 + .max_sensors = 16,
33 + .trip_min_temp = 0,
34 + .trip_max_temp = 204000,
35 +};
36 +
37 static const struct reg_field tsens_v2_regfields[MAX_REGFIELDS] = {
38 /* ----- SROT ------ */
39 /* VERSION */
40 @@ -104,6 +115,12 @@ struct tsens_plat_data data_tsens_v2 = {
41 .fields = tsens_v2_regfields,
42 };
43
44 +struct tsens_plat_data data_ipq8074 = {
45 + .ops = &ops_generic_v2,
46 + .feat = &ipq8074_feat,
47 + .fields = tsens_v2_regfields,
48 +};
49 +
50 /* Kept around for backward compatibility with old msm8996.dtsi */
51 struct tsens_plat_data data_8996 = {
52 .num_sensors = 13,
53 --- a/drivers/thermal/qcom/tsens.c
54 +++ b/drivers/thermal/qcom/tsens.c
55 @@ -991,6 +991,9 @@ static const struct of_device_id tsens_t
56 .compatible = "qcom,ipq8064-tsens",
57 .data = &data_8960,
58 }, {
59 + .compatible = "qcom,ipq8074-tsens",
60 + .data = &data_ipq8074,
61 + }, {
62 .compatible = "qcom,mdm9607-tsens",
63 .data = &data_9607,
64 }, {
65 --- a/drivers/thermal/qcom/tsens.h
66 +++ b/drivers/thermal/qcom/tsens.h
67 @@ -599,6 +599,6 @@ extern struct tsens_plat_data data_8916,
68 extern struct tsens_plat_data data_tsens_v1, data_8976, data_8956;
69
70 /* TSENS v2 targets */
71 -extern struct tsens_plat_data data_8996, data_tsens_v2;
72 +extern struct tsens_plat_data data_8996, data_ipq8074, data_tsens_v2;
73
74 #endif /* __QCOM_TSENS_H__ */