• Stephan Gerhold's avatar
    cpufreq: qcom-nvmem: Preserve PM domain votes in system suspend · d6048a19
    Stephan Gerhold authored
    >From the Linux point of view, the power domains used by the CPU must
    stay always-on. This is because we still need the CPU to keep running
    until the last instruction, which will typically be a firmware call that
    shuts down the CPU cleanly.
    
    At the moment the power domain votes (enable + performance state) are
    dropped during system suspend, which means the CPU could potentially
    malfunction while entering suspend.
    
    We need to distinguish between two different setups used with
    qcom-cpufreq-nvmem:
    
     1. CPR power domain: The backing regulator used by CPR should stay
        always-on in Linux; it is typically disabled automatically by
        hardware when the CPU enters a deep idle state. However, we
        should pause the CPR state machine during system suspend.
    
     2. RPMPD: The power domains used by the CPU should stay always-on
        in Linux (also across system suspend). The CPU typically only
        uses the *_AO ("active-only") variants of the power domains in
        RPMPD. For those, the RPM firmware will automatically drop
        the votes internally when the CPU enters a deep idle state.
    
    Make this work correctly by calling device_set_awake_path() on the
    virtual genpd devices, so that the votes are maintained across system
    suspend. The power domain drivers need to set GENPD_FLAG_ACTIVE_WAKEUP
    to opt into staying on during system suspend.
    
    For now we only set this for the RPMPD case. For CPR, not setting it
    will ensure the state machine is still paused during system suspend,
    while the backing regulator will stay on with "regulator-always-on".
    Signed-off-by: default avatarStephan Gerhold <stephan.gerhold@kernkonzept.com>
    Reviewed-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
    d6048a19
qcom-cpufreq-nvmem.c 16.1 KB