6b13f685e
김민수
BSP 최초 추가
|
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
|
#ifndef __TI_BANDGAP_H
#define __TI_BANDGAP_H
#include <linux/spinlock.h>
#include <linux/types.h>
#include <linux/err.h>
struct temp_sensor_registers {
u32 temp_sensor_ctrl;
u32 bgap_tempsoff_mask;
u32 bgap_soc_mask;
u32 bgap_eocz_mask;
u32 bgap_dtemp_mask;
u32 bgap_mask_ctrl;
u32 mask_hot_mask;
u32 mask_cold_mask;
u32 mask_sidlemode_mask;
u32 mask_counter_delay_mask;
u32 mask_freeze_mask;
u32 mask_clear_mask;
u32 mask_clear_accum_mask;
u32 bgap_mode_ctrl;
u32 mode_ctrl_mask;
u32 bgap_counter;
u32 counter_mask;
u32 bgap_threshold;
u32 threshold_thot_mask;
u32 threshold_tcold_mask;
u32 tshut_threshold;
u32 tshut_efuse_mask;
u32 tshut_efuse_shift;
u32 tshut_hot_mask;
u32 tshut_cold_mask;
u32 bgap_status;
u32 status_clean_stop_mask;
u32 status_bgap_alert_mask;
u32 status_hot_mask;
u32 status_cold_mask;
u32 bgap_cumul_dtemp;
u32 ctrl_dtemp_0;
u32 ctrl_dtemp_1;
u32 ctrl_dtemp_2;
u32 ctrl_dtemp_3;
u32 ctrl_dtemp_4;
u32 bgap_efuse;
};
struct temp_sensor_data {
u32 tshut_hot;
u32 tshut_cold;
u32 t_hot;
u32 t_cold;
u32 min_freq;
u32 max_freq;
int max_temp;
int min_temp;
int hyst_val;
u32 update_int1;
u32 update_int2;
};
struct ti_bandgap_data;
struct temp_sensor_regval {
u32 bg_mode_ctrl;
u32 bg_ctrl;
u32 bg_counter;
u32 bg_threshold;
u32 tshut_threshold;
void *data;
};
struct ti_bandgap {
struct device *dev;
void __iomem *base;
const struct ti_bandgap_data *conf;
struct temp_sensor_regval *regval;
struct clk *fclock;
struct clk *div_clk;
spinlock_t lock;
int irq;
int tshut_gpio;
u32 clk_rate;
};
struct ti_temp_sensor {
struct temp_sensor_data *ts_data;
struct temp_sensor_registers *registers;
char *domain;
const int slope;
const int constant;
const int slope_pcb;
const int constant_pcb;
int (*register_cooling)(struct ti_bandgap *bgp, int id);
int (*unregister_cooling)(struct ti_bandgap *bgp, int id);
};
#define TI_BANDGAP_FEATURE_TSHUT BIT(0)
#define TI_BANDGAP_FEATURE_TSHUT_CONFIG BIT(1)
#define TI_BANDGAP_FEATURE_TALERT BIT(2)
#define TI_BANDGAP_FEATURE_MODE_CONFIG BIT(3)
#define TI_BANDGAP_FEATURE_COUNTER BIT(4)
#define TI_BANDGAP_FEATURE_POWER_SWITCH BIT(5)
#define TI_BANDGAP_FEATURE_CLK_CTRL BIT(6)
#define TI_BANDGAP_FEATURE_FREEZE_BIT BIT(7)
#define TI_BANDGAP_FEATURE_COUNTER_DELAY BIT(8)
#define TI_BANDGAP_FEATURE_HISTORY_BUFFER BIT(9)
#define TI_BANDGAP_HAS(b, f) \
((b)->conf->features & TI_BANDGAP_FEATURE_ ## f)
struct ti_bandgap_data {
unsigned int features;
const int *conv_table;
u32 adc_start_val;
u32 adc_end_val;
char *fclock_name;
char *div_ck_name;
int sensor_count;
int (*report_temperature)(struct ti_bandgap *bgp, int id);
int (*expose_sensor)(struct ti_bandgap *bgp, int id, char *domain);
int (*remove_sensor)(struct ti_bandgap *bgp, int id);
struct ti_temp_sensor sensors[];
};
int ti_bandgap_read_thot(struct ti_bandgap *bgp, int id, int *thot);
int ti_bandgap_write_thot(struct ti_bandgap *bgp, int id, int val);
int ti_bandgap_read_tcold(struct ti_bandgap *bgp, int id, int *tcold);
int ti_bandgap_write_tcold(struct ti_bandgap *bgp, int id, int val);
int ti_bandgap_read_update_interval(struct ti_bandgap *bgp, int id,
int *interval);
int ti_bandgap_write_update_interval(struct ti_bandgap *bgp, int id,
u32 interval);
int ti_bandgap_read_temperature(struct ti_bandgap *bgp, int id,
int *temperature);
int ti_bandgap_set_sensor_data(struct ti_bandgap *bgp, int id, void *data);
void *ti_bandgap_get_sensor_data(struct ti_bandgap *bgp, int id);
int ti_bandgap_get_trend(struct ti_bandgap *bgp, int id, int *trend);
#ifdef CONFIG_OMAP4_THERMAL
extern const struct ti_bandgap_data omap4430_data;
extern const struct ti_bandgap_data omap4460_data;
extern const struct ti_bandgap_data omap4470_data;
#else
#define omap4430_data NULL
#define omap4460_data NULL
#define omap4470_data NULL
#endif
#ifdef CONFIG_OMAP5_THERMAL
extern const struct ti_bandgap_data omap5430_data;
#else
#define omap5430_data NULL
#endif
#ifdef CONFIG_DRA752_THERMAL
extern const struct ti_bandgap_data dra752_data;
#else
#define dra752_data NULL
#endif
#endif
|