Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 999f81dd authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents c9212201 90a21ff5
Loading
Loading
Loading
Loading
+29 −16
Original line number Diff line number Diff line
@@ -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,24 +525,16 @@ static int imx_thermal_probe(struct platform_device *pdev)
		return ret;
	}

	data->tz = thermal_zone_device_register("imx_thermal_zone",
						IMX_TRIP_NUM,
						BIT(IMX_TRIP_PASSIVE), data,
						&imx_tz_ops, NULL,
						IMX_PASSIVE_DELAY,
						IMX_POLLING_DELAY);
	if (IS_ERR(data->tz)) {
		ret = PTR_ERR(data->tz);
	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 register thermal zone device %d\n", ret);
				"failed to get thermal clk: %d\n", ret);
		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
@@ -547,8 +543,25 @@ static int imx_thermal_probe(struct platform_device *pdev)
	 * 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);
	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,
						&imx_tz_ops, NULL,
						IMX_PASSIVE_DELAY,
						IMX_POLLING_DELAY);
	if (IS_ERR(data->tz)) {
		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;
	}

	/* Enable measurements at ~ 10 Hz */
+7 −1
Original line number Diff line number Diff line
@@ -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;
}
+0 −1
Original line number Diff line number Diff line
@@ -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,
+0 −1
Original line number Diff line number Diff line
@@ -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