Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7376424rwr; Wed, 10 May 2023 07:31:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4SU6iljHX1iTuEG0+9SPhx+87zLG5D8MEn7Z8ZOn0ctzpbzCMbco7ohNvwYDpCz/I6vBK5 X-Received: by 2002:a9d:63d9:0:b0:69f:165b:1509 with SMTP id e25-20020a9d63d9000000b0069f165b1509mr3347711otl.35.1683729109411; Wed, 10 May 2023 07:31:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683729109; cv=none; d=google.com; s=arc-20160816; b=h+6e92jzdboG9LjtVk7T+9vq6TPaDsRZRtVuYDTnK2ugbfDkH2dN8csS9tgAuQjzM/ SusQ+pUFtHPkO++C0sK1ntWq5qw7PMF2I7ttafaGI7MgHEFcC7RjsjMxFthVQPCvSGP4 Pgtg6mnNc/FSfOiBWU2/O+6bU7khDhCj21hRhOk+HsR4DvT62flxHLQqMUwi5xMrnMpU vZsGSLdaeqbkaV8CMcFlx10akAQZU/Cvjo6I95yfoYXsHr9zrqKBArm50/A0SnkS09SJ 5OD/5fQC6kzPLt6iPrimi1gs3d14PotltW/vUSlcnqOlWiBPP3DCAGBIgUZ7S/GOHs23 KqGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:date:from; bh=VZwx/AAfdlrJSqV/bkO4XJef7/uoMe/ntINfyKvh5VI=; b=JCNSFJMFZqtf2iO80i3uYPuyIzttBvjFXKbvBMaBd2P+aqL9w2xN3FPCm4LfFRML8y tz3ue7krZ1FG5HTUJPeJtN+olzPIOIrMRFHb4oIJ+VDom0mfMoCI2ubT2ngOg20XAx4h 9ZpxNRXKZniWjcSqMdC+eStrrybK+HO6+s+yvw/MeWYHUL0C/msN3vyGnzZqWD3YDbQA oS+oir2kmUrc97bI8QqbNZCFTpC8H9R/i/Rdi007fVKrbLox1/Orp4MUbQvVX6Y6xRhI SibuXUloraXAy+Yisif8jh8xF/DcPsYLP3Qr071QVgpkfFnjJYcB6xR4ZHjMKqDV3aMS 7KHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w15-20020a056830410f00b006a1231ce942si8503129ott.365.2023.05.10.07.31.36; Wed, 10 May 2023 07:31:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237351AbjEJOPq (ORCPT + 99 others); Wed, 10 May 2023 10:15:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237333AbjEJOPp (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 021EE2D40 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: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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