mfd: ricoh583: Support shutdown through input signal
Laxman Dewangan [Wed, 16 Nov 2011 13:00:02 +0000 (18:00 +0530)]
Adding configuration parameter through platform data
to shutdown the PMIC when shutdown signal in input pin
SHUTDB is active.

bug 900732

Reviewed-on: http://git-master/r/65443
(cherry picked from commit 9327b9815e9791f56f95e0e691c1f1e15cf39b04)

Change-Id: I200c6f8755a55ad1875ba54c9c88a77e0937fb38
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/66325

Rebase-Id: Rcabdd1c5d217bfd201b241f443701d9253625df7

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

index dcb9d89..4811867 100644 (file)
@@ -486,10 +486,15 @@ static int __devinit ricoh583_ext_power_init(struct ricoh583 *ricoh583,
 {
        int ret;
        int i;
+       uint8_t on_off_val = 0;
 
        /*  Clear ONOFFSEL register */
        mutex_lock(&ricoh583->io_lock);
-       ret = __ricoh583_write(ricoh583->client, RICOH_ONOFFSEL_REG, 0x0);
+       if (pdata->enable_shutdown_pin)
+               on_off_val |= 0x1;
+
+       ret = __ricoh583_write(ricoh583->client, RICOH_ONOFFSEL_REG,
+                                       on_off_val);
        if (ret < 0)
                dev_err(ricoh583->dev, "Error in writing reg %d error: "
                                "%d\n", RICOH_ONOFFSEL_REG, ret);
index db1099e..086cbff 100644 (file)
@@ -140,6 +140,7 @@ struct ricoh583_platform_data {
 
        struct ricoh583_gpio_init_data *gpio_init_data;
        int num_gpioinit_data;
+       bool enable_shutdown_pin;
 };
 
 extern int ricoh583_read(struct device *dev, uint8_t reg, uint8_t *val);