mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-11 03:48:00 +00:00
pinctrl-sx150x: Improve oscio GPIO functions
Move actual code that configures oscio pin into a separate function and use it instead of calling sx150x_gpio_set to avoid calling sx150x_pin_is_oscio twice and correctly propagte error code in sx150x_gpio_direction_output. Tested-by: Neil Armstrong <narmstrong@baylibre.com> Acked-by: Neil Armstrong <narmstrong@baylibre.com> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
d977a876c6
commit
ab5bd03544
@ -372,15 +372,21 @@ static int __sx150x_gpio_set(struct sx150x_pinctrl *pctl, unsigned int offset,
|
|||||||
BIT(offset), value ? BIT(offset) : 0);
|
BIT(offset), value ? BIT(offset) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int sx150x_gpio_oscio_set(struct sx150x_pinctrl *pctl,
|
||||||
|
int value)
|
||||||
|
{
|
||||||
|
return regmap_write(pctl->regmap,
|
||||||
|
pctl->data->pri.x789.reg_clock,
|
||||||
|
(value ? 0x1f : 0x10));
|
||||||
|
}
|
||||||
|
|
||||||
static void sx150x_gpio_set(struct gpio_chip *chip, unsigned int offset,
|
static void sx150x_gpio_set(struct gpio_chip *chip, unsigned int offset,
|
||||||
int value)
|
int value)
|
||||||
{
|
{
|
||||||
struct sx150x_pinctrl *pctl = gpiochip_get_data(chip);
|
struct sx150x_pinctrl *pctl = gpiochip_get_data(chip);
|
||||||
|
|
||||||
if (sx150x_pin_is_oscio(pctl, offset))
|
if (sx150x_pin_is_oscio(pctl, offset))
|
||||||
regmap_write(pctl->regmap,
|
sx150x_gpio_oscio_set(pctl, value);
|
||||||
pctl->data->pri.x789.reg_clock,
|
|
||||||
(value ? 0x1f : 0x10));
|
|
||||||
else
|
else
|
||||||
__sx150x_gpio_set(pctl, offset, value);
|
__sx150x_gpio_set(pctl, offset, value);
|
||||||
|
|
||||||
@ -405,10 +411,8 @@ static int sx150x_gpio_direction_output(struct gpio_chip *chip,
|
|||||||
struct sx150x_pinctrl *pctl = gpiochip_get_data(chip);
|
struct sx150x_pinctrl *pctl = gpiochip_get_data(chip);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (sx150x_pin_is_oscio(pctl, offset)) {
|
if (sx150x_pin_is_oscio(pctl, offset))
|
||||||
sx150x_gpio_set(chip, offset, value);
|
return sx150x_gpio_oscio_set(pctl, value);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = __sx150x_gpio_set(pctl, offset, value);
|
ret = __sx150x_gpio_set(pctl, offset, value);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user