thermal: exynos: check STATUS register in exynos_tmu_initialize()

STATUS register is present on all SoCs so move its checking into
exynos_tmu_initialize().

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
This commit is contained in:
Bartlomiej Zolnierkiewicz 2018-04-26 13:51:19 +02:00 committed by Eduardo Valentin
parent 8f1c404b21
commit 97b3881b8b
1 changed files with 13 additions and 32 deletions

View File

@ -331,6 +331,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
struct thermal_zone_device *tzd = data->tzd;
const struct thermal_trip * const trips =
of_thermal_get_trip_points(tzd);
unsigned int status;
int ret = 0, temp;
if (!trips) {
@ -359,7 +360,13 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
clk_enable(data->clk);
if (!IS_ERR(data->clk_sec))
clk_enable(data->clk_sec);
ret = data->tmu_initialize(pdev);
status = readb(data->base + EXYNOS_TMU_REG_STATUS);
if (!status)
ret = -EBUSY;
else
ret = data->tmu_initialize(pdev);
clk_disable(data->clk);
mutex_unlock(&data->lock);
if (!IS_ERR(data->clk_sec))
@ -406,13 +413,6 @@ static int exynos4210_tmu_initialize(struct platform_device *pdev)
of_thermal_get_trip_points(tz);
int ret = 0, threshold_code, i;
unsigned long reference, temp;
unsigned int status;
status = readb(data->base + EXYNOS_TMU_REG_STATUS);
if (!status) {
ret = -EBUSY;
goto out;
}
sanitize_temp_error(data, readl(data->base + EXYNOS_TMU_REG_TRIMINFO));
@ -441,16 +441,10 @@ static int exynos4412_tmu_initialize(struct platform_device *pdev)
struct exynos_tmu_data *data = platform_get_drvdata(pdev);
const struct thermal_trip * const trips =
of_thermal_get_trip_points(data->tzd);
unsigned int status, trim_info, con, ctrl, rising_threshold;
unsigned int trim_info, con, ctrl, rising_threshold;
int ret = 0, threshold_code, i;
unsigned long crit_temp = 0;
status = readb(data->base + EXYNOS_TMU_REG_STATUS);
if (!status) {
ret = -EBUSY;
goto out;
}
if (data->soc == SOC_ARCH_EXYNOS3250 ||
data->soc == SOC_ARCH_EXYNOS4412 ||
data->soc == SOC_ARCH_EXYNOS5250) {
@ -497,7 +491,6 @@ static int exynos4412_tmu_initialize(struct platform_device *pdev)
con |= (1 << EXYNOS_TMU_THERM_TRIP_EN_SHIFT);
writel(con, data->base + EXYNOS_TMU_REG_CONTROL);
out:
return ret;
}
@ -505,17 +498,11 @@ static int exynos5433_tmu_initialize(struct platform_device *pdev)
{
struct exynos_tmu_data *data = platform_get_drvdata(pdev);
struct thermal_zone_device *tz = data->tzd;
unsigned int status, trim_info;
unsigned int trim_info;
unsigned int rising_threshold = 0, falling_threshold = 0;
int temp, temp_hist;
int ret = 0, threshold_code, i, sensor_id, cal_type;
status = readb(data->base + EXYNOS_TMU_REG_STATUS);
if (!status) {
ret = -EBUSY;
goto out;
}
trim_info = readl(data->base + EXYNOS_TMU_REG_TRIMINFO);
sanitize_temp_error(data, trim_info);
@ -590,7 +577,7 @@ static int exynos5433_tmu_initialize(struct platform_device *pdev)
}
data->tmu_clear_irqs(data);
out:
return ret;
}
@ -598,18 +585,12 @@ static int exynos7_tmu_initialize(struct platform_device *pdev)
{
struct exynos_tmu_data *data = platform_get_drvdata(pdev);
struct thermal_zone_device *tz = data->tzd;
unsigned int status, trim_info;
unsigned int trim_info;
unsigned int rising_threshold = 0, falling_threshold = 0;
int ret = 0, threshold_code, i;
int temp, temp_hist;
unsigned int reg_off, bit_off;
status = readb(data->base + EXYNOS_TMU_REG_STATUS);
if (!status) {
ret = -EBUSY;
goto out;
}
trim_info = readl(data->base + EXYNOS_TMU_REG_TRIMINFO);
data->temp_error1 = trim_info & EXYNOS7_TMU_TEMP_MASK;
@ -667,7 +648,7 @@ static int exynos7_tmu_initialize(struct platform_device *pdev)
}
data->tmu_clear_irqs(data);
out:
return ret;
}