0004-v6.2-thermal-drivers-tsens-Add-IPQ8074-support.patch 2.4 KB

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