Peripherals As Power Resources

Peripherals that provide services to other peripherals can be considered as power resources from the point of view of the client driver.

As they can offer a service to more than one other peripheral, we suggest that the driver that manages them presents a MPowerInput derived interface to client peripheral drivers, providing Use() and Release() functions that can be used by dependent peripheral drivers to issue power requests. The driver for the peripheral providing that interface may then use the built-in usage counting feature to control the peripheral power state.

A typical example of a shared Peripheral is an Inter-Component serial Bus (I2C, SPI, etc):

class MySharedPeripheral : public MPowerInput , (other parent classes)
    {
public:    
    // from MPowerInput
    void Use();
    void Release();
    TUint GetCount();
    ...
    (other methods and data members required to model the interface)
    };
      

Special care must be taken to not create circular dependencies, for example, Peripheral A depends on Peripheral B, which depends on Peripheral C which depends on Peripheral A. Such circular dependencies would cause the MPowerInput::Release() mechanism not to work properly, and preventing the chain of peripherals from powering down when due.

The shared peripheral driver’s power handler asynchronous PowerDown() must examine the usage count of that peripheral if the power manager issues a PowerDown() request to the shared peripheral driver’s power handler while the peripheral is still in use by another driver. In this situation, the shared peripheral driver must defer powering down until all the dependent peripherals have released their request on it.

Some peripherals may also be represented as power resources to prevent the base port power saving operations inhibiting their usage. For example, a base port may consider DRAM to be a shared power resource with the DMA controller, or the DSP controller as clients. This will allow them to still be able to access DRAM whilst the CPU is idling, thus stopping the DRAM going into self-refresh if either one of its clients has pending operations on it.

As another example, to save power some base ports might decide to reduce the refresh rate of the LCD whilst the CPU is idling or even power it down for short periods and rely on the persistence of the LCD to prevent degredation of the user experience. However, on a multiple core solution the LCD might be used by the second core (e.g. DSP), for example, for playing back video whilst the main CPU is idling. In this situation the LCD should be represented as a shared power resource and the DSP must be able to request usage of this resource. The DSP controller software could assert a request on the LCD preventing the main CPU from initiating the power saving measures.