All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 0/4] ARM: Enable thermal support for Raspberry Pi 4
@ 2020-01-03 17:23 ` Stefan Wahren
  0 siblings, 0 replies; 20+ messages in thread
From: Stefan Wahren @ 2020-01-03 17:23 UTC (permalink / raw)
  To: Zhang Rui, Daniel Lezcano, Amit Kucheria, Rob Herring,
	Mark Rutland, Nicolas Saenz Julienne, Florian Fainelli,
	Catalin Marinas, Will Deacon
  Cc: linux-pm, linux-arm-kernel, bcm-kernel-feedback-list, devicetree,
	Stefan Wahren

This series enables thermal support for the Raspberry Pi 4. Neither the
bcm2835_thermal nor the brcmstb_thermal are suitable for the BCM2711.
So add a new thermal driver to read out the SoC temperature from the
AVS RO block of the BCM2711.

Changes in V2:
- rebase on thermal/linux-next
- convert binding to YAML
- make AVS RO block a subnode of AVS monitor and access it via syscon
- drop unnecessary TSENS clock and get the rid of remove callback
- add Florian's reviewed-by to last/unchanged patch

Stefan Wahren (4):
  dt-bindings: Add Broadcom AVS RO thermal
  thermal: Add BCM2711 thermal driver
  ARM: dts: bcm2711: Enable thermal
  ARM: configs: Build BCM2711 thermal as module

 .../bindings/thermal/brcm,avs-ro-thermal.yaml      |  45 +++++++
 arch/arm/boot/dts/bcm2711.dtsi                     |  12 ++
 arch/arm/configs/multi_v7_defconfig                |   1 +
 arch/arm64/configs/defconfig                       |   1 +
 drivers/thermal/broadcom/Kconfig                   |   7 ++
 drivers/thermal/broadcom/Makefile                  |   1 +
 drivers/thermal/broadcom/bcm2711_thermal.c         | 129 +++++++++++++++++++++
 7 files changed, 196 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/brcm,avs-ro-thermal.yaml
 create mode 100644 drivers/thermal/broadcom/bcm2711_thermal.c

--
2.7.4


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH V2 0/4] ARM: Enable thermal support for Raspberry Pi 4
@ 2020-01-03 17:23 ` Stefan Wahren
  0 siblings, 0 replies; 20+ messages in thread
From: Stefan Wahren @ 2020-01-03 17:23 UTC (permalink / raw)
  To: Zhang Rui, Daniel Lezcano, Amit Kucheria, Rob Herring,
	Mark Rutland, Nicolas Saenz Julienne, Florian Fainelli,
	Catalin Marinas, Will Deacon
  Cc: devicetree, bcm-kernel-feedback-list, Stefan Wahren,
	linux-arm-kernel, linux-pm

This series enables thermal support for the Raspberry Pi 4. Neither the
bcm2835_thermal nor the brcmstb_thermal are suitable for the BCM2711.
So add a new thermal driver to read out the SoC temperature from the
AVS RO block of the BCM2711.

Changes in V2:
- rebase on thermal/linux-next
- convert binding to YAML
- make AVS RO block a subnode of AVS monitor and access it via syscon
- drop unnecessary TSENS clock and get the rid of remove callback
- add Florian's reviewed-by to last/unchanged patch

Stefan Wahren (4):
  dt-bindings: Add Broadcom AVS RO thermal
  thermal: Add BCM2711 thermal driver
  ARM: dts: bcm2711: Enable thermal
  ARM: configs: Build BCM2711 thermal as module

 .../bindings/thermal/brcm,avs-ro-thermal.yaml      |  45 +++++++
 arch/arm/boot/dts/bcm2711.dtsi                     |  12 ++
 arch/arm/configs/multi_v7_defconfig                |   1 +
 arch/arm64/configs/defconfig                       |   1 +
 drivers/thermal/broadcom/Kconfig                   |   7 ++
 drivers/thermal/broadcom/Makefile                  |   1 +
 drivers/thermal/broadcom/bcm2711_thermal.c         | 129 +++++++++++++++++++++
 7 files changed, 196 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/brcm,avs-ro-thermal.yaml
 create mode 100644 drivers/thermal/broadcom/bcm2711_thermal.c

--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH V2 1/4] dt-bindings: Add Broadcom AVS RO thermal
  2020-01-03 17:23 ` Stefan Wahren
@ 2020-01-03 17:23   ` Stefan Wahren
  -1 siblings, 0 replies; 20+ messages in thread
From: Stefan Wahren @ 2020-01-03 17:23 UTC (permalink / raw)
  To: Zhang Rui, Daniel Lezcano, Amit Kucheria, Rob Herring,
	Mark Rutland, Nicolas Saenz Julienne, Florian Fainelli,
	Catalin Marinas, Will Deacon
  Cc: linux-pm, linux-arm-kernel, bcm-kernel-feedback-list, devicetree,
	Stefan Wahren

Since the BCM2711 doesn't have a AVS TMON block, the thermal information
must be retrieved from the AVS ring oscillator block. This block is part
of the AVS monitor which contains a bunch of raw sensors.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 .../bindings/thermal/brcm,avs-ro-thermal.yaml      | 45 ++++++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/brcm,avs-ro-thermal.yaml

diff --git a/Documentation/devicetree/bindings/thermal/brcm,avs-ro-thermal.yaml b/Documentation/devicetree/bindings/thermal/brcm,avs-ro-thermal.yaml
new file mode 100644
index 0000000..7dce05e
--- /dev/null
+++ b/Documentation/devicetree/bindings/thermal/brcm,avs-ro-thermal.yaml
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: GPL-2.0+
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/thermal/brcm,avs-ro-thermal.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom AVS ring oscillator thermal
+
+maintainers:
+  - Stefan Wahren <wahrenst@gmx.net>
+
+description: |+
+  The thermal node should be the child of a syscon node with the
+  required property:
+
+  - compatible: Should be one of the following:
+                "brcm,bcm2711-avs-monitor", "syscon", "simple-mfd"
+
+  Refer to the the bindings described in
+  Documentation/devicetree/bindings/mfd/syscon.txt
+
+properties:
+  compatible:
+    const: brcm,bcm2711-thermal
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+        avs-monitor@7d5d2000 {
+                compatible = "brcm,bcm2711-avs-monitor",
+                             "syscon", "simple-mfd";
+                reg = <0x7d5d2000 0xf00>;
+
+                thermal: thermal {
+                        compatible = "brcm,bcm2711-thermal";
+                        #thermal-sensor-cells = <0>;
+                };
+        };
+...
--
2.7.4


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH V2 1/4] dt-bindings: Add Broadcom AVS RO thermal
@ 2020-01-03 17:23   ` Stefan Wahren
  0 siblings, 0 replies; 20+ messages in thread
From: Stefan Wahren @ 2020-01-03 17:23 UTC (permalink / raw)
  To: Zhang Rui, Daniel Lezcano, Amit Kucheria, Rob Herring,
	Mark Rutland, Nicolas Saenz Julienne, Florian Fainelli,
	Catalin Marinas, Will Deacon
  Cc: devicetree, bcm-kernel-feedback-list, Stefan Wahren,
	linux-arm-kernel, linux-pm

Since the BCM2711 doesn't have a AVS TMON block, the thermal information
must be retrieved from the AVS ring oscillator block. This block is part
of the AVS monitor which contains a bunch of raw sensors.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 .../bindings/thermal/brcm,avs-ro-thermal.yaml      | 45 ++++++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/brcm,avs-ro-thermal.yaml

diff --git a/Documentation/devicetree/bindings/thermal/brcm,avs-ro-thermal.yaml b/Documentation/devicetree/bindings/thermal/brcm,avs-ro-thermal.yaml
new file mode 100644
index 0000000..7dce05e
--- /dev/null
+++ b/Documentation/devicetree/bindings/thermal/brcm,avs-ro-thermal.yaml
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: GPL-2.0+
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/thermal/brcm,avs-ro-thermal.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom AVS ring oscillator thermal
+
+maintainers:
+  - Stefan Wahren <wahrenst@gmx.net>
+
+description: |+
+  The thermal node should be the child of a syscon node with the
+  required property:
+
+  - compatible: Should be one of the following:
+                "brcm,bcm2711-avs-monitor", "syscon", "simple-mfd"
+
+  Refer to the the bindings described in
+  Documentation/devicetree/bindings/mfd/syscon.txt
+
+properties:
+  compatible:
+    const: brcm,bcm2711-thermal
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+        avs-monitor@7d5d2000 {
+                compatible = "brcm,bcm2711-avs-monitor",
+                             "syscon", "simple-mfd";
+                reg = <0x7d5d2000 0xf00>;
+
+                thermal: thermal {
+                        compatible = "brcm,bcm2711-thermal";
+                        #thermal-sensor-cells = <0>;
+                };
+        };
+...
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH V2 2/4] thermal: Add BCM2711 thermal driver
  2020-01-03 17:23 ` Stefan Wahren
@ 2020-01-03 17:23   ` Stefan Wahren
  -1 siblings, 0 replies; 20+ messages in thread
From: Stefan Wahren @ 2020-01-03 17:23 UTC (permalink / raw)
  To: Zhang Rui, Daniel Lezcano, Amit Kucheria, Rob Herring,
	Mark Rutland, Nicolas Saenz Julienne, Florian Fainelli,
	Catalin Marinas, Will Deacon
  Cc: linux-pm, linux-arm-kernel, bcm-kernel-feedback-list, devicetree,
	Stefan Wahren

This adds the thermal sensor driver for the Broadcom BCM2711 SoC,
which is placed on the Raspberry Pi 4. The driver only provides
SoC temperature reading so far.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/thermal/broadcom/Kconfig           |   7 ++
 drivers/thermal/broadcom/Makefile          |   1 +
 drivers/thermal/broadcom/bcm2711_thermal.c | 129 +++++++++++++++++++++++++++++
 3 files changed, 137 insertions(+)
 create mode 100644 drivers/thermal/broadcom/bcm2711_thermal.c

diff --git a/drivers/thermal/broadcom/Kconfig b/drivers/thermal/broadcom/Kconfig
index cf43e15..061f1db 100644
--- a/drivers/thermal/broadcom/Kconfig
+++ b/drivers/thermal/broadcom/Kconfig
@@ -1,4 +1,11 @@
 # SPDX-License-Identifier: GPL-2.0-only
+config BCM2711_THERMAL
+	tristate "Broadcom AVS RO thermal sensor driver"
+	depends on ARCH_BCM2835 || COMPILE_TEST
+	depends on THERMAL_OF && MFD_SYSCON
+	help
+	  Support for thermal sensors on Broadcom BCM2711 SoCs.
+
 config BCM2835_THERMAL
 	tristate "Thermal sensors on bcm2835 SoC"
 	depends on ARCH_BCM2835 || COMPILE_TEST
diff --git a/drivers/thermal/broadcom/Makefile b/drivers/thermal/broadcom/Makefile
index 490ab1f..c917b24 100644
--- a/drivers/thermal/broadcom/Makefile
+++ b/drivers/thermal/broadcom/Makefile
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_BCM2711_THERMAL)		+= bcm2711_thermal.o
 obj-$(CONFIG_BCM2835_THERMAL)		+= bcm2835_thermal.o
 obj-$(CONFIG_BRCMSTB_THERMAL)		+= brcmstb_thermal.o
 obj-$(CONFIG_BCM_NS_THERMAL)		+= ns-thermal.o
diff --git a/drivers/thermal/broadcom/bcm2711_thermal.c b/drivers/thermal/broadcom/bcm2711_thermal.c
new file mode 100644
index 0000000..1d55b87
--- /dev/null
+++ b/drivers/thermal/broadcom/bcm2711_thermal.c
@@ -0,0 +1,129 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Broadcom AVS RO thermal sensor driver
+ *
+ * based on brcmstb_thermal
+ *
+ * Copyright (C) 2020 Stefan Wahren
+ */
+
+#include <linux/bitops.h>
+#include <linux/clk.h>
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+#include <linux/thermal.h>
+
+#include "../thermal_hwmon.h"
+
+#define AVS_RO_TEMP_STATUS		0x200
+ #define AVS_RO_TEMP_STATUS_valid_msk	(BIT(16) | BIT(10))
+ #define AVS_RO_TEMP_STATUS_data_msk	GENMASK(9, 0)
+
+struct bcm2711_thermal_priv {
+	struct regmap *regmap;
+	struct device *dev;
+	struct thermal_zone_device *thermal;
+};
+
+static int bcm2711_get_temp(void *data, int *temp)
+{
+	struct bcm2711_thermal_priv *priv = data;
+	int slope = thermal_zone_get_slope(priv->thermal);
+	int offset = thermal_zone_get_offset(priv->thermal);
+	u32 val;
+	int ret;
+	long t;
+
+	ret = regmap_read(priv->regmap, AVS_RO_TEMP_STATUS, &val);
+	if (ret)
+		return ret;
+
+	if (!(val & AVS_RO_TEMP_STATUS_valid_msk)) {
+		dev_err(priv->dev, "reading not valid\n");
+		return -EIO;
+	}
+
+	val &= AVS_RO_TEMP_STATUS_data_msk;
+
+	/* Convert a HW code to a temperature reading (millidegree celsius) */
+	t = slope * val + offset;
+	if (t < 0)
+		*temp = 0;
+	else
+		*temp = t;
+
+	return 0;
+}
+
+static const struct thermal_zone_of_device_ops bcm2711_thermal_of_ops = {
+	.get_temp	= bcm2711_get_temp,
+};
+
+static const struct of_device_id bcm2711_thermal_id_table[] = {
+	{ .compatible = "brcm,bcm2711-thermal" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, bcm2711_thermal_id_table);
+
+static int bcm2711_thermal_probe(struct platform_device *pdev)
+{
+	struct thermal_zone_device *thermal;
+	struct bcm2711_thermal_priv *priv;
+	struct device *dev = &pdev->dev;
+	struct device_node *parent;
+	struct regmap *regmap;
+	int ret;
+
+	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	/* get regmap from syscon node */
+	parent = of_get_parent(dev->of_node); /* parent should be syscon node */
+	regmap = syscon_node_to_regmap(parent);
+	of_node_put(parent);
+	if (IS_ERR(regmap)) {
+		dev_err(dev, "failed to get regmap (error %ld)\n",
+			PTR_ERR(regmap));
+		return PTR_ERR(regmap);
+	}
+	priv->regmap = regmap;
+	priv->dev = dev;
+
+	thermal = devm_thermal_zone_of_sensor_register(dev, 0, priv,
+						       &bcm2711_thermal_of_ops);
+	if (IS_ERR(thermal)) {
+		ret = PTR_ERR(thermal);
+		dev_err(dev, "could not register sensor: %d\n", ret);
+		return ret;
+	}
+
+	priv->thermal = thermal;
+
+	thermal->tzp->no_hwmon = false;
+	ret = thermal_add_hwmon_sysfs(thermal);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
+static struct platform_driver bcm2711_thermal_driver = {
+	.probe = bcm2711_thermal_probe,
+	.driver = {
+		.name = "bcm2711_thermal",
+		.of_match_table = bcm2711_thermal_id_table,
+	},
+};
+module_platform_driver(bcm2711_thermal_driver);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Stefan Wahren");
+MODULE_DESCRIPTION("Broadcom AVS RO thermal sensor driver");
--
2.7.4


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH V2 2/4] thermal: Add BCM2711 thermal driver
@ 2020-01-03 17:23   ` Stefan Wahren
  0 siblings, 0 replies; 20+ messages in thread
From: Stefan Wahren @ 2020-01-03 17:23 UTC (permalink / raw)
  To: Zhang Rui, Daniel Lezcano, Amit Kucheria, Rob Herring,
	Mark Rutland, Nicolas Saenz Julienne, Florian Fainelli,
	Catalin Marinas, Will Deacon
  Cc: devicetree, bcm-kernel-feedback-list, Stefan Wahren,
	linux-arm-kernel, linux-pm

This adds the thermal sensor driver for the Broadcom BCM2711 SoC,
which is placed on the Raspberry Pi 4. The driver only provides
SoC temperature reading so far.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/thermal/broadcom/Kconfig           |   7 ++
 drivers/thermal/broadcom/Makefile          |   1 +
 drivers/thermal/broadcom/bcm2711_thermal.c | 129 +++++++++++++++++++++++++++++
 3 files changed, 137 insertions(+)
 create mode 100644 drivers/thermal/broadcom/bcm2711_thermal.c

diff --git a/drivers/thermal/broadcom/Kconfig b/drivers/thermal/broadcom/Kconfig
index cf43e15..061f1db 100644
--- a/drivers/thermal/broadcom/Kconfig
+++ b/drivers/thermal/broadcom/Kconfig
@@ -1,4 +1,11 @@
 # SPDX-License-Identifier: GPL-2.0-only
+config BCM2711_THERMAL
+	tristate "Broadcom AVS RO thermal sensor driver"
+	depends on ARCH_BCM2835 || COMPILE_TEST
+	depends on THERMAL_OF && MFD_SYSCON
+	help
+	  Support for thermal sensors on Broadcom BCM2711 SoCs.
+
 config BCM2835_THERMAL
 	tristate "Thermal sensors on bcm2835 SoC"
 	depends on ARCH_BCM2835 || COMPILE_TEST
diff --git a/drivers/thermal/broadcom/Makefile b/drivers/thermal/broadcom/Makefile
index 490ab1f..c917b24 100644
--- a/drivers/thermal/broadcom/Makefile
+++ b/drivers/thermal/broadcom/Makefile
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_BCM2711_THERMAL)		+= bcm2711_thermal.o
 obj-$(CONFIG_BCM2835_THERMAL)		+= bcm2835_thermal.o
 obj-$(CONFIG_BRCMSTB_THERMAL)		+= brcmstb_thermal.o
 obj-$(CONFIG_BCM_NS_THERMAL)		+= ns-thermal.o
diff --git a/drivers/thermal/broadcom/bcm2711_thermal.c b/drivers/thermal/broadcom/bcm2711_thermal.c
new file mode 100644
index 0000000..1d55b87
--- /dev/null
+++ b/drivers/thermal/broadcom/bcm2711_thermal.c
@@ -0,0 +1,129 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Broadcom AVS RO thermal sensor driver
+ *
+ * based on brcmstb_thermal
+ *
+ * Copyright (C) 2020 Stefan Wahren
+ */
+
+#include <linux/bitops.h>
+#include <linux/clk.h>
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+#include <linux/thermal.h>
+
+#include "../thermal_hwmon.h"
+
+#define AVS_RO_TEMP_STATUS		0x200
+ #define AVS_RO_TEMP_STATUS_valid_msk	(BIT(16) | BIT(10))
+ #define AVS_RO_TEMP_STATUS_data_msk	GENMASK(9, 0)
+
+struct bcm2711_thermal_priv {
+	struct regmap *regmap;
+	struct device *dev;
+	struct thermal_zone_device *thermal;
+};
+
+static int bcm2711_get_temp(void *data, int *temp)
+{
+	struct bcm2711_thermal_priv *priv = data;
+	int slope = thermal_zone_get_slope(priv->thermal);
+	int offset = thermal_zone_get_offset(priv->thermal);
+	u32 val;
+	int ret;
+	long t;
+
+	ret = regmap_read(priv->regmap, AVS_RO_TEMP_STATUS, &val);
+	if (ret)
+		return ret;
+
+	if (!(val & AVS_RO_TEMP_STATUS_valid_msk)) {
+		dev_err(priv->dev, "reading not valid\n");
+		return -EIO;
+	}
+
+	val &= AVS_RO_TEMP_STATUS_data_msk;
+
+	/* Convert a HW code to a temperature reading (millidegree celsius) */
+	t = slope * val + offset;
+	if (t < 0)
+		*temp = 0;
+	else
+		*temp = t;
+
+	return 0;
+}
+
+static const struct thermal_zone_of_device_ops bcm2711_thermal_of_ops = {
+	.get_temp	= bcm2711_get_temp,
+};
+
+static const struct of_device_id bcm2711_thermal_id_table[] = {
+	{ .compatible = "brcm,bcm2711-thermal" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, bcm2711_thermal_id_table);
+
+static int bcm2711_thermal_probe(struct platform_device *pdev)
+{
+	struct thermal_zone_device *thermal;
+	struct bcm2711_thermal_priv *priv;
+	struct device *dev = &pdev->dev;
+	struct device_node *parent;
+	struct regmap *regmap;
+	int ret;
+
+	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	/* get regmap from syscon node */
+	parent = of_get_parent(dev->of_node); /* parent should be syscon node */
+	regmap = syscon_node_to_regmap(parent);
+	of_node_put(parent);
+	if (IS_ERR(regmap)) {
+		dev_err(dev, "failed to get regmap (error %ld)\n",
+			PTR_ERR(regmap));
+		return PTR_ERR(regmap);
+	}
+	priv->regmap = regmap;
+	priv->dev = dev;
+
+	thermal = devm_thermal_zone_of_sensor_register(dev, 0, priv,
+						       &bcm2711_thermal_of_ops);
+	if (IS_ERR(thermal)) {
+		ret = PTR_ERR(thermal);
+		dev_err(dev, "could not register sensor: %d\n", ret);
+		return ret;
+	}
+
+	priv->thermal = thermal;
+
+	thermal->tzp->no_hwmon = false;
+	ret = thermal_add_hwmon_sysfs(thermal);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
+static struct platform_driver bcm2711_thermal_driver = {
+	.probe = bcm2711_thermal_probe,
+	.driver = {
+		.name = "bcm2711_thermal",
+		.of_match_table = bcm2711_thermal_id_table,
+	},
+};
+module_platform_driver(bcm2711_thermal_driver);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Stefan Wahren");
+MODULE_DESCRIPTION("Broadcom AVS RO thermal sensor driver");
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH V2 3/4] ARM: dts: bcm2711: Enable thermal
  2020-01-03 17:23 ` Stefan Wahren
@ 2020-01-03 17:23   ` Stefan Wahren
  -1 siblings, 0 replies; 20+ messages in thread
From: Stefan Wahren @ 2020-01-03 17:23 UTC (permalink / raw)
  To: Zhang Rui, Daniel Lezcano, Amit Kucheria, Rob Herring,
	Mark Rutland, Nicolas Saenz Julienne, Florian Fainelli,
	Catalin Marinas, Will Deacon
  Cc: linux-pm, linux-arm-kernel, bcm-kernel-feedback-list, devicetree,
	Stefan Wahren

This enables thermal for the BCM2711 (used on Raspberry Pi 4) by adding
the AVS monitor and a subnode for the thermal part.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 arch/arm/boot/dts/bcm2711.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi
index 961bed8..96f341d 100644
--- a/arch/arm/boot/dts/bcm2711.dtsi
+++ b/arch/arm/boot/dts/bcm2711.dtsi
@@ -66,6 +66,17 @@
 						 IRQ_TYPE_LEVEL_HIGH)>;
 		};

+		avs_monitor: avs-monitor@7d5d2000 {
+			compatible = "brcm,bcm2711-avs-monitor",
+				     "syscon", "simple-mfd";
+			reg = <0x7d5d2000 0xf00>;
+
+			thermal: thermal {
+				compatible = "brcm,bcm2711-thermal";
+				#thermal-sensor-cells = <0>;
+			};
+		};
+
 		dma: dma@7e007000 {
 			compatible = "brcm,bcm2835-dma";
 			reg = <0x7e007000 0xb00>;
@@ -363,6 +374,7 @@

 &cpu_thermal {
 	coefficients = <(-487) 410040>;
+	thermal-sensors = <&thermal>;
 };

 &dsi0 {
--
2.7.4


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH V2 3/4] ARM: dts: bcm2711: Enable thermal
@ 2020-01-03 17:23   ` Stefan Wahren
  0 siblings, 0 replies; 20+ messages in thread
From: Stefan Wahren @ 2020-01-03 17:23 UTC (permalink / raw)
  To: Zhang Rui, Daniel Lezcano, Amit Kucheria, Rob Herring,
	Mark Rutland, Nicolas Saenz Julienne, Florian Fainelli,
	Catalin Marinas, Will Deacon
  Cc: devicetree, bcm-kernel-feedback-list, Stefan Wahren,
	linux-arm-kernel, linux-pm

This enables thermal for the BCM2711 (used on Raspberry Pi 4) by adding
the AVS monitor and a subnode for the thermal part.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 arch/arm/boot/dts/bcm2711.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi
index 961bed8..96f341d 100644
--- a/arch/arm/boot/dts/bcm2711.dtsi
+++ b/arch/arm/boot/dts/bcm2711.dtsi
@@ -66,6 +66,17 @@
 						 IRQ_TYPE_LEVEL_HIGH)>;
 		};

+		avs_monitor: avs-monitor@7d5d2000 {
+			compatible = "brcm,bcm2711-avs-monitor",
+				     "syscon", "simple-mfd";
+			reg = <0x7d5d2000 0xf00>;
+
+			thermal: thermal {
+				compatible = "brcm,bcm2711-thermal";
+				#thermal-sensor-cells = <0>;
+			};
+		};
+
 		dma: dma@7e007000 {
 			compatible = "brcm,bcm2835-dma";
 			reg = <0x7e007000 0xb00>;
@@ -363,6 +374,7 @@

 &cpu_thermal {
 	coefficients = <(-487) 410040>;
+	thermal-sensors = <&thermal>;
 };

 &dsi0 {
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH V2 4/4] ARM: configs: Build BCM2711 thermal as module
  2020-01-03 17:23 ` Stefan Wahren
@ 2020-01-03 17:23   ` Stefan Wahren
  -1 siblings, 0 replies; 20+ messages in thread
From: Stefan Wahren @ 2020-01-03 17:23 UTC (permalink / raw)
  To: Zhang Rui, Daniel Lezcano, Amit Kucheria, Rob Herring,
	Mark Rutland, Nicolas Saenz Julienne, Florian Fainelli,
	Catalin Marinas, Will Deacon
  Cc: linux-pm, linux-arm-kernel, bcm-kernel-feedback-list, devicetree,
	Stefan Wahren

This builds the BCM2711 thermal driver as module for the Raspberry Pi 4.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
 arch/arm/configs/multi_v7_defconfig | 1 +
 arch/arm64/configs/defconfig        | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 3f1b96d..f5d19cc 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -496,6 +496,7 @@ CONFIG_IMX_THERMAL=y
 CONFIG_ROCKCHIP_THERMAL=y
 CONFIG_RCAR_THERMAL=y
 CONFIG_ARMADA_THERMAL=y
+CONFIG_BCM2711_THERMAL=m
 CONFIG_BCM2835_THERMAL=m
 CONFIG_BRCMSTB_THERMAL=m
 CONFIG_ST_THERMAL_MEMMAP=y
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 6a83ba2..b2f6673 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -442,6 +442,7 @@ CONFIG_ROCKCHIP_THERMAL=m
 CONFIG_RCAR_THERMAL=y
 CONFIG_RCAR_GEN3_THERMAL=y
 CONFIG_ARMADA_THERMAL=y
+CONFIG_BCM2711_THERMAL=m
 CONFIG_BCM2835_THERMAL=m
 CONFIG_BRCMSTB_THERMAL=m
 CONFIG_EXYNOS_THERMAL=y
--
2.7.4


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH V2 4/4] ARM: configs: Build BCM2711 thermal as module
@ 2020-01-03 17:23   ` Stefan Wahren
  0 siblings, 0 replies; 20+ messages in thread
From: Stefan Wahren @ 2020-01-03 17:23 UTC (permalink / raw)
  To: Zhang Rui, Daniel Lezcano, Amit Kucheria, Rob Herring,
	Mark Rutland, Nicolas Saenz Julienne, Florian Fainelli,
	Catalin Marinas, Will Deacon
  Cc: devicetree, bcm-kernel-feedback-list, Stefan Wahren,
	linux-arm-kernel, linux-pm

This builds the BCM2711 thermal driver as module for the Raspberry Pi 4.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
 arch/arm/configs/multi_v7_defconfig | 1 +
 arch/arm64/configs/defconfig        | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 3f1b96d..f5d19cc 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -496,6 +496,7 @@ CONFIG_IMX_THERMAL=y
 CONFIG_ROCKCHIP_THERMAL=y
 CONFIG_RCAR_THERMAL=y
 CONFIG_ARMADA_THERMAL=y
+CONFIG_BCM2711_THERMAL=m
 CONFIG_BCM2835_THERMAL=m
 CONFIG_BRCMSTB_THERMAL=m
 CONFIG_ST_THERMAL_MEMMAP=y
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 6a83ba2..b2f6673 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -442,6 +442,7 @@ CONFIG_ROCKCHIP_THERMAL=m
 CONFIG_RCAR_THERMAL=y
 CONFIG_RCAR_GEN3_THERMAL=y
 CONFIG_ARMADA_THERMAL=y
+CONFIG_BCM2711_THERMAL=m
 CONFIG_BCM2835_THERMAL=m
 CONFIG_BRCMSTB_THERMAL=m
 CONFIG_EXYNOS_THERMAL=y
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 1/4] dt-bindings: Add Broadcom AVS RO thermal
  2020-01-03 17:23   ` Stefan Wahren
@ 2020-01-06 22:15     ` Rob Herring
  -1 siblings, 0 replies; 20+ messages in thread
From: Rob Herring @ 2020-01-06 22:15 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: Zhang Rui, Daniel Lezcano, Amit Kucheria, Mark Rutland,
	Nicolas Saenz Julienne, Florian Fainelli, Catalin Marinas,
	Will Deacon, linux-pm, linux-arm-kernel,
	bcm-kernel-feedback-list, devicetree

On Fri, Jan 03, 2020 at 06:23:53PM +0100, Stefan Wahren wrote:
> Since the BCM2711 doesn't have a AVS TMON block, the thermal information
> must be retrieved from the AVS ring oscillator block. This block is part
> of the AVS monitor which contains a bunch of raw sensors.
> 
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> ---
>  .../bindings/thermal/brcm,avs-ro-thermal.yaml      | 45 ++++++++++++++++++++++
>  1 file changed, 45 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/thermal/brcm,avs-ro-thermal.yaml
> 
> diff --git a/Documentation/devicetree/bindings/thermal/brcm,avs-ro-thermal.yaml b/Documentation/devicetree/bindings/thermal/brcm,avs-ro-thermal.yaml
> new file mode 100644
> index 0000000..7dce05e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/thermal/brcm,avs-ro-thermal.yaml
> @@ -0,0 +1,45 @@
> +# SPDX-License-Identifier: GPL-2.0+

Dual license new bindings please:

(GPL-2.0-only OR BSD-2-Clause)

With that:

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 1/4] dt-bindings: Add Broadcom AVS RO thermal
@ 2020-01-06 22:15     ` Rob Herring
  0 siblings, 0 replies; 20+ messages in thread
From: Rob Herring @ 2020-01-06 22:15 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: Mark Rutland, devicetree, Amit Kucheria, Florian Fainelli,
	linux-pm, Catalin Marinas, Daniel Lezcano,
	bcm-kernel-feedback-list, linux-arm-kernel, Zhang Rui,
	Will Deacon, Nicolas Saenz Julienne

On Fri, Jan 03, 2020 at 06:23:53PM +0100, Stefan Wahren wrote:
> Since the BCM2711 doesn't have a AVS TMON block, the thermal information
> must be retrieved from the AVS ring oscillator block. This block is part
> of the AVS monitor which contains a bunch of raw sensors.
> 
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> ---
>  .../bindings/thermal/brcm,avs-ro-thermal.yaml      | 45 ++++++++++++++++++++++
>  1 file changed, 45 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/thermal/brcm,avs-ro-thermal.yaml
> 
> diff --git a/Documentation/devicetree/bindings/thermal/brcm,avs-ro-thermal.yaml b/Documentation/devicetree/bindings/thermal/brcm,avs-ro-thermal.yaml
> new file mode 100644
> index 0000000..7dce05e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/thermal/brcm,avs-ro-thermal.yaml
> @@ -0,0 +1,45 @@
> +# SPDX-License-Identifier: GPL-2.0+

Dual license new bindings please:

(GPL-2.0-only OR BSD-2-Clause)

With that:

Reviewed-by: Rob Herring <robh@kernel.org>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 2/4] thermal: Add BCM2711 thermal driver
  2020-01-03 17:23   ` Stefan Wahren
@ 2020-01-06 22:30     ` Florian Fainelli
  -1 siblings, 0 replies; 20+ messages in thread
From: Florian Fainelli @ 2020-01-06 22:30 UTC (permalink / raw)
  To: Stefan Wahren, Zhang Rui, Daniel Lezcano, Amit Kucheria,
	Rob Herring, Mark Rutland, Nicolas Saenz Julienne,
	Florian Fainelli, Catalin Marinas, Will Deacon
  Cc: linux-pm, linux-arm-kernel, bcm-kernel-feedback-list, devicetree

Hi Stefan,

On 1/3/20 9:23 AM, Stefan Wahren wrote:
> This adds the thermal sensor driver for the Broadcom BCM2711 SoC,
> which is placed on the Raspberry Pi 4. The driver only provides
> SoC temperature reading so far.
> 
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

This looks good, I just have a couple of nits that you can address since
the binding needs to be re-spun, see below, in any case:

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

[snip]

> +	of_node_put(parent);
> +	if (IS_ERR(regmap)) {
> +		dev_err(dev, "failed to get regmap (error %ld)\n",
> +			PTR_ERR(regmap));

Here we use %ld

> +		return PTR_ERR(regmap);
> +	}
> +	priv->regmap = regmap;
> +	priv->dev = dev;
> +
> +	thermal = devm_thermal_zone_of_sensor_register(dev, 0, priv,
> +						       &bcm2711_thermal_of_ops);
> +	if (IS_ERR(thermal)) {
> +		ret = PTR_ERR(thermal);
> +		dev_err(dev, "could not register sensor: %d\n", ret);

and here we do an implicit cast into int, thus using %d, could we just
make both consistent and use %d?
-- 
Florian

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 2/4] thermal: Add BCM2711 thermal driver
@ 2020-01-06 22:30     ` Florian Fainelli
  0 siblings, 0 replies; 20+ messages in thread
From: Florian Fainelli @ 2020-01-06 22:30 UTC (permalink / raw)
  To: Stefan Wahren, Zhang Rui, Daniel Lezcano, Amit Kucheria,
	Rob Herring, Mark Rutland, Nicolas Saenz Julienne,
	Florian Fainelli, Catalin Marinas, Will Deacon
  Cc: devicetree, bcm-kernel-feedback-list, linux-arm-kernel, linux-pm

Hi Stefan,

On 1/3/20 9:23 AM, Stefan Wahren wrote:
> This adds the thermal sensor driver for the Broadcom BCM2711 SoC,
> which is placed on the Raspberry Pi 4. The driver only provides
> SoC temperature reading so far.
> 
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

This looks good, I just have a couple of nits that you can address since
the binding needs to be re-spun, see below, in any case:

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

[snip]

> +	of_node_put(parent);
> +	if (IS_ERR(regmap)) {
> +		dev_err(dev, "failed to get regmap (error %ld)\n",
> +			PTR_ERR(regmap));

Here we use %ld

> +		return PTR_ERR(regmap);
> +	}
> +	priv->regmap = regmap;
> +	priv->dev = dev;
> +
> +	thermal = devm_thermal_zone_of_sensor_register(dev, 0, priv,
> +						       &bcm2711_thermal_of_ops);
> +	if (IS_ERR(thermal)) {
> +		ret = PTR_ERR(thermal);
> +		dev_err(dev, "could not register sensor: %d\n", ret);

and here we do an implicit cast into int, thus using %d, could we just
make both consistent and use %d?
-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 0/4] ARM: Enable thermal support for Raspberry Pi 4
  2020-01-03 17:23 ` Stefan Wahren
@ 2020-01-06 22:39   ` Florian Fainelli
  -1 siblings, 0 replies; 20+ messages in thread
From: Florian Fainelli @ 2020-01-06 22:39 UTC (permalink / raw)
  To: Stefan Wahren, Zhang Rui, Daniel Lezcano, Amit Kucheria,
	Rob Herring, Mark Rutland, Nicolas Saenz Julienne,
	Catalin Marinas, Will Deacon
  Cc: linux-pm, linux-arm-kernel, bcm-kernel-feedback-list, devicetree

On 1/3/20 9:23 AM, Stefan Wahren wrote:
> This series enables thermal support for the Raspberry Pi 4. Neither the
> bcm2835_thermal nor the brcmstb_thermal are suitable for the BCM2711.
> So add a new thermal driver to read out the SoC temperature from the
> AVS RO block of the BCM2711.
> 
> Changes in V2:
> - rebase on thermal/linux-next
> - convert binding to YAML
> - make AVS RO block a subnode of AVS monitor and access it via syscon
> - drop unnecessary TSENS clock and get the rid of remove callback
> - add Florian's reviewed-by to last/unchanged patch

After your resubmit to address Rob's feedback on the binding, I would be
keen on taking patches 3 and 4 since they do look good to me, and
patches 1-2 can be applied to the thermal tree.

Thanks Stefan.

> 
> Stefan Wahren (4):
>   dt-bindings: Add Broadcom AVS RO thermal
>   thermal: Add BCM2711 thermal driver
>   ARM: dts: bcm2711: Enable thermal
>   ARM: configs: Build BCM2711 thermal as module
> 
>  .../bindings/thermal/brcm,avs-ro-thermal.yaml      |  45 +++++++
>  arch/arm/boot/dts/bcm2711.dtsi                     |  12 ++
>  arch/arm/configs/multi_v7_defconfig                |   1 +
>  arch/arm64/configs/defconfig                       |   1 +
>  drivers/thermal/broadcom/Kconfig                   |   7 ++
>  drivers/thermal/broadcom/Makefile                  |   1 +
>  drivers/thermal/broadcom/bcm2711_thermal.c         | 129 ++++++++++++++++=
> +++++
>  7 files changed, 196 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/thermal/brcm,avs-ro-=
> thermal.yaml
>  create mode 100644 drivers/thermal/broadcom/bcm2711_thermal.c
> 
> =2D-
> 2.7.4
> 


-- 
Florian

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 0/4] ARM: Enable thermal support for Raspberry Pi 4
@ 2020-01-06 22:39   ` Florian Fainelli
  0 siblings, 0 replies; 20+ messages in thread
From: Florian Fainelli @ 2020-01-06 22:39 UTC (permalink / raw)
  To: Stefan Wahren, Zhang Rui, Daniel Lezcano, Amit Kucheria,
	Rob Herring, Mark Rutland, Nicolas Saenz Julienne,
	Catalin Marinas, Will Deacon
  Cc: devicetree, bcm-kernel-feedback-list, linux-arm-kernel, linux-pm

On 1/3/20 9:23 AM, Stefan Wahren wrote:
> This series enables thermal support for the Raspberry Pi 4. Neither the
> bcm2835_thermal nor the brcmstb_thermal are suitable for the BCM2711.
> So add a new thermal driver to read out the SoC temperature from the
> AVS RO block of the BCM2711.
> 
> Changes in V2:
> - rebase on thermal/linux-next
> - convert binding to YAML
> - make AVS RO block a subnode of AVS monitor and access it via syscon
> - drop unnecessary TSENS clock and get the rid of remove callback
> - add Florian's reviewed-by to last/unchanged patch

After your resubmit to address Rob's feedback on the binding, I would be
keen on taking patches 3 and 4 since they do look good to me, and
patches 1-2 can be applied to the thermal tree.

Thanks Stefan.

> 
> Stefan Wahren (4):
>   dt-bindings: Add Broadcom AVS RO thermal
>   thermal: Add BCM2711 thermal driver
>   ARM: dts: bcm2711: Enable thermal
>   ARM: configs: Build BCM2711 thermal as module
> 
>  .../bindings/thermal/brcm,avs-ro-thermal.yaml      |  45 +++++++
>  arch/arm/boot/dts/bcm2711.dtsi                     |  12 ++
>  arch/arm/configs/multi_v7_defconfig                |   1 +
>  arch/arm64/configs/defconfig                       |   1 +
>  drivers/thermal/broadcom/Kconfig                   |   7 ++
>  drivers/thermal/broadcom/Makefile                  |   1 +
>  drivers/thermal/broadcom/bcm2711_thermal.c         | 129 ++++++++++++++++=
> +++++
>  7 files changed, 196 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/thermal/brcm,avs-ro-=
> thermal.yaml
>  create mode 100644 drivers/thermal/broadcom/bcm2711_thermal.c
> 
> =2D-
> 2.7.4
> 


-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 2/4] thermal: Add BCM2711 thermal driver
  2020-01-06 22:30     ` Florian Fainelli
@ 2020-01-07 11:28       ` Nicolas Saenz Julienne
  -1 siblings, 0 replies; 20+ messages in thread
From: Nicolas Saenz Julienne @ 2020-01-07 11:28 UTC (permalink / raw)
  To: Florian Fainelli, Stefan Wahren, Zhang Rui, Daniel Lezcano,
	Amit Kucheria, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon
  Cc: linux-pm, linux-arm-kernel, bcm-kernel-feedback-list, devicetree

[-- Attachment #1: Type: text/plain, Size: 1409 bytes --]

On Mon, 2020-01-06 at 14:30 -0800, Florian Fainelli wrote:
> Hi Stefan,
> 
> On 1/3/20 9:23 AM, Stefan Wahren wrote:
> > This adds the thermal sensor driver for the Broadcom BCM2711 SoC,
> > which is placed on the Raspberry Pi 4. The driver only provides
> > SoC temperature reading so far.
> > 
> > Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> 
> This looks good, I just have a couple of nits that you can address since
> the binding needs to be re-spun, see below, in any case:
> 
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> 
> [snip]
> 
> > +	of_node_put(parent);
> > +	if (IS_ERR(regmap)) {
> > +		dev_err(dev, "failed to get regmap (error %ld)\n",
> > +			PTR_ERR(regmap));
> 
> Here we use %ld
> 
> > +		return PTR_ERR(regmap);
> > +	}
> > +	priv->regmap = regmap;
> > +	priv->dev = dev;
> > +
> > +	thermal = devm_thermal_zone_of_sensor_register(dev, 0, priv,
> > +						       &bcm2711_thermal_of_ops);
> > +	if (IS_ERR(thermal)) {
> > +		ret = PTR_ERR(thermal);
> > +		dev_err(dev, "could not register sensor: %d\n", ret);
> 
> and here we do an implicit cast into int, thus using %d, could we just
> make both consistent and use %d?

Extra nit since you're changing this. I'd suggest keeping the same format
between error messages (i.e. one encloses the error message between parentheses
and the other uses a colon).

Regards,
Nicolas


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 2/4] thermal: Add BCM2711 thermal driver
@ 2020-01-07 11:28       ` Nicolas Saenz Julienne
  0 siblings, 0 replies; 20+ messages in thread
From: Nicolas Saenz Julienne @ 2020-01-07 11:28 UTC (permalink / raw)
  To: Florian Fainelli, Stefan Wahren, Zhang Rui, Daniel Lezcano,
	Amit Kucheria, Rob Herring, Mark Rutland, Catalin Marinas,
	Will Deacon
  Cc: devicetree, bcm-kernel-feedback-list, linux-arm-kernel, linux-pm


[-- Attachment #1.1: Type: text/plain, Size: 1409 bytes --]

On Mon, 2020-01-06 at 14:30 -0800, Florian Fainelli wrote:
> Hi Stefan,
> 
> On 1/3/20 9:23 AM, Stefan Wahren wrote:
> > This adds the thermal sensor driver for the Broadcom BCM2711 SoC,
> > which is placed on the Raspberry Pi 4. The driver only provides
> > SoC temperature reading so far.
> > 
> > Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> 
> This looks good, I just have a couple of nits that you can address since
> the binding needs to be re-spun, see below, in any case:
> 
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> 
> [snip]
> 
> > +	of_node_put(parent);
> > +	if (IS_ERR(regmap)) {
> > +		dev_err(dev, "failed to get regmap (error %ld)\n",
> > +			PTR_ERR(regmap));
> 
> Here we use %ld
> 
> > +		return PTR_ERR(regmap);
> > +	}
> > +	priv->regmap = regmap;
> > +	priv->dev = dev;
> > +
> > +	thermal = devm_thermal_zone_of_sensor_register(dev, 0, priv,
> > +						       &bcm2711_thermal_of_ops);
> > +	if (IS_ERR(thermal)) {
> > +		ret = PTR_ERR(thermal);
> > +		dev_err(dev, "could not register sensor: %d\n", ret);
> 
> and here we do an implicit cast into int, thus using %d, could we just
> make both consistent and use %d?

Extra nit since you're changing this. I'd suggest keeping the same format
between error messages (i.e. one encloses the error message between parentheses
and the other uses a colon).

Regards,
Nicolas


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 0/4] ARM: Enable thermal support for Raspberry Pi 4
  2020-01-03 17:23 ` Stefan Wahren
@ 2020-01-07 14:14   ` Nicolas Saenz Julienne
  -1 siblings, 0 replies; 20+ messages in thread
From: Nicolas Saenz Julienne @ 2020-01-07 14:14 UTC (permalink / raw)
  To: Stefan Wahren, Zhang Rui, Daniel Lezcano, Amit Kucheria,
	Rob Herring, Mark Rutland, Florian Fainelli, Catalin Marinas,
	Will Deacon
  Cc: linux-pm, linux-arm-kernel, bcm-kernel-feedback-list, devicetree

[-- Attachment #1: Type: text/plain, Size: 1696 bytes --]

On Fri, 2020-01-03 at 18:23 +0100, Stefan Wahren wrote:
> This series enables thermal support for the Raspberry Pi 4. Neither the
> bcm2835_thermal nor the brcmstb_thermal are suitable for the BCM2711.
> So add a new thermal driver to read out the SoC temperature from the
> AVS RO block of the BCM2711.
> 
> Changes in V2:
> - rebase on thermal/linux-next
> - convert binding to YAML
> - make AVS RO block a subnode of AVS monitor and access it via syscon
> - drop unnecessary TSENS clock and get the rid of remove callback
> - add Florian's reviewed-by to last/unchanged patch
> 
> Stefan Wahren (4):
>   dt-bindings: Add Broadcom AVS RO thermal
>   thermal: Add BCM2711 thermal driver
>   ARM: dts: bcm2711: Enable thermal
>   ARM: configs: Build BCM2711 thermal as module
> 
>  .../bindings/thermal/brcm,avs-ro-thermal.yaml      |  45 +++++++
>  arch/arm/boot/dts/bcm2711.dtsi                     |  12 ++
>  arch/arm/configs/multi_v7_defconfig                |   1 +
>  arch/arm64/configs/defconfig                       |   1 +
>  drivers/thermal/broadcom/Kconfig                   |   7 ++
>  drivers/thermal/broadcom/Makefile                  |   1 +
>  drivers/thermal/broadcom/bcm2711_thermal.c         | 129
> +++++++++++++++++++++
>  7 files changed, 196 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/thermal/brcm,avs-ro-
> thermal.yaml
>  create mode 100644 drivers/thermal/broadcom/bcm2711_thermal.c
> 
> --
> 2.7.4
> 

Minus the small changes mentioned you can add my:

Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Tested-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

Many Thanks!
Nicolas


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH V2 0/4] ARM: Enable thermal support for Raspberry Pi 4
@ 2020-01-07 14:14   ` Nicolas Saenz Julienne
  0 siblings, 0 replies; 20+ messages in thread
From: Nicolas Saenz Julienne @ 2020-01-07 14:14 UTC (permalink / raw)
  To: Stefan Wahren, Zhang Rui, Daniel Lezcano, Amit Kucheria,
	Rob Herring, Mark Rutland, Florian Fainelli, Catalin Marinas,
	Will Deacon
  Cc: devicetree, bcm-kernel-feedback-list, linux-arm-kernel, linux-pm


[-- Attachment #1.1: Type: text/plain, Size: 1696 bytes --]

On Fri, 2020-01-03 at 18:23 +0100, Stefan Wahren wrote:
> This series enables thermal support for the Raspberry Pi 4. Neither the
> bcm2835_thermal nor the brcmstb_thermal are suitable for the BCM2711.
> So add a new thermal driver to read out the SoC temperature from the
> AVS RO block of the BCM2711.
> 
> Changes in V2:
> - rebase on thermal/linux-next
> - convert binding to YAML
> - make AVS RO block a subnode of AVS monitor and access it via syscon
> - drop unnecessary TSENS clock and get the rid of remove callback
> - add Florian's reviewed-by to last/unchanged patch
> 
> Stefan Wahren (4):
>   dt-bindings: Add Broadcom AVS RO thermal
>   thermal: Add BCM2711 thermal driver
>   ARM: dts: bcm2711: Enable thermal
>   ARM: configs: Build BCM2711 thermal as module
> 
>  .../bindings/thermal/brcm,avs-ro-thermal.yaml      |  45 +++++++
>  arch/arm/boot/dts/bcm2711.dtsi                     |  12 ++
>  arch/arm/configs/multi_v7_defconfig                |   1 +
>  arch/arm64/configs/defconfig                       |   1 +
>  drivers/thermal/broadcom/Kconfig                   |   7 ++
>  drivers/thermal/broadcom/Makefile                  |   1 +
>  drivers/thermal/broadcom/bcm2711_thermal.c         | 129
> +++++++++++++++++++++
>  7 files changed, 196 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/thermal/brcm,avs-ro-
> thermal.yaml
>  create mode 100644 drivers/thermal/broadcom/bcm2711_thermal.c
> 
> --
> 2.7.4
> 

Minus the small changes mentioned you can add my:

Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Tested-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

Many Thanks!
Nicolas


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2020-01-07 14:14 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-03 17:23 [PATCH V2 0/4] ARM: Enable thermal support for Raspberry Pi 4 Stefan Wahren
2020-01-03 17:23 ` Stefan Wahren
2020-01-03 17:23 ` [PATCH V2 1/4] dt-bindings: Add Broadcom AVS RO thermal Stefan Wahren
2020-01-03 17:23   ` Stefan Wahren
2020-01-06 22:15   ` Rob Herring
2020-01-06 22:15     ` Rob Herring
2020-01-03 17:23 ` [PATCH V2 2/4] thermal: Add BCM2711 thermal driver Stefan Wahren
2020-01-03 17:23   ` Stefan Wahren
2020-01-06 22:30   ` Florian Fainelli
2020-01-06 22:30     ` Florian Fainelli
2020-01-07 11:28     ` Nicolas Saenz Julienne
2020-01-07 11:28       ` Nicolas Saenz Julienne
2020-01-03 17:23 ` [PATCH V2 3/4] ARM: dts: bcm2711: Enable thermal Stefan Wahren
2020-01-03 17:23   ` Stefan Wahren
2020-01-03 17:23 ` [PATCH V2 4/4] ARM: configs: Build BCM2711 thermal as module Stefan Wahren
2020-01-03 17:23   ` Stefan Wahren
2020-01-06 22:39 ` [PATCH V2 0/4] ARM: Enable thermal support for Raspberry Pi 4 Florian Fainelli
2020-01-06 22:39   ` Florian Fainelli
2020-01-07 14:14 ` Nicolas Saenz Julienne
2020-01-07 14:14   ` Nicolas Saenz Julienne

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.