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 7E7D1C43217 for ; Fri, 11 Nov 2022 09:02:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233665AbiKKJCy (ORCPT ); Fri, 11 Nov 2022 04:02:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233654AbiKKJCb (ORCPT ); Fri, 11 Nov 2022 04:02:31 -0500 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D4AD7878E; Fri, 11 Nov 2022 00:59:15 -0800 (PST) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 2AB8wk4g130327; Fri, 11 Nov 2022 02:58:46 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1668157126; bh=MzK939t1bZHhF1XE9KfYy0hyr4NI9NAbtTrJALGKJDc=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=XKoVv8/0jagy2y4ztuHR9d7Mdq95BiFUEsp5OvI+hbXBFiNPgJE0CBo/J+u2Cwnj6 HqSSjOTRIhqEQETPrvJjDWXP0I/f2xSM/2b07edh7+txQ/jvWS7uIAL53lk7FoKmVQ WrKUajDG1Hc4ycifOILf8jpGzNPc93eSCsmTZWS8= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 2AB8wkUv028572 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 11 Nov 2022 02:58:46 -0600 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.6; Fri, 11 Nov 2022 02:58:45 -0600 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.6 via Frontend Transport; Fri, 11 Nov 2022 02:58:45 -0600 Received: from ubuntu (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with SMTP id 2AB8wXWR105891; Fri, 11 Nov 2022 02:58:35 -0600 Date: Fri, 11 Nov 2022 00:58:32 -0800 From: Matt Ranostay To: Linus Walleij CC: Michael Walle , , , , , , , , , , , , , Keerthy Subject: Re: [PATCH v3 4/7] gpio: tps6594x: add GPIO support for TPS6594x PMIC Message-ID: References: <20221109065546.24912-1-mranostay@ti.com> <20221109065546.24912-5-mranostay@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org On Thu, Nov 10, 2022 at 11:15:22AM +0100, Linus Walleij wrote: > On Thu, Nov 10, 2022 at 11:12 AM Matt Ranostay wrote: > > On Wed, Nov 09, 2022 at 10:59:08AM +0100, Linus Walleij wrote: > > > On Wed, Nov 9, 2022 at 7:56 AM Matt Ranostay wrote: > > > > > > > Add support for TPS6594X PMICs GPIO interface that has 11 that can be > > > > configured as input or outputs. > > > > > > > > Tested-by: Keerthy > > > > Signed-off-by: Matt Ranostay > > > > > > (...) > > > > +config GPIO_TPS6594X > > > > + tristate "TI TPS6594X GPIO driver" > > > > + depends on MFD_TPS6594X > > > > + help > > > > + Select this option to enable GPIO driver for the TPS6954X > > > > + PMIC chip family. There are 11 GPIOs that can be configured. > > > > > > select GPIO_REGMAP > > > > > > This driver is an archetypical example of a driver that can make great > > > use of GPIO_REGMAP helpers, so rewrite it to use them. > > > Look in drivers/gpio/gpio-sl28cpld.c for an example. > > > > Linus, > > > > Those helpers look great for this usecase on the surface but however I think there could be some issues. > > For GPIO direction it isn't configured by a bitmap on a register(s) but by a bit on a range of > > registers (with a register for each GPIOx). > > > > For set/get values the gpio helper would work though. > > Isn't is possible to just use parts of the GPIO_REGMAP > helpers? I thought it's designed like such. > > Michael Walle will know what to do with your usecase, and > whether to use it or not, let's page him! > So after looking around a bit and digging into the helper code I found this drivers/pinctrl/bcm/pinctrl-bcm63xx.c which has a example on how to override the reg_mask_xlate function which could be used for changing the stride, and mask based on the base address. Currently have coded up using the gpio regmap helper. Will run through some testing first and then submit for review. - Matt > Yours, > Linus Walleij