mfd: max77663: add support for status LED control through PMU GPIO
Johnny Qiu [Thu, 16 Feb 2012 20:04:37 +0000 (12:04 -0800)]
Bug 920845
Bug 931371

Change-Id: I7c03c7f2f16aee1be636c2f8fd8ad18cf7539eae
Signed-off-by: Johnny Qiu <joqiu@nvidia.com>
Signed-off-by: Hao Tang <htang@nvidia.com>
Reviewed-on: http://git-master/r/83724
Reviewed-by: Kerwin Wan <kerwinw@nvidia.com>
Reviewed-by: Simone Willett <swillett@nvidia.com>

drivers/mfd/max77663-core.c
include/linux/mfd/max77663-core.h

index 137c04b..2ecb84d 100644 (file)
@@ -1358,8 +1358,13 @@ static int max77663_suspend(struct device *dev)
 {
        struct i2c_client *client = to_i2c_client(dev);
        struct max77663_chip *chip = i2c_get_clientdata(client);
+       struct max77663_platform_data *pdata = chip->pdata;
        int ret;
 
+       /* PMU_STAT_LED */
+       if (pdata->has_stat_led)
+               max77663_gpio_dir_input(&chip->gpio, pdata->stat_led_gpio);
+
        if (client->irq)
                disable_irq(client->irq);
 
@@ -1374,6 +1379,7 @@ static int max77663_resume(struct device *dev)
 {
        struct i2c_client *client = to_i2c_client(dev);
        struct max77663_chip *chip = i2c_get_clientdata(client);
+       struct max77663_platform_data *pdata = chip->pdata;
        int ret;
 
        ret = max77663_sleep(chip, false);
@@ -1385,6 +1391,12 @@ static int max77663_resume(struct device *dev)
        if (client->irq)
                enable_irq(client->irq);
 
+       /* PMU_STAT_LED */
+       if (pdata->has_stat_led) {
+               max77663_gpio_dir_output(&chip->gpio, MAX77663_GPIO7,
+                       pdata->stat_led_active_low ? 0 : 1);
+       }
+
        return 0;
 }
 #else
index acfe22a..896b656 100644 (file)
@@ -140,6 +140,9 @@ struct max77663_platform_data {
        unsigned char rtc_i2c_addr;
 
        bool use_power_off;
+       int has_stat_led;
+       int stat_led_gpio;
+       int stat_led_active_low;
 };
 
 #if defined(CONFIG_MFD_MAX77663)