Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2700139rdb; Mon, 12 Feb 2024 13:33:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IEkgUjU7VANBfJZ+51ws+vy1VwCMgD7jKaxTsZoMghGHf6MX3SoC4Nl3py9LQ3EpQSCBOCF X-Received: by 2002:a2e:9d02:0:b0:2d0:cc80:dcad with SMTP id t2-20020a2e9d02000000b002d0cc80dcadmr5417001lji.7.1707773635229; Mon, 12 Feb 2024 13:33:55 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXeIbbwuHP2/STjsa65dD57qqMmzYAGqy7351RlSGZpy0fxtAlDIoTQ6kvBTK6XnzY2BsznOf+TfdrmwoLFDQTGDGQeKz6lVzdazWMFOA== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id m27-20020a50931b000000b005617af69114si2571531eda.500.2024.02.12.13.33.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 13:33:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62399-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=UYkLqjxT; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-62399-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62399-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 C6B0A1F22849 for ; Mon, 12 Feb 2024 21:33:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D8F7B4D9F8; Mon, 12 Feb 2024 21:33:11 +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="UYkLqjxT" Received: from mail-vk1-f179.google.com (mail-vk1-f179.google.com [209.85.221.179]) (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 AFECC4EB4A for ; Mon, 12 Feb 2024 21:33:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707773591; cv=none; b=eblwEUJXatmCOfYmVENYSX6WcYtEnVdvOm48PMhjBuoUL9g/g7g9ZJRWPt80N+nHysHcduqYNR/6sikFlk0munkJdjGeNFSaDXmBiXQdmBKjPgojjvp2PERjs0muO182yXiupckEu9E3QZ8Bd2NpWACvl2xLwHb7sTOBkqpfr8w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707773591; c=relaxed/simple; bh=UccBZcWyRgHb8CdqI4SfdswhlCvqeiofHLzpJGOSCIM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=SwIHUfGsGsPYojLyKGvqeRdFjk5Mk0mwEaCc5XCEA9dJSTkiESTAR0P6otUM9Umo2Eyhihg1SY8iuGlooulqCcHusvmGwhwV2Xp0c222oqgthJc51OsUzjC5mBqvAzPhKTCvwo0MyGb5iC5h2cjNpvStNmsqkf+RDWfGpC8SEGQ= 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=UYkLqjxT; arc=none smtp.client-ip=209.85.221.179 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-f179.google.com with SMTP id 71dfb90a1353d-4c02be905beso741004e0c.0 for ; Mon, 12 Feb 2024 13:33:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1707773587; x=1708378387; 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=FJH2iY95UEJbzAWLAhKcrIml1wV+F91i2EVUBYNcdJo=; b=UYkLqjxT9GoSJnOQq93tXQa+t0FQEHckVJXzZ4Jk2drByJPW6AwZFaxvGLKlhTGEFi fIC2RwbEQumys6l1cZt1ESJw6pvC5N7OCy9a717BecKgaHCOBtBM8jDfYvUDUUxC6hXU CcjdrbpP+U3US/7ljiib3qOQfgLiS+PVQrQWCwwuUm+KWCVEynGTYESjb6Es50mKIkFb VYgQM00Qdwc/ULLhUEa24iTyV5/OXUXrzGqzuo+X7Qi34NUFTec7UZjSEX12Js2XUc0C 1I0MbGz8i740ZFB+MBT4+S4og+EaSnQsTs8gm+jn1dzEi95J6p7mbRtsXInOnTo3ftYp 7Kng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707773587; x=1708378387; 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=FJH2iY95UEJbzAWLAhKcrIml1wV+F91i2EVUBYNcdJo=; b=hmMHFBKI4NlEYB30ZJW2IA2+lNmeVt9rNCnRoNKsD0sjPCLjZ8e1DxTdshIZYnT2LT qWmHffnFKdnBW0oJh/sJcsz+x8rnVg4qysO9PuYE5R2rTV/kBbzpvV8rtiT2qGW/xa7x /+JmbWh7ot83hkWO3yRHESfF0kjcK+wsNYo3BsjSyhYp8h33DqFo6cGU+H/Tjk5wDMYu N0XhuBytyEmOsbp9aSaD62KV6NbSQI9pehiJnuWWcvvYwawBKa7L6HEYXPl2h8dWIER1 6T4VLtq2+gg8RYV+k7OGE7Uw1r0Fwu9GdNxs2KnP1F/9yo0p9v4+mcFouKJU3RNZuR1y pg3Q== X-Gm-Message-State: AOJu0YyQXWBNvFGrfPtfaoDg9UQ+0HePunFOg5NSFEIdzDWAbuxpilD2 3+GGFY532g/lZHajrxfHl+t7gy17MdvLt2rNXlRgSuwvVK6poP7rMfwpyVunmbaEOjqufZVkIsZ lugavmp555mWwrQocQTc0ewvpojict/S+1/pLQQ== X-Received: by 2002:a1f:e7c3:0:b0:4c0:21c4:3a9b with SMTP id e186-20020a1fe7c3000000b004c021c43a9bmr4103383vkh.15.1707773587581; Mon, 12 Feb 2024 13:33:07 -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: Mon, 12 Feb 2024 22:32:56 +0100 Message-ID: Subject: Re: [PATCH v6 4/6] reset: Instantiate reset GPIO controller for shared reset-gpios To: Linus Walleij Cc: Krzysztof Kozlowski , 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 Mon, Feb 12, 2024 at 9:48=E2=80=AFPM Linus Walleij wrote: > > 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 > > Acked-by: Linus Walleij > > I can't think of anything better, that is reasonable to ask for. > > I feel slightly icky about the way the code reaches into gpiolib, and I t= hink As long as it doesn't include gpiolib.h, I'm fine with it. > regulators should be able to reuse the code, but unfortunately only the d= ay > they have no board files left :/ > > I do feel the core code handling "reset-gpios" could as well have been > used to handle "enable-gpios" in regulators, just that the regulator code > has more requirements, and would be really hard to rewrite, and deals > with descriptors passed in from drivers instead of centralizing it. > > Like regulators, reset grows core support for handling GPIO for resets > which is *long due*, given how common it must be. We really need > something like this, and this is certainly elegant enough to do the job. > > Yours, > Linus Walleij Agreed. Acked-by: Bartosz Golaszewski I will pick up the stub patches tomorrow and send a tag for Philipp to pull= . Bartosz