[arm] tegra:cardhu:Registering i2c bus mux PCA954x
Laxman Dewangan [Tue, 18 Jan 2011 14:07:19 +0000 (19:07 +0530)]
Registering i2c bus mux PCA954x for cardhu on cam i2c.

Original-Change-Id: Ia741a06dad88d893a2150be8ee9fd0b448bda375
Reviewed-on: http://git-master/r/16112
Reviewed-by: Scott Williams <scwilliams@nvidia.com>
Tested-by: Scott Williams <scwilliams@nvidia.com>
Original-Change-Id: I80154e83cc59bf440e14ad714a313fb7e116fb43

Rebase-Id: R9b13b555a84fc67992e306b11ef15420d5a87aab

arch/arm/mach-tegra/board-cardhu-sensors.c
arch/arm/mach-tegra/board-cardhu.c
arch/arm/mach-tegra/board-cardhu.h

index 01b088b..7f08da3 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * arch/arm/mach-tegra/board-cardhu-sensors.c
  *
- * Copyright (c) 2010, NVIDIA, All Rights Reserved.
+ * Copyright (c) 2011, NVIDIA, All Rights Reserved.
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  */
 
 #include <linux/i2c.h>
+#include <linux/i2c/pca954x.h>
+
+#include "board-cardhu.h"
+
+#ifdef CONFIG_I2C_MUX_PCA954x
+static struct pca954x_platform_mode cardhu_pca954x_modes[] = {
+       { .adap_id = PCA954x_I2C_BUS0, },
+       { .adap_id = PCA954x_I2C_BUS1, },
+       { .adap_id = PCA954x_I2C_BUS2, },
+       { .adap_id = PCA954x_I2C_BUS3, },
+};
+
+static struct pca954x_platform_data cardhu_pca954x_data = {
+       .modes    = cardhu_pca954x_modes,
+       .num_modes      = ARRAY_SIZE(cardhu_pca954x_modes),
+};
+
+#endif
+
+static const struct i2c_board_info cardhu_i2c3_board_info[] = {
+#ifdef CONFIG_I2C_MUX_PCA954x
+       {
+               I2C_BOARD_INFO("pca9546", 0x70),
+               .platform_data = &cardhu_pca954x_data,
+       },
+#endif
+};
+
 int __init cardhu_sensors_init(void)
 {
+       if (ARRAY_SIZE(cardhu_i2c3_board_info))
+               i2c_register_board_info(3, cardhu_i2c3_board_info,
+                       ARRAY_SIZE(cardhu_i2c3_board_info));
+
        return 0;
 }
index a00ccf1..1ba4528 100644 (file)
@@ -178,32 +178,31 @@ static struct tegra_ehci_platform_data cardhu_ehci2_ulpi_platform_data = {
 static struct tegra_i2c_platform_data cardhu_i2c1_platform_data = {
        .adapter_nr     = 0,
        .bus_count      = 1,
-       .bus_clk_rate   = { 400000, 0 },
+       .bus_clk_rate   = { 100000, 0 },
 };
 
 static struct tegra_i2c_platform_data cardhu_i2c2_platform_data = {
        .adapter_nr     = 1,
        .bus_count      = 1,
-       .bus_clk_rate   = { 400000, 0 },
+       .bus_clk_rate   = { 100000, 0 },
 };
 
 static struct tegra_i2c_platform_data cardhu_i2c3_platform_data = {
        .adapter_nr     = 2,
        .bus_count      = 1,
-       .bus_clk_rate   = { 400000, 0 },
+       .bus_clk_rate   = { 100000, 0 },
 };
 
 static struct tegra_i2c_platform_data cardhu_i2c4_platform_data = {
        .adapter_nr     = 3,
        .bus_count      = 1,
-       .bus_clk_rate   = { 400000, 0 },
-       .is_dvc         = true,
+       .bus_clk_rate   = { 100000, 0 },
 };
 
 static struct tegra_i2c_platform_data cardhu_i2c5_platform_data = {
        .adapter_nr     = 4,
        .bus_count      = 1,
-       .bus_clk_rate   = { 400000, 0 },
+       .bus_clk_rate   = { 100000, 0 },
 };
 
 
index 09aea5c..5653267 100644 (file)
 #ifndef _MACH_TEGRA_BOARD_CARDHU_H
 #define _MACH_TEGRA_BOARD_CARDHU_H
 
+/* PCA954x I2C bus expander bus addresses */
+#define PCA954x_I2C_BUS_BASE   6
+#define PCA954x_I2C_BUS0       (PCA954x_I2C_BUS_BASE + 0)
+#define PCA954x_I2C_BUS1       (PCA954x_I2C_BUS_BASE + 1)
+#define PCA954x_I2C_BUS2       (PCA954x_I2C_BUS_BASE + 2)
+#define PCA954x_I2C_BUS3       (PCA954x_I2C_BUS_BASE + 3)
+
 int cardhu_charge_init(void);
 int cardhu_regulator_init(void);
 int cardhu_sdhci_init(void);