netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: "Kalle Valo" <kvalo@kernel.org>,
	"David S . Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Bjorn Andersson" <andersson@kernel.org>,
	"Konrad Dybcio" <konrad.dybcio@linaro.org>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Will Deacon" <will@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Heiko Stuebner" <heiko@sntech.de>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Chris Morgan" <macromorgan@hotmail.com>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Neil Armstrong" <neil.armstrong@linaro.org>,
	"Nícolas F . R . A . Prado" <nfraprado@collabora.com>,
	"Marek Szyprowski" <m.szyprowski@samsung.com>,
	"Peng Fan" <peng.fan@nxp.com>,
	"Robert Richter" <rrichter@amd.com>,
	"Dan Williams" <dan.j.williams@intel.com>,
	"Jonathan Cameron" <Jonathan.Cameron@huawei.com>,
	"Terry Bowman" <terry.bowman@amd.com>,
	"Lukas Wunner" <lukas@wunner.de>,
	"Huacai Chen" <chenhuacai@kernel.org>,
	"Alex Elder" <elder@linaro.org>,
	"Srini Kandagatla" <srinivas.kandagatla@linaro.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Abel Vesa" <abel.vesa@linaro.org>,
	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" <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH 0/9] PCI: introduce the concept of power sequencing of PCIe devices
Date: Fri, 19 Jan 2024 12:52:00 +0100	[thread overview]
Message-ID: <CAMRc=McUZh0jhjMW7H6aVKbw29WMCQ3wdkVAz=yOZVK5wc45OA@mail.gmail.com> (raw)
In-Reply-To: <CAA8EJpqyK=pkjEofWV595tp29vjkCeWKYr-KOJh_hBiBbkVBew@mail.gmail.com>

On Thu, Jan 18, 2024 at 7:53 PM Dmitry Baryshkov
<dmitry.baryshkov@linaro.org> 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:
>
>
> ===== CUT HERE =====
> /**
>  * cnss_select_pinctrl_enable - select WLAN_GPIO for Active pinctrl status
>  * @plat_priv: Platform private data structure pointer
>  *
>  * For QCA6490, PMU requires minimum 100ms delay between BT_EN_GPIO off and
>  * 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)
> ===== CUT HERE =====
>
>
> 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 = 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 = pwrseq_power_on(pwrseq);

or

ret = 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]

  reply	other threads:[~2024-01-19 11:52 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-17 16:07 [PATCH 0/9] PCI: introduce the concept of power sequencing of PCIe devices Bartosz Golaszewski
2024-01-17 16:07 ` [PATCH 1/9] arm64: dts: qcom: qrb5165-rb5: describe the WLAN module of QCA6390 Bartosz Golaszewski
2024-01-17 16:07 ` [PATCH 2/9] arm64: dts: qcom: sm8550-qrd: add Wifi nodes Bartosz Golaszewski
2024-01-17 16:07 ` [PATCH 3/9] arm64: dts: qcom: sm8650-qrd: " Bartosz Golaszewski
2024-01-17 16:07 ` [PATCH 4/9] PCI: create platform devices for child OF nodes of the port node Bartosz Golaszewski
2024-01-17 16:22   ` Dan Williams
2024-01-18 13:11     ` Bartosz Golaszewski
2024-01-17 16:45   ` Greg Kroah-Hartman
2024-01-18 10:58     ` Bartosz Golaszewski
2024-01-18 11:15       ` Greg Kroah-Hartman
2024-01-30 21:54         ` Bjorn Andersson
2024-01-31 11:04           ` Bartosz Golaszewski
2024-02-02  0:03             ` Bjorn Andersson
2024-02-02  4:50               ` Jeff Johnson
2024-02-02 10:02               ` Re: " Bartosz Golaszewski
2024-02-07 16:32                 ` Bartosz Golaszewski
2024-02-14 15:34                   ` Greg Kroah-Hartman
2024-01-17 16:07 ` [PATCH 5/9] PCI: hold the rescan mutex when scanning for the first time Bartosz Golaszewski
2024-01-17 16:07 ` [PATCH 6/9] PCI/pwrseq: add pwrseq core code Bartosz Golaszewski
2024-01-17 16:07 ` [PATCH 7/9] dt-bindings: wireless: ath11k: describe QCA6390 Bartosz Golaszewski
2024-01-17 16:07 ` [PATCH 8/9] dt-bindings: wireless: ath11k: describe WCN7850 Bartosz Golaszewski
2024-01-17 18:07   ` Kalle Valo
2024-01-17 20:01     ` Bartosz Golaszewski
2024-01-17 16:07 ` [PATCH 9/9] PCI/pwrseq: add a pwrseq driver for QCA6390 Bartosz Golaszewski
2024-01-18  5:49   ` Kalle Valo
2024-01-18 17:50   ` Konrad Dybcio
2024-01-17 17:53 ` [PATCH 0/9] PCI: introduce the concept of power sequencing of PCIe devices Neil Armstrong
2024-01-17 18:16 ` Dmitry Baryshkov
2024-01-18 18:53   ` Dmitry Baryshkov
2024-01-19 11:52     ` Bartosz Golaszewski [this message]
2024-01-19 12:31       ` Dmitry Baryshkov
2024-01-19 13:35         ` brgl
2024-01-19 14:07           ` Dmitry Baryshkov
2024-01-19 14:11             ` Bartosz Golaszewski
2024-01-19 14:48               ` Bartosz Golaszewski
2024-01-19 16:34       ` Lukas Wunner
2024-01-19 16:45         ` Rob Herring
2024-01-18 14:29 ` Rob Herring
2024-01-18 16:38   ` Bartosz Golaszewski
2024-01-18 16:47   ` Manivannan Sadhasivam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMRc=McUZh0jhjMW7H6aVKbw29WMCQ3wdkVAz=yOZVK5wc45OA@mail.gmail.com' \
    --to=brgl@bgdev.pl \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=abel.vesa@linaro.org \
    --cc=andersson@kernel.org \
    --cc=arnd@arndb.de \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=bhelgaas@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=chenhuacai@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=edumazet@google.com \
    --cc=elder@linaro.org \
    --cc=geert+renesas@glider.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=heiko@sntech.de \
    --cc=jernej.skrabec@gmail.com \
    --cc=konrad.dybcio@linaro.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kuba@kernel.org \
    --cc=kvalo@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=m.szyprowski@samsung.com \
    --cc=macromorgan@hotmail.com \
    --cc=neil.armstrong@linaro.org \
    --cc=netdev@vger.kernel.org \
    --cc=nfraprado@collabora.com \
    --cc=pabeni@redhat.com \
    --cc=peng.fan@nxp.com \
    --cc=robh+dt@kernel.org \
    --cc=rrichter@amd.com \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=terry.bowman@amd.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).