Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2137405rwb; Thu, 17 Nov 2022 07:03:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf5240PwYHMRqjk7BAZLA5Kdb3WKTPKNExT+NtUWPjTlkaBM0R0jMQIdoz1KJniG3c0ZPWAn X-Received: by 2002:a17:907:3ac5:b0:78d:5d4a:c12f with SMTP id fi5-20020a1709073ac500b0078d5d4ac12fmr2558754ejc.421.1668697430546; Thu, 17 Nov 2022 07:03:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668697430; cv=none; d=google.com; s=arc-20160816; b=ZJYRHSrKa+5/+KPyaQCBOTpfbj5pxAznu/8RwoM1O505KGNRXIgVT0xMe91sgs4OTu PsmqgIatz05EpKNtIL8uMzd/WmaR2HBNlFkx8gAByR/2GPLR+fZ3tgRMrmhycbH/TxsV 4HFp+xKoxAeYeaGUE3UkJaaDleiX9LKFpJfdY33Z9oZ72cvAv2v8GrsdMNkR6DlwS9eo kjBuFfuVTQPhhY56pmBWHcs9cIQv+OubHDlA8uW4Mb/CibEkGPVKSx7/nzftWrs/dsup kjVZQ3Onobb+hLR/UuyynEuOZwKySKccKDnNnNdxNXLgSp6iekQRHNXsjhKvfO7cUDGM P99Q== 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:from:date:dkim-signature; bh=XwTck/ecNhkid0iaJxj8dCkVWjNa9jLvmWZcqTf2HEY=; b=pEvi+VWzsoZs5ce/sb+SzWEEFhfyFw4UyD/SHzz5vbyzLstIEc//7d21BhBi5l+Orf uzOGtUPYXB8wCTCAEHVZtNN1EIlhjdlSAYNqNiVh90cyCoebyCnK1r5og7nhn64prGt8 YSCc+Zufnc4WO8mE6vdAel99ngu3Rai3b35yfYtiQxzJhAFsk8PRscbRx3Mu/s9AQdNy IilM9qeeQnhoR6X94lRZ/+Rxrbp2Bum6kj2pBcQR/dYeLOWa3ofpi0doARpUjiuqae1+ XwoGBanEHOTGBG6BuoyXjQbCXjx4poOXDlilBdnmls2bE81L8AJ4tqRTv+I3mi3beH6J wrcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TofIAUcU; 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 xf9-20020a17090731c900b007aeb99bbbc5si591920ejb.566.2022.11.17.07.03.06; Thu, 17 Nov 2022 07:03:50 -0800 (PST) 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=TofIAUcU; 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 S240030AbiKQOYD (ORCPT + 93 others); Thu, 17 Nov 2022 09:24:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240024AbiKQOYA (ORCPT ); Thu, 17 Nov 2022 09:24:00 -0500 Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52ED41D30E for ; Thu, 17 Nov 2022 06:23:59 -0800 (PST) Received: by mail-qt1-x831.google.com with SMTP id w4so1163249qts.0 for ; Thu, 17 Nov 2022 06:23:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=XwTck/ecNhkid0iaJxj8dCkVWjNa9jLvmWZcqTf2HEY=; b=TofIAUcUgNXdKkRlLpXAHp8LPOT+KnI3SNxuveYWvBTs6tRG9zxznjhaG2E7m2VMv3 82jxzeTw6haC8iWyHY4JKqEZAXouquoN8TTFCJIgKd0d6UUzGEptPxRLjrg6KXxGNR2w murjBhrirP64xXtZVcfHKlVhh5Td4BPvP61Ri4IPnEo3rrcEFnmr8dzp9Y3rXM5DsbjL cyvdDaLTYt/KwCvRorUY98pNdUqFz/pwBQTNa6TXZwKx4T2dPSblqWtCbJznGaCm4mQA +hsDXCfEm9hy9oEg+09mtgkWC6h/eMmJVN7jFodZBQRn0d3FbwVDKDvxy6pwBsOQUSOp IwUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=XwTck/ecNhkid0iaJxj8dCkVWjNa9jLvmWZcqTf2HEY=; b=EDAne1FDjGK0eTnVKFhTY/iQN6+hzPWlpYzHp/tEBLcQhaxGt3S7Qwo2butq97+g9Y kkJjI+tzXZ4TaCTcQDU/2FEN68a5gX7eyUnrwJvpUMTCxui54QLcKL8c7j51w+Fr73SJ zB8ino/v5wpB2DKbYZQkTeEKgtew8GpYGCY0PYPfAiRBBTioyq/iDX/UCPR6xFqskJD1 ED03gX2WfoDKUcxu07M1Igmsnwqvvzs0359xikhMcou7v6oTCa78pQ12uUm2n7v5lKSn /Ex1ARh6uv7OJh2yTBGYEdNlh0uinnMIZovZK+QjYzDAzhrJGrSiVym4FEcR9OXHG/yI uL/Q== X-Gm-Message-State: ANoB5pniS+uE4nRU5/7lV+ppF/vS4sW4useqUxNbroGJ6aP5091MZTzP DbufeS09/bo5ClKQmP1++xOfgg== X-Received: by 2002:ac8:5441:0:b0:3a5:50ba:b20c with SMTP id d1-20020ac85441000000b003a550bab20cmr2336722qtq.588.1668695038409; Thu, 17 Nov 2022 06:23:58 -0800 (PST) Received: from fedora (69-109-179-158.lightspeed.dybhfl.sbcglobal.net. [69.109.179.158]) by smtp.gmail.com with ESMTPSA id y19-20020a05620a44d300b006bbf85cad0fsm574376qkp.20.2022.11.17.06.23.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 06:23:57 -0800 (PST) Date: Thu, 17 Nov 2022 09:22:31 -0500 From: William Breathitt Gray To: Michael Walle Cc: Andy Shevchenko , robert.marko@sartura.hr, linus.walleij@linaro.org, brgl@bgdev.pl, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, broonie@kernel.org Subject: Re: [PATCH v2 1/4] gpio: regmap: Always set gpio_chip get_direction Message-ID: References: <1805d1ddb5bbce8e86164e66421ddde481cce4f9.1668129763.git.william.gray@linaro.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="enTNzqmh6/WJTuPZ" Content-Disposition: inline In-Reply-To: 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 autolearn=unavailable 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 --enTNzqmh6/WJTuPZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 16, 2022 at 04:41:30PM +0100, Michael Walle wrote: > Am 2022-11-13 14:21, schrieb William Breathitt Gray: > > On Sun, Nov 13, 2022 at 02:40:17PM +0200, Andy Shevchenko wrote: > > > On Thu, Nov 10, 2022 at 08:55:50PM -0500, William Breathitt Gray > > > wrote: > > > > If you only have reg_dat_base set, then it is input-only; if you on= ly > > > > have reg_set_base set, then it is output-only. Thus, we can always = set > > > > gpio_chip get_direction to gpio_regmap_get_direction and return > > > > GPIO_LINE_DIRECTION_IN/GPIO_LINE_DIRECTION_OUT given the respective > > > > register base addresses configuration. > > >=20 > > > Seems legit to me. Have you checked if we have any gpio-regmap > > > drivers that > > > have something like this in their configuration already? In such > > > cases we need > > > to be sure they behave as expected. > > >=20 > > > From the code perspective: > > > Reviewed-by: Andy Shevchenko > >=20 > > I see gpio-sl28cpld has two device types SL28CPLD_GPO (output-only) and > > SL28CPLD_GPI (input-only); gpio-tn48m similarly has two device types > > TN48M_GPO (output-only) and TN48M_GPI (input-only). It doesn't look like > > the change in this patch will cause problems for them, but I'll let > > Michael Walle and Robert Marko comment if they see issues here. >=20 > For the sl28cpld driver this shouldn't be a problem. So for that > Acked-by: Michael Walle >=20 > But back when I wrote gpio-regmap the bgpio served as a blue print. > There is the same handling. If you look at gpiolib-sysfs.c there > is a comment about the direction property: >=20 > * MAY BE OMITTED if kernel won't allow direction changes >=20 > So from a gpiolib/sysfs POV I'm not sure about this change. Does > get_direction =3D=3D NULL means setting the direction isn't possible? > OTHO there is a fat "MAY" :) >=20 > Which brings me to the question of "why this change?". The commit > message doesn't mention it. Just out of curiosity. >=20 > -michael Currently, the 104-idi-48 module implements a get_direction() callback that is executed in situations such as gpiod_get_direction() which aren't necessarily related to sysfs. In this patch series, the 104-idi-48 module is migrated to the gpio_regmap API, but loses this get_direction() support because it's an input-only configuration. The purpose of this patch is to prevent that regression by supporting get_direction() for input-only/output-only configurations. William Breathitt Gray --enTNzqmh6/WJTuPZ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQSNN83d4NIlKPjon7a1SFbKvhIjKwUCY3ZDpwAKCRC1SFbKvhIj K+zwAP91upqRhQV1dEM30LJyPIHO0ZHSXcyFgPN/PzNpEzV9cAEAvGvb9qHtmdAk xs3ibm0MRBsHFvbknnITdjEwBm27pg8= =/k59 -----END PGP SIGNATURE----- --enTNzqmh6/WJTuPZ--