Skip to content

Commit

Permalink
Merge tag 'thermal-6.4-rc1' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/rafael/linux-pm

Pull thermal control updates from Rafael Wysocki:
 "These mostly continue to prepare the thermal control subsystem for
  using unified representation of trip points, which includes cleanups,
  code refactoring and similar and update several drivers (for other
  reasons), which includes new hardware support.

  Specifics:

   - Add a thermal zone 'devdata' accessor and modify several drivers to
     use it (Daniel Lezcano)

   - Prevent drivers from using the 'device' internal thermal zone
     structure field directly (Daniel Lezcano)

   - Clean up the hwmon thermal driver (Daniel Lezcano)

   - Add thermal zone id accessor and thermal zone type accessor and
     prevent drivers from using thermal zone fields directly (Daniel
     Lezcano)

   - Clean up the acerhdf and tegra thermal drivers (Daniel Lezcano)

   - Add lower bound check for sysfs input to the x86_pkg_temp_thermal
     Intel thermal driver (Zhang Rui)

   - Add more thermal zone device encapsulation: prevent setting
     structure field directly, access the sensor device instead the
     thermal zone's device for trace, relocate the traces in
     drivers/thermal (Daniel Lezcano)

   - Use the generic trip point for the i.MX and remove the
     get_trip_temp ops (Daniel Lezcano)

   - Use the devm_platform_ioremap_resource() in the Hisilicon driver
     (Yang Li)

   - Remove R-Car H3 ES1.* handling as public has only access to the ES2
     version and the upstream support for the ES1 has been shutdown
     (Wolfram Sang)

   - Add a delay after initializing the bank in order to let the time to
     the hardware to initialze itself before reading the temperature
     (Amjad Ouled-Ameur)

   - Add MT8365 support (Amjad Ouled-Ameur)

   - Preparational cleanup 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)

   - Fix a kernel NULL pointer dereference in thermal_hwmon (Zhang Rui)

   - Revert recent message adjustment in thermal_hwmon (Rafael Wysocki)

   - Use of_property_present() for testing DT property presence in
     thermal control code (Rob Herring)

   - Clean up thermal_list_lock locking in the thermal core (Rafael
     Wysocki)

   - Add DLVR support for RFIM control in the int340x Intel thermal
     driver (Srinivas Pandruvada)"

* tag 'thermal-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (55 commits)
  thermal: intel: int340x: Add DLVR support for RFIM control
  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
Linus Torvalds committed Apr 26, 2023
2 parents 4173cf6 + 5bc6b1d commit 5e0ca0b
Show file tree
Hide file tree
Showing 88 changed files with 852 additions and 721 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
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Required properties:
- "mediatek,mt7981-thermal", "mediatek,mt7986-thermal" : For MT7981 SoC
- "mediatek,mt7986-thermal" : For MT7986 SoC
- "mediatek,mt8183-thermal" : For MT8183 family of SoCs
- "mediatek,mt8365-thermal" : For MT8365 family of SoCs
- "mediatek,mt8516-thermal", "mediatek,mt2701-thermal : For MT8516 family of SoCs
- reg: Address range of the thermal controller
- interrupts: IRQ for the thermal controller
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
46 changes: 44 additions & 2 deletions Documentation/driver-api/thermal/intel_dptf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,9 @@ ABI.
DPTF Processor thermal RFIM interface
--------------------------------------------

RFIM interface allows adjustment of FIVR (Fully Integrated Voltage Regulator)
and DDR (Double Data Rate)frequencies to avoid RF interference with WiFi and 5G.
RFIM interface allows adjustment of FIVR (Fully Integrated Voltage Regulator),
DDR (Double Data Rate) and DLVR (Digital Linear Voltage Regulator)
frequencies to avoid RF interference with WiFi and 5G.

Switching voltage regulators (VR) generate radiated EMI or RFI at the
fundamental frequency and its harmonics. Some harmonics may interfere
Expand All @@ -196,6 +197,15 @@ small % and shift away the switching noise harmonic interference from
radio channels. OEM or ODMs can use the driver to control SOC IVR
operation within the range where it does not impact IVR performance.

Some products use DLVR instead of FIVR as switching voltage regulator.
In this case attributes of DLVR must be adjusted instead of FIVR.

While shifting the frequencies additional clock noise can be introduced,
which is compensated by adjusting Spread spectrum percent. This helps
to reduce the clock noise to meet regulatory compliance. This spreading
% increases bandwidth of signal transmission and hence reduces the
effects of interference, noise and signal fading.

DRAM devices of DDR IO interface and their power plane can generate EMI
at the data rates. Similar to IVR control mechanism, Intel offers a
mechanism by which DDR data rates can be changed if several conditions
Expand Down Expand Up @@ -264,6 +274,38 @@ DVFS attributes
``rfi_disable (RW)``
Disable DDR rate change feature

DLVR attributes

:file:`/sys/bus/pci/devices/0000\:00\:04.0/dlvr/`

``dlvr_hardware_rev`` (RO)
DLVR hardware revision.

``dlvr_freq_mhz`` (RO)
Current DLVR PLL frequency in MHz.

``dlvr_freq_select`` (RW)
Sets DLVR PLL clock frequency. Once set, and enabled via
dlvr_rfim_enable, the dlvr_freq_mhz will show the current
DLVR PLL frequency.

``dlvr_pll_busy`` (RO)
PLL can't accept frequency change when set.

``dlvr_rfim_enable`` (RW)
0: Disable RF frequency hopping, 1: Enable RF frequency hopping.

``dlvr_spread_spectrum_pct`` (RW)
Sets DLVR spread spectrum percent value.

``dlvr_control_mode`` (RW)
Specifies how frequencies are spread using spread spectrum.
0: Down spread,
1: Spread in the Center.

``dlvr_control_lock`` (RW)
1: future writes are ignored.

DPTF Power supply and Battery Interface
----------------------------------------

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 @@ -20816,7 +20816,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
18 changes: 9 additions & 9 deletions drivers/acpi/thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)

static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp)
{
struct acpi_thermal *tz = thermal->devdata;
struct acpi_thermal *tz = thermal_zone_device_priv(thermal);
int result;

if (!tz)
Expand All @@ -516,7 +516,7 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp)
static int thermal_get_trip_type(struct thermal_zone_device *thermal,
int trip, enum thermal_trip_type *type)
{
struct acpi_thermal *tz = thermal->devdata;
struct acpi_thermal *tz = thermal_zone_device_priv(thermal);
int i;

if (!tz || trip < 0)
Expand Down Expand Up @@ -560,7 +560,7 @@ static int thermal_get_trip_type(struct thermal_zone_device *thermal,
static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
int trip, int *temp)
{
struct acpi_thermal *tz = thermal->devdata;
struct acpi_thermal *tz = thermal_zone_device_priv(thermal);
int i;

if (!tz || trip < 0)
Expand Down Expand Up @@ -613,7 +613,7 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
int *temperature)
{
struct acpi_thermal *tz = thermal->devdata;
struct acpi_thermal *tz = thermal_zone_device_priv(thermal);

if (tz->trips.critical.flags.valid) {
*temperature = deci_kelvin_to_millicelsius_with_offset(
Expand All @@ -628,7 +628,7 @@ static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
static int thermal_get_trend(struct thermal_zone_device *thermal,
int trip, enum thermal_trend *trend)
{
struct acpi_thermal *tz = thermal->devdata;
struct acpi_thermal *tz = thermal_zone_device_priv(thermal);
enum thermal_trip_type type;
int i;

Expand Down Expand Up @@ -670,7 +670,7 @@ static int thermal_get_trend(struct thermal_zone_device *thermal,

static void acpi_thermal_zone_device_hot(struct thermal_zone_device *thermal)
{
struct acpi_thermal *tz = thermal->devdata;
struct acpi_thermal *tz = thermal_zone_device_priv(thermal);

acpi_bus_generate_netlink_event(tz->device->pnp.device_class,
dev_name(&tz->device->dev),
Expand All @@ -679,7 +679,7 @@ static void acpi_thermal_zone_device_hot(struct thermal_zone_device *thermal)

static void acpi_thermal_zone_device_critical(struct thermal_zone_device *thermal)
{
struct acpi_thermal *tz = thermal->devdata;
struct acpi_thermal *tz = thermal_zone_device_priv(thermal);

acpi_bus_generate_netlink_event(tz->device->pnp.device_class,
dev_name(&tz->device->dev),
Expand All @@ -693,7 +693,7 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
bool bind)
{
struct acpi_device *device = cdev->devdata;
struct acpi_thermal *tz = thermal->devdata;
struct acpi_thermal *tz = thermal_zone_device_priv(thermal);
struct acpi_device *dev;
acpi_handle handle;
int i;
Expand Down Expand Up @@ -842,7 +842,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
goto acpi_bus_detach;

dev_info(&tz->device->dev, "registered as thermal_zone%d\n",
tz->thermal_zone->id);
thermal_zone_device_id(tz->thermal_zone));

return 0;

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/ahci_imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ static int __sata_ahci_read_temperature(void *dev, int *temp)

static int sata_ahci_read_temperature(struct thermal_zone_device *tz, int *temp)
{
return __sata_ahci_read_temperature(tz->devdata, temp);
return __sata_ahci_read_temperature(thermal_zone_device_priv(tz), temp);
}

static ssize_t sata_ahci_show_temp(struct device *dev,
Expand Down
4 changes: 2 additions & 2 deletions drivers/hwmon/hwmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ static DEFINE_IDA(hwmon_ida);
#ifdef CONFIG_THERMAL_OF
static int hwmon_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
{
struct hwmon_thermal_data *tdata = tz->devdata;
struct hwmon_thermal_data *tdata = thermal_zone_device_priv(tz);
struct hwmon_device *hwdev = to_hwmon_device(tdata->dev);
int ret;
long t;
Expand All @@ -171,7 +171,7 @@ static int hwmon_thermal_get_temp(struct thermal_zone_device *tz, int *temp)

static int hwmon_thermal_set_trips(struct thermal_zone_device *tz, int low, int high)
{
struct hwmon_thermal_data *tdata = tz->devdata;
struct hwmon_thermal_data *tdata = thermal_zone_device_priv(tz);
struct hwmon_device *hwdev = to_hwmon_device(tdata->dev);
const struct hwmon_chip_info *chip = hwdev->chip;
const struct hwmon_channel_info * const *info = chip->info;
Expand Down
2 changes: 1 addition & 1 deletion drivers/hwmon/pmbus/pmbus_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,7 @@ struct pmbus_thermal_data {

static int pmbus_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
{
struct pmbus_thermal_data *tdata = tz->devdata;
struct pmbus_thermal_data *tdata = thermal_zone_device_priv(tz);
struct pmbus_sensor *sensor = tdata->sensor;
struct pmbus_data *pmbus_data = tdata->pmbus_data;
struct i2c_client *client = to_i2c_client(pmbus_data->dev);
Expand Down
4 changes: 2 additions & 2 deletions drivers/hwmon/scmi-hwmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ static int scmi_hwmon_thermal_get_temp(struct thermal_zone_device *tz,
{
int ret;
long value;
struct scmi_thermal_sensor *th_sensor = tz->devdata;
struct scmi_thermal_sensor *th_sensor = thermal_zone_device_priv(tz);

ret = scmi_hwmon_read_scaled_value(th_sensor->ph, th_sensor->info,
&value);
Expand Down Expand Up @@ -220,7 +220,7 @@ static int scmi_thermal_sensor_register(struct device *dev,
sensor->name);
} else {
dev_dbg(dev, "Sensor '%s' attached to thermal zone ID:%d\n",
sensor->name, tzd->id);
sensor->name, thermal_zone_device_id(tzd));
}

return 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/hwmon/scpi-hwmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static void scpi_scale_reading(u64 *value, struct sensor_data *sensor)

static int scpi_read_temp(struct thermal_zone_device *tz, int *temp)
{
struct scpi_thermal_zone *zone = tz->devdata;
struct scpi_thermal_zone *zone = thermal_zone_device_priv(tz);
struct scpi_sensors *scpi_sensors = zone->scpi_sensors;
struct scpi_ops *scpi_ops = scpi_sensors->scpi_ops;
struct sensor_data *sensor = &scpi_sensors->data[zone->sensor_id];
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/adc/sun4i-gpadc-iio.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ static int sun4i_gpadc_runtime_resume(struct device *dev)

static int sun4i_gpadc_get_temp(struct thermal_zone_device *tz, int *temp)
{
struct sun4i_gpadc_iio *info = tz->devdata;
struct sun4i_gpadc_iio *info = thermal_zone_device_priv(tz);
int val, scale, offset;

if (sun4i_gpadc_temp_read(info->indio_dev, &val))
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/touchscreen/sun4i-ts.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ static int sun4i_get_temp(const struct sun4i_ts_data *ts, int *temp)

static int sun4i_get_tz_temp(struct thermal_zone_device *tz, int *temp)
{
return sun4i_get_temp(tz->devdata, temp);
return sun4i_get_temp(thermal_zone_device_priv(tz), temp);
}

static const struct thermal_zone_device_ops sun4i_ts_tz_ops = {
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
static int cxgb4_thermal_get_temp(struct thermal_zone_device *tzdev,
int *temp)
{
struct adapter *adap = tzdev->devdata;
struct adapter *adap = thermal_zone_device_priv(tzdev);
u32 param, val;
int ret;

Expand Down
Loading

0 comments on commit 5e0ca0b

Please sign in to comment.