exynos_tmu.c (0c1836a6563decc6de8622b2ed71523b3bdceb65) exynos_tmu.c (e6b7991ed50fea9bf8b36e8a4794ee36d35e1651)
1/*
2 * exynos_tmu.c - Samsung EXYNOS TMU (Thermal Management Unit)
3 *
4 * Copyright (C) 2011 Samsung Electronics
5 * Donggeun Kim <dg77.kim@samsung.com>
6 * Amit Daniel Kachhap <amit.kachhap@linaro.org>
7 *
8 * This program is free software; you can redistribute it and/or modify

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

25#include <linux/io.h>
26#include <linux/interrupt.h>
27#include <linux/module.h>
28#include <linux/of.h>
29#include <linux/platform_device.h>
30
31#include "exynos_thermal_common.h"
32#include "exynos_tmu.h"
1/*
2 * exynos_tmu.c - Samsung EXYNOS TMU (Thermal Management Unit)
3 *
4 * Copyright (C) 2011 Samsung Electronics
5 * Donggeun Kim <dg77.kim@samsung.com>
6 * Amit Daniel Kachhap <amit.kachhap@linaro.org>
7 *
8 * This program is free software; you can redistribute it and/or modify

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

25#include <linux/io.h>
26#include <linux/interrupt.h>
27#include <linux/module.h>
28#include <linux/of.h>
29#include <linux/platform_device.h>
30
31#include "exynos_thermal_common.h"
32#include "exynos_tmu.h"
33#include "exynos_tmu_data.h"
33
34/* Exynos generic registers */
35#define EXYNOS_TMU_REG_TRIMINFO 0x0
36#define EXYNOS_TMU_REG_CONTROL 0x20
37#define EXYNOS_TMU_REG_STATUS 0x28
38#define EXYNOS_TMU_REG_CURRENT_TEMP 0x40
39#define EXYNOS_TMU_REG_INTEN 0x70
40#define EXYNOS_TMU_REG_INTSTAT 0x74

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

376 return IRQ_HANDLED;
377}
378static struct thermal_sensor_conf exynos_sensor_conf = {
379 .name = "exynos-therm",
380 .read_temperature = (int (*)(void *))exynos_tmu_read,
381 .write_emul_temp = exynos_tmu_set_emulation,
382};
383
34
35/* Exynos generic registers */
36#define EXYNOS_TMU_REG_TRIMINFO 0x0
37#define EXYNOS_TMU_REG_CONTROL 0x20
38#define EXYNOS_TMU_REG_STATUS 0x28
39#define EXYNOS_TMU_REG_CURRENT_TEMP 0x40
40#define EXYNOS_TMU_REG_INTEN 0x70
41#define EXYNOS_TMU_REG_INTSTAT 0x74

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

377 return IRQ_HANDLED;
378}
379static struct thermal_sensor_conf exynos_sensor_conf = {
380 .name = "exynos-therm",
381 .read_temperature = (int (*)(void *))exynos_tmu_read,
382 .write_emul_temp = exynos_tmu_set_emulation,
383};
384
384#if defined(CONFIG_CPU_EXYNOS4210)
385static struct exynos_tmu_platform_data const exynos4210_default_tmu_data = {
386 .threshold = 80,
387 .trigger_levels[0] = 5,
388 .trigger_levels[1] = 20,
389 .trigger_levels[2] = 30,
390 .trigger_level0_en = 1,
391 .trigger_level1_en = 1,
392 .trigger_level2_en = 1,
393 .trigger_level3_en = 0,
394 .gain = 15,
395 .reference_voltage = 7,
396 .cal_type = TYPE_ONE_POINT_TRIMMING,
397 .freq_tab[0] = {
398 .freq_clip_max = 800 * 1000,
399 .temp_level = 85,
400 },
401 .freq_tab[1] = {
402 .freq_clip_max = 200 * 1000,
403 .temp_level = 100,
404 },
405 .freq_tab_count = 2,
406 .type = SOC_ARCH_EXYNOS4210,
407};
408#define EXYNOS4210_TMU_DRV_DATA (&exynos4210_default_tmu_data)
409#else
410#define EXYNOS4210_TMU_DRV_DATA (NULL)
411#endif
412
413#if defined(CONFIG_SOC_EXYNOS5250) || defined(CONFIG_SOC_EXYNOS4412) || \
414 defined(CONFIG_SOC_EXYNOS4212)
415static struct exynos_tmu_platform_data const exynos_default_tmu_data = {
416 .threshold_falling = 10,
417 .trigger_levels[0] = 85,
418 .trigger_levels[1] = 103,
419 .trigger_levels[2] = 110,
420 .trigger_level0_en = 1,
421 .trigger_level1_en = 1,
422 .trigger_level2_en = 1,
423 .trigger_level3_en = 0,
424 .gain = 8,
425 .reference_voltage = 16,
426 .noise_cancel_mode = 4,
427 .cal_type = TYPE_ONE_POINT_TRIMMING,
428 .efuse_value = 55,
429 .freq_tab[0] = {
430 .freq_clip_max = 800 * 1000,
431 .temp_level = 85,
432 },
433 .freq_tab[1] = {
434 .freq_clip_max = 200 * 1000,
435 .temp_level = 103,
436 },
437 .freq_tab_count = 2,
438 .type = SOC_ARCH_EXYNOS,
439};
440#define EXYNOS_TMU_DRV_DATA (&exynos_default_tmu_data)
441#else
442#define EXYNOS_TMU_DRV_DATA (NULL)
443#endif
444
445#ifdef CONFIG_OF
446static const struct of_device_id exynos_tmu_match[] = {
447 {
448 .compatible = "samsung,exynos4210-tmu",
449 .data = (void *)EXYNOS4210_TMU_DRV_DATA,
450 },
451 {
452 .compatible = "samsung,exynos4412-tmu",
385#ifdef CONFIG_OF
386static const struct of_device_id exynos_tmu_match[] = {
387 {
388 .compatible = "samsung,exynos4210-tmu",
389 .data = (void *)EXYNOS4210_TMU_DRV_DATA,
390 },
391 {
392 .compatible = "samsung,exynos4412-tmu",
453 .data = (void *)EXYNOS_TMU_DRV_DATA,
393 .data = (void *)EXYNOS5250_TMU_DRV_DATA,
454 },
455 {
456 .compatible = "samsung,exynos5250-tmu",
394 },
395 {
396 .compatible = "samsung,exynos5250-tmu",
457 .data = (void *)EXYNOS_TMU_DRV_DATA,
397 .data = (void *)EXYNOS5250_TMU_DRV_DATA,
458 },
459 {},
460};
461MODULE_DEVICE_TABLE(of, exynos_tmu_match);
462#endif
463
464static struct platform_device_id exynos_tmu_driver_ids[] = {
465 {
466 .name = "exynos4210-tmu",
467 .driver_data = (kernel_ulong_t)EXYNOS4210_TMU_DRV_DATA,
468 },
469 {
470 .name = "exynos5250-tmu",
398 },
399 {},
400};
401MODULE_DEVICE_TABLE(of, exynos_tmu_match);
402#endif
403
404static struct platform_device_id exynos_tmu_driver_ids[] = {
405 {
406 .name = "exynos4210-tmu",
407 .driver_data = (kernel_ulong_t)EXYNOS4210_TMU_DRV_DATA,
408 },
409 {
410 .name = "exynos5250-tmu",
471 .driver_data = (kernel_ulong_t)EXYNOS_TMU_DRV_DATA,
411 .driver_data = (kernel_ulong_t)EXYNOS5250_TMU_DRV_DATA,
472 },
473 { },
474};
475MODULE_DEVICE_TABLE(platform, exynos_tmu_driver_ids);
476
477static inline struct exynos_tmu_platform_data *exynos_get_driver_data(
478 struct platform_device *pdev)
479{

--- 173 unchanged lines hidden ---
412 },
413 { },
414};
415MODULE_DEVICE_TABLE(platform, exynos_tmu_driver_ids);
416
417static inline struct exynos_tmu_platform_data *exynos_get_driver_data(
418 struct platform_device *pdev)
419{

--- 173 unchanged lines hidden ---