[PATCH v2 2/5] pinctrl: axp209: Add support for GPIO3 on the AXP209

andy.shevchenko at gmail.com andy.shevchenko at gmail.com
Wed May 10 07:15:38 PDT 2023


Wed, May 10, 2023 at 01:01:27PM +0100, Jonathan McDowell kirjoitti:
> The AXP209 device has a 4th GPIO which has a slightly different register
> setup, where the control + status bits are held in a single register
> rather than sharing AXP20X_GPIO20_SS with GPIOs 0-2.

...

> +#define AXP20X_GPIO3_FUNCTIONS		(BIT(2) | BIT(1))

GENMASK() ?

...


> +#define AXP20X_GPIO3_FUNCTION_OUT_LOW	0
> +#define AXP20X_GPIO3_FUNCTION_OUT_HIGH	BIT(1)
> +#define AXP20X_GPIO3_FUNCTION_INPUT	BIT(2)

Seems mixed use of decimal and bitwise values, switch to decimal, since it
makes more sense in my opinion.

...

> +	if (offset == 3) {
> +		ret = regmap_read(pctl->regmap, AXP20X_GPIO3_CTRL, &val);
> +		if (ret)
> +			return ret;
> +		if (val & AXP20X_GPIO3_FUNCTION_INPUT)
> +			return GPIO_LINE_DIRECTION_IN;

> +		else

Redundant 'else'.

> +			return GPIO_LINE_DIRECTION_OUT;
> +	}


-- 
With Best Regards,
Andy Shevchenko





More information about the linux-arm-kernel mailing list