On Fri, Jan 10, 2020 at 7:30 PM Steven Price <steven.price@xxxxxxx> wrote: > > On 09/01/2020 19:49, Mark Brown wrote: > > On Thu, Jan 09, 2020 at 04:53:02PM +0000, Steven Price wrote: > >> On 09/01/2020 16:28, Mark Brown wrote: > >>> On Thu, Jan 09, 2020 at 02:14:42PM +0000, Steven Price wrote: > > > >>>> I'm not sure if it's better, but could we just encode the list of > >>>> regulators into device tree. I'm a bit worried about special casing an > >>>> "sram" regulator given that other platforms might have a similar > >>>> situation but call the second regulator a different name. > > > >>> Obviously the list of regulators bound on a given platform is encoded in > >>> the device tree but you shouldn't really be relying on that to figure > >>> out what to request in the driver - the driver should know what it's > >>> expecting. > > > >> From a driver perspective we don't expect to have to worry about power > >> domains/multiple regulators - the hardware provides a bunch of power > >> registers to turn on/off various parts of the hardware and this should be > >> linked (in hardware) to a PDC which sorts it out. The GPU/PDC handles the > >> required sequencing. So it *should* be a case of turn power/clocks on and > >> go. > > > > Ah, the well abstracted and consistent hardware with which we are all so > > fortunate to work :) . More seriously perhaps the thing to do here is > > create a driver that provides a soft PDC and then push all the special > > case handling into that? It can then get instantiated based on the > > compatible or perhaps represented directly in the device tree if that > > makes sense. > > That makes sense to me. > > >> However certain integrations may have quirks such that there are physically > >> multiple supplies. These are expected to all be turned on before using the > >> GPU. Quite how this is best represented is something I'm not sure about. > > > > If they're always on and don't ever change then that's really easy to > > represent in the DT without involving drivers, it's when you need to > > actively manage them that it's more effort. > > Sorry, I should have been more clear. They are managed as a group - so > either the entire GPU is powered off, or powered on. There's no support > in Panfrost or mali_kbase for attempting to power part of the GPU. > > >>> Bear in mind that getting regulator stuff wrong can result > >>> in physical damage to the system so it pays to be careful and to > >>> consider that platform integrators have a tendency to rely on things > >>> that just happen to work but aren't a good idea or accurate > >>> representations of the system. It's certainly *possible* to do > >>> something like that, the information is there, but I would not in any > >>> way recommend doing things that way as it's likely to not be robust. > > > >>> The possibility that the regulator setup may vary on other platforms > >>> (which I'd expect TBH) does suggest that just requesting a bunch of > >>> supply names optionally and hoping that we got all the ones that are > >>> important on a given platform is going to lead to trouble down the line. > > > >> Certainly if we miss a regulator the GPU isn't going to work properly (some > >> cores won't be able to power up successfully). However at the moment the > >> driver will happily do this if someone provides it with a DT which includes > >> regulators that it doesn't know about. So I'm not sure how adding special > >> case code for a SoC would help here. > > > > I thought this SoC neeed to vary the voltage on both rails as part of > > the power management? Things like that can lead to hardware damage if > > we go out of spec far enough for long enough - there can be requirements > > like keeping one rail a certain voltage above another or whatever. > > Yes, you are correct. My concern is that a DT which specifies a new > regulator (e.g. "sram2") would be accepted by an old kernel (because it > wouldn't know to look for the new regulator) but wouldn't know to > control the regulator. It could then create a situation which puts the > board out of spec - potentially in a damaging way. Hence I'd like to > express the regulator structure in such a way that old kernels wouldn't > "half-work". Your "soft-PDC" approach would seem to fit that requirement. FYI, I sent a v3 here: https://patchwork.kernel.org/patch/11331373/ that addresses _some_ of these concerns. I'm not quite sure how to describe the regulators in a way that we can check that the device tree does not specific extra ones (apart from doing some string matching on all properties?), and I don't think I'm best placed to implement the soft-PDC idea. See my comment on that patch. Thanks! _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel