Re: [PATCH 1/2] thermal: exynos: Reorder exynos_map_dt_data() function

Abhilash Kesavan
2015-01-22T08:29:25Z

Hi Lukasz,

On Mon, Jan 19, 2015 at 5:14 PM, Lukasz Majewski <l.majewski@samsung.com> wrote:
> The exynos_map_dt_data() function must be called before
> thermal_zone_of_sensor_register(), and hence provide tmu_read() function,
> before it is needed.
>
> This change is driven by adding support for enabling thermal_zoneX when
> it is properly initialized.
>
> One can read the mode of operation at /sys/class/thermal/thermal_zone0/mode
> Such functionality was missing in the of-thermal.c code.
>
> Reported-by: Abhilash Kesavan <a.kesavan@samsung.com>
> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
> ---
> drivers/thermal/samsung/exynos_tmu.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index 9d2d685..5d946ab 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -975,15 +975,16 @@ static int exynos_tmu_probe(struct platform_device *pdev)
> platform_set_drvdata(pdev, data);
> mutex_init(&data->lock);
>
> + ret = exynos_map_dt_data(pdev);
> + if (ret)
> + goto err_sensor;
> +
> data->tzd = thermal_zone_of_sensor_register(&pdev->dev, 0, data,
> &exynos_sensor_ops);
> if (IS_ERR(data->tzd)) {
> pr_err("thermal: tz: %p ERROR\n", data->tzd);
> return PTR_ERR(data->tzd);
> }
> - ret = exynos_map_dt_data(pdev);
> - if (ret)
> - goto err_sensor;
>
> pdata = data->pdata;

I have been testing this along with your v5 patch set and am seeing
incorrect temperature being reported at boot-up on exynos7. It looks
like exynos_tmu_read gets called from thermal_zone_of_device_update
during boot-up, now that we have it populated early. However, as the
tmu initialization function has not been called yet it returns a wrong
value. Does that sound correct ?

Regards,
Abhilash
>
> --
> 2.0.0.rc2
>