On Fri, Jun 13, 2025 at 10:25 AM Michal Wilczynski <m.wilczyn...@samsung.com> wrote: > > > Why? You have specific compatible for executing such quirks only for > > given platform. > > This is due to how the pwrseq API works; it constructs a bus on which > provider devices may appear at any time. With the current API, there is > no way to express that a provider for a specific target will never > appear. ('gpu-power' is the generic target name, and of course, more > specific binding is handled in the provider's .match callback - based on > the compatible and the node phandle like discussed previously). >
This is by design and also the reason why we don't expose a pwrseq_get_optional(). If the driver calls pwrseq_get() at all then it expects the provider to eventually appear or will fail to initialize. That still doesn't answer the question: why can't you have a callback in your match data which - for this mode only - would call pwrseq_get()/power_on()/power_off()? > For all other supported SoCs, no such provider will ever appear on the > bus, and the current pwrseq API doesn't allow a generic consumer to know > this. > > However, your suggestion of handling this with a platform specific > driver is a good path forward. It would still require a minimal addition > to the pwrseq API to work. For example, a new SoC specific driver for > "thead,th1520" could call a new function like > pwrseq_enable_optional_target("gpu-power") during its probe. This would > signal to the pwrseq core that this target is expected on the platform. > Therefore, when the Imagination driver later calls pwrseq_get() on a > TH1520, it would correctly result in either a match or a deferral. > I don't want to use the word optional. I think what you're thinking of is a kind of "deferred" get where you get a valid handle, use it and then, the provider eventually arrives it will get attached and its state aligned with the current state of all the existing handles. I'm not against it, it sounds quite elegant but there's an issue of error reporting in this case. We'd need a notifier of some kind so that consumers could subscribe and be notified about errors happening behind the scenes. Bart