From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fgw23-7.mail.saunalahti.fi (fgw23-7.mail.saunalahti.fi [62.142.5.84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC62620B54 for ; Wed, 10 May 2023 14:16:49 +0000 (UTC) Received: from localhost (88-113-26-95.elisa-laajakaista.fi [88.113.26.95]) by fgw23.mail.saunalahti.fi (Halon) with ESMTP id 23a0e2df-ef3d-11ed-b972-005056bdfda7; Wed, 10 May 2023 17:15:40 +0300 (EEST) From: andy.shevchenko@gmail.com Date: Wed, 10 May 2023 17:15:38 +0300 To: Jonathan McDowell Cc: Rob Herring , Krzysztof Kozlowski , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Linus Walleij , Bartosz Golaszewski , Conor Dooley , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org Subject: Re: [PATCH v2 2/5] pinctrl: axp209: Add support for GPIO3 on the AXP209 Message-ID: References: Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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