forked from Minki/linux
gpio: tps65910: use regmap accessors
Use regmap accessors directly for register manipulation - removing one layer of abstraction. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Acked-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
This commit is contained in:
parent
f594d01bb4
commit
a233d4ebfc
@ -28,7 +28,7 @@ static int tps65910_gpio_get(struct gpio_chip *gc, unsigned offset)
|
|||||||
struct tps65910 *tps65910 = tps65910_gpio->tps65910;
|
struct tps65910 *tps65910 = tps65910_gpio->tps65910;
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
tps65910_reg_read(tps65910, TPS65910_GPIO0 + offset, &val);
|
regmap_read(tps65910->regmap, TPS65910_GPIO0 + offset, &val);
|
||||||
|
|
||||||
if (val & GPIO_STS_MASK)
|
if (val & GPIO_STS_MASK)
|
||||||
return 1;
|
return 1;
|
||||||
@ -43,10 +43,10 @@ static void tps65910_gpio_set(struct gpio_chip *gc, unsigned offset,
|
|||||||
struct tps65910 *tps65910 = tps65910_gpio->tps65910;
|
struct tps65910 *tps65910 = tps65910_gpio->tps65910;
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
tps65910_reg_set_bits(tps65910, TPS65910_GPIO0 + offset,
|
regmap_set_bits(tps65910->regmap, TPS65910_GPIO0 + offset,
|
||||||
GPIO_SET_MASK);
|
GPIO_SET_MASK);
|
||||||
else
|
else
|
||||||
tps65910_reg_clear_bits(tps65910, TPS65910_GPIO0 + offset,
|
regmap_clear_bits(tps65910->regmap, TPS65910_GPIO0 + offset,
|
||||||
GPIO_SET_MASK);
|
GPIO_SET_MASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ static int tps65910_gpio_output(struct gpio_chip *gc, unsigned offset,
|
|||||||
/* Set the initial value */
|
/* Set the initial value */
|
||||||
tps65910_gpio_set(gc, offset, value);
|
tps65910_gpio_set(gc, offset, value);
|
||||||
|
|
||||||
return tps65910_reg_set_bits(tps65910, TPS65910_GPIO0 + offset,
|
return regmap_set_bits(tps65910->regmap, TPS65910_GPIO0 + offset,
|
||||||
GPIO_CFG_MASK);
|
GPIO_CFG_MASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ static int tps65910_gpio_input(struct gpio_chip *gc, unsigned offset)
|
|||||||
struct tps65910_gpio *tps65910_gpio = gpiochip_get_data(gc);
|
struct tps65910_gpio *tps65910_gpio = gpiochip_get_data(gc);
|
||||||
struct tps65910 *tps65910 = tps65910_gpio->tps65910;
|
struct tps65910 *tps65910 = tps65910_gpio->tps65910;
|
||||||
|
|
||||||
return tps65910_reg_clear_bits(tps65910, TPS65910_GPIO0 + offset,
|
return regmap_clear_bits(tps65910->regmap, TPS65910_GPIO0 + offset,
|
||||||
GPIO_CFG_MASK);
|
GPIO_CFG_MASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ static int tps65910_gpio_probe(struct platform_device *pdev)
|
|||||||
if (!pdata->en_gpio_sleep[i])
|
if (!pdata->en_gpio_sleep[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ret = tps65910_reg_set_bits(tps65910,
|
ret = regmap_set_bits(tps65910->regmap,
|
||||||
TPS65910_GPIO0 + i, GPIO_SLEEP_MASK);
|
TPS65910_GPIO0 + i, GPIO_SLEEP_MASK);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
dev_warn(tps65910->dev,
|
dev_warn(tps65910->dev,
|
||||||
|
Loading…
Reference in New Issue
Block a user