Re: PCI power management

Alan Cox
2001-04-19T13:32:38Z

> > pci_power_on_generic
> > pci_power_off_generic
> > pci_power_on_null
> > pci_power_off_null
> >
> >At which point most driver writers are having to do no thinking at all about
> >their device. The PCI layer just requires they pick a function and stick it
> >in the struct pci_device.
>
> Could you elaborate about the difference between generic and null
> functions ? I'm not sure I understand what you mean...

null = 'do absolutely nothing'
generic = 'do D3 as per the specification'

The idea being the PM layer would go around calling

dev->power_off(dev);

as a default notifier for PCI devices.

> one to know if it will be able to bring back the card from a power off
> state or not. It's the only one to know if it can reconfigure the card
> completely without having a BIOS run before it.

And in the case of the cards like that you would need a custom mask. So you'd
do
pci_set_power_handler(dev, atyfb_power_on, atyfb_power_off)

to get a custom function. For most authors however they can call the power
handler setup just using prerolled functions that do the right thing and know
about any architecture horrors they dont.

> pci_power_off(uint mask);
>
> where mask is
>
> PCI_POWER_MASK_D1 = 0x00000001
> PCI_POWER_MASK_D2 = 0x00000002
> PCI_POWER_MASK_D3 = 0x00000004
> PCI_POWER_MASK_NOCLOCK = 0x00000008
> PCI_POWER_MASK_NOPOWER = 0x00000010

I'd rather

pci_dev->powerstate

or similar as a set of flags in the device.

Alan