Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp953682rdb; Tue, 23 Jan 2024 23:29:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IEXhoHYU6BD8kGzJ7dDJ1CUbpVw+GcZCF4vB6pZq1eR9YITHWcr2KKOt3hSwAdbyAnFWgC0 X-Received: by 2002:a17:902:a5c5:b0:1d7:2d68:cee9 with SMTP id t5-20020a170902a5c500b001d72d68cee9mr292064plq.27.1706081340283; Tue, 23 Jan 2024 23:29:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706081340; cv=pass; d=google.com; s=arc-20160816; b=FToN1pWy14yIekrbtorBKDErXZMaQhTNBl0VffvCdnE737W9J7jMaBejZKp38cW9fc 8QL/DZ1gaes/O4H15REO+0EhaYI04txc3glYL/c99NrPJ0k6SnxArzl45ictm8LBOpQA UQ/ZrheC5YCgYlciURWUKfmIyHRB6DCFakzZ8EkH/0HSjh1goyARl6pZsgzhcnQF1VIU Dd6SYP5eskH/vM6b+y9RDAvd+D/0Gyrw+akUa8RFIFrafJhSILIzvPrdJkjG7ddw8ydF 4tdrhbp/6Aiuan/nJ+Loo17UKqRTc6uQyWp/fu8x1S2y/UvZKADr7MP48pUnVfcR+DgO Vo3A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=0fLLuHTpgYX/yoJ14ATULSdZd7GfYaqCyS12xdAnKho=; fh=gdfTsId/bReA/dTGaAfVqGjKl+uU/LKFEXG+gGscxek=; b=nRlRS9XCIyQwd0oziXY3Q7RJ1w2FCzAZDa4YDBdQMzkBjcgFMF1S1nlWDmqrt+TM+o CbOVxYyqyuBWUUt3m/SUtc8NppGuc+w2/UP/cMhGwgw4CuuUNFbYNoZFZsdb5lnKY17h Of6fJnbdIIPWaPrFciSswvdj6kOw6DjEO7BTEwxEXTKFeS0cxKYp+RvIk9F2lAIH2lCB BLYJFnSHqZjJsQ0knBYGItK+Yhpg9LNxEAqBat8HIpSuto07xra8+7jzLi4amEtITP0d g1QZKbyzJWXaAYoJuuqzXNJn9agvVAfbBg8aPSrBdQ8qCufT9EZZ0K8v6SQl/jS5Gy7b +mLg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="yF/3lsO8"; 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-36546-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36546-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id c5-20020a170902d48500b001d76a322667si3134164plg.72.2024.01.23.23.29.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 23:29:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36546-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="yF/3lsO8"; 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-36546-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36546-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id E410E288EAC for ; Wed, 24 Jan 2024 07:28:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DE15F168DA; Wed, 24 Jan 2024 07:28:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="yF/3lsO8" Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (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 A200C1642F for ; Wed, 24 Jan 2024 07:28:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706081328; cv=none; b=rI26+JgxalgnnGmrTzVubtbAv2EBeVz9YfYR71CYetGth7Qd9Ni5XmiQuzXN97djLXTIoOYkzomYugw3zBaaL2N/WcK99ZHJ0FdejjJCCD7jJWITqOfkdw/fYiS72ViaMau/jMaM4DgLKOvxAvvtZi221Ar+h3DtHC4mu84A3B0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706081328; c=relaxed/simple; bh=RnFvsZRAgPqC61p7ZiwGeVU7gxwIswOGV30gdQpZ8JM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=d9r9eM0us6mZK5TKXmrt33tOUvVco7OdsEAdtfBRpC/ol2kIKD8T8HlGSBTcD/DMbZmWqi/sqQ0POyJQRBbnw40Beb1PzTR0RjJmoEIKy7QTf08kiH0CR0Xi6aoVq2KFMNpY0VH2eThspJ44q7bDOzok/WpWlmhcTx+zrGoaCnU= 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=yF/3lsO8; arc=none smtp.client-ip=209.85.128.53 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-wm1-f53.google.com with SMTP id 5b1f17b1804b1-40e490c2115so37466795e9.0 for ; Tue, 23 Jan 2024 23:28:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706081324; x=1706686124; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=0fLLuHTpgYX/yoJ14ATULSdZd7GfYaqCyS12xdAnKho=; b=yF/3lsO8kWz73jodljidzvqbGkajrUBb/KF8WZ6SdJFztcQ2VXI5A4BB1qfG7kFmxg xbZqBlsEZKy8cwJ79a9Ps9+Bm+Eu/30sFSyqJCiwLTCwrbd2ZjZbb4yKMhVPD3ECcvg7 ccm9df0m9vJw8hTV53CkxqATdyBqVH8u6U/ywLqao44vua9kPZHvgfCO+hr3q9PiA9+D rRtSKsLTxfELSl7s/kh2LCKiN4hDcdaI63Ph0Hfbauhpw+B8CyLq0L6bmizHaelFl2pB sVTMPyVXa78jycqBsrqZKl6g8QqSc7zZJ+x99PTh7rIHd6fm2MC1kOLTVB7mKh+G167Q 8aWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706081324; x=1706686124; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0fLLuHTpgYX/yoJ14ATULSdZd7GfYaqCyS12xdAnKho=; b=iwgqvQT3qbCFxzM/hVbr2byyIznWYWqNN2CPJGA9CwspLxUhIfbjJN72pRkMYCKc3J XVDLsPrLkgXQNz8TZ/X5LR90wlSDZboz0lI9Oa1CLl0+h3v9MdP3LxWwNGilZijOuagO GdnUfpkYqf0aFegCxuipIwTiuh3szfHFRH7ZqhKHja6f8jKdJfD0crGrIL/puf8bcYnu 0PfnjI43DeYF50l8WSbPayrVR0f84SM1BEIe78sF0VbDn3KDG7Bpif2nvJJOA8Zx6qB6 7N4wvQhr9yxwtSnEmKqWoe6pAy0TOA3+B4rptWkTRn+mz+xKNI82EyvFOUiyxQFTP39s 3bJg== X-Gm-Message-State: AOJu0YxO5llskJECxcr0ckhiUvtaC6OBKWj7UhF0qUUeOvcyTof5+M9X K6vz5L023UwsPQDqfZOlomb1ZovJlyWTtJvxMhkZiyJTCJohIW6OOpP8e4BRlkY= X-Received: by 2002:a05:600c:3155:b0:40e:bf71:f6db with SMTP id h21-20020a05600c315500b0040ebf71f6dbmr359367wmo.17.1706081323896; Tue, 23 Jan 2024 23:28:43 -0800 (PST) Received: from [192.168.1.20] ([178.197.215.66]) by smtp.gmail.com with ESMTPSA id v4-20020a05600c470400b0040e5945307esm45004053wmo.40.2024.01.23.23.28.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Jan 2024 23:28:43 -0800 (PST) Message-ID: <953497b6-b884-49e7-8376-cbece92b1567@linaro.org> Date: Wed, 24 Jan 2024 08:28:40 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 4/6] reset: Instantiate reset GPIO controller for shared reset-gpios Content-Language: en-US To: Philipp Zabel , Bjorn Andersson , Konrad Dybcio , Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , "Rafael J. Wysocki" , Viresh Kumar , Frank Rowand , Jaroslav Kysela , Takashi Iwai , linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: Bartosz Golaszewski , Chris Packham , Sean Anderson References: <20240123141311.220505-1-krzysztof.kozlowski@linaro.org> <20240123141311.220505-5-krzysztof.kozlowski@linaro.org> From: Krzysztof Kozlowski Autocrypt: addr=krzysztof.kozlowski@linaro.org; keydata= xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79 cFgcqTTuNHjAvxtUG8pQgGTHAObYs6xeYJtjUH0ZX6ndJ33FJYf5V3yXqqjcZ30FgHzJCFUu JMp7PSyMPzpUXfU12yfcRYVEMQrmplNZssmYhiTeVicuOOypWugZKVLGNm0IweVCaZ/DJDIH gNbpvVwjcKYrx85m9cBVEBUGaQP6AT7qlVCkrf50v8bofSIyVa2xmubbAwwFA1oxoOusjPIE J3iadrwpFvsZjF5uHAKS+7wHLoW9hVzOnLbX6ajk5Hf8Pb1m+VH/E8bPBNNYKkfTtypTDUCj NYcd27tjnXfG+SDs/EXNUAIRefCyvaRG7oRYF3Ec+2RgQDRnmmjCjoQNbFrJvJkFHlPeHaeS BosGY+XWKydnmsfY7SSnjAzLUGAFhLd/XDVpb1Een2XucPpKvt9ORF+48gy12FA5GduRLhQU vK4tU7ojoem/G23PcowM1CwPurC8sAVsQb9KmwTGh7rVz3ks3w/zfGBy3+WmLg++C2Wct6nM Pd8/6CBVjEWqD06/RjI2AnjIq5fSEH/BIfXXfC68nMp9BZoy3So4ZsbOlBmtAPvMYX6U8VwD TNeBxJu5Ex0Izf1NV9CzC3nNaFUYOY8KfN01X5SExAoVTr09ewARAQABzTRLcnp5c3p0b2Yg S296bG93c2tpIDxrc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GRG KQ06ztUMRrj8eVtpImjsWCd0bDWRaaR4vqhCHvAG9iWXZu4qh3ipie2Y0oSJygcZT7H3UZxq fyYKiqEmRuqsvv6dcbblD8ZLkz1EVZL6djImH5zc5x8qpVxlA0A0i23v5QvN00m6G9NFF0Le D2GYIS41Kv4Isx2dEFh+/Q== In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 23/01/2024 16:06, Philipp Zabel wrote: > On Di, 2024-01-23 at 15:13 +0100, 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 >> Signed-off-by: Krzysztof Kozlowski > > I'm nearly out of complaints, two tiny cosmetic issues remaining: > > [...] >> diff --git a/drivers/reset/core.c b/drivers/reset/core.c >> index 4d5a78d3c085..6e81b8d35055 100644 >> --- a/drivers/reset/core.c >> +++ b/drivers/reset/core.c > [...] >> @@ -813,12 +838,161 @@ static void __reset_control_put_internal(struct reset_control *rstc) >> kref_put(&rstc->refcnt, __reset_control_release); >> } >> >> +static int __reset_add_reset_gpio_lookup(int id, struct device_node *np, >> + unsigned int gpio, >> + unsigned int of_flags) >> +{ >> + unsigned int lookup_flags; >> + const char *label_tmp; >> + >> + /* >> + * Later we map GPIO flags between OF and Linux, however not all >> + * constants from include/dt-bindings/gpio/gpio.h and >> + * include/linux/gpio/machine.h match each other. >> + */ >> + if (of_flags > GPIO_ACTIVE_LOW) { >> + pr_err("reset-gpio code does not support GPIO flags %u for GPIO %u\n", >> + of_flags, gpio); > > Alignment to parenthesis is slightly off. Ack > >> + return -EINVAL; >> + } >> + >> + struct gpio_device *gdev __free(gpio_device_put) = gpio_device_find_by_fwnode(of_fwnode_handle(np)); > > Adding a local fwnode variable would make this fit in the 100 character > limit again. Ack Best regards, Krzysztof