]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/kernel-video.git/commitdiff
mfd: Palmas: Add TPS659038 PMIC support
authorJ Keerthy <j-keerthy@ti.com>
Mon, 27 May 2013 10:55:00 +0000 (16:25 +0530)
committerJ Keerthy <j-keerthy@ti.com>
Tue, 28 May 2013 05:39:04 +0000 (11:09 +0530)
The Patch adds TPS659038 PMIC support in the palmas mfd driver.
The TPS659038 has almost the same registers as of the earlier
supported variants of PALMAS family such as the TWL6035.

The critical differences between TPS659038 and TWL6035 being:

1) TPS659038 has nothing related to battery charging and back up battery stuff.
2) TPS659038 does not have does not have SMPS10(Boost) step up convertor.
3) TPS659038 does not have Battery detection and anything related to battery.
4) TPS659038 has something more than Palmas in one case it is called
   Sync clock Functionality.
5) can use an external crystal unit or 16MHz oscillator to generate clock.
6) SD card detection, Battery presence detection, Vibrator, USB OTG are missing
   when compared to TWL6035.

Hence some of the IRQs are reserved in case of TPS659038 but the
remaining are bit exact compared to TWL6035.

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Documentation/devicetree/bindings/mfd/palmas.txt
drivers/mfd/palmas.c
include/linux/mfd/palmas.h

index d5ab9e69e7e016d36eb1b650a3b5736686deb781..3defba700eed5a3414689396325ca73049bd007f 100644 (file)
@@ -16,6 +16,7 @@ Required properties:
   ti,tps65913
   ti,tps65914
   ti,tps80036
+  ti,tps659038
 and also the generic series names
   ti,palmas
   ti,palmas-charger
index e7947cbbd55ae885a88d3073644874941e58e6bd..ce51d7ffbff9edfe2e0fa1a4a6e902f9126bfab1 100644 (file)
@@ -86,6 +86,49 @@ static const struct mfd_cell palmas_children[] = {
        }
 };
 
+static const struct mfd_cell tps659038_children[] = {
+       {
+               .name = "tps659038-pmic",
+               .id = PALMAS_PMIC_ID,
+       },
+       {
+               .name = "tps659038-gpio",
+               .id = PALMAS_GPIO_ID,
+       },
+       {
+               .name = "tps659038-leds",
+               .id = PALMAS_LEDS_ID,
+       },
+       {
+               .name = "tps659038-wdt",
+               .id = PALMAS_WDT_ID,
+       },
+       {
+               .name = "tps659038-rtc",
+               .id = PALMAS_RTC_ID,
+       },
+       {
+               .name = "tps659038-pwrbutton",
+               .id = PALMAS_PWRBUTTON_ID,
+       },
+       {
+               .name = "tps659038-gpadc",
+               .id = PALMAS_GPADC_ID,
+       },
+       {
+               .name = "tps659038-resource",
+               .id = PALMAS_RESOURCE_ID,
+       },
+       {
+               .name = "tps659038-clk",
+               .id = PALMAS_CLK_ID,
+       },
+       {
+               .name = "tps659038-pwm",
+               .id = PALMAS_PWM_ID,
+       }
+};
+
 static const struct regmap_config palmas_regmap_config[PALMAS_NUM_CLIENTS] = {
        {
                .reg_bits = 8,
@@ -341,11 +384,23 @@ static struct palmas_pmic_data palmas_data = {
        .has_usb = 1,
 };
 
+static struct palmas_pmic_data tps659038_data = {
+       .irq_chip = &palmas_irq_chip,
+       .regmap_config = palmas_regmap_config,
+       .mfd_cell = tps659038_children,
+       .id = TPS659038,
+       .has_usb = 0,
+};
+
 static const struct of_device_id of_palmas_match_tbl[] = {
        {
                .compatible = "ti,palmas",
                .data = &palmas_data,
        },
+       {
+               .compatible = "ti,tps659038",
+               .data = &tps659038_data,
+       },
        { },
 };
 
@@ -419,18 +474,23 @@ static int palmas_i2c_probe(struct i2c_client *i2c,
                }
        }
 
-       /* Change IRQ into clear on read mode for efficiency */
-       slave = PALMAS_BASE_TO_SLAVE(PALMAS_INTERRUPT_BASE);
-       addr = PALMAS_BASE_TO_REG(PALMAS_INTERRUPT_BASE, PALMAS_INT_CTRL);
-       reg = PALMAS_INT_CTRL_INT_CLEAR;
+       /* Avoid irq requesting for TOS659038 as the IRQ line
+               is only connected to a test point */
+       if (palmas->palmas_id != TPS659038) {
+               /* Change IRQ into clear on read mode for efficiency */
+               slave = PALMAS_BASE_TO_SLAVE(PALMAS_INTERRUPT_BASE);
+               addr = PALMAS_BASE_TO_REG(PALMAS_INTERRUPT_BASE,
+                                         PALMAS_INT_CTRL);
+               reg = PALMAS_INT_CTRL_INT_CLEAR;
 
-       regmap_write(palmas->regmap[slave], addr, reg);
+               regmap_write(palmas->regmap[slave], addr, reg);
 
-       ret = regmap_add_irq_chip(palmas->regmap[slave], palmas->irq,
-                       IRQF_ONESHOT, 0, pmic_data->irq_chip,
-                       &palmas->irq_data);
-       if (ret < 0)
-               goto err;
+               ret = regmap_add_irq_chip(palmas->regmap[slave], palmas->irq,
+                               IRQF_ONESHOT, 0, pmic_data->irq_chip,
+                               &palmas->irq_data);
+               if (ret < 0)
+                       goto err;
+       }
 
        slave = PALMAS_BASE_TO_SLAVE(PALMAS_PU_PD_OD_BASE);
        addr = PALMAS_BASE_TO_REG(PALMAS_PU_PD_OD_BASE,
@@ -539,8 +599,11 @@ static int palmas_i2c_probe(struct i2c_client *i2c,
        children[PALMAS_RESOURCE_ID].pdata_size =
                        sizeof(*pdata->resource_pdata);
 
-       children[PALMAS_USB_ID].platform_data = pdata->usb_pdata;
-       children[PALMAS_USB_ID].pdata_size = sizeof(*pdata->usb_pdata);
+       /* TPS659038 does not have USB */
+       if (pmic_data->has_usb) {
+               children[PALMAS_USB_ID].platform_data = pdata->usb_pdata;
+               children[PALMAS_USB_ID].pdata_size = sizeof(*pdata->usb_pdata);
+       }
 
        children[PALMAS_CLK_ID].platform_data = pdata->clk_pdata;
        children[PALMAS_CLK_ID].pdata_size = sizeof(*pdata->clk_pdata);
@@ -580,6 +643,7 @@ static const struct i2c_device_id palmas_i2c_id[] = {
        { "twl6035", TWL6035},
        { "twl6037", TWL6037},
        { "tps65913", TPS65913},
+       { "tps659038", TPS659038},
        { /* end */ }
 };
 MODULE_DEVICE_TABLE(i2c, palmas_i2c_id);
index 7838df7f4d3cea2572b47a0d4322ac730c76880d..346bed95dd0fca56c852f2fc93cbdc898db49536 100644 (file)
@@ -137,6 +137,7 @@ enum pmic_ids {
        TWL6035,
        TWL6037,
        TPS65913,
+       TPS659038,
 };
 
 enum palmas_regulators {