[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZFunCnXldqEMFYaE@surfacebook>
Date: Wed, 10 May 2023 17:15:38 +0300
From: andy.shevchenko@...il.com
To: Jonathan McDowell <noodles@...th.li>
Cc: Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Chen-Yu Tsai <wens@...e.org>,
Jernej Skrabec <jernej.skrabec@...il.com>,
Samuel Holland <samuel@...lland.org>,
Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>,
Conor Dooley <conor+dt@...nel.org>, devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-sunxi@...ts.linux.dev,
linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org
Subject: Re: [PATCH v2 2/5] pinctrl: axp209: Add support for GPIO3 on the
AXP209
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
Powered by blists - more mailing lists