mfd: palmas: add USB VBUS LP0 wakeup option
Lucas Dai [Mon, 25 Mar 2013 23:31:25 +0000 (16:31 -0700)]
Currently we are using the Palmas to handle VBUS detection and wake up
AP using Palmas's IRQ line as wakeup source. We can also wakeup the AP
directly from USB VBUS line if enable the AP's VBUS input controlled by
ldousb regulator.

bug 1239645

Change-Id: I412c8a9f5488d9553049dc09ce74f8f927709290
Signed-off-by: Lucas Dai <lucasd@nvidia.com>
Reviewed-on: http://git-master/r/205897
Reviewed-by: Mrutyunjay Sawant <msawant@nvidia.com>
Tested-by: Mrutyunjay Sawant <msawant@nvidia.com>

drivers/mfd/palmas.c
include/linux/mfd/palmas.h

index 01d493d..70407b3 100644 (file)
@@ -1059,6 +1059,11 @@ static int __devinit palmas_i2c_probe(struct i2c_client *i2c,
        if (pdata->use_power_off && !pm_power_off)
                pm_power_off = palmas_power_off;
 
+       if (pdata->auto_ldousb_en)
+               /* VBUS detection enables the LDOUSB */
+               palmas_control_update(palmas, PALMAS_EXT_CHRG_CTRL, 1,
+                                       PALMAS_EXT_CHRG_CTRL_AUTO_LDOUSB_EN);
+
        palmas_dev = palmas;
        return ret;
 
index c536453..28e65c0 100644 (file)
@@ -2,6 +2,7 @@
  * TI Palmas
  *
  * Copyright 2011 Texas Instruments Inc.
+ * Copyright (c) 2013, NVIDIA CORPORATION.  All rights reserved.
  *
  * Author: Graeme Gregory <gg@slimlogic.co.uk>
  *
@@ -242,6 +243,8 @@ struct palmas_platform_data {
        struct palmas_clk32k_init_data  *clk32k_init_data;
        int clk32k_init_data_size;
        bool use_power_off;
+       /* LDOUSB is enabled or disabled on VBUS detection */
+       bool auto_ldousb_en;
 
        struct palmas_pinctrl_platform_data *pinctrl_pdata;
        struct palmas_extcon_platform_data *extcon_pdata;