Commit 3fdd8ea3 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge tag 'thermal-v6.11-rc1' of...

Merge tag 'thermal-v6.11-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/thermal/linux into thermal

Merge thermal drivers updates for 6.11-rc1 from Daniel Lezcano:

"- Group all Renesas drivers inside a dedicated sub directory and add
   the missing dependency to OF (Niklas Söderlund)

 - Add suspend/resume support on k3_j72xx_bandgap and take the
   opportunity to remove a unneeded delay in the init time code path
   (Théo Lebrun)

 - Fix thermal zone definition for MT8186 and MT8188 (Julien Panis)

 - Convert hisilicon-thermal.txt to dt-schema (Abdulrasaq Lawani)

 - Add the DT bindings for the X1E80100 temperature sensor (Abel Vesa)

 - Fix the thermal zone node name regular expression in the DT schema
   (Krzysztof Kozlowski)

 - Take into account some production platforms may not have calibration
   data. Deal with it with a default value instead of failing the
   initialization (Chen-Yu Tsai)

 - Fix the sensor cell size on the Exynos platform (Krzysztof Kozlowski)

 - Bring the common definition of '#thermal-sensor-cells' property in
   order to simplify the bindings on all the platforms where this
   change makes sense and do some minor cleanups (Krzysztof Kozlowski)

 - Fix a race between removal and clock disable on the broadcom driver
   (Krzysztof Kozlowski)

 - Drop 'trips' node as required from the thermal zone bindings in
   order to fix the remaining warnings appearing with thermal zone
   whithout trip points defined (Rob Herring)

 - Simplify all the drivers where dev_err_probe() can apply (Krzysztof
   Kozlowski)

 - Cleanup code related to stih416 as this platform is not described
   anywhere (Raphael Gallais-Pou)"

* tag 'thermal-v6.11-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/thermal/linux: (45 commits)
  thermal/drivers/sti: Cleanup code related to stih416
  thermal/drivers/generic-adc: Simplify with dev_err_probe()
  thermal/drivers/generic-adc: Simplify probe() with local dev variable
  thermal/drivers/qcom-tsens: Simplify with dev_err_probe()
  thermal/drivers/qcom-spmi-adc-tm5: Simplify with dev_err_probe()
  thermal/drivers/imx: Simplify with dev_err_probe()
  thermal/drivers/imx: Simplify probe() with local dev variable
  thermal/drivers/hisi: Simplify with dev_err_probe()
  thermal/drivers/exynos: Simplify with dev_err_probe()
  thermal/drivers/exynos: Simplify probe() with local dev variable
  thermal/drivers/broadcom: Simplify with dev_err_probe()
  thermal/drivers/broadcom: Simplify probe() with local dev variable
  thermal/drivers/broadcom: Fix race between removal and clock disable
  dt-bindings: thermal: Drop 'trips' node as required
  dt-bindings: thermal: qoriq: reference thermal-sensor schema
  dt-bindings: thermal: cleanup examples indentation
  dt-bindings: thermal: simplify few bindings
  dt-bindings: thermal: ti,j72xx: reference thermal-sensor schema
  dt-bindings: thermal: ti,am654: reference thermal-sensor schema
  dt-bindings: thermal: st,stm32: reference thermal-sensor schema
  ...
parents 462be1c3 e61cc85e
......@@ -10,6 +10,8 @@ maintainers:
- Vasily Khoruzhick <anarsoul@gmail.com>
- Yangtao Li <tiny.windzz@gmail.com>
$ref: thermal-sensor.yaml#
properties:
compatible:
enum:
......@@ -55,7 +57,6 @@ properties:
maxItems: 1
description: phandle to device controlling temperate offset SYS_CFG register
# See Documentation/devicetree/bindings/thermal/thermal-sensor.yaml for details
"#thermal-sensor-cells":
enum:
- 0
......@@ -135,9 +136,8 @@ required:
- compatible
- reg
- interrupts
- '#thermal-sensor-cells'
additionalProperties: false
unevaluatedProperties: false
examples:
- |
......
......@@ -11,6 +11,8 @@ maintainers:
description: Binding for Amlogic Thermal
$ref: thermal-sensor.yaml#
properties:
compatible:
oneOf:
......@@ -44,11 +46,11 @@ required:
- clocks
- amlogic,ao-secure
additionalProperties: false
unevaluatedProperties: false
examples:
- |
cpu_temp: temperature-sensor@ff634800 {
temperature-sensor@ff634800 {
compatible = "amlogic,g12a-cpu-thermal",
"amlogic,g12a-thermal";
reg = <0xff634800 0x50>;
......
......@@ -19,19 +19,19 @@ description: |+
Refer to the bindings described in
Documentation/devicetree/bindings/mfd/syscon.yaml
$ref: thermal-sensor.yaml#
properties:
compatible:
const: brcm,bcm2711-thermal
# See Documentation/devicetree/bindings/thermal/thermal-sensor.yaml for details
"#thermal-sensor-cells":
const: 0
required:
- compatible
- '#thermal-sensor-cells'
additionalProperties: false
unevaluatedProperties: false
examples:
- |
......
......@@ -42,7 +42,6 @@ additionalProperties: false
required:
- compatible
- reg
- "#thermal-sensor-cells"
examples:
- |
......
......@@ -34,7 +34,6 @@ required:
- compatible
- reg
- clocks
- '#thermal-sensor-cells'
examples:
- |
......
......@@ -28,7 +28,6 @@ properties:
required:
- compatible
- '#thermal-sensor-cells'
additionalProperties: false
......
......@@ -15,6 +15,8 @@ description:
sensor resistor. The voltage read across the sensor is mapped to
temperature using voltage-temperature lookup table.
$ref: thermal-sensor.yaml#
properties:
compatible:
const: generic-adc-thermal
......@@ -44,11 +46,10 @@ properties:
required:
- compatible
- '#thermal-sensor-cells'
- io-channels
- io-channel-names
additionalProperties: false
unevaluatedProperties: false
examples:
- |
......
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/thermal/hisilicon,tsensor.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Temperature Sensor on HiSilicon SoCs
maintainers:
- Abdulrasaq Lawani <abdulrasaqolawani@gmail.com>
allOf:
- $ref: thermal-sensor.yaml
properties:
compatible:
enum:
- hisilicon,tsensor
- hisilicon,hi3660-tsensor
reg:
maxItems: 1
clocks:
maxItems: 1
clock-names:
items:
- const: thermal_clk
interrupts:
maxItems: 1
'#thermal-sensor-cells':
const: 1
required:
- compatible
- reg
- interrupts
- '#thermal-sensor-cells'
unevaluatedProperties: false
examples:
- |
#include <dt-bindings/clock/hi6220-clock.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
temperature-sensor@f7030700 {
compatible = "hisilicon,tsensor";
reg = <0xf7030700 0x1000>;
interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&sys_ctrl HI6220_TSENSOR_CLK>;
clock-names = "thermal_clk";
#thermal-sensor-cells = <1>;
};
* Temperature Sensor on hisilicon SoCs
** Required properties :
- compatible: "hisilicon,tsensor".
- reg: physical base address of thermal sensor and length of memory mapped
region.
- interrupt: The interrupt number to the cpu. Defines the interrupt used
by /SOCTHERM/tsensor.
- clock-names: Input clock name, should be 'thermal_clk'.
- clocks: phandles for clock specified in "clock-names" property.
- #thermal-sensor-cells: Should be 1. See Documentation/devicetree/bindings/thermal/thermal-sensor.yaml for a description.
Example :
for Hi6220:
tsensor: tsensor@0,f7030700 {
compatible = "hisilicon,tsensor";
reg = <0x0 0xf7030700 0x0 0x1000>;
interrupts = <0 7 0x4>;
clocks = <&sys_ctrl HI6220_TSENSOR_CLK>;
clock-names = "thermal_clk";
#thermal-sensor-cells = <1>;
}
for Hi3660:
tsensor: tsensor@fff30000 {
compatible = "hisilicon,hi3660-tsensor";
reg = <0x0 0xfff30000 0x0 0x1000>;
interrupts = <GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>;
#thermal-sensor-cells = <1>;
};
......@@ -16,6 +16,8 @@ description: |
for i.MX8MM which has ONLY 1 sensor, v2 is for i.MX8MP which has
2 sensors.
$ref: thermal-sensor.yaml#
properties:
compatible:
oneOf:
......@@ -51,9 +53,8 @@ required:
- compatible
- reg
- clocks
- '#thermal-sensor-cells'
additionalProperties: false
unevaluatedProperties: false
examples:
- |
......
......@@ -38,7 +38,6 @@ required:
- compatible
- reg
- interrupts
- '#thermal-sensor-cells'
if:
properties:
......
......@@ -99,7 +99,6 @@ required:
- resets
- nvmem-cells
- nvmem-cell-names
- "#thermal-sensor-cells"
additionalProperties: false
......
......@@ -197,7 +197,6 @@ required:
- clock-names
- resets
- reset-names
- "#thermal-sensor-cells"
allOf:
- $ref: thermal-sensor.yaml
......
......@@ -20,11 +20,7 @@ description: |
node. See ../firmware/nvidia,tegra186-bpmp.yaml for details of the
BPMP binding.
This node represents a thermal sensor. See
Documentation/devicetree/bindings/thermal/thermal-sensor.yaml
for details of the core thermal binding.
$ref: thermal-sensor.yaml#
properties:
compatible:
......@@ -33,10 +29,6 @@ properties:
- nvidia,tegra194-bpmp-thermal
'#thermal-sensor-cells':
$ref: /schemas/types.yaml#/definitions/uint32
description: Number of cells needed in the phandle specifier to
identify a given sensor. Must be 1 and the single cell specifies
the sensor index.
const: 1
additionalProperties: false
unevaluatedProperties: false
......@@ -27,6 +27,8 @@ description: |
TSENSOR has two channels which monitor two different spots of the SoC.
$ref: thermal-sensor.yaml#
properties:
compatible:
const: nvidia,tegra30-tsensor
......@@ -46,19 +48,14 @@ properties:
"#thermal-sensor-cells":
const: 1
assigned-clock-parents: true
assigned-clock-rates: true
assigned-clocks: true
required:
- compatible
- reg
- clocks
- resets
- interrupts
- "#thermal-sensor-cells"
additionalProperties: false
unevaluatedProperties: false
examples:
- |
......
......@@ -42,7 +42,6 @@ required:
- compatible
- reg
- interrupts
- '#thermal-sensor-cells'
additionalProperties: false
......
......@@ -8,6 +8,8 @@ title: Qualcomm's SPMI PMIC ADC HC Thermal Monitoring
maintainers:
- Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
$ref: thermal-sensor.yaml#
properties:
compatible:
const: qcom,spmi-adc-tm-hc
......@@ -20,9 +22,6 @@ properties:
"#thermal-sensor-cells":
const: 1
description:
Number of cells required to uniquely identify the thermal sensors. Since
we have multiple sensors this is set to 1
"#address-cells":
const: 1
......@@ -106,9 +105,8 @@ required:
- interrupts
- "#address-cells"
- "#size-cells"
- "#thermal-sensor-cells"
additionalProperties: false
unevaluatedProperties: false
examples:
- |
......
......@@ -8,6 +8,8 @@ title: Qualcomm's SPMI PMIC ADC Thermal Monitoring
maintainers:
- Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
$ref: thermal-sensor.yaml#
properties:
compatible:
enum:
......@@ -23,9 +25,6 @@ properties:
"#thermal-sensor-cells":
const: 1
description:
Number of cells required to uniquely identify the thermal sensors. Since
we have multiple sensors this is set to 1
"#address-cells":
const: 1
......@@ -159,9 +158,8 @@ required:
- interrupts
- "#address-cells"
- "#size-cells"
- "#thermal-sensor-cells"
additionalProperties: false
unevaluatedProperties: false
examples:
- |
......
......@@ -67,6 +67,7 @@ properties:
- qcom,sm8450-tsens
- qcom,sm8550-tsens
- qcom,sm8650-tsens
- qcom,x1e80100-tsens
- const: qcom,tsens-v2
- description: v2 of TSENS with combined interrupt
......@@ -217,18 +218,16 @@ properties:
"#thermal-sensor-cells":
const: 1
description:
Number of cells required to uniquely identify the thermal sensors. Since
we have multiple sensors this is set to 1
required:
- compatible
- interrupts
- interrupt-names
- "#thermal-sensor-cells"
- "#qcom,sensors"
allOf:
- $ref: thermal-sensor.yaml#
- if:
properties:
compatible:
......@@ -292,17 +291,12 @@ allOf:
required:
- reg
additionalProperties: false
unevaluatedProperties: false
examples:
- |
#include <dt-bindings/interrupt-controller/arm-gic.h>
// Example msm9860 based SoC (ipq8064):
gcc: clock-controller {
/* ... */
tsens: thermal-sensor {
thermal-sensor {
compatible = "qcom,ipq8064-tsens";
nvmem-cells = <&tsens_calib>, <&tsens_calib_backup>;
......@@ -313,7 +307,6 @@ examples:
#qcom,sensors = <11>;
#thermal-sensor-cells = <1>;
};
};
- |
#include <dt-bindings/interrupt-controller/arm-gic.h>
......
......@@ -9,6 +9,8 @@ title: Thermal Monitoring Unit (TMU) on Freescale QorIQ SoCs
maintainers:
- Anson Huang <Anson.Huang@nxp.com>
$ref: thermal-sensor.yaml#
properties:
compatible:
description: |
......@@ -68,9 +70,8 @@ required:
- interrupts
- fsl,tmu-range
- fsl,tmu-calibration
- '#thermal-sensor-cells'
additionalProperties: false
unevaluatedProperties: false
examples:
- |
......
......@@ -15,6 +15,8 @@ description:
maintainers:
- Niklas Söderlund <niklas.soderlund@ragnatech.se>
$ref: thermal-sensor.yaml#
properties:
compatible:
enum:
......@@ -57,7 +59,6 @@ required:
- clocks
- power-domains
- resets
- "#thermal-sensor-cells"
if:
properties:
......@@ -96,7 +97,7 @@ else:
required:
- interrupts
additionalProperties: false
unevaluatedProperties: false
examples:
- |
......
......@@ -9,6 +9,8 @@ title: Temperature Sensor ADC (TSADC) on Rockchip SoCs
maintainers:
- Heiko Stuebner <heiko@sntech.de>
$ref: thermal-sensor.yaml#
properties:
compatible:
enum:
......@@ -76,9 +78,8 @@ required:
- clocks
- clock-names
- resets
- "#thermal-sensor-cells"
additionalProperties: false
unevaluatedProperties: false
examples:
- |
......
......@@ -13,6 +13,8 @@ description:
maintainers:
- Biju Das <biju.das.jz@bp.renesas.com>
$ref: thermal-sensor.yaml#
properties:
compatible:
items:
......@@ -43,9 +45,8 @@ required:
- clocks
- power-domains
- resets
- "#thermal-sensor-cells"
additionalProperties: false
unevaluatedProperties: false
examples:
- |
......
......@@ -61,7 +61,8 @@ properties:
TRIMINFO at 0x10068000 contains data for TMU channel 2
minItems: 1
'#thermal-sensor-cells': true
'#thermal-sensor-cells':
const: 0
vtmu-supply:
description: The regulator node supplying voltage to TMU.
......
......@@ -14,6 +14,8 @@ description: |
maintainers:
- Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
$ref: thermal-sensor.yaml#
properties:
compatible:
enum:
......@@ -38,9 +40,8 @@ properties:
required:
- compatible
- interrupts
- "#thermal-sensor-cells"
additionalProperties: false
unevaluatedProperties: false
examples:
- |
......
......@@ -11,6 +11,8 @@ maintainers:
- Baolin Wang <baolin.wang7@gmail.com>
- Chunyan Zhang <zhang.lyra@gmail.com>
$ref: thermal-sensor.yaml#
properties:
compatible:
const: sprd,ums512-thermal
......@@ -77,15 +79,14 @@ required:
- clock-names
- nvmem-cells
- nvmem-cell-names
- "#thermal-sensor-cells"
- "#address-cells"
- "#size-cells"
additionalProperties: false
unevaluatedProperties: false
examples:
- |
ap_thm0: thermal@32200000 {
thermal@32200000 {
compatible = "sprd,ums512-thermal";
reg = <0x32200000 0x10000>;
clock-names = "enable";
......
......@@ -9,6 +9,8 @@ title: STMicroelectronics STM32 digital thermal sensor (DTS)
maintainers:
- Pascal Paillet <p.paillet@foss.st.com>
$ref: thermal-sensor.yaml#
properties:
compatible:
const: st,stm32-thermal
......@@ -30,14 +32,13 @@ properties:
const: 0
required:
- "#thermal-sensor-cells"
- compatible
- reg
- interrupts
- clocks
- clock-names
additionalProperties: false
unevaluatedProperties: false
examples:
- |
......
......@@ -49,7 +49,10 @@ properties:
to take when the temperature crosses those thresholds.
patternProperties:
"^[a-zA-Z][a-zA-Z0-9\\-]{1,12}-thermal$":
# Node name is limited in size due to Linux kernel requirements - 19
# characters in total (see THERMAL_NAME_LENGTH, including terminating NUL
# byte):
"^[a-zA-Z][a-zA-Z0-9\\-]{1,10}-thermal$":
type: object
description:
Each thermal zone node contains information about how frequently it
......@@ -229,7 +232,6 @@ patternProperties:
required:
- thermal-sensors
- trips
additionalProperties: false
......
......@@ -9,6 +9,8 @@ title: Texas Instruments AM654 VTM (DTS)
maintainers:
- Keerthy <j-keerthy@ti.com>
$ref: thermal-sensor.yaml#
properties:
compatible:
const: ti,am654-vtm
......@@ -26,9 +28,8 @@ required:
- compatible
- reg
- power-domains
- "#thermal-sensor-cells"
additionalProperties: false
unevaluatedProperties: false
examples:
- |
......
......@@ -22,6 +22,8 @@ description: |
Temp(C) = (-9.2627e-12) * x^4 + (6.0373e-08) * x^3 + \
(-1.7058e-04) * x^2 + (3.2512e-01) * x + (-4.9003e+01)
$ref: thermal-sensor.yaml#
properties:
compatible:
enum:
......@@ -64,9 +66,8 @@ required:
- compatible
- reg
- power-domains
- "#thermal-sensor-cells"
additionalProperties: false
unevaluatedProperties: false
examples:
- |
......
......@@ -19076,8 +19076,8 @@ L: linux-renesas-soc@vger.kernel.org
S: Supported
F: Documentation/devicetree/bindings/thermal/rcar-gen3-thermal.yaml
F: Documentation/devicetree/bindings/thermal/rcar-thermal.yaml
F: drivers/thermal/rcar_gen3_thermal.c
F: drivers/thermal/rcar_thermal.c
F: drivers/thermal/renesas/rcar_gen3_thermal.c
F: drivers/thermal/renesas/rcar_thermal.c
RENESAS RIIC DRIVER
M: Chris Brandt <chris.brandt@renesas.com>
......
......@@ -343,32 +343,6 @@ config ROCKCHIP_THERMAL
trip point. Cpufreq is used as the cooling device and will throttle
CPUs when the Temperature crosses the passive trip point.
config RCAR_THERMAL
tristate "Renesas R-Car thermal driver"
depends on ARCH_RENESAS || COMPILE_TEST
depends on HAS_IOMEM
help
Enable this to plug the R-Car thermal sensor driver into the Linux
thermal framework.
config RCAR_GEN3_THERMAL
tristate "Renesas R-Car Gen3 and RZ/G2 thermal driver"
depends on ARCH_RENESAS || COMPILE_TEST
depends on HAS_IOMEM
depends on OF
help
Enable this to plug the R-Car Gen3 or RZ/G2 thermal sensor driver into
the Linux thermal framework.
config RZG2L_THERMAL
tristate "Renesas RZ/G2L thermal driver"
depends on ARCH_RENESAS || COMPILE_TEST
depends on HAS_IOMEM
depends on OF
help
Enable this to plug the RZ/G2L thermal sensor driver into the Linux
thermal framework.
config KIRKWOOD_THERMAL
tristate "Temperature sensor on Marvell Kirkwood SoCs"
depends on MACH_KIRKWOOD || COMPILE_TEST
......@@ -459,6 +433,8 @@ depends on (ARCH_STI || ARCH_STM32) && OF
source "drivers/thermal/st/Kconfig"
endmenu
source "drivers/thermal/renesas/Kconfig"
source "drivers/thermal/tegra/Kconfig"
config GENERIC_ADC_THERMAL
......
......@@ -38,9 +38,7 @@ obj-$(CONFIG_THERMAL_MMIO) += thermal_mmio.o
obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o
obj-$(CONFIG_SUN8I_THERMAL) += sun8i_thermal.o
obj-$(CONFIG_ROCKCHIP_THERMAL) += rockchip_thermal.o
obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o
obj-$(CONFIG_RCAR_GEN3_THERMAL) += rcar_gen3_thermal.o
obj-$(CONFIG_RZG2L_THERMAL) += rzg2l_thermal.o
obj-y += renesas/
obj-$(CONFIG_KIRKWOOD_THERMAL) += kirkwood_thermal.o
obj-y += samsung/
obj-$(CONFIG_DOVE_THERMAL) += dove_thermal.o
......
......@@ -163,6 +163,7 @@ MODULE_DEVICE_TABLE(of, bcm2835_thermal_of_match_table);
static int bcm2835_thermal_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
const struct of_device_id *match;
struct thermal_zone_device *tz;
struct bcm2835_thermal_data *data;
......@@ -170,12 +171,11 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
u32 val;
unsigned long rate;
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;
match = of_match_device(bcm2835_thermal_of_match_table,
&pdev->dev);
match = of_match_device(bcm2835_thermal_of_match_table, dev);
if (!match)
return -EINVAL;
......@@ -185,34 +185,20 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
return err;
}
data->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(data->clk)) {
err = PTR_ERR(data->clk);
if (err != -EPROBE_DEFER)
dev_err(&pdev->dev, "Could not get clk: %d\n", err);
return err;
}
err = clk_prepare_enable(data->clk);
if (err)
return err;
data->clk = devm_clk_get_enabled(dev, NULL);
if (IS_ERR(data->clk))
return dev_err_probe(dev, PTR_ERR(data->clk), "Could not get clk\n");
rate = clk_get_rate(data->clk);
if ((rate < 1920000) || (rate > 5000000))
dev_warn(&pdev->dev,
dev_warn(dev,
"Clock %pCn running at %lu Hz is outside of the recommended range: 1.92 to 5MHz\n",
data->clk, rate);
/* register of thermal sensor and get info from DT */
tz = devm_thermal_of_zone_register(&pdev->dev, 0, data,
&bcm2835_thermal_ops);
if (IS_ERR(tz)) {
err = PTR_ERR(tz);
dev_err(&pdev->dev,
"Failed to register the thermal device: %d\n",
err);
goto err_clk;
}
tz = devm_thermal_of_zone_register(dev, 0, data, &bcm2835_thermal_ops);
if (IS_ERR(tz))
return dev_err_probe(dev, PTR_ERR(tz), "Failed to register the thermal device\n");
/*
* right now the FW does set up the HW-block, so we are not
......@@ -233,10 +219,8 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
*/
err = thermal_zone_get_trip(tz, 0, &trip);
if (err < 0) {
dev_err(&pdev->dev,
"Not able to read trip_temp: %d\n",
err);
goto err_tz;
dev_err(dev, "Not able to read trip_temp: %d\n", err);
return err;
}
/* set bandgap reference voltage and enable voltage regulator */
......@@ -269,17 +253,11 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
*/
err = thermal_add_hwmon_sysfs(tz);
if (err)
goto err_tz;
return err;
bcm2835_thermal_debugfs(pdev);
return 0;
err_tz:
devm_thermal_of_zone_unregister(&pdev->dev, tz);
err_clk:
clk_disable_unprepare(data->clk);
return err;
}
static void bcm2835_thermal_remove(struct platform_device *pdev)
......@@ -287,7 +265,6 @@ static void bcm2835_thermal_remove(struct platform_device *pdev)
struct bcm2835_thermal_data *data = platform_get_drvdata(pdev);
debugfs_remove_recursive(data->debugfsdir);
clk_disable_unprepare(data->clk);
}
static struct platform_driver bcm2835_thermal_driver = {
......
......@@ -388,15 +388,10 @@ static int hi6220_thermal_probe(struct hisi_thermal_data *data)
{
struct platform_device *pdev = data->pdev;
struct device *dev = &pdev->dev;
int ret;
data->clk = devm_clk_get(dev, "thermal_clk");
if (IS_ERR(data->clk)) {
ret = PTR_ERR(data->clk);
if (ret != -EPROBE_DEFER)
dev_err(dev, "failed to get thermal clk: %d\n", ret);
return ret;
}
if (IS_ERR(data->clk))
return dev_err_probe(dev, PTR_ERR(data->clk), "failed to get thermal clk\n");
data->sensor = devm_kzalloc(dev, sizeof(*data->sensor), GFP_KERNEL);
if (!data->sensor)
......
......@@ -601,28 +601,29 @@ static inline void imx_thermal_unregister_legacy_cooling(struct imx_thermal_data
static int imx_thermal_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct imx_thermal_data *data;
struct regmap *map;
int measure_freq;
int ret;
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;
data->dev = &pdev->dev;
data->dev = dev;
map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "fsl,tempmon");
map = syscon_regmap_lookup_by_phandle(dev->of_node, "fsl,tempmon");
if (IS_ERR(map)) {
ret = PTR_ERR(map);
dev_err(&pdev->dev, "failed to get tempmon regmap: %d\n", ret);
dev_err(dev, "failed to get tempmon regmap: %d\n", ret);
return ret;
}
data->tempmon = map;
data->socdata = of_device_get_match_data(&pdev->dev);
data->socdata = of_device_get_match_data(dev);
if (!data->socdata) {
dev_err(&pdev->dev, "no device match found\n");
dev_err(dev, "no device match found\n");
return -ENODEV;
}
......@@ -645,15 +646,15 @@ static int imx_thermal_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, data);
if (of_property_present(pdev->dev.of_node, "nvmem-cells")) {
if (of_property_present(dev->of_node, "nvmem-cells")) {
ret = imx_init_from_nvmem_cells(pdev);
if (ret)
return dev_err_probe(&pdev->dev, ret,
return dev_err_probe(dev, ret,
"failed to init from nvmem\n");
} else {
ret = imx_init_from_tempmon_data(pdev);
if (ret) {
dev_err(&pdev->dev, "failed to init from fsl,tempmon-data\n");
dev_err(dev, "failed to init from fsl,tempmon-data\n");
return ret;
}
}
......@@ -673,15 +674,12 @@ static int imx_thermal_probe(struct platform_device *pdev)
ret = imx_thermal_register_legacy_cooling(data);
if (ret)
return dev_err_probe(&pdev->dev, ret,
return dev_err_probe(dev, ret,
"failed to register cpufreq cooling device\n");
data->thermal_clk = devm_clk_get(&pdev->dev, NULL);
data->thermal_clk = devm_clk_get(dev, NULL);
if (IS_ERR(data->thermal_clk)) {
ret = PTR_ERR(data->thermal_clk);
if (ret != -EPROBE_DEFER)
dev_err(&pdev->dev,
"failed to get thermal clk: %d\n", ret);
ret = dev_err_probe(dev, PTR_ERR(data->thermal_clk), "failed to get thermal clk\n");
goto legacy_cleanup;
}
......@@ -694,7 +692,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
*/
ret = clk_prepare_enable(data->thermal_clk);
if (ret) {
dev_err(&pdev->dev, "failed to enable thermal clk: %d\n", ret);
dev_err(dev, "failed to enable thermal clk: %d\n", ret);
goto legacy_cleanup;
}
......@@ -707,12 +705,12 @@ static int imx_thermal_probe(struct platform_device *pdev)
IMX_POLLING_DELAY);
if (IS_ERR(data->tz)) {
ret = PTR_ERR(data->tz);
dev_err(&pdev->dev,
"failed to register thermal zone device %d\n", ret);
dev_err(dev, "failed to register thermal zone device %d\n",
ret);
goto clk_disable;
}
dev_info(&pdev->dev, "%s CPU temperature grade - max:%dC"
dev_info(dev, "%s CPU temperature grade - max:%dC"
" critical:%dC passive:%dC\n", data->temp_grade,
data->temp_max / 1000, trips[IMX_TRIP_CRITICAL].temperature / 1000,
trips[IMX_TRIP_PASSIVE].temperature / 1000);
......@@ -736,7 +734,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
usleep_range(20, 50);
/* the core was configured and enabled just before */
pm_runtime_set_active(&pdev->dev);
pm_runtime_set_active(dev);
pm_runtime_enable(data->dev);
ret = pm_runtime_resume_and_get(data->dev);
......@@ -748,11 +746,11 @@ static int imx_thermal_probe(struct platform_device *pdev)
if (ret)
goto thermal_zone_unregister;
ret = devm_request_threaded_irq(&pdev->dev, data->irq,
ret = devm_request_threaded_irq(dev, data->irq,
imx_thermal_alarm_irq, imx_thermal_alarm_irq_thread,
0, "imx_thermal", data);
if (ret < 0) {
dev_err(&pdev->dev, "failed to request alarm irq: %d\n", ret);
dev_err(dev, "failed to request alarm irq: %d\n", ret);
goto thermal_zone_unregister;
}
......
......@@ -178,6 +178,7 @@ struct k3_j72xx_bandgap {
void __iomem *base;
void __iomem *cfg2_base;
struct k3_thermal_data *ts_data[K3_VTM_MAX_NUM_TS];
int cnt;
};
/* common data structures */
......@@ -338,24 +339,52 @@ static void print_look_up_table(struct device *dev, int *ref_table)
dev_dbg(dev, "%d %d %d\n", i, derived_table[i], ref_table[i]);
}
static void k3_j72xx_bandgap_init_hw(struct k3_j72xx_bandgap *bgp)
{
struct k3_thermal_data *data;
int id, high_max, low_temp;
u32 val;
for (id = 0; id < bgp->cnt; id++) {
data = bgp->ts_data[id];
val = readl(bgp->cfg2_base + data->ctrl_offset);
val |= (K3_VTM_TMPSENS_CTRL_MAXT_OUTRG_EN |
K3_VTM_TMPSENS_CTRL_SOC |
K3_VTM_TMPSENS_CTRL_CLRZ | BIT(4));
writel(val, bgp->cfg2_base + data->ctrl_offset);
}
/*
* Program TSHUT thresholds
* Step 1: set the thresholds to ~123C and 105C WKUP_VTM_MISC_CTRL2
* Step 2: WKUP_VTM_TMPSENS_CTRL_j set the MAXT_OUTRG_EN bit
* This is already taken care as per of init
* Step 3: WKUP_VTM_MISC_CTRL set the ANYMAXT_OUTRG_ALERT_EN bit
*/
high_max = k3_j72xx_bandgap_temp_to_adc_code(MAX_TEMP);
low_temp = k3_j72xx_bandgap_temp_to_adc_code(COOL_DOWN_TEMP);
writel((low_temp << 16) | high_max, bgp->cfg2_base + K3_VTM_MISC_CTRL2_OFFSET);
writel(K3_VTM_ANYMAXT_OUTRG_ALERT_EN, bgp->cfg2_base + K3_VTM_MISC_CTRL_OFFSET);
}
struct k3_j72xx_bandgap_data {
const bool has_errata_i2128;
};
static int k3_j72xx_bandgap_probe(struct platform_device *pdev)
{
int ret = 0, cnt, val, id;
int high_max, low_temp;
struct resource *res;
const struct k3_j72xx_bandgap_data *driver_data;
struct thermal_zone_device *ti_thermal;
struct device *dev = &pdev->dev;
bool workaround_needed = false;
struct k3_j72xx_bandgap *bgp;
struct k3_thermal_data *data;
bool workaround_needed = false;
const struct k3_j72xx_bandgap_data *driver_data;
struct thermal_zone_device *ti_thermal;
int *ref_table;
struct err_values err_vals;
void __iomem *fuse_base;
int ret = 0, val, id;
struct resource *res;
int *ref_table;
const s64 golden_factors[] = {
-490019999999999936,
......@@ -422,10 +451,10 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev)
/* Get the sensor count in the VTM */
val = readl(bgp->base + K3_VTM_DEVINFO_PWR0_OFFSET);
cnt = val & K3_VTM_DEVINFO_PWR0_TEMPSENS_CT_MASK;
cnt >>= __ffs(K3_VTM_DEVINFO_PWR0_TEMPSENS_CT_MASK);
bgp->cnt = val & K3_VTM_DEVINFO_PWR0_TEMPSENS_CT_MASK;
bgp->cnt >>= __ffs(K3_VTM_DEVINFO_PWR0_TEMPSENS_CT_MASK);
data = devm_kcalloc(bgp->dev, cnt, sizeof(*data), GFP_KERNEL);
data = devm_kcalloc(bgp->dev, bgp->cnt, sizeof(*data), GFP_KERNEL);
if (!data) {
ret = -ENOMEM;
goto err_alloc;
......@@ -449,8 +478,8 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev)
else
init_table(3, ref_table, pvt_wa_factors);
/* Register the thermal sensors */
for (id = 0; id < cnt; id++) {
/* Precompute the derived table & fill each thermal sensor struct */
for (id = 0; id < bgp->cnt; id++) {
data[id].bgp = bgp;
data[id].ctrl_offset = K3_VTM_TMPSENS0_CTRL_OFFSET + id * 0x20;
data[id].stat_offset = data[id].ctrl_offset +
......@@ -470,13 +499,13 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev)
else if (id == 0 && !workaround_needed)
memcpy(derived_table, ref_table, TABLE_SIZE * 4);
val = readl(data[id].bgp->cfg2_base + data[id].ctrl_offset);
val |= (K3_VTM_TMPSENS_CTRL_MAXT_OUTRG_EN |
K3_VTM_TMPSENS_CTRL_SOC |
K3_VTM_TMPSENS_CTRL_CLRZ | BIT(4));
writel(val, data[id].bgp->cfg2_base + data[id].ctrl_offset);
bgp->ts_data[id] = &data[id];
}
k3_j72xx_bandgap_init_hw(bgp);
/* Register the thermal sensors */
for (id = 0; id < bgp->cnt; id++) {
ti_thermal = devm_thermal_of_zone_register(bgp->dev, id, &data[id],
&k3_of_thermal_ops);
if (IS_ERR(ti_thermal)) {
......@@ -486,21 +515,7 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev)
}
}
/*
* Program TSHUT thresholds
* Step 1: set the thresholds to ~123C and 105C WKUP_VTM_MISC_CTRL2
* Step 2: WKUP_VTM_TMPSENS_CTRL_j set the MAXT_OUTRG_EN bit
* This is already taken care as per of init
* Step 3: WKUP_VTM_MISC_CTRL set the ANYMAXT_OUTRG_ALERT_EN bit
*/
high_max = k3_j72xx_bandgap_temp_to_adc_code(MAX_TEMP);
low_temp = k3_j72xx_bandgap_temp_to_adc_code(COOL_DOWN_TEMP);
writel((low_temp << 16) | high_max, data[0].bgp->cfg2_base +
K3_VTM_MISC_CTRL2_OFFSET);
mdelay(100);
writel(K3_VTM_ANYMAXT_OUTRG_ALERT_EN, data[0].bgp->cfg2_base +
K3_VTM_MISC_CTRL_OFFSET);
platform_set_drvdata(pdev, bgp);
print_look_up_table(dev, ref_table);
/*
......@@ -527,6 +542,35 @@ static void k3_j72xx_bandgap_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
}
static int k3_j72xx_bandgap_suspend(struct device *dev)
{
pm_runtime_put_sync(dev);
pm_runtime_disable(dev);
return 0;
}
static int k3_j72xx_bandgap_resume(struct device *dev)
{
struct k3_j72xx_bandgap *bgp = dev_get_drvdata(dev);
int ret;
pm_runtime_enable(dev);
ret = pm_runtime_get_sync(dev);
if (ret < 0) {
pm_runtime_put_noidle(dev);
pm_runtime_disable(dev);
return ret;
}
k3_j72xx_bandgap_init_hw(bgp);
return 0;
}
static DEFINE_SIMPLE_DEV_PM_OPS(k3_j72xx_bandgap_pm_ops,
k3_j72xx_bandgap_suspend,
k3_j72xx_bandgap_resume);
static const struct k3_j72xx_bandgap_data k3_j72xx_bandgap_j721e_data = {
.has_errata_i2128 = true,
};
......@@ -554,6 +598,7 @@ static struct platform_driver k3_j72xx_bandgap_sensor_driver = {
.driver = {
.name = "k3-j72xx-soc-thermal",
.of_match_table = of_k3_j72xx_bandgap_match,
.pm = pm_sleep_ptr(&k3_j72xx_bandgap_pm_ops),
},
};
......
......@@ -128,6 +128,7 @@ struct lvts_data {
int temp_factor;
int temp_offset;
int gt_calib_bit_offset;
unsigned int def_calibration;
};
struct lvts_sensor {
......@@ -689,6 +690,10 @@ static int lvts_calibration_init(struct device *dev, struct lvts_ctrl *lvts_ctrl
size_t calib_len)
{
int i;
u32 gt;
/* A zero value for gt means that device has invalid efuse data */
gt = (((u32 *)efuse_calibration)[0] >> lvts_ctrl->lvts_data->gt_calib_bit_offset) & 0xff;
lvts_for_each_valid_sensor(i, lvts_ctrl_data) {
const struct lvts_sensor_data *sensor =
......@@ -699,10 +704,17 @@ static int lvts_calibration_init(struct device *dev, struct lvts_ctrl *lvts_ctrl
sensor->cal_offsets[2] >= calib_len)
return -EINVAL;
if (gt) {
lvts_ctrl->calibration[i] =
(efuse_calibration[sensor->cal_offsets[0]] << 0) +
(efuse_calibration[sensor->cal_offsets[1]] << 8) +
(efuse_calibration[sensor->cal_offsets[2]] << 16);
} else if (lvts_ctrl->lvts_data->def_calibration) {
lvts_ctrl->calibration[i] = lvts_ctrl->lvts_data->def_calibration;
} else {
dev_err(dev, "efuse contains invalid calibration data and no default given.\n");
return -ENODATA;
}
}
return 0;
......@@ -770,14 +782,13 @@ static int lvts_golden_temp_init(struct device *dev, u8 *calib,
gt = (((u32 *)calib)[0] >> lvts_data->gt_calib_bit_offset) & 0xff;
/* A zero value for gt means that device has invalid efuse data */
if (!gt)
return -ENODATA;
if (gt < LVTS_GOLDEN_TEMP_MAX)
if (gt && gt < LVTS_GOLDEN_TEMP_MAX)
golden_temp = gt;
golden_temp_offset = golden_temp * 500 + lvts_data->temp_offset;
dev_info(dev, "%sgolden temp=%d\n", gt ? "" : "fake ", golden_temp);
return 0;
}
......@@ -1440,7 +1451,7 @@ static const struct lvts_ctrl_data mt8186_lvts_data_ctrl[] = {
.cal_offsets = { 29, 30, 31 } },
{ .dt_id = MT8186_ADSP,
.cal_offsets = { 34, 35, 28 } },
{ .dt_id = MT8186_MFG,
{ .dt_id = MT8186_GPU,
.cal_offsets = { 39, 32, 33 } }
},
VALID_SENSOR_MAP(1, 1, 1, 0),
......@@ -1488,11 +1499,11 @@ static const struct lvts_ctrl_data mt8188_lvts_ap_data_ctrl[] = {
},
{
.lvts_sensor = {
{ .dt_id = MT8188_AP_GPU1,
{ .dt_id = MT8188_AP_GPU0,
.cal_offsets = { 43, 44, 45 } },
{ .dt_id = MT8188_AP_GPU2,
{ .dt_id = MT8188_AP_GPU1,
.cal_offsets = { 46, 47, 48 } },
{ .dt_id = MT8188_AP_SOC1,
{ .dt_id = MT8188_AP_ADSP,
.cal_offsets = { 49, 50, 51 } },
},
VALID_SENSOR_MAP(1, 1, 1, 0),
......@@ -1500,9 +1511,9 @@ static const struct lvts_ctrl_data mt8188_lvts_ap_data_ctrl[] = {
},
{
.lvts_sensor = {
{ .dt_id = MT8188_AP_SOC2,
{ .dt_id = MT8188_AP_VDO,
.cal_offsets = { 52, 53, 54 } },
{ .dt_id = MT8188_AP_SOC3,
{ .dt_id = MT8188_AP_INFRA,
.cal_offsets = { 55, 56, 57 } },
},
VALID_SENSOR_MAP(1, 1, 0, 0),
......@@ -1701,6 +1712,7 @@ static const struct lvts_data mt8186_lvts_data = {
.temp_factor = LVTS_COEFF_A_MT7988,
.temp_offset = LVTS_COEFF_B_MT7988,
.gt_calib_bit_offset = 24,
.def_calibration = 19000,
};
static const struct lvts_data mt8188_lvts_mcu_data = {
......@@ -1709,6 +1721,7 @@ static const struct lvts_data mt8188_lvts_mcu_data = {
.temp_factor = LVTS_COEFF_A_MT8195,
.temp_offset = LVTS_COEFF_B_MT8195,
.gt_calib_bit_offset = 20,
.def_calibration = 35000,
};
static const struct lvts_data mt8188_lvts_ap_data = {
......@@ -1717,6 +1730,7 @@ static const struct lvts_data mt8188_lvts_ap_data = {
.temp_factor = LVTS_COEFF_A_MT8195,
.temp_offset = LVTS_COEFF_B_MT8195,
.gt_calib_bit_offset = 20,
.def_calibration = 35000,
};
static const struct lvts_data mt8192_lvts_mcu_data = {
......@@ -1725,6 +1739,7 @@ static const struct lvts_data mt8192_lvts_mcu_data = {
.temp_factor = LVTS_COEFF_A_MT8195,
.temp_offset = LVTS_COEFF_B_MT8195,
.gt_calib_bit_offset = 24,
.def_calibration = 35000,
};
static const struct lvts_data mt8192_lvts_ap_data = {
......@@ -1733,6 +1748,7 @@ static const struct lvts_data mt8192_lvts_ap_data = {
.temp_factor = LVTS_COEFF_A_MT8195,
.temp_offset = LVTS_COEFF_B_MT8195,
.gt_calib_bit_offset = 24,
.def_calibration = 35000,
};
static const struct lvts_data mt8195_lvts_mcu_data = {
......@@ -1741,6 +1757,7 @@ static const struct lvts_data mt8195_lvts_mcu_data = {
.temp_factor = LVTS_COEFF_A_MT8195,
.temp_offset = LVTS_COEFF_B_MT8195,
.gt_calib_bit_offset = 24,
.def_calibration = 35000,
};
static const struct lvts_data mt8195_lvts_ap_data = {
......@@ -1749,6 +1766,7 @@ static const struct lvts_data mt8195_lvts_ap_data = {
.temp_factor = LVTS_COEFF_A_MT8195,
.temp_offset = LVTS_COEFF_B_MT8195,
.gt_calib_bit_offset = 24,
.def_calibration = 35000,
};
static const struct of_device_id lvts_of_match[] = {
......
......@@ -829,12 +829,9 @@ static int adc_tm5_get_dt_channel_data(struct adc_tm5_chip *adc_tm,
channel->iio = devm_fwnode_iio_channel_get_by_name(adc_tm->dev,
of_fwnode_handle(node), NULL);
if (IS_ERR(channel->iio)) {
ret = PTR_ERR(channel->iio);
if (ret != -EPROBE_DEFER)
dev_err(dev, "%s: error getting channel: %d\n", name, ret);
return ret;
}
if (IS_ERR(channel->iio))
return dev_err_probe(dev, PTR_ERR(channel->iio), "%s: error getting channel\n",
name);
ret = of_property_read_u32_array(node, "qcom,pre-scaling", varr, 2);
if (!ret) {
......
......@@ -1336,11 +1336,9 @@ static int tsens_probe(struct platform_device *pdev)
if (priv->ops->calibrate) {
ret = priv->ops->calibrate(priv);
if (ret < 0) {
if (ret != -EPROBE_DEFER)
dev_err(dev, "%s: calibration failed\n", __func__);
return ret;
}
if (ret < 0)
return dev_err_probe(dev, ret, "%s: calibration failed\n",
__func__);
}
ret = tsens_register(priv);
......
# SPDX-License-Identifier: GPL-2.0-only
config RCAR_THERMAL
tristate "Renesas R-Car thermal driver"
depends on ARCH_RENESAS || COMPILE_TEST
depends on HAS_IOMEM
depends on OF
help
Enable this to plug the R-Car thermal sensor driver into the Linux
thermal framework.
config RCAR_GEN3_THERMAL
tristate "Renesas R-Car Gen3 and RZ/G2 thermal driver"
depends on ARCH_RENESAS || COMPILE_TEST
depends on HAS_IOMEM
depends on OF
help
Enable this to plug the R-Car Gen3 or RZ/G2 thermal sensor driver into
the Linux thermal framework.
config RZG2L_THERMAL
tristate "Renesas RZ/G2L thermal driver"
depends on ARCH_RENESAS || COMPILE_TEST
depends on HAS_IOMEM
depends on OF
help
Enable this to plug the RZ/G2L thermal sensor driver into the Linux
thermal framework.
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_RCAR_GEN3_THERMAL) += rcar_gen3_thermal.o
obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o
obj-$(CONFIG_RZG2L_THERMAL) += rzg2l_thermal.o
......@@ -16,7 +16,7 @@
#include <linux/pm_runtime.h>
#include <linux/thermal.h>
#include "thermal_hwmon.h"
#include "../thermal_hwmon.h"
/* Register offsets */
#define REG_GEN3_IRQSTR 0x04
......
......@@ -19,7 +19,7 @@
#include <linux/spinlock.h>
#include <linux/thermal.h>
#include "thermal_hwmon.h"
#include "../thermal_hwmon.h"
#define IDLE_INTERVAL 5000
......
......@@ -17,7 +17,7 @@
#include <linux/thermal.h>
#include <linux/units.h>
#include "thermal_hwmon.h"
#include "../thermal_hwmon.h"
#define CTEMP_MASK 0xFFF
......
......@@ -1004,11 +1004,11 @@ static const struct thermal_zone_device_ops exynos_sensor_ops = {
static int exynos_tmu_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct exynos_tmu_data *data;
int ret;
data = devm_kzalloc(&pdev->dev, sizeof(struct exynos_tmu_data),
GFP_KERNEL);
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;
......@@ -1020,7 +1020,7 @@ static int exynos_tmu_probe(struct platform_device *pdev)
* TODO: Add regulator as an SOC feature, so that regulator enable
* is a compulsory call.
*/
ret = devm_regulator_get_enable_optional(&pdev->dev, "vtmu");
ret = devm_regulator_get_enable_optional(dev, "vtmu");
switch (ret) {
case 0:
case -ENODEV:
......@@ -1028,8 +1028,7 @@ static int exynos_tmu_probe(struct platform_device *pdev)
case -EPROBE_DEFER:
return -EPROBE_DEFER;
default:
dev_err(&pdev->dev, "Failed to get enabled regulator: %d\n",
ret);
dev_err(dev, "Failed to get enabled regulator: %d\n", ret);
return ret;
}
......@@ -1037,44 +1036,40 @@ static int exynos_tmu_probe(struct platform_device *pdev)
if (ret)
return ret;
data->clk = devm_clk_get(&pdev->dev, "tmu_apbif");
if (IS_ERR(data->clk)) {
dev_err(&pdev->dev, "Failed to get clock\n");
return PTR_ERR(data->clk);
}
data->clk = devm_clk_get(dev, "tmu_apbif");
if (IS_ERR(data->clk))
return dev_err_probe(dev, PTR_ERR(data->clk), "Failed to get clock\n");
data->clk_sec = devm_clk_get(&pdev->dev, "tmu_triminfo_apbif");
data->clk_sec = devm_clk_get(dev, "tmu_triminfo_apbif");
if (IS_ERR(data->clk_sec)) {
if (data->soc == SOC_ARCH_EXYNOS5420_TRIMINFO) {
dev_err(&pdev->dev, "Failed to get triminfo clock\n");
return PTR_ERR(data->clk_sec);
}
if (data->soc == SOC_ARCH_EXYNOS5420_TRIMINFO)
return dev_err_probe(dev, PTR_ERR(data->clk_sec),
"Failed to get triminfo clock\n");
} else {
ret = clk_prepare(data->clk_sec);
if (ret) {
dev_err(&pdev->dev, "Failed to get clock\n");
dev_err(dev, "Failed to get clock\n");
return ret;
}
}
ret = clk_prepare(data->clk);
if (ret) {
dev_err(&pdev->dev, "Failed to get clock\n");
dev_err(dev, "Failed to get clock\n");
goto err_clk_sec;
}
switch (data->soc) {
case SOC_ARCH_EXYNOS5433:
case SOC_ARCH_EXYNOS7:
data->sclk = devm_clk_get(&pdev->dev, "tmu_sclk");
data->sclk = devm_clk_get(dev, "tmu_sclk");
if (IS_ERR(data->sclk)) {
dev_err(&pdev->dev, "Failed to get sclk\n");
ret = PTR_ERR(data->sclk);
ret = dev_err_probe(dev, PTR_ERR(data->sclk), "Failed to get sclk\n");
goto err_clk;
} else {
ret = clk_prepare_enable(data->sclk);
if (ret) {
dev_err(&pdev->dev, "Failed to enable sclk\n");
dev_err(dev, "Failed to enable sclk\n");
goto err_clk;
}
}
......@@ -1085,33 +1080,30 @@ static int exynos_tmu_probe(struct platform_device *pdev)
ret = exynos_tmu_initialize(pdev);
if (ret) {
dev_err(&pdev->dev, "Failed to initialize TMU\n");
dev_err(dev, "Failed to initialize TMU\n");
goto err_sclk;
}
data->tzd = devm_thermal_of_zone_register(&pdev->dev, 0, data,
data->tzd = devm_thermal_of_zone_register(dev, 0, data,
&exynos_sensor_ops);
if (IS_ERR(data->tzd)) {
ret = PTR_ERR(data->tzd);
if (ret != -EPROBE_DEFER)
dev_err(&pdev->dev, "Failed to register sensor: %d\n",
ret);
ret = dev_err_probe(dev, PTR_ERR(data->tzd), "Failed to register sensor\n");
goto err_sclk;
}
ret = exynos_thermal_zone_configure(pdev);
if (ret) {
dev_err(&pdev->dev, "Failed to configure the thermal zone\n");
dev_err(dev, "Failed to configure the thermal zone\n");
goto err_sclk;
}
ret = devm_request_threaded_irq(&pdev->dev, data->irq, NULL,
ret = devm_request_threaded_irq(dev, data->irq, NULL,
exynos_tmu_threaded_irq,
IRQF_TRIGGER_RISING
| IRQF_SHARED | IRQF_ONESHOT,
dev_name(&pdev->dev), data);
dev_name(dev), data);
if (ret) {
dev_err(&pdev->dev, "Failed to request irq: %d\n", data->irq);
dev_err(dev, "Failed to request irq: %d\n", data->irq);
goto err_sclk;
}
......
......@@ -142,15 +142,6 @@ static const struct st_thermal_sensor_ops st_mmap_sensor_ops = {
.enable_irq = st_mmap_enable_irq,
};
/* Compatible device data stih416 mpe thermal sensor */
static const struct st_thermal_compat_data st_416mpe_cdata = {
.reg_fields = st_mmap_thermal_regfields,
.ops = &st_mmap_sensor_ops,
.calibration_val = 14,
.temp_adjust_val = -95,
.crit_temp = 120,
};
/* Compatible device data stih407 thermal sensor */
static const struct st_thermal_compat_data st_407_cdata = {
.reg_fields = st_mmap_thermal_regfields,
......@@ -161,7 +152,6 @@ static const struct st_thermal_compat_data st_407_cdata = {
};
static const struct of_device_id st_mmap_thermal_of_match[] = {
{ .compatible = "st,stih416-mpe-thermal", .data = &st_416mpe_cdata },
{ .compatible = "st,stih407-thermal", .data = &st_407_cdata },
{ /* sentinel */ }
};
......
......@@ -117,44 +117,41 @@ static int gadc_thermal_read_linear_lookup_table(struct device *dev,
static int gadc_thermal_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct gadc_thermal_info *gti;
int ret;
if (!pdev->dev.of_node) {
dev_err(&pdev->dev, "Only DT based supported\n");
if (!dev->of_node) {
dev_err(dev, "Only DT based supported\n");
return -ENODEV;
}
gti = devm_kzalloc(&pdev->dev, sizeof(*gti), GFP_KERNEL);
gti = devm_kzalloc(dev, sizeof(*gti), GFP_KERNEL);
if (!gti)
return -ENOMEM;
gti->channel = devm_iio_channel_get(&pdev->dev, "sensor-channel");
if (IS_ERR(gti->channel)) {
ret = PTR_ERR(gti->channel);
if (ret != -EPROBE_DEFER)
dev_err(&pdev->dev, "IIO channel not found: %d\n", ret);
return ret;
}
gti->channel = devm_iio_channel_get(dev, "sensor-channel");
if (IS_ERR(gti->channel))
return dev_err_probe(dev, PTR_ERR(gti->channel), "IIO channel not found\n");
ret = gadc_thermal_read_linear_lookup_table(&pdev->dev, gti);
ret = gadc_thermal_read_linear_lookup_table(dev, gti);
if (ret < 0)
return ret;
gti->dev = &pdev->dev;
gti->dev = dev;
gti->tz_dev = devm_thermal_of_zone_register(&pdev->dev, 0, gti,
gti->tz_dev = devm_thermal_of_zone_register(dev, 0, gti,
&gadc_thermal_ops);
if (IS_ERR(gti->tz_dev)) {
ret = PTR_ERR(gti->tz_dev);
if (ret != -EPROBE_DEFER)
dev_err(&pdev->dev,
dev_err(dev,
"Thermal zone sensor register failed: %d\n",
ret);
return ret;
}
devm_thermal_add_hwmon_sysfs(&pdev->dev, gti->tz_dev);
devm_thermal_add_hwmon_sysfs(dev, gti->tz_dev);
return 0;
}
......
......@@ -24,7 +24,7 @@
#define MT8186_BIG_CPU1 5
#define MT8186_NNA 6
#define MT8186_ADSP 7
#define MT8186_MFG 8
#define MT8186_GPU 8
#define MT8188_MCU_LITTLE_CPU0 0
#define MT8188_MCU_LITTLE_CPU1 1
......@@ -34,11 +34,11 @@
#define MT8188_MCU_BIG_CPU1 5
#define MT8188_AP_APU 0
#define MT8188_AP_GPU1 1
#define MT8188_AP_GPU2 2
#define MT8188_AP_SOC1 3
#define MT8188_AP_SOC2 4
#define MT8188_AP_SOC3 5
#define MT8188_AP_GPU0 1
#define MT8188_AP_GPU1 2
#define MT8188_AP_ADSP 3
#define MT8188_AP_VDO 4
#define MT8188_AP_INFRA 5
#define MT8188_AP_CAM1 6
#define MT8188_AP_CAM2 7
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment