1. 29 5月, 2020 6 次提交
  2. 13 5月, 2020 1 次提交
  3. 13 4月, 2020 1 次提交
    • R
      opp: Manage empty OPP tables with clk handle · aca48b61
      Rajendra Nayak 提交于
      With OPP core now supporting DVFS for IO devices, we have instances of
      IO devices (same IP block) which require an OPP on some platforms/SoCs
      while just needing to scale the clock on some others.
      
      In order to avoid conditional code in every driver which supports such
      devices (to check for availability of OPPs and then deciding to do
      either dev_pm_opp_set_rate() or clk_set_rate()) add support to manage
      empty OPP tables with a clk handle.
      
      This makes dev_pm_opp_set_rate() equivalent of a clk_set_rate() for
      devices with just a clk and no OPPs specified, and makes
      dev_pm_opp_set_rate(0) bail out without throwing an error.
      Signed-off-by: NRajendra Nayak <rnayak@codeaurora.org>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      aca48b61
  4. 06 1月, 2020 1 次提交
  5. 10 12月, 2019 2 次提交
    • V
      opp: Replace list_kref with a local counter · 03758d60
      Viresh Kumar 提交于
      A kref or refcount isn't the right tool to be used here for counting
      number of devices that are sharing the static OPPs created for the OPP
      table. For example, we are reinitializing the kref again, after it
      reaches a value of 0 and frees the resources, if the static OPPs get
      added for the same OPP table structure (as the OPP table structure was
      never freed). That is messy and very unclear.
      
      This patch makes parsed_static_opps an unsigned integer and uses it to
      count the number of users of the static OPPs. The increment and
      decrement to parsed_static_opps is done under opp_table->lock now to
      make sure no races are possible if the OPP table is getting added and
      removed in parallel (which doesn't happen in practice, but can in
      theory).
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      03758d60
    • V
      opp: Free static OPPs on errors while adding them · ba003319
      Viresh Kumar 提交于
      The static OPPs aren't getting freed properly, if errors occur while
      adding them. Fix that by calling _put_opp_list_kref() and putting their
      reference on failures.
      
      Fixes: 11e1a164 ("opp: Don't decrement uninitialized list_kref")
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      ba003319
  6. 11 11月, 2019 1 次提交
  7. 23 10月, 2019 1 次提交
  8. 22 10月, 2019 1 次提交
  9. 21 10月, 2019 1 次提交
  10. 10 10月, 2019 1 次提交
  11. 26 7月, 2019 6 次提交
  12. 24 6月, 2019 1 次提交
  13. 19 6月, 2019 1 次提交
  14. 17 6月, 2019 2 次提交
    • R
      opp: Make dev_pm_opp_set_rate() handle freq = 0 to drop performance votes · cd7ea582
      Rajendra Nayak 提交于
      For devices with performance state, we use dev_pm_opp_set_rate() to set
      the appropriate clk rate and the performance state.
      
      We do need a way to remove the performance state vote when we idle the
      device and turn the clocks off. Use dev_pm_opp_set_rate() with freq = 0
      to achieve this.
      Signed-off-by: NRajendra Nayak <rnayak@codeaurora.org>
      Signed-off-by: NStephen Boyd <swboyd@chromium.org>
      [ Viresh: Updated _set_required_opps() to handle the !opp case ]
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      cd7ea582
    • S
      opp: Don't overwrite rounded clk rate · b3e3759e
      Stephen Boyd 提交于
      The OPP table normally contains 'fmax' values corresponding to the
      voltage or performance levels of each OPP, but we don't necessarily want
      all the devices to run at fmax all the time. Running at fmax makes sense
      for devices like CPU/GPU, which have a finite amount of work to do and
      since a specific amount of energy is consumed at an OPP, its better to
      run at the highest possible frequency for that voltage value.
      
      On the other hand, we have IO devices which need to run at specific
      frequencies only for their proper functioning, instead of maximum
      possible frequency.
      
      The OPP core currently roundup to the next possible OPP for a frequency
      and select the fmax value. To support the IO devices by the OPP core,
      lets do the roundup to fetch the voltage or performance state values,
      but not use the OPP frequency value. Rather use the value returned by
      clk_round_rate().
      
      The current user, cpufreq, of dev_pm_opp_set_rate() already does the
      rounding to the next OPP before calling this routine and it won't
      have any side affects because of this change.
      Signed-off-by: NStephen Boyd <swboyd@chromium.org>
      Signed-off-by: NRajendra Nayak <rnayak@codeaurora.org>
      [ Viresh: Massaged changelog, added comment and use temp_opp variable
      	  instead ]
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      b3e3759e
  15. 15 6月, 2019 1 次提交
  16. 21 5月, 2019 1 次提交
  17. 20 5月, 2019 2 次提交
    • V
      opp: Allocate genpd_virt_devs from dev_pm_opp_attach_genpd() · c0ab9e08
      Viresh Kumar 提交于
      Currently the space for the array of virtual devices is allocated along
      with the OPP table, but that isn't going to work well from now onwards.
      For single power domain case, a driver can either use the original
      device structure for setting the performance state (if genpd attached
      with dev_pm_domain_attach()) or use the virtual device structure (if
      genpd attached with dev_pm_domain_attach_by_name(), which returns the
      virtual device) and so we can't know in advance if we are going to need
      genpd_virt_devs array or not.
      
      Lets delay the allocation a bit and do it along with
      dev_pm_opp_attach_genpd() rather. The deallocation is done from
      dev_pm_opp_detach_genpd().
      Tested-by: NNiklas Cassel <niklas.cassel@linaro.org>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      c0ab9e08
    • V
      opp: Attach genpds to devices from within OPP core · 6319aee1
      Viresh Kumar 提交于
      The OPP core requires the virtual device pointers to set performance
      state on behalf of the device, for the multiple power domain case. The
      genpd API (dev_pm_domain_attach_by_name()) has evolved now to support
      even the single power domain case and that lets us add common code for
      handling both the cases more efficiently.
      
      The virtual device structure returned by dev_pm_domain_attach_by_name()
      isn't normally used by the cpufreq drivers as they don't manage power
      on/off of the domains and so is only useful for the OPP core.
      
      This patch moves all the complexity into the OPP core to make the end
      drivers simple. The earlier APIs dev_pm_opp_{set|put}_genpd_virt_dev()
      are reworked into dev_pm_opp_{attach|detach}_genpd(). The new helper
      dev_pm_opp_attach_genpd() accepts a NULL terminated array of strings
      which contains names of all the genpd's to attach. It then attaches all
      the domains and saves the pointers to the virtual devices. The other
      helper undo the work done by this helper.
      Tested-by: NNiklas Cassel <niklas.cassel@linaro.org>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      6319aee1
  18. 10 4月, 2019 1 次提交
  19. 12 3月, 2019 1 次提交
  20. 11 3月, 2019 1 次提交
  21. 07 2月, 2019 3 次提交
  22. 23 1月, 2019 1 次提交
  23. 04 1月, 2019 1 次提交
    • V
      cpufreq: scpi/scmi: Fix freeing of dynamic OPPs · 1690d8bb
      Viresh Kumar 提交于
      Since the commit 2a4eb735 "OPP: Don't remove dynamic OPPs from
      _dev_pm_opp_remove_table()", dynamically created OPP aren't
      automatically removed anymore by dev_pm_opp_cpumask_remove_table(). This
      affects the scpi and scmi cpufreq drivers which no longer free OPPs on
      failures or on invocations of the policy->exit() callback.
      
      Create a generic OPP helper dev_pm_opp_remove_all_dynamic() which can be
      called from these drivers instead of dev_pm_opp_cpumask_remove_table().
      
      In dev_pm_opp_remove_all_dynamic(), we need to make sure that the
      opp_list isn't getting accessed simultaneously from other parts of the
      OPP core while the helper is freeing dynamic OPPs, i.e. we can't drop
      the opp_table->lock while traversing through the OPP list. And to
      accomplish that, this patch also creates _opp_kref_release_unlocked()
      which can be called from this new helper with the opp_table lock already
      held.
      
      Cc: 4.20 <stable@vger.kernel.org> # v4.20
      Reported-by: NValentin Schneider <valentin.schneider@arm.com>
      Fixes: 2a4eb735 "OPP: Don't remove dynamic OPPs from _dev_pm_opp_remove_table()"
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Tested-by: NValentin Schneider <valentin.schneider@arm.com>
      Reviewed-by: NSudeep Holla <sudeep.holla@arm.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      1690d8bb
  24. 14 12月, 2018 2 次提交
    • V
      OPP: Don't return 0 on error from of_get_required_opp_performance_state() · 2feb5a89
      Viresh Kumar 提交于
      of_get_required_opp_performance_state() returns 0 on errors currently
      and a positive performance state otherwise. Since 0 is a valid
      performance state (representing off), it would be better if this routine
      returns negative values on error.
      
      That will also make it behave similar to
      dev_pm_opp_xlate_performance_state(), which also returns performance
      states and returns negative values on error. Change the return type of
      the function to "int" in order to return negative values.
      
      This doesn't have any users for now and so no other part of the kernel
      will be impacted with this change.
      Reviewed-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      2feb5a89
    • V
      OPP: Add dev_pm_opp_xlate_performance_state() helper · c8a59103
      Viresh Kumar 提交于
      dev_pm_genpd_set_performance_state() needs to handle performance state
      propagation going forward. Currently this routine only gets the required
      performance state of the device's genpd as an argument, but it doesn't
      know how to translate that to master genpd(s) of the device's genpd.
      
      Introduce a new helper dev_pm_opp_xlate_performance_state() which will
      be used to translate from performance state of a device (or genpd
      sub-domain) to another device (or master genpd).
      
      Normally the src_table (of genpd sub-domain) will have the
      "required_opps" property set to point to one of the OPPs in the
      dst_table (of master genpd), but in some cases the genpd and its master
      have one to one mapping of performance states and so none of them have
      the "required-opps" property set. Return the performance state of the
      src_table as it is in such cases.
      Tested-by: NRajendra Nayak <rnayak@codeaurora.org>
      Reviewed-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      c8a59103