qcom: Add support for TSENS driver
Subsystems (7)
v3 cover qcom: Add support for TSENS driver
Changes since v2:
* Minor review fixes from Stephen/Punit and rebase on 4.3-rc4
Changes since v1:
* Created virtual tsens device from gcc driver for 8960, with DT having a single node for gcc and tsens
* Minor fixes with rebasing on 4.3-rc1
Changes since RFC:
* Added support for 8916 and 8084
* Based off the latest nvmem framework patches [1]
* Minor review fixes for comments mostly from Lina
This is an attempt to have a single TSENS driver for the different versions of the TSENS IP that exist, on different qcom msm/apq SoCs'
Support is added for msm8916, msm8960 and msm8974 families.
A lot of the work is based of original code from Stephen Boyd and Siddartha Mohanadoss. I have also picked some of what Narendran Rajan did in his attempt to upstream the support for 8960 family. I could not keep the original authorship on any of the patches because I ended up moving the code around quite a bit in an effort to have a single driver for the various devices. I would be glad to change the authorship for any of the patches if needed.
Rajendra Nayak (9):
thermal: qcom: tsens: Add a skeletal TSENS drivers
thermal: qcom: tsens-8916: Add support for 8916 family of SoCs
thermal: qcom: tsens-8974: Add support for 8974 family of SoCs
clk: qcom: create virtual child device for TSENS
thermal: qcom: tsens-8960: Add support for 8960 family of SoCs
arm: dts: msm8974: Add thermal zones, tsens and qfprom nodes
arm: dts: apq8064: Add thermal zones, tsens and qfprom nodes
arm: dts: apq8084: Add thermal zones, tsens and qfprom nodes
arm64: dts: msm8916: Add thermal zones, tsens and qfprom nodes
.../devicetree/bindings/thermal/qcom-tsens.txt | 33 +++ arch/arm/boot/dts/qcom-apq8064.dtsi | 101 +++++++ arch/arm/boot/dts/qcom-apq8084.dtsi | 105 ++++++++ arch/arm/boot/dts/qcom-msm8974.dtsi | 105 ++++++++ arch/arm64/boot/dts/qcom/msm8916.dtsi | 66 +++++ drivers/clk/qcom/gcc-msm8960.c | 19 +- drivers/thermal/Kconfig | 5 + drivers/thermal/Makefile | 1 + drivers/thermal/qcom/Kconfig | 10 + drivers/thermal/qcom/Makefile | 2 + drivers/thermal/qcom/tsens-8916.c | 107 ++++++++ drivers/thermal/qcom/tsens-8960.c | 291 +++++++++++++++++++++ drivers/thermal/qcom/tsens-8974.c | 239 +++++++++++++++++ drivers/thermal/qcom/tsens-common.c | 130 +++++++++ drivers/thermal/qcom/tsens.c | 206 +++++++++++++++ drivers/thermal/qcom/tsens.h | 69 +++++ 16 files changed, 1488 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/thermal/qcom-tsens.txt create mode 100644 drivers/thermal/qcom/Kconfig create mode 100644 drivers/thermal/qcom/Makefile create mode 100644 drivers/thermal/qcom/tsens-8916.c create mode 100644 drivers/thermal/qcom/tsens-8960.c create mode 100644 drivers/thermal/qcom/tsens-8974.c create mode 100644 drivers/thermal/qcom/tsens-common.c create mode 100644 drivers/thermal/qcom/tsens.c create mode 100644 drivers/thermal/qcom/tsens.h
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v3 1/9 thermal: qcom: tsens: Add a skeletal TSENS drivers
TSENS is Qualcomms' thermal temperature sensor device. It supports reading temperatures from multiple thermal sensors present on various QCOM SoCs.
Calibration data is generally read from a non-volatile memory (eeprom) device.
Add a skeleton driver with all the necessary abstractions so a variety of qcom device families which support TSENS can add driver extensions.
Also add the required device tree bindings which can be used to describe the TSENS device in DT.
--- .../devicetree/bindings/thermal/qcom-tsens.txt | 33 ++++ drivers/thermal/Kconfig | 5 + drivers/thermal/Makefile | 1 + drivers/thermal/qcom/Kconfig | 10 ++ drivers/thermal/qcom/Makefile | 2 + drivers/thermal/qcom/tsens.c | 199 +++++++++++++++++++++ drivers/thermal/qcom/tsens.h | 58 ++++++ 7 files changed, 308 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/qcom-tsens.txt create mode 100644 drivers/thermal/qcom/Kconfig create mode 100644 drivers/thermal/qcom/Makefile create mode 100644 drivers/thermal/qcom/tsens.c create mode 100644 drivers/thermal/qcom/tsens.h
Documentation/devicetree/bindings/thermal/qcom-tsens.txt new file +33 -0
@@ -0,0 +1,33 @@ +* QCOM SoC Temperature Sensor (TSENS) + +Required properties: +- compatible : + - "qcom,msm8916-tsens" : For 8916 Family of SoCs + - "qcom,msm8974-tsens" : For 8974 Family of SoCs + +- reg: Address range of the thermal registers +- qcom,tsens-slopes : Must contain slope value for each of the sensors controlled + by this device +- #thermal-sensor-cells : Should be 1. See ./thermal.txt for a description. +- Refer to Documentation/devicetree/bindings/nvmem/nvmem.txt to know how to specify +nvmem cells + +Optional properties: +- qcom,sensor-id: List of sensor instances used in a given SoC. A TSENS IP can + have a fixed number of sensors (like 11) but a given SoC can + use only 5 of these and they might not always the first 5. They + could be sensors 0, 1, 4, 8 and 9. This property is used to + describe the subset of the sensors used. If this property is + missing they are assumed to be the first 'n' sensors numbered + sequentially in which case the number of sensors defaults to + the number of slope values. + +Example: +tsens: thermal-sensor at 900000 { + compatible = "qcom,msm8916-tsens"; + nvmem-cells = <&tsens_caldata>, <&tsens_calsel>; + nvmem-cell-names = "caldata", "calsel"; + qcom,tsens-slopes = <3200 3200 3200 3200 3200>; + qcom,sensor-id = <0 1 2 4 5>; + #thermal-sensor-cells = <1>; + };
drivers/thermal/Kconfig +5 -0
@@ -374,4 +374,9 @@ config QCOM_SPMI_TEMP_ALARM real time die temperature if an ADC is present or an estimate of the temperature based upon the over temperature stage value. +menu "Qualcomm thermal drivers" +depends on ARCH_QCOM && OF +source "drivers/thermal/qcom/Kconfig" +endmenu + endif
drivers/thermal/Makefile +1 -0
@@ -43,5 +43,6 @@ obj-$(CONFIG_TI_SOC_THERMAL) += ti-soc-thermal/ obj-$(CONFIG_INT340X_THERMAL) += int340x_thermal/ obj-$(CONFIG_INTEL_PCH_THERMAL) += intel_pch_thermal.o obj-$(CONFIG_ST_THERMAL) += st/ +obj-$(CONFIG_QCOM_TSENS) += qcom/ obj-$(CONFIG_TEGRA_SOCTHERM) += tegra_soctherm.o obj-$(CONFIG_HISI_THERMAL) += hisi_thermal.o
drivers/thermal/qcom/Kconfig new file +10 -0
@@ -0,0 +1,10 @@ +config QCOM_TSENS + tristate "Qualcomm TSENS Temperature Alarm" + depends on THERMAL + depends on QCOM_QFPROM + help + This enables the thermal sysfs driver for the TSENS device. It shows + up in Sysfs as a thermal zone with multiple trip points. Disabling the + thermal zone device via the mode file results in disabling the sensor. + Also able to set threshold temperature for both hot and cold and update + when a threshold is reached.
drivers/thermal/qcom/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +obj-$(CONFIG_QCOM_TSENS) += qcom_tsens.o +qcom_tsens-y += tsens.o
drivers/thermal/qcom/tsens.c new file +199 -0
199 lines not on this page · raw message
drivers/thermal/qcom/tsens.h new file +58 -0
58 lines not on this page · raw message
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v3 2/9 thermal: qcom: tsens-8916: Add support for 8916 family of SoCs
In reply to Rajendra NayakAdd support to calibrate sensors on 8916 family and also add common functions to read temperature from sensors (This can be reused on other SoCs having similar TSENS device)
The calibration data is read from eeprom using the generic nvmem framework apis.
Based on the original code by Siddartha Mohanadoss and Stephen Boyd.
--- drivers/thermal/qcom/Makefile | 2 +- drivers/thermal/qcom/tsens-8916.c | 107 +++++++++++++++++++++++++++++ drivers/thermal/qcom/tsens-common.c | 130 ++++++++++++++++++++++++++++++++++++ drivers/thermal/qcom/tsens.c | 1 + drivers/thermal/qcom/tsens.h | 11 +++ 5 files changed, 250 insertions(+), 1 deletion(-) create mode 100644 drivers/thermal/qcom/tsens-8916.c create mode 100644 drivers/thermal/qcom/tsens-common.c
drivers/thermal/qcom/Makefile +1 -1
@@ -1,2 +1,2 @@ obj-$(CONFIG_QCOM_TSENS) += qcom_tsens.o -qcom_tsens-y += tsens.o +qcom_tsens-y += tsens.o tsens-common.o tsens-8916.o
drivers/thermal/qcom/tsens-8916.c new file +107 -0
107 lines not on this page · raw message
drivers/thermal/qcom/tsens-common.c new file +130 -0
130 lines not on this page · raw message
drivers/thermal/qcom/tsens.c +1 -0
@@ -65,6 +65,7 @@ static SIMPLE_DEV_PM_OPS(tsens_pm_ops, tsens_suspend, tsens_resume);static const struct of_device_id tsens_table[] = { { .compatible ="qcom,msm8916-tsens" , + .data = &ops_8916, }, { .compatible ="qcom,msm8974-tsens" , },
drivers/thermal/qcom/tsens.h +11 -0
@@ -13,6 +13,10 @@#ifndef __QCOM_TSENS_H__#define __QCOM_TSENS_H__ +#define ONE_PT_CALIB 0x1 +#define ONE_PT_CALIB2 0x2 +#define TWO_PT_CALIB 0x3 +struct tsens_device ; struct tsens_sensor {
@@ -55,4 +59,11 @@ struct tsens_device { struct tsens_sensor sensor[0]; }; +char *qfprom_read (struct device *,const char *); +void compute_intercept_slope (struct tsens_device *,u32 *,u32 *,u32 ); +int init_common (struct tsens_device *); +int get_temp_common (struct tsens_device *,int ,int *); + +extern const struct tsens_ops ops_8916; +#endif /* __QCOM_TSENS_H__ */
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v3 3/9 thermal: qcom: tsens-8974: Add support for 8974 family of SoCs
In reply to Rajendra NayakAdd .calibrate support for 8974 family as part of tsens_ops.
Based on the original code by Siddartha Mohanadoss and Stephen Boyd.
--- drivers/thermal/qcom/Makefile | 2 +- drivers/thermal/qcom/tsens-8974.c | 239 ++++++++++++++++++++++++++++++++++++++ drivers/thermal/qcom/tsens.c | 1 + drivers/thermal/qcom/tsens.h | 2 +- 4 files changed, 242 insertions(+), 2 deletions(-) create mode 100644 drivers/thermal/qcom/tsens-8974.c
drivers/thermal/qcom/Makefile +1 -1
@@ -1,2 +1,2 @@ obj-$(CONFIG_QCOM_TSENS) += qcom_tsens.o -qcom_tsens-y += tsens.o tsens-common.o tsens-8916.o +qcom_tsens-y += tsens.o tsens-common.o tsens-8916.o tsens-8974.o
drivers/thermal/qcom/tsens-8974.c new file +239 -0
239 lines not on this page · raw message
drivers/thermal/qcom/tsens.c +1 -0
@@ -68,6 +68,7 @@ static const struct of_device_id tsens_table[] = { .data = &ops_8916, }, { .compatible = "qcom,msm8974-tsens", + .data = &ops_8974, }, {} };
drivers/thermal/qcom/tsens.h +1 -1
@@ -64,6 +64,6 @@ void compute_intercept_slope(struct tsens_device *, u32 *, u32 *, u32);int init_common (struct tsens_device *);int get_temp_common (struct tsens_device *,int ,int *); -extern const struct tsens_ops ops_8916; +extern const struct tsens_ops ops_8916, ops_8974;#endif /* __QCOM_TSENS_H__ */
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v3 4/9 clk: qcom: create virtual child device for TSENS
In reply to Rajendra Nayak8960 family of devices have TSENS as part of GCC in hardware. Hence DT would represent a GCC node with GCC properties as well as TSENS. Create a virtual platform child device here for TSENS so the driver can probe it and use the parent (GCC) to extract DT properties.
--- drivers/clk/qcom/gcc-msm8960.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/clk/qcom/gcc-msm8960.c +18 -1
@@ -3506,6 +3506,8 @@ static int gcc_msm8960_probe(struct platform_device *pdev)struct clk *clk;struct device *dev = &pdev->dev;const struct of_device_id *match; +struct platform_device *tsens; +int ret; match =of_match_device (gcc_msm8960_match_table, &pdev->dev);if (!match)
@@ -3520,11 +3522,26 @@ static int gcc_msm8960_probe(struct platform_device *pdev)if (IS_ERR (clk))return PTR_ERR (clk); -return qcom_cc_probe (pdev, match->data); + ret =qcom_cc_probe (pdev, match->data); +if (ret) +return ret; + + tsens =platform_device_register_data (&pdev->dev,"qcom-tsens" ,-1 , +NULL ,0 ); +if (IS_ERR (tsens)) { +qcom_cc_remove (pdev); +return PTR_ERR (tsens); + } +platform_set_drvdata (pdev, tsens); + +return 0 ; }static int gcc_msm8960_remove (struct platform_device *pdev) { +struct platform_device *tsens =platform_get_drvdata (pdev); + +platform_device_unregister (tsens);qcom_cc_remove (pdev);return 0 ; }
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v3 4/9 clk: qcom: create virtual child device for TSENS
Quoted 6 lines · Rajendra Nayak
drivers/clk/qcom/gcc-msm8960.c +1
-1@@ -3520,11 +3522,26 @@ static int gcc_msm8960_probe(struct platform_device *pdev)if (IS_ERR (clk))return PTR_ERR (clk); -return qcom_cc_probe (pdev, match->data); + ret =qcom_cc_probe (pdev, match->data);
drivers/clk/qcom/gcc-msm8960.c static int gcc_msm8960_probe(struct platform_device *pdev) · line 3535
Quoted 10 lines
drivers/clk/qcom/gcc-msm8960.c +10
-0+if (ret) +return ret; + + tsens =platform_device_register_data (&pdev->dev,"qcom-tsens" ,-1 , +NULL ,0 ); +if (IS_ERR (tsens)) { +qcom_cc_remove (pdev); +return PTR_ERR (tsens); + } +platform_set_drvdata (pdev, tsens);
We just blew away the pointer that qcom_cc_probe() stores.
drivers/clk/qcom/gcc-msm8960.c static int gcc_msm8960_probe(struct platform_device *pdev) · line 3545
Quoted 10 lines
drivers/clk/qcom/gcc-msm8960.c +5
-0+ +return 0 ; }static int gcc_msm8960_remove (struct platform_device *pdev) { +struct platform_device *tsens =platform_get_drvdata (pdev); + +platform_device_unregister (tsens);qcom_cc_remove (pdev);
So now we've leaked the reset controller.
I suppose the simplest solution is to get the drvdata pointer after qcom_cc_probe(), allocate a container structure to hold that as a void * plus the tsens device, i.e.
struct container {
void *data;
struct platform_device *tsens;
};and then set the drvdata to that. And finally undo all that and restore the drvdata pointer on remove.
I've also been considering putting some devm stuff inside qcom_cc_probe() itself so that in the normal case you don't even need to call qcom_cc_remove(), it just gets done automatically. That would open up the possibility for drivers to use the drvdata member as they wish.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v3 4/9 clk: qcom: create virtual child device for TSENS
Quoted 8 lines · Stephen Boyd
On 10/08, Rajendra Nayak wrote:
I've also been considering putting some devm stuff inside
qcom_cc_probe()itself so that in the normal case you don't even need to callqcom_cc_remove(), it just gets done automatically. That would open up the possibility for drivers to use the drvdata member as they wish.
Something like this untested patch
---8<---
From: Stephen Boyd <[email protected]>
Subject: [PATCH] qcom: clk: Make qcom_cc_probe() fully devm safe
Some APIs in qcom_cc_probe() don't have a devm counterpart, so we have to use the calling device's platform data to pass pointers to the remove path. Let's use devm_add_action() instead, so that the remove path doesn't need to do anything, allowing us to remove qcom_cc_remove() entirely.
--- drivers/clk/qcom/common.c | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-)
drivers/clk/qcom/common.c +24 -11
@@ -73,6 +73,21 @@ qcom_cc_map(struct platform_device *pdev, const struct qcom_cc_desc *desc) }EXPORT_SYMBOL_GPL (qcom_cc_map); +static void qcom_cc_del_clk_provider (void *data) +{ +of_clk_del_provider (data); +} + +static void qcom_cc_reset_unregister (void *data) +{ +reset_controller_unregister (data); +} + +static void qcom_cc_gdsc_unregister (void *data) +{ +gdsc_unregister (data); +} +int qcom_cc_really_probe (struct platform_device *pdev,const struct qcom_cc_desc *desc,struct regmap *regmap) {
@@ -111,6 +126,8 @@ int qcom_cc_really_probe(struct platform_device *pdev,if (ret)return ret; +devm_add_action (dev, qcom_cc_del_clk_provider, pdev->dev.of_node); + reset = &cc->reset; reset->rcdev.of_node = dev->of_node; reset->rcdev.ops = &qcom_reset_ops;
@@ -118,25 +135,24 @@ int qcom_cc_really_probe(struct platform_device *pdev, reset->rcdev.nr_resets = desc->num_resets; reset->regmap = regmap; reset->reset_map = desc->resets; -platform_set_drvdata (pdev, &reset->rcdev); ret =reset_controller_register (&reset->rcdev);if (ret) - goto err_reset; +return ret; + +devm_add_action (dev, qcom_cc_reset_unregister, &reset->rcdev);if (desc->gdscs && desc->num_gdscs) { ret =gdsc_register (dev, desc->gdscs, desc->num_gdscs, &reset->rcdev, regmap);if (ret) - goto err_pd; +return ret; } +devm_add_action (dev, qcom_cc_gdsc_unregister, dev); + +return 0 ; -err_pd: -reset_controller_unregister (&reset->rcdev); -err_reset: -of_clk_del_provider (dev->of_node); -return ret; }EXPORT_SYMBOL_GPL (qcom_cc_really_probe);
@@ -154,9 +170,6 @@ EXPORT_SYMBOL_GPL(qcom_cc_probe);void qcom_cc_remove (struct platform_device *pdev) { -gdsc_unregister (&pdev->dev); -of_clk_del_provider (pdev->dev.of_node); -reset_controller_unregister (platform_get_drvdata (pdev)); }EXPORT_SYMBOL_GPL (qcom_cc_remove);
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH 1/1 clk: qcom: Drop calls to qcom_cc_remove()
Now that qcom_cc_remove() is a nop, drop calls to qcom_cc_remove() and any empty driver remove functions.
---
And here's the driver part. I left 8960_remove in place to make your patch easier to apply. Time to sleep.
drivers/clk/qcom/common.c | 5 ----- drivers/clk/qcom/common.h | 2 -- drivers/clk/qcom/gcc-apq8084.c | 7 ------- drivers/clk/qcom/gcc-ipq806x.c | 7 ------- drivers/clk/qcom/gcc-msm8660.c | 7 ------- drivers/clk/qcom/gcc-msm8916.c | 7 ------- drivers/clk/qcom/gcc-msm8960.c | 1 - drivers/clk/qcom/gcc-msm8974.c | 7 ------- drivers/clk/qcom/lcc-ipq806x.c | 7 ------- drivers/clk/qcom/lcc-msm8960.c | 7 ------- drivers/clk/qcom/mmcc-apq8084.c | 7 ------- drivers/clk/qcom/mmcc-msm8960.c | 7 ------- drivers/clk/qcom/mmcc-msm8974.c | 6 +----- 13 files changed, 1 insertion(+), 76 deletions(-)
drivers/clk/qcom/common.c +0 -5
@@ -168,9 +168,4 @@ int qcom_cc_probe(struct platform_device *pdev, const struct qcom_cc_desc *desc) }EXPORT_SYMBOL_GPL (qcom_cc_probe); -void qcom_cc_remove (struct platform_device *pdev) -{ -} -EXPORT_SYMBOL_GPL (qcom_cc_remove); -MODULE_LICENSE ("GPL v2" );
drivers/clk/qcom/common.h +0 -2
@@ -45,6 +45,4 @@ extern int qcom_cc_really_probe(struct platform_device *pdev,extern int qcom_cc_probe (struct platform_device *pdev,const struct qcom_cc_desc *desc); -extern void qcom_cc_remove (struct platform_device *pdev); -#endif
drivers/clk/qcom/gcc-apq8084.c +0 -7
@@ -3623,15 +3623,8 @@ static int gcc_apq8084_probe(struct platform_device *pdev)return qcom_cc_probe (pdev, &gcc_apq8084_desc); } -static int gcc_apq8084_remove (struct platform_device *pdev) -{ -qcom_cc_remove (pdev); -return 0 ; -} -static struct platform_driver gcc_apq8084_driver = { .probe = gcc_apq8084_probe, - .remove = gcc_apq8084_remove, .driver = { .name ="gcc-apq8084" , .of_match_table = gcc_apq8084_match_table,
drivers/clk/qcom/gcc-ipq806x.c +0 -7
@@ -3058,15 +3058,8 @@ static int gcc_ipq806x_probe(struct platform_device *pdev)return 0 ; } -static int gcc_ipq806x_remove (struct platform_device *pdev) -{ -qcom_cc_remove (pdev); -return 0 ; -} -static struct platform_driver gcc_ipq806x_driver = { .probe = gcc_ipq806x_probe, - .remove = gcc_ipq806x_remove, .driver = { .name ="gcc-ipq806x" , .of_match_table = gcc_ipq806x_match_table,
drivers/clk/qcom/gcc-msm8660.c +0 -7
@@ -2735,15 +2735,8 @@ static int gcc_msm8660_probe(struct platform_device *pdev)return qcom_cc_probe (pdev, &gcc_msm8660_desc); } -static int gcc_msm8660_remove (struct platform_device *pdev) -{ -qcom_cc_remove (pdev); -return 0 ; -} -static struct platform_driver gcc_msm8660_driver = { .probe = gcc_msm8660_probe, - .remove = gcc_msm8660_remove, .driver = { .name ="gcc-msm8660" , .of_match_table = gcc_msm8660_match_table,
drivers/clk/qcom/gcc-msm8916.c +0 -7
@@ -3372,15 +3372,8 @@ static int gcc_msm8916_probe(struct platform_device *pdev)return qcom_cc_probe (pdev, &gcc_msm8916_desc); } -static int gcc_msm8916_remove (struct platform_device *pdev) -{ -qcom_cc_remove (pdev); -return 0 ; -} -static struct platform_driver gcc_msm8916_driver = { .probe = gcc_msm8916_probe, - .remove = gcc_msm8916_remove, .driver = { .name ="gcc-msm8916" , .of_match_table = gcc_msm8916_match_table,
drivers/clk/qcom/gcc-msm8960.c +0 -1
@@ -3525,7 +3525,6 @@ static int gcc_msm8960_probe(struct platform_device *pdev)static int gcc_msm8960_remove (struct platform_device *pdev) { -qcom_cc_remove (pdev);return 0 ; }
drivers/clk/qcom/gcc-msm8974.c +0 -7
@@ -2744,15 +2744,8 @@ static int gcc_msm8974_probe(struct platform_device *pdev)return qcom_cc_probe (pdev, &gcc_msm8974_desc); } -static int gcc_msm8974_remove (struct platform_device *pdev) -{ -qcom_cc_remove (pdev); -return 0 ; -} -static struct platform_driver gcc_msm8974_driver = { .probe = gcc_msm8974_probe, - .remove = gcc_msm8974_remove, .driver = { .name ="gcc-msm8974" , .of_match_table = gcc_msm8974_match_table,
drivers/clk/qcom/lcc-ipq806x.c +0 -7
@@ -452,15 +452,8 @@ static int lcc_ipq806x_probe(struct platform_device *pdev)return qcom_cc_really_probe (pdev, &lcc_ipq806x_desc, regmap); } -static int lcc_ipq806x_remove (struct platform_device *pdev) -{ -qcom_cc_remove (pdev); -return 0 ; -} -static struct platform_driver lcc_ipq806x_driver = { .probe = lcc_ipq806x_probe, - .remove = lcc_ipq806x_remove, .driver = { .name ="lcc-ipq806x" , .of_match_table = lcc_ipq806x_match_table,
drivers/clk/qcom/lcc-msm8960.c +0 -7
@@ -565,15 +565,8 @@ static int lcc_msm8960_probe(struct platform_device *pdev)return qcom_cc_really_probe (pdev, &lcc_msm8960_desc, regmap); } -static int lcc_msm8960_remove (struct platform_device *pdev) -{ -qcom_cc_remove (pdev); -return 0 ; -} -static struct platform_driver lcc_msm8960_driver = { .probe = lcc_msm8960_probe, - .remove = lcc_msm8960_remove, .driver = { .name ="lcc-msm8960" , .of_match_table = lcc_msm8960_match_table,
drivers/clk/qcom/mmcc-apq8084.c +0 -7
@@ -3402,15 +3402,8 @@ static int mmcc_apq8084_probe(struct platform_device *pdev)return 0 ; } -static int mmcc_apq8084_remove (struct platform_device *pdev) -{ -qcom_cc_remove (pdev); -return 0 ; -} -static struct platform_driver mmcc_apq8084_driver = { .probe = mmcc_apq8084_probe, - .remove = mmcc_apq8084_remove, .driver = { .name ="mmcc-apq8084" , .of_match_table = mmcc_apq8084_match_table,
drivers/clk/qcom/mmcc-msm8960.c +0 -7
@@ -2686,15 +2686,8 @@ static int mmcc_msm8960_probe(struct platform_device *pdev)return qcom_cc_really_probe (pdev, match->data, regmap); } -static int mmcc_msm8960_remove (struct platform_device *pdev) -{ -qcom_cc_remove (pdev); -return 0 ; -} -static struct platform_driver mmcc_msm8960_driver = { .probe = mmcc_msm8960_probe, - .remove = mmcc_msm8960_remove, .driver = { .name ="mmcc-msm8960" , .of_match_table = mmcc_msm8960_match_table,
drivers/clk/qcom/mmcc-msm8974.c +1 -5
@@ -2628,16 +2628,12 @@ static int mmcc_msm8974_probe(struct platform_device *pdev)if (ret)return ret; - ret =pm_genpd_add_subdomain (&oxili_gdsc.pd, &oxilicx_gdsc.pd); -if (ret) -qcom_cc_remove (pdev); -return ret; +return pm_genpd_add_subdomain (&oxili_gdsc.pd, &oxilicx_gdsc.pd); }static int mmcc_msm8974_remove (struct platform_device *pdev) {pm_genpd_remove_subdomain (&oxili_gdsc.pd, &oxilicx_gdsc.pd); -qcom_cc_remove (pdev);return 0 ; }
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH 1/1 clk: qcom: Drop calls to qcom_cc_remove()
Quoted 8 lines · Stephen Boyd
Now that
qcom_cc_remove()is a nop, drop calls toqcom_cc_remove()and any empty driver remove functions.Signed-off-by Stephen Boyd <[email protected]>---
And here's the driver part. I left 8960_remove in place to make your patch easier to apply. Time to sleep.
I was trying to test this out, but looks like none of our clock drivers support a clean remove and reprobe (with or without this patch)
The problem seems to be the fixed rate clocks that get registered at probe, never unregistered, causing the subsequent probe to fail.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH 1/1 clk: qcom: Drop calls to qcom_cc_remove()
Quoted 7 lines · Rajendra Nayak
Quoted 6 lines · Stephen Boyd
Now that
qcom_cc_remove()is a nop, drop calls toqcom_cc_remove()and any empty driver remove functions.Signed-off-by Stephen Boyd <[email protected]>---
Quoted 8 lines
Quoted 2 lines
And here's the driver part. I left 8960_remove in place to make your patch easier to apply. Time to sleep.
I was trying to test this out, but looks like none of our clock drivers support a clean remove and reprobe (with or without this patch)
The problem seems to be the fixed rate clocks that get registered at probe, never unregistered, causing the subsequent probe to fail.
Yeah the gcc drivers are not so good there. We should probably fix those too.
The mmcc drivers support a clean remove and reprobe though. So I tested it on msm8960 with these patches and everything looks good. Removing gcc is sort of annoying because it provides the clock for the serial console.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v3 4/9 clk: qcom: create virtual child device for TSENS
In reply to Stephen BoydQuoted 5 lines · Stephen Boyd
Quoted 4 lines · Rajendra Nayak
drivers/clk/qcom/gcc-msm8960.c +0
-0@@ -3520,11 +3522,26 @@ static int gcc_msm8960_probe(struct platform_device *pdev)if (IS_ERR (clk))return PTR_ERR (clk);
Quoted 14 lines
drivers/clk/qcom/gcc-msm8960.c static int gcc_msm8960_probe(struct platform_device *pdev) · line 3535
Quoted 12 lines
drivers/clk/qcom/gcc-msm8960.c +11
-1-return qcom_cc_probe (pdev, match->data); + ret =qcom_cc_probe (pdev, match->data); +if (ret) +return ret; + + tsens =platform_device_register_data (&pdev->dev,"qcom-tsens" ,-1 , +NULL ,0 ); +if (IS_ERR (tsens)) { +qcom_cc_remove (pdev); +return PTR_ERR (tsens); + } +platform_set_drvdata (pdev, tsens);We just blew away the pointer that
qcom_cc_probe()stores.
Oops, I seem to have completely overlooked that.
Quoted 23 lines
drivers/clk/qcom/gcc-msm8960.c static int gcc_msm8960_probe(struct platform_device *pdev) · line 3545
Quoted 11 lines
drivers/clk/qcom/gcc-msm8960.c +5
-0+ +return 0 ; }static int gcc_msm8960_remove (struct platform_device *pdev) { +struct platform_device *tsens =platform_get_drvdata (pdev); + +platform_device_unregister (tsens);qcom_cc_remove (pdev);So now we've leaked the reset controller.
I suppose the simplest solution is to get the drvdata pointer after
qcom_cc_probe(), allocate a container structure to hold that as a void * plus the tsens device, i.e.struct container { void *data; struct platform_device *tsens; };
Quoted 8 lines
and then set the drvdata to that. And finally undo all that and restore the drvdata pointer on remove.
I've also been considering putting some devm stuff inside
qcom_cc_probe()itself so that in the normal case you don't even need to callqcom_cc_remove(), it just gets done automatically. That would open up the possibility for drivers to use the drvdata member as they wish.
I'll test with the patch you just sent.
Quoted 1 line
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Stephen Boyd
AppliedPATCH v3 4/9 clk: qcom: create virtual child device for TSENS
In reply to Rajendra NayakQuoted 9 lines · Rajendra Nayak
8960 family of devices have TSENS as part of GCC in hardware. Hence DT would represent a GCC node with GCC properties as well as TSENS. Create a virtual platform child device here for TSENS so the driver can probe it and use the parent (GCC) to extract DT properties.
Suggested-by Stephen Boyd <[email protected]>Signed-off-by Rajendra Nayak <[email protected]>---
Applied to clk-next with some massaging. Is there going to be an update to the gcc binding too?
---8<----
From: Rajendra Nayak <[email protected]>
Subject: [PATCH] clk: qcom: create virtual child device for TSENS
8960 family of devices have TSENS as part of GCC in hardware. Hence DT would represent a GCC node with GCC properties as well as TSENS. Create a virtual platform child device here for TSENS so the driver can probe it and use the parent (GCC) to extract DT properties.
[sboyd at codeaurora.org: Massaged to work with devm friendly qcom_cc_probe()]
--- drivers/clk/qcom/gcc-msm8960.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/clk/qcom/gcc-msm8960.c +18 -1
@@ -3506,6 +3506,8 @@ static int gcc_msm8960_probe(struct platform_device *pdev)struct clk *clk;struct device *dev = &pdev->dev;const struct of_device_id *match; +struct platform_device *tsens; +int ret; match =of_match_device (gcc_msm8960_match_table, &pdev->dev);if (!match)
@@ -3520,11 +3522,26 @@ static int gcc_msm8960_probe(struct platform_device *pdev)if (IS_ERR (clk))return PTR_ERR (clk); -return qcom_cc_probe (pdev, match->data); + ret =qcom_cc_probe (pdev, match->data); +if (ret) +return ret; + + tsens =platform_device_register_data (&pdev->dev,"qcom-tsens" ,-1 , +NULL ,0 ); +if (IS_ERR (tsens)) +return PTR_ERR (tsens); + +platform_set_drvdata (pdev, tsens); + +return 0 ; }static int gcc_msm8960_remove (struct platform_device *pdev) { +struct platform_device *tsens =platform_get_drvdata (pdev); + +platform_device_unregister (tsens); +return 0 ; }
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v3 4/9 clk: qcom: create virtual child device for TSENS
Quoted 7 lines · Stephen Boyd
Quoted 6 lines · Rajendra Nayak
8960 family of devices have TSENS as part of GCC in hardware. Hence DT would represent a GCC node with GCC properties as well as TSENS. Create a virtual platform child device here for TSENS so the driver can probe it and use the parent (GCC) to extract DT properties.
Quoted 6 lines
Quoted 3 lines
Suggested-by Stephen Boyd <[email protected]>Signed-off-by Rajendra Nayak <[email protected]>---
Applied to clk-next with some massaging. Is there going to be an update to the gcc binding too?
Thanks, I will update the gcc bindings as part of the patch which adds support for 8960 tsens.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v3 5/9 thermal: qcom: tsens-8960: Add support for 8960 family of SoCs
In reply to Rajendra Nayak8960 family of SoCs have the TSENS device as part of GCC, hence the driver probes the virtual child device created by GCC and uses the parent to extract all DT properties and reuses the GCC regmap.
Also GCC/TSENS are part of a domain thats not always ON. Hence add .suspend and .resume hooks to save and restore some of the inited register context.
Also 8960 family have some of the TSENS init sequence thats required to be done by the HLOS driver (some later versions of TSENS do not export these registers to non-secure world, and hence need these initializations to be done by secure bootloaders)
8660 from the same family has just one sensor and hence some register offset/layout differences which need special handling in the driver.
Based on the original code from Siddartha Mohanadoss, Stephen Boyd and Narendran Rajan.
--- drivers/thermal/qcom/Makefile | 2 +- drivers/thermal/qcom/tsens-8960.c | 291 ++++++++++++++++++++++++++++++++++++++ drivers/thermal/qcom/tsens.c | 13 +- drivers/thermal/qcom/tsens.h | 2 +- 4 files changed, 302 insertions(+), 6 deletions(-) create mode 100644 drivers/thermal/qcom/tsens-8960.c
drivers/thermal/qcom/Makefile +1 -1
@@ -1,2 +1,2 @@ obj-$(CONFIG_QCOM_TSENS) += qcom_tsens.o -qcom_tsens-y += tsens.o tsens-common.o tsens-8916.o tsens-8974.o +qcom_tsens-y += tsens.o tsens-common.o tsens-8916.o tsens-8974.o tsens-8960.o
drivers/thermal/qcom/tsens-8960.c new file +291 -0
291 lines not on this page · raw message
drivers/thermal/qcom/tsens.c +9 -4
@@ -119,7 +119,11 @@ static int tsens_probe(struct platform_device *pdev)struct tsens_device *tmdev;const struct of_device_id *id; - dev = &pdev->dev; +if (pdev->dev.of_node) + dev = &pdev->dev; +else + dev = pdev->dev.parent; + np = dev->of_node; num =of_property_count_u32_elems (np,"qcom,tsens-slopes" );
@@ -141,10 +145,11 @@ static int tsens_probe(struct platform_device *pdev) &s->slope); id =of_match_node (tsens_table, np); -if (!id) -return -ENODEV ; +if (id) + tmdev->ops = id->data; +else + tmdev->ops = &ops_8960; - tmdev->ops = id->data;if (!tmdev->ops || !tmdev->ops->init || !tmdev->ops->calibrate || !tmdev->ops->get_temp)return -EINVAL ;
drivers/thermal/qcom/tsens.h +1 -1
@@ -64,6 +64,6 @@ void compute_intercept_slope(struct tsens_device *, u32 *, u32 *, u32);int init_common (struct tsens_device *);int get_temp_common (struct tsens_device *,int ,int *); -extern const struct tsens_ops ops_8916, ops_8974; +extern const struct tsens_ops ops_8960, ops_8916, ops_8974;#endif /* __QCOM_TSENS_H__ */
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v3 5/9 thermal: qcom: tsens-8960: Add support for 8960 family of SoCs
drivers/thermal/qcom/Makefile line 2
Quoted 8 lines · Rajendra Nayak
drivers/thermal/qcom/Makefile +1
-1@@ -1,2 +1,2 @@ obj-$(CONFIG_QCOM_TSENS) += qcom_tsens.o -qcom_tsens-y += tsens.o tsens-common.o tsens-8916.o tsens-8974.o +qcom_tsens-y += tsens.o tsens-common.o tsens-8916.o tsens-8974.o tsens-8960.o
Maybe a dumb question: What's the point of multiple files for each SoC if they're always built?
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v3 5/9 thermal: qcom: tsens-8960: Add support for 8960 family of SoCs
Quoted 12 lines · Stephen Boyd
drivers/thermal/qcom/Makefile line 2
Quoted 8 lines · Rajendra Nayak
drivers/thermal/qcom/Makefile +1
-1@@ -1,2 +1,2 @@ obj-$(CONFIG_QCOM_TSENS) += qcom_tsens.o -qcom_tsens-y += tsens.o tsens-common.o tsens-8916.o tsens-8974.o +qcom_tsens-y += tsens.o tsens-common.o tsens-8916.o tsens-8974.o tsens-8960.oMaybe a dumb question: What's the point of multiple files for each SoC if they're always built?
Just for code segregation and better readability.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v3 6/9 arm: dts: msm8974: Add thermal zones, tsens and qfprom nodes
In reply to Rajendra NayakAdd thermal zones, tsens and qfprom nodes
--- arch/arm/boot/dts/qcom-msm8974.dtsi | 105 ++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+)
arch/arm/boot/dts/qcom-msm8974.dtsi +105 -0
@@ -86,6 +86,88 @@ }; }; + thermal-zones { + cpu-thermal0 { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens 5>; + + trips { + cpu_alert0: trip at 0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + cpu_crit0: trip at 1 { + temperature = <95000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + + cpu-thermal1 { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens 6>; + + trips { + cpu_alert1: trip at 0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + cpu_crit1: trip at 1 { + temperature = <95000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + + cpu-thermal2 { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens 7>; + + trips { + cpu_alert2: trip at 0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + cpu_crit2: trip at 1 { + temperature = <95000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + + cpu-thermal3 { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens 8>; + + trips { + cpu_alert3: trip at 0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + cpu_crit3: trip at 1 { + temperature = <95000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + }; + cpu-pmu { compatible = "qcom,krait-pmu"; interrupts = <1 7 0xf04>;
@@ -114,6 +196,29 @@ <0xf9002000 0x1000>; }; + qfprom: qfprom at fc4bc000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "qcom,qfprom"; + reg = <0xfc4bc000 0x1000>; + tsens_calib: calib at d0 { + reg = <0xd0 0x18>; + }; + tsens_backup: backup at 440 { + reg = <0x440 0x10>; + }; + }; + + tsens: thermal-sensor at fc4a8000 { + compatible = "qcom,msm8974-tsens"; + reg = <0xfc4a8000 0x2000>; + nvmem-cells = <&tsens_calib>, <&tsens_backup>; + nvmem-cell-names = "calib", "calib_backup"; + qcom,tsens-slopes = <3200 3200 3200 3200 3200 3200 + 3200 3200 3200 3200 3200>; + #thermal-sensor-cells = <1>; + }; + timer at f9020000 { #address-cells = <1>; #size-cells = <1>;
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v3 7/9 arm: dts: apq8064: Add thermal zones, tsens and qfprom nodes
In reply to Rajendra NayakTSENS is part of GCC, hence add TSENS properties as part of GCC node. Also add thermal zones and qfprom nodes.
--- arch/arm/boot/dts/qcom-apq8064.dtsi | 101 ++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+)
arch/arm/boot/dts/qcom-apq8064.dtsi +101 -0
@@ -75,6 +75,88 @@ }; }; + thermal-zones { + cpu-thermal0 { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&gcc 7>; + + trips { + cpu_alert0: trip at 0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + cpu_crit0: trip at 1 { + temperature = <95000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + + cpu-thermal1 { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&gcc 8>; + + trips { + cpu_alert1: trip at 0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + cpu_crit1: trip at 1 { + temperature = <95000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + + cpu-thermal2 { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&gcc 9>; + + trips { + cpu_alert2: trip at 0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + cpu_crit2: trip at 1 { + temperature = <95000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + + cpu-thermal3 { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&gcc 10>; + + trips { + cpu_alert3: trip at 0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + cpu_crit3: trip at 1 { + temperature = <95000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + }; + cpu-pmu { compatible = "qcom,krait-pmu"; interrupts = <1 10 0x304>;
@@ -364,11 +446,30 @@ }; }; + qfprom: qfprom at 00700000 { + compatible = "qcom,qfprom"; + reg = <0x00700000 0x1000>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + tsens_calib: calib { + reg = <0x404 0x10>; + }; + tsens_backup: backup_calib { + reg = <0x414 0x10>; + }; + }; + gcc: clock-controller at 900000 { compatible = "qcom,gcc-apq8064"; reg = <0x00900000 0x4000>; + nvmem-cells = <&tsens_calib>, <&tsens_backup>; + nvmem-cell-names = "calib", "calib_backup"; + qcom,tsens-slopes = <1176 1176 1154 1176 1111 + 1132 1132 1199 1132 1199 1132>; #clock-cells = <1>; #reset-cells = <1>; + #thermal-sensor-cells = <1>; }; lcc: clock-controller at 28000000 {
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v3 8/9 arm: dts: apq8084: Add thermal zones, tsens and qfprom nodes
In reply to Rajendra NayakAdd thermal zones, tsens and qfprom nodes
--- arch/arm/boot/dts/qcom-apq8084.dtsi | 105 ++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+)
arch/arm/boot/dts/qcom-apq8084.dtsi +105 -0
@@ -75,6 +75,88 @@ }; }; + thermal-zones { + cpu-thermal0 { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens 5>; + + trips { + cpu_alert0: trip at 0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + cpu_crit0: trip at 1 { + temperature = <95000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + + cpu-thermal1 { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens 6>; + + trips { + cpu_alert1: trip at 0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + cpu_crit1: trip at 1 { + temperature = <95000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + + cpu-thermal2 { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens 7>; + + trips { + cpu_alert2: trip at 0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + cpu_crit2: trip at 1 { + temperature = <95000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + + cpu-thermal3 { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens 8>; + + trips { + cpu_alert3: trip at 0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + cpu_crit3: trip at 1 { + temperature = <95000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + }; + cpu-pmu { compatible = "qcom,krait-pmu"; interrupts = <1 7 0xf04>;
@@ -103,6 +185,29 @@ <0xf9002000 0x1000>; }; + qfprom: qfprom at fc4bc000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "qcom,qfprom"; + reg = <0xfc4bc000 0x1000>; + tsens_calib: calib at d0 { + reg = <0xd0 0x18>; + }; + tsens_backup: backup at 440 { + reg = <0x440 0x10>; + }; + }; + + tsens: thermal-sensor at fc4a8000 { + compatible = "qcom,msm8974-tsens"; + reg = <0xfc4a8000 0x2000>; + nvmem-cells = <&tsens_calib>, <&tsens_backup>; + nvmem-cell-names = "calib", "calib_backup"; + qcom,tsens-slopes = <3200 3200 3200 3200 3200 3200 + 3200 3200 3200 3200 3200>; + #thermal-sensor-cells = <1>; + }; + timer at f9020000 { #address-cells = <1>; #size-cells = <1>;
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v3 9/9 arm64: dts: msm8916: Add thermal zones, tsens and qfprom nodes
In reply to Rajendra NayakAdd thermal zones, tsens and qfprom nodes
--- arch/arm64/boot/dts/qcom/msm8916.dtsi | 66 +++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+)
arch/arm64/boot/dts/qcom/msm8916.dtsi +66 -0
@@ -68,6 +68,49 @@ }; }; + thermal-zones { + cpu-thermal0 { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens 4>; + + trips { + cpu_alert0: trip at 0 { + temperature = <100000>; + hysteresis = <2000>; + type = "passive"; + }; + cpu_crit0: trip at 1 { + temperature = <125000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + + cpu-thermal1 { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens 3>; + + trips { + cpu_alert1: trip at 0 { + temperature = <100000>; + hysteresis = <2000>; + type = "passive"; + }; + cpu_crit1: trip at 1 { + temperature = <125000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + + }; + timer { compatible = "arm,armv8-timer"; interrupts = <GIC_PPI 2 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
@@ -392,6 +435,29 @@ interrupt-controller; #interrupt-cells = <4>; }; + + qfprom: qfprom at 5c000 { + compatible = "qcom,qfprom"; + reg = <0x5c000 0x1000>; + #address-cells = <1>; + #size-cells = <1>; + tsens_caldata: caldata at d0 { + reg = <0xd0 0x8>; + }; + tsens_calsel: calsel at ec { + reg = <0xec 0x4>; + }; + }; + + tsens: thermal-sensor at 4a8000 { + compatible = "qcom,msm8916-tsens"; + reg = <0x4a8000 0x2000>; + nvmem-cells = <&tsens_caldata>, <&tsens_calsel>; + nvmem-cell-names = "calib", "calib_sel"; + qcom,tsens-slopes = <3200 3200 3200 3200 3200>; + qcom,sensor-id = <0 1 2 4 5>; + #thermal-sensor-cells = <1>; + }; }; };
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation