Skip to content
  • Viresh Kumar's avatar
    opp: Keep track of currently programmed OPP · 81c4d8a3
    Viresh Kumar authored
    
    
    The dev_pm_opp_set_rate() helper needs to know the currently programmed
    OPP to make few decisions and currently we try to find it on every
    invocation of this routine.
    
    Lets start keeping track of the current_opp programmed for the devices
    of the opp table, that will be quite useful going forward.
    
    If we fail to find the current OPP, we pick the first one available in
    the list, as the list is in ascending order of frequencies, level, or
    bandwidth and that's the best guess we can make anyway.
    
    Note that we used to do the frequency comparison a bit early in
    dev_pm_opp_set_rate() previously, and now instead we check the target
    opp, which shall be more accurate anyway.
    
    We need to make sure that current_opp's memory doesn't get freed while
    it is being used and so we keep a reference of it until the time it is
    used.
    
    Now that current_opp will always be set, we can drop some unnecessary
    checks as well.
    
    Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
    Tested-by: default avatarDmitry Osipenko <digetx@gmail.com>
    81c4d8a3