[PATCH v2 1/4] gpio: qcom: add direction functions for pwrkey

Sumit Garg sumit.garg at linaro.org
Fri Jan 20 08:28:38 CET 2023


On Thu, 19 Jan 2023 at 22:48, Dzmitry Sankouski <dsankouski at gmail.com> wrote:
>
> GPIO button driver requires direction functions to probe
> button gpio. Those functions are blank, since pwrkey gpio
> configured earlier not by u-boot.
>
> Signed-off-by: Dzmitry Sankouski <dsankouski at gmail.com>
> ---
> Changes for v2:
> - none
>
>  drivers/gpio/qcom_pmic_gpio.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>

Reviewed-by: Sumit Garg <sumit.garg at linaro.org>

-Sumit

> diff --git a/drivers/gpio/qcom_pmic_gpio.c b/drivers/gpio/qcom_pmic_gpio.c
> index 3be1be8692..e46377ce3b 100644
> --- a/drivers/gpio/qcom_pmic_gpio.c
> +++ b/drivers/gpio/qcom_pmic_gpio.c
> @@ -303,9 +303,24 @@ static int qcom_pwrkey_get_value(struct udevice *dev, unsigned offset)
>         }
>  }
>
> +/*
> + * Power button already configured as input by previous bootloader.
> + */
> +static int qcom_pwrkey_direction_input(struct udevice *dev, unsigned int offset)
> +{
> +       return 0;
> +}
> +
> +static int qcom_pwrkey_direction_output(struct udevice *dev, unsigned int offset, int value)
> +{
> +       return -EOPNOTSUPP;
> +}
> +
>  static const struct dm_gpio_ops qcom_pwrkey_ops = {
>         .get_value              = qcom_pwrkey_get_value,
>         .get_function           = qcom_pwrkey_get_function,
> +       .direction_input        = qcom_pwrkey_direction_input,
> +       .direction_output       = qcom_pwrkey_direction_output,
>  };
>
>  static int qcom_pwrkey_probe(struct udevice *dev)
> --
> 2.30.2
>


More information about the U-Boot mailing list