Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1543692rdb; Wed, 31 Jan 2024 01:38:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IEp0n5jjoAeaN7D0ayNpg60AypjM6MlMkqiiK2woHiFsD3gqKjexnb2stLsZV6JV1xyWjuN X-Received: by 2002:a05:6402:22ac:b0:55e:f9c4:352d with SMTP id cx12-20020a05640222ac00b0055ef9c4352dmr701530edb.28.1706693926338; Wed, 31 Jan 2024 01:38:46 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXgU7cQn753TE1q40VviihHzx0FqHWU0T9KKidcDMzaFrr2fI/nJEgiI5Cup/0w+hkd0kwtUv2OM0G5sM0uhRyl2sbLXx7e92gddso8Og== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ij12-20020a056402158c00b0055cd3f3153csi5380529edb.16.2024.01.31.01.38.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 01:38:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46148-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=xBkCE3xf; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-46148-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46148-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4BFD81F2C6D4 for ; Wed, 31 Jan 2024 09:38:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7BF0B69D00; Wed, 31 Jan 2024 09:37:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="xBkCE3xf" Received: from mail-vk1-f173.google.com (mail-vk1-f173.google.com [209.85.221.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA91467E86 for ; Wed, 31 Jan 2024 09:37:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706693864; cv=none; b=So2graLUdxX6qI/7Nbwq6G+ZjPT8Q4vuoqfghbGHzAsuPIdihWHj3nm70V+xwycpwO/EtmrdTaQTsPkWG8052uagTsPLwOCMBzXywnILcyl921cDDDJgG8iFGOsIlWPp1bAd69XvR/dmOaKShsTgmk0c3ATyUA19GRFaEqSEdj0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706693864; c=relaxed/simple; bh=6g/9wBTl6BPCWec9Q4PfBb1jAfx/QsrhO21o+nVjTVw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=XVnb0GTGJCrhD9SVCR7ps5njoEwhwgzZOviuNb0G+JccYLIqreVafip2VO1528miIoOFRzcVWgzGWg9cX3z4CboWjncdZvWDHhU14j1IXOVjKshbOuJDmP7Y9tRzUsmzmLpqE+9pbCzUdjTa85k76m1NCqGsxJFz1rMNwh99uMw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=xBkCE3xf; arc=none smtp.client-ip=209.85.221.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Received: by mail-vk1-f173.google.com with SMTP id 71dfb90a1353d-4bd91d89fbeso1391829e0c.2 for ; Wed, 31 Jan 2024 01:37:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1706693861; x=1707298661; darn=vger.kernel.org; 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=DmHeh0AnnU8R6/8VaEZIi+vqbQkcVNAn6pqy7RHvRQI=; b=xBkCE3xfgEp8qPGMcW2d28LiFylg+yIZOldTOmpHe5lUFK6l5+DI497ZIMUvKHvR3j 5vOhoZK9QoLFDxfTn4kYxFh/FX3o8o25S/D6Sv8wZeP18QQPnyWKphT1Bh7/ezCzu4Wr s95RpLWANK4vYXBZrbepdIn0wldP0HdC2BxO0HdJ+8ZawP2n58lqMjREM5faykWBjJ45 EtBMY2xpQgjmRDSFw9hHxeb8YH3+3DWp7ciglNRhkeikLvefwq2ngMcoIKg2ocnq/ql2 RL8HFjKkqdVJR+bPWl1Add/iTs6kyaHX4qQGGvRX+gUYzPDz0BBz9JoiBd75cdYvLfG+ ZdBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706693861; x=1707298661; 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=DmHeh0AnnU8R6/8VaEZIi+vqbQkcVNAn6pqy7RHvRQI=; b=mwAuWKThEQfRwUWQQ53hGN3F8G6zQFlmmeBhgk8mss/msbZGdYzGP8mXCGUHQDKR9w bNBYPMn7uNQtjR6uoPFJJI1iu77tjCB8ZROFtZylFtowBMRByNagi9WYp858NHAHPxEs HHrgiZaAc9H5bqNy+xgM8u7Teql3KfJd+FRtEOuziUQ6cGyla8GPlENlScfw0T49htCq xADldZD+QP+E1Ms58x/PKR4xXpEBnXHSlW2/KXZq/lRMgvLwSC2Xw3rKFkJP8MrVQBLR JtgTvFyhuigym4USWGRLA0paTSEuBn4lfKnaDSkIlrbF6s18NlMldhKVQaQ1Vtqp9wAn vVSw== X-Gm-Message-State: AOJu0YwX9o/yKVjr6HJxY3TkZK7P0LmVVjkUkxnwTZkv9wdU3+g/lHsi nePSCYAMS1pnYu/V9MakbPmlnQ1LS9qnVOYNfOcSy15OwWNWHwX4vp84+otkTaqQQqha8LPT50a GZsAca9tI3O+h6WCxBIm6N2uYp0mHQ4v0DRJpVw== X-Received: by 2002:a05:6122:4693:b0:4bf:dbbd:37aa with SMTP id di19-20020a056122469300b004bfdbbd37aamr937831vkb.15.1706693860441; Wed, 31 Jan 2024 01:37:40 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240129115216.96479-1-krzysztof.kozlowski@linaro.org> <20240129115216.96479-5-krzysztof.kozlowski@linaro.org> In-Reply-To: From: Bartosz Golaszewski Date: Wed, 31 Jan 2024 10:37:29 +0100 Message-ID: Subject: Re: [PATCH v6 4/6] reset: Instantiate reset GPIO controller for shared reset-gpios To: Linus Walleij Cc: Krzysztof Kozlowski , Geert Uytterhoeven , Srinivas Kandagatla , Banajit Goswami , Bjorn Andersson , Konrad Dybcio , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , "Rafael J. Wysocki" , Viresh Kumar , Frank Rowand , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Chris Packham , Sean Anderson Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jan 31, 2024 at 9:57=E2=80=AFAM Linus Walleij wrote: > > Hi Krzysztof, > > something is odd with the addresses on this patch, because neither GPIO > maintainer is on CC nor linux-gpio@vger, and it's such a GPIO-related > patch. We only saw it through side effects making > optional, as required by this patch. > > Please also CC Geert Uytterhoeven, the author of the GPIO aggregator. > > i.e. this: > > 2. !GPIOLIB stub: > > https://lore.kernel.org/all/20240125081601.118051-3-krzysztof.kozlow= ski@linaro.org/ > > On Mon, Jan 29, 2024 at 12:53=E2=80=AFPM Krzysztof Kozlowski > wrote: > > > Devices sharing a reset GPIO could use the reset framework for > > coordinated handling of that shared GPIO line. We have several cases o= f > > such needs, at least for Devicetree-based platforms. > > > > If Devicetree-based device requests a reset line, while "resets" > > Devicetree property is missing but there is a "reset-gpios" one, > > instantiate a new "reset-gpio" platform device which will handle such > > reset line. This allows seamless handling of such shared reset-gpios > > without need of changing Devicetree binding [1]. > > > > To avoid creating multiple "reset-gpio" platform devices, store the > > Devicetree "reset-gpios" GPIO specifiers used for new devices on a > > linked list. Later such Devicetree GPIO specifier (phandle to GPIO > > controller, GPIO number and GPIO flags) is used to check if reset > > controller for given GPIO was already registered. > > > > If two devices have conflicting "reset-gpios" property, e.g. with > > different ACTIVE_xxx flags, this would allow to spawn two separate > > "reset-gpio" devices, where the second would fail probing on busy GPIO > > request. > > > > Link: https://lore.kernel.org/all/YXi5CUCEi7YmNxXM@robh.at.kernel.org/ = [1] > > Cc: Bartosz Golaszewski > > Cc: Chris Packham > > Cc: Sean Anderson > > Reviewed-by: Philipp Zabel > > Signed-off-by: Krzysztof Kozlowski > (...) > > In my naive view, this implements the following: > > reset -> virtual "gpio" -> many physical gpios[0..n] This is a different problem: it supports many users enabling the same GPIO (in Krzysztof's patch it's one but could be more if needed) but - unlike the broken NONEXCLUSIVE GPIOs in GPIOLIB - it counts the number of users and doesn't disable the GPIO for as long as there's at least one. Bart > > So if there was already a way in the kernel to map one GPIO to > many GPIOs, the framework could just use that with a simple > single GPIO? > > See the bindings in: > Documentation/devicetree/bindings/gpio/gpio-delay.yaml > > This is handled by drivers/gpio/gpio-aggregator.c. > > This supports a 1-to-1 map: one GPIO in, one GPIO out, same offset. > So if that is extended to support 1-to-many, this problem is solved. > > Proposed solution: add a single boolean property such as > aggregate-all-gpios; to the gpio-delay node, making it provide > one single gpio at offset 0 on the consumer side, and refuse any > more consumers. > > This will also solve the problem with induced delays on > some GPIO lines as I can see was discussed in the bindings, > the gpio aggregator already supports that, but it would work > fine with a delay being zero as well. > > This avoids all the hackery with driver stubs etc as well. > > Yours, > Linus Walleij