arm: enterprise: Clean some of tps80031 definition
Laxman Dewangan [Fri, 8 Jul 2011 12:10:37 +0000 (17:10 +0530)]
Adding public definition in the 80031 header so that client
can used directly in place of defining at client level.

Original-Change-Id: Ifb64e0ffc83bc29c470d08a49d0915613a677537
Reviewed-on: http://git-master/r/40208
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>

Rebase-Id: R981610616a78797050538c2a4eb5160ea11384c8

arch/arm/mach-tegra/board-enterprise-power.c
arch/arm/mach-tegra/board-enterprise.h
drivers/mfd/tps80031.c
include/linux/mfd/tps80031.h

index d908290..436c1d7 100644 (file)
@@ -181,7 +181,7 @@ TPS_PDATA_INIT(vana,  1000, 3300, 0, 0, 0, 0, -1, 0, 0, 0);
 TPS_PDATA_INIT(vbus,  0, 5000, 0, 0, 0, 0, -1, 0, 0, VBUS_SW_ONLY);
 
 static struct tps80031_rtc_platform_data rtc_data = {
-       .irq = TPS80031_IRQ_BASE + TPS80031_INT_RTC_ALARM,
+       .irq = ENT_TPS80031_IRQ_BASE + TPS80031_INT_RTC_ALARM,
        .time = {
                .tm_year = 2011,
                .tm_mon = 0,
@@ -232,8 +232,8 @@ struct tps80031_32kclock_plat_data clk32k_pdata = {
 static struct tps80031_platform_data tps_platform = {
        .num_subdevs    = ARRAY_SIZE(tps80031_devs),
        .subdevs        = tps80031_devs,
-       .irq_base       = TPS80031_IRQ_BASE,
-       .gpio_base      = TPS80031_GPIO_BASE,
+       .irq_base       = ENT_TPS80031_IRQ_BASE,
+       .gpio_base      = ENT_TPS80031_GPIO_BASE,
        .clk32k_pdata   = &clk32k_pdata,
 };
 
@@ -322,9 +322,9 @@ static int gpio_switch_cam_ldo_1v8_en_voltages[] = {1800};
                .disable_rail = _disable,                               \
        }
 
-GREG_INIT(0, pmu_5v15_en,     NULL,      TPS80031_GPIO_REGEN1, false, 0, 0, 0, 0);
-GREG_INIT(1, pmu_3v3_en,      "vdd_5v15", TPS80031_GPIO_REGEN2, false, 0, 0, 0, 0);
-GREG_INIT(2, pmu_hdmi_5v0_en, "vdd_5v15", TPS80031_GPIO_SYSEN, false, 0, 0, 0, 0);
+GREG_INIT(0, pmu_5v15_en,     NULL,      ENT_TPS80031_GPIO_REGEN1, false, 0, 0, 0, 0);
+GREG_INIT(1, pmu_3v3_en,      "vdd_5v15", ENT_TPS80031_GPIO_REGEN2, false, 0, 0, 0, 0);
+GREG_INIT(2, pmu_hdmi_5v0_en, "vdd_5v15", ENT_TPS80031_GPIO_SYSEN, false, 0, 0, 0, 0);
 
 GREG_INIT(3, vdd_fuse_en,    "avdd_usb_hdmi_3v3", TEGRA_GPIO_PM0, false, 0, 0, 0, 0);
 GREG_INIT(4, sdmmc3_vdd_sel, "vddio_sdmmc_2v85", TEGRA_GPIO_PM1, false, 0, 0, 0, 0);
index 2641fd4..0ccff3e 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <mach/gpio.h>
 #include <mach/irqs.h>
+#include <linux/mfd/tps80031.h>
 
 int enterprise_charge_init(void);
 int enterprise_sdhci_init(void);
@@ -44,16 +45,16 @@ int enterprise_suspend_init(void);
 
 /*****************External GPIO tables ******************/
 /* External peripheral gpio base. */
-#define TPS80031_GPIO_BASE     TEGRA_NR_GPIOS
-#define TPS80031_GPIO_REGEN1   (TPS80031_GPIO_BASE + 0)
-#define TPS80031_GPIO_REGEN2   (TPS80031_GPIO_BASE + 1)
-#define TPS80031_GPIO_SYSEN    (TPS80031_GPIO_BASE + 2)
-#define TPS80031_GPIO_END      (TPS80031_GPIO_BASE + 3)
+#define ENT_TPS80031_GPIO_BASE    TEGRA_NR_GPIOS
+#define ENT_TPS80031_GPIO_REGEN1 (ENT_TPS80031_GPIO_BASE + TPS80031_GPIO_REGEN1)
+#define ENT_TPS80031_GPIO_REGEN2 (ENT_TPS80031_GPIO_BASE + TPS80031_GPIO_REGEN2)
+#define ENT_TPS80031_GPIO_SYSEN         (ENT_TPS80031_GPIO_BASE + TPS80031_GPIO_SYSEN)
+#define ENT_TPS80031_GPIO_END  (ENT_TPS80031_GPIO_BASE + TPS80031_GPIO_NR)
 
 /*****************External Interrupt tables ******************/
 /* External peripheral irq base */
-#define TPS80031_IRQ_BASE      TEGRA_NR_IRQS
-#define TPS80031_IRQ_END       (TPS80031_IRQ_BASE + 24)
+#define ENT_TPS80031_IRQ_BASE  TEGRA_NR_IRQS
+#define ENT_TPS80031_IRQ_END  (ENT_TPS80031_IRQ_BASE + TPS80031_INT_NR)
 
 /*****************Camera GPIOs ******************/
 #define CAM_CSI_MUX_SEL_GPIO   TEGRA_GPIO_PM3
index a1d50fc..bd8555d 100644 (file)
@@ -503,7 +503,7 @@ static void tps80031_gpio_init(struct tps80031 *tps80031,
        tps80031->gpio.label            = tps->client->name;
        tps80031->gpio.dev              = tps80031->dev;
        tps80031->gpio.base             = gpio_base;
-       tps80031->gpio.ngpio            = 3;
+       tps80031->gpio.ngpio            = TPS80031_GPIO_NR;
        tps80031->gpio.can_sleep        = 1;
 
        tps80031->gpio.request          = tps80031_gpio_enable;
@@ -742,7 +742,7 @@ static int __devinit tps80031_irq_init(struct tps80031 *tps80031, int irq,
        tps80031->irq_chip.irq_bus_lock = tps80031_irq_lock;
        tps80031->irq_chip.irq_bus_sync_unlock = tps80031_irq_sync_unlock;
 
-       for (i = 0; i < ARRAY_SIZE(tps80031_irqs); i++) {
+       for (i = 0; i < TPS80031_INT_NR; i++) {
                int __irq = i + tps80031->irq_base;
                irq_set_chip_data(__irq, tps80031);
                irq_set_chip_and_handler(__irq, &tps80031->irq_chip,
index f643561..120a77a 100644 (file)
@@ -86,7 +86,16 @@ enum {
        TPS80031_INT_LINCH_GATED,
 
        /* Last interrupt id to get the end number */
-       TPS80031_INT_END,
+       TPS80031_INT_NR,
+};
+
+enum TPS80031_GPIO {
+       TPS80031_GPIO_REGEN1,
+       TPS80031_GPIO_REGEN2,
+       TPS80031_GPIO_SYSEN,
+
+       /* Last entry */
+       TPS80031_GPIO_NR,
 };
 
 enum {