Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal

Pull thermal driver fixes from Eduardo Valentin:
 "This week we have few fixes:
   - fix in IMX thermal driver to do the correct loading sequence with
     CPUfreq
   - fix in Exynos related to TMU_CONTROL offset in Exynos5260
   - fix the unit conversion in int3403"

[ Still pulling from Eduardo as Rui Zhang is on a business trip and has
  troubles with his machine ]

* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal:
  imx: thermal: imx_get_temp might be called before sensor clock is prepared
  thermal: exynos: use correct offset for TMU_CONTROL register on Exynos5260
  thermal: imx: correct driver load sequence for cpu cooling
  Thermal/int3403: Fix thermal hysteresis unit conversion
This commit is contained in:
Linus Torvalds 2014-11-12 13:15:18 -08:00
commit 999f81dd19
4 changed files with 36 additions and 19 deletions

View File

@ -459,6 +459,10 @@ static int imx_thermal_probe(struct platform_device *pdev)
int measure_freq;
int ret;
if (!cpufreq_get_current_driver()) {
dev_dbg(&pdev->dev, "no cpufreq driver!");
return -EPROBE_DEFER;
}
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;
@ -521,6 +525,30 @@ static int imx_thermal_probe(struct platform_device *pdev)
return ret;
}
data->thermal_clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(data->thermal_clk)) {
ret = PTR_ERR(data->thermal_clk);
if (ret != -EPROBE_DEFER)
dev_err(&pdev->dev,
"failed to get thermal clk: %d\n", ret);
cpufreq_cooling_unregister(data->cdev);
return ret;
}
/*
* Thermal sensor needs clk on to get correct value, normally
* we should enable its clk before taking measurement and disable
* clk after measurement is done, but if alarm function is enabled,
* hardware will auto measure the temperature periodically, so we
* need to keep the clk always on for alarm function.
*/
ret = clk_prepare_enable(data->thermal_clk);
if (ret) {
dev_err(&pdev->dev, "failed to enable thermal clk: %d\n", ret);
cpufreq_cooling_unregister(data->cdev);
return ret;
}
data->tz = thermal_zone_device_register("imx_thermal_zone",
IMX_TRIP_NUM,
BIT(IMX_TRIP_PASSIVE), data,
@ -531,26 +559,11 @@ static int imx_thermal_probe(struct platform_device *pdev)
ret = PTR_ERR(data->tz);
dev_err(&pdev->dev,
"failed to register thermal zone device %d\n", ret);
clk_disable_unprepare(data->thermal_clk);
cpufreq_cooling_unregister(data->cdev);
return ret;
}
data->thermal_clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(data->thermal_clk)) {
dev_warn(&pdev->dev, "failed to get thermal clk!\n");
} else {
/*
* Thermal sensor needs clk on to get correct value, normally
* we should enable its clk before taking measurement and disable
* clk after measurement is done, but if alarm function is enabled,
* hardware will auto measure the temperature periodically, so we
* need to keep the clk always on for alarm function.
*/
ret = clk_prepare_enable(data->thermal_clk);
if (ret)
dev_warn(&pdev->dev, "failed to enable thermal clk: %d\n", ret);
}
/* Enable measurements at ~ 10 Hz */
regmap_write(map, TEMPSENSE1 + REG_CLR, TEMPSENSE1_MEASURE_FREQ);
measure_freq = DIV_ROUND_UP(32768, 10); /* 10 Hz */

View File

@ -92,7 +92,13 @@ static int sys_get_trip_hyst(struct thermal_zone_device *tzone,
if (ACPI_FAILURE(status))
return -EIO;
*temp = DECI_KELVIN_TO_MILLI_CELSIUS(hyst, KELVIN_OFFSET);
/*
* Thermal hysteresis represents a temperature difference.
* Kelvin and Celsius have same degree size. So the
* conversion here between tenths of degree Kelvin unit
* and Milli-Celsius unit is just to multiply 100.
*/
*temp = hyst * 100;
return 0;
}

View File

@ -264,7 +264,6 @@ struct exynos_tmu_init_data const exynos5250_default_tmu_data = {
static const struct exynos_tmu_registers exynos5260_tmu_registers = {
.triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
.tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
.tmu_ctrl = EXYNOS_TMU_REG_CONTROL1,
.therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
.therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK,
.therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,

View File

@ -75,7 +75,6 @@
#define EXYNOS_MAX_TRIGGER_PER_REG 4
/* Exynos5260 specific */
#define EXYNOS_TMU_REG_CONTROL1 0x24
#define EXYNOS5260_TMU_REG_INTEN 0xC0
#define EXYNOS5260_TMU_REG_INTSTAT 0xC4
#define EXYNOS5260_TMU_REG_INTCLEAR 0xC8