ARM: tegra: Use new nct interface for cdev bind
[linux-3.10.git] / arch / arm / mach-tegra / board-dalmore-sensors.c
1 /*
2  * arch/arm/mach-tegra/board-dalmore-sensors.c
3  *
4  * Copyright (c) 2012 NVIDIA CORPORATION, All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met:
9  *
10  * Redistributions of source code must retain the above copyright notice,
11  * this list of conditions and the following disclaimer.
12  *
13  * Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in the
15  * documentation and/or other materials provided with the distribution.
16  *
17  * Neither the name of NVIDIA CORPORATION nor the names of its contributors
18  * may be used to endorse or promote products derived from this software
19  * without specific prior written permission.
20  *
21  * This software is licensed under the terms of the GNU General Public
22  * License version 2, as published by the Free Software Foundation, and
23  * may be copied, distributed, and modified under those terms.
24  *
25  * This program is distributed in the hope that it will be useful,
26  * but WITHOUT ANY WARRANTY; without even the implied warranty of
27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28  * GNU General Public License for more details.
29  */
30
31 #include <linux/i2c.h>
32 #include <linux/delay.h>
33 #include <linux/mpu.h>
34 #include <linux/regulator/consumer.h>
35 #include <linux/gpio.h>
36 #include <linux/therm_est.h>
37 #include <linux/nct1008.h>
38 #include <mach/edp.h>
39
40 #include <mach/gpio-tegra.h>
41 #include <mach/pinmux-t11.h>
42 #include <mach/pinmux.h>
43 #include <media/imx091.h>
44 #include <media/ov9772.h>
45 #include <media/as364x.h>
46 #include <media/ad5816.h>
47 #include <generated/mach-types.h>
48 #include <linux/power/sbs-battery.h>
49
50 #include "gpio-names.h"
51 #include "board.h"
52 #include "board-dalmore.h"
53 #include "cpu-tegra.h"
54 #include "devices.h"
55 #include "tegra-board-id.h"
56
57 static struct nvc_gpio_pdata imx091_gpio_pdata[] = {
58         {IMX091_GPIO_RESET, CAM_RSTN, true, false},
59         {IMX091_GPIO_PWDN, CAM1_POWER_DWN_GPIO, true, false},
60         {IMX091_GPIO_GP1, CAM_GPIO1, true, false}
61 };
62
63 static struct board_info board_info;
64
65 static struct balanced_throttle tj_throttle = {
66         .throt_tab_size = 19,
67         .throt_tab = {
68                 {      0, 1000 },
69                 {  51000, 1000 },
70                 { 102000, 1000 },
71                 { 204000, 1000 },
72                 { 252000, 1000 },
73                 { 288000, 1000 },
74                 { 372000, 1000 },
75                 { 468000, 1000 },
76                 { 510000, 1000 },
77                 { 612000, 1000 },
78                 { 714000, 1050 },
79                 { 816000, 1050 },
80                 { 918000, 1050 },
81                 {1020000, 1100 },
82                 {1122000, 1100 },
83                 {1224000, 1100 },
84                 {1326000, 1100 },
85                 {1428000, 1100 },
86                 {1530000, 1100 },
87         },
88 };
89
90 static int __init dalmore_throttle_init(void)
91 {
92         if (machine_is_dalmore())
93                 balanced_throttle_register(&tj_throttle, "dalmore-nct");
94         return 0;
95 }
96 module_init(dalmore_throttle_init);
97
98 static struct nct1008_platform_data dalmore_nct1008_pdata = {
99         .supported_hwrev = true,
100         .ext_range = true,
101         .conv_rate = 0x08,
102         .offset = 80, /* 4 * 20C. Bug 844025 - 1C for device accuracies */
103         .shutdown_ext_limit = 90, /* C */
104         .shutdown_local_limit = 120, /* C */
105
106         /* Thermal Throttling */
107         .passive = {
108                 .enable = true,
109                 .type = "dalmore-nct",
110                 .trip_temp = 80000,
111                 .tc1 = 0,
112                 .tc2 = 1,
113                 .passive_delay = 2000,
114         }
115 };
116
117 static struct i2c_board_info dalmore_i2c4_nct1008_board_info[] = {
118         {
119                 I2C_BOARD_INFO("nct1008", 0x4C),
120                 .platform_data = &dalmore_nct1008_pdata,
121                 .irq = -1,
122         }
123 };
124
125 #define VI_PINMUX(_pingroup, _mux, _pupd, _tri, _io, _lock, _ioreset) \
126         {                                                       \
127                 .pingroup       = TEGRA_PINGROUP_##_pingroup,   \
128                 .func           = TEGRA_MUX_##_mux,             \
129                 .pupd           = TEGRA_PUPD_##_pupd,           \
130                 .tristate       = TEGRA_TRI_##_tri,             \
131                 .io             = TEGRA_PIN_##_io,              \
132                 .lock           = TEGRA_PIN_LOCK_##_lock,       \
133                 .od             = TEGRA_PIN_OD_DEFAULT,         \
134                 .ioreset        = TEGRA_PIN_IO_RESET_##_ioreset \
135 }
136
137 static int dalmore_focuser_power_on(struct ad5816_power_rail *pw)
138 {
139         int err;
140
141         if (unlikely(WARN_ON(!pw || !pw->vdd || !pw->vdd_i2c)))
142                 return -EFAULT;
143
144         err = regulator_enable(pw->vdd_i2c);
145         if (unlikely(err))
146                 goto ad5816_vdd_i2c_fail;
147
148         err = regulator_enable(pw->vdd);
149         if (unlikely(err))
150                 goto ad5816_vdd_fail;
151
152         return 0;
153
154 ad5816_vdd_fail:
155         regulator_disable(pw->vdd_i2c);
156
157 ad5816_vdd_i2c_fail:
158         pr_err("%s FAILED\n", __func__);
159
160         return -ENODEV;
161 }
162
163 static int dalmore_focuser_power_off(struct ad5816_power_rail *pw)
164 {
165         if (unlikely(WARN_ON(!pw || !pw->vdd || !pw->vdd_i2c)))
166                 return -EFAULT;
167
168         regulator_disable(pw->vdd);
169         regulator_disable(pw->vdd_i2c);
170
171         return 0;
172 }
173
174 static struct tegra_pingroup_config mclk_disable =
175         VI_PINMUX(CAM_MCLK, VI, NORMAL, NORMAL, OUTPUT, DEFAULT, DEFAULT);
176
177 static struct tegra_pingroup_config mclk_enable =
178         VI_PINMUX(CAM_MCLK, VI_ALT3, NORMAL, NORMAL, OUTPUT, DEFAULT, DEFAULT);
179
180 static struct tegra_pingroup_config pbb0_disable =
181         VI_PINMUX(GPIO_PBB0, VI, NORMAL, NORMAL, OUTPUT, DEFAULT, DEFAULT);
182
183 static struct tegra_pingroup_config pbb0_enable =
184         VI_PINMUX(GPIO_PBB0, VI_ALT3, NORMAL, NORMAL, OUTPUT, DEFAULT, DEFAULT);
185
186 /*
187  * As a workaround, dalmore_vcmvdd need to be allocated to activate the
188  * sensor devices. This is due to the focuser device(AD5816) will hook up
189  * the i2c bus if it is not powered up.
190 */
191 static struct regulator *dalmore_vcmvdd;
192
193 static int dalmore_get_vcmvdd(void)
194 {
195         if (!dalmore_vcmvdd) {
196                 dalmore_vcmvdd = regulator_get(NULL, "vdd_af_cam1");
197                 if (unlikely(WARN_ON(IS_ERR(dalmore_vcmvdd)))) {
198                         pr_err("%s: can't get regulator vcmvdd: %ld\n",
199                                 __func__, PTR_ERR(dalmore_vcmvdd));
200                         dalmore_vcmvdd = NULL;
201                         return -ENODEV;
202                 }
203         }
204         return 0;
205 }
206
207 static int dalmore_imx091_power_on(struct nvc_regulator *vreg)
208 {
209         int err;
210
211         if (unlikely(WARN_ON(!vreg)))
212                 return -EFAULT;
213
214         if (dalmore_get_vcmvdd())
215                 goto imx091_poweron_fail;
216
217         gpio_set_value(CAM1_POWER_DWN_GPIO, 0);
218         usleep_range(10, 20);
219
220         err = regulator_enable(vreg[IMX091_VREG_AVDD].vreg);
221         if (err)
222                 goto imx091_avdd_fail;
223
224         err = regulator_enable(vreg[IMX091_VREG_IOVDD].vreg);
225         if (err)
226                 goto imx091_iovdd_fail;
227
228         usleep_range(1, 2);
229         gpio_set_value(CAM1_POWER_DWN_GPIO, 1);
230
231         err = regulator_enable(dalmore_vcmvdd);
232         if (unlikely(err))
233                 goto imx091_vcmvdd_fail;
234
235         tegra_pinmux_config_table(&mclk_enable, 1);
236         usleep_range(300, 310);
237
238         return 1;
239
240 imx091_vcmvdd_fail:
241         regulator_disable(vreg[IMX091_VREG_IOVDD].vreg);
242
243 imx091_iovdd_fail:
244         regulator_disable(vreg[IMX091_VREG_AVDD].vreg);
245
246 imx091_avdd_fail:
247         gpio_set_value(CAM1_POWER_DWN_GPIO, 0);
248
249 imx091_poweron_fail:
250         pr_err("%s FAILED\n", __func__);
251         return -ENODEV;
252 }
253
254 static int dalmore_imx091_power_off(struct nvc_regulator *vreg)
255 {
256         if (unlikely(WARN_ON(!vreg)))
257                 return -EFAULT;
258
259         usleep_range(1, 2);
260         tegra_pinmux_config_table(&mclk_disable, 1);
261         gpio_set_value(CAM1_POWER_DWN_GPIO, 0);
262         usleep_range(1, 2);
263
264         regulator_disable(dalmore_vcmvdd);
265         regulator_disable(vreg[IMX091_VREG_IOVDD].vreg);
266         regulator_disable(vreg[IMX091_VREG_AVDD].vreg);
267
268         return 1;
269 }
270
271 static struct nvc_imager_cap imx091_cap = {
272         .identifier             = "IMX091",
273         .sensor_nvc_interface   = 3,
274         .pixel_types[0]         = 0x100,
275         .orientation            = 0,
276         .direction              = 0,
277         .initial_clock_rate_khz = 6000,
278         .clock_profiles[0] = {
279                 .external_clock_khz     = 24000,
280                 .clock_multiplier       = 10416667, /* value / 1,000,000 */
281         },
282         .clock_profiles[1] = {
283                 .external_clock_khz     = 0,
284                 .clock_multiplier       = 0,
285         },
286         .h_sync_edge            = 0,
287         .v_sync_edge            = 0,
288         .mclk_on_vgp0           = 0,
289         .csi_port               = 0,
290         .data_lanes             = 4,
291         .virtual_channel_id     = 0,
292         .discontinuous_clk_mode = 1,
293         .cil_threshold_settle   = 0x0,
294         .min_blank_time_width   = 16,
295         .min_blank_time_height  = 16,
296         .preferred_mode_index   = 0,
297         .focuser_guid           = NVC_FOCUS_GUID(0),
298         .torch_guid             = NVC_TORCH_GUID(0),
299         .cap_version            = NVC_IMAGER_CAPABILITIES_VERSION2,
300 };
301
302 static struct imx091_platform_data imx091_pdata = {
303         .num                    = 0,
304         .sync                   = 0,
305         .dev_name               = "camera",
306         .gpio_count             = ARRAY_SIZE(imx091_gpio_pdata),
307         .gpio                   = imx091_gpio_pdata,
308         .flash_cap              = {
309                 .sdo_trigger_enabled = 1,
310                 .adjustable_flash_timing = 1,
311         },
312         .cap                    = &imx091_cap,
313         .power_on               = dalmore_imx091_power_on,
314         .power_off              = dalmore_imx091_power_off,
315 };
316
317 struct sbs_platform_data sbs_pdata = {
318         .poll_retry_count = 100,
319         .i2c_retry_count = 2,
320 };
321
322 static int dalmore_ov9772_power_on(struct ov9772_power_rail *pw)
323 {
324         int err;
325
326         if (unlikely(!pw || !pw->avdd || !pw->dovdd))
327                 return -EFAULT;
328
329         if (dalmore_get_vcmvdd())
330                 goto ov9772_get_vcmvdd_fail;
331
332         gpio_set_value(CAM2_POWER_DWN_GPIO, 0);
333         gpio_set_value(CAM_RSTN, 0);
334
335         err = regulator_enable(pw->avdd);
336         if (unlikely(err))
337                 goto ov9772_avdd_fail;
338
339         err = regulator_enable(pw->dovdd);
340         if (unlikely(err))
341                 goto ov9772_dovdd_fail;
342
343         gpio_set_value(CAM_RSTN, 1);
344         gpio_set_value(CAM2_POWER_DWN_GPIO, 1);
345
346         err = regulator_enable(dalmore_vcmvdd);
347         if (unlikely(err))
348                 goto ov9772_vcmvdd_fail;
349
350         tegra_pinmux_config_table(&pbb0_enable, 1);
351         usleep_range(340, 380);
352
353         /* return 1 to skip the in-driver power_on sequence */
354         return 1;
355
356 ov9772_vcmvdd_fail:
357         regulator_disable(pw->dovdd);
358
359 ov9772_dovdd_fail:
360         regulator_disable(pw->avdd);
361
362 ov9772_avdd_fail:
363         gpio_set_value(CAM_RSTN, 0);
364         gpio_set_value(CAM2_POWER_DWN_GPIO, 0);
365
366 ov9772_get_vcmvdd_fail:
367         pr_err("%s FAILED\n", __func__);
368         return -ENODEV;
369 }
370
371 static int dalmore_ov9772_power_off(struct ov9772_power_rail *pw)
372 {
373         if (unlikely(!pw || !dalmore_vcmvdd || !pw->avdd || !pw->dovdd))
374                 return -EFAULT;
375
376         usleep_range(21, 25);
377         tegra_pinmux_config_table(&pbb0_disable, 1);
378
379         gpio_set_value(CAM2_POWER_DWN_GPIO, 0);
380         gpio_set_value(CAM_RSTN, 0);
381
382         regulator_disable(dalmore_vcmvdd);
383         regulator_disable(pw->dovdd);
384         regulator_disable(pw->avdd);
385
386         /* return 1 to skip the in-driver power_off sequence */
387         return 1;
388 }
389
390 static struct nvc_gpio_pdata ov9772_gpio_pdata[] = {
391         { OV9772_GPIO_TYPE_SHTDN, CAM2_POWER_DWN_GPIO, true, 0, },
392         { OV9772_GPIO_TYPE_PWRDN, CAM_RSTN, true, 0, },
393 };
394
395 static struct ov9772_platform_data dalmore_ov9772_pdata = {
396         .num            = 1,
397         .dev_name       = "camera",
398         .gpio_count     = ARRAY_SIZE(ov9772_gpio_pdata),
399         .gpio           = ov9772_gpio_pdata,
400         .power_on       = dalmore_ov9772_power_on,
401         .power_off      = dalmore_ov9772_power_off,
402 };
403
404 static int dalmore_as3648_power_on(struct as364x_power_rail *pw)
405 {
406         int err = dalmore_get_vcmvdd();
407
408         if (err)
409                 return err;
410
411         return regulator_enable(dalmore_vcmvdd);
412 }
413
414 static int dalmore_as3648_power_off(struct as364x_power_rail *pw)
415 {
416         if (!dalmore_vcmvdd)
417                 return -ENODEV;
418
419         return regulator_disable(dalmore_vcmvdd);
420 }
421
422 static struct as364x_platform_data dalmore_as3648_pdata = {
423         .config         = {
424                 .max_total_current_mA = 1000,
425                 .max_peak_current_mA = 600,
426                 .vin_low_v_run_mV = 3070,
427                 .strobe_type = 1,
428                 },
429         .pinstate       = {
430                 .mask   = 1 << (CAM_FLASH_STROBE - TEGRA_GPIO_PBB0),
431                 .values = 1 << (CAM_FLASH_STROBE - TEGRA_GPIO_PBB0)
432                 },
433         .dev_name       = "torch",
434         .type           = AS3648,
435         .gpio_strobe    = CAM_FLASH_STROBE,
436         .led_mask       = 3,
437
438         .power_on_callback = dalmore_as3648_power_on,
439         .power_off_callback = dalmore_as3648_power_off,
440 };
441
442 static struct ad5816_platform_data dalmore_ad5816_pdata = {
443         .cfg = 0,
444         .num = 0,
445         .sync = 0,
446         .dev_name = "focuser",
447         .power_on = dalmore_focuser_power_on,
448         .power_off = dalmore_focuser_power_off,
449 };
450
451 static struct i2c_board_info dalmore_i2c_board_info_e1625[] = {
452         {
453                 I2C_BOARD_INFO("imx091", 0x36),
454                 .platform_data = &imx091_pdata,
455         },
456         {
457                 I2C_BOARD_INFO("ov9772", 0x10),
458                 .platform_data = &dalmore_ov9772_pdata,
459         },
460         {
461                 I2C_BOARD_INFO("as3648", 0x30),
462                 .platform_data = &dalmore_as3648_pdata,
463         },
464         {
465                 I2C_BOARD_INFO("ad5816", 0x0E),
466                 .platform_data = &dalmore_ad5816_pdata,
467         },
468 };
469
470 static int dalmore_camera_init(void)
471 {
472         tegra_pinmux_config_table(&mclk_disable, 1);
473         tegra_pinmux_config_table(&pbb0_disable, 1);
474
475         i2c_register_board_info(2, dalmore_i2c_board_info_e1625,
476                 ARRAY_SIZE(dalmore_i2c_board_info_e1625));
477         return 0;
478 }
479
480 /* MPU board file definition    */
481 static struct mpu_platform_data mpu9150_gyro_data = {
482         .int_config     = 0x10,
483         .level_shifter  = 0,
484         /* Located in board_[platformname].h */
485         .orientation    = MPU_GYRO_ORIENTATION,
486         .sec_slave_type = SECONDARY_SLAVE_TYPE_COMPASS,
487         .sec_slave_id   = COMPASS_ID_AK8975,
488         .secondary_i2c_addr     = MPU_COMPASS_ADDR,
489         .secondary_read_reg     = 0x06,
490         .secondary_orientation  = MPU_COMPASS_ORIENTATION,
491         .key            = {0x4E, 0xCC, 0x7E, 0xEB, 0xF6, 0x1E, 0x35, 0x22,
492                            0x00, 0x34, 0x0D, 0x65, 0x32, 0xE9, 0x94, 0x89},
493 };
494
495 #define TEGRA_CAMERA_GPIO(_gpio, _label, _value)                \
496         {                                                       \
497                 .gpio = _gpio,                                  \
498                 .label = _label,                                \
499                 .value = _value,                                \
500         }
501
502 static struct i2c_board_info dalmore_i2c_board_info_cm3218[] = {
503         {
504                 I2C_BOARD_INFO("cm3218", 0x48),
505         },
506 };
507
508 static struct i2c_board_info __initdata inv_mpu9150_i2c2_board_info[] = {
509         {
510                 I2C_BOARD_INFO(MPU_GYRO_NAME, MPU_GYRO_ADDR),
511                 .platform_data = &mpu9150_gyro_data,
512         },
513 };
514
515 static void mpuirq_init(void)
516 {
517         int ret = 0;
518         unsigned gyro_irq_gpio = MPU_GYRO_IRQ_GPIO;
519         unsigned gyro_bus_num = MPU_GYRO_BUS_NUM;
520         char *gyro_name = MPU_GYRO_NAME;
521
522         pr_info("*** MPU START *** mpuirq_init...\n");
523
524         ret = gpio_request(gyro_irq_gpio, gyro_name);
525
526         if (ret < 0) {
527                 pr_err("%s: gpio_request failed %d\n", __func__, ret);
528                 return;
529         }
530
531         ret = gpio_direction_input(gyro_irq_gpio);
532         if (ret < 0) {
533                 pr_err("%s: gpio_direction_input failed %d\n", __func__, ret);
534                 gpio_free(gyro_irq_gpio);
535                 return;
536         }
537         pr_info("*** MPU END *** mpuirq_init...\n");
538
539         inv_mpu9150_i2c2_board_info[0].irq = gpio_to_irq(MPU_GYRO_IRQ_GPIO);
540         i2c_register_board_info(gyro_bus_num, inv_mpu9150_i2c2_board_info,
541                 ARRAY_SIZE(inv_mpu9150_i2c2_board_info));
542 }
543
544 static int dalmore_nct1008_init(void)
545 {
546         int nct1008_port = -1;
547         int ret = 0;
548
549 #if defined(CONFIG_ARCH_TEGRA_11x_SOC)
550         if ((board_info.board_id == BOARD_E1612) ||
551             (board_info.board_id == BOARD_E1641) ||
552             (board_info.board_id == BOARD_E1613) ||
553             (board_info.board_id == BOARD_P2454))
554         {
555                 /* per email from Matt 9/10/2012 */
556                 nct1008_port = TEGRA_GPIO_PX6;
557         } else if (board_info.board_id == BOARD_E1611) {
558                 if (board_info.fab == 0x04)
559                         nct1008_port = TEGRA_GPIO_PO4;
560                 else
561                         nct1008_port = TEGRA_GPIO_PX6;
562         } else {
563                 nct1008_port = TEGRA_GPIO_PX6;
564                 pr_err("Warning: nct alert_port assumed TEGRA_GPIO_PX6"
565                         " for unknown dalmore board id E%d\n",
566                         board_info.board_id);
567         }
568 #else
569         /* dalmore + AP30 interposer has SPI2_CS0 gpio */
570         nct1008_port = TEGRA_GPIO_PX3;
571 #endif
572
573         if (nct1008_port >= 0) {
574 #ifdef CONFIG_TEGRA_EDP_LIMITS
575                 const struct tegra_edp_limits *cpu_edp_limits;
576                 struct nct1008_cdev *active_cdev;
577                 int cpu_edp_limits_size;
578                 int i;
579
580                 /* edp capping */
581                 tegra_get_cpu_edp_limits(&cpu_edp_limits, &cpu_edp_limits_size);
582
583                 if ((cpu_edp_limits_size > MAX_THROT_TABLE_SIZE) ||
584                         (cpu_edp_limits_size > MAX_ACTIVE_TEMP_STATE))
585                         BUG();
586
587                 active_cdev = &dalmore_nct1008_pdata.active;
588                 active_cdev->enable = true;
589                 active_cdev->type = "edp";
590                 active_cdev->hysteresis = 1000;
591
592                 for (i = 0; i < cpu_edp_limits_size-1; i++) {
593                         active_cdev->states[i].trip_temp =
594                                 cpu_edp_limits[i].temperature * 1000;
595                         active_cdev->states[i].state = i + 1;
596                 }
597 #endif
598
599                 dalmore_i2c4_nct1008_board_info[0].irq = gpio_to_irq(nct1008_port);
600                 pr_info("%s: dalmore nct1008 irq %d", __func__, dalmore_i2c4_nct1008_board_info[0].irq);
601
602                 ret = gpio_request(nct1008_port, "temp_alert");
603                 if (ret < 0)
604                         return ret;
605
606                 ret = gpio_direction_input(nct1008_port);
607                 if (ret < 0) {
608                         pr_info("%s: calling gpio_free(nct1008_port)", __func__);
609                         gpio_free(nct1008_port);
610                 }
611         }
612
613         /* dalmore has thermal sensor on GEN1-I2C i.e. instance 0 */
614         i2c_register_board_info(0, dalmore_i2c4_nct1008_board_info,
615                 ARRAY_SIZE(dalmore_i2c4_nct1008_board_info));
616
617         return ret;
618 }
619
620 static struct i2c_board_info __initdata bq20z45_pdata[] = {
621         {
622                 I2C_BOARD_INFO("sbs-battery", 0x0B),
623                 .platform_data = &sbs_pdata,
624         },
625 };
626
627 #ifdef CONFIG_TEGRA_SKIN_THROTTLE
628 static int tegra_skin_match(struct thermal_zone_device *thz, void *data)
629 {
630         return strcmp((char *)data, thz->type) == 0;
631 }
632
633 static int tegra_skin_get_temp(void *data, long *temp)
634 {
635         struct thermal_zone_device *thz;
636
637         thz = thermal_zone_device_find(data, tegra_skin_match);
638
639         if (!thz || thz->ops->get_temp(thz, temp))
640                 *temp = 25000;
641
642         return 0;
643 }
644
645 static struct therm_est_data skin_data = {
646         .toffset = 9793,
647         .polling_period = 1100,
648         .ndevs = 2,
649         .devs = {
650                         {
651                                 .dev_data = "nct_ext",
652                                 .get_temp = tegra_skin_get_temp,
653                                 .coeffs = {
654                                         2, 1, 1, 1,
655                                         1, 1, 1, 1,
656                                         1, 1, 1, 0,
657                                         1, 1, 0, 0,
658                                         0, 0, -1, -7
659                                 },
660                         },
661                         {
662                                 .dev_data = "nct_int",
663                                 .get_temp = tegra_skin_get_temp,
664                                 .coeffs = {
665                                         -11, -7, -5, -3,
666                                         -3, -2, -1, 0,
667                                         0, 0, 1, 1,
668                                         1, 2, 2, 3,
669                                         4, 6, 11, 18
670                                 },
671                         },
672         },
673         .trip_temp = 43000,
674         .tc1 = 1,
675         .tc2 = 15,
676         .passive_delay = 15000,
677 };
678
679 static struct balanced_throttle skin_throttle = {
680         .throt_tab_size = 6,
681         .throt_tab = {
682                 { 640000, 1200 },
683                 { 640000, 1200 },
684                 { 760000, 1200 },
685                 { 760000, 1200 },
686                 {1000000, 1200 },
687                 {1000000, 1200 },
688         },
689 };
690
691 static int __init dalmore_skin_init(void)
692 {
693         struct thermal_cooling_device *skin_cdev;
694
695         skin_cdev = balanced_throttle_register(&skin_throttle, "dalmore-skin");
696
697         skin_data.cdev = skin_cdev;
698         tegra_skin_therm_est_device.dev.platform_data = &skin_data;
699         platform_device_register(&tegra_skin_therm_est_device);
700
701         return 0;
702 }
703 late_initcall(dalmore_skin_init);
704 #endif
705
706 int __init dalmore_sensors_init(void)
707 {
708         int err;
709
710         tegra_get_board_info(&board_info);
711
712         err = dalmore_nct1008_init();
713         if (err)
714                 return err;
715
716         dalmore_camera_init();
717         mpuirq_init();
718
719         i2c_register_board_info(0, dalmore_i2c_board_info_cm3218,
720                 ARRAY_SIZE(dalmore_i2c_board_info_cm3218));
721
722         i2c_register_board_info(0, bq20z45_pdata,
723                 ARRAY_SIZE(bq20z45_pdata));
724
725         return 0;
726 }