Revert "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         tegra_gpio_enable(ISL29018_IRQ_GPIO);
47         gpio_request(ISL29018_IRQ_GPIO, "isl29018");
48         gpio_direction_input(ISL29018_IRQ_GPIO);
49 }
50
51 static void aruba_akm8975_init(void)
52 {
53         tegra_gpio_enable(AKM8975_IRQ_GPIO);
54         gpio_request(AKM8975_IRQ_GPIO, "akm8975");
55         gpio_direction_input(AKM8975_IRQ_GPIO);
56 }
57
58 struct nct1008_platform_data aruba_nct1008_pdata = {
59         .conv_rate = 5,
60         .config = NCT1008_CONFIG_ALERT_DISABLE,
61         .thermal_threshold = 110,
62 };
63
64 static const struct i2c_board_info aruba_i2c0_board_info[] = {
65         {
66                 I2C_BOARD_INFO("isl29018", 0x44),
67                 .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PZ2),
68         },
69 };
70
71 static const struct i2c_board_info aruba_i2c2_board_info[] = {
72         {
73                 I2C_BOARD_INFO("bq20z75-battery", 0x0B),
74         },
75 };
76
77 static struct i2c_board_info aruba_i2c4_board_info[] = {
78         {
79                 I2C_BOARD_INFO("nct1008", 0x4C),
80                 .platform_data = &aruba_nct1008_pdata,
81         },
82         {
83                 I2C_BOARD_INFO("akm8975", 0x0C),
84                 .irq = TEGRA_GPIO_TO_IRQ(AKM8975_IRQ_GPIO),
85         }
86 };
87
88 int __init aruba_sensors_init(void)
89 {
90         aruba_isl29018_init();
91         aruba_akm8975_init();
92
93         i2c_register_board_info(0, aruba_i2c0_board_info,
94                 ARRAY_SIZE(aruba_i2c0_board_info));
95
96         i2c_register_board_info(2, aruba_i2c2_board_info,
97                 ARRAY_SIZE(aruba_i2c2_board_info));
98
99         i2c_register_board_info(4, aruba_i2c4_board_info,
100                 ARRAY_SIZE(aruba_i2c4_board_info));
101
102         return 0;
103 }
104 #else
105 int __init aruba_sensors_init(void)
106 {
107         return 0;
108 }
109 #endif