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
85
86
87
88
89
90
91
92
93
94
95
96
97
|
/*
* ARM Intelligent Power Allocation
*
* Copyright (C) 2013 ARM Limited.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef _DRIVERS_THERMAL_IPA_H
#define _DRIVERS_THERMAL_IPA_H
#include <linux/cpufreq.h>
#include <linux/sysfs.h>
#define THERMAL_NEW_MAX_FREQ 0
struct ipa_sensor_conf {
int (*read_soc_temperature)(void *data);
int (*read_skin_temperature)(void);
void *private_data;
};
struct thermal_limits {
int max_freq;
int cur_freq;
cpumask_t cpus;
};
struct ipa_attr {
struct attribute attr;
ssize_t (*show)(struct kobject *kobj,
struct kobj_attribute *attr, char *buf);
ssize_t (*store)(struct kobject *a, struct kobj_attribute *b,
const char *c, size_t count);
};
struct ipa_attr_ro {
struct attribute attr;
ssize_t (*show)(struct kobject *kobj,
struct kobj_attribute *attr, char *buf);
};
#define define_ipa_attr(_name) \
static struct ipa_attr _name = \
__ATTR(_name, 0664, _name##_show, _name##_store)
#define define_ipa_attr_ro(_name) \
static struct ipa_attr _name = \
__ATTR(_name, 0444, _name##_show, NULL)
int ipa_hotplug(bool remove_cores); // this is not very generic
#ifdef CONFIG_CPU_THERMAL_IPA
void check_switch_ipa_on(int temp);
void ipa_cpufreq_requested(struct cpufreq_policy *p, unsigned int freq);
int ipa_register_thermal_sensor(struct ipa_sensor_conf *);
int thermal_register_notifier(struct notifier_block *nb);
int thermal_unregister_notifier(struct notifier_block *nb);
#else
static inline void check_switch_ipa_on(int t)
{
}
static void __maybe_unused ipa_cpufreq_requested(struct cpufreq_policy *p, unsigned int *freqs)
{
}
static inline int ipa_register_thermal_sensor(struct ipa_sensor_conf *p)
{
return 0;
}
static inline int thermal_register_notifier(struct notifier_block *nb)
{
return 0;
}
static inline int thermal_unregister_notifier(struct notifier_block *nb)
{
return 0;
}
#endif
#endif /* _DRIVERS_THERMAL_IPA_H */
|