[arm] tegra:cardhu:Registering i2c bus mux PCA954x
[linux-2.6.git] / arch / arm / mach-tegra / board-cardhu-sensors.c
1 /*
2  * arch/arm/mach-tegra/board-cardhu-sensors.c
3  *
4  * Copyright (c) 2011, NVIDIA, All Rights Reserved.
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20
21 #include <linux/i2c.h>
22 #include <linux/i2c/pca954x.h>
23
24 #include "board-cardhu.h"
25
26 #ifdef CONFIG_I2C_MUX_PCA954x
27 static struct pca954x_platform_mode cardhu_pca954x_modes[] = {
28         { .adap_id = PCA954x_I2C_BUS0, },
29         { .adap_id = PCA954x_I2C_BUS1, },
30         { .adap_id = PCA954x_I2C_BUS2, },
31         { .adap_id = PCA954x_I2C_BUS3, },
32 };
33
34 static struct pca954x_platform_data cardhu_pca954x_data = {
35         .modes    = cardhu_pca954x_modes,
36         .num_modes      = ARRAY_SIZE(cardhu_pca954x_modes),
37 };
38
39 #endif
40
41 static const struct i2c_board_info cardhu_i2c3_board_info[] = {
42 #ifdef CONFIG_I2C_MUX_PCA954x
43         {
44                 I2C_BOARD_INFO("pca9546", 0x70),
45                 .platform_data = &cardhu_pca954x_data,
46         },
47 #endif
48 };
49
50 int __init cardhu_sensors_init(void)
51 {
52         if (ARRAY_SIZE(cardhu_i2c3_board_info))
53                 i2c_register_board_info(3, cardhu_i2c3_board_info,
54                         ARRAY_SIZE(cardhu_i2c3_board_info));
55
56         return 0;
57 }