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

Alexey Minnekhanov alexeymin at postmarketos.org
Sat Jan 21 03:47:11 CET 2023


Hi!

On 2023-01-19 20:18, Dzmitry Sankouski wrote:
> GPIO button driver requires direction functions to probe
> button gpio. Those functions are blank, since pwrkey gpio
> configured earlier not by u-boot.

...

> +/*
> + * Power button already configured as input by previous bootloader.
> + */
> +static int qcom_pwrkey_direction_input(struct udevice *dev, unsigned int offset)

I think this explanation and comment are a bit misleading. As far as I
understand, KDPWR and RESIN on qcom PMICs are not real GPIOs, they are
only modeled as such in U-Boot (probably because there were no keyboard
class drivers before?). Unlike other GPIOs exposed by the PMIC, which
are real GPIOs.

The comment in this file on line 276 says literally this [1]:

/* Add pmic buttons as GPIO as well - there is no generic way for now */

So these functions should be empty not because those were configured by
first-stage bootloader, but because these buttons are not really GPIOs
and they simply do not support setting directions.

Thanks for working on this! This is really useful, if not you, I'd do 
this myself. :)

[1] 
https://elixir.bootlin.com/u-boot/v2023.01/source/drivers/gpio/qcom_pmic_gpio.c#L276


More information about the U-Boot mailing list