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
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
|
/*
* arch/arm/mach-tegra/board-ardbeg-power.c
*
* Copyright (c) 2013-2014, NVIDIA CORPORATION. All rights reserved.
*
* 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.
*
* 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.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <linux/i2c.h>
#include <linux/platform_device.h>
#include <linux/resource.h>
#include <linux/io.h>
#include <mach/edp.h>
#include <mach/irqs.h>
#include <linux/edp.h>
#include <linux/platform_data/tegra_edp.h>
#include <linux/pid_thermal_gov.h>
#include <linux/regulator/fixed.h>
#include <linux/regulator/machine.h>
#include <linux/irq.h>
#include <linux/gpio.h>
#include <linux/regulator/tegra-dfll-bypass-regulator.h>
#include <linux/tegra-fuse.h>
#include <linux/tegra-pmc.h>
#include <asm/mach-types.h>
#include <mach/pinmux-t12.h>
#include "pm.h"
#include "dvfs.h"
#include "board.h"
#include "tegra-board-id.h"
#include "board-pmu-defines.h"
#include "board-common.h"
#include "board-ardbeg.h"
#include "board-pmu-defines.h"
#include "devices.h"
#include "iomap.h"
#include "tegra_cl_dvfs.h"
#include "tegra11_soctherm.h"
#define E1735_EMULATE_E1767_SKU 1001
static struct tegra_suspend_platform_data ardbeg_suspend_data = {
.cpu_timer = 500,
.cpu_off_timer = 300,
.suspend_mode = TEGRA_SUSPEND_LP0,
.core_timer = 0x157e,
.core_off_timer = 10,
.corereq_high = true,
.sysclkreq_high = true,
.cpu_lp2_min_residency = 1000,
.min_residency_vmin_fmin = 1000,
.min_residency_ncpu_fast = 8000,
.min_residency_ncpu_slow = 5000,
.min_residency_mclk_stop = 5000,
.min_residency_crail = 20000,
};
static struct regulator_consumer_supply fixed_reg_en_avdd_3v3_dp_supply[] = {
REGULATOR_SUPPLY("avdd_3v3_dp", NULL),
};
FIXED_SYNC_REG(121, avdd_3v3_dp, avdd_3v3_dp,
NULL, 0, 0, TEGRA_GPIO_PH3,
false, true, 0, 3300, 0);
static struct platform_device *fixed_reg_devs_e1824[] = {
&fixed_reg_en_avdd_3v3_dp_dev,
};
/************************ ARDBEG CL-DVFS DATA *********************/
#define E1735_CPU_VDD_MAP_SIZE 33
#define E1735_CPU_VDD_MIN_UV 675000
#define E1735_CPU_VDD_STEP_UV 18750
#define E1735_CPU_VDD_STEP_US 80
#define E1735_CPU_VDD_BOOT_UV 1000000
#define E1735_CPU_VDD_IDLE_MA 5000
#define ARDBEG_DEFAULT_CVB_ALIGNMENT 10000
#ifdef CONFIG_ARCH_TEGRA_HAS_CL_DVFS
/* E1735 board parameters for cpu dfll */
static struct tegra_cl_dvfs_cfg_param e1735_cl_dvfs_param = {
.sample_rate = 50000,
.force_mode = TEGRA_CL_DVFS_FORCE_FIXED,
.cf = 10,
.ci = 0,
.cg = 2,
.droop_cut_value = 0xF,
.droop_restore_ramp = 0x0,
.scale_out_ramp = 0x0,
};
/* E1735 dfll bypass device for legacy dvfs control */
static struct regulator_consumer_supply e1735_dfll_bypass_consumers[] = {
REGULATOR_SUPPLY("vdd_cpu", NULL),
};
DFLL_BYPASS(e1735,
E1735_CPU_VDD_MIN_UV, E1735_CPU_VDD_STEP_UV, E1735_CPU_VDD_BOOT_UV,
E1735_CPU_VDD_MAP_SIZE, E1735_CPU_VDD_STEP_US, TEGRA_GPIO_PX2);
static struct tegra_cl_dvfs_platform_data e1735_cl_dvfs_data = {
.dfll_clk_name = "dfll_cpu",
.pmu_if = TEGRA_CL_DVFS_PMU_PWM,
.u.pmu_pwm = {
.pwm_rate = 12750000,
.min_uV = E1735_CPU_VDD_MIN_UV,
.step_uV = E1735_CPU_VDD_STEP_UV,
.pwm_pingroup = TEGRA_PINGROUP_DVFS_PWM,
.out_gpio = TEGRA_GPIO_PS5,
.out_enable_high = false,
#ifdef CONFIG_REGULATOR_TEGRA_DFLL_BYPASS
.dfll_bypass_dev = &e1735_dfll_bypass_dev,
#endif
},
.cfg_param = &e1735_cl_dvfs_param,
};
static void e1735_suspend_dfll_bypass(void)
{
__gpio_set_value(TEGRA_GPIO_PS5, 1); /* tristate external PWM buffer */
}
static void e1735_resume_dfll_bypass(void)
{
__gpio_set_value(TEGRA_GPIO_PS5, 0); /* enable PWM buffer operations */
}
static void e1767_suspend_dfll_bypass(void)
{
tegra_pinmux_set_tristate(TEGRA_PINGROUP_DVFS_PWM, TEGRA_TRI_TRISTATE);
}
static void e1767_resume_dfll_bypass(void)
{
tegra_pinmux_set_tristate(TEGRA_PINGROUP_DVFS_PWM, TEGRA_TRI_NORMAL);
}
static struct tegra_cl_dvfs_cfg_param e1733_ardbeg_cl_dvfs_param = {
.sample_rate = 12500,
.force_mode = TEGRA_CL_DVFS_FORCE_FIXED,
.cf = 10,
.ci = 0,
.cg = 2,
.droop_cut_value = 0xF,
.droop_restore_ramp = 0x0,
.scale_out_ramp = 0x0,
};
/* E1733 volatge map. Fixed 10mv steps from 700mv to 1400mv */
#define E1733_CPU_VDD_MAP_SIZE ((1400000 - 700000) / 10000 + 1)
static struct voltage_reg_map e1733_cpu_vdd_map[E1733_CPU_VDD_MAP_SIZE];
static inline void e1733_fill_reg_map(int minor_ver)
{
int i;
int reg_init_value = (minor_ver == 2) ? 0x1e : 0xa;
for (i = 0; i < E1733_CPU_VDD_MAP_SIZE; i++) {
e1733_cpu_vdd_map[i].reg_value = i + reg_init_value;
e1733_cpu_vdd_map[i].reg_uV = 700000 + 10000 * i;
}
}
static struct tegra_cl_dvfs_platform_data e1733_cl_dvfs_data = {
.dfll_clk_name = "dfll_cpu",
.pmu_if = TEGRA_CL_DVFS_PMU_I2C,
.u.pmu_i2c = {
.fs_rate = 400000,
.slave_addr = 0x80,
.reg = 0x00,
},
.vdd_map = e1733_cpu_vdd_map,
.vdd_map_size = E1733_CPU_VDD_MAP_SIZE,
.cfg_param = &e1733_ardbeg_cl_dvfs_param,
};
static void __init ardbeg_tweak_E1767_dt(void)
{
struct device_node *dn = NULL;
struct property *pp = NULL;
/*
* Update E1735 DT for E1767 prototype. To be removed when
* E1767 is productized with its own DT.
*/
dn = of_find_node_with_property(dn, "pwm-1wire-buffer");
if (dn) {
pp = of_find_property(dn, "pwm-1wire-buffer", NULL);
if (pp)
pp->name = "pwm-1wire-direct";
of_node_put(dn);
}
if (!dn || !pp)
WARN(1, "Failed update DT for PMU E1767 prototype\n");
}
static int __init ardbeg_cl_dvfs_init(struct board_info *pmu_board_info)
{
u16 pmu_board_id = pmu_board_info->board_id;
struct tegra_cl_dvfs_platform_data *data = NULL;
if (pmu_board_id == BOARD_E1735) {
bool e1767 = pmu_board_info->sku == E1735_EMULATE_E1767_SKU;
struct device_node *dn = of_find_compatible_node(
NULL, NULL, "nvidia,tegra124-dfll");
/*
* Ardbeg platforms with E1735 PMIC module maybe used with
* different DT variants. Some of them include CL-DVFS data
* in DT, some - not. Check DT here, and continue with platform
* device registration only if DT DFLL node is not present.
*/
if (dn) {
bool available = of_device_is_available(dn);
of_node_put(dn);
if (available) {
if (e1767)
ardbeg_tweak_E1767_dt();
return 0;
}
}
data = &e1735_cl_dvfs_data;
data->u.pmu_pwm.pwm_bus = e1767 ?
TEGRA_CL_DVFS_PWM_1WIRE_DIRECT :
TEGRA_CL_DVFS_PWM_1WIRE_BUFFER;
if (data->u.pmu_pwm.dfll_bypass_dev) {
platform_device_register(
data->u.pmu_pwm.dfll_bypass_dev);
} else {
(void)e1735_dfll_bypass_dev;
}
}
if (pmu_board_id == BOARD_E1733) {
int minor_ver = 1;
if ((pmu_board_info->major_revision == 'F') &&
(pmu_board_info->minor_revision == 0x2)) {
pr_err("AMS PMIC version 1V2\n");
minor_ver = 2;
} else {
minor_ver = 1;
pr_err("AMS PMIC version 1V2\n");
}
e1733_fill_reg_map(minor_ver);
data = &e1733_cl_dvfs_data;
}
if (data) {
data->flags = TEGRA_CL_DVFS_DYN_OUTPUT_CFG;
tegra_cl_dvfs_device.dev.platform_data = data;
platform_device_register(&tegra_cl_dvfs_device);
}
return 0;
}
#else
static inline int ardbeg_cl_dvfs_init(struct board_info *pmu_board_info)
{ return 0; }
#endif
int __init ardbeg_rail_alignment_init(void)
{
struct board_info pmu_board_info;
tegra_get_pmu_board_info(&pmu_board_info);
#ifdef CONFIG_ARCH_TEGRA_13x_SOC
#else
if (pmu_board_info.board_id == BOARD_E1735)
tegra12x_vdd_cpu_align(E1735_CPU_VDD_STEP_UV,
E1735_CPU_VDD_MIN_UV);
else
tegra12x_vdd_cpu_align(ARDBEG_DEFAULT_CVB_ALIGNMENT, 0);
#endif
return 0;
}
static int __init ardbeg_display_regulator_init(void)
{
struct board_info display_board_info;
tegra_get_display_board_info(&display_board_info);
if (display_board_info.board_id == BOARD_E1824)
platform_add_devices(fixed_reg_devs_e1824,
ARRAY_SIZE(fixed_reg_devs_e1824));
return 0;
}
int __init ardbeg_regulator_init(void)
{
struct board_info pmu_board_info;
ardbeg_display_regulator_init();
tegra_get_pmu_board_info(&pmu_board_info);
switch (pmu_board_info.board_id) {
case BOARD_E1733:
case BOARD_E1734:
tegra_pmc_pmu_interrupt_polarity(true);
break;
case BOARD_E1735:
tegra_pmc_pmu_interrupt_polarity(true);
#ifdef CONFIG_REGULATOR_TEGRA_DFLL_BYPASS
tegra_init_cpu_reg_mode_limits(
E1735_CPU_VDD_IDLE_MA, REGULATOR_MODE_IDLE);
#endif
break;
case BOARD_E1736:
case BOARD_E1936:
case BOARD_E1769:
case BOARD_P1761:
tn8_regulator_init();
return 0;
default:
pr_warn("PMU board id 0x%04x is not supported\n",
pmu_board_info.board_id);
break;
}
ardbeg_cl_dvfs_init(&pmu_board_info);
return 0;
}
int __init ardbeg_suspend_init(void)
{
struct board_info pmu_board_info;
tegra_get_pmu_board_info(&pmu_board_info);
if (pmu_board_info.board_id == BOARD_E1735) {
struct tegra_suspend_platform_data *data = &ardbeg_suspend_data;
if (pmu_board_info.sku != E1735_EMULATE_E1767_SKU) {
data->cpu_timer = 2000;
data->crail_up_early = true;
#ifdef CONFIG_REGULATOR_TEGRA_DFLL_BYPASS
data->suspend_dfll_bypass = e1735_suspend_dfll_bypass;
data->resume_dfll_bypass = e1735_resume_dfll_bypass;
} else {
data->suspend_dfll_bypass = e1767_suspend_dfll_bypass;
data->resume_dfll_bypass = e1767_resume_dfll_bypass;
#endif
}
}
tegra_init_suspend(&ardbeg_suspend_data);
return 0;
}
int __init ardbeg_edp_init(void)
{
unsigned int regulator_mA;
struct board_info pmu_board_info;
tegra_get_pmu_board_info(&pmu_board_info);
regulator_mA = get_maximum_cpu_current_supported();
if (!regulator_mA) {
if (pmu_board_info.board_id == BOARD_E1936)
regulator_mA = 16800;
else if (pmu_board_info.board_id == BOARD_PM374)
regulator_mA = 32000;
else
regulator_mA = 14000;
}
pr_info("%s: CPU regulator %d mA\n", __func__, regulator_mA);
tegra_init_cpu_edp_limits(regulator_mA);
/* gpu maximum current */
if (pmu_board_info.board_id == BOARD_E1936)
regulator_mA = 11200;
else if (pmu_board_info.board_id == BOARD_PM374)
regulator_mA = 16000;
else
regulator_mA = 12000;
pr_info("%s: GPU regulator %d mA\n", __func__, regulator_mA);
tegra_init_gpu_edp_limits(regulator_mA);
return 0;
}
static struct pid_thermal_gov_params soctherm_pid_params = {
.max_err_temp = 9000,
.max_err_gain = 1000,
.gain_p = 1000,
.gain_d = 0,
.up_compensation = 20,
.down_compensation = 20,
};
static struct thermal_zone_params soctherm_tzp = {
.governor_name = "pid_thermal_gov",
.governor_params = &soctherm_pid_params,
};
static struct tegra_thermtrip_pmic_data tpdata_palmas = {
.reset_tegra = 1,
.pmu_16bit_ops = 0,
.controller_type = 0,
.pmu_i2c_addr = 0x58,
.i2c_controller_id = 4,
.poweroff_reg_addr = 0xa0,
.poweroff_reg_data = 0x0,
};
static struct tegra_thermtrip_pmic_data tpdata_as3722 = {
.reset_tegra = 1,
.pmu_16bit_ops = 0,
.controller_type = 0,
.pmu_i2c_addr = 0x40,
.i2c_controller_id = 4,
.poweroff_reg_addr = 0x36,
.poweroff_reg_data = 0x2,
};
static struct soctherm_therm ardbeg_therm_pop[THERM_SIZE] = {
[THERM_CPU] = {
.zone_enable = true,
.passive_delay = 1000,
.hotspot_offset = 6000,
.num_trips = 3,
.trips = {
{
.cdev_type = "tegra-shutdown",
.trip_temp = 97000,
.trip_type = THERMAL_TRIP_CRITICAL,
.upper = THERMAL_NO_LIMIT,
.lower = THERMAL_NO_LIMIT,
},
{
.cdev_type = "tegra-heavy",
.trip_temp = 94000,
.trip_type = THERMAL_TRIP_HOT,
.upper = THERMAL_NO_LIMIT,
.lower = THERMAL_NO_LIMIT,
},
{
.cdev_type = "cpu-balanced",
.trip_temp = 84000,
.trip_type = THERMAL_TRIP_PASSIVE,
.upper = THERMAL_NO_LIMIT,
.lower = THERMAL_NO_LIMIT,
},
},
.tzp = &soctherm_tzp,
},
[THERM_GPU] = {
.zone_enable = true,
.passive_delay = 1000,
.hotspot_offset = 6000,
.num_trips = 3,
.trips = {
{
.cdev_type = "tegra-shutdown",
.trip_temp = 93000,
.trip_type = THERMAL_TRIP_CRITICAL,
.upper = THERMAL_NO_LIMIT,
.lower = THERMAL_NO_LIMIT,
},
{
.cdev_type = "tegra-heavy",
.trip_temp = 91000,
.trip_type = THERMAL_TRIP_HOT,
.upper = THERMAL_NO_LIMIT,
.lower = THERMAL_NO_LIMIT,
},
{
.cdev_type = "gpu-balanced",
.trip_temp = 81000,
.trip_type = THERMAL_TRIP_PASSIVE,
.upper = THERMAL_NO_LIMIT,
.lower = THERMAL_NO_LIMIT,
},
},
.tzp = &soctherm_tzp,
},
[THERM_MEM] = {
.zone_enable = true,
.num_trips = 1,
.trips = {
{
.cdev_type = "tegra-shutdown",
.trip_temp = 93000, /* = GPU shut */
.trip_type = THERMAL_TRIP_CRITICAL,
.upper = THERMAL_NO_LIMIT,
.lower = THERMAL_NO_LIMIT,
},
},
.tzp = &soctherm_tzp,
},
[THERM_PLL] = {
.zone_enable = true,
.num_trips = 1,
.trips = {
{
.cdev_type = "tegra-dram",
.trip_temp = 78000,
.trip_type = THERMAL_TRIP_ACTIVE,
.upper = 1,
.lower = 1,
},
},
.tzp = &soctherm_tzp,
},
};
static struct soctherm_platform_data ardbeg_soctherm_data = {
.oc_irq_base = TEGRA_SOC_OC_IRQ_BASE,
.num_oc_irqs = TEGRA_SOC_OC_NUM_IRQ,
.therm = {
[THERM_CPU] = {
.zone_enable = true,
.passive_delay = 1000,
.hotspot_offset = 6000,
.num_trips = 3,
.trips = {
{
.cdev_type = "tegra-shutdown",
.trip_temp = 101000,
.trip_type = THERMAL_TRIP_CRITICAL,
.upper = THERMAL_NO_LIMIT,
.lower = THERMAL_NO_LIMIT,
},
{
.cdev_type = "tegra-heavy",
.trip_temp = 99000,
.trip_type = THERMAL_TRIP_HOT,
.upper = THERMAL_NO_LIMIT,
.lower = THERMAL_NO_LIMIT,
},
{
.cdev_type = "cpu-balanced",
.trip_temp = 90000,
.trip_type = THERMAL_TRIP_PASSIVE,
.upper = THERMAL_NO_LIMIT,
.lower = THERMAL_NO_LIMIT,
},
},
.tzp = &soctherm_tzp,
},
[THERM_GPU] = {
.zone_enable = true,
.passive_delay = 1000,
.hotspot_offset = 6000,
.num_trips = 3,
.trips = {
{
.cdev_type = "tegra-shutdown",
.trip_temp = 101000,
.trip_type = THERMAL_TRIP_CRITICAL,
.upper = THERMAL_NO_LIMIT,
.lower = THERMAL_NO_LIMIT,
},
{
.cdev_type = "tegra-heavy",
.trip_temp = 99000,
.trip_type = THERMAL_TRIP_HOT,
.upper = THERMAL_NO_LIMIT,
.lower = THERMAL_NO_LIMIT,
},
{
.cdev_type = "gpu-balanced",
.trip_temp = 90000,
.trip_type = THERMAL_TRIP_PASSIVE,
.upper = THERMAL_NO_LIMIT,
.lower = THERMAL_NO_LIMIT,
},
},
.tzp = &soctherm_tzp,
},
[THERM_MEM] = {
.zone_enable = true,
.num_trips = 1,
.trips = {
{
.cdev_type = "tegra-shutdown",
.trip_temp = 101000, /* = GPU shut */
.trip_type = THERMAL_TRIP_CRITICAL,
.upper = THERMAL_NO_LIMIT,
.lower = THERMAL_NO_LIMIT,
},
},
.tzp = &soctherm_tzp,
},
[THERM_PLL] = {
.zone_enable = true,
.tzp = &soctherm_tzp,
},
},
.throttle = {
[THROTTLE_HEAVY] = {
.priority = 100,
.devs = {
[THROTTLE_DEV_CPU] = {
.enable = true,
.depth = 80,
.throttling_depth = "heavy_throttling",
},
[THROTTLE_DEV_GPU] = {
.enable = true,
.throttling_depth = "heavy_throttling",
},
},
},
},
};
/* Only the diffs from ardbeg_soctherm_data structure */
static struct soctherm_platform_data t132ref_v1_soctherm_data = {
.therm = {
[THERM_CPU] = {
.zone_enable = true,
.passive_delay = 1000,
.hotspot_offset = 6000,
},
[THERM_PLL] = {
.zone_enable = true,
.passive_delay = 1000,
.num_trips = 3,
.trips = {
{
.cdev_type = "tegra-shutdown",
.trip_temp = 99000,
.trip_type = THERMAL_TRIP_CRITICAL,
.upper = THERMAL_NO_LIMIT,
.lower = THERMAL_NO_LIMIT,
},
{
.cdev_type = "tegra-heavy",
.trip_temp = 96000,
.trip_type = THERMAL_TRIP_HOT,
.upper = THERMAL_NO_LIMIT,
.lower = THERMAL_NO_LIMIT,
},
{
.cdev_type = "cpu-balanced",
.trip_temp = 86000,
.trip_type = THERMAL_TRIP_PASSIVE,
.upper = THERMAL_NO_LIMIT,
.lower = THERMAL_NO_LIMIT,
},
},
.tzp = &soctherm_tzp,
},
},
};
static struct soctherm_throttle battery_oc_throttle = {
.throt_mode = BRIEF,
.polarity = SOCTHERM_ACTIVE_LOW,
.priority = 100,
.devs = {
[THROTTLE_DEV_CPU] = {
.enable = true,
.depth = 50,
.throttling_depth = "medium_throttling",
},
[THROTTLE_DEV_GPU] = {
.enable = true,
.throttling_depth = "medium_throttling",
},
},
};
static struct soctherm_throttle voltmon_throttle = {
.throt_mode = BRIEF,
.polarity = SOCTHERM_ACTIVE_LOW,
.priority = 50,
.intr = true,
.alarm_cnt_threshold = 100,
.alarm_filter = 5100000,
.devs = {
[THROTTLE_DEV_CPU] = {
.enable = true,
/* throttle depth 75% with 3.76us ramp rate */
.dividend = 63,
.divisor = 255,
.duration = 0,
.step = 0,
.throttling_depth = "medium_throttling",
},
[THROTTLE_DEV_GPU] = {
.enable = true,
.throttling_depth = "medium_throttling",
},
},
};
int __init ardbeg_soctherm_init(void)
{
s32 base_cp, shft_cp;
u32 base_ft, shft_ft;
struct board_info pmu_board_info;
struct board_info board_info;
enum soctherm_therm_id therm_cpu;
tegra_get_board_info(&board_info);
if (board_info.board_id == BOARD_E1923 ||
board_info.board_id == BOARD_E1922) {
memcpy(ardbeg_soctherm_data.therm,
ardbeg_therm_pop, sizeof(ardbeg_therm_pop));
}
/* Bowmore and P1761 are T132 platforms: ATE rev check (TODO) */
if (board_info.board_id == BOARD_E1971 ||
board_info.board_id == BOARD_P1761 ||
board_info.board_id == BOARD_E1991) {
memcpy(&ardbeg_soctherm_data.therm[THERM_CPU],
&t132ref_v1_soctherm_data.therm[THERM_CPU],
sizeof(t132ref_v1_soctherm_data.therm[THERM_CPU]));
memcpy(&ardbeg_soctherm_data.therm[THERM_PLL],
&t132ref_v1_soctherm_data.therm[THERM_PLL],
sizeof(t132ref_v1_soctherm_data.therm[THERM_PLL]));
therm_cpu = THERM_PLL; /* override CPU zone with PLL zone */
} else {
therm_cpu = THERM_CPU;
}
/* do this only for supported CP,FT fuses */
if ((tegra_fuse_calib_base_get_cp(&base_cp, &shft_cp) >= 0) &&
(tegra_fuse_calib_base_get_ft(&base_ft, &shft_ft) >= 0)) {
tegra_platform_edp_init(
ardbeg_soctherm_data.therm[therm_cpu].trips,
&ardbeg_soctherm_data.therm[therm_cpu].num_trips,
7000); /* edp temperature margin */
tegra_platform_gpu_edp_init(
ardbeg_soctherm_data.therm[THERM_GPU].trips,
&ardbeg_soctherm_data.therm[THERM_GPU].num_trips,
7000);
tegra_add_cpu_vmax_trips(
ardbeg_soctherm_data.therm[therm_cpu].trips,
&ardbeg_soctherm_data.therm[therm_cpu].num_trips);
tegra_add_tgpu_trips(
ardbeg_soctherm_data.therm[THERM_GPU].trips,
&ardbeg_soctherm_data.therm[THERM_GPU].num_trips);
tegra_add_vc_trips(
ardbeg_soctherm_data.therm[therm_cpu].trips,
&ardbeg_soctherm_data.therm[therm_cpu].num_trips);
tegra_add_core_vmax_trips(
ardbeg_soctherm_data.therm[THERM_PLL].trips,
&ardbeg_soctherm_data.therm[THERM_PLL].num_trips);
}
if (board_info.board_id == BOARD_P1761 ||
board_info.board_id == BOARD_E1784 ||
board_info.board_id == BOARD_E1971 ||
board_info.board_id == BOARD_E1991 ||
board_info.board_id == BOARD_E1922) {
tegra_add_cpu_vmin_trips(
ardbeg_soctherm_data.therm[therm_cpu].trips,
&ardbeg_soctherm_data.therm[therm_cpu].num_trips);
tegra_add_gpu_vmin_trips(
ardbeg_soctherm_data.therm[THERM_GPU].trips,
&ardbeg_soctherm_data.therm[THERM_GPU].num_trips);
tegra_add_core_vmin_trips(
ardbeg_soctherm_data.therm[THERM_PLL].trips,
&ardbeg_soctherm_data.therm[THERM_PLL].num_trips);
}
tegra_get_pmu_board_info(&pmu_board_info);
if ((pmu_board_info.board_id == BOARD_E1733) ||
(pmu_board_info.board_id == BOARD_E1734))
ardbeg_soctherm_data.tshut_pmu_trip_data = &tpdata_as3722;
else if (pmu_board_info.board_id == BOARD_E1735 ||
pmu_board_info.board_id == BOARD_E1736 ||
pmu_board_info.board_id == BOARD_E1769 ||
pmu_board_info.board_id == BOARD_P1761 ||
pmu_board_info.board_id == BOARD_E1936)
ardbeg_soctherm_data.tshut_pmu_trip_data = &tpdata_palmas;
else
pr_warn("soctherm THERMTRIP not supported on PMU (BOARD_E%d)\n",
pmu_board_info.board_id);
/* Enable soc_therm OC throttling on selected platforms */
switch (pmu_board_info.board_id) {
case BOARD_P1761:
memcpy(&ardbeg_soctherm_data.throttle[THROTTLE_OC4],
&battery_oc_throttle,
sizeof(battery_oc_throttle));
memcpy(&ardbeg_soctherm_data.throttle[THROTTLE_OC1],
&voltmon_throttle,
sizeof(voltmon_throttle));
break;
default:
break;
}
return tegra11_soctherm_init(&ardbeg_soctherm_data);
}
|