Skip to content

Commit

Permalink
Merge tag 'thermal-v6.4-rc1-2' of ssh://gitolite.kernel.org/pub/scm/l…
Browse files Browse the repository at this point in the history
…inux/kernel/git/thermal/linux

Pull more thermal control changes for 6.4-rc1 from Daniel Lezcano:

"- Do preparating cleaning and DT bindings for RK3588 support
   (Sebastian Reichel)

 - Add driver support for RK3588 (Finley Xiao)

 - Use devm_reset_control_array_get_exclusive() for the Rockchip driver
   (Ye Xingchen)

 - Detect power gated thermal zones and return -EAGAIN when reading the
   temperature (Mikko Perttunen)

 - Remove thermal_bind_params structure as it is unused (Zhang Rui)

 - Drop unneeded quotes in DT bindings allowing to run yamllint (Rob
   Herring)

 - Update the power allocator documentation according to the thermal
   trace relocation (Lukas Bulwahn)

 - Fix sensor 1 interrupt status bitmask for the Mediatek LVTS sensor
   (Chen-Yu Tsai)

 - Use the dev_err_probe() helper in the Amlogic driver (Ye Xingchen)

 - Add AP domain support to LVTS thermal controllers for mt8195
   (Balsam CHIHI)

 - Remove buggy call to thermal_of_zone_unregister() (Daniel Lezcano)

 - Make thermal_of_zone_[un]register() private to the thermal OF code
   (Daniel Lezcano)

 - Create a private copy of the thermal zone device parameters
   structure when registering a thermal zone (Daniel Lezcano)"

* tag 'thermal-v6.4-rc1-2' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/thermal/linux:
  thermal/core: Alloc-copy-free the thermal zone parameters structure
  thermal/of: Unexport unused OF functions
  thermal/drivers/bcm2835: Remove buggy call to thermal_of_zone_unregister
  thermal/drivers/mediatek/lvts_thermal: Add AP domain for mt8195
  dt-bindings: thermal: mediatek: Add AP domain to LVTS thermal controllers for mt8195
  thermal: amlogic: Use dev_err_probe()
  thermal/drivers/mediatek/lvts_thermal: Fix sensor 1 interrupt status bitmask
  MAINTAINERS: adjust entry in THERMAL/POWER_ALLOCATOR after header movement
  dt-bindings: thermal: Drop unneeded quotes
  thermal/core: Remove thermal_bind_params structure
  thermal/drivers/tegra-bpmp: Handle offline zones
  thermal/drivers/rockchip: use devm_reset_control_array_get_exclusive()
  dt-bindings: rockchip-thermal: Support the RK3588 SoC compatible
  thermal/drivers/rockchip: Support RK3588 SoC in the thermal driver
  thermal/drivers/rockchip: Support dynamic sized sensor array
  thermal/drivers/rockchip: Simplify channel id logic
  thermal/drivers/rockchip: Use dev_err_probe
  thermal/drivers/rockchip: Simplify clock logic
  thermal/drivers/rockchip: Simplify getting match data
  • Loading branch information
Rafael J. Wysocki committed Apr 17, 2023
2 parents cfeeb7d + 3d439b1 commit 51699e4
Show file tree
Hide file tree
Showing 15 changed files with 358 additions and 356 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ properties:

amlogic,ao-secure:
description: phandle to the ao-secure syscon
$ref: '/schemas/types.yaml#/definitions/phandle'
$ref: /schemas/types.yaml#/definitions/phandle

'#thermal-sensor-cells':
const: 0
Expand Down
4 changes: 2 additions & 2 deletions Documentation/devicetree/bindings/thermal/imx-thermal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ properties:
- const: temp_grade

fsl,tempmon:
$ref: '/schemas/types.yaml#/definitions/phandle'
$ref: /schemas/types.yaml#/definitions/phandle
description: Phandle to anatop system controller node.

fsl,tempmon-data:
$ref: '/schemas/types.yaml#/definitions/phandle'
$ref: /schemas/types.yaml#/definitions/phandle
description: |
Deprecated property, phandle pointer to fuse controller that contains
TEMPMON calibration data, e.g. OCOTP on imx6q. The details about
Expand Down
4 changes: 2 additions & 2 deletions Documentation/devicetree/bindings/thermal/qoriq-thermal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ properties:
maxItems: 1

fsl,tmu-range:
$ref: '/schemas/types.yaml#/definitions/uint32-array'
$ref: /schemas/types.yaml#/definitions/uint32-array
description: |
The values to be programmed into TTRnCR, as specified by the SoC
reference manual. The first cell is TTR0CR, the second is TTR1CR, etc.
maxItems: 4

fsl,tmu-calibration:
$ref: '/schemas/types.yaml#/definitions/uint32-matrix'
$ref: /schemas/types.yaml#/definitions/uint32-matrix
description: |
A list of cell pairs containing temperature calibration data, as
specified by the SoC reference manual. The first cell of each pair
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ properties:
- rockchip,rk3368-tsadc
- rockchip,rk3399-tsadc
- rockchip,rk3568-tsadc
- rockchip,rk3588-tsadc
- rockchip,rv1108-tsadc

reg:
Expand Down
40 changes: 0 additions & 40 deletions Documentation/driver-api/thermal/sysfs-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -304,42 +304,6 @@ temperature) and throttle appropriate devices.
1.4 Thermal Zone Parameters
---------------------------

::

struct thermal_bind_params

This structure defines the following parameters that are used to bind
a zone with a cooling device for a particular trip point.

.cdev:
The cooling device pointer
.weight:
The 'influence' of a particular cooling device on this
zone. This is relative to the rest of the cooling
devices. For example, if all cooling devices have a
weight of 1, then they all contribute the same. You can
use percentages if you want, but it's not mandatory. A
weight of 0 means that this cooling device doesn't
contribute to the cooling of this zone unless all cooling
devices have a weight of 0. If all weights are 0, then
they all contribute the same.
.trip_mask:
This is a bit mask that gives the binding relation between
this thermal zone and cdev, for a particular trip point.
If nth bit is set, then the cdev and thermal zone are bound
for trip point n.
.binding_limits:
This is an array of cooling state limits. Must have
exactly 2 * thermal_zone.number_of_trip_points. It is an
array consisting of tuples <lower-state upper-state> of
state limits. Each trip will be associated with one state
limit tuple when binding. A NULL pointer means
<THERMAL_NO_LIMITS THERMAL_NO_LIMITS> on all trips.
These limits are used when binding a cdev to a trip point.
.match:
This call back returns success(0) if the 'tz and cdev' need to
be bound, as per platform data.

::

struct thermal_zone_params
Expand All @@ -357,10 +321,6 @@ temperature) and throttle appropriate devices.
will be created. when no_hwmon == true, nothing will be done.
In case the thermal_zone_params is NULL, the hwmon interface
will be created (for backward compatibility).
.num_tbps:
Number of thermal_bind_params entries for this zone
.tbp:
thermal_bind_params entries

2. sysfs attributes structure
=============================
Expand Down
2 changes: 1 addition & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -20771,7 +20771,7 @@ L: linux-pm@vger.kernel.org
S: Maintained
F: Documentation/driver-api/thermal/power_allocator.rst
F: drivers/thermal/gov_power_allocator.c
F: include/trace/events/thermal_power_allocator.h
F: drivers/thermal/thermal_trace_ipa.h

THINKPAD ACPI EXTRAS DRIVER
M: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Expand Down
7 changes: 2 additions & 5 deletions drivers/thermal/amlogic_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,8 @@ static int amlogic_thermal_probe(struct platform_device *pdev)
return PTR_ERR(pdata->regmap);

pdata->clk = devm_clk_get(dev, NULL);
if (IS_ERR(pdata->clk)) {
if (PTR_ERR(pdata->clk) != -EPROBE_DEFER)
dev_err(dev, "failed to get clock\n");
return PTR_ERR(pdata->clk);
}
if (IS_ERR(pdata->clk))
return dev_err_probe(dev, PTR_ERR(pdata->clk), "failed to get clock\n");

pdata->sec_ao_map = syscon_regmap_lookup_by_phandle
(pdev->dev.of_node, "amlogic,ao-secure");
Expand Down
4 changes: 1 addition & 3 deletions drivers/thermal/broadcom/bcm2835_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)

return 0;
err_tz:
thermal_of_zone_unregister(tz);
devm_thermal_of_zone_unregister(&pdev->dev, tz);
err_clk:
clk_disable_unprepare(data->clk);

Expand All @@ -285,10 +285,8 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
static int bcm2835_thermal_remove(struct platform_device *pdev)
{
struct bcm2835_thermal_data *data = platform_get_drvdata(pdev);
struct thermal_zone_device *tz = data->tz;

debugfs_remove_recursive(data->debugfsdir);
thermal_of_zone_unregister(tz);
clk_disable_unprepare(data->clk);

return 0;
Expand Down
100 changes: 77 additions & 23 deletions drivers/thermal/mediatek/lvts_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
#define LVTS_MONINT_CONF 0x9FBF7BDE

#define LVTS_INT_SENSOR0 0x0009001F
#define LVTS_INT_SENSOR1 0X000881F0
#define LVTS_INT_SENSOR1 0x001203E0
#define LVTS_INT_SENSOR2 0x00247C00
#define LVTS_INT_SENSOR3 0x1FC00000

Expand Down Expand Up @@ -395,8 +395,8 @@ static irqreturn_t lvts_ctrl_irq_handler(struct lvts_ctrl *lvts_ctrl)
* => 0x1FC00000
* sensor 2 interrupt: 0000 0000 0010 0100 0111 1100 0000 0000
* => 0x00247C00
* sensor 1 interrupt: 0000 0000 0001 0001 0000 0011 1110 0000
* => 0X000881F0
* sensor 1 interrupt: 0000 0000 0001 0010 0000 0011 1110 0000
* => 0X001203E0
* sensor 0 interrupt: 0000 0000 0000 1001 0000 0000 0001 1111
* => 0x0009001F
*/
Expand Down Expand Up @@ -530,29 +530,33 @@ static int lvts_sensor_init(struct device *dev, struct lvts_ctrl *lvts_ctrl,
* The efuse blob values follows the sensor enumeration per thermal
* controller. The decoding of the stream is as follow:
*
* <--?-> <----big0 ???---> <-sensor0-> <-0->
* ------------------------------------------
* index in the stream: : | 0x0 | 0x1 | 0x2 | 0x3 | 0x4 | 0x5 | 0x6 |
* ------------------------------------------
* stream index map for MCU Domain :
*
* <--sensor1--><-0-> <----big1 ???---> <-sen
* ------------------------------------------
* | 0x7 | 0x8 | 0x9 | 0xA | 0xB | OxC | OxD |
* ------------------------------------------
* <-----mcu-tc#0-----> <-----sensor#0-----> <-----sensor#1----->
* 0x01 | 0x02 | 0x03 | 0x04 | 0x05 | 0x06 | 0x07 | 0x08 | 0x09
*
* sor0-> <-0-> <-sensor1-> <-0-> ..........
* ------------------------------------------
* | 0x7 | 0x8 | 0x9 | 0xA | 0xB | OxC | OxD |
* ------------------------------------------
* <-----mcu-tc#1-----> <-----sensor#2-----> <-----sensor#3----->
* 0x0A | 0x0B | 0x0C | 0x0D | 0x0E | 0x0F | 0x10 | 0x11 | 0x12
*
* And so on ...
* <-----mcu-tc#2-----> <-----sensor#4-----> <-----sensor#5-----> <-----sensor#6-----> <-----sensor#7----->
* 0x13 | 0x14 | 0x15 | 0x16 | 0x17 | 0x18 | 0x19 | 0x1A | 0x1B | 0x1C | 0x1D | 0x1E | 0x1F | 0x20 | 0x21
*
* stream index map for AP Domain :
*
* <-----ap--tc#0-----> <-----sensor#0-----> <-----sensor#1----->
* 0x22 | 0x23 | 0x24 | 0x25 | 0x26 | 0x27 | 0x28 | 0x29 | 0x2A
*
* <-----ap--tc#1-----> <-----sensor#2-----> <-----sensor#3----->
* 0x2B | 0x2C | 0x2D | 0x2E | 0x2F | 0x30 | 0x31 | 0x32 | 0x33
*
* <-----ap--tc#2-----> <-----sensor#4-----> <-----sensor#5-----> <-----sensor#6----->
* 0x34 | 0x35 | 0x36 | 0x37 | 0x38 | 0x39 | 0x3A | 0x3B | 0x3C | 0x3D | 0x3E | 0x3F
*
* <-----ap--tc#3-----> <-----sensor#7-----> <-----sensor#8----->
* 0x40 | 0x41 | 0x42 | 0x43 | 0x44 | 0x45 | 0x46 | 0x47 | 0x48
*
* The data description gives the offset of the calibration data in
* this bytes stream for each sensor.
*
* Each thermal controller can handle up to 4 sensors max, we don't
* care if there are less as the array of calibration is sized to 4
* anyway. The unused sensor slot will be zeroed.
*/
static int lvts_calibration_init(struct device *dev, struct lvts_ctrl *lvts_ctrl,
const struct lvts_ctrl_data *lvts_ctrl_data,
Expand Down Expand Up @@ -1165,7 +1169,7 @@ static int lvts_remove(struct platform_device *pdev)
return 0;
}

static const struct lvts_ctrl_data mt8195_lvts_data_ctrl[] = {
static const struct lvts_ctrl_data mt8195_lvts_mcu_data_ctrl[] = {
{
.cal_offset = { 0x04, 0x07 },
.lvts_sensor = {
Expand Down Expand Up @@ -1200,13 +1204,63 @@ static const struct lvts_ctrl_data mt8195_lvts_data_ctrl[] = {
}
};

static const struct lvts_ctrl_data mt8195_lvts_ap_data_ctrl[] = {
{
.cal_offset = { 0x25, 0x28 },
.lvts_sensor = {
{ .dt_id = MT8195_AP_VPU0 },
{ .dt_id = MT8195_AP_VPU1 }
},
.num_lvts_sensor = 2,
.offset = 0x0,
.hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8195,
},
{
.cal_offset = { 0x2e, 0x31 },
.lvts_sensor = {
{ .dt_id = MT8195_AP_GPU0 },
{ .dt_id = MT8195_AP_GPU1 }
},
.num_lvts_sensor = 2,
.offset = 0x100,
.hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8195,
},
{
.cal_offset = { 0x37, 0x3a, 0x3d },
.lvts_sensor = {
{ .dt_id = MT8195_AP_VDEC },
{ .dt_id = MT8195_AP_IMG },
{ .dt_id = MT8195_AP_INFRA },
},
.num_lvts_sensor = 3,
.offset = 0x200,
.hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8195,
},
{
.cal_offset = { 0x43, 0x46 },
.lvts_sensor = {
{ .dt_id = MT8195_AP_CAM0 },
{ .dt_id = MT8195_AP_CAM1 }
},
.num_lvts_sensor = 2,
.offset = 0x300,
.hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8195,
}
};

static const struct lvts_data mt8195_lvts_mcu_data = {
.lvts_ctrl = mt8195_lvts_data_ctrl,
.num_lvts_ctrl = ARRAY_SIZE(mt8195_lvts_data_ctrl),
.lvts_ctrl = mt8195_lvts_mcu_data_ctrl,
.num_lvts_ctrl = ARRAY_SIZE(mt8195_lvts_mcu_data_ctrl),
};

static const struct lvts_data mt8195_lvts_ap_data = {
.lvts_ctrl = mt8195_lvts_ap_data_ctrl,
.num_lvts_ctrl = ARRAY_SIZE(mt8195_lvts_ap_data_ctrl),
};

static const struct of_device_id lvts_of_match[] = {
{ .compatible = "mediatek,mt8195-lvts-mcu", .data = &mt8195_lvts_mcu_data },
{ .compatible = "mediatek,mt8195-lvts-ap", .data = &mt8195_lvts_ap_data },
{},
};
MODULE_DEVICE_TABLE(of, lvts_of_match);
Expand Down
Loading

0 comments on commit 51699e4

Please sign in to comment.