On Thu, Jan 18, 2024 at 7:53 PM Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx> 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]