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