Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2682200rdb; Mon, 12 Feb 2024 12:48:16 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWCnbCHfQzNXkfnPKtyDn43oiO/D/JqiWwDW40+rQy57G3ltpC4qvqTupg4tGMKO9SsrTGFU6LUytTPktpVCkmxCvb+a6cxZRoaRm7qVQ== X-Google-Smtp-Source: AGHT+IFWpqSmeEjSeMqBke6c//bJxvYWyJAv9DM0RWG/Jswglh1v65Jt8P49EW0xQEme+cTWYx9Z X-Received: by 2002:a05:620a:2907:b0:787:19d6:73a7 with SMTP id m7-20020a05620a290700b0078719d673a7mr319136qkp.10.1707770896149; Mon, 12 Feb 2024 12:48:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707770896; cv=pass; d=google.com; s=arc-20160816; b=ddfRvyhuYHNndHAhvgbdVcJnolKnIWnlTZjtkSdv3f9822IR6D3etxSCfAZcNjARMd zpUs68sABoRN2hB2bneTHAIkHsmyt+/puyg7UfgKqOf3+kX/nOfqLyQgKxRCNYlymfIJ mVbnbXamoAXdGZfWzWbZMzYth/SVz8E1dnn9jZaYppn4qbWn8uzr/1jgai1G04645LCO lVXGyiJ49OocWdRfhrxfNiXC8Ne4GuDTre22nHY4jTt34N7rXubFbQBUHzpRv4sbFpa3 2sXjepF4MAgJYhxUIv2R2q4/713/Hb439e/8XWOaVQP0HsZDUBI7kI3OwNYbjGoS9D9r l6xA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=PY3cqSsBwNpTxKZXjc6hWsn0tIs/KUkTAVHRiL48yE4=; fh=RiIEFmigSYepVdg1fkBMdMVfFyBLRHYk8W4i1HMRIxA=; b=djjsyhWQfTFXEc796Eu1JcrHgQ/IaINNMoWxExeush1egTEXSQbVu8mvOsfFVHhIDa JUc5eaCnMLRucM5HuqtcEeGfm8yw7qYKHf/nemeU0l1+pVVe+rIxG2DJ5tOHpI5euQ+z lMvgdv0ESUwZf0jHxVmEzGwDhforaywvjDAhWO4T1pKqu+uNCOcV6IP/Ha+9gKS9+VE5 H6csv79zj2x0QOs2p20palvafCfjBrIFb8Ea432rco96fmC2Du6oZgISK0fSvjsu8di4 mnJvPrqJF40shPRN9cKTAX2qJCZbb39A91MhwwA+UXwchWhepe+1Fy0O1WAyU0oruPdq yrMA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a+Yb7tEC; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-62354-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62354-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=2; AJvYcCWxAdVHLY+oTrYqUQYwzOUDAEsMtd7uPvl1gLk+Mbx+uIG7Lx9w29iOBE2I2fv3FWX2WU1Oqd10ZwnbHhH3Of8tMFj5rbp/Zm7IvVGOiw== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a14-20020a05620a16ce00b00785d67f6b22si3101877qkn.168.2024.02.12.12.48.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 12:48:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62354-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a+Yb7tEC; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-62354-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62354-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D31FF1C21E49 for ; Mon, 12 Feb 2024 20:48:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 474424B5CD; Mon, 12 Feb 2024 20:48:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="a+Yb7tEC" Received: from mail-yb1-f169.google.com (mail-yb1-f169.google.com [209.85.219.169]) (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 E7E3E1EA78 for ; Mon, 12 Feb 2024 20:48:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707770884; cv=none; b=BTgWcNKiCmEktW0d4Vx18MANTwZm7ngbHeuyn1NU8GZOAvSpTQd2h1WPpsKMzfo8qO8PARN4ufCvFWgpIZik+8ySC4nvUnfMvk1kYv/4jr5F0naRbwsrXNY1fjTrw4gofzG5ajGVXWwMboVklWy0EKZ6l1X+zH0lKe3CpZt0ndg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707770884; c=relaxed/simple; bh=sMYBJYjLm8YsiiGaWfwhHa/Xio+UaZ439FcuhwQ9JVg=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=NXFg4CVUrWMPww/CPgSGUpbvZsDfjlYWAa24Kg/SUOhlo0u5HGsKNzw9wiWkqIImWjy2YrU//tcjBI+n2/p9+QXhFkBBuJb0Sp9+mv0byoup3OAT8MD+1XH0K/Jsd4C45AQAf3gPh781jdFOAyvFip2QUvCJVUR0P8WmHGYDSSs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=a+Yb7tEC; arc=none smtp.client-ip=209.85.219.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yb1-f169.google.com with SMTP id 3f1490d57ef6-dc6d24737d7so3318796276.0 for ; Mon, 12 Feb 2024 12:48:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707770881; x=1708375681; 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=PY3cqSsBwNpTxKZXjc6hWsn0tIs/KUkTAVHRiL48yE4=; b=a+Yb7tECEsxUlJG9pZBQ4yYsQJfwSb8/Dp7q9QQg/oUfwoRoVm7+sAHVAPASxRcUO4 jnfIjeb/hO2y3ZxtQZUcFVB7T9nv0p3SHMmAhI4++ZlDRp4Lf2/JBYBt1sn27BXWHRIH //eg1gydfBzXBgUcScNBllJ9VXAceIq+IJG0miyzlR85sSSl7F9NtMmmRt3J2rfKTzvs ErPJtzQLXWAWNN2di9UwfCUoudZO2FTHZ8g9RZjQfHRk0KGFcLRhOnX9Gpvc44YfZhAg nAJ+CzzXA/N45fz67vDcWlUGXrHxlsL2xzsrtTHkQKMMtrm84syYBNZKJV4HiiPhyOtS rUew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707770881; x=1708375681; 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=PY3cqSsBwNpTxKZXjc6hWsn0tIs/KUkTAVHRiL48yE4=; b=ZPm1kZaIuBMzs1mstXe5LoB7i8uIcIiRonSJ+frnPyAgeHstanaduUxLjPmeuNOV8n eZg8EKKO7y376LuMmieyg7C73e5MOfVp1Z7h1aCgm2coZ544srcJaR8zMP1GBGh+lmL3 CPXoNNCeQ3i59oRF8/optMIF7gr7OAoH6uWCXsfFDqn7Qi8b2LVt96bN5aPehQ7jBNmX 9r4koVZxpzZ3lNAjVntpNj8Uzec6AfDlS9oN4u2P1K9qkTUiq2OgpBd1aONS1v91Owhn MMmBCOREHtPlsyNFuVJlP8ejEgTMe2KU7zCbqzmMP3MpHNtD1g+9g1h2THGHznyiTzhx 9sbA== X-Forwarded-Encrypted: i=1; AJvYcCVtoBolulmQGIIxY/lTBgP1VwPkF37uC+YNa0WbEIa0Fmg9GXPgUWKmGrzj9YYSeD+zqwfQvJE6ZhdbP69tKCm3H8H0HyPYqxWdkddG X-Gm-Message-State: AOJu0YxPBibAkFSPfKh8E8pDsDDbadkmmMDeS1Cdci69PR0ySAGm9p1k SawAb1JMiJ2tdULDY8wn3Hxc71wzXRI5qA46C/8Vms12UHmoLnzVeDA9w5iLTIn13SuIa0PlLkD bUOcpoigTGSXW5jtoTyTJZ0I0iDGVJW9hDOZh1A== X-Received: by 2002:a25:ad82:0:b0:dc2:2f4f:757 with SMTP id z2-20020a25ad82000000b00dc22f4f0757mr6478822ybi.7.1707770880839; Mon, 12 Feb 2024 12:48:00 -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: <20240129115216.96479-5-krzysztof.kozlowski@linaro.org> From: Linus Walleij Date: Mon, 12 Feb 2024 21:47:49 +0100 Message-ID: Subject: Re: [PATCH v6 4/6] reset: Instantiate reset GPIO controller for shared reset-gpios To: Krzysztof Kozlowski Cc: 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, Bartosz Golaszewski , Chris Packham , Sean Anderson Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 of > 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 thi= nk regulators should be able to reuse the code, but unfortunately only the day 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