Re: [PATCH v4 1/8] thermal: qcom: tsens: Add a skeletal TSENS drivers
> [].. > +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. >>> >>> Can you please elaborate a bit more on why you could not solve this >>> using the thermal sensor descriptor id? >>> + +Example: +tsens: thermal-sensor@90 { + compatible = "qcom,msm8916-tsens"; + nvmem-cells = <_caldata>, <_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>; >>> >>> How about if you simply make the sensor driver expose all sensors, then >>> in the >>> thermal zone descriptor, you pick which sensor to use using the thermal >>> sensor >>> descriptor (quoting the binding again): > > Hi Eduardo, > > What you suggested would work, except for that the calibration data in > eeprom would > be available for only the _subset_ of sensors on the SoC. So the driver in > some way would > need to know which exact sensors the eeprom data corresponds to. > > If this does not seem like something which needs to be described in DT, I > can have the > data embedded into the driver so it gets picked based on the right > compatibles. Hey Eduardo, any thoughts on this? -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 1/8] thermal: qcom: tsens: Add a skeletal TSENS drivers
On 11/03/2015 02:00 AM, Eduardo Valentin wrote: > Hello Rajendra, > > On Fri, Oct 09, 2015 at 03:11:03PM +0530, Rajendra Nayak wrote: > > > >> +- #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. > > Can you please elaborate a bit more on why you could not solve this > using the thermal sensor descriptor id? > >> + >> +Example: >> +tsens: thermal-sensor@90 { >> +compatible = "qcom,msm8916-tsens"; >> +nvmem-cells = <_caldata>, <_calsel>; >> +nvmem-cell-names = "caldata", "calsel"; >> +qcom,tsens-slopes = <3200 3200 3200 3200 3200>; > > This property is not documented. Please, also consider my comment on > Narendran's work: use the already existing thermal zone properties. > > Have a look on the binding documentation: > Documentation/devicetree/bindings/thermal/thermal.txt > > > Optional property: > - coefficients: An array of integers (one signed cell) containing > Type: array coefficients to compose a linear relation between > Elem size: one cell the sensors listed in the thermal-sensors property. > Elem type: signed Coefficients defaults to 1, in case this property > is not specified. A simple linear polynomial is used: > Z = c0 * x0 + c1 + x1 + ... + c(n-1) * x(n-1) + cn. > > The coefficients are ordered and they match with > sensors > by means of sensor ID. Additional coefficients are > interpreted as constant offset. > > > Today the code supports only slope + offset linear coefficients. Which I am > assuming you could reuse in your case. Sure, I'll take a look at these and see if I can reuse these bindings instead of creating new ones. regards, Rajendra > > > >> +qcom,sensor-id = <0 1 2 4 5>; >> +#thermal-sensor-cells = <1>; > > How about if you simply make the sensor driver expose all sensors, then in the > thermal zone descriptor, you pick which sensor to use using the thermal sensor > descriptor (quoting the binding again): > > ocp { > ... > /* > * A simple IC with several bandgap temperature sensors. > */ > bandgap0: bandgap@0xED00 { > ... > #thermal-sensor-cells = <1>; > }; > }; > > thermal-zones { > cpu_thermal: cpu-thermal { > polling-delay-passive = <250>; /* milliseconds */ > polling-delay = <1000>; /* milliseconds */ > > /* sensor ID */ > thermal-sensors = < 0>; > }; > gpu_thermal: gpu-thermal { > polling-delay-passive = <120>; /* milliseconds */ > polling-delay = <1000>; /* milliseconds */ > > /* sensor ID */ > thermal-sensors = < 1>; > > }; > > }; > > Would that simplify ? > > BR, > > Eduardo Valentin > >> +}; >> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig >> index 5aabc4b..d49f2bd 100644 >> --- a/drivers/thermal/Kconfig >> +++ b/drivers/thermal/Kconfig >> @@ -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 > > Please add compile test too. > >> +source "drivers/thermal/qcom/Kconfig" >> +endmenu >> + >> endif >> diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile >> index 26f1608..cdaa55f 100644 >> --- a/drivers/thermal/Makefile >> +++ b/drivers/thermal/Makefile >> @@ -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 >> diff --git a/drivers/thermal/qcom/Kconfig b/drivers/thermal/qcom/Kconfig >> new file mode 100644 >>
Re: [PATCH v4 1/8] thermal: qcom: tsens: Add a skeletal TSENS drivers
Hello Rajendra, On Fri, Oct 09, 2015 at 03:11:03PM +0530, Rajendra Nayak wrote: > +- #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. Can you please elaborate a bit more on why you could not solve this using the thermal sensor descriptor id? > + > +Example: > +tsens: thermal-sensor@90 { > + compatible = "qcom,msm8916-tsens"; > + nvmem-cells = <_caldata>, <_calsel>; > + nvmem-cell-names = "caldata", "calsel"; > + qcom,tsens-slopes = <3200 3200 3200 3200 3200>; This property is not documented. Please, also consider my comment on Narendran's work: use the already existing thermal zone properties. Have a look on the binding documentation: Documentation/devicetree/bindings/thermal/thermal.txt Optional property: - coefficients: An array of integers (one signed cell) containing Type: array coefficients to compose a linear relation between Elem size: one cell the sensors listed in the thermal-sensors property. Elem type: signed Coefficients defaults to 1, in case this property is not specified. A simple linear polynomial is used: Z = c0 * x0 + c1 + x1 + ... + c(n-1) * x(n-1) + cn. The coefficients are ordered and they match with sensors by means of sensor ID. Additional coefficients are interpreted as constant offset. Today the code supports only slope + offset linear coefficients. Which I am assuming you could reuse in your case. > + qcom,sensor-id = <0 1 2 4 5>; > + #thermal-sensor-cells = <1>; How about if you simply make the sensor driver expose all sensors, then in the thermal zone descriptor, you pick which sensor to use using the thermal sensor descriptor (quoting the binding again): ocp { ... /* * A simple IC with several bandgap temperature sensors. */ bandgap0: bandgap@0xED00 { ... #thermal-sensor-cells = <1>; }; }; thermal-zones { cpu_thermal: cpu-thermal { polling-delay-passive = <250>; /* milliseconds */ polling-delay = <1000>; /* milliseconds */ /* sensor ID */ thermal-sensors = < 0>; }; gpu_thermal: gpu-thermal { polling-delay-passive = <120>; /* milliseconds */ polling-delay = <1000>; /* milliseconds */ /* sensor ID */ thermal-sensors = < 1>; }; }; Would that simplify ? BR, Eduardo Valentin > + }; > diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig > index 5aabc4b..d49f2bd 100644 > --- a/drivers/thermal/Kconfig > +++ b/drivers/thermal/Kconfig > @@ -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 Please add compile test too. > +source "drivers/thermal/qcom/Kconfig" > +endmenu > + > endif > diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile > index 26f1608..cdaa55f 100644 > --- a/drivers/thermal/Makefile > +++ b/drivers/thermal/Makefile > @@ -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 > diff --git a/drivers/thermal/qcom/Kconfig b/drivers/thermal/qcom/Kconfig > new file mode 100644 > index 000..f7e8e40 > --- /dev/null > +++ b/drivers/thermal/qcom/Kconfig > @@ -0,0 +1,10 @@ > +config QCOM_TSENS > + tristate "Qualcomm TSENS Temperature Alarm" > + depends on THERMAL > + depends on QCOM_QFPROM Compile test.. > + help > + This enables the thermal sysfs driver for the TSENS device. It shows > + up in Sysfs as a
Re: [PATCH v4 1/8] thermal: qcom: tsens: Add a skeletal TSENS drivers
On Fri, Oct 09, 2015 at 03:11:03PM +0530, Rajendra Nayak wrote: > 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. > > Signed-off-by: Rajendra Nayak> Reviewed-by: Lina Iyer > --- > .../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 > > diff --git a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt > b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt > new file mode 100644 > index 000..8b1f26f > --- /dev/null > +++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt > @@ -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@90 { > + compatible = "qcom,msm8916-tsens"; > + nvmem-cells = <_caldata>, <_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>; > + }; > diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig > index 5aabc4b..d49f2bd 100644 > --- a/drivers/thermal/Kconfig > +++ b/drivers/thermal/Kconfig > @@ -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 > diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile > index 26f1608..cdaa55f 100644 > --- a/drivers/thermal/Makefile > +++ b/drivers/thermal/Makefile > @@ -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 > diff --git a/drivers/thermal/qcom/Kconfig b/drivers/thermal/qcom/Kconfig > new file mode 100644 > index 000..f7e8e40 > --- /dev/null > +++ b/drivers/thermal/qcom/Kconfig > @@ -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
[PATCH v4 1/8] 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. Signed-off-by: Rajendra NayakReviewed-by: Lina Iyer --- .../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 diff --git a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt new file mode 100644 index 000..8b1f26f --- /dev/null +++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt @@ -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@90 { + compatible = "qcom,msm8916-tsens"; + nvmem-cells = <_caldata>, <_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>; + }; diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index 5aabc4b..d49f2bd 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig @@ -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 diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile index 26f1608..cdaa55f 100644 --- a/drivers/thermal/Makefile +++ b/drivers/thermal/Makefile @@ -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 diff --git a/drivers/thermal/qcom/Kconfig b/drivers/thermal/qcom/Kconfig new file mode 100644 index 000..f7e8e40 --- /dev/null +++ b/drivers/thermal/qcom/Kconfig @@ -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. diff --git a/drivers/thermal/qcom/Makefile b/drivers/thermal/qcom/Makefile new file mode 100644 index 000..401069b --- /dev/null +++ b/drivers/thermal/qcom/Makefile @@ -0,0 +1,2 @@