Another round of tsens cleanups
Subsystems (5)
v3 cover Another round of tsens cleanups
This is another series of tsens cleanups before we add interrupt support. This applies on top of 4.19-rc2.
Patches [1-6] can directly be applied by Eduardo.
Patches [9-16] can directly be applied by Andy.
Patches [7-8] introduce a new check and needs review and can then be applied completely separately by Eduardo.
There is a *dependency* however. Patch 1 should be applied to the tree before the DT changes in patches 9 and 10.
In this series, I've collected all outstanding tsens patches by combining the patches from the v2 posting with 3 DT patches for sdm845 thermal zones and msm8916 camera and gpu thermal zones. Details are as follows:
- splitup 8916 and 8974 register address spaces for SROT and TM
- cleanups: move to spdx, dead code removal, removal of id field
- Add support to map the SROT address space for DTs that list it separately
- Check if TSENS IP is enabled in firmware by querying the SROT space
- Add myself as maintainer of tsens
- Add one-off patches adding sdm845 thermal zones and msm8916 gpu and camera thermal zones to this series.
Changes since v2:
- Split up changes to code and dt and within dt, split into arm and arm64 patches
- Rearrange the sequence of patches so that the thermal maintainer can pick up the first part and the platform maintainer can pick up the latter part of the series
- Drop patch 09/11 because it causes some issues on systems with non-contiguous enabled sensors e.g. db410c
- Drop patch 10/11 because reg-name property isn't encouraged
- Fix a bug on msm8916 to check if IP is enabled in firmware. This was due to the register being at a different offset on msm8916. Fixed by coding this information as private data.
Changes since v1:
- Split up changes that split the address space and added qcom,sensors property into two separate patches
- Remove brackets in typo correction patch
Amit Kucheria (16):
thermal: tsens: Prepare 8916 and 8974 tsens to use SROT and TM address
space
thermal: tsens: Add SPDX license identifiers
thermal: tsens: Get rid of dead code
thermal: tsens: Rename map field in order to add a second address map
thermal: tsens: Add the SROT address map
MAINTAINERS: Add entry for Qualcomm TSENS thermal drivers
thermal: tsens: Pass register offsets as private data
thermal: tsens: Check if the IP is correctly enabled by firmware
arm: dts: msm8974: thermal: split address space into two
arm64: dts: msm8916: thermal: split address space into two
arm: dts: msm8974: thermal: Add "qcom,sensors" property
arm64: dts: msm8916: thermal: Add "qcom,sensors" property
dt-bindings: thermal: Fix a typo in documentation
arm64: dts: msm8916: Add gpu thermal zone
arm64: dts: msm8916: Add camera thermal zone
arm64: dts: sdm845: enable tsens thermal zones
.../devicetree/bindings/thermal/thermal.txt | 2 +- MAINTAINERS | 7 + arch/arm/boot/dts/qcom-msm8974.dtsi | 6 +- arch/arm64/boot/dts/qcom/msm8916.dtsi | 47 ++++- arch/arm64/boot/dts/qcom/sdm845.dtsi | 170 ++++++++++++++++++ drivers/thermal/qcom/tsens-8916.c | 12 +- drivers/thermal/qcom/tsens-8960.c | 41 ++--- drivers/thermal/qcom/tsens-8974.c | 12 +- drivers/thermal/qcom/tsens-common.c | 62 ++++--- drivers/thermal/qcom/tsens-v2.c | 8 +- drivers/thermal/qcom/tsens.c | 19 +- drivers/thermal/qcom/tsens.h | 23 +-- 12 files changed, 309 insertions(+), 100 deletions(-)
Signature · 1 line
2.17.1
PATCH v3 1/16 thermal: tsens: Prepare 8916 and 8974 tsens to use SROT and TM address space
We've already converted over the devicetree of platforms using v2 version of the TSENS IP to use two address spaces. Now prepare to convert over the 8916 and 8974 platforms to use separate SROT and TM address spaces.
This patch will work with device trees with one or two address spaces because we set the tm_offset in commit 5b1283984fa3 ("thermal: tsens:
Add support to split up register address space into two").
--- drivers/thermal/qcom/tsens-common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/thermal/qcom/tsens-common.c +3 -2
@@ -21,7 +21,7 @@#include <linux/regmap.h> #include "tsens.h" -#define S0_ST_ADDR 0x1030 +#define STATUS_OFFSET 0x30#define SN_ADDR_OFFSET 0x4#define SN_ST_TEMP_MASK 0x3ff#define CAL_DEGC_PT1 30
@@ -107,8 +107,9 @@ int get_temp_common(struct tsens_device *tmdev, int id, int *temp)unsigned int status_reg;int last_temp =0 , ret; - status_reg =S0_ST_ADDR + s->hw_id *SN_ADDR_OFFSET ; + status_reg = tmdev->tm_offset +STATUS_OFFSET + s->hw_id *SN_ADDR_OFFSET ; ret =regmap_read (tmdev->map, status_reg, &code); +if (ret)return ret; last_temp = code &SN_ST_TEMP_MASK ;
Signature · 1 line
2.17.1
PATCH v3 2/16 thermal: tsens: Add SPDX license identifiers
In reply to Amit KucheriaThe TSENS drivers use a GPL-2.0 license. Replace with equivalent SPDX tags and delete the full license text.
--- drivers/thermal/qcom/tsens-8916.c | 11 +---------- drivers/thermal/qcom/tsens-8960.c | 11 +---------- drivers/thermal/qcom/tsens-8974.c | 11 +---------- drivers/thermal/qcom/tsens-common.c | 11 +---------- drivers/thermal/qcom/tsens.c | 11 +---------- drivers/thermal/qcom/tsens.h | 11 ++--------- 6 files changed, 7 insertions(+), 59 deletions(-)
drivers/thermal/qcom/tsens-8916.c +1 -10
@@ -1,15 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2015, The Linux Foundation. All rights reserved. -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 and -* only version 2 as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* */ #include <linux/platform_device.h>
drivers/thermal/qcom/tsens-8960.c +1 -10
@@ -1,15 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2015, The Linux Foundation. All rights reserved. -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 and -* only version 2 as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* */ #include <linux/platform_device.h>
drivers/thermal/qcom/tsens-8974.c +1 -10
@@ -1,15 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2015, The Linux Foundation. All rights reserved. -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 and -* only version 2 as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* */ #include <linux/platform_device.h>
drivers/thermal/qcom/tsens-common.c +1 -10
@@ -1,15 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2015, The Linux Foundation. All rights reserved. -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 and -* only version 2 as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* */ #include <linux/err.h>
drivers/thermal/qcom/tsens.c +1 -10
@@ -1,15 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2015, The Linux Foundation. All rights reserved. -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 and -* only version 2 as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* */ #include <linux/err.h>
drivers/thermal/qcom/tsens.h +2 -9
@@ -1,15 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (c) 2015, The Linux Foundation. All rights reserved. -* -* This software is licensed under the terms of the GNU General Public -* License version 2, as published by the Free Software Foundation, and -* may be copied, distributed, and modified under those terms. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. */ +#ifndef __QCOM_TSENS_H__#define __QCOM_TSENS_H__
Signature · 1 line
2.17.1
PATCH v3 3/16 thermal: tsens: Get rid of dead code
In reply to Amit Kucheriahw_id is dynamically allocated but not used anywhere. Get rid of dead code.
--- drivers/thermal/qcom/tsens.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/thermal/qcom/tsens.c +0 -5
@@ -80,11 +80,6 @@ static int tsens_register(struct tsens_device *tmdev) {int i;struct thermal_zone_device *tzd; -u32 *hw_id, n = tmdev->num_sensors; - - hw_id =devm_kcalloc (tmdev->dev, n,sizeof (u32),GFP_KERNEL ); -if (!hw_id) -return -ENOMEM ;for (i =0 ; i < tmdev->num_sensors; i++) { tmdev->sensor[i].tmdev = tmdev;
Signature · 1 line
2.17.1
PATCH v3 4/16 thermal: tsens: Rename map field in order to add a second address map
In reply to Amit KucheriaThe TSENS driver currently only uses a limited set of registers from the TM address space. So it was ok to map just that set of registers and call it "map".
We'd now like to map a second set: SROT registers to introduce new functionality. Rename the "map" field to a more appropriate "tm_map".
The 8960 doesn't have a clear split between TM and SROT registers. To avoid complicating the data structure, it will switchover to using tm_map for its maps.
There is no functional change with this patch.
--- drivers/thermal/qcom/tsens-8960.c | 30 ++++++++++++++--------------- drivers/thermal/qcom/tsens-common.c | 17 ++++++++-------- drivers/thermal/qcom/tsens-v2.c | 6 +++--- drivers/thermal/qcom/tsens.h | 2 +- 4 files changed, 27 insertions(+), 28 deletions(-)
drivers/thermal/qcom/tsens-8960.c +15 -15
@@ -60,7 +60,7 @@ static int suspend_8960(struct tsens_device *tmdev) {int ret;unsigned int mask; -struct regmap *map = tmdev->map; +struct regmap *map = tmdev->tm_map; ret =regmap_read (map,THRESHOLD_ADDR , &tmdev->ctx.threshold);if (ret)
@@ -85,7 +85,7 @@ static int suspend_8960(struct tsens_device *tmdev)static int resume_8960 (struct tsens_device *tmdev) {int ret; -struct regmap *map = tmdev->map; +struct regmap *map = tmdev->tm_map; ret =regmap_update_bits (map,CNTL_ADDR ,SW_RST ,SW_RST );if (ret)
@@ -117,12 +117,12 @@ static int enable_8960(struct tsens_device *tmdev, int id)int ret;u32 reg, mask; - ret =regmap_read (tmdev->map,CNTL_ADDR , ®); + ret =regmap_read (tmdev->tm_map,CNTL_ADDR , ®);if (ret)return ret; mask =BIT (id +SENSOR0_SHIFT ); - ret =regmap_write (tmdev->map,CNTL_ADDR , reg |SW_RST ); + ret =regmap_write (tmdev->tm_map,CNTL_ADDR , reg |SW_RST );if (ret)return ret;
@@ -131,7 +131,7 @@ static int enable_8960(struct tsens_device *tmdev, int id)else reg |= mask |SLP_CLK_ENA_8660 |EN ; - ret =regmap_write (tmdev->map,CNTL_ADDR , reg); + ret =regmap_write (tmdev->tm_map,CNTL_ADDR , reg);if (ret)return ret;
@@ -148,7 +148,7 @@ static void disable_8960(struct tsens_device *tmdev) mask <<=SENSOR0_SHIFT ; mask |=EN ; - ret =regmap_read (tmdev->map,CNTL_ADDR , ®_cntl); + ret =regmap_read (tmdev->tm_map,CNTL_ADDR , ®_cntl);if (ret)return ;
@@ -159,7 +159,7 @@ static void disable_8960(struct tsens_device *tmdev)else reg_cntl &= ~SLP_CLK_ENA_8660 ; -regmap_write (tmdev->map,CNTL_ADDR , reg_cntl); +regmap_write (tmdev->tm_map,CNTL_ADDR , reg_cntl); }static int init_8960 (struct tsens_device *tmdev)
@@ -167,8 +167,8 @@ static int init_8960(struct tsens_device *tmdev)int ret, i;u32 reg_cntl; - tmdev->map =dev_get_regmap (tmdev->dev,NULL ); -if (!tmdev->map) + tmdev->tm_map =dev_get_regmap (tmdev->dev,NULL ); +if (!tmdev->tm_map)return -ENODEV ;/*
@@ -184,14 +184,14 @@ static int init_8960(struct tsens_device *tmdev) } reg_cntl =SW_RST ; - ret =regmap_update_bits (tmdev->map,CNTL_ADDR ,SW_RST , reg_cntl); + ret =regmap_update_bits (tmdev->tm_map,CNTL_ADDR ,SW_RST , reg_cntl);if (ret)return ret;if (tmdev->num_sensors >1 ) { reg_cntl |=SLP_CLK_ENA | (MEASURE_PERIOD <<18 ); reg_cntl &= ~SW_RST ; - ret =regmap_update_bits (tmdev->map,CONFIG_ADDR , + ret =regmap_update_bits (tmdev->tm_map,CONFIG_ADDR ,CONFIG_MASK ,CONFIG ); }else { reg_cntl |=SLP_CLK_ENA_8660 | (MEASURE_PERIOD <<16 );
@@ -200,12 +200,12 @@ static int init_8960(struct tsens_device *tmdev) } reg_cntl |=GENMASK (tmdev->num_sensors -1 ,0 ) <<SENSOR0_SHIFT ; - ret =regmap_write (tmdev->map,CNTL_ADDR , reg_cntl); + ret =regmap_write (tmdev->tm_map,CNTL_ADDR , reg_cntl);if (ret)return ret; reg_cntl |=EN ; - ret =regmap_write (tmdev->map,CNTL_ADDR , reg_cntl); + ret =regmap_write (tmdev->tm_map,CNTL_ADDR , reg_cntl);if (ret)return ret;
@@ -252,12 +252,12 @@ static int get_temp_8960(struct tsens_device *tmdev, int id, int *temp) timeout = jiffies +usecs_to_jiffies (TIMEOUT_US ); do { - ret = regmap_read(tmdev->map, INT_STATUS_ADDR, &trdy); + ret = regmap_read(tmdev->tm_map, INT_STATUS_ADDR, &trdy); if (ret) return ret; if (!(trdy & TRDY_MASK)) continue; - ret = regmap_read(tmdev->map, s->status, &code); + ret = regmap_read(tmdev->tm_map, s->status, &code); if (ret) return ret; *temp = code_to_mdegC(code, s);
drivers/thermal/qcom/tsens-common.c +8 -9
@@ -99,8 +99,7 @@ int get_temp_common(struct tsens_device *tmdev, int id, int *temp)int last_temp =0 , ret; status_reg = tmdev->tm_offset +STATUS_OFFSET + s->hw_id *SN_ADDR_OFFSET ; - ret =regmap_read (tmdev->map, status_reg, &code); - + ret =regmap_read (tmdev->tm_map, status_reg, &code);if (ret)return ret; last_temp = code &SN_ST_TEMP_MASK ;
@@ -118,7 +117,7 @@ static const struct regmap_config tsens_config = {int __init init_common (struct tsens_device *tmdev) { -void __iomem *base; +void __iomem *tm_base;struct resource *res;struct platform_device *op =of_find_device_by_node (tmdev->dev->of_node);
@@ -134,13 +133,13 @@ int __init init_common(struct tsens_device *tmdev) } res =platform_get_resource (op,IORESOURCE_MEM ,0 ); - base =devm_ioremap_resource (&op->dev, res); -if (IS_ERR (base)) -return PTR_ERR (base); + tm_base =devm_ioremap_resource (&op->dev, res); +if (IS_ERR (tm_base)) +return PTR_ERR (tm_base); - tmdev->map =devm_regmap_init_mmio (tmdev->dev, base, &tsens_config); -if (IS_ERR (tmdev->map)) -return PTR_ERR (tmdev->map); + tmdev->tm_map =devm_regmap_init_mmio (tmdev->dev, tm_base, &tsens_config); +if (IS_ERR (tmdev->tm_map)) +return PTR_ERR (tmdev->tm_map);return 0 ; }
drivers/thermal/qcom/tsens-v2.c +3 -3
@@ -21,7 +21,7 @@ static int get_temp_tsens_v2(struct tsens_device *tmdev, int id, int *temp)int ret; status_reg = tmdev->tm_offset +STATUS_OFFSET + s->hw_id *4 ; - ret =regmap_read (tmdev->map, status_reg, &code); + ret =regmap_read (tmdev->tm_map, status_reg, &code);if (ret)return ret; last_temp = code &LAST_TEMP_MASK ;
@@ -29,7 +29,7 @@ static int get_temp_tsens_v2(struct tsens_device *tmdev, int id, int *temp) goto done;/* Try a second time */ - ret =regmap_read (tmdev->map, status_reg, &code); + ret =regmap_read (tmdev->tm_map, status_reg, &code);if (ret)return ret;if (code &STATUS_VALID_BIT ) {
@@ -40,7 +40,7 @@ static int get_temp_tsens_v2(struct tsens_device *tmdev, int id, int *temp) }/* Try a third/last time */ - ret =regmap_read (tmdev->map, status_reg, &code); + ret =regmap_read (tmdev->tm_map, status_reg, &code);if (ret)return ret;if (code &STATUS_VALID_BIT ) {
drivers/thermal/qcom/tsens.h +1 -1
@@ -69,7 +69,7 @@ struct tsens_context {struct tsens_device {struct device *dev;u32 num_sensors; -struct regmap *map; +struct regmap *tm_map;u32 tm_offset;struct tsens_context ctx;const struct tsens_ops *ops;
Signature · 1 line
2.17.1
PATCH v3 5/16 thermal: tsens: Add the SROT address map
In reply to Amit KucheriaOn platforms whose device trees specify two address spaces for TSENS, the second one points to the SROT registers. Initialise the SROT map on those platforms.
--- drivers/thermal/qcom/tsens-common.c | 14 ++++++++++++-- drivers/thermal/qcom/tsens.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-)
drivers/thermal/qcom/tsens-common.c +12 -2
@@ -117,16 +117,26 @@ static const struct regmap_config tsens_config = {int __init init_common (struct tsens_device *tmdev) { -void __iomem *tm_base; +void __iomem *tm_base, *srot_base;struct resource *res;struct platform_device *op =of_find_device_by_node (tmdev->dev->of_node);if (!op)return -EINVAL ; -/* The driver only uses the TM register address space for now */ if (op->num_resources >1 ) { +/* DT with separate SROT and TM address space */ tmdev->tm_offset =0 ; + res =platform_get_resource (op,IORESOURCE_MEM ,1 ); + srot_base =devm_ioremap_resource (&op->dev, res); +if (IS_ERR (srot_base)) +return PTR_ERR (srot_base); + + tmdev->srot_map =devm_regmap_init_mmio (tmdev->dev, + srot_base, &tsens_config); +if (IS_ERR (tmdev->srot_map)) +return PTR_ERR (tmdev->srot_map); + }else {/* old DTs where SROT and TM were in a contiguous 2K block */ tmdev->tm_offset =0x1000 ;
drivers/thermal/qcom/tsens.h +1 -0
@@ -70,6 +70,7 @@ struct tsens_device {struct device *dev;u32 num_sensors;struct regmap *tm_map; +struct regmap *srot_map;u32 tm_offset;struct tsens_context ctx;const struct tsens_ops *ops;
Signature · 1 line
2.17.1
PATCH v3 6/16 MAINTAINERS: Add entry for Qualcomm TSENS thermal drivers
In reply to Amit KucheriaCreate an entry for the TSENS drivers and mark them as maintained
--- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
@@ -12076,6 +12076,13 @@ L: [email protected] S: Maintained F: drivers/iommu/qcom_iommu.c +QUALCOMM TSENS THERMAL DRIVER +M: Amit Kucheria <[email protected]> +L: [email protected] +L: [email protected] +S: Maintained +F: drivers/thermal/qcom/ + QUALCOMM VENUS VIDEO ACCELERATOR DRIVER M: Stanimir Varbanov <[email protected]> L: [email protected]
Signature · 1 line
2.17.1
PATCH v3 7/16 thermal: tsens: Pass register offsets as private data
In reply to Amit KucheriaRegisters have moved around across TSENS generations. For example, the CTRL register was at offset 0x0 in the SROT region on msm8916 but is at offset 0x4 in newer v2 based TSENS HW blocks.
Allow passing offsets of important registers so that we can continue to use common functions.
--- drivers/thermal/qcom/tsens-8916.c | 1 + drivers/thermal/qcom/tsens-8974.c | 1 + drivers/thermal/qcom/tsens-v2.c | 2 ++ drivers/thermal/qcom/tsens.c | 3 +++ drivers/thermal/qcom/tsens.h | 9 +++++++++ 5 files changed, 16 insertions(+)
drivers/thermal/qcom/tsens-8916.c +1 -0
@@ -100,5 +100,6 @@ static const struct tsens_ops ops_8916 = {const struct tsens_data data_8916 = { .num_sensors =5 , .ops = &ops_8916, + .reg_offsets = { [SROT_CTRL_OFFSET ] =0x0 }, .hw_ids = (unsigned int []){0 ,1 ,2 ,4 ,5 }, };
drivers/thermal/qcom/tsens-8974.c +1 -0
@@ -232,4 +232,5 @@ static const struct tsens_ops ops_8974 = {const struct tsens_data data_8974 = { .num_sensors =11 , .ops = &ops_8974, + .reg_offsets = { [SROT_CTRL_OFFSET ] =0x0 }, };
drivers/thermal/qcom/tsens-v2.c +2 -0
@@ -68,10 +68,12 @@ static const struct tsens_ops ops_generic_v2 = {const struct tsens_data data_tsens_v2 = { .ops = &ops_generic_v2, + .reg_offsets = { [SROT_CTRL_OFFSET ] =0x4 }, };/* Kept around for backward compatibility with old msm8996.dtsi */ const struct tsens_data data_8996 = { .num_sensors =13 , .ops = &ops_generic_v2, + .reg_offsets = { [SROT_CTRL_OFFSET ] =0x4 }, };
drivers/thermal/qcom/tsens.c +3 -0
@@ -144,6 +144,9 @@ static int tsens_probe(struct platform_device *pdev)else tmdev->sensor[i].hw_id = i; } +for (i =0 ; i <REG_ARRAY_SIZE ; i++) { + tmdev->reg_offsets[i] = data->reg_offsets[i]; + }if (!tmdev->ops || !tmdev->ops->init || !tmdev->ops->get_temp)return -EINVAL ;
drivers/thermal/qcom/tsens.h +9 -0
@@ -48,15 +48,23 @@ struct tsens_ops {int (*get_trend)(struct tsens_device *,int ,enum thermal_trend *); }; +enum reg_list { +SROT_CTRL_OFFSET , + +REG_ARRAY_SIZE , +}; +/** * struct tsens_data - tsens instance specific data * @num_sensors: Max number of sensors supported by platform * @ops: operations the tsens instance supports * @hw_ids: Subset of sensors ids supported by platform, if not the first n +* @reg_offsets: Register offsets for commonly used registers */ struct tsens_data {const u32 num_sensors;const struct tsens_ops *ops; +const u16 reg_offsets[REG_ARRAY_SIZE ];unsigned int *hw_ids; };
@@ -72,6 +80,7 @@ struct tsens_device {struct regmap *tm_map;struct regmap *srot_map;u32 tm_offset; +u16 reg_offsets[REG_ARRAY_SIZE ];struct tsens_context ctx;const struct tsens_ops *ops;struct tsens_sensor sensor[0 ];
Signature · 1 line
2.17.1
Re: [PATCH v3 07/16] thermal: tsens: Pass register offsets as private data
drivers/thermal/qcom/tsens.c static int tsens_probe(struct platform_device *pdev) · line 149
Quoted 11 lines · Amit Kucheria
drivers/thermal/qcom/tsens.c +3
-0@@ -144,6 +144,9 @@ static int tsens_probe(struct platform_device *pdev)else tmdev->sensor[i].hw_id = i; } +for (i =0 ; i <REG_ARRAY_SIZE ; i++) { + tmdev->reg_offsets[i] = data->reg_offsets[i]; + }
Unnecessary {}
Quoted 13 lines
drivers/thermal/qcom/tsens.c +0
-0if (!tmdev->ops || !tmdev->ops->init || !tmdev->ops->get_temp)return -EINVAL ;drivers/thermal/qcom/tsens.h +2
-0@@ -48,15 +48,23 @@ struct tsens_ops {int (*get_trend)(struct tsens_device *,int ,enum thermal_trend *); }; +enum reg_list { +SROT_CTRL_OFFSET ,
drivers/thermal/qcom/tsens.h struct tsens_ops { · line 62
Quoted 10 lines
drivers/thermal/qcom/tsens.h +5
-0+ + REG_ARRAY_SIZE, +}; +/** * struct tsens_data - tsens instance specific data * @num_sensors: Max number of sensors supported by platform * @ops: operations the tsens instance supports * @hw_ids: Subset of sensors ids supported by platform, if not the first n +* @reg_offsets: Register offsets for commonly used registers
Order doesn't match struct.
drivers/thermal/qcom/tsens.h struct tsens_ops { · line 69
Quoted 7 lines
drivers/thermal/qcom/tsens.h +1
-0*/ struct tsens_data {const u32 num_sensors;const struct tsens_ops *ops; +const u16 reg_offsets[REG_ARRAY_SIZE ];unsigned int *hw_ids; };
Except of that you have my:
Regards,
Bjorn
PATCH v4 7/16 thermal: tsens: Pass register offsets as private data
Registers have moved around across TSENS generations. For example, the CTRL register was at offset 0x0 in the SROT region on msm8916 but is at offset 0x4 in newer v2 based TSENS HW blocks.
Allow passing offsets of important registers so that we can continue to use common functions.
---
Here is a fixup patch. Eduardo, if you like I can resend the entire series or you can find the entire series hosted with all tags applied here:
https://git.linaro.org/people/amit.kucheria/kernel.git/log/?h=up/thermal/tsens-preirq-cleanup-v4
drivers/thermal/qcom/tsens-8916.c | 1 + drivers/thermal/qcom/tsens-8974.c | 1 + drivers/thermal/qcom/tsens-v2.c | 2 ++ drivers/thermal/qcom/tsens.c | 2 ++ drivers/thermal/qcom/tsens.h | 9 +++++++++ 5 files changed, 15 insertions(+)
drivers/thermal/qcom/tsens-8916.c +1 -0
@@ -100,5 +100,6 @@ static const struct tsens_ops ops_8916 = {const struct tsens_data data_8916 = { .num_sensors =5 , .ops = &ops_8916, + .reg_offsets = { [SROT_CTRL_OFFSET ] =0x0 }, .hw_ids = (unsigned int []){0 ,1 ,2 ,4 ,5 }, };
drivers/thermal/qcom/tsens-8974.c +1 -0
@@ -232,4 +232,5 @@ static const struct tsens_ops ops_8974 = {const struct tsens_data data_8974 = { .num_sensors =11 , .ops = &ops_8974, + .reg_offsets = { [SROT_CTRL_OFFSET ] =0x0 }, };
drivers/thermal/qcom/tsens-v2.c +2 -0
@@ -68,10 +68,12 @@ static const struct tsens_ops ops_generic_v2 = {const struct tsens_data data_tsens_v2 = { .ops = &ops_generic_v2, + .reg_offsets = { [SROT_CTRL_OFFSET ] =0x4 }, };/* Kept around for backward compatibility with old msm8996.dtsi */ const struct tsens_data data_8996 = { .num_sensors =13 , .ops = &ops_generic_v2, + .reg_offsets = { [SROT_CTRL_OFFSET ] =0x4 }, };
drivers/thermal/qcom/tsens.c +2 -0
@@ -144,6 +144,8 @@ static int tsens_probe(struct platform_device *pdev)else tmdev->sensor[i].hw_id = i; } +for (i =0 ; i <REG_ARRAY_SIZE ; i++) + tmdev->reg_offsets[i] = data->reg_offsets[i];if (!tmdev->ops || !tmdev->ops->init || !tmdev->ops->get_temp)return -EINVAL ;
drivers/thermal/qcom/tsens.h +9 -0
@@ -48,15 +48,23 @@ struct tsens_ops {int (*get_trend)(struct tsens_device *,int ,enum thermal_trend *); }; +enum reg_list { +SROT_CTRL_OFFSET , + +REG_ARRAY_SIZE , +}; +/** * struct tsens_data - tsens instance specific data * @num_sensors: Max number of sensors supported by platform * @ops: operations the tsens instance supports +* @reg_offsets: Register offsets for commonly used registers * @hw_ids: Subset of sensors ids supported by platform, if not the first n */ struct tsens_data {const u32 num_sensors;const struct tsens_ops *ops; +const u16 reg_offsets[REG_ARRAY_SIZE ];unsigned int *hw_ids; };
@@ -72,6 +80,7 @@ struct tsens_device {struct regmap *tm_map;struct regmap *srot_map;u32 tm_offset; +u16 reg_offsets[REG_ARRAY_SIZE ];struct tsens_context ctx;const struct tsens_ops *ops;struct tsens_sensor sensor[0 ];
Signature · 1 line
2.17.1
PATCH v3 8/16 thermal: tsens: Check if the IP is correctly enabled by firmware
In reply to Amit KucheriaThe SROT registers are initialised by the secure firmware at boot. We don't have write access to the registers. Check if the block is enabled before continuing.
--- drivers/thermal/qcom/tsens-common.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/thermal/qcom/tsens-common.c +17 -0
@@ -12,6 +12,10 @@#include <linux/regmap.h> #include "tsens.h" +/* SROT */ +#define TSENS_EN BIT(0) + +/* TM */ #define STATUS_OFFSET 0x30#define SN_ADDR_OFFSET 0x4#define SN_ST_TEMP_MASK 0x3ff
@@ -119,7 +123,10 @@ int __init init_common(struct tsens_device *tmdev) {void __iomem *tm_base, *srot_base;struct resource *res; +u32 code; +int ret;struct platform_device *op =of_find_device_by_node (tmdev->dev->of_node); +u16 ctrl_offset = tmdev->reg_offsets[SROT_CTRL_OFFSET ];if (!op)return -EINVAL ;
@@ -151,5 +158,15 @@ int __init init_common(struct tsens_device *tmdev)if (IS_ERR (tmdev->tm_map))return PTR_ERR (tmdev->tm_map); +if (tmdev->srot_map) { + ret =regmap_read (tmdev->srot_map, ctrl_offset, &code); +if (ret) +return ret; +if (!(code &TSENS_EN )) { +dev_err (tmdev->dev,"tsens device is not enabled\n" ); +return -ENODEV ; + } + } +return 0 ; }
Signature · 1 line
2.17.1
PATCH v3 9/16 arm: dts: msm8974: thermal: split address space into two
In reply to Amit KucheriaWe've earlier added support to split the register address space into TM and SROT regions. Split up the regmap address space into two for msm8974 that has a similar register layout.
Since tsens-common.c/init_common() currently only registers one address space, the order is important (TM before SROT). This is OK since the code doesn't really use the SROT functionality yet.
--- arch/arm/boot/dts/qcom-msm8974.dtsi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm/boot/dts/qcom-msm8974.dtsi +3 -2
@@ -427,9 +427,10 @@ }; }; - tsens: thermal-sensor@fc4a8000 { + tsens: thermal-sensor@fc4a9000 { compatible = "qcom,msm8974-tsens"; - reg = <0xfc4a8000 0x2000>; + reg = <0xfc4a9000 0x1000>, /* TM */ + <0xfc4a8000 0x1000>; /* SROT */ nvmem-cells = <&tsens_calib>, <&tsens_backup>; nvmem-cell-names = "calib", "calib_backup"; #thermal-sensor-cells = <1>;
Signature · 1 line
2.17.1
Re: [PATCH v3 09/16] arm: dts: msm8974: thermal: split address space into two
Quoted 11 lines · Amit Kucheria
We've earlier added support to split the register address space into TM and SROT regions. Split up the regmap address space into two for msm8974 that has a similar register layout.
Since tsens-common.c/init_common() currently only registers one address space, the order is important (TM before SROT). This is OK since the code doesn't really use the SROT functionality yet.
Signed-off-by Amit Kucheria <[email protected]>Reviewed-by Matthias Kaehlcke <[email protected]>---
PATCH v3 10/16 arm64: dts: msm8916: thermal: split address space into two
In reply to Amit KucheriaWe've earlier added support to split the register address space into TM and SROT regions. Split up the regmap address space into two for msm8916 that has a similar register layout.
Since tsens-common.c/init_common() currently only registers one address space, the order is important (TM before SROT). This is OK since the code doesn't really use the SROT functionality yet.
--- arch/arm64/boot/dts/qcom/msm8916.dtsi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/msm8916.dtsi +3 -2
@@ -761,9 +761,10 @@ }; }; - tsens: thermal-sensor@4a8000 { + tsens: thermal-sensor@4a9000 { compatible = "qcom,msm8916-tsens"; - reg = <0x4a8000 0x2000>; + reg = <0x4a9000 0x1000>, /* TM */ + <0x4a8000 0x1000>; /* SROT */ nvmem-cells = <&tsens_caldata>, <&tsens_calsel>; nvmem-cell-names = "calib", "calib_sel"; #thermal-sensor-cells = <1>;
Signature · 1 line
2.17.1
Re: [PATCH v3 10/16] arm64: dts: msm8916: thermal: split address space into two
Quoted 11 lines · Amit Kucheria
We've earlier added support to split the register address space into TM and SROT regions. Split up the regmap address space into two for msm8916 that has a similar register layout.
Since tsens-common.c/init_common() currently only registers one address space, the order is important (TM before SROT). This is OK since the code doesn't really use the SROT functionality yet.
Signed-off-by Amit Kucheria <[email protected]>Reviewed-by Matthias Kaehlcke <[email protected]>---
PATCH v3 11/16 arm: dts: msm8974: thermal: Add "qcom,sensors" property
In reply to Amit KucheriaThis new property allows the number of sensors to be configured from DT instead of being hardcoded in platform data. Use it.
--- arch/arm/boot/dts/qcom-msm8974.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/qcom-msm8974.dtsi +1 -0
@@ -433,6 +433,7 @@ <0xfc4a8000 0x1000>; /* SROT */ nvmem-cells = <&tsens_calib>, <&tsens_backup>; nvmem-cell-names = "calib", "calib_backup"; + #qcom,sensors = <11>; #thermal-sensor-cells = <1>; };
Signature · 1 line
2.17.1
Re: [PATCH v3 11/16] arm: dts: msm8974: thermal: Add "qcom,sensors" property
arch/arm/boot/dts/qcom-msm8974.dtsi
Quoted 13 lines · Amit Kucheria
This new property allows the number of sensors to be configured from DT instead of being hardcoded in platform data. Use it.
Signed-off-by Amit Kucheria <[email protected]>Reviewed-by Matthias Kaehlcke <[email protected]>Reviewed-by Bjorn Andersson <[email protected]>--- arch/arm/boot/dts/qcom-msm8974.dtsi | 1 + 1 file changed, 1 insertion(+)arch/arm/boot/dts/qcom-msm8974.dtsi +0
-1--- a/arch/arm/boot/dts/qcom-msm8974.dtsi
PATCH v3 12/16 arm64: dts: msm8916: thermal: Add "qcom,sensors" property
In reply to Amit KucheriaThis new property allows the number of sensors to be configured from DT instead of being hardcoded in platform data. Use it.
--- arch/arm64/boot/dts/qcom/msm8916.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/msm8916.dtsi +1 -0
@@ -767,6 +767,7 @@ <0x4a8000 0x1000>; /* SROT */ nvmem-cells = <&tsens_caldata>, <&tsens_calsel>; nvmem-cell-names = "calib", "calib_sel"; + #qcom,sensors = <5>; #thermal-sensor-cells = <1>; };
Signature · 1 line
2.17.1
Re: [PATCH v3 12/16] arm64: dts: msm8916: thermal: Add "qcom,sensors" property
arch/arm64/boot/dts/qcom/msm8916.dtsi
Quoted 12 lines · Amit Kucheria
This new property allows the number of sensors to be configured from DT instead of being hardcoded in platform data. Use it.
Signed-off-by Amit Kucheria <[email protected]>Reviewed-by Bjorn Andersson <[email protected]>--- arch/arm64/boot/dts/qcom/msm8916.dtsi | 1 + 1 file changed, 1 insertion(+)arch/arm64/boot/dts/qcom/msm8916.dtsi +0
-1--- a/arch/arm64/boot/dts/qcom/msm8916.dtsi
PATCH v3 13/16 dt-bindings: thermal: Fix a typo in documentation
In reply to Amit Kucheriac(1) + x(1) was actually meant to be c(1) * x(1).
--- Documentation/devicetree/bindings/thermal/thermal.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/thermal/thermal.txt +1 -1
@@ -152,7 +152,7 @@ Optional property: Elem size: one cell the sensors listed in the thermal-sensors property. Elem type: signed Coefficients defaults to 1, in case this property is not specified. A simple linear polynomial is used: - Z = c0 * x0 + c1 + x1 + ... + c(n-1) * x(n-1) + cn. + Z = c0 * x0 + c1 * x1 + ... + c(n-1) * x(n-1) + cn. The coefficients are ordered and they match with sensors by means of sensor ID. Additional coefficients are
Signature · 1 line
2.17.1
PATCH v3 14/16 arm64: dts: msm8916: Add gpu thermal zone
In reply to Amit KucheriaInitialise the gpu thermal zone to export temperature to userspace.
--- arch/arm64/boot/dts/qcom/msm8916.dtsi | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
arch/arm64/boot/dts/qcom/msm8916.dtsi +20 -0
@@ -237,6 +237,26 @@ }; }; + gpu-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens 2>; + + trips { + gpu_alert: trip0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + gpu_crit: trip1 { + temperature = <95000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + }; cpu_opp_table: cpu_opp_table {
Signature · 1 line
2.17.1
Re: [PATCH v3 14/16] arm64: dts: msm8916: Add gpu thermal zone
arch/arm64/boot/dts/qcom/msm8916.dtsi
Quoted 11 lines · Amit Kucheria
Initialise the gpu thermal zone to export temperature to userspace.
Signed-off-by Amit Kucheria <[email protected]>--- arch/arm64/boot/dts/qcom/msm8916.dtsi | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)arch/arm64/boot/dts/qcom/msm8916.dtsi +0
-0
PATCH v3 15/16 arm64: dts: msm8916: Add camera thermal zone
In reply to Amit KucheriaInitialise the camera thermal zone to export temperature to userspace.
--- arch/arm64/boot/dts/qcom/msm8916.dtsi | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
arch/arm64/boot/dts/qcom/msm8916.dtsi +21 -0
@@ -257,6 +257,27 @@ }; }; + camera-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens 1>; + + trips { + cam_alert: trip0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + cam_crit: trip1 { + temperature = <95000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + + }; + }; cpu_opp_table: cpu_opp_table {
Signature · 1 line
2.17.1
Re: [PATCH v3 15/16] arm64: dts: msm8916: Add camera thermal zone
arch/arm64/boot/dts/qcom/msm8916.dtsi
Quoted 11 lines · Amit Kucheria
Initialise the camera thermal zone to export temperature to userspace.
Signed-off-by Amit Kucheria <[email protected]>--- arch/arm64/boot/dts/qcom/msm8916.dtsi | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)arch/arm64/boot/dts/qcom/msm8916.dtsi +0
-0
PATCH v3 16/16 arm64: dts: sdm845: enable tsens thermal zones
In reply to Amit KucheriaOne thermal zone per cpu is defined
--- arch/arm64/boot/dts/qcom/sdm845.dtsi | 170 +++++++++++++++++++++++++++ 1 file changed, 170 insertions(+)
arch/arm64/boot/dts/qcom/sdm845.dtsi +170 -0
@@ -1104,4 +1104,174 @@ }; }; }; + + thermal-zones { + cpu0-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens0 1>; + + trips { + cpu_alert0: trip0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + + cpu_crit0: trip1 { + temperature = <110000>; + hysteresis = <1000>; + type = "critical"; + }; + }; + }; + + cpu1-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens0 2>; + + trips { + cpu_alert1: trip0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + + cpu_crit1: trip1 { + temperature = <110000>; + hysteresis = <1000>; + type = "critical"; + }; + }; + }; + + cpu2-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens0 3>; + + trips { + cpu_alert2: trip0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + + cpu_crit2: trip1 { + temperature = <110000>; + hysteresis = <1000>; + type = "critical"; + }; + }; + }; + + cpu3-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens0 4>; + + trips { + cpu_alert3: trip0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + + cpu_crit3: trip1 { + temperature = <110000>; + hysteresis = <1000>; + type = "critical"; + }; + }; + }; + + cpu4-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens0 7>; + + trips { + cpu_alert4: trip0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + + cpu_crit4: trip1 { + temperature = <110000>; + hysteresis = <1000>; + type = "critical"; + }; + }; + }; + + cpu5-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens0 8>; + + trips { + cpu_alert5: trip0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + + cpu_crit5: trip1 { + temperature = <110000>; + hysteresis = <1000>; + type = "critical"; + }; + }; + }; + + cpu6-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens0 9>; + + trips { + cpu_alert6: trip0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + + cpu_crit6: trip1 { + temperature = <110000>; + hysteresis = <1000>; + type = "critical"; + }; + }; + }; + + cpu7-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens0 10>; + + trips { + cpu_alert7: trip0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + + cpu_crit7: trip1 { + temperature = <110000>; + hysteresis = <1000>; + type = "critical"; + }; + }; + }; + }; };
Signature · 1 line
2.17.1
Re: [PATCH v3 16/16] arm64: dts: sdm845: enable tsens thermal zones
arch/arm64/boot/dts/qcom/sdm845.dtsi
Quoted 13 lines · Amit Kucheria
One thermal zone per cpu is defined
Signed-off-by Amit Kucheria <[email protected]>Reviewed-by Matthias Kaehlcke <[email protected]>Tested-by Matthias Kaehlcke <[email protected]>--- arch/arm64/boot/dts/qcom/sdm845.dtsi | 170 +++++++++++++++++++++++++++ 1 file changed, 170 insertions(+)arch/arm64/boot/dts/qcom/sdm845.dtsi +0
-0
Re: [PATCH v3 16/16] arm64: dts: sdm845: enable tsens thermal zones
In reply to Amit KucheriaHi Amit,
vaguely related question, since you are working on SDM845 thermal
stuff: Do you have plans to add CPU cooling devices? I raised the point during the review of the CPUfreq HW, however there was no clear answer: https://lore.kernel.org/patchwork/patch/966833/#1164748
The driver is still under development/review, but I wonder what the path forward is.
Cheers
Matthias
Quoted 188 lines · Amit Kucheria
One thermal zone per cpu is defined
Signed-off-by Amit Kucheria <[email protected]>Reviewed-by Matthias Kaehlcke <[email protected]>Tested-by Matthias Kaehlcke <[email protected]>--- arch/arm64/boot/dts/qcom/sdm845.dtsi | 170 +++++++++++++++++++++++++++ 1 file changed, 170 insertions(+)arch/arm64/boot/dts/qcom/sdm845.dtsi +170
-0@@ -1104,4 +1104,174 @@ }; }; }; + + thermal-zones { + cpu0-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens0 1>; + + trips { + cpu_alert0: trip0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + + cpu_crit0: trip1 { + temperature = <110000>; + hysteresis = <1000>; + type = "critical"; + }; + }; + }; + + cpu1-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens0 2>; + + trips { + cpu_alert1: trip0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + + cpu_crit1: trip1 { + temperature = <110000>; + hysteresis = <1000>; + type = "critical"; + }; + }; + }; + + cpu2-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens0 3>; + + trips { + cpu_alert2: trip0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + + cpu_crit2: trip1 { + temperature = <110000>; + hysteresis = <1000>; + type = "critical"; + }; + }; + }; + + cpu3-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens0 4>; + + trips { + cpu_alert3: trip0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + + cpu_crit3: trip1 { + temperature = <110000>; + hysteresis = <1000>; + type = "critical"; + }; + }; + }; + + cpu4-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens0 7>; + + trips { + cpu_alert4: trip0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + + cpu_crit4: trip1 { + temperature = <110000>; + hysteresis = <1000>; + type = "critical"; + }; + }; + }; + + cpu5-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens0 8>; + + trips { + cpu_alert5: trip0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + + cpu_crit5: trip1 { + temperature = <110000>; + hysteresis = <1000>; + type = "critical"; + }; + }; + }; + + cpu6-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens0 9>; + + trips { + cpu_alert6: trip0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + + cpu_crit6: trip1 { + temperature = <110000>; + hysteresis = <1000>; + type = "critical"; + }; + }; + }; + + cpu7-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + + thermal-sensors = <&tsens0 10>; + + trips { + cpu_alert7: trip0 { + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + + cpu_crit7: trip1 { + temperature = <110000>; + hysteresis = <1000>; + type = "critical"; + }; + }; + }; + }; };
Re: [PATCH v3 16/16] arm64: dts: sdm845: enable tsens thermal zones
Quoted 10 lines · Matthias Kaehlcke
Hi Amit,
vaguely related question, since you are working on SDM845 thermal
stuff: Do you have plans to add CPU cooling devices? I raised the point during the review of the CPUfreq HW, however there was no clear answer: https://lore.kernel.org/patchwork/patch/966833/#1164748
The driver is still under development/review, but I wonder what the path forward is.
Hi Matthias,
I plan to but the OSM driver doesn't work well enough for me to send out that patch yet. I responded with my findings on the v9 posting where it seems to get stuck at the high OPP. It'd be nice if somebody else could confirm (or refute) this behaviour.
Regards,
Amit
Re: [PATCH v3 16/16] arm64: dts: sdm845: enable tsens thermal zones
Quoted 12 lines · Amit Kucheria
Quoted 10 lines · Matthias Kaehlcke
Hi Amit,
vaguely related question, since you are working on SDM845 thermal
stuff: Do you have plans to add CPU cooling devices? I raised the point during the review of the CPUfreq HW, however there was no clear answer: https://lore.kernel.org/patchwork/patch/966833/#1164748
The driver is still under development/review, but I wonder what the path forward is.
Quoted 3 lines
Hi Matthias,
I plan to
Great!
Quoted 4 lines
but the OSM driver doesn't work well enough for me to send out that patch yet. I responded with my findings on the v9 posting where it seems to get stuck at the high OPP. It'd be nice if somebody else could confirm (or refute) this behaviour.
Ok, we aren't using the latest version yet, I'll try to repro and report back.
Cheers
Matthias
Hi Eduardo, Andy,
Quoted 10 lines · Amit Kucheria
This is another series of tsens cleanups before we add interrupt support. This applies on top of 4.19-rc2.
Patches [1-6] can directly be applied by Eduardo.
Patches [9-16] can directly be applied by Andy.
Patches [7-8] introduce a new check and needs review and can then be applied completely separately by Eduardo.There is a *dependency* however. Patch 1 should be applied to the tree before the DT changes in patches 9 and 10.
To clarify here, it might be easier if Eduardo acks patches 9 and 10 so that they can be merged through Andy's tree before the rest of the DT patches. That would remove the need to create any immutable trees or having to worry about the ordering of the patches.
Just a suggestion.
Quoted 66 lines
In this series, I've collected all outstanding tsens patches by combining the patches from the v2 posting with 3 DT patches for sdm845 thermal zones and msm8916 camera and gpu thermal zones. Details are as follows:
- splitup 8916 and 8974 register address spaces for SROT and TM
- cleanups: move to spdx, dead code removal, removal of id field
- Add support to map the SROT address space for DTs that list it separately
- Check if TSENS IP is enabled in firmware by querying the SROT space
- Add myself as maintainer of tsens
- Add one-off patches adding sdm845 thermal zones and msm8916 gpu and camera thermal zones to this series.Changes since v2:
- Split up changes to code and dt and within dt, split into arm and arm64 patches
- Rearrange the sequence of patches so that the thermal maintainer can pick up the first part and the platform maintainer can pick up the latter part of the series
- Drop patch 09/11 because it causes some issues on systems with non-contiguous enabled sensors e.g. db410c
- Drop patch 10/11 because reg-name property isn't encouraged
- Fix a bug on msm8916 to check if IP is enabled in firmware. This was due to the register being at a different offset on msm8916. Fixed by coding this information as private data.Changes since v1:
- Split up changes that split the address space and added qcom,sensors property into two separate patches
- Remove brackets in typo correction patchAmit Kucheria (16):
thermal: tsens: Prepare 8916 and 8974 tsens to use SROT and TM address
space
thermal: tsens: Add SPDX license identifiers
thermal: tsens: Get rid of dead code
thermal: tsens: Rename map field in order to add a second address map
thermal: tsens: Add the SROT address map
MAINTAINERS: Add entry for Qualcomm TSENS thermal drivers
thermal: tsens: Pass register offsets as private data
thermal: tsens: Check if the IP is correctly enabled by firmware
arm: dts: msm8974: thermal: split address space into two
arm64: dts: msm8916: thermal: split address space into two
arm: dts: msm8974: thermal: Add "qcom,sensors" property
arm64: dts: msm8916: thermal: Add "qcom,sensors" property
dt-bindings: thermal: Fix a typo in documentation
arm64: dts: msm8916: Add gpu thermal zone
arm64: dts: msm8916: Add camera thermal zone
arm64: dts: sdm845: enable tsens thermal zones.../devicetree/bindings/thermal/thermal.txt | 2 +- MAINTAINERS | 7 + arch/arm/boot/dts/qcom-msm8974.dtsi | 6 +- arch/arm64/boot/dts/qcom/msm8916.dtsi | 47 ++++- arch/arm64/boot/dts/qcom/sdm845.dtsi | 170 ++++++++++++++++++ drivers/thermal/qcom/tsens-8916.c | 12 +- drivers/thermal/qcom/tsens-8960.c | 41 ++--- drivers/thermal/qcom/tsens-8974.c | 12 +- drivers/thermal/qcom/tsens-common.c | 62 ++++--- drivers/thermal/qcom/tsens-v2.c | 8 +- drivers/thermal/qcom/tsens.c | 19 +- drivers/thermal/qcom/tsens.h | 23 +-- 12 files changed, 309 insertions(+), 100 deletions(-)--
2.17.1
Quoted 4 lines · Amit Kucheria
This is another series of tsens cleanups before we add interrupt support. This applies on top of 4.19-rc2.
Patches [1-6] can directly be applied by Eduardo.
Patches [9-16] can directly be applied by Andy.
Eduardo,
I ACKed the DTS patches for this. Can you take 9-16 along with the 1-6 through your tree?
Thanks,
Andy
Quoted 4 lines · Andy Gross
Quoted 2 lines · Amit Kucheria
This is another series of tsens cleanups before we add interrupt support. This applies on top of 4.19-rc2.
Quoted 8 lines
Quoted 2 lines
Patches [1-6] can directly be applied by Eduardo.
Patches [9-16] can directly be applied by Andy.Eduardo,
I ACKed the DTS patches for this. Can you take 9-16 along with the 1-6 through your tree?
Thanks Andy.
Eduardo, I've send a fixup patch 07/16. If you like, I can resend the entire series
or you can find the entire series hosted with all tags applied here:
https://git.linaro.org/people/amit.kucheria/kernel.git/log/?h=up/thermal/tsens-preirq-cleanup-v4
Regards,
Amit