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
|
/*
* arch/arm/mach-tegra/board-macallan-power.c
*
* Copyright (C) 2012-2013 NVIDIA Corporation.
*
* 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/pda_power.h>
#include <linux/platform_device.h>
#include <linux/resource.h>
#include <linux/io.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/fixed.h>
#include <linux/mfd/palmas.h>
#include <linux/power/bq2419x-charger.h>
#include <linux/max17048_battery.h>
#include <linux/gpio.h>
#include <linux/interrupt.h>
#include <linux/regulator/userspace-consumer.h>
#include <asm/mach-types.h>
#include <linux/power/sbs-battery.h>
#include <mach/iomap.h>
#include <mach/irqs.h>
#include <mach/hardware.h>
#include <mach/edp.h>
#include <mach/gpio-tegra.h>
#include "cpu-tegra.h"
#include "pm.h"
#include "tegra-board-id.h"
#include "board.h"
#include "gpio-names.h"
#include "board-common.h"
#include "board-macallan.h"
#include "tegra_cl_dvfs.h"
#include "devices.h"
#include "tegra11_soctherm.h"
#include "tegra3_tsensor.h"
#define PMC_CTRL 0x0
#define PMC_CTRL_INTR_LOW (1 << 17)
/* BQ2419X VBUS regulator */
static struct regulator_consumer_supply bq2419x_vbus_supply[] = {
REGULATOR_SUPPLY("usb_vbus", "tegra-ehci.0"),
};
static struct bq2419x_vbus_platform_data bq2419x_vbus_pdata = {
.gpio_otg_iusb = TEGRA_GPIO_PI4,
.num_consumer_supplies = ARRAY_SIZE(bq2419x_vbus_supply),
.consumer_supplies = bq2419x_vbus_supply,
};
struct bq2419x_platform_data macallan_bq2419x_pdata = {
.vbus_pdata = &bq2419x_vbus_pdata,
};
static struct i2c_board_info __initdata bq2419x_boardinfo[] = {
{
I2C_BOARD_INFO("bq2419x", 0x6b),
.platform_data = &macallan_bq2419x_pdata,
},
};
/************************ Macallan based regulator ****************/
static struct regulator_consumer_supply palmas_smps123_supply[] = {
REGULATOR_SUPPLY("vdd_cpu", NULL),
};
static struct regulator_consumer_supply palmas_smps45_supply[] = {
REGULATOR_SUPPLY("vdd_core", NULL),
};
static struct regulator_consumer_supply palmas_smps6_supply[] = {
REGULATOR_SUPPLY("vdd_lcd_hv", NULL),
REGULATOR_SUPPLY("avdd_lcd", NULL),
REGULATOR_SUPPLY("avdd", "spi0.0"),
};
static struct regulator_consumer_supply palmas_smps7_supply[] = {
REGULATOR_SUPPLY("vddio_ddr", NULL),
};
static struct regulator_consumer_supply palmas_smps8_supply[] = {
REGULATOR_SUPPLY("avdd_usb_pll", "tegra-udc.0"),
REGULATOR_SUPPLY("avdd_usb_pll", "tegra-ehci.0"),
REGULATOR_SUPPLY("avdd_usb_pll", "tegra-ehci.1"),
REGULATOR_SUPPLY("avdd_osc", NULL),
REGULATOR_SUPPLY("vddio_sys", NULL),
REGULATOR_SUPPLY("vddio_bb", NULL),
REGULATOR_SUPPLY("vddio_sdmmc", "sdhci-tegra.0"),
REGULATOR_SUPPLY("pwrdet_sdmmc1", NULL),
REGULATOR_SUPPLY("vddio_sdmmc", "sdhci-tegra.3"),
REGULATOR_SUPPLY("vdd_emmc", "sdhci-tegra.3"),
REGULATOR_SUPPLY("pwrdet_sdmmc4", NULL),
REGULATOR_SUPPLY("vddio_audio", NULL),
REGULATOR_SUPPLY("pwrdet_audio", NULL),
REGULATOR_SUPPLY("vddio_uart", NULL),
REGULATOR_SUPPLY("pwrdet_uart", NULL),
REGULATOR_SUPPLY("vddio_gmi", NULL),
};
static struct regulator_consumer_supply palmas_smps9_supply[] = {
REGULATOR_SUPPLY("vddio_sd_slot", "sdhci-tegra.3"),
};
static struct regulator_consumer_supply palmas_smps10_supply[] = {
};
static struct regulator_consumer_supply palmas_ldo1_supply[] = {
REGULATOR_SUPPLY("avdd_hdmi_pll", "tegradc.1"),
REGULATOR_SUPPLY("avdd_csi_dsi_pll", "tegradc.0"),
REGULATOR_SUPPLY("avdd_csi_dsi_pll", "tegradc.1"),
REGULATOR_SUPPLY("avdd_csi_dsi_pll", "vi"),
REGULATOR_SUPPLY("avdd_pllm", NULL),
REGULATOR_SUPPLY("avdd_pllu", NULL),
REGULATOR_SUPPLY("avdd_plla_p_c", NULL),
REGULATOR_SUPPLY("avdd_pllx", NULL),
REGULATOR_SUPPLY("vdd_ddr_hs", NULL),
REGULATOR_SUPPLY("avdd_plle", NULL),
};
static struct regulator_consumer_supply palmas_ldo2_supply[] = {
REGULATOR_SUPPLY("avdd_dsi_csi", "tegradc.0"),
REGULATOR_SUPPLY("avdd_dsi_csi", "tegradc.1"),
REGULATOR_SUPPLY("avdd_dsi_csi", "vi"),
REGULATOR_SUPPLY("vddio_hsic", "tegra-ehci.1"),
REGULATOR_SUPPLY("vddio_hsic", "tegra-ehci.2"),
};
static struct regulator_consumer_supply palmas_ldo3_supply[] = {
REGULATOR_SUPPLY("vpp_fuse", NULL),
};
static struct regulator_consumer_supply palmas_ldo4_supply[] = {
REGULATOR_SUPPLY("vdd_1v2_cam", NULL),
REGULATOR_SUPPLY("dvdd", "2-0010"),
REGULATOR_SUPPLY("vdig", "2-0036"),
};
static struct regulator_consumer_supply palmas_ldo5_supply[] = {
REGULATOR_SUPPLY("avdd_cam2", NULL),
REGULATOR_SUPPLY("avdd", "2-0010"),
};
static struct regulator_consumer_supply palmas_ldo6_supply[] = {
};
static struct regulator_consumer_supply palmas_ldo7_supply[] = {
REGULATOR_SUPPLY("avdd_2v8_cam_af", NULL),
REGULATOR_SUPPLY("vdd_af_cam1", NULL),
REGULATOR_SUPPLY("avdd_cam1", NULL),
REGULATOR_SUPPLY("vana", "2-0036"),
REGULATOR_SUPPLY("vdd", "2-000e"),
};
static struct regulator_consumer_supply palmas_ldo8_supply[] = {
REGULATOR_SUPPLY("vdd_rtc", NULL),
};
static struct regulator_consumer_supply palmas_ldo9_supply[] = {
REGULATOR_SUPPLY("vddio_sdmmc", "sdhci-tegra.2"),
REGULATOR_SUPPLY("pwrdet_sdmmc3", NULL),
};
static struct regulator_consumer_supply palmas_ldoln_supply[] = {
REGULATOR_SUPPLY("avdd_hdmi", "tegradc.1"),
};
static struct regulator_consumer_supply palmas_ldousb_supply[] = {
REGULATOR_SUPPLY("avdd_usb", "tegra-udc.0"),
REGULATOR_SUPPLY("avdd_usb", "tegra-ehci.0"),
REGULATOR_SUPPLY("avdd_usb", "tegra-ehci.1"),
REGULATOR_SUPPLY("avdd_usb", "tegra-ehci.2"),
REGULATOR_SUPPLY("hvdd_usb", "tegra-ehci.2"),
};
static struct regulator_consumer_supply palmas_regen1_supply[] = {
};
static struct regulator_consumer_supply palmas_regen2_supply[] = {
};
#define PALMAS_PDATA_INIT(_name, _minmv, _maxmv, _supply_reg, _always_on, \
_boot_on, _apply_uv) \
static struct regulator_init_data reg_idata_##_name = { \
.constraints = { \
.name = palmas_rails(_name), \
.min_uV = (_minmv)*1000, \
.max_uV = (_maxmv)*1000, \
.valid_modes_mask = (REGULATOR_MODE_NORMAL | \
REGULATOR_MODE_STANDBY), \
.valid_ops_mask = (REGULATOR_CHANGE_MODE | \
REGULATOR_CHANGE_STATUS | \
REGULATOR_CHANGE_VOLTAGE), \
.always_on = _always_on, \
.boot_on = _boot_on, \
.apply_uV = _apply_uv, \
}, \
.num_consumer_supplies = \
ARRAY_SIZE(palmas_##_name##_supply), \
.consumer_supplies = palmas_##_name##_supply, \
.supply_regulator = _supply_reg, \
}
PALMAS_PDATA_INIT(smps123, 900, 1300, NULL, 0, 0, 0);
PALMAS_PDATA_INIT(smps45, 900, 1400, NULL, 0, 0, 0);
PALMAS_PDATA_INIT(smps6, 2800, 3000, NULL, 0, 0, 0);
PALMAS_PDATA_INIT(smps7, 1350, 1350, NULL, 0, 0, 1);
PALMAS_PDATA_INIT(smps8, 1800, 1800, NULL, 1, 1, 1);
PALMAS_PDATA_INIT(smps9, 2900, 2900, NULL, 1, 0, 1);
PALMAS_PDATA_INIT(smps10, 5000, 5000, NULL, 0, 0, 0);
PALMAS_PDATA_INIT(ldo1, 1050, 1050, palmas_rails(smps7), 1, 0, 1);
PALMAS_PDATA_INIT(ldo2, 1200, 1200, palmas_rails(smps7), 0, 1, 1);
PALMAS_PDATA_INIT(ldo3, 1800, 1800, NULL, 0, 0, 0);
PALMAS_PDATA_INIT(ldo4, 1200, 1200, palmas_rails(smps8), 0, 0, 0);
PALMAS_PDATA_INIT(ldo5, 2700, 2700, palmas_rails(smps9), 0, 0, 1);
PALMAS_PDATA_INIT(ldo6, 2850, 2850, palmas_rails(smps9), 1, 1, 1);
PALMAS_PDATA_INIT(ldo7, 2700, 2700, palmas_rails(smps9), 0, 0, 1);
PALMAS_PDATA_INIT(ldo8, 1100, 1100, NULL, 1, 1, 1);
PALMAS_PDATA_INIT(ldo9, 1800, 2900, palmas_rails(smps9), 0, 0, 1);
PALMAS_PDATA_INIT(ldoln, 3300, 3300, NULL, 0, 0, 1);
PALMAS_PDATA_INIT(ldousb, 3300, 3300, NULL, 0, 0, 1);
PALMAS_PDATA_INIT(regen1, 4200, 4200, NULL, 0, 0, 0);
PALMAS_PDATA_INIT(regen2, 4200, 4200, palmas_rails(smps8), 0, 0, 0);
#define PALMAS_REG_PDATA(_sname) (®_idata_##_sname)
static struct regulator_init_data *macallan_reg_data[PALMAS_NUM_REGS] = {
NULL,
PALMAS_REG_PDATA(smps123),
NULL,
PALMAS_REG_PDATA(smps45),
NULL,
PALMAS_REG_PDATA(smps6),
PALMAS_REG_PDATA(smps7),
PALMAS_REG_PDATA(smps8),
PALMAS_REG_PDATA(smps9),
PALMAS_REG_PDATA(smps10),
PALMAS_REG_PDATA(ldo1),
PALMAS_REG_PDATA(ldo2),
PALMAS_REG_PDATA(ldo3),
PALMAS_REG_PDATA(ldo4),
PALMAS_REG_PDATA(ldo5),
PALMAS_REG_PDATA(ldo6),
PALMAS_REG_PDATA(ldo7),
PALMAS_REG_PDATA(ldo8),
PALMAS_REG_PDATA(ldo9),
PALMAS_REG_PDATA(ldoln),
PALMAS_REG_PDATA(ldousb),
PALMAS_REG_PDATA(regen1),
PALMAS_REG_PDATA(regen2),
NULL,
NULL,
NULL,
};
#define PALMAS_REG_INIT(_name, _warm_reset, _roof_floor, _mode_sleep, \
_tstep, _vsel) \
static struct palmas_reg_init reg_init_data_##_name = { \
.warm_reset = _warm_reset, \
.roof_floor = _roof_floor, \
.mode_sleep = _mode_sleep, \
.tstep = _tstep, \
.vsel = _vsel, \
}
PALMAS_REG_INIT(smps12, 0, 0, 0, 0, 0);
PALMAS_REG_INIT(smps123, 0, PALMAS_EXT_CONTROL_ENABLE1, 0, 0, 0);
PALMAS_REG_INIT(smps3, 0, 0, 0, 0, 0);
PALMAS_REG_INIT(smps45, 0, PALMAS_EXT_CONTROL_NSLEEP, 0, 0, 0);
PALMAS_REG_INIT(smps457, 0, 0, 0, 0, 0);
PALMAS_REG_INIT(smps6, 0, 0, 0, 0, 0);
PALMAS_REG_INIT(smps7, 0, 0, 0, 0, 0);
PALMAS_REG_INIT(smps8, 0, 0, 0, 0, 0);
PALMAS_REG_INIT(smps9, 0, 0, 0, 0, 0);
PALMAS_REG_INIT(smps10, 0, 0, 0, 0, 0);
PALMAS_REG_INIT(ldo1, 0, PALMAS_EXT_CONTROL_NSLEEP, 0, 0, 0);
PALMAS_REG_INIT(ldo2, 0, PALMAS_EXT_CONTROL_NSLEEP, 0, 0, 0);
PALMAS_REG_INIT(ldo3, 0, PALMAS_EXT_CONTROL_NSLEEP, 0, 0, 0);
PALMAS_REG_INIT(ldo4, 0, PALMAS_EXT_CONTROL_NSLEEP, 0, 0, 0);
PALMAS_REG_INIT(ldo5, 0, PALMAS_EXT_CONTROL_NSLEEP, 0, 0, 0);
PALMAS_REG_INIT(ldo6, 0, 0, 0, 0, 0);
PALMAS_REG_INIT(ldo7, 0, PALMAS_EXT_CONTROL_NSLEEP, 0, 0, 0);
PALMAS_REG_INIT(ldo8, 0, 0, 0, 0, 0);
PALMAS_REG_INIT(ldo9, 0, PALMAS_EXT_CONTROL_NSLEEP, 0, 0, 0);
PALMAS_REG_INIT(ldoln, 0, PALMAS_EXT_CONTROL_NSLEEP, 0, 0, 0);
PALMAS_REG_INIT(ldousb, 0, PALMAS_EXT_CONTROL_NSLEEP, 0, 0, 0);
#define PALMAS_REG_INIT_DATA(_sname) (®_init_data_##_sname)
static struct palmas_reg_init *macallan_reg_init[PALMAS_NUM_REGS] = {
PALMAS_REG_INIT_DATA(smps12),
PALMAS_REG_INIT_DATA(smps123),
PALMAS_REG_INIT_DATA(smps3),
PALMAS_REG_INIT_DATA(smps45),
PALMAS_REG_INIT_DATA(smps457),
PALMAS_REG_INIT_DATA(smps6),
PALMAS_REG_INIT_DATA(smps7),
PALMAS_REG_INIT_DATA(smps8),
PALMAS_REG_INIT_DATA(smps9),
PALMAS_REG_INIT_DATA(smps10),
PALMAS_REG_INIT_DATA(ldo1),
PALMAS_REG_INIT_DATA(ldo2),
PALMAS_REG_INIT_DATA(ldo3),
PALMAS_REG_INIT_DATA(ldo4),
PALMAS_REG_INIT_DATA(ldo5),
PALMAS_REG_INIT_DATA(ldo6),
PALMAS_REG_INIT_DATA(ldo7),
PALMAS_REG_INIT_DATA(ldo8),
PALMAS_REG_INIT_DATA(ldo9),
PALMAS_REG_INIT_DATA(ldoln),
PALMAS_REG_INIT_DATA(ldousb),
};
static struct palmas_pmic_platform_data pmic_platform = {
.enable_ldo8_tracking = true,
.disabe_ldo8_tracking_suspend = true,
.disable_smps10_boost_suspend = true,
};
static struct palmas_platform_data palmas_pdata = {
.gpio_base = PALMAS_TEGRA_GPIO_BASE,
.irq_base = PALMAS_TEGRA_IRQ_BASE,
.pmic_pdata = &pmic_platform,
.mux_from_pdata = true,
.pad1 = 0,
.pad2 = 0,
.pad3 = PALMAS_PRIMARY_SECONDARY_PAD3_DVFS1,
.use_power_off = true,
};
static struct i2c_board_info palma_device[] = {
{
I2C_BOARD_INFO("tps65913", 0x58),
.irq = INT_EXTERNAL_PMU,
.platform_data = &palmas_pdata,
},
};
static struct regulator_consumer_supply fixed_reg_dvdd_lcd_1v8_supply[] = {
REGULATOR_SUPPLY("dvdd_lcd", NULL),
};
static struct regulator_consumer_supply fixed_reg_vdd_lcd_bl_en_supply[] = {
REGULATOR_SUPPLY("vdd_lcd_bl_en", NULL),
};
/* EN_1V8_TS From TEGRA_GPIO_PH4 */
static struct regulator_consumer_supply fixed_reg_dvdd_ts_supply[] = {
REGULATOR_SUPPLY("dvdd", "spi0.0"),
};
/* ENABLE 5v0 for HDMI */
static struct regulator_consumer_supply fixed_reg_vdd_hdmi_5v0_supply[] = {
REGULATOR_SUPPLY("vdd_hdmi_5v0", "tegradc.1"),
};
static struct regulator_consumer_supply fixed_reg_vddio_sd_slot_supply[] = {
REGULATOR_SUPPLY("vddio_sd_slot", "sdhci-tegra.2"),
};
static struct regulator_consumer_supply fixed_reg_vd_cam_1v8_supply[] = {
REGULATOR_SUPPLY("vdd_cam_1v8", NULL),
REGULATOR_SUPPLY("vi2c", "2-0030"),
REGULATOR_SUPPLY("vif", "2-0036"),
REGULATOR_SUPPLY("dovdd", "2-0010"),
REGULATOR_SUPPLY("vdd_i2c", "2-000e"),
};
/* Macro for defining fixed regulator sub device data */
#define FIXED_SUPPLY(_name) "fixed_reg_"#_name
#define FIXED_REG(_id, _var, _name, _in_supply, _always_on, _boot_on, \
_gpio_nr, _open_drain, _active_high, _boot_state, _millivolts) \
static struct regulator_init_data ri_data_##_var = \
{ \
.supply_regulator = _in_supply, \
.num_consumer_supplies = \
ARRAY_SIZE(fixed_reg_##_name##_supply), \
.consumer_supplies = fixed_reg_##_name##_supply, \
.constraints = { \
.valid_modes_mask = (REGULATOR_MODE_NORMAL | \
REGULATOR_MODE_STANDBY), \
.valid_ops_mask = (REGULATOR_CHANGE_MODE | \
REGULATOR_CHANGE_STATUS | \
REGULATOR_CHANGE_VOLTAGE), \
.always_on = _always_on, \
.boot_on = _boot_on, \
}, \
}; \
static struct fixed_voltage_config fixed_reg_##_var##_pdata = \
{ \
.supply_name = FIXED_SUPPLY(_name), \
.microvolts = _millivolts * 1000, \
.gpio = _gpio_nr, \
.gpio_is_open_drain = _open_drain, \
.enable_high = _active_high, \
.enabled_at_boot = _boot_state, \
.init_data = &ri_data_##_var, \
}; \
static struct platform_device fixed_reg_##_var##_dev = { \
.name = "reg-fixed-voltage", \
.id = _id, \
.dev = { \
.platform_data = &fixed_reg_##_var##_pdata, \
}, \
}
/*
* Creating the fixed regulator device table
*/
FIXED_REG(1, dvdd_lcd_1v8, dvdd_lcd_1v8,
palmas_rails(smps8), 0, 1,
PALMAS_TEGRA_GPIO_BASE + PALMAS_GPIO4, false, true, 1, 1800);
FIXED_REG(2, vdd_lcd_bl_en, vdd_lcd_bl_en,
NULL, 0, 1,
TEGRA_GPIO_PH2, false, true, 1, 3700);
FIXED_REG(3, dvdd_ts, dvdd_ts,
palmas_rails(smps8), 0, 0,
TEGRA_GPIO_PH4, false, false, 1, 1800);
FIXED_REG(4, vdd_hdmi_5v0, vdd_hdmi_5v0,
palmas_rails(smps10), 0, 0,
TEGRA_GPIO_PK6, false, true, 0, 5000);
FIXED_REG(5, vddio_sd_slot, vddio_sd_slot,
palmas_rails(smps9), 0, 0,
TEGRA_GPIO_PK1, false, true, 0, 2900);
FIXED_REG(6, vd_cam_1v8, vd_cam_1v8,
palmas_rails(smps8), 0, 0,
PALMAS_TEGRA_GPIO_BASE + PALMAS_GPIO6, false, true, 0, 1800);
#define ADD_FIXED_REG(_name) (&fixed_reg_##_name##_dev)
/* Gpio switch regulator platform data for Macallan E1545 */
static struct platform_device *fixed_reg_devs[] = {
ADD_FIXED_REG(dvdd_lcd_1v8),
ADD_FIXED_REG(vdd_lcd_bl_en),
ADD_FIXED_REG(dvdd_ts),
ADD_FIXED_REG(vdd_hdmi_5v0),
ADD_FIXED_REG(vddio_sd_slot),
ADD_FIXED_REG(vd_cam_1v8),
};
int __init macallan_palmas_regulator_init(void)
{
void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE);
u32 pmc_ctrl;
int i;
/* TPS65913: Normal state of INT request line is LOW.
* configure the power management controller to trigger PMU
* interrupts when HIGH.
*/
pmc_ctrl = readl(pmc + PMC_CTRL);
writel(pmc_ctrl | PMC_CTRL_INTR_LOW, pmc + PMC_CTRL);
for (i = 0; i < PALMAS_NUM_REGS ; i++) {
pmic_platform.reg_data[i] = macallan_reg_data[i];
pmic_platform.reg_init[i] = macallan_reg_init[i];
}
i2c_register_board_info(4, palma_device,
ARRAY_SIZE(palma_device));
i2c_register_board_info(0, bq2419x_boardinfo,
ARRAY_SIZE(bq2419x_boardinfo));
return 0;
}
static int ac_online(void)
{
return 1;
}
static struct resource macallan_pda_resources[] = {
[0] = {
.name = "ac",
},
};
static struct pda_power_pdata macallan_pda_data = {
.is_ac_online = ac_online,
};
static struct platform_device macallan_pda_power_device = {
.name = "pda-power",
.id = -1,
.resource = macallan_pda_resources,
.num_resources = ARRAY_SIZE(macallan_pda_resources),
.dev = {
.platform_data = &macallan_pda_data,
},
};
static struct tegra_suspend_platform_data macallan_suspend_data = {
.cpu_timer = 300,
.cpu_off_timer = 300,
.suspend_mode = TEGRA_SUSPEND_LP0,
.core_timer = 0x157e,
.core_off_timer = 2000,
.corereq_high = true,
.sysclkreq_high = true,
.min_residency_crail = 20000,
};
#ifdef CONFIG_ARCH_TEGRA_HAS_CL_DVFS
/* board parameters for cpu dfll */
static struct tegra_cl_dvfs_cfg_param macallan_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,
};
#endif
/* palmas: fixed 10mV steps from 600mV to 1400mV, with offset 0x10 */
#define PMU_CPU_VDD_MAP_SIZE ((1400000 - 600000) / 10000 + 1)
static struct voltage_reg_map pmu_cpu_vdd_map[PMU_CPU_VDD_MAP_SIZE];
static inline void fill_reg_map(void)
{
int i;
for (i = 0; i < PMU_CPU_VDD_MAP_SIZE; i++) {
pmu_cpu_vdd_map[i].reg_value = i + 0x10;
pmu_cpu_vdd_map[i].reg_uV = 600000 + 10000 * i;
}
}
#ifdef CONFIG_ARCH_TEGRA_HAS_CL_DVFS
static struct tegra_cl_dvfs_platform_data macallan_cl_dvfs_data = {
.dfll_clk_name = "dfll_cpu",
.pmu_if = TEGRA_CL_DVFS_PMU_I2C,
.u.pmu_i2c = {
.fs_rate = 400000,
.slave_addr = 0xb0,
.reg = 0x23,
},
.vdd_map = pmu_cpu_vdd_map,
.vdd_map_size = PMU_CPU_VDD_MAP_SIZE,
.cfg_param = &macallan_cl_dvfs_param,
};
static int __init macallan_cl_dvfs_init(void)
{
fill_reg_map();
if (tegra_revision < TEGRA_REVISION_A02)
macallan_cl_dvfs_data.out_quiet_then_disable = true;
tegra_cl_dvfs_device.dev.platform_data = &macallan_cl_dvfs_data;
platform_device_register(&tegra_cl_dvfs_device);
return 0;
}
#endif
static int __init macallan_fixed_regulator_init(void)
{
if (!machine_is_macallan())
return 0;
return platform_add_devices(fixed_reg_devs,
ARRAY_SIZE(fixed_reg_devs));
}
subsys_initcall_sync(macallan_fixed_regulator_init);
int __init macallan_regulator_init(void)
{
#ifdef CONFIG_ARCH_TEGRA_HAS_CL_DVFS
macallan_cl_dvfs_init();
#endif
macallan_palmas_regulator_init();
platform_device_register(&macallan_pda_power_device);
return 0;
}
int __init macallan_suspend_init(void)
{
tegra_init_suspend(&macallan_suspend_data);
return 0;
}
int __init macallan_edp_init(void)
{
unsigned int regulator_mA;
regulator_mA = get_maximum_cpu_current_supported();
if (!regulator_mA)
regulator_mA = 15000;
pr_info("%s: CPU regulator %d mA\n", __func__, regulator_mA);
tegra_init_cpu_edp_limits(regulator_mA);
regulator_mA = get_maximum_core_current_supported();
if (!regulator_mA)
regulator_mA = 4000;
pr_info("%s: core regulator %d mA\n", __func__, regulator_mA);
tegra_init_core_edp_limits(regulator_mA);
return 0;
}
static struct tegra_tsensor_pmu_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 soctherm_platform_data macallan_soctherm_data = {
.therm = {
[THERM_CPU] = {
.zone_enable = true,
.passive_delay = 1000,
.num_trips = 3,
.trips = {
{
.cdev_type = "tegra-balanced",
.trip_temp = 90000,
.trip_type = THERMAL_TRIP_PASSIVE,
.upper = THERMAL_NO_LIMIT,
.lower = THERMAL_NO_LIMIT,
},
{
.cdev_type = "tegra-heavy",
.trip_temp = 100000,
.trip_type = THERMAL_TRIP_HOT,
.upper = THERMAL_NO_LIMIT,
.lower = THERMAL_NO_LIMIT,
},
{
.cdev_type = "tegra-shutdown",
.trip_temp = 102000,
.trip_type = THERMAL_TRIP_CRITICAL,
.upper = THERMAL_NO_LIMIT,
.lower = THERMAL_NO_LIMIT,
},
},
},
[THERM_GPU] = {
.zone_enable = true,
},
[THERM_PLL] = {
.zone_enable = true,
},
},
.throttle = {
[THROTTLE_HEAVY] = {
.devs = {
[THROTTLE_DEV_CPU] = {
.enable = 1,
},
},
},
},
.tshut_pmu_trip_data = &tpdata_palmas,
};
int __init macallan_soctherm_init(void)
{
tegra_platform_edp_init(macallan_soctherm_data.therm[THERM_CPU].trips,
&macallan_soctherm_data.therm[THERM_CPU].num_trips,
8000); /* edp temperature margin */
tegra_add_tj_trips(macallan_soctherm_data.therm[THERM_CPU].trips,
&macallan_soctherm_data.therm[THERM_CPU].num_trips);
return tegra11_soctherm_init(&macallan_soctherm_data);
}
|