Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp735557rwr; Fri, 5 May 2023 04:25:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ74P+cOJlg9ZqIpOg4DAmo1qd5URM/VsjkgeBTlYhfV7ISvtRR6JQDsDOzIU2eVd3R1gGt2 X-Received: by 2002:a17:903:2405:b0:1a6:4b60:3195 with SMTP id e5-20020a170903240500b001a64b603195mr1333864plo.66.1683285917660; Fri, 05 May 2023 04:25:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683285917; cv=none; d=google.com; s=arc-20160816; b=w7/6kfyk1bOAWgT1a4oK5UmFyh9b6I90svNghNvNPYU9q+qorWFpoJ/n0Mtf1Exz7p JoujZA3KbscSxtsSF1rKzp8q0WtEQ393pQ+4N+a+rsEC54ACiQY8RzEK7BYiKdyjX4yF WcoMAoYzeqp1cRRyxSE7of46s5FPNfAwcjCwHHyVO09LURiyQ7/cYz4M0Bp7l+MYO35h b9lAIJVYuJqBLpoY6ZxwriV2Tpy3UI5giNS64Oi+gYgPyofvQxBFkD4xVHQzavnrYjtO 0kGe6+LO44UmJ8YkGPReF6IvG23RYoVAaDdK6Uum0qo5zEgvs1v5g9OFZXalb9T/0pkQ eowA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=VMh/43OBmVa5W+sApW1lWJ+8XgRig/QCp8MH47Ky4W4=; b=V23Ht0tgAjgo5WQpuN/3p7xIKzTGKJ0/UvYvCb3XV0/cgWruXLN/ITm8heY7n5B5sg sUmqIsVz/+6RCnRr0mWsHKHrUiy4q8ujkRK4rczP1RAsGWCQrWAVpVlpf4qPZl9+QBdH gj4tkeLABIN0/hJ35gsnx2xUtiRRpbcLZtMk8zRo7IUdj+3m6OEo2iOVKFzoMcBzH6OI zuR4NeMMsm3nZfB8xddNnRTaSMTTQk6oXC+ffc0hEQEsBxmUgwxakXN0D7+EXTwNYxp8 vjtml9lhCPdsgO4uf3nBMMBm16Tivkzmv5h1kKJ2Brjq9Yj7q9OkcgIy3T2HSJNy1MyL Digw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Gid/OSuL"; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c8-20020a170902848800b001aad604bb95si1363146plo.152.2023.05.05.04.25.02; Fri, 05 May 2023 04:25:17 -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=@linaro.org header.s=google header.b="Gid/OSuL"; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231649AbjEELX6 (ORCPT + 99 others); Fri, 5 May 2023 07:23:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229568AbjEELX5 (ORCPT ); Fri, 5 May 2023 07:23:57 -0400 Received: from mail-yw1-x1131.google.com (mail-yw1-x1131.google.com [IPv6:2607:f8b0:4864:20::1131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2C0717DFE for ; Fri, 5 May 2023 04:23:55 -0700 (PDT) Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-55a20a56a01so28149847b3.3 for ; Fri, 05 May 2023 04:23:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683285835; x=1685877835; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=VMh/43OBmVa5W+sApW1lWJ+8XgRig/QCp8MH47Ky4W4=; b=Gid/OSuLLgZJuvHMZ03uxW45BnHAT4yABfayVkZxEnTsaOgEJTcFhZW14vbUifPUpj 4lvMtKPqbbn8/CSf2AySUrvJfmNSim2bD02RcxGP1MbrJ/TxjaZaA4/75Km0akf4erc5 18pkEewruftfw+HEYwccY8czqRKyDbYuSAXNgXXX6frNuzVQZX3tQemHOwJ+Pt4Pzf3+ FQTZD/HkzQN2VNqutAlJ5i3xIoyFEB4EQ5jIq0+ebA8TpL8ywdT0IFptsJTaV8guoM5K F7XFO/ItU5W8pgA9eAHmVeqCnbzeLm1XjjBmfgX6jrmtjp1O4uDTWhQPbj+JsIsZf+Ng 4W1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683285835; x=1685877835; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VMh/43OBmVa5W+sApW1lWJ+8XgRig/QCp8MH47Ky4W4=; b=jdof61IESZhHeS+Ltn9ukvt39Uf1N6WArLzNXFGVVop95MAY1gAv42OHgJQ3EuHU7l eHW4qjWnDc9lggcADygoZFs7PTkZbOajdDAsu+nVlJnnWAXWDFGjb7+F9XAyykvtgWJT BjySNfYSjKxfwY6ym46g0rmuLlqwkm8H8mqluk9P9rPBLTF2RsGfSuGbXxReZmgrEF+Q +IshTuvLmT1uR3R3D/8Zn89PMs1aMa/xwoyY2pzQnMmqJNtXPkkaNrVdQUnVcYrq6Z+e ETwl6e5M7nMux4wGCpRx9XFKabqoiX00UagAJ94vElhKz2IOgcgPO17lM3PXmmLxi/1+ Cqqw== X-Gm-Message-State: AC+VfDwPaCz4HyfBFr6SdkZOU9kqWvIrTN/ttg+ONA7OLlhu1bpQDdSJ DcSRT2Fbnd3Oj3EoXJum06AKlaFPf/6ko9vFLxA7kg== X-Received: by 2002:a0d:dd10:0:b0:559:eb47:fc65 with SMTP id g16-20020a0ddd10000000b00559eb47fc65mr1179026ywe.28.1683285835210; Fri, 05 May 2023 04:23:55 -0700 (PDT) MIME-Version: 1.0 References: <20230414101217.1342891-1-eblanc@baylibre.com> <20230414101217.1342891-3-eblanc@baylibre.com> In-Reply-To: From: Linus Walleij Date: Fri, 5 May 2023 13:23:44 +0200 Message-ID: Subject: Re: [PATCH v3 2/3] pinctrl: tps6594: add for TPS6594 PMIC To: Esteban Blanc , Michael Walle Cc: lgirdwood@gmail.com, broonie@kernel.org, a.zummo@towertech.it, alexandre.belloni@bootlin.com, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-rtc@vger.kernel.org, jpanis@baylibre.com, jneanne@baylibre.com, aseketeli@baylibre.com, sterzik@ti.com, u-kumar1@ti.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Wed, May 3, 2023 at 1:37=E2=80=AFPM Esteban Blanc = wrote: > On Fri Apr 21, 2023 at 10:34 AM CEST, Linus Walleij wrote: > > Hi Esteban, > > > > thanks for your patch! > > > > On Fri, Apr 14, 2023 at 12:12=E2=80=AFPM Esteban Blanc wrote: > > > > > TI TPS6594 PMIC has 11 GPIOs which can be used for different > > > functions. > > > > > > This add a pinctrl and pinmux drivers in order to use those functions= . > > > > > > Signed-off-by: Esteban Blanc > > (...) > > > +config PINCTRL_TPS6594 > > > + tristate "Pinctrl and GPIO driver for TI TPS6594 PMIC" > > > + depends on MFD_TPS6594 > > > + default MFD_TPS6594 > > > + select PINMUX > > > + select GPIOLIB > > > > select GPIO_REGMAP > > ? > > > > I think this driver can use the GPIO_REGMAP helper library. > > > > Please look into other drivers using this, such as > > drivers/gpio/gpio-sl28cpld.c > > I had a look at this driver and gpio-regmap.c. I think I understood > what's going on, but I'm not sure how to handle the > gpio_regmap_set_direction case. It is using the same reg_mask_xlate to > determine the register and value to write as gpio_regmap_set or > gpio_regmap_read. The problem is that this PMIC has 1 register per GPIO > for the configuration (GPIOX_CONF registers with a bit for direction), > while the in and out register are used for 8 pins (GPIO_OUT_1, > GPIO_OUT_2 and GPIO_IN_1, GPIO_IN_2). This means that the register and > mask returned by reg_mask_xlate will be erroneous in one or the other > case. > > I noticed that I could override reg_mask_xlate, so I should be able to > "just" match on the base address given as argument to perform a > different computation depending on whether we are using reg_mask_xlate in > a "direction change" or not, but somehow this feels a bit wrong. > > Is this the correct solution? > Am I missing something? This is a question for Michael Walle who wrote gpio-regmap, Michael, what do you say? Yours, Linus Walleij