Re: [RFC PATCH 3/4] sdio: introduce sdio_platform_pm_ops

Rafael J. Wysocki
2012-10-18T23:30:37Z

On Friday 12 of October 2012 11:12:40 Aaron Lu wrote:
> Some platform has the ability to set the sdio device into a low power
> state with some specific method, e.g. ACPI on x86 based system can use
> acpi control methods to change the device's power state.
>
> Considering there may be different platforms utilizing different
> mechanisms to achieve this, a new structure is introduced to let
> individual platform to use these callbacks to do the job.
>
> The structure contains 4 callbacks:
> - is_manageable
> return true when the platform can manage the device's power;
> return false otherwise.
> - choose_state
> Choose a proper power state for the device
> - set_state
> Set the device's power state
> - run_wake
> Enable the device's runtime wakeup capability from the platform's
> perspective.
>
> And 4 functions to wrap these callbacks:
> - bool platform_sdio_power_manageable(struct device *dev)
> - int platform_sdio_choose_power_state(struct device *dev)
> - int platform_sdio_set_power_state(struct device *dev, int state)
> - int platform_sdio_run_wake(struct device *dev, bool enable)
> So when these callbacks are desired, these wrapper functions should be
> used. And if someday some sdio function driver which lives out of the
> mmc subsystem has a need to use these wrapper functions, they can be
> exported.
>
> sdio_acpi.c implements these callbacks utilizing ACPI code.
>
> The idea of this patch and the definition/wrapper of these callbacks
> are heavily based on the one used in PCI subsystem.
>
> Signed-off-by: Aaron Lu <aaron.lu@intel.com>

I'm not really sure if we need to make it so complicated.

Please see my comments on the next patch.

Thanks,
Rafael

--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.