exynos_tmu.c (5d6976d01414f23af4b81d7f91cfd59839c8b1fe) exynos_tmu.c (d7a5b431911c5d9da7fbff852433e6f99a4c6616)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * exynos_tmu.c - Samsung Exynos TMU (Thermal Management Unit)
4 *
5 * Copyright (C) 2014 Samsung Electronics
6 * Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
7 * Lukasz Majewski <l.majewski@samsung.com>
8 *

--- 329 unchanged lines hidden (view full) ---

338 data->enabled = on;
339 clk_disable(data->clk);
340 mutex_unlock(&data->lock);
341}
342
343static void exynos4210_tmu_set_trip_temp(struct exynos_tmu_data *data,
344 int trip_id, u8 temp)
345{
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * exynos_tmu.c - Samsung Exynos TMU (Thermal Management Unit)
4 *
5 * Copyright (C) 2014 Samsung Electronics
6 * Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
7 * Lukasz Majewski <l.majewski@samsung.com>
8 *

--- 329 unchanged lines hidden (view full) ---

338 data->enabled = on;
339 clk_disable(data->clk);
340 mutex_unlock(&data->lock);
341}
342
343static void exynos4210_tmu_set_trip_temp(struct exynos_tmu_data *data,
344 int trip_id, u8 temp)
345{
346 struct thermal_trip trip;
347 u8 ref, th_code;
348
349 if (thermal_zone_get_trip(data->tzd, 0, &trip))
350 return;
351
352 ref = trip.temperature / MCELSIUS;
353
354 if (trip_id == 0) {
355 th_code = temp_to_code(data, ref);
356 writeb(th_code, data->base + EXYNOS4210_TMU_REG_THRESHOLD_TEMP);
357 }
358
359 temp -= ref;
346 temp = temp_to_code(data, temp);
360 writeb(temp, data->base + EXYNOS4210_TMU_REG_TRIG_LEVEL0 + trip_id * 4);
361}
362
363/* failing thresholds are not supported on Exynos4210 */
364static void exynos4210_tmu_set_trip_hyst(struct exynos_tmu_data *data,
365 int trip, u8 temp, u8 hyst)
366{
367}
368
369static void exynos4210_tmu_initialize(struct platform_device *pdev)
370{
371 struct exynos_tmu_data *data = platform_get_drvdata(pdev);
372
373 sanitize_temp_error(data, readl(data->base + EXYNOS_TMU_REG_TRIMINFO));
347 writeb(temp, data->base + EXYNOS4210_TMU_REG_TRIG_LEVEL0 + trip_id * 4);
348}
349
350/* failing thresholds are not supported on Exynos4210 */
351static void exynos4210_tmu_set_trip_hyst(struct exynos_tmu_data *data,
352 int trip, u8 temp, u8 hyst)
353{
354}
355
356static void exynos4210_tmu_initialize(struct platform_device *pdev)
357{
358 struct exynos_tmu_data *data = platform_get_drvdata(pdev);
359
360 sanitize_temp_error(data, readl(data->base + EXYNOS_TMU_REG_TRIMINFO));
361
362 writeb(0, data->base + EXYNOS4210_TMU_REG_THRESHOLD_TEMP);
374}
375
376static void exynos4412_tmu_set_trip_temp(struct exynos_tmu_data *data,
377 int trip, u8 temp)
378{
379 u32 th, con;
380
381 th = readl(data->base + EXYNOS_THD_TEMP_RISE);

--- 772 unchanged lines hidden ---
363}
364
365static void exynos4412_tmu_set_trip_temp(struct exynos_tmu_data *data,
366 int trip, u8 temp)
367{
368 u32 th, con;
369
370 th = readl(data->base + EXYNOS_THD_TEMP_RISE);

--- 772 unchanged lines hidden ---