aboutsummaryrefslogtreecommitdiff
path: root/drivers/mfd/pcf50633-gpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/pcf50633-gpio.c')
-rw-r--r--drivers/mfd/pcf50633-gpio.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/mfd/pcf50633-gpio.c b/drivers/mfd/pcf50633-gpio.c
index a7117fa6282..55139071d22 100644
--- a/drivers/mfd/pcf50633-gpio.c
+++ b/drivers/mfd/pcf50633-gpio.c
@@ -42,7 +42,7 @@ int pcf50633_gpio_get(struct pcf50633 *pcf, int gpio)
u8 reg, val;
reg = gpio - PCF50633_GPIO1 + PCF50633_REG_GPIO1CFG;
- val = pcf50633_reg_read(pcf, reg);
+ val = pcf50633_reg_read(pcf, reg) & 0x07;
return val;
}
@@ -55,7 +55,7 @@ void pcf50633_gpio_invert_set(struct pcf50633 *pcf, int gpio, int invert)
reg = gpio - PCF50633_GPIO1 + PCF50633_REG_GPIO1CFG;
val = !!invert << 3;
- pcf50633_reg_set_bit_mask(pcf, reg, val, val);
+ pcf50633_reg_set_bit_mask(pcf, reg, 1 << 3, val);
}
EXPORT_SYMBOL_GPL(pcf50633_gpio_invert_set);
@@ -87,13 +87,14 @@ static const u8 pcf50633_regulator_registers[PCF50633_NUM_REGULATORS] = {
void pcf50633_gpio_power_supply_set(struct pcf50633 *pcf,
int gpio, int regulator, int on)
{
- u8 reg, val;
+ u8 reg, val, mask;
/* the *ENA register is always one after the *OUT register */
reg = pcf50633_regulator_registers[regulator] + 1;
val = (!!on << (gpio - PCF50633_GPIO1));
+ mask = (1 << (gpio - PCF50633_GPIO1));
- pcf50633_reg_set_bit_mask(pcf, reg, val, val);
+ pcf50633_reg_set_bit_mask(pcf, reg, mask, val);
}
EXPORT_SYMBOL_GPL(pcf50633_gpio_power_supply_set);