mfd: tps6586x: Fix wrong gpio value
Amit Kamath [Wed, 29 Dec 2010 13:04:36 +0000 (18:04 +0530)]
Replaced write to GPIO pin with read-modify write as old value was
overwritten.

Original-Change-Id: I679994ba920b70f90a2b1654ee2c0fcc3e08d02e
Reviewed-on: http://git-master/r/14540
Reviewed-by: Amit Kamath <akamath@nvidia.com>
Tested-by: Amit Kamath <akamath@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

Rebase-Id: Rf7e30c62eb580ed8727142b3b5604e2b7990f144

drivers/mfd/tps6586x.c

index 77eecf7..6d842fa 100644 (file)
@@ -311,8 +311,13 @@ static int tps6586x_gpio_output(struct gpio_chip *gc, unsigned offset,
 {
        struct tps6586x *tps6586x = container_of(gc, struct tps6586x, gpio);
        uint8_t val, mask;
+       int ret;
 
-       tps6586x_gpio_set(gc, offset, value);
+       val = value << offset;
+       mask = 0x1 << offset;
+       ret = tps6586x_update(tps6586x->dev, TPS6586X_GPIOSET2, val, mask);
+       if (ret)
+               return ret;
 
        val = 0x1 << (offset * 2);
        mask = 0x3 << (offset * 2);