Commit Graph

8 Commits

Author SHA1 Message Date
Liang He a9e37a828c
regulator: scmi: Add missing of_node_get()
In scmi_regulator_probe(), of_find_node_by_name() will decrease
the refcount of its first argument and we need a of_node_get()
to keep reference balance.

Signed-off-by: Liang He <windhl@126.com>
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Link: https://lore.kernel.org/r/20220622034816.4094043-1-windhl@126.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-30 13:25:37 +01:00
Miaoqian Lin 68d6c8476f
regulator: scmi: Fix refcount leak in scmi_regulator_probe
of_find_node_by_name() returns a node pointer with refcount
incremented, we should use of_node_put() on it when done.
Add missing of_node_put() to avoid refcount leak.

Fixes: 0fbeae70ee ("regulator: add SCMI driver")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220516074433.32433-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-17 11:58:13 +01:00
Linus Torvalds 9b1111fa80 regulator: Fixes for v5.14
A collection of fixes for the regulator API that have come up since the
 merge window, including a big batch of fixes from Axel Lin's usual
 careful and detailed review.  The one stand out fix here is Dmitry
 Baryshkov's fix for an issue where we fail to power on the parents of
 always on regulators during system startup if they weren't already
 powered on.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmC/ao0ACgkQJNaLcl1U
 h9AoqQf9GYtljFSON07MAOWwMgnjuMQ+rl0ZadqKKzq74QMMi4bxVKDWkftQ28/5
 Ulk2M/mxRE6C1OEpOJl9ZnG9K0fWpOdnTURkYgW0FsJniEDiF7ZkdoFypwu93jOD
 0r+3QCw/Ti9i08pOdlpFpUKU5rp/O9HYmouOTzBOCiM1SMb9TkkX5GBoDVw8+cWd
 2PZqKQXEsaK1uNzeaXYw6UO8+IdSpVQRzSEILdtVWyHCNmXDDJWfI3vYeeqDbhYr
 C+E3UdrO1ftNsOoJv33NqhscMnulkZDZ6H6lgbLX2FyFAe2M9N+AildGlkR5H1GD
 xH3q3EvkOE2Y2X3zHteLdJ3MoI91cQ==
 =poWJ
 -----END PGP SIGNATURE-----

Merge tag 'regulator-fix-v5.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

Pull regulator fixes from Mark Brown:
 "A collection of fixes for the regulator API that have come up since
  the merge window, including a big batch of fixes from Axel Lin's usual
  careful and detailed review.

  The one stand out fix here is Dmitry Baryshkov's fix for an issue
  where we fail to power on the parents of always on regulators during
  system startup if they weren't already powered on"

* tag 'regulator-fix-v5.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (21 commits)
  regulator: rt4801: Fix NULL pointer dereference if priv->enable_gpios is NULL
  regulator: hi6421v600: Fix .vsel_mask setting
  regulator: bd718x7: Fix the BUCK7 voltage setting on BD71837
  regulator: atc260x: Fix n_voltages and min_sel for pickable linear ranges
  regulator: rtmv20: Fix to make regcache value first reading back from HW
  regulator: mt6315: Fix function prototype for mt6315_map_mode
  regulator: rtmv20: Add Richtek to Kconfig text
  regulator: rtmv20: Fix .set_current_limit/.get_current_limit callbacks
  regulator: hisilicon: use the correct HiSilicon copyright
  regulator: bd71828: Fix .n_voltages settings
  regulator: bd70528: Fix off-by-one for buck123 .n_voltages setting
  regulator: max77620: Silence deferred probe error
  regulator: max77620: Use device_set_of_node_from_dev()
  regulator: scmi: Fix off-by-one for linear regulators .n_voltages setting
  regulator: core: resolve supply for boot-on/always-on regulators
  regulator: fixed: Ensure enable_counter is correct if reg_domain_disable fails
  regulator: Check ramp_delay_table for regulator_set_ramp_delay_regmap
  regulator: fan53880: Fix missing n_voltages setting
  regulator: da9121: Return REGULATOR_MODE_INVALID for invalid mode
  regulator: fan53555: fix TCS4525 voltage calulation
  ...
2021-06-08 09:41:16 -07:00
Axel Lin 36cb555fae
regulator: scmi: Fix off-by-one for linear regulators .n_voltages setting
For linear regulators, the .n_voltages is (max_uv - min_uv) / uv_step + 1.

Fixes: 0fbeae70ee ("regulator: add SCMI driver")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Link: https://lore.kernel.org/r/20210521073020.1944981-1-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-21 20:05:48 +01:00
Linus Torvalds ca62e9090d regulator: Updates for v5.13
Not much going on with regulator this cycle, even in terms of cleanups
 and fixes things were fairly quiet.
 
  - New helper for setting ramp delay.
  - Conversion of the Qualcomm RPMH bindings to YAML.
  - Support for Tang Cheng TCS4525.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmCGwr0ACgkQJNaLcl1U
 h9AoxQf9GL9+ikg6p5RagNLslkcdsKaCfQJKzUTKIJGfFbmYLOqxNPyrFX2R3Dv3
 YPGDzWwT7ZdBbXyXO5fr7Y8iqO+STyLeQnSCT0TSGATKrst+Gjwrt6Jc4pzyaPAc
 lRC6atB1Lprucqh3gH4KTsuFPw6ag/44EdNevr37e9o2u5f3hLsy23Ng+xhP4Wfp
 S7R18OGSpW0kHuLwomfjLC6sk1QfLnw6hIoDc7znmnndxQE1+z89p7SZ46hrf4hf
 2bcWMLiXqthhzITTDUY41SmqSQVpSCyBjEjjIMcn6PdjJolTAHJuP3+wuLQYWf5r
 MBhgxTssJTm+y4QlOhRoeoqAWJAxXw==
 =9ZSz
 -----END PGP SIGNATURE-----

Merge tag 'regulator-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

Pull regulator updates from Mark Brown:
 "Not much going on with regulator this cycle, even in terms of cleanups
  and fixes things were fairly quiet.

   - New helper for setting ramp delay

   - Conversion of the Qualcomm RPMH bindings to YAML

   - Support for Tang Cheng TCS4525"

* tag 'regulator-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (26 commits)
  regulator: Add binding for TCS4525
  regulator: fan53555: Add TCS4525 DCDC support
  dt-bindings: vendor-prefixes: Add Tang Cheng (TCS)
  regulator: core: Fix off_on_delay handling
  regulator: core: Respect off_on_delay at startup
  regulator: core.c: Improve a comment
  regulator: Avoid a double 'of_node_get' in 'regulator_of_get_init_node()'
  regulator: core.c: Fix indentation of comment
  regulator: s2mps11: Drop initialization via platform data
  regulator: s2mpa01: Drop initialization via platform data
  regulator: da9121: automotive variants identity fix
  regulator: Add regmap helper for ramp-delay setting
  regulator: helpers: Export helper voltage listing
  regulator: Add compatibles for PM7325/PMR735A
  regulator: Convert RPMh regulator bindings to YAML
  regulator: qcom-rpmh: Add PM7325/PMR735A regulator support
  regulator: qcom-rpmh: Add pmic5_ftsmps520 buck
  regulator: mt6360: remove redundant error print
  regulator: bd9576: Fix return from bd957x_probe()
  regulator: add missing call to of_node_put()
  ...
2021-04-26 16:24:42 -07:00
Cristian Marussi 59046d157d regulator: scmi: Port driver to the new scmi_voltage_proto_ops interface
Port the scmi regulator driver to the new SCMI voltage interface based
on protocol handles and common devm_get_ops().

Link: https://lore.kernel.org/r/20210316124903.35011-30-cristian.marussi@arm.com
Cc: Mark Brown <broonie@kernel.org>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2021-03-30 16:35:15 +01:00
Yang Li 45ee8b79d6
regulator: add missing call to of_node_put()
In one of the error paths of the for_each_child_of_node() loop,
add missing call to of_node_put().

Fix the following coccicheck warning:
./drivers/regulator/scmi-regulator.c:343:1-23: WARNING: Function
"for_each_child_of_node" should have of_node_put() before return around
line 347.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Link: https://lore.kernel.org/r/1614303575-27436-1-git-send-email-yang.lee@linux.alibaba.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10 12:47:47 +00:00
Cristian Marussi 0fbeae70ee
regulator: add SCMI driver
Add a simple regulator based on SCMI Voltage Domain Protocol.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
----
v6 --> v7
- add proper blank lines between semantic blocks
- fix return value on error path of scmi_reg_is_enabled()
- use generic Failure message on err path of info_get()
- fix comment containing apostrophe

v3 --> v4
- using of_match_full_name core regulator flag
- avoid coccinelle falde complaints about pointer-sized allocations

v2 --> v3
- remove multiple linear mappings support
- removed duplicated voltage name printout
- added a few comments
- simplified return path in scmi_reg_set_voltage_sel()

v1 --> v2
- removed duplicate regulator naming
- removed redundant .get/set_voltage ops: only _sel variants implemented
- removed condexpr on fail path to increase readability

v0 --> v1
- fixed init_data constraint parsing
- fixes for v5.8 (linear_range.h)
- fixed commit message content and subject line format
- factored out SCMI core specific changes to distinct patch
- reworked Kconfig and Makefile to keep proper alphabetic order
- fixed SPDX comment style
- removed unneeded inline functions
- reworked conditionals for legibility
- fixed some return paths to properly report SCMI original errors codes
- added some more descriptive error messages when fw returns invalid ranges
- removed unneeded explicit devm_regulator_unregister from .remove()
Link: https://lore.kernel.org/r/20201123202336.46701-4-cristian.marussi@arm.com

Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-23 20:42:03 +00:00