From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B88FC77B7D for ; Wed, 10 May 2023 14:15:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237117AbjEJOPp (ORCPT ); Wed, 10 May 2023 10:15:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237161AbjEJOPp (ORCPT ); Wed, 10 May 2023 10:15:45 -0400 Received: from fgw23-7.mail.saunalahti.fi (fgw23-7.mail.saunalahti.fi [62.142.5.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12BFC46A2 for ; Wed, 10 May 2023 07:15:42 -0700 (PDT) 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: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org 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