Re: [PATCH 08/14] thermal: exynos: remove parsing of samsung,tmu[_min,_max]_efuse_value properties

2018-04-16 Thread Daniel Lezcano
On 16/04/2018 12:11, Bartlomiej Zolnierkiewicz wrote:
> Since pdata efuse values are SoC (not platform) specific just move
> them from platform data to struct exynos_tmu_data instance. Then
> remove parsing of samsung,tmu[_,min_,max]_efuse_value properties.
> 
> There should be no functional changes caused by this patch.
> 
> Signed-off-by: Bartlomiej Zolnierkiewicz 
> ---
>  drivers/thermal/samsung/exynos_tmu.c | 49 
> +++-
>

Reviewed-by: Daniel Lezcano 


-- 
  Linaro.org │ Open source software for ARM SoCs

Follow Linaro:   Facebook |
 Twitter |
 Blog



[PATCH 08/14] thermal: exynos: remove parsing of samsung,tmu[_min,_max]_efuse_value properties

2018-04-16 Thread Bartlomiej Zolnierkiewicz
Since pdata efuse values are SoC (not platform) specific just move
them from platform data to struct exynos_tmu_data instance. Then
remove parsing of samsung,tmu[_,min_,max]_efuse_value properties.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz 
---
 drivers/thermal/samsung/exynos_tmu.c | 49 +++-
 drivers/thermal/samsung/exynos_tmu.h |  7 --
 2 files changed, 32 insertions(+), 24 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 1fa162d..9a0e961 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -185,6 +185,9 @@
  * @clk: pointer to the clock structure.
  * @clk_sec: pointer to the clock structure for accessing the base_second.
  * @sclk: pointer to the clock structure for accessing the tmu special clk.
+ * @efuse_value: SoC defined fuse value
+ * @min_efuse_value: minimum valid trimming data
+ * @max_efuse_value: maximum valid trimming data
  * @temp_error1: fused value of the first point trim.
  * @temp_error2: fused value of the second point trim.
  * @regulator: pointer to the TMU regulator structure.
@@ -207,6 +210,9 @@ struct exynos_tmu_data {
struct work_struct irq_work;
struct mutex lock;
struct clk *clk, *clk_sec, *sclk;
+   u32 efuse_value;
+   u32 min_efuse_value;
+   u32 max_efuse_value;
u16 temp_error1, temp_error2;
struct regulator *regulator;
struct thermal_zone_device *tzd;
@@ -283,20 +289,18 @@ static int code_to_temp(struct exynos_tmu_data *data, u16 
temp_code)
 
 static void sanitize_temp_error(struct exynos_tmu_data *data, u32 trim_info)
 {
-   struct exynos_tmu_platform_data *pdata = data->pdata;
-
data->temp_error1 = trim_info & EXYNOS_TMU_TEMP_MASK;
data->temp_error2 = ((trim_info >> EXYNOS_TRIMINFO_85_SHIFT) &
EXYNOS_TMU_TEMP_MASK);
 
if (!data->temp_error1 ||
-   (pdata->min_efuse_value > data->temp_error1) ||
-   (data->temp_error1 > pdata->max_efuse_value))
-   data->temp_error1 = pdata->efuse_value & EXYNOS_TMU_TEMP_MASK;
+   (data->min_efuse_value > data->temp_error1) ||
+   (data->temp_error1 > data->max_efuse_value))
+   data->temp_error1 = data->efuse_value & EXYNOS_TMU_TEMP_MASK;
 
if (!data->temp_error2)
data->temp_error2 =
-   (pdata->efuse_value >> EXYNOS_TRIMINFO_85_SHIFT) &
+   (data->efuse_value >> EXYNOS_TRIMINFO_85_SHIFT) &
EXYNOS_TMU_TEMP_MASK;
 }
 
@@ -655,7 +659,6 @@ 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;
-   struct exynos_tmu_platform_data *pdata = data->pdata;
unsigned int status, trim_info;
unsigned int rising_threshold = 0, falling_threshold = 0;
int ret = 0, threshold_code, i;
@@ -672,9 +675,9 @@ static int exynos7_tmu_initialize(struct platform_device 
*pdev)
 
data->temp_error1 = trim_info & EXYNOS7_TMU_TEMP_MASK;
if (!data->temp_error1 ||
-   (pdata->min_efuse_value > data->temp_error1) ||
-   (data->temp_error1 > pdata->max_efuse_value))
-   data->temp_error1 = pdata->efuse_value & EXYNOS_TMU_TEMP_MASK;
+   (data->min_efuse_value > data->temp_error1) ||
+   (data->temp_error1 > data->max_efuse_value))
+   data->temp_error1 = data->efuse_value & EXYNOS_TMU_TEMP_MASK;
 
/* Write temperature code for rising and falling threshold */
for (i = (of_thermal_get_ntrips(tz) - 1); i >= 0; i--) {
@@ -1136,13 +1139,6 @@ static int exynos_of_sensor_conf(struct device_node *np,
of_property_read_u32(np, "samsung,tmu_reference_voltage", &value);
pdata->reference_voltage = (u8)value;
 
-   of_property_read_u32(np, "samsung,tmu_efuse_value",
-&pdata->efuse_value);
-   of_property_read_u32(np, "samsung,tmu_min_efuse_value",
-&pdata->min_efuse_value);
-   of_property_read_u32(np, "samsung,tmu_max_efuse_value",
-&pdata->max_efuse_value);
-
of_property_read_u32(np, "samsung,tmu_cal_type", &pdata->cal_type);
 
of_node_put(np);
@@ -1196,6 +1192,9 @@ static int exynos_map_dt_data(struct platform_device 
*pdev)
data->tmu_read = exynos4210_tmu_read;
data->tmu_clear_irqs = exynos4210_tmu_clear_irqs;
data->ntrip = 4;
+   data->efuse_value = 55;
+   data->min_efuse_value = 40;
+   data->max_efuse_value = 100;
break;
case SOC_ARCH_EXYNOS3250:
case SOC_ARCH_EXYNOS4412:
@@ -1209,6 +1208,13 @@ static int exynos_map_dt_data(struct