int as3722_gpio_direction_output(struct udevice *pmic, unsigned int gpio, unsigned int level) { u8 value; int err; if (gpio > 7) return -EINVAL; if (level == 0) value = AS3722_GPIO_CONTROL_MODE_OUTPUT_VDDL; else value = AS3722_GPIO_CONTROL_MODE_OUTPUT_VDDH; err = as3722_write(pmic, AS3722_GPIO_CONTROL(gpio), value); if (err) { error("failed to configure GPIO#%u as output: %d", gpio, err); return err; } err = as3722_gpio_set(pmic, gpio, level); if (err < 0) { error("failed to set GPIO#%u high: %d", gpio, err); return err; } return 0; }
static int as3722_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int value) { as3722_gpio_set(chip, offset, value); return pinctrl_gpio_direction_output(chip->base + offset); }