X-Git-Url: http://plrg.eecs.uci.edu/git/?p=firefly-linux-kernel-4.4.55.git;a=blobdiff_plain;f=drivers%2Fthermal%2Frockchip_thermal.c;h=357d967fc71fa4c679ebaddf49926d543827a062;hp=43f3371360b2905d5947379ed7d03f7d761207c3;hb=83fb4e1f93adb50a1c90d1554e72a0d64ce6eb57;hpb=e489b532145672a4bba4864eaefbc0297923844e;ds=inline diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index 43f3371360b2..357d967fc71f 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -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: