Message ID | cover.1681580558.git.noodles@earth.li |
---|---|
Headers | show |
Series | Minor device-tree additions for C.H.I.P | expand |
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; > + }