1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
/* linux/arch/arm/plat-s5p/dev-tmu.c
*
* Copyright 2009 by SAMSUNG
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <asm/irq.h>
#include <mach/irqs.h>
#include <mach/map.h>
#include <plat/devs.h>
#include <plat/s5p-tmu.h>
static struct resource tmu_resource[] = {
[0] = {
.start = S5P_PA_TMU,
.end = S5P_PA_TMU + 0xFFFF - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_TMU,
.end = IRQ_TMU,
.flags = IORESOURCE_IRQ,
},
};
struct platform_device exynos_device_tmu = {
.name = "s5p-tmu",
.id = -1,
.num_resources = ARRAY_SIZE(tmu_resource),
.resource = tmu_resource,
};
static struct tmu_data default_tmu_data __initdata = {
.ts = {
.stop_throttle = 0,
.start_throttle = 0,
.stop_warning = 0,
.start_warning = 0,
.start_tripping = 0,
},
.cpulimit = {
.throttle_freq = 0,
.warning_freq = 0,
},
.efuse_value = 0,
.slope = 0,
.mode = 0,
};
int s5p_tmu_get_irqno(int num)
{
return platform_get_irq(&exynos_device_tmu, num);
}
struct tmu_info *s5p_tmu_get_platdata(void)
{
return platform_get_drvdata(&exynos_device_tmu);
}
void __init s5p_tmu_set_platdata(struct tmu_data *pd)
{
struct tmu_data *npd;
npd = kmalloc(sizeof(struct tmu_data), GFP_KERNEL);
if (!npd) {
printk(KERN_ERR "%s: no memory for platform data\n", __func__);
} else {
if (!pd->ts.stop_throttle)
memcpy(&npd->ts, &default_tmu_data.ts, sizeof(struct temperature_params));
else
memcpy(&npd->ts, &pd->ts, sizeof(struct tmu_data));
}
exynos_device_tmu.dev.platform_data = npd;
}
|