Message ID | cover.1549525708.git.amit.kucheria@linaro.org |
---|---|
Headers | show |
Series | thermal: tsens: Refactor to use regmap_field | expand |
On Thu, Feb 07, 2019 at 04:19:31PM +0530, Amit Kucheria wrote: > On some TSENS IP, version is stored. Print that version at init. > > Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org> > --- > drivers/thermal/qcom/tsens-common.c | 23 ++++++++++++++++++++++- > 1 file changed, 22 insertions(+), 1 deletion(-) > > diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c > index aae3d71d7eed..39cd5733fd44 100644 > --- a/drivers/thermal/qcom/tsens-common.c > +++ b/drivers/thermal/qcom/tsens-common.c > @@ -121,7 +121,7 @@ int __init init_common(struct tsens_priv *priv) > void __iomem *tm_base, *srot_base; > struct device *dev = priv->dev; > struct resource *res; > - u32 enabled; > + u32 enabled, maj_ver, min_ver; > int ret, i, j; > struct platform_device *op = of_find_device_by_node(priv->dev->of_node); > > @@ -155,6 +155,27 @@ int __init init_common(struct tsens_priv *priv) > if (IS_ERR(priv->tm_map)) > return PTR_ERR(priv->tm_map); > > + for (i = 0; i < MAX_REGFIELDS; i++) { > + priv->rf[i] = NULL; > + } > + > + /* alloc regmap_fields in srot_map */ > + if (priv->feat->ver_info) { > + for (i = 0, j = VER_MAJOR; i < 2; i++, j++) { > + priv->rf[j] = devm_regmap_field_alloc(dev, priv->srot_map, > + priv->fields[j]); > + if (IS_ERR(priv->rf[j])) > + return PTR_ERR(priv->rf[j]); > + } > + ret = regmap_field_read(priv->rf[VER_MAJOR], &maj_ver); > + if (ret) > + return ret; > + ret = regmap_field_read(priv->rf[VER_MINOR], &min_ver); > + if (ret) > + return ret; > + dev_info(dev, "version: %d.%d\n", maj_ver, min_ver); Is this really needed? Printing stuff into kernel log during boot can just add a lot of info that ends up just slowing down things. Besides, if this info is important shouldnt be available somewhere else as the kernel log is a circular buffer and eventually that line will get wrapped up? > + } > + > priv->rf[TSENS_EN] = devm_regmap_field_alloc(dev, priv->srot_map, > priv->fields[TSENS_EN]); > if (IS_ERR(priv->rf[TSENS_EN])) > -- > 2.17.1 >
On Wed, Feb 20, 2019 at 6:39 AM Eduardo Valentin <edubezval@gmail.com> wrote: > > On Thu, Feb 07, 2019 at 04:19:41PM +0530, Amit Kucheria wrote: > > qcs404 has 10 sensors connected to the single TSENS IP. Define a thermal > > zone for each of those sensors to expose the temperature of each zone. > > > > Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org> > > --- > > arch/arm64/boot/dts/qcom/qcs404.dtsi | 243 +++++++++++++++++++++++++++ > > 1 file changed, 243 insertions(+) > > > > diff --git a/arch/arm64/boot/dts/qcom/qcs404.dtsi b/arch/arm64/boot/dts/qcom/qcs404.dtsi > > index 57d14d8f0c90..ca99c45864df 100644 > > --- a/arch/arm64/boot/dts/qcom/qcs404.dtsi > > +++ b/arch/arm64/boot/dts/qcom/qcs404.dtsi > > @@ -3,6 +3,7 @@ > > > > #include <dt-bindings/interrupt-controller/arm-gic.h> > > #include <dt-bindings/clock/qcom,gcc-qcs404.h> > > +#include <dt-bindings/thermal/thermal.h> > > > > / { > > interrupt-parent = <&intc>; > > @@ -30,6 +31,7 @@ > > reg = <0x100>; > > enable-method = "psci"; > > next-level-cache = <&L2_0>; > > + #cooling-cells= <2>; > > }; > > > > CPU1: cpu@101 { > > @@ -38,6 +40,7 @@ > > reg = <0x101>; > > enable-method = "psci"; > > next-level-cache = <&L2_0>; > > + #cooling-cells= <2>; > > }; > > > > CPU2: cpu@102 { > > @@ -46,6 +49,7 @@ > > reg = <0x102>; > > enable-method = "psci"; > > next-level-cache = <&L2_0>; > > + #cooling-cells= <2>; > > }; > > > > CPU3: cpu@103 { > > @@ -54,6 +58,7 @@ > > reg = <0x103>; > > enable-method = "psci"; > > next-level-cache = <&L2_0>; > > + #cooling-cells= <2>; > > }; > > > > L2_0: l2-cache { > > @@ -507,4 +512,242 @@ > > #interrupt-cells = <2>; > > }; > > }; > > + > > + thermal-zones { > > There are several zones with passive trips and no cooling maps. Indeed. The policy bits are still a WIP and in some cases the throttling is handled by someone in userspace. But I'd like to expose at least the temperatures at each of the sensors to make it easier for others to use this information. See my reply to the cover letter. Regards, Amit > > + aoss-thermal { > > + polling-delay-passive = <250>; > > + polling-delay = <1000>; > > + > > + thermal-sensors = <&tsens 0>; > > + > > + trips { > > + aoss_alert0: trip-point@0 { > > + temperature = <95000>; > > + hysteresis = <2000>; > > + type = "passive"; > > + }; > > + aoss_crit: aoss_crit { > > + temperature = <110000>; > > + hysteresis = <2000>; > > + type = "critical"; > > + }; > > + }; > > + }; > > + > > + dsp-thermal { > > + polling-delay-passive = <250>; > > + polling-delay = <1000>; > > + > > + thermal-sensors = <&tsens 1>; > > + > > + trips { > > + dsp_alert0: trip-point@0 { > > + temperature = <95000>; > > + hysteresis = <2000>; > > + type = "passive"; > > + }; > > + dsp_crit: dsp_crit { > > + temperature = <110000>; > > + hysteresis = <2000>; > > + type = "critical"; > > + }; > > + }; > > + }; > > + > > + lpass-thermal { > > + polling-delay-passive = <250>; > > + polling-delay = <1000>; > > + > > + thermal-sensors = <&tsens 2>; > > + > > + trips { > > + lpass_alert0: trip-point@0 { > > + temperature = <95000>; > > + hysteresis = <2000>; > > + type = "passive"; > > + }; > > + lpass_crit: lpass_crit { > > + temperature = <110000>; > > + hysteresis = <2000>; > > + type = "critical"; > > + }; > > + }; > > + }; > > + > > + wlan-thermal { > > + polling-delay-passive = <250>; > > + polling-delay = <1000>; > > + > > + thermal-sensors = <&tsens 3>; > > + > > + trips { > > + wlan_alert0: trip-point@0 { > > + temperature = <95000>; > > + hysteresis = <2000>; > > + type = "passive"; > > + }; > > + wlan_crit: wlan_crit { > > + temperature = <110000>; > > + hysteresis = <2000>; > > + type = "critical"; > > + }; > > + }; > > + }; > > + > > + cluster-thermal { > > + polling-delay-passive = <250>; > > + polling-delay = <1000>; > > + > > + thermal-sensors = <&tsens 4>; > > + > > + trips { > > + cluster_alert0: trip-point@0 { > > + temperature = <95000>; > > + hysteresis = <2000>; > > + type = "passive"; > > + }; > > + cluster_crit: cluster_crit { > > + temperature = <110000>; > > + hysteresis = <2000>; > > + type = "critical"; > > + }; > > + }; > > + }; > > + > > + cpu0-thermal { > > + polling-delay-passive = <250>; > > + polling-delay = <1000>; > > + > > + thermal-sensors = <&tsens 5>; > > + > > + trips { > > + cpu0_alert0: trip-point@0 { > > + temperature = <95000>; > > + hysteresis = <2000>; > > + type = "passive"; > > + }; > > + cpu0_crit: cpu_crit { > > + temperature = <110000>; > > + hysteresis = <2000>; > > + type = "critical"; > > + }; > > + }; > > + cooling-maps { > > + map0 { > > + trip = <&cpu0_alert0>; > > + cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, > > + <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, > > + <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, > > + <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; > > + }; > > + }; > > + }; > > + > > + cpu1-thermal { > > + polling-delay-passive = <250>; > > + polling-delay = <1000>; > > + > > + thermal-sensors = <&tsens 6>; > > + > > + trips { > > + cpu1_alert0: trip-point@0 { > > + temperature = <95000>; > > + hysteresis = <2000>; > > + type = "passive"; > > + }; > > + cpu1_crit: cpu_crit { > > + temperature = <110000>; > > + hysteresis = <2000>; > > + type = "critical"; > > + }; > > + }; > > + cooling-maps { > > + map0 { > > + trip = <&cpu1_alert0>; > > + cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, > > + <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, > > + <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, > > + <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; > > + }; > > + }; > > + }; > > + > > + cpu2-thermal { > > + polling-delay-passive = <250>; > > + polling-delay = <1000>; > > + > > + thermal-sensors = <&tsens 7>; > > + > > + trips { > > + cpu2_alert0: trip-point@0 { > > + temperature = <95000>; > > + hysteresis = <2000>; > > + type = "passive"; > > + }; > > + cpu2_crit: cpu_crit { > > + temperature = <110000>; > > + hysteresis = <2000>; > > + type = "critical"; > > + }; > > + }; > > + cooling-maps { > > + map0 { > > + trip = <&cpu2_alert0>; > > + cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, > > + <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, > > + <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, > > + <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; > > + }; > > + }; > > + }; > > + > > + cpu3-thermal { > > + polling-delay-passive = <250>; > > + polling-delay = <1000>; > > + > > + thermal-sensors = <&tsens 8>; > > + > > + trips { > > + cpu3_alert0: trip-point@0 { > > + temperature = <95000>; > > + hysteresis = <2000>; > > + type = "passive"; > > + }; > > + cpu3_crit: cpu_crit { > > + temperature = <110000>; > > + hysteresis = <2000>; > > + type = "critical"; > > + }; > > + }; > > + cooling-maps { > > + map0 { > > + trip = <&cpu3_alert0>; > > + cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, > > + <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, > > + <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, > > + <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; > > + }; > > + }; > > + }; > > + > > + gpu-thermal { > > + polling-delay-passive = <250>; > > + polling-delay = <1000>; > > + > > + thermal-sensors = <&tsens 9>; > > + > > + trips { > > + gpu_alert0: trip-point@0 { > > + temperature = <95000>; > > + hysteresis = <2000>; > > + type = "passive"; > > + }; > > + gpu_crit: gpu_crit { > > + temperature = <95000>; > > + hysteresis = <2000>; > > + type = "critical"; > > + }; > > + }; > > + }; > > + }; > > }; > > -- > > 2.17.1 > >