summaryrefslogtreecommitdiffstats
path: root/include/pm_domain.h
Commit message (Collapse)AuthorAgeFilesLines
* pmdomain: implement pm_genpd_remove/of_genpd_del_provider for cleanupAhmad Fatoum2024-01-221-0/+13
| | | | | | | | | We already have pm_genpd_init/of_genpd_add_provider, but lack functions to deregister them. Port the deregisteration functions over from Linux. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240119162610.1014870-13-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pmdomain: add stub definition for pm_runtime_put_genpdAhmad Fatoum2024-01-221-0/+7
| | | | | | | | | | | | | Putting a runtime PM reference will send a device into runtime suspend once no users remain. We don't do reference counting for users and don't mind power domains remaining enabled as the kernel will enable unused power domains on its own anyway. Thus implement pm_runtime_put_genpd() as empty stub. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240119162610.1014870-12-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pmdomain: add stub definition for dev_pm_domain_detachAhmad Fatoum2024-01-221-0/+6
| | | | | | | | | | | | | Detaching a power domain frees the virtual device if any was allocated and may power down the domain if no users remain. We don't do reference counting for users and don't mind power domains remaining enables as the kernel will enable unused power domains on its own anyway. Thus implement dev_pm_domain_detach() as empty stub. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240119162610.1014870-11-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pmdomain: add support for enabling power domains later onAhmad Fatoum2024-01-221-1/+7
| | | | | | | | | | | | | | | When a single power domain is specified platform driver probe takes care to enable the power domain. When there are multiple power domains however, each Linux driver must itself enable power domains in the correct sequence. In Linux, this is handled by runtime PM. We don't have that in barebox, so we add the enable function with a _genpd suffix to alert users to this fact. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240119162610.1014870-9-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pmdomain: implement dev_pm_domain_attach_by_id/nameAhmad Fatoum2024-01-221-0/+68
| | | | | | | | | | | | | | In Linux, dev_pm_domain_attach() enables a device's sole power domain, but dev_pm_domain_attach_by_id/name(), attaches the power domain to a virtual device and returns it for use with runtime PM API. Import these two functions into barebox, so drivers can use them to implement more elaborate power up sequences. The power up operation itself follows in a follow-up commit. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240119162610.1014870-8-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pmdomain: associate devices with their power domainAhmad Fatoum2024-01-221-0/+4
| | | | | | | | | | | | | | | | | | | In Linux, there is no public consumer API to enable or disable a struct generic_pm_domain. Operations are instead performed on regular struct device, each of which has a reference to a single attached power domain. Power domain consumer API in barebox was so far limited to automatically attaching a single power domain and powering it on prior to function probe, which is never detached and thus no further consumer API is needed. To support more complex power domain setups, we adopt here the kernel API of attaching power domains to devices to enable using struct device as handles for additional power domain operations. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240119162610.1014870-5-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pmdomain: use single implementation for dev_pm_domain_attachAhmad Fatoum2024-01-221-29/+24
| | | | | | | | | | genpd_dev_pm_attach already has a stub definition when !CONFIG_PM_GENERIC_DOMAINS, so we can just call it unconditionally from dev_pm_domain_attach. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240119162610.1014870-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2023-11-271-0/+3
|\
| * include: pm_domain.h: make header self-containedAhmad Fatoum2023-11-211-0/+3
| | | | | | | | | | | | | | | | | | | | pm_domain.h so far included no headers and only worked, because it was included in a "correct" order in other files. Fix this by including the header it depends on. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231109121108.1475657-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | pm_domain: Add onecell supportSascha Hauer2023-11-031-0/+9
|/ | | | | | | | | So far we only have simple translation support. Add support for onecell translation taken straight from Linux. This is needed for upcoming TI K3 support. Link: https://lore.barebox.org/20230803105003.4088205-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pm_domains: Enable explicitly when we have power-domain providersSascha Hauer2023-03-071-0/+6
| | | | | | | | | | | | | | | | | | Many SoCs provide power-domains in their device trees. In barebox we most of the time do not have drivers for the power-domains. This is no problem for most of the time as the necessary power domains are either default on or enabled during early SoC init. With multi-arch support it can happen that we compile in SoCs for which we do not have power-domain drivers and other SoCs where we need a power-domain driver. The example I stumbled upon is the i.MX7 on the one hand which has a driver and OMAP on the other hand which has power-domains described in the device tree for which we do not have (and do not currently need) a driver. To be able to handle both situations let's enable pm_domain support explicitly on SoCs we know we have a driver for. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct device_d to deviceSascha Hauer2023-01-101-4/+4
| | | | | | | | | | | | | The '_d' suffix was originally introduced in case we want to import Linux struct device as a separate struct into barebox. Over time it became clear that this won't happen, instead barebox struct device_d is basically the same as Linux struct device. Rename the struct name accordingly to make porting Linux code easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: add pm_domain for listing power domainsAhmad Fatoum2022-09-131-0/+2
| | | | | | | | | | Like the regulator command, this new pm_domain command gives an easy way for listing registered power domains and whether barebox had them activated. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220905070448.539531-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: add SPDX-License-IdentifierAhmad Fatoum2022-01-051-1/+3
| | | | | | | | | All these files lack a license statement, so add the default GPL-2.0-only. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220103120539.1730644-7-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: base: Port power management code from LinuxAndrey Smirnov2019-01-181-0/+82
Port an extremely abridged version of power management/power domain code from Linux as a dependency of i.MX7D PCIe work. Currenlty only bare minimum of functionality is implemented. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>