1. 05 11月, 2018 3 次提交
  2. 01 10月, 2018 1 次提交
    • V
      OPP: Prevent creating multiple OPP tables for devices sharing OPP nodes · 283d55e6
      Viresh Kumar 提交于
      When two or more devices are sharing their clock and voltage rails, they
      share the same OPP table. But there are some corner cases where the OPP
      core incorrectly creates separate OPP tables for them.
      
      For example, CPU 0 and 1 share clock/voltage rails. The platform
      specific code calls dev_pm_opp_set_regulators() for CPU0 and the OPP
      core creates an OPP table for it (the individual OPPs aren't initialized
      as of now). The same is repeated for CPU1 then. Because
      _opp_get_opp_table() doesn't compare DT node pointers currently, it
      fails to find the link between CPU0 and CPU1 and so creates a new OPP
      table.
      
      Fix this by calling _managed_opp() from _opp_get_opp_table().
      _managed_opp() gain an additional argument (index) to get the right node
      pointer. This resulted in simplifying code in _of_add_opp_table_v2() as
      well.
      Tested-by: NNiklas Cassel <niklas.cassel@linaro.org>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      283d55e6
  3. 20 9月, 2018 7 次提交
    • V
      OPP: Use a single mechanism to free the OPP table · cdd6ed90
      Viresh Kumar 提交于
      Currently there are two separate ways to free the OPP table based on how
      it is created in the first place.
      
      We call _dev_pm_opp_remove_table() to free the static and/or dynamic
      OPP, OPP list devices, etc. This is done for the case where the OPP
      table is added while initializing the OPPs, like via the path
      dev_pm_opp_of_add_table().
      
      We also call dev_pm_opp_put_opp_table() in some cases which eventually
      frees the OPP table structure once the reference count reaches 0. This
      is used by the first case as well as other cases like
      dev_pm_opp_set_regulators() where the OPPs aren't necessarily
      initialized at this point.
      
      This whole thing is a bit unclear and messy and obstruct any further
      cleanup/fixup of OPP core.
      
      This patch tries to streamline this by keeping a single path for OPP
      table destruction, i.e. dev_pm_opp_put_opp_table().
      
      All the cleanup happens in _opp_table_kref_release() now after the
      reference count reaches 0. _dev_pm_opp_remove_table() is removed as it
      isn't required anymore.
      
      We don't drop the reference to the OPP table after creating it from
      _of_add_opp_table_v{1|2}() anymore and the same is dropped only when we
      try to remove them.
      Tested-by: NNiklas Cassel <niklas.cassel@linaro.org>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      cdd6ed90
    • V
      OPP: Don't remove dynamic OPPs from _dev_pm_opp_remove_table() · 2a4eb735
      Viresh Kumar 提交于
      Only one platform was depending on this feature and it is already
      updated now. Stop removing dynamic OPPs from _dev_pm_opp_remove_table().
      This simplifies lot of paths and removes unnecessary parameters.
      Tested-by: NNiklas Cassel <niklas.cassel@linaro.org>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      2a4eb735
    • V
      OPP: Create separate kref for static OPPs list · d0e8ae6c
      Viresh Kumar 提交于
      The static OPPs don't always get freed with the OPP table, it can happen
      before that as well. For example, if the OPP table is first created
      using helpers like dev_pm_opp_set_supported_hw() and the OPPs are
      created at a later point. Now when the OPPs are removed, the OPP table
      stays until the time dev_pm_opp_put_supported_hw() is called.
      
      Later patches will streamline the freeing of OPP table and that requires
      the static OPPs to get freed with help of a separate kernel reference.
      This patch prepares for that by creating a separate kref for static OPPs
      list.
      Tested-by: NNiklas Cassel <niklas.cassel@linaro.org>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      d0e8ae6c
    • V
      OPP: Parse OPP table's DT properties from _of_init_opp_table() · f06ed90e
      Viresh Kumar 提交于
      Parse the DT properties present in the OPP table from
      _of_init_opp_table(), which is a dedicated routine for DT parsing.
      
      Minor relocation of helpers is required for this.
      
      It is possible now for _managed_opp() to return a partially initialized
      OPP table if the OPP table is created via the helpers like
      dev_pm_opp_set_supported_hw() and we need another flag to indicate if
      the static OPP are already parsed or not to make sure we don't
      incorrectly skip initializing the static OPPs.
      Tested-by: NNiklas Cassel <niklas.cassel@linaro.org>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      f06ed90e
    • V
      OPP: Pass index to _of_init_opp_table() · eb7c8743
      Viresh Kumar 提交于
      This is a preparatory patch required for the next commit which will
      start using OPP table's node pointer in _of_init_opp_table(), which
      requires the index in order to read the OPP table's phandle.
      
      This commit adds the index argument in the call chains in order to get
      it delivered to _of_init_opp_table().
      Tested-by: NNiklas Cassel <niklas.cassel@linaro.org>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      eb7c8743
    • V
      OPP: Protect dev_list with opp_table lock · 3d255699
      Viresh Kumar 提交于
      The dev_list needs to be protected with a lock, else we may have
      simultaneous access (addition/removal) to it and that would be racy.
      Extend scope of the opp_table lock to protect dev_list as well.
      Tested-by: NNiklas Cassel <niklas.cassel@linaro.org>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      3d255699
    • V
      OPP: Don't try to remove all OPP tables on failure · 404b1369
      Viresh Kumar 提交于
      dev_pm_opp_of_cpumask_add_table() creates the OPP table for all CPUs
      present in the cpumask and on errors it should revert all changes it has
      done.
      
      It actually is doing a bit more than that. On errors, it tries to free
      all the OPP tables, even the one it hasn't created yet. This may also
      end up freeing the OPP tables which were created from separate path,
      like dev_pm_opp_set_supported_hw().
      Reported-and-tested-by: NNiklas Cassel <niklas.cassel@linaro.org>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      404b1369
  4. 09 5月, 2018 3 次提交
  5. 14 10月, 2017 2 次提交
  6. 03 10月, 2017 1 次提交
  7. 30 1月, 2017 5 次提交
  8. 27 1月, 2017 4 次提交
  9. 06 12月, 2016 4 次提交
  10. 21 10月, 2016 1 次提交
  11. 16 6月, 2016 1 次提交
    • V
      PM / OPP: Add 'UNKNOWN' status for shared_opp in struct opp_table · 79ee2e8f
      Viresh Kumar 提交于
      dev_pm_opp_get_sharing_cpus() returns 0 even in the case when the OPP
      core doesn't know whether or not the table is shared. It works on the
      majority of platforms, where the OPP table is never created before
      invoking the function and then -ENODEV is returned by it.
      
      But in the case of one platform (Jetson TK1) at least, the situation
      is a bit different. The OPP table has been created (somehow) before
      dev_pm_opp_get_sharing_cpus() is called and it returns 0. Its caller
      treats that as 'the CPUs don't share OPPs' and that leads to degraded
      performance.
      
      Fix this by converting 'shared_opp' in struct opp_table to an enum
      and making dev_pm_opp_get_sharing_cpus() return -EINVAL in case when
      the value of that field is "access unknown", so that the caller can
      handle it accordingly (cpufreq-dt considers that as 'all CPUs share
      the table', for example).
      
      Fixes: 6f707daa "PM / OPP: Add dev_pm_opp_get_sharing_cpus()"
      Reported-and-tested-by: NAlexandre Courbot <acourbot@nvidia.com>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      [ rjw : Subject & changelog ]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      79ee2e8f
  12. 06 5月, 2016 1 次提交
  13. 21 2月, 2016 1 次提交
  14. 10 2月, 2016 3 次提交
  15. 11 12月, 2015 2 次提交
  16. 24 11月, 2015 1 次提交