thermal: exynos: always check for trips points existence
* Check for trip points existence in exynos_tmu_initialize() so it is checked on all SoCs. * Use dev_err() instead of pr_err(). * Fix dev_err() to reference "device tree" not "of-thermal.c". * Remove no longer needed checks from exynos4210_tmu_initialize() and get_th_reg(). Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
This commit is contained in:
parent
8bfc218d0e
commit
75e0f10077
@ -309,12 +309,6 @@ static u32 get_th_reg(struct exynos_tmu_data *data, u32 threshold, bool falling)
|
|||||||
unsigned long temp;
|
unsigned long temp;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!trips) {
|
|
||||||
pr_err("%s: Cannot get trip points from of-thermal.c!\n",
|
|
||||||
__func__);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < of_thermal_get_ntrips(tz); i++) {
|
for (i = 0; i < of_thermal_get_ntrips(tz); i++) {
|
||||||
if (trips[i].type == THERMAL_TRIP_CRITICAL)
|
if (trips[i].type == THERMAL_TRIP_CRITICAL)
|
||||||
continue;
|
continue;
|
||||||
@ -334,14 +328,23 @@ static u32 get_th_reg(struct exynos_tmu_data *data, u32 threshold, bool falling)
|
|||||||
static int exynos_tmu_initialize(struct platform_device *pdev)
|
static int exynos_tmu_initialize(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct exynos_tmu_data *data = platform_get_drvdata(pdev);
|
struct exynos_tmu_data *data = platform_get_drvdata(pdev);
|
||||||
|
struct thermal_zone_device *tzd = data->tzd;
|
||||||
|
const struct thermal_trip * const trips =
|
||||||
|
of_thermal_get_trip_points(tzd);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (of_thermal_get_ntrips(data->tzd) > data->ntrip) {
|
if (!trips) {
|
||||||
|
dev_err(&pdev->dev,
|
||||||
|
"Cannot get trip points from device tree!\n");
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (of_thermal_get_ntrips(tzd) > data->ntrip) {
|
||||||
dev_info(&pdev->dev,
|
dev_info(&pdev->dev,
|
||||||
"More trip points than supported by this TMU.\n");
|
"More trip points than supported by this TMU.\n");
|
||||||
dev_info(&pdev->dev,
|
dev_info(&pdev->dev,
|
||||||
"%d trip points should be configured in polling mode.\n",
|
"%d trip points should be configured in polling mode.\n",
|
||||||
(of_thermal_get_ntrips(data->tzd) - data->ntrip));
|
(of_thermal_get_ntrips(tzd) - data->ntrip));
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_lock(&data->lock);
|
mutex_lock(&data->lock);
|
||||||
@ -397,13 +400,6 @@ static int exynos4210_tmu_initialize(struct platform_device *pdev)
|
|||||||
unsigned long reference, temp;
|
unsigned long reference, temp;
|
||||||
unsigned int status;
|
unsigned int status;
|
||||||
|
|
||||||
if (!trips) {
|
|
||||||
pr_err("%s: Cannot get trip points from of-thermal.c!\n",
|
|
||||||
__func__);
|
|
||||||
ret = -ENODEV;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
status = readb(data->base + EXYNOS_TMU_REG_STATUS);
|
status = readb(data->base + EXYNOS_TMU_REG_STATUS);
|
||||||
if (!status) {
|
if (!status) {
|
||||||
ret = -EBUSY;
|
ret = -EBUSY;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user