1. 29 5月, 2020 2 次提交
  2. 13 5月, 2020 1 次提交
  3. 10 12月, 2019 1 次提交
    • 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
  4. 19 6月, 2019 1 次提交
  5. 07 2月, 2019 1 次提交
  6. 23 1月, 2019 1 次提交
  7. 11 12月, 2018 1 次提交
    • V
      OPP: Fix missing debugfs supply directory for OPPs · 46f48aca
      Viresh Kumar 提交于
      There is one case where we may end up with no "supply" directory for the
      OPPs in debugfs. That happens when the OPP core isn't managing the
      regulators for the device and the device's OPP do have microvolt
      property. It happens because the opp_table->regulator_count remains set
      to 0 and the debugfs routines don't add any supply directory in such a
      case.
      
      This commit fixes that by setting opp_table->regulator_count to 1 in
      that particular case. But to make everything work nicely and not break
      other parts of the core, regulator_count is defined as "int" now instead
      of "unsigned int" and it can have different special values now. It is
      set to -1 initially to mark it "uninitialized" and later only we set it
      to 0 or positive values after checking how many supplies are there.
      
      This also helps in finding the bugs where only few of the OPPs have the
      "opp-microvolt" property set and not all.
      
      Fixes: 1fae788e ("PM / OPP: Don't create debugfs "supply-0" directory unnecessarily")
      Reported-by: NQuentin Perret <quentin.perret@arm.com>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      46f48aca
  8. 05 11月, 2018 4 次提交
    • V
      OPP: Add dev_pm_opp_{set|put}_genpd_virt_dev() helper · 4f018bc0
      Viresh Kumar 提交于
      Multiple generic power domains for a consumer device are supported with
      the help of virtual devices, which are created for each consumer device
      - genpd pair. These are the device structures which are attached to the
      power domain and are required by the OPP core to set the performance
      state of the genpd.
      
      The helpers added by this commit are required to be called once for each
      of these virtual devices. These are required only if multiple domains
      are available for a device, otherwise the actual device structure will
      be used instead by the OPP core.
      
      The new helpers also support the complex cases where the consumer device
      wouldn't always require all the domains. For example, a camera may
      require only one power domain during normal operations but two during
      high resolution operations. The consumer driver can call
      dev_pm_opp_put_genpd_virt_dev(high_resolution_genpd_virt_dev) if it is
      currently operating in the normal mode and doesn't have any performance
      requirements from the genpd which manages high resolution power
      requirements. The consumer driver can later call
      dev_pm_opp_set_genpd_virt_dev(high_resolution_genpd_virt_dev) once it
      switches back to the high resolution mode.
      
      The new helpers differ from other OPP set/put helpers as the new ones
      can be called with OPPs initialized for the table as we may need to call
      them on the fly because of the complex case explained above. For this
      reason it is possible that the genpd virt_dev structure may be used in
      parallel while the new helpers are running and a new mutex is added to
      protect against that. We didn't use the existing opp_table->lock mutex
      as that is widely used in the OPP core and we will need this lock in the
      dev_pm_opp_set_rate() helper while changing OPP and we need to make sure
      there is not much contention while doing that as that's the hotpath.
      Reviewed-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      4f018bc0
    • V
      OPP: Populate OPPs from "required-opps" property · da544b61
      Viresh Kumar 提交于
      An earlier commit populated the OPP tables from the "required-opps"
      property, this commit populates the individual OPPs. This is repeated
      for each OPP in the OPP table and these populated OPPs will be used by
      later commits.
      Reviewed-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      da544b61
    • V
      OPP: Populate required opp tables from "required-opps" property · 5d6d106f
      Viresh Kumar 提交于
      The current implementation works only for the case where a single
      phandle is present in the "required-opps" property, while DT allows
      multiple phandles to be present there.
      
      This patch adds new infrastructure to parse all the phandles present in
      "required-opps" property and save pointers of the required OPP's OPP
      tables. These will be used by later commits.
      Reviewed-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      5d6d106f
    • V
      OPP: Identify and mark genpd OPP tables · 61d8e7c7
      Viresh Kumar 提交于
      We need to handle genpd OPP tables differently, this is already the case
      at one location and will be extended going forward. Add another field to
      the OPP table to check if the table belongs to a genpd or not.
      Reviewed-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      61d8e7c7
  9. 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
  10. 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
  11. 09 5月, 2018 3 次提交
  12. 14 10月, 2017 2 次提交
  13. 03 10月, 2017 1 次提交
  14. 30 1月, 2017 5 次提交
  15. 27 1月, 2017 4 次提交
  16. 06 12月, 2016 4 次提交
  17. 21 10月, 2016 1 次提交