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

2018-03-06 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 adfd9ef..02d34cf 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.
@@ -206,6 +209,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;
@@ -301,20 +307,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;
 }
 
@@ -672,7 +676,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;
@@ -689,9 +692,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--) {
@@ -1154,13 +1157,6 @@ static int exynos_of_sensor_conf(struct device_node *np,
of_property_read_u32(np, "samsung,tmu_reference_voltage", );
pdata->reference_voltage = (u8)value;
 
-   of_property_read_u32(np, "samsung,tmu_efuse_value",
->efuse_value);
-   of_property_read_u32(np, "samsung,tmu_min_efuse_value",
->min_efuse_value);
-   of_property_read_u32(np, "samsung,tmu_max_efuse_value",
->max_efuse_value);
-
of_property_read_u32(np, "samsung,tmu_cal_type", >cal_type);
 
of_node_put(np);
@@ -1214,6 +1210,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:
@@ -1227,6 +1226,13 @@ static int exynos_map_dt_data(struct 

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

2018-03-06 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 adfd9ef..02d34cf 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.
@@ -206,6 +209,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;
@@ -301,20 +307,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;
 }
 
@@ -672,7 +676,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;
@@ -689,9 +692,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--) {
@@ -1154,13 +1157,6 @@ static int exynos_of_sensor_conf(struct device_node *np,
of_property_read_u32(np, "samsung,tmu_reference_voltage", );
pdata->reference_voltage = (u8)value;
 
-   of_property_read_u32(np, "samsung,tmu_efuse_value",
->efuse_value);
-   of_property_read_u32(np, "samsung,tmu_min_efuse_value",
->min_efuse_value);
-   of_property_read_u32(np, "samsung,tmu_max_efuse_value",
->max_efuse_value);
-
of_property_read_u32(np, "samsung,tmu_cal_type", >cal_type);
 
of_node_put(np);
@@ -1214,6 +1210,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:
@@ -1227,6 +1226,13 @@ static int exynos_map_dt_data(struct platform_device 
*pdev)