Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp596379iog; Fri, 17 Jun 2022 09:22:44 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vNTSfi0QNfUPuszjDff5GQMyvGAcdONpwinoaV47Vcjn27h3aPFG29Y2hjYbQw+nK1Vmqe X-Received: by 2002:a05:6402:35c9:b0:431:3b5f:ecc1 with SMTP id z9-20020a05640235c900b004313b5fecc1mr13213470edc.349.1655482963832; Fri, 17 Jun 2022 09:22:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655482963; cv=none; d=google.com; s=arc-20160816; b=RAJYzz3UT1G76X9cPayB7Q7H6ohs9d1IAqx/kApRskD5Xcqq1l7mOzuV2x4kgLaqPp ST+53eMx4puLb0GTexCDhaIoBsj6Zy985xz8VurPH/opRRCt1OY6elDseAd2CTaD0rSZ EOkdC33Quw2qS+/wUeM4LFUr5ZNBQ2qcKlBd6Bv7kWwU4IRfrzu1onA0r1BZD0WgTVXN 4yf7Lqpa07gnqu49YOujtKnpPlQMPe6KOJREA9SxeWPzISUzQLHOVhyEgNMP4usQj35Z QgiJ3w5rSYd3Y0telSZkFk+B3jpgmxsJzbXZ8R8gb5333aJN1YCU4jLBwHyoaxrChb4K OMBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=HyaPAU422RTkmUp3vQSmgWg7DCK+47J/Ak6BUGAJv9g=; b=HLnb4NBkGICVZ22pV5d4vvSQ3iSXV4/6RenNptzopK0Re5SYn1DbpQP67bR+7FrY9X qfQTlnc1x7OmWkUUD4q3GJlXwosVaCkTvlZFtu7aS/UQe/jWTWZQaW9h0QWbygnUUSEo W3OQrAvE2LfoJ7EhzMwzcq2uWM6KsoN2pKCxOVoW4k0Z148EQ/RTUaz0AENHBNN1br8U G9aPPMzggp0gVoJngJdO4uRblLA+yBDfhTsdR/nW6DbPpSa4W+9Tp33oFvV2WiJeqedc 50sDQ8xucaE8+VhgVxcADSN5tHSVkpzHz+t8YZCfmJHmj18LS7h8DgG53xjQj8MIr86T vDAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=T+pFXVXs; 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=pass (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 29-20020a17090602dd00b006e86aac6b67si4919820ejk.351.2022.06.17.09.22.17; Fri, 17 Jun 2022 09:22:43 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=T+pFXVXs; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383173AbiFQQIw (ORCPT + 99 others); Fri, 17 Jun 2022 12:08:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383141AbiFQQIt (ORCPT ); Fri, 17 Jun 2022 12:08:49 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E043B33A10; Fri, 17 Jun 2022 09:08:48 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id u12so9637613eja.8; Fri, 17 Jun 2022 09:08:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HyaPAU422RTkmUp3vQSmgWg7DCK+47J/Ak6BUGAJv9g=; b=T+pFXVXs2r+jnKz9ngTh0ZNKl5hes6LPoOziVTWMXaG2Q/FnbhCwSNBXQVM1NoKmFw dzokG5Bb12FUtkfKvTF8dg9kf3laiK96t1QYl4fOKtPUqlcyJx+o8OS/26SQIgLM/+OZ xuLJnS2qJjR33nDhMfVhR4/31KgLMMUqtZvtOHKJ9V71j9d976A/7/vN9MXXgYdlYJ6P vRt2QWSIiDszzQnhb3iyubH6H84foOOjcspVK2zmQ87p++vrszkPM3tT+q/6CixA/w6g ajUTWiGspTuBwE7j0UlgGD3IYRBy4Gqo/GBDApB5elZBhq1+pqZKnL4InAAQ2y0qWCwP uhUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HyaPAU422RTkmUp3vQSmgWg7DCK+47J/Ak6BUGAJv9g=; b=NkZjloiXP68oAre/i2YU4DDqGyRTZGvtkru/FRLTOBkjv88kfWXrDA/eaim3kHdEXJ pyjQl6PgiDJJl4SJPu8nmArAXQsqOwa50G1PaFTK5uC1TvI3JBFaJoDzFV7aSai+Rrub 8fuEpgWA1e5LiLOL/cDUdbWClwLP6f7X2L9YbJgeCIoYEIzMdFHFlN26Dy27RFiZAlp0 lcY/drCa/2on/BQIps5Vs5eTPnp4rlVEY9JEM1SgvS4CBIHUbeI1AWNEp5SkCEZEIVDS 1CVHOxA2HcQKD+WMX6fQFmG3Hz4EEY7zFxQSV81bsxNgM0CUfWjHe7GUtWv2zQl5XZrE r3JA== X-Gm-Message-State: AJIora/8AM/F88pSDfrQV98idcsD6RSz1G1FOAQYl4/In+JjgFKlzW/d QzMJDjMWk08x/2S9F7+dr12Zdxq5pIFSQmAMmss= X-Received: by 2002:a17:906:434f:b0:711:eb76:c320 with SMTP id z15-20020a170906434f00b00711eb76c320mr9944067ejm.636.1655482127352; Fri, 17 Jun 2022 09:08:47 -0700 (PDT) MIME-Version: 1.0 References: <20220603135714.12007-1-aidanmacdonald.0x0@gmail.com> <20220603135714.12007-11-aidanmacdonald.0x0@gmail.com> In-Reply-To: From: Andy Shevchenko Date: Fri, 17 Jun 2022 18:08:09 +0200 Message-ID: Subject: Re: [PATCH 10/10] pinctrl: Add AXP192 pin control driver To: Aidan MacDonald Cc: Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Chen-Yu Tsai , Jonathan Cameron , Lee Jones , Sebastian Reichel , Mark Brown , Greg Kroah-Hartman , Liam Girdwood , Lars-Peter Clausen , "Rafael J. Wysocki" , "open list:GPIO SUBSYSTEM" , devicetree , linux-iio , Linux PM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Fri, Jun 17, 2022 at 2:14 PM Aidan MacDonald wrote: > Andy Shevchenko writes: > > On Fri, Jun 3, 2022 at 6:29 PM Aidan MacDonald > > wrote: ... > >> + if ((val & reginfo->mask) == (input_muxvals[offset] << (ffs(reginfo->mask) - 1))) > >> + return GPIO_LINE_DIRECTION_IN; > > > >> + else > > > > Redundant. > > Also applies for the other similar cases in your code. Note, this is > > also redundant for 'continue' and 'break' in case of loops. > > Sorry, I'm not sure what you're referring to here. The "else"? Yes. > I'm missing the generalization. > > >> + return GPIO_LINE_DIRECTION_OUT; ... > >> + pctl->chip.to_irq = axp192_gpio_to_irq; > > > > Why a custom method? > > The irq chip is part of the mfd device, not the gpio chip. There does > not seem to be any default implementation for this case so I have to > provide one. A similar example is gpio-wm8994. > > I did notice I'm doing something wrong by calling regmap_irq_get_virq() > in the probe function, which creates an irq mapping; I think I should be > doing that in the to_irq() callback like the other drivers do. It may be done using different approaches, but this part should be carefully reviewed by GPIO / pin control maintainers. ... > Ah, sorry, I see that function is deprecated. The documentation points > to doing this in the device tree instead. So if I understand correctly > I should follow the example of pinctrl-thunderbay and add gpio-ranges: > > pinctrl0: gpio@0 { > compatible = "x-powers,axp192-gpio"; > gpio-controller; > #gpio-cells = <2>; > gpio-ranges = <&pinctrl0 0 0 6>; > }; > > which means I'll have to update the gpio DT bindings. I'm guessing the > callback you mentioned is add_pin_ranges() or of_gpio_ranges_fallback() > but neither of those seem appropriate in this case. The DT node should > be good enough. Sounds good. -- With Best Regards, Andy Shevchenko