thermal: rockchip: add temperature dump when panic
Change-Id: I8cf3bbaea76d379dcfd1c89482254854df62cfea Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
This commit is contained in:
parent
e489b53214
commit
83fb4e1f93
1 changed files with 47 additions and 0 deletions
|
|
@ -1010,6 +1010,48 @@ static void rockchip_thermal_reset_controller(struct reset_control *reset)
|
|||
reset_control_deassert(reset);
|
||||
}
|
||||
|
||||
static struct platform_device *thermal_device;
|
||||
|
||||
void rockchip_dump_temperature(void)
|
||||
{
|
||||
struct rockchip_thermal_data *thermal;
|
||||
struct platform_device *pdev;
|
||||
int i;
|
||||
|
||||
if (!thermal_device)
|
||||
return;
|
||||
|
||||
pdev = thermal_device;
|
||||
thermal = platform_get_drvdata(pdev);
|
||||
|
||||
for (i = 0; i < thermal->chip->chn_num; i++) {
|
||||
struct rockchip_thermal_sensor *sensor = &thermal->sensors[i];
|
||||
struct thermal_zone_device *tz = sensor->tzd;
|
||||
|
||||
if (tz->temperature != THERMAL_TEMP_INVALID)
|
||||
dev_warn(&pdev->dev, "channal %d: temperature(%d C)\n",
|
||||
i, tz->temperature / 1000);
|
||||
}
|
||||
|
||||
if (thermal->regs) {
|
||||
pr_warn("THERMAL REGS:\n");
|
||||
print_hex_dump(KERN_WARNING, "", DUMP_PREFIX_OFFSET,
|
||||
32, 4, thermal->regs, 0x88, false);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rockchip_dump_temperature);
|
||||
|
||||
static int rockchip_thermal_panic(struct notifier_block *this,
|
||||
unsigned long ev, void *ptr)
|
||||
{
|
||||
rockchip_dump_temperature();
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
static struct notifier_block rockchip_thermal_panic_block = {
|
||||
.notifier_call = rockchip_thermal_panic,
|
||||
};
|
||||
|
||||
static int rockchip_thermal_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device_node *np = pdev->dev.of_node;
|
||||
|
|
@ -1122,6 +1164,11 @@ static int rockchip_thermal_probe(struct platform_device *pdev)
|
|||
|
||||
platform_set_drvdata(pdev, thermal);
|
||||
|
||||
thermal_device = pdev;
|
||||
|
||||
atomic_notifier_chain_register(&panic_notifier_list,
|
||||
&rockchip_thermal_panic_block);
|
||||
|
||||
return 0;
|
||||
|
||||
err_disable_pclk:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue