Merge commit 'main-jb-2012.08.03-B4' into t114-0806
[linux-2.6.git] / arch / arm / mach-tegra / board-aruba-sensors.c
1 /*
2  * arch/arm/mach-tegra/board-aruba-sensors.c
3  *
4  * Copyright (c) 2010-2011, 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 PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
24  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
27  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33
34 #include <linux/i2c.h>
35 #include <mach/gpio.h>
36
37 #include "gpio-names.h"
38
39 #if 0   // !!!FIXME!!! IMPLEMENT ME
40
41 #define ISL29018_IRQ_GPIO       TEGRA_GPIO_PZ2
42 #define AKM8975_IRQ_GPIO        TEGRA_GPIO_PN5
43
44 static void aruba_isl29018_init(void)
45 {
46         gpio_request(ISL29018_IRQ_GPIO, "isl29018");
47         gpio_direction_input(ISL29018_IRQ_GPIO);
48 }
49
50 static void aruba_akm8975_init(void)
51 {
52         gpio_request(AKM8975_IRQ_GPIO, "akm8975");
53         gpio_direction_input(AKM8975_IRQ_GPIO);
54 }
55
56 struct nct1008_platform_data aruba_nct1008_pdata = {
57         .conv_rate = 5,
58         .config = NCT1008_CONFIG_ALERT_DISABLE,
59         .thermal_threshold = 110,
60 };
61
62 static const struct i2c_board_info aruba_i2c0_board_info[] = {
63         {
64                 I2C_BOARD_INFO("isl29018", 0x44),
65                 .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PZ2),
66         },
67 };
68
69 static const struct i2c_board_info aruba_i2c2_board_info[] = {
70         {
71                 I2C_BOARD_INFO("bq20z75-battery", 0x0B),
72         },
73 };
74
75 static struct i2c_board_info aruba_i2c4_board_info[] = {
76         {
77                 I2C_BOARD_INFO("nct1008", 0x4C),
78                 .platform_data = &aruba_nct1008_pdata,
79         },
80         {
81                 I2C_BOARD_INFO("akm8975", 0x0C),
82                 .irq = TEGRA_GPIO_TO_IRQ(AKM8975_IRQ_GPIO),
83         }
84 };
85
86 int __init aruba_sensors_init(void)
87 {
88         aruba_isl29018_init();
89         aruba_akm8975_init();
90
91         i2c_register_board_info(0, aruba_i2c0_board_info,
92                 ARRAY_SIZE(aruba_i2c0_board_info));
93
94         i2c_register_board_info(2, aruba_i2c2_board_info,
95                 ARRAY_SIZE(aruba_i2c2_board_info));
96
97         i2c_register_board_info(4, aruba_i2c4_board_info,
98                 ARRAY_SIZE(aruba_i2c4_board_info));
99
100         return 0;
101 }
102 #else
103 int __init aruba_sensors_init(void)
104 {
105         return 0;
106 }
107 #endif