mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
Merge tag 'thermal-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull thermal control updates from Rafael Wysocki:
"These add a thermal library and thermal tools to wrap the netlink
interface into event-based callbacks, improve overheat condition
handling during suspend-to-idle on Intel SoCs, add some new hardware
support, fix bugs and clean up code.
Specifics:
- Add thermal library and thermal tools to encapsulate the netlink
into event based callbacks (Daniel Lezcano, Jiapeng Chong).
- Improve overheat condition handling during suspend-to-idle in the
Intel PCH thermal driver (Zhang Rui).
- Use local ops instead of global ops in devfreq_cooling (Kant Fan).
- Clean up _OSC handling in int340x (Davidlohr Bueso).
- Switch hisi_termal from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
(Hesham Almatary).
- Add new k3 j72xx bangdap driver and the corresponding bindings
(Keerthy).
- Fix missing of_node_put() in the SC iMX driver at probe time
(Miaoqian Lin).
- Fix memory leak in __thermal_cooling_device_register()
when device_register() fails by calling
thermal_cooling_device_destroy_sysfs() (Yang Yingliang).
- Add sc8180x and sc8280xp compatible string in the DT bindings and
lMH support for QCom tsens driver (Bjorn Andersson).
- Fix OTP Calibration Register values conforming to the documentation
on RZ/G2L and bindings documentation for RZ/G2UL (Biju Das).
- Fix type in kerneldoc description for __thermal_bind_params
(Corentin Labbe).
- Fix potential NULL dereference in sr_thermal_probe() on Broadcom
platform (Zheng Yongjun).
- Add change mode ops to the thermal-of sensor (Manaf Meethalavalappu
Pallikunhi).
- Fix non-negative value support by preventing the value to be clamp
to zero (Stefan Wahren).
- Add compatible string and DT bindings for MSM8960 tsens driver
(Dmitry Baryshkov).
- Add hwmon support for K3 driver (Massimiliano Minella).
- Refactor and add multiple generations support for QCom ADC driver
(Jishnu Prakash).
- Use platform_get_irq_optional() to get the interrupt on RCar driver
and document Document RZ/V2L bindings (Lad Prabhakar).
- Remove NULL check after container_of() call from the Intel HFI
thermal driver (Haowen Bai)"
* tag 'thermal-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (38 commits)
thermal: intel: pch: improve the cooling delay log
thermal: intel: pch: enhance overheat handling
thermal: intel: pch: move cooling delay to suspend_noirq phase
PM: wakeup: expose pm_wakeup_pending to modules
thermal: k3_j72xx_bandgap: Add the bandgap driver support
dt-bindings: thermal: k3-j72xx: Add VTM bindings documentation
thermal/drivers/imx_sc_thermal: Fix refcount leak in imx_sc_thermal_probe
thermal/core: Fix memory leak in __thermal_cooling_device_register()
dt-bindings: thermal: tsens: Add sc8280xp compatible
dt-bindings: thermal: lmh: Add Qualcomm sc8180x compatible
thermal/drivers/qcom/lmh: Add sc8180x compatible
thermal/drivers/rz2gl: Fix OTP Calibration Register values
dt-bindings: thermal: rzg2l-thermal: Document RZ/G2UL bindings
thermal: thermal_of: fix typo on __thermal_bind_params
tools/thermal: remove unneeded semicolon
tools/lib/thermal: remove unneeded semicolon
thermal/drivers/broadcom: Fix potential NULL dereference in sr_thermal_probe
tools/thermal: Add thermal daemon skeleton
tools/thermal: Add a temperature capture tool
tools/thermal: Add util library
...
This commit is contained in:
@@ -18,6 +18,7 @@ description:
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- qcom,sc8180x-lmh
|
||||
- qcom,sdm845-lmh
|
||||
- qcom,sm8150-lmh
|
||||
|
||||
|
||||
@@ -10,7 +10,9 @@ maintainers:
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
const: qcom,spmi-adc-tm5
|
||||
enum:
|
||||
- qcom,spmi-adc-tm5
|
||||
- qcom,spmi-adc-tm5-gen2
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
@@ -33,6 +35,7 @@ properties:
|
||||
qcom,avg-samples:
|
||||
$ref: /schemas/types.yaml#/definitions/uint32
|
||||
description: Number of samples to be used for measurement.
|
||||
Not applicable for Gen2 ADC_TM peripheral.
|
||||
enum:
|
||||
- 1
|
||||
- 2
|
||||
@@ -45,6 +48,7 @@ properties:
|
||||
$ref: /schemas/types.yaml#/definitions/uint32
|
||||
description: This parameter is used to decrease ADC sampling rate.
|
||||
Quicker measurements can be made by reducing decimation ratio.
|
||||
Not applicable for Gen2 ADC_TM peripheral.
|
||||
enum:
|
||||
- 250
|
||||
- 420
|
||||
@@ -93,6 +97,29 @@ patternProperties:
|
||||
- const: 1
|
||||
- enum: [ 1, 3, 4, 6, 20, 8, 10 ]
|
||||
|
||||
qcom,avg-samples:
|
||||
$ref: /schemas/types.yaml#/definitions/uint32
|
||||
description: Number of samples to be used for measurement.
|
||||
This property in child node is applicable only for Gen2 ADC_TM peripheral.
|
||||
enum:
|
||||
- 1
|
||||
- 2
|
||||
- 4
|
||||
- 8
|
||||
- 16
|
||||
default: 1
|
||||
|
||||
qcom,decimation:
|
||||
$ref: /schemas/types.yaml#/definitions/uint32
|
||||
description: This parameter is used to decrease ADC sampling rate.
|
||||
Quicker measurements can be made by reducing decimation ratio.
|
||||
This property in child node is applicable only for Gen2 ADC_TM peripheral.
|
||||
enum:
|
||||
- 85
|
||||
- 340
|
||||
- 1360
|
||||
default: 1360
|
||||
|
||||
required:
|
||||
- reg
|
||||
- io-channels
|
||||
@@ -100,6 +127,31 @@ patternProperties:
|
||||
additionalProperties:
|
||||
false
|
||||
|
||||
allOf:
|
||||
- if:
|
||||
properties:
|
||||
compatible:
|
||||
contains:
|
||||
const: qcom,spmi-adc-tm5
|
||||
|
||||
then:
|
||||
patternProperties:
|
||||
"^([-a-z0-9]*)@[0-7]$":
|
||||
properties:
|
||||
qcom,decimation: false
|
||||
qcom,avg-samples: false
|
||||
|
||||
- if:
|
||||
properties:
|
||||
compatible:
|
||||
contains:
|
||||
const: qcom,spmi-adc-tm5-gen2
|
||||
|
||||
then:
|
||||
properties:
|
||||
qcom,avg-samples: false
|
||||
qcom,decimation: false
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
@@ -124,7 +176,7 @@ examples:
|
||||
#size-cells = <0>;
|
||||
#io-channel-cells = <1>;
|
||||
|
||||
/* Other propreties are omitted */
|
||||
/* Other properties are omitted */
|
||||
conn-therm@4f {
|
||||
reg = <ADC5_AMUX_THM3_100K_PU>;
|
||||
qcom,ratiometric;
|
||||
@@ -148,4 +200,58 @@ examples:
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
- |
|
||||
#include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h>
|
||||
#include <dt-bindings/iio/qcom,spmi-adc7-pm8350.h>
|
||||
#include <dt-bindings/interrupt-controller/irq.h>
|
||||
spmi_bus {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
pmk8350_vadc: adc@3100 {
|
||||
reg = <0x3100>;
|
||||
compatible = "qcom,spmi-adc7";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
#io-channel-cells = <1>;
|
||||
|
||||
/* Other properties are omitted */
|
||||
xo-therm@44 {
|
||||
reg = <PMK8350_ADC7_AMUX_THM1_100K_PU>;
|
||||
qcom,ratiometric;
|
||||
qcom,hw-settle-time = <200>;
|
||||
};
|
||||
|
||||
conn-therm@47 {
|
||||
reg = <PM8350_ADC7_AMUX_THM4_100K_PU>;
|
||||
qcom,ratiometric;
|
||||
qcom,hw-settle-time = <200>;
|
||||
};
|
||||
};
|
||||
|
||||
pmk8350_adc_tm: adc-tm@3400 {
|
||||
compatible = "qcom,spmi-adc-tm5-gen2";
|
||||
reg = <0x3400>;
|
||||
interrupts = <0x0 0x34 0x0 IRQ_TYPE_EDGE_RISING>;
|
||||
#thermal-sensor-cells = <1>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
pmk8350-xo-therm@0 {
|
||||
reg = <0>;
|
||||
io-channels = <&pmk8350_vadc PMK8350_ADC7_AMUX_THM1_100K_PU>;
|
||||
qcom,decimation = <340>;
|
||||
qcom,ratiometric;
|
||||
qcom,hw-settle-time-us = <200>;
|
||||
};
|
||||
|
||||
conn-therm@1 {
|
||||
reg = <1>;
|
||||
io-channels = <&pmk8350_vadc PM8350_ADC7_AMUX_THM4_100K_PU>;
|
||||
qcom,avg-samples = <2>;
|
||||
qcom,ratiometric;
|
||||
qcom,hw-settle-time-us = <200>;
|
||||
};
|
||||
};
|
||||
};
|
||||
...
|
||||
|
||||
@@ -19,10 +19,11 @@ description: |
|
||||
properties:
|
||||
compatible:
|
||||
oneOf:
|
||||
- description: msm9860 TSENS based
|
||||
- description: msm8960 TSENS based
|
||||
items:
|
||||
- enum:
|
||||
- qcom,ipq8064-tsens
|
||||
- qcom,msm8960-tsens
|
||||
|
||||
- description: v0.1 of TSENS
|
||||
items:
|
||||
@@ -49,6 +50,7 @@ properties:
|
||||
- qcom,sc7180-tsens
|
||||
- qcom,sc7280-tsens
|
||||
- qcom,sc8180x-tsens
|
||||
- qcom,sc8280xp-tsens
|
||||
- qcom,sdm630-tsens
|
||||
- qcom,sdm845-tsens
|
||||
- qcom,sm8150-tsens
|
||||
@@ -116,6 +118,7 @@ allOf:
|
||||
- qcom,ipq8064-tsens
|
||||
- qcom,mdm9607-tsens
|
||||
- qcom,msm8916-tsens
|
||||
- qcom,msm8960-tsens
|
||||
- qcom,msm8974-tsens
|
||||
- qcom,msm8976-tsens
|
||||
- qcom,qcs404-tsens
|
||||
|
||||
@@ -17,7 +17,9 @@ properties:
|
||||
compatible:
|
||||
items:
|
||||
- enum:
|
||||
- renesas,r9a07g043-tsu # RZ/G2UL
|
||||
- renesas,r9a07g044-tsu # RZ/G2{L,LC}
|
||||
- renesas,r9a07g054-tsu # RZ/V2L
|
||||
- const: renesas,rzg2l-tsu
|
||||
|
||||
reg:
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/thermal/ti,j72xx-thermal.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: Texas Instruments J72XX VTM (DTS) binding
|
||||
|
||||
maintainers:
|
||||
- Keerthy <j-keerthy@ti.com>
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- ti,j721e-vtm
|
||||
- ti,j7200-vtm
|
||||
|
||||
reg:
|
||||
items:
|
||||
- description: VTM cfg1 register space
|
||||
- description: VTM cfg2 register space
|
||||
- description: VTM efuse register space
|
||||
|
||||
power-domains:
|
||||
maxItems: 1
|
||||
|
||||
"#thermal-sensor-cells":
|
||||
const: 1
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
- power-domains
|
||||
- "#thermal-sensor-cells"
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
#include <dt-bindings/soc/ti,sci_pm_domain.h>
|
||||
wkup_vtm0: thermal-sensor@42040000 {
|
||||
compatible = "ti,j721e-vtm";
|
||||
reg = <0x42040000 0x350>,
|
||||
<0x42050000 0x350>,
|
||||
<0x43000300 0x10>;
|
||||
power-domains = <&k3_pds 154 TI_SCI_PD_EXCLUSIVE>;
|
||||
#thermal-sensor-cells = <1>;
|
||||
};
|
||||
|
||||
mpu_thermal: mpu-thermal {
|
||||
polling-delay-passive = <250>; /* milliseconds */
|
||||
polling-delay = <500>; /* milliseconds */
|
||||
thermal-sensors = <&wkup_vtm0 0>;
|
||||
|
||||
trips {
|
||||
mpu_crit: mpu-crit {
|
||||
temperature = <125000>; /* milliCelsius */
|
||||
hysteresis = <2000>; /* milliCelsius */
|
||||
type = "critical";
|
||||
};
|
||||
};
|
||||
};
|
||||
...
|
||||
@@ -19589,6 +19589,7 @@ F: drivers/thermal/
|
||||
F: include/linux/cpu_cooling.h
|
||||
F: include/linux/thermal.h
|
||||
F: include/uapi/linux/thermal.h
|
||||
F: tools/lib/thermal/
|
||||
F: tools/thermal/
|
||||
|
||||
THERMAL DRIVER FOR AMLOGIC SOCS
|
||||
|
||||
@@ -930,6 +930,7 @@ bool pm_wakeup_pending(void)
|
||||
|
||||
return ret || atomic_read(&pm_abort_suspend) > 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pm_wakeup_pending);
|
||||
|
||||
void pm_system_wakeup(void)
|
||||
{
|
||||
|
||||
@@ -677,6 +677,17 @@ u16 qcom_adc_tm5_temp_volt_scale(unsigned int prescale_ratio,
|
||||
}
|
||||
EXPORT_SYMBOL(qcom_adc_tm5_temp_volt_scale);
|
||||
|
||||
u16 qcom_adc_tm5_gen2_temp_res_scale(int temp)
|
||||
{
|
||||
int64_t resistance;
|
||||
|
||||
resistance = qcom_vadc_map_temp_voltage(adcmap7_100k,
|
||||
ARRAY_SIZE(adcmap7_100k), temp);
|
||||
|
||||
return div64_s64(resistance * RATIO_MAX_ADC7, resistance + R_PU_100K);
|
||||
}
|
||||
EXPORT_SYMBOL(qcom_adc_tm5_gen2_temp_res_scale);
|
||||
|
||||
int qcom_adc5_hw_scale(enum vadc_scale_fn_type scaletype,
|
||||
unsigned int prescale_ratio,
|
||||
const struct adc5_data *data,
|
||||
|
||||
@@ -28,7 +28,7 @@ thermal_sys-$(CONFIG_CPU_IDLE_THERMAL) += cpuidle_cooling.o
|
||||
# devfreq cooling
|
||||
thermal_sys-$(CONFIG_DEVFREQ_THERMAL) += devfreq_cooling.o
|
||||
|
||||
obj-$(CONFIG_K3_THERMAL) += k3_bandgap.o
|
||||
obj-$(CONFIG_K3_THERMAL) += k3_bandgap.o k3_j72xx_bandgap.o
|
||||
# platform thermal drivers
|
||||
obj-y += broadcom/
|
||||
obj-$(CONFIG_THERMAL_MMIO) += thermal_mmio.o
|
||||
|
||||
@@ -38,7 +38,6 @@ static int bcm2711_get_temp(void *data, int *temp)
|
||||
int offset = thermal_zone_get_offset(priv->thermal);
|
||||
u32 val;
|
||||
int ret;
|
||||
long t;
|
||||
|
||||
ret = regmap_read(priv->regmap, AVS_RO_TEMP_STATUS, &val);
|
||||
if (ret)
|
||||
@@ -50,9 +49,7 @@ static int bcm2711_get_temp(void *data, int *temp)
|
||||
val &= AVS_RO_TEMP_STATUS_DATA_MSK;
|
||||
|
||||
/* Convert a HW code to a temperature reading (millidegree celsius) */
|
||||
t = slope * val + offset;
|
||||
|
||||
*temp = t < 0 ? 0 : t;
|
||||
*temp = slope * val + offset;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -60,6 +60,9 @@ static int sr_thermal_probe(struct platform_device *pdev)
|
||||
return -ENOMEM;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!res)
|
||||
return -ENOENT;
|
||||
|
||||
sr_thermal->regs = (void __iomem *)devm_memremap(&pdev->dev, res->start,
|
||||
resource_size(res),
|
||||
MEMREMAP_WB);
|
||||
|
||||
@@ -359,22 +359,29 @@ of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
|
||||
struct device *dev = df->dev.parent;
|
||||
struct devfreq_cooling_device *dfc;
|
||||
struct em_perf_domain *em;
|
||||
struct thermal_cooling_device_ops *ops;
|
||||
char *name;
|
||||
int err, num_opps;
|
||||
|
||||
dfc = kzalloc(sizeof(*dfc), GFP_KERNEL);
|
||||
if (!dfc)
|
||||
ops = kmemdup(&devfreq_cooling_ops, sizeof(*ops), GFP_KERNEL);
|
||||
if (!ops)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
dfc = kzalloc(sizeof(*dfc), GFP_KERNEL);
|
||||
if (!dfc) {
|
||||
err = -ENOMEM;
|
||||
goto free_ops;
|
||||
}
|
||||
|
||||
dfc->devfreq = df;
|
||||
|
||||
em = em_pd_get(dev);
|
||||
if (em && !em_is_artificial(em)) {
|
||||
dfc->em_pd = em;
|
||||
devfreq_cooling_ops.get_requested_power =
|
||||
ops->get_requested_power =
|
||||
devfreq_cooling_get_requested_power;
|
||||
devfreq_cooling_ops.state2power = devfreq_cooling_state2power;
|
||||
devfreq_cooling_ops.power2state = devfreq_cooling_power2state;
|
||||
ops->state2power = devfreq_cooling_state2power;
|
||||
ops->power2state = devfreq_cooling_power2state;
|
||||
|
||||
dfc->power_ops = dfc_power;
|
||||
|
||||
@@ -409,8 +416,7 @@ of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
|
||||
if (!name)
|
||||
goto remove_qos_req;
|
||||
|
||||
cdev = thermal_of_cooling_device_register(np, name, dfc,
|
||||
&devfreq_cooling_ops);
|
||||
cdev = thermal_of_cooling_device_register(np, name, dfc, ops);
|
||||
kfree(name);
|
||||
|
||||
if (IS_ERR(cdev)) {
|
||||
@@ -431,6 +437,8 @@ free_table:
|
||||
kfree(dfc->freq_table);
|
||||
free_dfc:
|
||||
kfree(dfc);
|
||||
free_ops:
|
||||
kfree(ops);
|
||||
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
@@ -512,11 +520,13 @@ EXPORT_SYMBOL_GPL(devfreq_cooling_em_register);
|
||||
void devfreq_cooling_unregister(struct thermal_cooling_device *cdev)
|
||||
{
|
||||
struct devfreq_cooling_device *dfc;
|
||||
const struct thermal_cooling_device_ops *ops;
|
||||
struct device *dev;
|
||||
|
||||
if (IS_ERR_OR_NULL(cdev))
|
||||
return;
|
||||
|
||||
ops = cdev->ops;
|
||||
dfc = cdev->devdata;
|
||||
dev = dfc->devfreq->dev.parent;
|
||||
|
||||
@@ -527,5 +537,6 @@ void devfreq_cooling_unregister(struct thermal_cooling_device *cdev)
|
||||
|
||||
kfree(dfc->freq_table);
|
||||
kfree(dfc);
|
||||
kfree(ops);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(devfreq_cooling_unregister);
|
||||
|
||||
@@ -629,7 +629,6 @@ static int hisi_thermal_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int hisi_thermal_suspend(struct device *dev)
|
||||
{
|
||||
struct hisi_thermal_data *data = dev_get_drvdata(dev);
|
||||
@@ -651,15 +650,14 @@ static int hisi_thermal_resume(struct device *dev)
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(hisi_thermal_pm_ops,
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(hisi_thermal_pm_ops,
|
||||
hisi_thermal_suspend, hisi_thermal_resume);
|
||||
|
||||
static struct platform_driver hisi_thermal_driver = {
|
||||
.driver = {
|
||||
.name = "hisi_thermal",
|
||||
.pm = &hisi_thermal_pm_ops,
|
||||
.pm = pm_sleep_ptr(&hisi_thermal_pm_ops),
|
||||
.of_match_table = of_hisi_thermal_match,
|
||||
},
|
||||
.probe = hisi_thermal_probe,
|
||||
|
||||
@@ -94,8 +94,8 @@ static int imx_sc_thermal_probe(struct platform_device *pdev)
|
||||
sensor = devm_kzalloc(&pdev->dev, sizeof(*sensor), GFP_KERNEL);
|
||||
if (!sensor) {
|
||||
of_node_put(child);
|
||||
of_node_put(sensor_np);
|
||||
return -ENOMEM;
|
||||
ret = -ENOMEM;
|
||||
goto put_node;
|
||||
}
|
||||
|
||||
ret = thermal_zone_of_get_sensor_id(child,
|
||||
@@ -124,7 +124,9 @@ static int imx_sc_thermal_probe(struct platform_device *pdev)
|
||||
dev_warn(&pdev->dev, "failed to add hwmon sysfs attributes\n");
|
||||
}
|
||||
|
||||
put_node:
|
||||
of_node_put(sensor_np);
|
||||
of_node_put(np);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -169,28 +169,25 @@ static int int3400_thermal_run_osc(acpi_handle handle, char *uuid_str, int *enab
|
||||
acpi_status status;
|
||||
int result = 0;
|
||||
struct acpi_osc_context context = {
|
||||
.uuid_str = NULL,
|
||||
.uuid_str = uuid_str,
|
||||
.rev = 1,
|
||||
.cap.length = 8,
|
||||
.cap.pointer = buf,
|
||||
};
|
||||
|
||||
context.uuid_str = uuid_str;
|
||||
|
||||
buf[OSC_QUERY_DWORD] = 0;
|
||||
buf[OSC_SUPPORT_DWORD] = *enable;
|
||||
|
||||
context.cap.pointer = buf;
|
||||
|
||||
status = acpi_run_osc(handle, &context);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
ret = *((u32 *)(context.ret.pointer + 4));
|
||||
if (ret != *enable)
|
||||
result = -EPERM;
|
||||
|
||||
kfree(context.ret.pointer);
|
||||
} else
|
||||
result = -EPERM;
|
||||
|
||||
kfree(context.ret.pointer);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -524,21 +521,18 @@ static void int3400_setup_gddv(struct int3400_thermal_priv *priv)
|
||||
|
||||
obj = buffer.pointer;
|
||||
if (obj->type != ACPI_TYPE_PACKAGE || obj->package.count != 1
|
||||
|| obj->package.elements[0].type != ACPI_TYPE_BUFFER) {
|
||||
kfree(buffer.pointer);
|
||||
return;
|
||||
}
|
||||
|| obj->package.elements[0].type != ACPI_TYPE_BUFFER)
|
||||
goto out_free;
|
||||
|
||||
priv->data_vault = kmemdup(obj->package.elements[0].buffer.pointer,
|
||||
obj->package.elements[0].buffer.length,
|
||||
GFP_KERNEL);
|
||||
if (!priv->data_vault) {
|
||||
kfree(buffer.pointer);
|
||||
return;
|
||||
}
|
||||
if (!priv->data_vault)
|
||||
goto out_free;
|
||||
|
||||
bin_attr_data_vault.private = priv->data_vault;
|
||||
bin_attr_data_vault.size = obj->package.elements[0].buffer.length;
|
||||
out_free:
|
||||
kfree(buffer.pointer);
|
||||
}
|
||||
|
||||
|
||||
@@ -243,8 +243,6 @@ static void hfi_update_work_fn(struct work_struct *work)
|
||||
|
||||
hfi_instance = container_of(to_delayed_work(work), struct hfi_instance,
|
||||
update_work);
|
||||
if (!hfi_instance)
|
||||
return;
|
||||
|
||||
update_capabilities(hfi_instance);
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ static unsigned int delay_timeout = 100;
|
||||
module_param(delay_timeout, int, 0644);
|
||||
MODULE_PARM_DESC(delay_timeout, "amount of time delay for each iteration.");
|
||||
|
||||
/* Number of iterations for cooling delay, 10 counts by default for now */
|
||||
static unsigned int delay_cnt = 10;
|
||||
/* Number of iterations for cooling delay, 600 counts by default for now */
|
||||
static unsigned int delay_cnt = 600;
|
||||
module_param(delay_cnt, int, 0644);
|
||||
MODULE_PARM_DESC(delay_cnt, "total number of iterations for time delay.");
|
||||
|
||||
@@ -193,10 +193,11 @@ static int pch_wpt_get_temp(struct pch_thermal_device *ptd, int *temp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Cool the PCH when it's overheat in .suspend_noirq phase */
|
||||
static int pch_wpt_suspend(struct pch_thermal_device *ptd)
|
||||
{
|
||||
u8 tsel;
|
||||
u8 pch_delay_cnt = 1;
|
||||
int pch_delay_cnt = 0;
|
||||
u16 pch_thr_temp, pch_cur_temp;
|
||||
|
||||
/* Shutdown the thermal sensor if it is not enabled by BIOS */
|
||||
@@ -232,26 +233,38 @@ static int pch_wpt_suspend(struct pch_thermal_device *ptd)
|
||||
* temperature stays above threshold, notify the warning message
|
||||
* which helps to indentify the reason why S0ix entry was rejected.
|
||||
*/
|
||||
while (pch_delay_cnt <= delay_cnt) {
|
||||
if (pch_cur_temp <= pch_thr_temp)
|
||||
while (pch_delay_cnt < delay_cnt) {
|
||||
if (pch_cur_temp < pch_thr_temp)
|
||||
break;
|
||||
|
||||
dev_warn(&ptd->pdev->dev,
|
||||
if (pm_wakeup_pending()) {
|
||||
dev_warn(&ptd->pdev->dev, "Wakeup event detected, abort cooling\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
pch_delay_cnt++;
|
||||
dev_dbg(&ptd->pdev->dev,
|
||||
"CPU-PCH current temp [%dC] higher than the threshold temp [%dC], sleep %d times for %d ms duration\n",
|
||||
pch_cur_temp, pch_thr_temp, pch_delay_cnt, delay_timeout);
|
||||
msleep(delay_timeout);
|
||||
/* Read the PCH current temperature for next cycle. */
|
||||
pch_cur_temp = GET_PCH_TEMP(WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TEMP));
|
||||
pch_delay_cnt++;
|
||||
}
|
||||
|
||||
if (pch_cur_temp > pch_thr_temp)
|
||||
if (pch_cur_temp >= pch_thr_temp)
|
||||
dev_warn(&ptd->pdev->dev,
|
||||
"CPU-PCH is hot [%dC] even after delay, continue to suspend. S0ix might fail\n",
|
||||
pch_cur_temp);
|
||||
else
|
||||
dev_info(&ptd->pdev->dev,
|
||||
"CPU-PCH is cool [%dC], continue to suspend\n", pch_cur_temp);
|
||||
"CPU-PCH is hot [%dC] after %d ms delay. S0ix might fail\n",
|
||||
pch_cur_temp, pch_delay_cnt * delay_timeout);
|
||||
else {
|
||||
if (pch_delay_cnt)
|
||||
dev_info(&ptd->pdev->dev,
|
||||
"CPU-PCH is cool [%dC] after %d ms delay\n",
|
||||
pch_cur_temp, pch_delay_cnt * delay_timeout);
|
||||
else
|
||||
dev_info(&ptd->pdev->dev,
|
||||
"CPU-PCH is cool [%dC]\n",
|
||||
pch_cur_temp);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -455,7 +468,7 @@ static void intel_pch_thermal_remove(struct pci_dev *pdev)
|
||||
pci_disable_device(pdev);
|
||||
}
|
||||
|
||||
static int intel_pch_thermal_suspend(struct device *device)
|
||||
static int intel_pch_thermal_suspend_noirq(struct device *device)
|
||||
{
|
||||
struct pch_thermal_device *ptd = dev_get_drvdata(device);
|
||||
|
||||
@@ -495,7 +508,7 @@ static const struct pci_device_id intel_pch_thermal_id[] = {
|
||||
MODULE_DEVICE_TABLE(pci, intel_pch_thermal_id);
|
||||
|
||||
static const struct dev_pm_ops intel_pch_pm_ops = {
|
||||
.suspend = intel_pch_thermal_suspend,
|
||||
.suspend_noirq = intel_pch_thermal_suspend_noirq,
|
||||
.resume = intel_pch_thermal_resume,
|
||||
};
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
#include <linux/thermal.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#include "thermal_hwmon.h"
|
||||
|
||||
#define K3_VTM_DEVINFO_PWR0_OFFSET 0x4
|
||||
#define K3_VTM_DEVINFO_PWR0_TEMPSENS_CT_MASK 0xf0
|
||||
#define K3_VTM_TMPSENS0_CTRL_OFFSET 0x80
|
||||
@@ -219,6 +221,9 @@ static int k3_bandgap_probe(struct platform_device *pdev)
|
||||
ret = PTR_ERR(data[id].tzd);
|
||||
goto err_alloc;
|
||||
}
|
||||
|
||||
if (devm_thermal_add_hwmon_sysfs(data[id].tzd))
|
||||
dev_warn(dev, "Failed to add hwmon sysfs attributes\n");
|
||||
}
|
||||
|
||||
platform_set_drvdata(pdev, bgp);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -220,6 +220,7 @@ static int lmh_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
static const struct of_device_id lmh_table[] = {
|
||||
{ .compatible = "qcom,sc8180x-lmh", },
|
||||
{ .compatible = "qcom,sdm845-lmh", .data = (void *)LMH_ENABLE_ALGOS},
|
||||
{ .compatible = "qcom,sm8150-lmh", },
|
||||
{}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user