Skip to contentSkip to conversation

qcom: Add support for tsens driver

RFC New Rajendra Nayak 3 participants 19 messages Apr 23, 2015 – Jun 15, 2015

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

cover qcom: Add support for tsens driver

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. Based on top of the latest eeprom framework patches [1]

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.

[1] https://lwn.net/Articles/638565/

Rajendra Nayak (6):
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
thermal: qcom: tsens-8960: Add support for 8960 family of SoCs
arm: dts: msm8974: Add thermal zones, tsens and eeprom nodes
arm: dts: apq8064: Add thermal zones, tsens and eeprom nodes

Srinivas Kandagatla (1):
clk: qcom: gcc-msm8960: add child devices support.

 .../devicetree/bindings/thermal/qcom-tsens.txt     |  36 +++
 arch/arm/boot/dts/qcom-apq8064.dtsi                | 108 +++++++
 arch/arm/boot/dts/qcom-msm8974.dtsi                | 105 +++++++
 drivers/clk/qcom/gcc-msm8960.c                     |   4 +-
 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                  | 336 +++++++++++++++++++++
 drivers/thermal/qcom/tsens-8974.c                  | 239 +++++++++++++++
 drivers/thermal/qcom/tsens-common.c                | 128 ++++++++
 drivers/thermal/qcom/tsens.c                       | 209 +++++++++++++
 drivers/thermal/qcom/tsens.h                       |  69 +++++
 14 files changed, 1358 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
#1 lore raw

RFC 1/7 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 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 descibe the tsens device in DT.

---
 .../devicetree/bindings/thermal/qcom-tsens.txt     |  36 ++++
 drivers/thermal/Kconfig                            |   5 +
 drivers/thermal/Makefile                           |   1 +
 drivers/thermal/qcom/Kconfig                       |  10 +
 drivers/thermal/qcom/Makefile                      |   2 +
 drivers/thermal/qcom/tsens.c                       | 206 +++++++++++++++++++++
 drivers/thermal/qcom/tsens.h                       |  58 ++++++
 7 files changed, 318 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 +36 -0
new file mode 100644
index 0000000..90ec469
@@ -0,0 +1,36 @@
+* QCOM SoC Temperature Sensor (TSENS)
+
+Required properties:
+- compatible :
+ - "qcom,msm8916-tsens" : For 8916 Family of SoCs
+ - "qcom,msm8974-tsens" : For 8974 Family of SoCs
+ - "qcom,msm8960-tsens" : For 8960 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/eeprom/eeprom.txt to know how to specify
+an eeprom cell
+
+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.
+
+Example:
+tsens: thermal-sesnor at 900000 {
+		compatible = "qcom,msm8916-tsens";
+		qcom,tsens-slopes = <1176 1176 1154 1176 1111
+				1132 1132 1199 1132 1199
+				1132>;
+		calib_data = <&tsens_caldata>;
+		calib_sel = <&tsens_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
index af40db0..46b63ff 100644
@@ -299,4 +299,9 @@ depends on ARCH_STI && OF
 source "drivers/thermal/st/Kconfig"
 endmenu
 
+menu "Qualcomm thermal drivers"
+depends on ARCH_QCOM && OF
+source "drivers/thermal/qcom/Kconfig"
+endmenu
+
 endif
drivers/thermal/Makefile +1 -0
index fa0dc48..df83890 100644
@@ -38,4 +38,5 @@ obj-$(CONFIG_INTEL_SOC_DTS_THERMAL)	+= intel_soc_dts_thermal.o
 obj-$(CONFIG_TI_SOC_THERMAL)	+= ti-soc-thermal/
 obj-$(CONFIG_INT340X_THERMAL)  += int340x_thermal/
 obj-$(CONFIG_ST_THERMAL)	+= st/
+obj-$(CONFIG_QCOM_TSENS)	+= qcom/
 obj-$(CONFIG_TEGRA_SOCTHERM)	+= tegra_soctherm.o
drivers/thermal/qcom/Kconfig new file +10 -0
new file mode 100644
index 0000000..ade0a03
@@ -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
new file mode 100644
index 0000000..401069b
@@ -0,0 +1,2 @@
+obj-$(CONFIG_QCOM_TSENS)	+= qcom_tsens.o
+qcom_tsens-y			+= tsens.o
drivers/thermal/qcom/tsens.c new file +206 -0

206 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
#2 lore raw

RFC 1/7 thermal: qcom: tsens: Add a skeletal tsens drivers

Hi Rajendra,

Quoted 13 lines · Rajendra Nayak

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 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 descibe the tsens device in DT.

[...]

drivers/thermal/qcom/tsens.c line 167

Quoted 5 lines
drivers/thermal/qcom/tsens.c new file +5 -0
+	ret = tmdev->ops->calibrate(tmdev);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "tsens calibration failed\n");
+		return ret;
+	}

I was trying this series on linux-next with Srini's eeprom v4 and my first attempt was to build the eeprom, qfprom and tsens drivers as built-in. Unfortunately, the tsens driver probed before the eeprom/qfprom driver so failed here with the "calibration failed" message.

Building things as modules worked better, but you might want to take a look at possibly using -EPROBE_DEFER here?

Kevin

#3 lore raw

RFC 1/7 thermal: qcom: tsens: Add a skeletal tsens drivers

Hi Kevin,

Quoted 9 lines

I was trying this series on linux-next with Srini's eeprom v4 and my first attempt was to build the eeprom, qfprom and tsens drivers as built-in. Unfortunately, the tsens driver probed before the eeprom/qfprom driver so failed here with the "calibration failed" message.

Building things as modules worked better, but you might want to take a look at possibly using -EPROBE_DEFER here?

The driver does return -EPROBE_DEFER in case the calibration fails when tsens is probed before qfprom. It does however also show the error message "calibration failed" which is a little misleading and needs fixing. What target were you trying this on? I will give it a try again to make sure things work.

regards,
Rajendra

#4 lore raw

RFC 1/7 thermal: qcom: tsens: Add a skeletal tsens drivers

In reply to Rajendra Nayak
Quoted 1 line · Rajendra Nayak

tsens is qualcomms' thermal temperature sensor device. It

/s/tsens/TSENS /s/qualcomm/Qualcomm

Quoted 4 lines

supports reading temperatures from multiple thermal sensors present on various QCOM SoCs.
Calibration data is generally read from a eeprom device.

Quoted 8 lines

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 descibe the tsens device in DT.

Minor nits. Otherwise,

Quoted 34 lines

---

.../devicetree/bindings/thermal/qcom-tsens.txt     |  36 ++++
drivers/thermal/Kconfig                            |   5 +
drivers/thermal/Makefile                           |   1 +
drivers/thermal/qcom/Kconfig                       |  10 +
drivers/thermal/qcom/Makefile                      |   2 +
drivers/thermal/qcom/tsens.c                       | 206 +++++++++++++++++++++
drivers/thermal/qcom/tsens.h                       |  58 ++++++
7 files changed, 318 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 +13 -0
new file mode 100644
index 0000000..90ec469
@@ -0,0 +1,36 @@
+* QCOM SoC Temperature Sensor (TSENS)
+
+Required properties:
+- compatible :
+ - "qcom,msm8916-tsens" : For 8916 Family of SoCs
+ - "qcom,msm8974-tsens" : For 8974 Family of SoCs
+ - "qcom,msm8960-tsens" : For 8960 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/eeprom/eeprom.txt to know how to specify

Documentation/devicetree/bindings/thermal/qcom-tsens.txt line 23

Quoted 10 lines
Documentation/devicetree/bindings/thermal/qcom-tsens.txt new file +10 -0
+an eeprom cell
+
+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.

May want to explicitly call out that the numsensor defaults to number of slope values.

Documentation/devicetree/bindings/thermal/qcom-tsens.txt line 26

Quoted 3 lines
Documentation/devicetree/bindings/thermal/qcom-tsens.txt new file +3 -0
+
+Example:
+tsens: thermal-sesnor at 900000 {

/s/sesnor/sensor

Quoted 40 lines
Documentation/devicetree/bindings/thermal/qcom-tsens.txt new file +10 -0
+		compatible = "qcom,msm8916-tsens";
+		qcom,tsens-slopes = <1176 1176 1154 1176 1111
+				1132 1132 1199 1132 1199
+				1132>;
+		calib_data = <&tsens_caldata>;
+		calib_sel = <&tsens_calsel>;
+		qcom,tsens-slopes = <3200 3200 3200 3200 3200>;
+		qcom,sensor-id = <0 1 2 4 5>;
+		#thermal-sensor-cells = <1>;
+	};
drivers/thermal/Kconfig +0 -0
index af40db0..46b63ff 100644
@@ -299,4 +299,9 @@ depends on ARCH_STI && OF

source "drivers/thermal/st/Kconfig"
endmenu

drivers/thermal/Kconfig +5 -0
+menu "Qualcomm thermal drivers"
+depends on ARCH_QCOM && OF
+source "drivers/thermal/qcom/Kconfig"
+endmenu
+

endif

drivers/thermal/Makefile +0 -0
index fa0dc48..df83890 100644
@@ -38,4 +38,5 @@ obj-$(CONFIG_INTEL_SOC_DTS_THERMAL)	+= intel_soc_dts_thermal.o

obj-$(CONFIG_TI_SOC_THERMAL) += ti-soc-thermal/
obj-$(CONFIG_INT340X_THERMAL) += int340x_thermal/
obj-$(CONFIG_ST_THERMAL) += st/
+obj-$(CONFIG_QCOM_TSENS) += qcom/
obj-$(CONFIG_TEGRA_SOCTHERM) += tegra_soctherm.o

drivers/thermal/qcom/Kconfig new file +0 -0
new file mode 100644
index 0000000..ade0a03

drivers/thermal/qcom/Kconfig line 2

Quoted 2 lines
drivers/thermal/qcom/Kconfig new file +2 -0
@@ -0,0 +1,10 @@
+config QCOM_TSENS
+	tristate "Qualcomm Tsens Temperature Alarm"

TSENS is the correct usage.

Quoted 60 lines
drivers/thermal/qcom/Kconfig new file +8 -0
+	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
new file mode 100644
index 0000000..401069b
@@ -0,0 +1,2 @@
+obj-$(CONFIG_QCOM_TSENS)	+= qcom_tsens.o
+qcom_tsens-y			+= tsens.o
drivers/thermal/qcom/tsens.c new file +38 -0
new file mode 100644
index 0000000..fa4a73a
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2015, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/err.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/pm.h>
+#include <linux/slab.h>
+#include <linux/thermal.h>
+#include "tsens.h"
+
+static int tsens_get_temp(void *data, long *temp)
+{
+	const struct tsens_sensor *s = data;
+	struct tsens_device *tmdev = s->tmdev;
+
+	return tmdev->ops->get_temp(tmdev, s->id, temp);
+}
+
+static int tsens_get_trend(void *data, long *temp)
+{
+	const struct tsens_sensor *s = data;
+	struct tsens_device *tmdev = s->tmdev;
+
+	if (tmdev->ops->get_trend)
+		return tmdev->ops->get_trend(tmdev, s->id, temp);

drivers/thermal/qcom/tsens.c line 48

Quoted 10 lines
drivers/thermal/qcom/tsens.c new file +10 -0
+
+	return -ENOSYS;
+}
+
+#ifdef CONFIG_PM
+static int tsens_suspend(struct device *dev)
+{
+	struct tsens_device *tmdev = dev_get_drvdata(dev);
+
+	if (tmdev->ops->suspend)

You seem to have checked for tmdev->ops in resume, why not here?

Quoted 20 lines
drivers/thermal/qcom/tsens.c new file +20 -0
+		return tmdev->ops->suspend(tmdev);
+
+	return 0;
+}
+
+static int tsens_resume(struct device *dev)
+{
+	struct tsens_device *tmdev = dev_get_drvdata(dev);
+
+	if (tmdev->ops && tmdev->ops->resume)
+		return tmdev->ops->resume(tmdev);
+
+	return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(tsens_pm_ops, tsens_suspend, tsens_resume);
+#define TSENS_PM_OPS   (&tsens_pm_ops)
+
+#else /* CONFIG_PM_SLEEP */
+#define TSENS_PM_OPS NULL

drivers/thermal/qcom/tsens.c line 78

Quoted 10 lines
drivers/thermal/qcom/tsens.c new file +10 -0
+#endif /* CONFIG_PM_SLEEP */
+
+static const struct of_device_id tsens_table[] = {
+	{
+		.compatible = "qcom,msm8960-tsens",
+	}, {
+		.compatible = "qcom,msm8916-tsens",
+	}, {
+		.compatible = "qcom,msm8974-tsens",
+	},

{ .compatible = "..." },

Makes for an easier read, unless, you have ops that have long names.

Quoted 176 lines
drivers/thermal/qcom/tsens.c new file +128 -0
+	{}
+};
+MODULE_DEVICE_TABLE(of, tsens_table);
+
+static const struct thermal_zone_of_device_ops tsens_of_ops = {
+	.get_temp = tsens_get_temp,
+	.get_trend = tsens_get_trend,
+};
+
+static int tsens_register(struct tsens_device *tmdev)
+{
+	int i, ret;
+	struct thermal_zone_device *tzd;
+	u32 *hw_id, n = tmdev->num_sensors;
+	struct device_node *np = tmdev->dev->of_node;
+
+	hw_id = devm_kcalloc(tmdev->dev, n, sizeof(u32), GFP_KERNEL);
+	if (!hw_id)
+		return -ENOMEM;
+
+	ret = of_property_read_u32_array(np, "qcom,sensor-id", hw_id, n);
+	if (ret)
+		for (i = 0;  i < tmdev->num_sensors; i++)
+			tmdev->sensor[i].hw_id = i;
+	else
+		for (i = 0;  i < tmdev->num_sensors; i++)
+			tmdev->sensor[i].hw_id = hw_id[i];
+
+	for (i = 0;  i < tmdev->num_sensors; i++) {
+		tmdev->sensor[i].tmdev = tmdev;
+		tmdev->sensor[i].id = i;
+		tzd = thermal_zone_of_sensor_register(tmdev->dev, i,
+						      &tmdev->sensor[i],
+						      &tsens_of_ops);
+		if (IS_ERR(tzd))
+			continue;
+		tmdev->sensor[i].tzd = tzd;
+		if (tmdev->ops->enable)
+			tmdev->ops->enable(tmdev, i);
+	}
+	return 0;
+}
+
+static int tsens_probe(struct platform_device *pdev)
+{
+	int ret, i, num;
+	struct device_node *np = pdev->dev.of_node;
+	struct tsens_sensor *s;
+	struct tsens_device *tmdev;
+	const struct of_device_id *id;
+
+	num = of_property_count_u32_elems(np, "qcom,tsens-slopes");
+	if (num <= 0) {
+		dev_err(&pdev->dev, "invalid tsens slopes\n");
+		return -EINVAL;
+	}
+
+	tmdev = devm_kzalloc(&pdev->dev, sizeof(*tmdev) +
+			     num * sizeof(*s), GFP_KERNEL);
+	if (!tmdev)
+		return -ENOMEM;
+
+	tmdev->dev = &pdev->dev;
+	tmdev->num_sensors = num;
+
+	for (i = 0, s = tmdev->sensor; i < tmdev->num_sensors; i++, s++)
+		of_property_read_u32_index(np, "qcom,tsens-slopes", i,
+					   &s->slope);
+
+	id = of_match_node(tsens_table, np);
+	if (!id)
+		return -ENODEV;
+
+	tmdev->ops = id->data;
+	if (!tmdev->ops || !tmdev->ops->init || !tmdev->ops->calibrate ||
+	    !tmdev->ops->get_temp)
+		return -EINVAL;
+
+	ret = tmdev->ops->init(tmdev);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "tsens init failed\n");
+		return ret;
+	}
+
+	ret = tmdev->ops->calibrate(tmdev);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "tsens calibration failed\n");
+		return ret;
+	}
+
+	ret = tsens_register(tmdev);
+
+	platform_set_drvdata(pdev, tmdev);
+
+	return ret;
+}
+
+static int tsens_remove(struct platform_device *pdev)
+{
+	int i;
+	struct tsens_device *tmdev = platform_get_drvdata(pdev);
+	struct thermal_zone_device *tzd;
+
+	if (tmdev->ops->disable)
+		tmdev->ops->disable(tmdev);
+
+	for (i = 0; i < tmdev->num_sensors; i++) {
+		tzd = tmdev->sensor[i].tzd;
+		thermal_zone_of_sensor_unregister(&pdev->dev, tzd);
+	}
+
+	return 0;
+}
+
+static struct platform_driver tsens_driver = {
+	.probe = tsens_probe,
+	.remove = tsens_remove,
+	.driver = {
+		.name = "qcom-tsens",
+		.pm	= TSENS_PM_OPS,
+		.of_match_table = tsens_table,
+	},
+};
+module_platform_driver(tsens_driver);
+
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("QCOM Temperature Sensor driver");
+MODULE_ALIAS("platform:qcom-tsens");
drivers/thermal/qcom/tsens.h new file +42 -0
new file mode 100644
index 0000000..6e3c365
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2015, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#ifndef __QCOM_TSENS_H__
+#define __QCOM_TSENS_H__
+
+struct tsens_device;
+
+struct tsens_sensor {
+	struct tsens_device		*tmdev;
+	struct thermal_zone_device	*tzd;
+	int				offset;
+	int				id;
+	int				hw_id;
+	u32				slope;
+	u32				status;
+};
+
+struct tsens_ops {
+	/* mandatory callbacks */
+	int (*init)(struct tsens_device *);
+	int (*calibrate)(struct tsens_device *);
+	int (*get_temp)(struct tsens_device *, int, long *);
+	/* optional callbacks */
+	int (*enable)(struct tsens_device *, int);
+	void (*disable)(struct tsens_device *);
+	int (*suspend)(struct tsens_device *);
+	int (*resume)(struct tsens_device *);
+	int (*get_trend)(struct tsens_device *, int, long *);
+};
+
+/* Registers to be saved/restored across a context loss */
+struct tsens_context {

drivers/thermal/qcom/tsens.h line 52

Quoted 10 lines
drivers/thermal/qcom/tsens.h new file +10 -0
+	int	threshold;
+	int	control;
+};
+
+struct tsens_device {
+	struct device			*dev;
+	u32				num_sensors;
+	struct regmap			*map;
+	struct regmap_field		*status_field;
+	struct tsens_context		c;

Could have had a better variable name - ctx, perhaps?

Quoted 10 lines
drivers/thermal/qcom/tsens.h new file +6 -0
+	bool				trdy;
+	const struct tsens_ops		*ops;
+	struct tsens_sensor		sensor[0];
+};
+
+#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
#5 lore raw

RFC 1/7 thermal: qcom: tsens: Add a skeletal tsens drivers

Quoted 12 lines · Lina Iyer
Quoted 1 line · Rajendra Nayak

tsens is qualcomms' thermal temperature sensor device. It

/s/tsens/TSENS /s/qualcomm/Qualcomm

Quoted 8 lines

supports reading temperatures from multiple thermal sensors present on various QCOM SoCs.
Calibration data is generally read from a 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.

Quoted 8 lines
Quoted 4 lines

Also add the required device tree bindings which can be used to descibe the tsens device in DT.

Minor nits. Otherwise,

thanks for the review. will fix-up all of the below issues with a repost.

Quoted 417 lines
Quoted 49 lines

---

.../devicetree/bindings/thermal/qcom-tsens.txt     |  36 ++++
drivers/thermal/Kconfig                            |   5 +
drivers/thermal/Makefile                           |   1 +
drivers/thermal/qcom/Kconfig                       |  10 +
drivers/thermal/qcom/Makefile                      |   2 +
drivers/thermal/qcom/tsens.c                       | 206
+++++++++++++++++++++
drivers/thermal/qcom/tsens.h                       |  58 ++++++
7 files changed, 318 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 +10 -0
new file mode 100644
index 0000000..90ec469
@@ -0,0 +1,36 @@
+* QCOM SoC Temperature Sensor (TSENS)
+
+Required properties:
+- compatible :
+ - "qcom,msm8916-tsens" : For 8916 Family of SoCs
+ - "qcom,msm8974-tsens" : For 8974 Family of SoCs
+ - "qcom,msm8960-tsens" : For 8960 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/eeprom/eeprom.txt to know how to specify

Documentation/devicetree/bindings/thermal/qcom-tsens.txt new file +4 -0
+an eeprom cell
+
+Optional properties:
+- qcom,sensor-id: List of sensor instances used in a given SoC. A

TSENS IP can

Documentation/devicetree/bindings/thermal/qcom-tsens.txt new file +2 -0
+          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

Documentation/devicetree/bindings/thermal/qcom-tsens.txt line 23

Quoted 4 lines
Documentation/devicetree/bindings/thermal/qcom-tsens.txt new file +4 -0
+          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.

May want to explicitly call out that the numsensor defaults to number of slope values.

Documentation/devicetree/bindings/thermal/qcom-tsens.txt line 26

Quoted 3 lines
Documentation/devicetree/bindings/thermal/qcom-tsens.txt new file +3 -0
+
+Example:
+tsens: thermal-sesnor at 900000 {

/s/sesnor/sensor

Quoted 41 lines
Documentation/devicetree/bindings/thermal/qcom-tsens.txt new file +10 -0
+        compatible = "qcom,msm8916-tsens";
+        qcom,tsens-slopes = <1176 1176 1154 1176 1111
+                1132 1132 1199 1132 1199
+                1132>;
+        calib_data = <&tsens_caldata>;
+        calib_sel = <&tsens_calsel>;
+        qcom,tsens-slopes = <3200 3200 3200 3200 3200>;
+        qcom,sensor-id = <0 1 2 4 5>;
+        #thermal-sensor-cells = <1>;
+    };
drivers/thermal/Kconfig +0 -0
index af40db0..46b63ff 100644
@@ -299,4 +299,9 @@ depends on ARCH_STI && OF

source "drivers/thermal/st/Kconfig"
endmenu

drivers/thermal/Kconfig +5 -0
+menu "Qualcomm thermal drivers"
+depends on ARCH_QCOM && OF
+source "drivers/thermal/qcom/Kconfig"
+endmenu
+

endif

drivers/thermal/Makefile +0 -0
index fa0dc48..df83890 100644
@@ -38,4 +38,5 @@ obj-$(CONFIG_INTEL_SOC_DTS_THERMAL)    +=

intel_soc_dts_thermal.o
obj-$(CONFIG_TI_SOC_THERMAL) += ti-soc-thermal/
obj-$(CONFIG_INT340X_THERMAL) += int340x_thermal/
obj-$(CONFIG_ST_THERMAL) += st/
+obj-$(CONFIG_QCOM_TSENS) += qcom/
obj-$(CONFIG_TEGRA_SOCTHERM) += tegra_soctherm.o

drivers/thermal/qcom/Kconfig new file +0 -0
new file mode 100644
index 0000000..ade0a03

drivers/thermal/qcom/Kconfig line 2

Quoted 2 lines
drivers/thermal/qcom/Kconfig new file +2 -0
@@ -0,0 +1,10 @@
+config QCOM_TSENS
+    tristate "Qualcomm Tsens Temperature Alarm"

TSENS is the correct usage.

Quoted 65 lines
drivers/thermal/qcom/Kconfig new file +4 -0
+    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

drivers/thermal/qcom/Kconfig new file +1 -0
+      when a threshold is reached.
drivers/thermal/qcom/Makefile new file +2 -0
new file mode 100644
index 0000000..401069b
@@ -0,0 +1,2 @@
+obj-$(CONFIG_QCOM_TSENS)    += qcom_tsens.o
+qcom_tsens-y            += tsens.o
drivers/thermal/qcom/tsens.c new file +38 -0
new file mode 100644
index 0000000..fa4a73a
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2015, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/err.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/pm.h>
+#include <linux/slab.h>
+#include <linux/thermal.h>
+#include "tsens.h"
+
+static int tsens_get_temp(void *data, long *temp)
+{
+    const struct tsens_sensor *s = data;
+    struct tsens_device *tmdev = s->tmdev;
+
+    return tmdev->ops->get_temp(tmdev, s->id, temp);
+}
+
+static int tsens_get_trend(void *data, long *temp)
+{
+    const struct tsens_sensor *s = data;
+    struct tsens_device *tmdev = s->tmdev;
+
+    if (tmdev->ops->get_trend)
+        return tmdev->ops->get_trend(tmdev, s->id, temp);

drivers/thermal/qcom/tsens.c line 48

Quoted 10 lines
drivers/thermal/qcom/tsens.c new file +10 -0
+
+    return -ENOSYS;
+}
+
+#ifdef CONFIG_PM
+static int tsens_suspend(struct device *dev)
+{
+    struct tsens_device *tmdev = dev_get_drvdata(dev);
+
+    if (tmdev->ops->suspend)

You seem to have checked for tmdev->ops in resume, why not here?

Quoted 20 lines
drivers/thermal/qcom/tsens.c new file +20 -0
+        return tmdev->ops->suspend(tmdev);
+
+    return 0;
+}
+
+static int tsens_resume(struct device *dev)
+{
+    struct tsens_device *tmdev = dev_get_drvdata(dev);
+
+    if (tmdev->ops && tmdev->ops->resume)
+        return tmdev->ops->resume(tmdev);
+
+    return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(tsens_pm_ops, tsens_suspend, tsens_resume);
+#define TSENS_PM_OPS   (&tsens_pm_ops)
+
+#else /* CONFIG_PM_SLEEP */
+#define TSENS_PM_OPS NULL

drivers/thermal/qcom/tsens.c line 78

Quoted 10 lines
drivers/thermal/qcom/tsens.c new file +10 -0
+#endif /* CONFIG_PM_SLEEP */
+
+static const struct of_device_id tsens_table[] = {
+    {
+        .compatible = "qcom,msm8960-tsens",
+    }, {
+        .compatible = "qcom,msm8916-tsens",
+    }, {
+        .compatible = "qcom,msm8974-tsens",
+    },

{ .compatible = "..." },

Makes for an easier read, unless, you have ops that have long names.

Quoted 176 lines
drivers/thermal/qcom/tsens.c new file +128 -0
+    {}
+};
+MODULE_DEVICE_TABLE(of, tsens_table);
+
+static const struct thermal_zone_of_device_ops tsens_of_ops = {
+    .get_temp = tsens_get_temp,
+    .get_trend = tsens_get_trend,
+};
+
+static int tsens_register(struct tsens_device *tmdev)
+{
+    int i, ret;
+    struct thermal_zone_device *tzd;
+    u32 *hw_id, n = tmdev->num_sensors;
+    struct device_node *np = tmdev->dev->of_node;
+
+    hw_id = devm_kcalloc(tmdev->dev, n, sizeof(u32), GFP_KERNEL);
+    if (!hw_id)
+        return -ENOMEM;
+
+    ret = of_property_read_u32_array(np, "qcom,sensor-id", hw_id, n);
+    if (ret)
+        for (i = 0;  i < tmdev->num_sensors; i++)
+            tmdev->sensor[i].hw_id = i;
+    else
+        for (i = 0;  i < tmdev->num_sensors; i++)
+            tmdev->sensor[i].hw_id = hw_id[i];
+
+    for (i = 0;  i < tmdev->num_sensors; i++) {
+        tmdev->sensor[i].tmdev = tmdev;
+        tmdev->sensor[i].id = i;
+        tzd = thermal_zone_of_sensor_register(tmdev->dev, i,
+                              &tmdev->sensor[i],
+                              &tsens_of_ops);
+        if (IS_ERR(tzd))
+            continue;
+        tmdev->sensor[i].tzd = tzd;
+        if (tmdev->ops->enable)
+            tmdev->ops->enable(tmdev, i);
+    }
+    return 0;
+}
+
+static int tsens_probe(struct platform_device *pdev)
+{
+    int ret, i, num;
+    struct device_node *np = pdev->dev.of_node;
+    struct tsens_sensor *s;
+    struct tsens_device *tmdev;
+    const struct of_device_id *id;
+
+    num = of_property_count_u32_elems(np, "qcom,tsens-slopes");
+    if (num <= 0) {
+        dev_err(&pdev->dev, "invalid tsens slopes\n");
+        return -EINVAL;
+    }
+
+    tmdev = devm_kzalloc(&pdev->dev, sizeof(*tmdev) +
+                 num * sizeof(*s), GFP_KERNEL);
+    if (!tmdev)
+        return -ENOMEM;
+
+    tmdev->dev = &pdev->dev;
+    tmdev->num_sensors = num;
+
+    for (i = 0, s = tmdev->sensor; i < tmdev->num_sensors; i++, s++)
+        of_property_read_u32_index(np, "qcom,tsens-slopes", i,
+                       &s->slope);
+
+    id = of_match_node(tsens_table, np);
+    if (!id)
+        return -ENODEV;
+
+    tmdev->ops = id->data;
+    if (!tmdev->ops || !tmdev->ops->init || !tmdev->ops->calibrate ||
+        !tmdev->ops->get_temp)
+        return -EINVAL;
+
+    ret = tmdev->ops->init(tmdev);
+    if (ret < 0) {
+        dev_err(&pdev->dev, "tsens init failed\n");
+        return ret;
+    }
+
+    ret = tmdev->ops->calibrate(tmdev);
+    if (ret < 0) {
+        dev_err(&pdev->dev, "tsens calibration failed\n");
+        return ret;
+    }
+
+    ret = tsens_register(tmdev);
+
+    platform_set_drvdata(pdev, tmdev);
+
+    return ret;
+}
+
+static int tsens_remove(struct platform_device *pdev)
+{
+    int i;
+    struct tsens_device *tmdev = platform_get_drvdata(pdev);
+    struct thermal_zone_device *tzd;
+
+    if (tmdev->ops->disable)
+        tmdev->ops->disable(tmdev);
+
+    for (i = 0; i < tmdev->num_sensors; i++) {
+        tzd = tmdev->sensor[i].tzd;
+        thermal_zone_of_sensor_unregister(&pdev->dev, tzd);
+    }
+
+    return 0;
+}
+
+static struct platform_driver tsens_driver = {
+    .probe = tsens_probe,
+    .remove = tsens_remove,
+    .driver = {
+        .name = "qcom-tsens",
+        .pm    = TSENS_PM_OPS,
+        .of_match_table = tsens_table,
+    },
+};
+module_platform_driver(tsens_driver);
+
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("QCOM Temperature Sensor driver");
+MODULE_ALIAS("platform:qcom-tsens");
drivers/thermal/qcom/tsens.h new file +42 -0
new file mode 100644
index 0000000..6e3c365
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2015, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#ifndef __QCOM_TSENS_H__
+#define __QCOM_TSENS_H__
+
+struct tsens_device;
+
+struct tsens_sensor {
+    struct tsens_device        *tmdev;
+    struct thermal_zone_device    *tzd;
+    int                offset;
+    int                id;
+    int                hw_id;
+    u32                slope;
+    u32                status;
+};
+
+struct tsens_ops {
+    /* mandatory callbacks */
+    int (*init)(struct tsens_device *);
+    int (*calibrate)(struct tsens_device *);
+    int (*get_temp)(struct tsens_device *, int, long *);
+    /* optional callbacks */
+    int (*enable)(struct tsens_device *, int);
+    void (*disable)(struct tsens_device *);
+    int (*suspend)(struct tsens_device *);
+    int (*resume)(struct tsens_device *);
+    int (*get_trend)(struct tsens_device *, int, long *);
+};
+
+/* Registers to be saved/restored across a context loss */
+struct tsens_context {

drivers/thermal/qcom/tsens.h line 52

Quoted 10 lines
drivers/thermal/qcom/tsens.h new file +10 -0
+    int    threshold;
+    int    control;
+};
+
+struct tsens_device {
+    struct device            *dev;
+    u32                num_sensors;
+    struct regmap            *map;
+    struct regmap_field        *status_field;
+    struct tsens_context        c;

Could have had a better variable name - ctx, perhaps?

Quoted 10 lines
drivers/thermal/qcom/tsens.h new file +6 -1
+    bool                trdy;
+    const struct tsens_ops        *ops;
+    struct tsens_sensor        sensor[0];
+};
+
+#endif /* __QCOM_TSENS_H__ */
--

QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#6 lore raw

RFC 2/7 thermal: qcom: tsens-8916: Add support for 8916 family of SoCs

In reply to Rajendra Nayak

Add 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 eeprom 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 | 128 ++++++++++++++++++++++++++++++++++++
 drivers/thermal/qcom/tsens.c        |   1 +
 drivers/thermal/qcom/tsens.h        |  11 ++++
 5 files changed, 248 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
index 401069b..05c98e4 100644
@@ -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 +128 -0

128 lines not on this page · raw message

drivers/thermal/qcom/tsens.c +1 -0
index fa4a73a..e190225 100644
@@ -73,6 +73,7 @@ static const struct of_device_id tsens_table[] = {
 		.compatible = "qcom,msm8960-tsens",
 	}, {
 		.compatible = "qcom,msm8916-tsens",
+		.data = &ops_8916,
 	}, {
 		.compatible = "qcom,msm8974-tsens",
 	},
drivers/thermal/qcom/tsens.h +11 -0
index 6e3c365..39b031b 100644
@@ -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, long *);
+
+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
#7 lore raw

RFC 3/7 thermal: qcom: tsens-8974: Add support for 8974 family of SoCs

In reply to Rajendra Nayak

Add .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
index 05c98e4..a471100 100644
@@ -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
index e190225..aeb32a1 100644
@@ -76,6 +76,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
index 39b031b..ee4ae14 100644
@@ -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, long *);
 
-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
#8 lore raw

RFC 4/7 thermal: qcom: tsens-8960: Add support for 8960 family of SoCs

In reply to Rajendra Nayak

8960 family of SoCs have the TSENS device as part of a domain thats not always ON. Hence add .suspend and .resume hooks to save and restore some of the inited register context.

8960 family has TSENS as part of GCC, hence reuse the GCC regmap. Also 8960 family had 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 | 336 ++++++++++++++++++++++++++++++++++++++
 drivers/thermal/qcom/tsens.c      |   1 +
 drivers/thermal/qcom/tsens.h      |   2 +-
 4 files changed, 339 insertions(+), 2 deletions(-)
 create mode 100644 drivers/thermal/qcom/tsens-8960.c
drivers/thermal/qcom/Makefile +1 -1
index a471100..f3cefd1 100644
@@ -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 +336 -0

336 lines not on this page · raw message

drivers/thermal/qcom/tsens.c +1 -0
index aeb32a1..fa50588 100644
@@ -71,6 +71,7 @@ static SIMPLE_DEV_PM_OPS(tsens_pm_ops, tsens_suspend, tsens_resume);
 static const struct of_device_id tsens_table[] = {
 	{
 		.compatible = "qcom,msm8960-tsens",
+		.data = &ops_8960,
 	}, {
 		.compatible = "qcom,msm8916-tsens",
 		.data = &ops_8916,
drivers/thermal/qcom/tsens.h +1 -1
index ee4ae14..a1d6f7a 100644
@@ -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, long *);
 
-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
#9 lore raw

RFC 5/7 arm: dts: msm8974: Add thermal zones, tsens and eeprom nodes

In reply to Rajendra Nayak

Add thermal zones, tsens and eeprom nodes

---
 arch/arm/boot/dts/qcom-msm8974.dtsi | 105 ++++++++++++++++++++++++++++++++++++
 1 file changed, 105 insertions(+)
arch/arm/boot/dts/qcom-msm8974.dtsi +105 -0
index e265ec1..5716e89 100644
@@ -57,6 +57,88 @@
 		};
 	};
 
+	thermal-zones {
+		cpu-thermal0 {
+			polling-delay-passive = <250>;
+			polling-delay = <1000>;
+
+			thermal-sensors = <&tsens 5>;
+
+			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 6>;
+
+			trips {
+				cpu_alert1: trip at 0 {
+					temperature = <100000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+				cpu_crit1: trip at 1 {
+					temperature = <125000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+		};
+
+		cpu-thermal2 {
+			polling-delay-passive = <250>;
+			polling-delay = <1000>;
+
+			thermal-sensors = <&tsens 7>;
+
+			trips {
+				cpu_alert2: trip at 0 {
+					temperature = <100000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+				cpu_crit2: trip at 1 {
+					temperature = <125000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+		};
+
+		cpu-thermal3 {
+			polling-delay-passive = <250>;
+			polling-delay = <1000>;
+
+			thermal-sensors = <&tsens 8>;
+
+			trips {
+				cpu_alert3: trip at 0 {
+					temperature = <100000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+				cpu_crit3: trip at 1 {
+					temperature = <125000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+		};
+	};
+
 	cpu-pmu {
 		compatible = "qcom,krait-pmu";
 		interrupts = <1 7 0xf04>;
@@ -85,6 +167,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>;
+			calib = <&tsens_calib>;
+			calib_backup = <&tsens_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
#10 lore raw

RFC 5/7 arm: dts: msm8974: Add thermal zones, tsens and eeprom nodes

Quoted 1 line · Rajendra Nayak

Add thermal zones, tsens and eeprom nodes

I dont see corresponding patches for 8084 and 8916.

-- Lina

Quoted 133 lines

---
arch/arm/boot/dts/qcom-msm8974.dtsi | 105 ++++++++++++++++++++++++++++++++++++

1 file changed, 105 insertions(+)
arch/arm/boot/dts/qcom-msm8974.dtsi +105 -0
index e265ec1..5716e89 100644
@@ -57,6 +57,88 @@
 		};
 	};
 
+	thermal-zones {
+		cpu-thermal0 {
+			polling-delay-passive = <250>;
+			polling-delay = <1000>;
+
+			thermal-sensors = <&tsens 5>;
+
+			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 6>;
+
+			trips {
+				cpu_alert1: trip at 0 {
+					temperature = <100000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+				cpu_crit1: trip at 1 {
+					temperature = <125000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+		};
+
+		cpu-thermal2 {
+			polling-delay-passive = <250>;
+			polling-delay = <1000>;
+
+			thermal-sensors = <&tsens 7>;
+
+			trips {
+				cpu_alert2: trip at 0 {
+					temperature = <100000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+				cpu_crit2: trip at 1 {
+					temperature = <125000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+		};
+
+		cpu-thermal3 {
+			polling-delay-passive = <250>;
+			polling-delay = <1000>;
+
+			thermal-sensors = <&tsens 8>;
+
+			trips {
+				cpu_alert3: trip at 0 {
+					temperature = <100000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+				cpu_crit3: trip at 1 {
+					temperature = <125000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+		};
+	};
+
 	cpu-pmu {
 		compatible = "qcom,krait-pmu";
 		interrupts = <1 7 0xf04>;
@@ -85,6 +167,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>;
+			calib = <&tsens_calib>;
+			calib_backup = <&tsens_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
#11 lore raw

RFC 5/7 arm: dts: msm8974: Add thermal zones, tsens and eeprom nodes

Quoted 4 lines · Lina Iyer
Quoted 1 line · Rajendra Nayak

Add thermal zones, tsens and eeprom nodes

I dont see corresponding patches for 8084 and 8916.

I did not add 8916 as the dts for it isn't upstream (yet), and I hadn't tested on 8084 but I can certainly do so and update the dts files when I do a respin.

Quoted 137 lines

-- Lina

Quoted 135 lines

---
arch/arm/boot/dts/qcom-msm8974.dtsi | 105
++++++++++++++++++++++++++++++++++++

1 file changed, 105 insertions(+)
arch/arm/boot/dts/qcom-msm8974.dtsi +105 -1
index e265ec1..5716e89 100644
@@ -57,6 +57,88 @@
        };
    };
 
+    thermal-zones {
+        cpu-thermal0 {
+            polling-delay-passive = <250>;
+            polling-delay = <1000>;
+
+            thermal-sensors = <&tsens 5>;
+
+            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 6>;
+
+            trips {
+                cpu_alert1: trip at 0 {
+                    temperature = <100000>;
+                    hysteresis = <2000>;
+                    type = "passive";
+                };
+                cpu_crit1: trip at 1 {
+                    temperature = <125000>;
+                    hysteresis = <2000>;
+                    type = "critical";
+                };
+            };
+        };
+
+        cpu-thermal2 {
+            polling-delay-passive = <250>;
+            polling-delay = <1000>;
+
+            thermal-sensors = <&tsens 7>;
+
+            trips {
+                cpu_alert2: trip at 0 {
+                    temperature = <100000>;
+                    hysteresis = <2000>;
+                    type = "passive";
+                };
+                cpu_crit2: trip at 1 {
+                    temperature = <125000>;
+                    hysteresis = <2000>;
+                    type = "critical";
+                };
+            };
+        };
+
+        cpu-thermal3 {
+            polling-delay-passive = <250>;
+            polling-delay = <1000>;
+
+            thermal-sensors = <&tsens 8>;
+
+            trips {
+                cpu_alert3: trip at 0 {
+                    temperature = <100000>;
+                    hysteresis = <2000>;
+                    type = "passive";
+                };
+                cpu_crit3: trip at 1 {
+                    temperature = <125000>;
+                    hysteresis = <2000>;
+                    type = "critical";
+                };
+            };
+        };
+    };
+
    cpu-pmu {
        compatible = "qcom,krait-pmu";
        interrupts = <1 7 0xf04>;
@@ -85,6 +167,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>;
+            calib = <&tsens_calib>;
+            calib_backup = <&tsens_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>;
--

QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#12 lore raw

RFC 6/7 clk: qcom: gcc-msm8960: add child devices support.

In reply to Rajendra Nayak

From: Srinivas Kandagatla <[email protected]>

This patch adds support to add child devices to gcc as some of the registers mapped by gcc are used by things like thermal sensors.

---
 drivers/clk/qcom/gcc-msm8960.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/qcom/gcc-msm8960.c +3 -1
index eb6a4f9..2c80d03 100644
@@ -15,6 +15,7 @@
 #include <linux/bitops.h>
 #include <linux/err.h>
 #include <linux/platform_device.h>
+#include <linux/of_platform.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
@@ -3520,7 +3521,8 @@ static int gcc_msm8960_probe(struct platform_device *pdev)
 	if (IS_ERR(clk))
 		return PTR_ERR(clk);
 
-	return qcom_cc_probe(pdev, match->data);
+	qcom_cc_probe(pdev, match->data);
+	return of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
 }
 
 static int gcc_msm8960_remove(struct platform_device *pdev)
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
#13 lore raw

RFC 7/7 arm: dts: apq8064: Add thermal zones, tsens and eeprom nodes

In reply to Rajendra Nayak

Add thermal zones, tsens and eeprom nodes

---
 arch/arm/boot/dts/qcom-apq8064.dtsi | 108 ++++++++++++++++++++++++++++++++++++
 1 file changed, 108 insertions(+)
arch/arm/boot/dts/qcom-apq8064.dtsi +108 -0
index b3154c0..1aed325 100644
@@ -61,6 +61,88 @@
 		};
 	};
 
+	thermal-zones {
+		cpu-thermal0 {
+			polling-delay-passive = <250>;
+			polling-delay = <1000>;
+
+			thermal-sensors = <&tsens 7>;
+
+			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 8>;
+
+			trips {
+				cpu_alert1: trip at 0 {
+					temperature = <100000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+				cpu_crit1: trip at 1 {
+					temperature = <125000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+		};
+
+		cpu-thermal2 {
+			polling-delay-passive = <250>;
+			polling-delay = <1000>;
+
+			thermal-sensors = <&tsens 9>;
+
+			trips {
+				cpu_alert2: trip at 0 {
+					temperature = <100000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+				cpu_crit2: trip at 1 {
+					temperature = <125000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+		};
+
+		cpu-thermal3 {
+			polling-delay-passive = <250>;
+			polling-delay = <1000>;
+
+			thermal-sensors = <&tsens 10>;
+
+			trips {
+				cpu_alert3: trip at 0 {
+					temperature = <100000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+				cpu_crit3: trip at 1 {
+					temperature = <125000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+		};
+	};
+
 	cpu-pmu {
 		compatible = "qcom,krait-pmu";
 		interrupts = <1 10 0x304>;
@@ -232,11 +314,37 @@
 			qcom,controller-type = "pmic-arbiter";
 		};
 
+		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>;
 			#clock-cells = <1>;
 			#reset-cells = <1>;
+			#address-cells	= <1>;
+			#size-cells	= <1>;
+			ranges;
+
+			tsens: thermal-sensor at 900000 {
+				compatible = "qcom,msm8960-tsens";
+				calib = <&tsens_calib>;
+				calib_backup = <&tsens_backup>;
+				qcom,tsens-slopes = <1176 1176 1154 1176 1111
+					1132 1132 1199 1132 1199 1132>;
+				#thermal-sensor-cells = <1>;
+			};
 		};
 
 		mmcc: clock-controller at 4000000 {
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
#14 lore raw

cover qcom: Add support for tsens driver

In reply to Rajendra Nayak
Quoted 3 lines · Rajendra Nayak

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.

Thanks, I think the design looks good. Will take a look at the patches.

-- Lina

Quoted 54 lines

Support is added for msm8916, msm8960 and msm8974 families. Based on top of the latest eeprom framework patches [1]

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.

[1] https://lwn.net/Articles/638565/

Rajendra Nayak (6):
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
thermal: qcom: tsens-8960: Add support for 8960 family of SoCs
arm: dts: msm8974: Add thermal zones, tsens and eeprom nodes
arm: dts: apq8064: Add thermal zones, tsens and eeprom nodes

Srinivas Kandagatla (1):
clk: qcom: gcc-msm8960: add child devices support.

.../devicetree/bindings/thermal/qcom-tsens.txt     |  36 +++
arch/arm/boot/dts/qcom-apq8064.dtsi                | 108 +++++++
arch/arm/boot/dts/qcom-msm8974.dtsi                | 105 +++++++
drivers/clk/qcom/gcc-msm8960.c                     |   4 +-
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                  | 336 +++++++++++++++++++++
drivers/thermal/qcom/tsens-8974.c                  | 239 +++++++++++++++
drivers/thermal/qcom/tsens-common.c                | 128 ++++++++
drivers/thermal/qcom/tsens.c                       | 209 +++++++++++++
drivers/thermal/qcom/tsens.h                       |  69 +++++
14 files changed, 1358 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
#15 lore raw

cover qcom: Add support for tsens driver

In reply to Rajendra Nayak

[+ Javi, Punit for power_allocator questions ]

Hi Rajendra,

Quoted 5 lines · Rajendra Nayak

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. Based on top of the latest eeprom framework patches [1]

Curious how are you testing this? with which thermal governor?

I'm experimenting with the new thermal power_allocator governor currently in linux-next, and was hoping to use this to test it, but I'm noticing it doesn't work with the power_allocator governor.

The first thing is that the power_allator goveror expects each thermal zone to have a sustainable-power property in the DT, which this series doesn't provide. Hacking some dummy values in there to see what happens next, I then hit the "thermal zone cpu-thermal0 has wrong trip setup for power allocator" error from the power_allocator driver.

I stopped there as that made it clear this isn't yet ready to be used with the power_allocator governor.

Kevin

#16 lore raw

cover qcom: Add support for tsens driver

Hi Kevin,

Quoted 1 line

Curious how are you testing this? with which thermal governor?

I have been mostly testing this with step wise on the db410c target board.

Quoted 10 lines

I'm experimenting with the new thermal power_allocator governor currently in linux-next, and was hoping to use this to test it, but I'm noticing it doesn't work with the power_allocator governor.

The first thing is that the power_allator goveror expects each thermal zone to have a sustainable-power property in the DT, which this series doesn't provide. Hacking some dummy values in there to see what happens next, I then hit the "thermal zone cpu-thermal0 has wrong trip setup for power allocator" error from the power_allocator driver.

Right, the RFC I posted wasn't tested with IPA and hence does not have some of the additional properties in DT which IPA expects. The wrong trip setup error that you are seeing is because IPA expects 2 passive trip points, a "switch on" trip point and a "desired temperature" trip point and the dts I posted with the RFC had just one passive trip point.

I am in the process of testing this with IPA myself (on db410c mainly, but will also test on db8074 and IFC6410/6540 as well) and will repost in a few days with updated dts entries and a few other minor fixes to the driver itself. Let me know what target board you are interested to get this working on and I will make sure I test on it before I repost.

regards,
Rajendra

#17 lore raw

cover qcom: Add support for tsens driver

Quoted 25 lines · Rajendra Nayak

Hi Kevin,

Quoted 1 line

Curious how are you testing this? with which thermal governor?

I have been mostly testing this with step wise on the db410c target board.

Quoted 10 lines

I'm experimenting with the new thermal power_allocator governor currently in linux-next, and was hoping to use this to test it, but I'm noticing it doesn't work with the power_allocator governor.

The first thing is that the power_allator goveror expects each thermal zone to have a sustainable-power property in the DT, which this series doesn't provide. Hacking some dummy values in there to see what happens next, I then hit the "thermal zone cpu-thermal0 has wrong trip setup for power allocator" error from the power_allocator driver.

Right, the RFC I posted wasn't tested with IPA and hence does not have some of the additional properties in DT which IPA expects. The wrong trip setup error that you are seeing is because IPA expects 2 passive trip points, a "switch on" trip point and a "desired temperature" trip point and the dts I posted with the RFC had just one passive trip point.

Quoted 6 lines

I am in the process of testing this with IPA myself (on db410c mainly, but will also test on db8074 and IFC6410/6540 as well) and will repost in a few days with updated dts entries and a few other minor fixes to the driver itself. Let me know what target board you are interested to get this working on and I will make sure I test on it before I repost.

Great, thanks!

I tried on qcom-apq8064-ifc6410 and qcom-msm8974-sony-xperia-honami, and would have also tried qcom-apq8084-ifc6540 but saw that Lina mentioned there was missing support for 8084.

Kevin

#18 lore raw

cover qcom: Add support for tsens driver

Hi Kevin,

Quoted 7 lines
Quoted 6 lines

I am in the process of testing this with IPA myself (on db410c mainly, but will also test on db8074 and IFC6410/6540 as well) and will repost in a few days with updated dts entries and a few other minor fixes to the driver itself. Let me know what target board you are interested to get this working on and I will make sure I test on it before I repost.

Quoted 5 lines

Great, thanks!

I tried on qcom-apq8064-ifc6410 and qcom-msm8974-sony-xperia-honami, and would have also tried qcom-apq8084-ifc6540 but saw that Lina mentioned there was missing support for 8084.

I have done some testing on ifc6540 now, and will add support for 8084 as well with the repost.

regards,
Rajendra