Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp945489rdb; Fri, 19 Jan 2024 03:52:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IFkgiakOgNaHXOVAupUV682bhzMcEK+892kcVyfSOuROUiKt0njSJZog4ov5oNs/R3Y3kxN X-Received: by 2002:a05:6a20:f39f:b0:19b:1768:f0ef with SMTP id qr31-20020a056a20f39f00b0019b1768f0efmr1796935pzb.111.1705665137058; Fri, 19 Jan 2024 03:52:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705665137; cv=pass; d=google.com; s=arc-20160816; b=FAHTR1oYFKbb2Q1BwpoYDaq/056TBGLHUrI2iaorsqbBvEg1V8IPePrkAoAHEYjK7/ y5KVTnBbmgEfE6qa2EA1vNKMbOhtsUXFaOKFH5o0URHmkb1qQi3GNAX+du0juCAbNdk3 BeGtth7Fqx2ywAQIaYB+wfQuPqLurqraMz8SMGUSTRjG9PLHCMYj4i4CjHQTfOmE/I7U 2pemzohA2Sj+3Ur6OTgAayHqscxc89cjL02mhWghgZOQwqQR8Z7IndzhNOqMOjTqNYSy QLXjguEg+2YRX+mv9xYvzpijKwbSP13T0WnuastXgcdH5ddesJM1KLONH+hNgMXYcYO3 9J/w== 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=scQQNQ5xR79QdIxgg95WyhVE0qz02vfpeEac+jED8n0=; fh=TOK/Hez4s4jMHK3DQotFJZV/WwPUcZz68IVd9TbqDWs=; b=bSVKAWYjv5JSsDWaJ5IDTaUC9iQcs4NEKmv+qZbX8HlkmSr46hHFkU0mpRm8Y5BKTG f2rifOrQM20aN+smFxS4stLW9kbsMylX6EhC9t5rv7FpTUW1ndC3vnb4j7zSHYJbkz6r kaFVeAbHIR9lPovquJMJ3oX7hvR4Kuf1FGXC8lqE0+5f5D+WHMlQArK/cgvhAb3byJxu NhES7cTfkr7Ba8kBqSblIS3r2jVsKQqq2cYSUlh7QZ/KAsp0ufTYNlkNzCFop63hWCbt 5/0ZsWdP3gWdLSx5SJf/RbSUINB89xaUfgXaSM9WvDGRgg3bpGvQrKrhti91KHUbMVig Vy2w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=afNvk1oU; arc=pass (i=1 dkim=pass dkdomain=bgdev-pl.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-wireless+bounces-2248-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2248-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id cz20-20020aa79314000000b006dafc2e3d48si5631881pfb.330.2024.01.19.03.52.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 03:52:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-2248-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=afNvk1oU; arc=pass (i=1 dkim=pass dkdomain=bgdev-pl.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-wireless+bounces-2248-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2248-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A7891285375 for ; Fri, 19 Jan 2024 11:52:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BC3874F1E2; Fri, 19 Jan 2024 11:52:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="afNvk1oU" X-Original-To: linux-wireless@vger.kernel.org Received: from mail-ua1-f54.google.com (mail-ua1-f54.google.com [209.85.222.54]) (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 3AC034C3D2 for ; Fri, 19 Jan 2024 11:52:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705665134; cv=none; b=rK2fdgBALvbK8mscR68HsH+sLBLODwUqQ6mroeSZPMvGz7zffqEql/3N92a8QdFw8YwZVqmV4bjSWbG86+BntMVaQoDRSGV1FWbujMW1NODH2+jJ1vUzfTcyumnRF3f/pWB1SZwdTeiFDaFwe7Oob+2S47tfL4hSGfudQWTxfQA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705665134; c=relaxed/simple; bh=L/Fc06LLs/rGZJoI3sRZIJrlufKv5PaKYitAV+6n9QY=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=JhciuOKORMPC9lvwUaxBEWX5dPx0Mu1r2RJHLSMDWARMgHpB3HqnlZKv71KFDycEcWA92ImBfphHrgOyoXAcofDc1CZYV+Ltf/7Vegxg+Kg3s3WFTNfsJnjMSTH9OqDcfyCXzIbSF7iurTG1SlcPnIc40DeHzMun7dNjvRu5mn4= 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=afNvk1oU; arc=none smtp.client-ip=209.85.222.54 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-ua1-f54.google.com with SMTP id a1e0cc1a2514c-7d2e15193bbso67958241.0 for ; Fri, 19 Jan 2024 03:52:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1705665132; x=1706269932; 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=scQQNQ5xR79QdIxgg95WyhVE0qz02vfpeEac+jED8n0=; b=afNvk1oUnQ19qYmNfiBN0essEgUXat59gy72RjkVeS20wdU1gBqWOrEffQNMb2kswW cMwBoAps3H3BLxBX0r/zfrw6sdlVAkn1ps6YTUpz0hP4VVfXJUyc5mahKpA1BRm9nYyY 7Mx9Rhe/cxicQ4YsF6KI10G1Ezcd+EajAHZBEa/ufPqgbqz/xv1lv4PNdVghiGkjHupm aoIPlV3td+icGePMWUtXF4dj+UjP1icTn+1amOYEfjuDWqaa4vu9yTOTzmsa7AtG5mQ2 9oKvl2+QmQzD6rY0a5ZrU3wmVz/D4Ulctb07VURqpvZZRHr8Lhm3WWEmyS//g9PjQ1CH 1JzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705665132; x=1706269932; 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=scQQNQ5xR79QdIxgg95WyhVE0qz02vfpeEac+jED8n0=; b=RxWwQTOa5qH+JlnrNZmS8bOTqCHLFpKDo4RbOs7uCVZQF8zZE+A5yX35gwpd2ZQyAr tW5BVT9w4t2/cn/8dqONfzjKk7WjUs0Gp8F0YeOeYav7K75aWp1b0mLRejPNCuBrwugU aeslWmyCPsrOlctBDm4RXtZgd5OAbVx9azOtu4tPzc8TKYPnih5OCceCPl6F6GEHcdb0 dkKFvxdnZkKzPO1h9cxfIO+OZnvhl9dAl4WMya1EdK3awyhVTLY3p9VYIJEo7wwD+eUU b4Qj1Z4XMuOtJ45Spfz+KLprkwsIeU9jdRNEO39mrH2AynGOga9L67OTNp9RPwxJurWT Cz5Q== X-Gm-Message-State: AOJu0YzeHnIippLSqGKl6v8Ri2fLCg4z8wqtX0fhGZ0S4ODUazil4IOj Eci95xaclWCNzsj6EMaK3UMk9BvT/F6AwGyHjaI64psWiMjBMWmyQB/lnssuj8E/5vhHgBt7yke 88EEDGTgSjSi4LIGjZy2SAqiorovaxzv4HFC5Tw== X-Received: by 2002:a67:f945:0:b0:468:90e:2c8e with SMTP id u5-20020a67f945000000b00468090e2c8emr1903776vsq.35.1705665132098; Fri, 19 Jan 2024 03:52:12 -0800 (PST) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240117160748.37682-1-brgl@bgdev.pl> In-Reply-To: From: Bartosz Golaszewski Date: Fri, 19 Jan 2024 12:52:00 +0100 Message-ID: Subject: Re: [PATCH 0/9] PCI: introduce the concept of power sequencing of PCIe devices To: Dmitry Baryshkov Cc: Kalle Valo , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio , Catalin Marinas , Will Deacon , Bjorn Helgaas , Heiko Stuebner , Jernej Skrabec , Chris Morgan , Linus Walleij , Geert Uytterhoeven , Arnd Bergmann , Neil Armstrong , =?UTF-8?B?TsOtY29sYXMgRiAuIFIgLiBBIC4gUHJhZG8=?= , Marek Szyprowski , Peng Fan , Robert Richter , Dan Williams , Jonathan Cameron , Terry Bowman , Lukas Wunner , Huacai Chen , Alex Elder , Srini Kandagatla , Greg Kroah-Hartman , Abel Vesa , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jan 18, 2024 at 7:53=E2=80=AFPM Dmitry Baryshkov wrote: > [snip] > > > > I'd still like to see how this can be extended to handle BT power up, > > having a single entity driving both of the BT and WiFI. > > > > The device tree changes behave in exactly the opposite way: they > > define regulators for the WiFi device, while the WiFi is not being > > powered by these regulators. Both WiFi and BT are powered by the PMU, > > which in turn consumes all specified regulators. > > Some additional justification, why I think that this should be > modelled as a single instance instead of two different items. > > This is from msm-5.10 kernel: > > > =3D=3D=3D=3D=3D CUT HERE =3D=3D=3D=3D=3D > /** > * cnss_select_pinctrl_enable - select WLAN_GPIO for Active pinctrl statu= s > * @plat_priv: Platform private data structure pointer > * > * For QCA6490, PMU requires minimum 100ms delay between BT_EN_GPIO off a= nd > * WLAN_EN_GPIO on. This is done to avoid power up issues. > * > * Return: Status of pinctrl select operation. 0 - Success. > */ > static int cnss_select_pinctrl_enable(struct cnss_plat_data *plat_priv) > =3D=3D=3D=3D=3D CUT HERE =3D=3D=3D=3D=3D > > > Also see the bt_configure_gpios() function in the same kernel. > You are talking about a different problem. Unfortunately we're using similar naming here but I don't have a better alternative in mind. We have two separate issues: one is powering-up a PCI device so that it can be detected and the second is dealing with a device that has multiple modules in it which share a power sequence. The two are independent and this series isn't trying to solve the latter. But I am aware of this and so I actually have an idea for a generalized power sequencing framework. Let's call it pwrseq as opposed to pci_pwrseq. Krzysztof is telling me that there cannot be any power sequencing information contained in DT. Also: modelling the PMU in DT would just over complicate stuff for now reason. We'd end up having the PMU node consuming the regulators but it too would need to expose regulators for WLAN and BT or be otherwise referenced by their nodes. So I'm thinking that the DT representation should remain as it is: with separate WLAN and BT nodes consuming resources relevant to their functionality (BT does not need to enable PCIe regulators). Now how to handle the QCA6490 model you brought up? How about pwrseq drivers that would handle the sequence based on compatibles? We'd add a new subsystem at drivers/pwrseq/. Inside there would be: drivers/pwrseq/pwrseq-qca6490.c. The pwrseq framework would expose an API to "sub-drivers" (in this case: BT serdev driver and the qca6490 power sequencing driver). Now the latter goes: struct pwrseq_desc *pwrseq =3D pwrseq_get(dev); And the pwrseq subsystem matches the device's compatible against the correct, *shared* sequence. The BT driver can do the same at any time. The pwrseq driver then gets regulators, GPIOs, clocks etc. and will be responsible for dealing with them. In sub-drivers we now do: ret =3D pwrseq_power_on(pwrseq); or ret =3D pwrseq_power_off(pwrseq); in the sub-device drivers and no longer interact with each regulator on our own. The pwrseq subsystem is now in charge of adding delays etc. That's only an idea and I haven't done any real work yet but I'm throwing it out there for discussion. Bartosz [snip]