Commit graph

4422 commits

Author SHA1 Message Date
Axel Lin
e1e8d55bb9
regulator: mp886x: Convert to use regulator_set_ramp_delay_regmap
Use regulator_set_ramp_delay_regmap instead of open-coded.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Message-Id: <20210525102708.2519323-1-axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@sirena.org.uk>
2021-05-25 16:45:09 +01:00
Axel Lin
e0f339213c
regulator: qcom_smd: Make pm8953_lnldo linear_ranges entries properly sorted
For better readability, make linear_ranges entries sort by selector.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Message-Id: <20210520112719.1814396-1-axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@sirena.org.uk>
2021-05-25 16:45:08 +01:00
Mark Brown
a072cbda97
Merge series "Fix MAX77620 regulator driver regression" from Dmitry Osipenko <digetx@gmail.com>:
Hi,

The next-20210521 started to fail on Nexus 7 because of the change to
regulator core that caused regression of the MAX77620 regulator driver.
The regulator driver is now getting a deferred probe and turned out
driver wasn't ready for this. The root of the problem is that OF node
of the PMIC MFD sub-device is shared with the PINCTRL sub-device and we
need to convey this information to the driver core, otherwise it will
try to claim GPIO pin that is already claimed by PINCTRL and fail the
probe.

Dmitry Osipenko (2):
  regulator: max77620: Use device_set_of_node_from_dev()
  regulator: max77620: Silence deferred probe error

 drivers/regulator/max77620-regulator.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

--
2.30.2
2021-05-24 12:54:44 +01:00
Axel Lin
7c556aec14
regulator: bd70528: Convert to use regulator_set_ramp_delay_regmap
Use regulator_set_ramp_delay_regmap instead of open-coded.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Link: https://lore.kernel.org/r/20210522124250.2121076-1-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-24 09:51:35 +01:00
Axel Lin
8590ccd4df
regulator: max8973: Convert to use regulator_set_ramp_delay_regmap
Use regulator_set_ramp_delay_regmap instead of open-coded.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Link: https://lore.kernel.org/r/20210522040814.2042397-1-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-24 09:51:34 +01:00
Randy Dunlap
5ba3747dbc
regulator: bd71815: add select to fix build
Mend the Kconfig for REGULATOR_BD71815 to prevent build errors:

riscv32-linux-ld: drivers/regulator/bd71815-regulator.o: in function `.L0 ':
regulator.c:289: undefined reference to `rohm_regulator_set_dvs_levels'
riscv32-linux-ld: drivers/regulator/bd71815-regulator.c:370: undefined reference to `rohm_regulator_set_dvs_levels'

Fixes: 1aad39001e ("regulator: Support ROHM BD71815 regulators")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Reviewed-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Link: https://lore.kernel.org/r/20210523001427.13500-1-rdunlap@infradead.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-24 09:51:34 +01:00
Hao Fang
8d6ee30c11
regulator: hisilicon: use the correct HiSilicon copyright
s/Hisilicon/HiSilicon/.
It should use capital S, according to the official website
https://www.hisilicon.com/en.

Signed-off-by: Hao Fang <fanghao11@huawei.com>
Link: https://lore.kernel.org/r/1621679151-15617-1-git-send-email-fanghao11@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-24 09:50:31 +01:00
Dmitry Osipenko
62499a94ce
regulator: max77620: Silence deferred probe error
One of previous changes to regulator core causes PMIC regulators to
re-probe until supply regulator is registered. Silence noisy error
message about the deferred probe.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20210523224243.13219-3-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-24 09:50:20 +01:00
Dmitry Osipenko
6f55c5dd11
regulator: max77620: Use device_set_of_node_from_dev()
The MAX77620 driver fails to re-probe on deferred probe because driver
core tries to claim resources that are already claimed by the PINCTRL
device. Use device_set_of_node_from_dev() helper which marks OF node as
reused, skipping erroneous execution of pinctrl_bind_pins() for the PMIC
device on the re-probe.

Fixes: aea6cb9970 ("regulator: resolve supply after creating regulator")
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20210523224243.13219-2-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-24 09:50:19 +01: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
Dmitry Baryshkov
98e48cd928
regulator: core: resolve supply for boot-on/always-on regulators
For the boot-on/always-on regulators the set_machine_constrainst() is
called before resolving rdev->supply. Thus the code would try to enable
rdev before enabling supplying regulator. Enforce resolving supply
regulator before enabling rdev.

Fixes: aea6cb9970 ("regulator: resolve supply after creating regulator")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20210519221224.2868496-1-dmitry.baryshkov@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-20 22:00:11 +01:00
Axel Lin
855bfff9d6
regulator: fixed: Ensure enable_counter is correct if reg_domain_disable fails
dev_pm_genpd_set_performance_state() may fail, so had better to check it's
return value before decreasing priv->enable_counter.

Fixes: bf3a28cf42 ("regulator: fixed: support using power domain for enable/disable")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Link: https://lore.kernel.org/r/20210520111811.1806293-1-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-20 17:57:23 +01:00
Axel Lin
687c9e3b1a
regulator: Check ramp_delay_table for regulator_set_ramp_delay_regmap
Return -EINVAL if ramp_delay_table is NULL.
Also add WARN_ON since the driver code needs fix if this happened.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Link: https://lore.kernel.org/r/20210519132255.1683863-1-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-19 14:31:43 +01:00
Axel Lin
79c7e1447c
regulator: fan53555: Cleanup unused define and redundant assignment
TCS_VSEL_NSEL_MASK is not used so remove it.
Also remove redundant assignment for di->slew_reg.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Link: https://lore.kernel.org/r/20210517010318.1027949-2-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-19 14:19:12 +01:00
Axel Lin
a7f003147b
regulator: fan53555: Fix slew_shift setting for tcs4525
Fix trivial copy-paste mistake.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Link: https://lore.kernel.org/r/20210517010318.1027949-1-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-19 14:19:11 +01:00
Luca Ceresoli
5258f7eed4 mfd: lp87565: Move LP87565_regulator_id to .c file
This enum is used only internally to the regulator driver for buck indexes.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2021-05-19 13:34:00 +01:00
Axel Lin
7075359c8e
regulator: fan53880: Convert to use .probe_new
Use the new .probe_new for fan53880.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Christoph Fritz <chf.fritz@googlemail.com>
Link: https://lore.kernel.org/r/20210517105325.1227393-2-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-18 14:04:34 +01:00
Axel Lin
3799fa23af
regulator: bd71815: Fix missing include files
Include linux/of.h and linux/gpio/consumer.h to fix below errors:
error: implicit declaration of function ‘of_match_ptr’
error: implicit declaration of function ‘devm_gpiod_get_from_of_node’

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Link: https://lore.kernel.org/r/20210518114843.1495152-1-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-18 14:04:33 +01:00
Axel Lin
34991ee96f
regulator: fan53880: Fix missing n_voltages setting
Fixes: e6dea51e2d ("regulator: fan53880: Add initial support")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Christoph Fritz <chf.fritz@googlemail.com>
Link: https://lore.kernel.org/r/20210517105325.1227393-1-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-18 14:04:22 +01:00
Axel Lin
0b1e552673
regulator: da9121: Return REGULATOR_MODE_INVALID for invalid mode
-EINVAL is not a valid return value for .of_map_mode, return
REGULATOR_MODE_INVALID instead.

Fixes: 65ac97042d ("regulator: da9121: add mode support")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/20210517052721.1063375-1-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-18 14:04:21 +01:00
Mark Brown
9b8756d6ee
Merge branch 'for-5.13' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-5.14 2021-05-12 17:55:27 +01:00
Peter Geis
b3cc8ec04f
regulator: fan53555: fix tcs4525 function names
The tcs4525 is based off the fan53526.
Rename the tcs4525 functions to align with this.

Signed-off-by: Peter Geis <pgwipeout@gmail.com>
Link: https://lore.kernel.org/r/20210511211335.2935163-4-pgwipeout@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-12 16:26:40 +01:00
Peter Geis
f9028dcdf5
regulator: fan53555: only bind tcs4525 to correct chip id
The tcs4525 regulator has a chip id of <12>.
Only allow the driver to bind to the correct chip id for safety, in
accordance with the other supported devices.

Signed-off-by: Peter Geis <pgwipeout@gmail.com>
Link: https://lore.kernel.org/r/20210511211335.2935163-3-pgwipeout@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-12 16:26:39 +01:00
Peter Geis
d4db69eba2
regulator: fan53555: fix TCS4525 voltage calulation
The TCS4525 has 128 voltage steps. With the calculation set to 127 the
most significant bit is disregarded which leads to a miscalculation of
the voltage by about 200mv.

Fix the calculation to end deadlock on the rk3566-quartz64 which uses
this as the cpu regulator.

Fixes: 914df8faa7 ("regulator: fan53555: Add TCS4525 DCDC support")
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
Link: https://lore.kernel.org/r/20210511211335.2935163-2-pgwipeout@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-12 16:26:39 +01:00
Mark Brown
adf1471b2f
Merge series "regulator: fan53555: tcs4525 fix and cleanup" from Peter Geis <pgwipeout@gmail.com>:
The tcs4525 voltage calculation is incorrect, which leads to a deadlock
on the rk3566-quartz64 board when loading cpufreq.
Fix the voltage calculation to correct the deadlock.
While we are at it, add a safety check and clean up the function names
to be more accurate.

Peter Geis (3):
  regulator: fan53555: fix TCS4525 voltage calulation
  regulator: fan53555: only bind tcs4525 to correct chip id
  regulator: fan53555: fix tcs4525 function names

 drivers/regulator/fan53555.c | 44 ++++++++++++++++++++++--------------
 1 file changed, 27 insertions(+), 17 deletions(-)

--
2.25.1
2021-05-12 16:22:53 +01:00
Peter Geis
f8c8871f5e
regulator: fan53555: fix TCS4525 voltage calulation
The TCS4525 has 128 voltage steps. With the calculation set to 127 the
most significant bit is disregarded which leads to a miscalculation of
the voltage by about 200mv.

Fix the calculation to end deadlock on the rk3566-quartz64 which uses
this as the cpu regulator.

Fixes: 914df8faa7 ("regulator: fan53555: Add TCS4525 DCDC support")
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
Link: https://lore.kernel.org/r/20210511211335.2935163-2-pgwipeout@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-12 16:22:21 +01:00
Axel Lin
3d681804ef
regulator: cros-ec: Fix error code in dev_err message
Show proper error code instead of 0.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Link: https://lore.kernel.org/r/20210512075824.620580-1-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-12 13:01:41 +01:00
Zou Wei
d019f38a1a
regulator: uniphier: Add missing MODULE_DEVICE_TABLE
This patch adds missing MODULE_DEVICE_TABLE definition which generates
correct modalias for automatic loading of this driver when it is built
as an external module.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
Link: https://lore.kernel.org/r/1620705198-104566-1-git-send-email-zou_wei@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-11 10:05:48 +01:00
Mark Brown
8c94df1e6f
Merge series "Enable VBUS current boost on pm8150b platforms" from Bryan O'Donoghue <bryan.odonoghue@linaro.org>:
V3:
- Drop the SoC regulator constraints for
  regulator-min-microamp
  regulator-max-microamp
  These will be applied on a per-board basis - Mark Brown

V2:
The first version of this patch set the current limit to 3 amps as was done
in downstream. Mark indicated a preference to set this on a per-system
basis instead of blitzing it, as in downstream.

Looking at what was upstream versus what was in my working tree I saw that
in fact the VBUS boost driver had been upstreamed minus accompanying DTS in
pm8150b.

So there's no need for a fixes as this driver doesn't appear to be in use.
A subsequent patchset will enable the VBUS boost for the two relevant
upstream platforms.

First thing though, is the driver + dts change.

- Use regulator_set_current_limit_regmap/regulator_get_current_limit_regmap
  with a relevant current-to-bitmap lookup.

- Add a parallel DTS entry to the pm8150b
  It looks like this was submitted upstream but not followed up on

  I've add regulator-min-microamp/regulator-max-microamp to Wesley's
  original work.

I've made sure to test that its possible to set the current to anything in
the range of 500 mA to 3 A and confirmed the output on a scope.

Once these two patches are in, I'll send out board enablement for the
sm8150-mtp and qrb5165-rb5.

https://lore.kernel.org/linux-arm-msm/8687acdb-75e9-5fc5-dd3e-9a19615676b5@linaro.org/T/#t

Bryan O'Donoghue (1):
  regulator: Add a routine to set the current limit for QCOM PMIC VBUS

Wesley Cheng (1):
  arm64: boot: dts: qcom: pm8150b: Add DTS node for PMIC VBUS booster

 arch/arm64/boot/dts/qcom/pm8150b.dtsi       |  6 ++++++
 drivers/regulator/qcom_usb_vbus-regulator.c | 12 ++++++++++++
 2 files changed, 18 insertions(+)

--
2.30.1
2021-05-11 09:06:04 +01:00
Axel Lin
4446e6f3bd
regulator: hi6421v600: Remove unneeded *pmic from struct hi6421_spmi_reg_info
Use rdev->regmap instead of pmic->regmap.
With this change, hi6421_spmi_regulator_disable can be removed and use
regulator_disable_regmap instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Link: https://lore.kernel.org/r/20210430085555.1127994-1-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-10 13:06:53 +01:00
Bartosz Dudziak
8c816d56a2
regulator: qcom_smd: Add PM8226 regulator support
Add support for PM8226 regulator which is commonly used with MSM8226 SoCs.

Signed-off-by: Bartosz Dudziak <bartosz.dudziak@snejp.pl>
Link: https://lore.kernel.org/r/20210502115304.8570-2-bartosz.dudziak@snejp.pl
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-10 13:06:52 +01:00
Bryan O'Donoghue
67823d9dad
regulator: Add a routine to set the current limit for QCOM PMIC VBUS
Add hooks to regulator_get_current_limit_regmap() and
regulator_set_current_limit_regmap() with an accompanying map of amperages.

This lets us use the existing helper functions to map requested current
settings to register bit-map/indicies.

This change is required to elevate the default 2 Amps set by the bootloader
to 3 Amps or indeed to constrain the value lower as the system design may
dictate.

The valid range is 500 mA to 3 A in increments of 500 mA.

Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Link: https://lore.kernel.org/r/20210427130712.2005456-2-bryan.odonoghue@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-10 13:06:50 +01:00
Linus Torvalds
71a5cc28e8 - Core Frameworks
- Add support for Software Nodes to MFD Core
    - Remove support for Device Properties from MFD Core
    - Use standard APIs in MFD Core
 
  - New Drivers
    - Add support for ROHM BD9576MUF and BD9573MUF PMICs
    - Add support for Netronix Embedded Controller, PWM and RTC
    - Add support for Actions Semi ATC260x PMICs and OnKey
 
  - New Device Support
    - Add support for DG1 PCIe Graphics Card to Intel PMT
    - Add support for ROHM BD71815 PMIC to ROHM BD71828
    - Add support for Tolino Shine 2 HD to Netronix Embedded Controller
    - Add support for AX10 BMC Secure Updates to Intel M10 BMC
 
  - Removed Device Support
    - Remove Arizona Extcon support from MFD
    - Remove ST-E AB8500 Power Supply code from MFD
    - Remove AB3100 altogether
 
  - New Functionality
    - Add support for SMBus and I2C modes to Dialog DA9063
    - Switch to using Software Nodes in Intel (various)
 
  - New/converted Device Tree bindings; rohm,bd71815-pmic, rohm,bd9576-pmic,
                                        netronix,ntxec, actions,atc260x,
 				       ricoh,rn5t618, qcom-pm8xxx
 
 - Fix-ups
    - Fix error handling/path; intel_pmt
    - Simplify code; rohm-bd718x7, ab8500-core, intel-m10-bmc
    - Trivial clean-ups (reordering, spelling); rohm-generic, rn5t618, max8997
    - Use correct data-type; db8500-prcmu
    - Remove superfluous code; lp87565, intel_quark_i2c_gpi, lpc_sch, twl
    - Use generic APIs/defines; lm3533-core, intel_quark_i2c_gpio
    - Regmap related fix-ups; intel-m10-bmc, sec-core
    - Reorder resource freeing during remove; intel_quark_i2c_gpio
    - Make table indexing more robust; intel_quark_i2c_gpio
    - Fix reference imbalances; arizona-irq
    - Staticify and (un)constify things; arizona-spi, stmpe, ene-kb3930,
                                         intel-lpss-acpi, intel-lpss-pci,
                                         atc260x-i2c, intel_quark_i2c_gpio
 
  - Bug Fixes
    - Fix incorrect (register) values; intel-m10-bmc
    - Kconfig related fixes; ABX500_CORE
    - Do not clear the Auto Reload Register; stm32-timers
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmCJIPEACgkQUa+KL4f8
 d2FRZA//Xu9f8u2uLuIfuhxIjUUXOqIjRAFnkhKlgGZhKsY8BohjQ80Tj9yp6UKy
 St6ABwACO0hJap4zL4FxPW9+HXTmqZvAibnvHnvZdYSQ3ai6x9h6kTNvhSNLeRQU
 fuY7eN8kpAHHiHNKNJCsQLQMvcIyP7+0KAP6qir5GYsMjiXspWq7THUnfBi2JXC6
 y60guDo9XrgmQTO+pB870UJrKLM/h+iiohNRGxLFlShKhFCgbTB/wyw6bFeKy1SB
 0/6XuY6fOt1IQyBDuzw383Q2faMWO9U+es29bwvFxdqJDK0MHQXC47zBba2q94wL
 /9i/HSoz9dRHnTJNYUKWsVcPv4T84w/Iq7scyDvE00ubehJ+oo/M7Au3M6Tt3M1/
 6lBAwFYXiwhQnp9EP3nwPwgJF6JzX1IGuMOsUAqrVFOEMuIkZKbRdUlatUhqepJT
 spV4/TOfztAhY/7BzEOZLnF8cFNjmL5sn42/UzSRW708V5SxuTNsS48KJ4l0c7Er
 CZSTlR/T1rKkWqf7ejaS2TNqMCdYyB3vZW0quDxZTHTZHv9huNUvtbKPR7jmd+4p
 mrMIik7EE4BzC5m8tBPnXXZl+Og0keeYv4LUDBuLDX1agrxYIErl4ITvQTqqMfX1
 Jt14SIjSO56iu2ngQuvGWwegVK4/urO2kBJKUAH1QN1OocNaajQ=
 =IJSL
 -----END PGP SIGNATURE-----

Merge tag 'mfd-next-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MFD updates from Lee Jones:
 "Core Framework:
   - Add support for Software Nodes to MFD Core
   - Remove support for Device Properties from MFD Core
   - Use standard APIs in MFD Core

  New Drivers:
   - Add support for ROHM BD9576MUF and BD9573MUF PMICs
   - Add support for Netronix Embedded Controller, PWM and RTC
   - Add support for Actions Semi ATC260x PMICs and OnKey

  New Device Support:
   - Add support for DG1 PCIe Graphics Card to Intel PMT
   - Add support for ROHM BD71815 PMIC to ROHM BD71828
   - Add support for Tolino Shine 2 HD to Netronix Embedded Controller
   - Add support for AX10 BMC Secure Updates to Intel M10 BMC

  Removed Device Support:
   - Remove Arizona Extcon support from MFD
   - Remove ST-E AB8500 Power Supply code from MFD
   - Remove AB3100 altogether

  New Functionality:
   - Add support for SMBus and I2C modes to Dialog DA9063
   - Switch to using Software Nodes in Intel (various)

  New/converted Device Tree bindings:
   - rohm bd71815-pmic, rohm bd9576-pmic, netronix ntxec, actions
     atc260x, ricoh rn5t618, qcom pm8xxx

- Fix-ups:
   - Fix error handling/path; intel_pmt
   - Simplify code; rohm-bd718x7, ab8500-core, intel-m10-bmc
   - Trivial clean-ups (reordering, spelling); rohm-generic, rn5t618,
     max8997
   - Use correct data-type; db8500-prcmu
   - Remove superfluous code; lp87565, intel_quark_i2c_gpi, lpc_sch, twl
   - Use generic APIs/defines; lm3533-core, intel_quark_i2c_gpio
   - Regmap related fix-ups; intel-m10-bmc, sec-core
   - Reorder resource freeing during remove; intel_quark_i2c_gpio
   - Make table indexing more robust; intel_quark_i2c_gpio
   - Fix reference imbalances; arizona-irq
   - Staticify and (un)constify things; arizona-spi, stmpe, ene-kb3930,
     intel-lpss-acpi, intel-lpss-pci, atc260x-i2c, intel_quark_i2c_gpio

  Bug Fixes:
   - Fix incorrect (register) values; intel-m10-bmc
   - Kconfig related fixes; ABX500_CORE
   - Do not clear the Auto Reload Register; stm32-timers"

* tag 'mfd-next-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (84 commits)
  mfd: intel-m10-bmc: Add support for MAX10 BMC Secure Updates
  Revert "mfd: max8997: Add of_compatible to Extcon and Charger mfd_cell"
  mfd: twl: Remove unused inline function twl4030charger_usb_en()
  dt-bindings: mfd: Convert pm8xxx bindings to yaml
  dt-bindings: mfd: Add compatible for pmk8350 rtc
  i2c: designware: Get rid of legacy platform data
  mfd: intel_quark_i2c_gpio: Convert I²C to use software nodes
  mfd: lpc_sch: Partially revert "Add support for Intel Quark X1000"
  mfd: arizona: Fix rumtime PM imbalance on error
  mfd: max8997: Replace 8998 with 8997
  mfd: core: Use acpi_find_child_device() for child devices lookup
  mfd: intel_quark_i2c_gpio: Don't play dirty trick with const
  mfd: intel_quark_i2c_gpio: Enable MSI interrupt
  mfd: intel_quark_i2c_gpio: Reuse BAR definitions for MFD cell indexing
  mfd: ntxec: Support for EC in Tolino Shine 2 HD
  mfd: stm32-timers: Avoid clearing auto reload register
  mfd: intel_quark_i2c_gpio: Replace I²C speeds with descriptive definitions
  mfd: intel_quark_i2c_gpio: Remove unused struct device member
  mfd: intel_quark_i2c_gpio: Unregister resources in reversed order
  mfd: Kconfig: ABX500_CORE should depend on ARCH_U8500
  ...
2021-04-28 15:59:13 -07: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
Linus Torvalds
37f00ab4a0 ARM: SoC drivers for v5.13
Updates for SoC specific drivers include a few subsystems that
 have their own maintainers but send them through the soc tree:
 
 TEE/OP-TEE:
  -  Add tracepoints around calls to secure world
 
 Memory controller drivers:
  - Minor fixes for Renesas, Exynos, Mediatek and Tegra platforms
  - Add debug statistics to Tegra20 memory controller
  - Update Tegra bindings and convert to dtschema
 
 ARM SCMI Firmware:
  - Support for modular SCMI protocols and vendor specific extensions
  - New SCMI IIO driver
  - Per-cpu DVFS
 
 The other driver changes are all from the platform maintainers
 directly and reflect the drivers that don't fit into any other
 subsystem as well as treewide changes for a particular platform.
 
 SoCFPGA:
  - Various cleanups contributed by Krzysztof Kozlowski
 
 Mediatek:
  - add MT8183 support to mutex driver
  - MMSYS: use per SoC array to describe the possible routing
  - add MMSYS support for MT8183 and MT8167
  - add support for PMIC wrapper with integrated arbiter
  - add support for MT8192/MT6873
 
 Tegra:
  - Bug fixes to PMC and clock drivers
 
 NXP/i.MX:
  - Update SCU power domain driver to keep console domain power on.
  - Add missing ADC1 power domain to SCU power domain driver.
  - Update comments for single global power domain in SCU power domain
    driver.
  - Add i.MX51/i.MX53 unique id support to i.MX SoC driver.
 
 NXP/FSL SoC driver updates for v5.13
  - Add ACPI support for RCPM driver
  - Use generic io{read,write} for QE drivers after performance optimized
    for PowerPC
  - Fix QBMAN probe to cleanup HW states correctly for kexec
  - Various cleanup and style fix for QBMAN/QE/GUTS drivers
 
 OMAP:
  - Preparation to use devicetree for genpd
  - ti-sysc needs iorange check improved when the interconnect target module
    has no control registers listed
  - ti-sysc needs to probe l4_wkup and l4_cfg interconnects first to avoid
    issues with missing resources and unnecessary deferred probe
  - ti-sysc debug option can now detect more devices
  - ti-sysc now warns if an old incomplete devicetree data is found as we
    now rely on it being complete for am3 and 4
  - soc init code needs to check for prcm and prm nodes for omap4/5 and dra7
  - omap-prm driver needs to enable autoidle retention support for omap4
  - omap5 clocks are missing gpmc and ocmc clock registers
  - pci-dra7xx now needs to use builtin_platform_driver instead of using
    builtin_platform_driver_probe for deferred probe to work
 
 Raspberry Pi:
  - Fix-up all RPi firmware drivers so as for unbind to happen in an
    orderly fashion
  - Support for RPi's PoE hat PWM bus
 
 Qualcomm
  - Improved detection for SCM calling conventions
  - Support for OEM specific wifi firmware path
  - Added drivers for SC7280/SM8350: RPMH, LLCC< AOSS QMP
 
 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmCC2JwACgkQmmx57+YA
 GNkgRg//cBtq2NyDbjiNABxFSkmGCfcc0w0C2wjVzr4cfg6BLTbuvvlpZxI912pu
 P1G2sbsdfQJ8sSeIyZos+PilWK0zHrqlaGZfKI19US45dMjpteDBgsPd7wNZwBjQ
 jbops3YLjztZK1HpY4dIdvMnfxt7yRqhBWaTbPuCwQ35c5KsOM8NHB3cP3BUINWK
 x1uuBCv9svppzwdDiPxneV93WKEzabOUo+WBMPyh5vnyvmW17Iif4BA/VKQxzymm
 mWUi8HHpKBpvntJOKwAD2hnLAdpR3SwX20SLOpyLhnJMotbzNUEqq3LdRxDNPdHk
 ry+rarJ78JGlYfpcfegf2bLf5ITNMfOyRGkjtzeYpcZIXPjufOg9DA9YtAy37k0u
 L0T/9gQ+tQ01WGMca77OyUtIqJKdblZrQMfuH/yGlR99bqFQMV7rNc7GNlX1MXp/
 zw4aOYrRWGtGEeAjx5JJWcYydvMSJpCrqxTz3YhgeJECHB2iA6YkV3NROR4TLW//
 tfxaKqxR/KmSqE6hoVOAuuQ0BLXNlql/+4EE6MKsAOBiKPJclvmJg4CyuY8G21ev
 9Su0zJnXMzai7gNu32v1pizGj26+AOhxCEgAG0mGgk2jlQSn24CKgm5e7kCUewcF
 j/1XksNPT95v/K8MsLpXe5xGvF3jhA1BlFfvjJNZOrcZywBXRxg=
 =iidq
 -----END PGP SIGNATURE-----

Merge tag 'arm-drivers-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc

Pull ARM SoC driver updates from Arnd Bergmann:
 "Updates for SoC specific drivers include a few subsystems that have
  their own maintainers but send them through the soc tree:

  TEE/OP-TEE:
   - Add tracepoints around calls to secure world

  Memory controller drivers:
   - Minor fixes for Renesas, Exynos, Mediatek and Tegra platforms
   - Add debug statistics to Tegra20 memory controller
   - Update Tegra bindings and convert to dtschema

  ARM SCMI Firmware:
   - Support for modular SCMI protocols and vendor specific extensions
   - New SCMI IIO driver
   - Per-cpu DVFS

  The other driver changes are all from the platform maintainers
  directly and reflect the drivers that don't fit into any other
  subsystem as well as treewide changes for a particular platform.

  SoCFPGA:
   - Various cleanups contributed by Krzysztof Kozlowski

  Mediatek:
   - add MT8183 support to mutex driver
   - MMSYS: use per SoC array to describe the possible routing
   - add MMSYS support for MT8183 and MT8167
   - add support for PMIC wrapper with integrated arbiter
   - add support for MT8192/MT6873

  Tegra:
   - Bug fixes to PMC and clock drivers

  NXP/i.MX:
   - Update SCU power domain driver to keep console domain power on.
   - Add missing ADC1 power domain to SCU power domain driver.
   - Update comments for single global power domain in SCU power domain
     driver.
   - Add i.MX51/i.MX53 unique id support to i.MX SoC driver.

  NXP/FSL SoC driver updates for v5.13
   - Add ACPI support for RCPM driver
   - Use generic io{read,write} for QE drivers after performance
     optimized for PowerPC
   - Fix QBMAN probe to cleanup HW states correctly for kexec
   - Various cleanup and style fix for QBMAN/QE/GUTS drivers

  OMAP:
   - Preparation to use devicetree for genpd
   - ti-sysc needs iorange check improved when the interconnect target
     module has no control registers listed
   - ti-sysc needs to probe l4_wkup and l4_cfg interconnects first to
     avoid issues with missing resources and unnecessary deferred probe
   - ti-sysc debug option can now detect more devices
   - ti-sysc now warns if an old incomplete devicetree data is found as
     we now rely on it being complete for am3 and 4
   - soc init code needs to check for prcm and prm nodes for omap4/5 and
     dra7
   - omap-prm driver needs to enable autoidle retention support for
     omap4
   - omap5 clocks are missing gpmc and ocmc clock registers
   - pci-dra7xx now needs to use builtin_platform_driver instead of
     using builtin_platform_driver_probe for deferred probe to work

  Raspberry Pi:
   - Fix-up all RPi firmware drivers so as for unbind to happen in an
     orderly fashion
   - Support for RPi's PoE hat PWM bus

  Qualcomm
   - Improved detection for SCM calling conventions
   - Support for OEM specific wifi firmware path
   - Added drivers for SC7280/SM8350: RPMH, LLCC< AOSS QMP"

* tag 'arm-drivers-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (165 commits)
  soc: aspeed: fix a ternary sign expansion bug
  memory: mtk-smi: Add device-link between smi-larb and smi-common
  memory: samsung: exynos5422-dmc: handle clk_set_parent() failure
  memory: renesas-rpc-if: fix possible NULL pointer dereference of resource
  clk: socfpga: fix iomem pointer cast on 64-bit
  soc: aspeed: Adapt to new LPC device tree layout
  pinctrl: aspeed-g5: Adapt to new LPC device tree layout
  ipmi: kcs: aspeed: Adapt to new LPC DTS layout
  ARM: dts: Remove LPC BMC and Host partitions
  dt-bindings: aspeed-lpc: Remove LPC partitioning
  soc: fsl: enable acpi support in RCPM driver
  soc: qcom: mdt_loader: Detect truncated read of segments
  soc: qcom: mdt_loader: Validate that p_filesz < p_memsz
  soc: qcom: pdr: Fix error return code in pdr_register_listener
  firmware: qcom_scm: Fix kernel-doc function names to match
  firmware: qcom_scm: Suppress sysfs bind attributes
  firmware: qcom_scm: Workaround lack of "is available" call on SC7180
  firmware: qcom_scm: Reduce locking section for __get_convention()
  firmware: qcom_scm: Make __qcom_scm_is_call_available() return bool
  Revert "soc: fsl: qe: introduce qe_io{read,write}* wrappers"
  ...
2021-04-26 12:11:52 -07:00
Linus Torvalds
8900d92fd6 Staging/IIO driver updates for 5.13-rc1
Here is the big set of staging and IIO driver updates for 5.13-rc1.
 
 Lots of little churn in here, and some larger churn as well.  Major
 things are:
 	- removal of wimax drivers, no one has this hardware anymore for
 	  this failed "experiment".
 	- removal of the Google gasket driver, turns out no one wanted
 	  to maintain it or cares about it anymore, so they asked for it
 	  to be removed.
 	- comedi finally moves out of the staging directory into
 	  drivers/comedi/  This is one of the oldest kernel subsystems
 	  around, being created in the 2.0 kernel days, and was one of
 	  the first things added to drivers/staging/ when that was
 	  created over 15 years ago.  It should have been moved out of
 	  staging a long time ago, it's well maintained and used by
 	  loads of different devices in the real world every day.  Nice
 	  to see this finally happen.
 	- so many tiny coding style cleanups it's not funny.  Perfect
 	  storm of at least 2 different intern project application
 	  deadlines combined to provide a huge number of new
 	  contributions in this area from people learning how to do
 	  kernel development.  Great job to everyone involved here.
 
 There's also the normal updates for IIO drivers with new IIO drivers and
 updates all over that subsystem.
 
 All of these have been in linux-next for a while with no reported
 issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCYIa1zw8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ykfMACgq/Qj9n6NO/P4BX55XWjRkjOmxxwAoKrYEWkG
 fIdLmhh4FGWkxaJO3Izf
 =PCXb
 -----END PGP SIGNATURE-----

Merge tag 'staging-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging/IIO driver updates from Greg KH:
 "Here is the big set of staging and IIO driver updates for 5.13-rc1.

  Lots of little churn in here, and some larger churn as well. Major
  things are:

   - removal of wimax drivers, no one has this hardware anymore for this
     failed "experiment".

   - removal of the Google gasket driver, turns out no one wanted to
     maintain it or cares about it anymore, so they asked for it to be
     removed.

   - comedi finally moves out of the staging directory into drivers/comedi

     This is one of the oldest kernel subsystems around, being created
     in the 2.0 kernel days, and was one of the first things added to
     drivers/staging/ when that was created over 15 years ago.

     It should have been moved out of staging a long time ago, it's well
     maintained and used by loads of different devices in the real world
     every day. Nice to see this finally happen.

   - so many tiny coding style cleanups it's not funny.

     Perfect storm of at least 2 different intern project application
     deadlines combined to provide a huge number of new contributions in
     this area from people learning how to do kernel development. Great
     job to everyone involved here.

  There's also the normal updates for IIO drivers with new IIO drivers
  and updates all over that subsystem.

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'staging-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (907 commits)
  staging: octeon: Use 'for_each_child_of_node'
  Staging: rtl8723bs: rtw_xmit: fixed tabbing issue
  staging: rtl8188eu: remove unused function parameters
  staging: rtl8188eu: cmdThread is a task_struct
  staging: rtl8188eu: remove constant variable and dead code
  staging: rtl8188eu: change bLeisurePs' type to bool
  staging: rtl8723bs: remove empty #ifdef block
  staging: rtl8723bs: remove unused DBG_871X_LEVEL macro declarations
  staging: rtl8723bs: split too long line
  staging: rtl8723bs: fix indentation in if block
  staging: rtl8723bs: fix code indent issue
  staging: rtl8723bs: replace DBG_871X_LEVEL logs with netdev_*()
  staging: rtl8192e: indent statement properly
  staging: rtl8723bs: Remove led_blink_hdl() and everything related
  staging: comedi: move out of staging directory
  staging: rtl8723bs: remove sdio_drv_priv structure
  staging: rtl8723bs: remove unused argument in function
  staging: rtl8723bs: remove DBG_871X_SEL_NL macro declaration
  staging: rtl8723bs: replace DBG_871X_SEL_NL with netdev_dbg()
  staging: rtl8723bs: fix indentation issue introduced by long line split
  ...
2021-04-26 11:14:21 -07:00
Joseph Chen
914df8faa7
regulator: fan53555: Add TCS4525 DCDC support
TCS4525 main features:

- 2.7V to 5.5V Input Voltage Range;
- 3MHz Constant Switching Frequency;
- 5A Available Load Current;
- Programmable Output Voltage: 0.6V to 1.4V in 6.25mV Steps;
- PFM/PWM Operation for Optimum Increased Efficiency;

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
[Ezequiel: Forward port]
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Link: https://lore.kernel.org/r/20210421210338.43819-3-ezequiel@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-23 15:36:15 +01:00
Vincent Whitchurch
a8ce7bd896
regulator: core: Fix off_on_delay handling
The jiffies-based off_on_delay implementation has a couple of problems
that cause it to sometimes not actually delay for the required time:

 (1) If, for example, the off_on_delay time is equivalent to one jiffy,
     and the ->last_off_jiffy is set just before a new jiffy starts,
     then _regulator_do_enable() does not wait at all since it checks
     using time_before().

 (2) When jiffies overflows, the value of "remaining" becomes higher
     than "max_delay" and the code simply proceeds without waiting.

Fix these problems by changing it to use ktime_t instead.

[Note that since jiffies doesn't start at zero but at INITIAL_JIFFIES
 ("-5 minutes"), (2) above also led to the code not delaying if
 the first regulator_enable() is called when the ->last_off_jiffy is not
 initialised, such as for regulators with ->constraints->boot_on set.
 It's not clear to me if this was intended or not, but I've preserved
 this behaviour explicitly with the check for a non-zero ->last_off.]

Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Link: https://lore.kernel.org/r/20210423114524.26414-1-vincent.whitchurch@axis.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-23 13:18:35 +01:00
Mark Brown
41a36ffc18
Merge branch 'for-5.12' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-5.13 2021-04-23 13:17:36 +01:00
Vincent Whitchurch
a5ccccb3ec
regulator: core: Respect off_on_delay at startup
We currently do not respect off_on_delay the first time we turn on a
regulator.  This is problematic since the regulator could have been
turned off by the bootloader, or it could it have been turned off during
the probe of the regulator driver (such as when regulator-fixed requests
the enable GPIO), either of which could potentially have happened less
than off_on_delay microseconds ago before the first time a client
requests for the regulator to be turned on.

We can't know exactly when the regulator was turned off, but initialise
off_on_delay to the current time when registering the regulator, so that
we guarantee that we respect the off_on_delay in all cases.

Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Link: https://lore.kernel.org/r/20210422083044.11479-1-vincent.whitchurch@axis.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-22 16:27:34 +01:00
Mark Brown
823543b739
Merge series "mfd/rtc/regulator: Drop board file support for Samsung PMIC" from Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>:
Hi,

The Samsung PMIC drivers since long time are used only on devicetree
platforms (Samsung Exynos) and there are no users with board files.

Drop the support for board files entirely and depend on OF for matching.

This makes the code smaller and simpler.

Dependencies
============
The MFD pieces are rebased on my previous sec-core dirver changes:
mfd: sec: Simplify getting of_device_id match data
https://lore.kernel.org/linux-samsung-soc/20210420113929.278082-1-krzysztof.kozlowski@canonical.com/T/#t

Applying - can be independent
=============================
The last RTC and regulator patches can be picked up independently via
regulator and rtc trees.  There are no board files currently, so the
code in these drivers is basically dead code and feature-bisection is
preserved.

Best regards,
Krzysztof

Krzysztof Kozlowski (9):
  mfd: sec: Drop support for board files and require devicetree
  mfd: sec: Remove unused cfg_pmic_irq in platform data
  mfd: sec: Remove unused device_type in platform data
  mfd: sec: Remove unused irq_base in platform data
  mfd: sec: Enable wakeup from suspend via devicetree property
  mfd: sec: Remove unused platform data members
  rtc: s5m: Remove reference to parent's device pdata
  regulator: s2mpa01: Drop initialization via platform data
  regulator: s2mps11: Drop initialization via platform data

 drivers/mfd/Kconfig              |  1 +
 drivers/mfd/sec-core.c           | 64 +++++---------------------------
 drivers/mfd/sec-irq.c            |  4 +-
 drivers/regulator/s2mpa01.c      |  4 --
 drivers/regulator/s2mps11.c      | 22 +----------
 drivers/rtc/rtc-s5m.c            |  6 ---
 include/linux/mfd/samsung/core.h | 33 ----------------
 7 files changed, 14 insertions(+), 120 deletions(-)

--
2.25.1
2021-04-21 19:35:06 +01:00
Sebastian Fricke
72241e3190
regulator: core.c: Improve a comment
s/regulator may on/regulator may already be enabled/
s/or left on/or was left on/

The aim of this patch is to make the comment more readable and to make
it clear, that this is about a regulator, that is already enabled instead
of a regulator that may be switched on.

Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net>
Link: https://lore.kernel.org/r/20210421055236.13148-1-sebastian.fricke@posteo.net
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-21 15:54:57 +01:00
Christophe JAILLET
8a065ce92b
regulator: Avoid a double 'of_node_get' in 'regulator_of_get_init_node()'
'for_each_available_child_of_node()' already performs an 'of_node_get()'
on child, so there is no need to perform another one before returning.
Otherwise, a double 'get' is performed and a resource may never be
released.

Fixes: 925c85e21e ("regulator: Factor out location of init data OF node")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/a79f0068812b89ff412d572a1171f22109c24132.1618947049.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-21 15:54:56 +01:00
Shubhankar Kuranagatti
69b8821e29
regulator: core.c: Fix indentation of comment
Shifted the closing */ of multiline comment to a new line
This is done to maintain code uniformity

Signed-off-by: Shubhankar Kuranagatti <shubhankarvk@gmail.com>
Link: https://lore.kernel.org/r/20210420034718.t7wudu6xcfpahflv@kewl-virtual-machine
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-21 15:54:55 +01:00
Krzysztof Kozlowski
beeab9bc8e
regulator: s2mps11: Drop initialization via platform data
None of the platforms with S2MPS11 use board files, so any
initialization via platform data can be safely removed.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Link: https://lore.kernel.org/r/20210420170244.13467-5-krzysztof.kozlowski@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-21 15:51:43 +01:00
Krzysztof Kozlowski
378b40ae1a
regulator: s2mpa01: Drop initialization via platform data
None of the platforms with S2MPA01 use board files, so any
initialization via platform data can be safely removed.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Link: https://lore.kernel.org/r/20210420170244.13467-4-krzysztof.kozlowski@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-21 15:51:42 +01:00
Adam Ward
013592be14
regulator: da9121: automotive variants identity fix
This patch fixes identification of DA913x parts by the DA9121 driver,
where a lack of clarity lead to implementation on the basis that variant
IDs were to be identical to the equivalent rated non-automotive parts.

There is a new emphasis on the DT identity to cope with overlap in these
ID's - this is not considered to be problematic, because projects would
be exclusively using automotive or consumer grade parts.

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/20210421120306.DB5B880007F@slsrvapps-01.diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-21 15:49:51 +01:00
Greg Kroah-Hartman
a00fcbc115 Linux 5.12-rc7
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAmBzdS0eHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGDdAIAIpKH/tAHhH7s7QH
 m5ewgE8foP7M5Ue9fp3+JmbtaYSzhCAMcKhqGtat/zk5PvA9AoYCDXrTetfYtBHh
 LUOmhL9hcKItNobfkYBok6BiFjGUEL3HMqz5w+MUsMwnXIc4RXqfJmsQ932z9Kxf
 yDwe6ehIzJVrQLI/C0mTamYRHu2aiZ1VWzhKuT493rLeg0R2odCCIClPN+/QvCwb
 8/sk6l1c8eOUYYMUzKFZifaZGb12qDjRt4pZmk51aMTzg0WCpElJG+7Uqr4QQhZP
 p6xeNuUQq6WwxtlDkmo79Uzkrurb5tN2/hZ1RcJhs3EdHfpR0MjIyH3Znnb31gnu
 39VjHhg=
 =4KP/
 -----END PGP SIGNATURE-----

Merge tag 'v5.12-rc7' into driver-core-next

We need the driver core fix in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-14 19:53:39 +02:00
Lee Jones
1658d6242a Immutable branch between MFD, Clock, GPIO, Regulator and RTC due for the v5.13 merge window
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmB2tEoACgkQUa+KL4f8
 d2GqwRAAoslBlgvaQy5UB/dD1sVFzNNeqUhXJIYHMN0AvC5BRiysEBUqWotf0CKp
 ywl34SRiEyZ7RAgyYZpZ3gR7pmx8tPSf8PzKMLyZgzOfj5JjEM35Qu7oxPpi7Cnl
 g6kRvlUyVHeFS0uNkUORg7pG3MA43kx6u2SjjEHIyPdDgjmT9QWHH8/8sQdv++Hs
 AOFvsqe5rIpyDKvY0h/xG018AMq8Gr3kZNCg2rYPoxzzjXWZK5CPInzbLnrkZ0Nh
 HEehgtEYN+QmFp6tU1AdJXDReEckQkyOGJ1jSy5sPAKWJ0NKKzaTjwcP8T0KN7Nw
 03VYhA6iom9U4oQGVxZLKKm20QRvevx2ZzYU8yK9qEamwsGADBwlNxO1v3C4dYUT
 AC1xrmu570Hr7EaZYQkU0s4kjqIyZfm9JOTcsltOGYACvE34tgIMiIR5qu1VXnmX
 OcOBUGiQqFovu+zYgHvMhggjclTYu5xM+DH7coi9iFLc7FftbjXF+T8Q/EV/qAfL
 SaVbCQ1XYMefA92pI4kntHMhTe+eNSEDHodc1Tuw/dN4kEJ82R13WpCojH5L739I
 VXaB7GO11W6iVD1wgmv03pf2Ce+TLifHZE90t8GSh5zztND1qI60c3Mc4KOSkGHU
 i5qbGdyFph2MYnWzydPJgSNXoCzLsT/sHwABprOIa7/05mNfEyc=
 =7O9a
 -----END PGP SIGNATURE-----
mergetag object a908a71669
 type commit
 tag ib-mfd-extcon-v5.13
 tagger Lee Jones <lee.jones@linaro.org> 1616067995 +0000
 
 Immutable branch between MFD and Extcon due for the v5.13 merge window
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmBTPZsACgkQUa+KL4f8
 d2Ew4g/8CZnru5gfuR2uMZIReS8Q4RniTKe3IoQNGE+nyZFp8heJm5sJ/tcHzHuX
 RcBbuY9hLhhZRvQ+WrveYiXYdC3tH/8j/5mHj6CLJDwh8ukEf9H/tcNAx1T0Y8by
 C3Y/lY7avAzfTorJQ2g+LRkbuei3mojTpUuEiwgdJEzydbg/GzYVv2edRvdCkW0Y
 6xCg8ufmWBTjrHHoXm4/wtGSJ2L17coieSRSIiQ4KsGf8xM6QAnUEXbwQV3KjlVS
 SbI0gucfjnYYdsYqrPy+yyA8gzA5utP/0Zis4pfDG1Av1dBm6ZfD5n/z+KYyJUoG
 C1GPkqxukZODBitwO6PdCoHpFTsbwfoqz6HD8o+6oFqScdBtU7C8SectMpis0G4/
 j3VrstGL6T0GgzuVmy5EnpPkqyiiJh3Smv5ZS91Rztiy4CTTvLlkrw5+h0GP9aR7
 uUfNmQU65KCG4WscnwuWeImcQzxRAlsiI0QxXFmHhIxZFG8Bq2z11V5rcpYdJXgx
 GbkOml6iq+G1UQu3sKYgLlE2Lg3IlehjytAbpY0Qoj9VE1FeE8STgYQMEwT5TqIB
 Em6T1fkpXp2kho92rmJ+rjcAJp7rKmlSQHO0xgbJwbzZsA5rKvClAn3PZmoZs7HY
 VHmeWjPihoo7qJTx7LVhWEtYptKG31JqCRPFTbVXjeCvClnjcFU=
 =3CZN
 -----END PGP SIGNATURE-----
mergetag object eac013a0b7
 type commit
 tag ib-mfd-input-v5.13-1
 tagger Lee Jones <lee.jones@linaro.org> 1615374673 +0000
 
 Immutable branch between MFD and Input due for the v5.13 merge window
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmBIqV8ACgkQUa+KL4f8
 d2EmIw//fydErEBA/TsNSSMfAxK+WRY3xDFdTwK9NorfJiyPFMwsfIZ2Y0BdGHpa
 cNz4EMqcfKgHzblbla5EOW64RDIIFQfDTiuCJTGaTB5LUlI56hnKEuiKlrtKlQMC
 3ZSxY5+SY5OFwof4LFPCASyn0N3bH8Mdd1inyFAIphFrgHKez353B9N2RwePlpLq
 7jWaGABQVo28cPpkLl3Slo064xadzS2+Sklwii8gOOvtAGMkLkvLpFEcGCNFRX7l
 OBnw8QP3SCg14b7hrtSys2g7onpH3M5eDt5LwJVqOXEY5SCWJUoultF0msNuGVlq
 XGxJATebx0iU3IByhgTFmzj3ymCWZ7I/EeXD1GI0Fn5EscK1AsrRimlQNcxq9Nm7
 tb/mV3FZlkNi6FjOq/rQ90QgT20t74tGrU9qpXlbwpB2Z9jO3GCDTFLt0XQFEE/4
 83nqIjhYfbpkNXfRTH6/FPtFWqpfw+U8/kNMNWSk9BNta+67++vBQzeFAYWC6hFK
 m7LTzyDNb/EHstAYdXIDblEX4x1VLOilKMaltRqlQC9sUZ4ZpA4YxFJKX21mtGBX
 0jrM2SLeBff+Xv4i/UdoiGBC2uWiBPWW0G94IkDwpCM272q5br8LxTuKIzWCv4w4
 /4J8bXtVfmXl74lXw90ZnMwHApq95+yPDd2g8XTcdo+zctSqS6E=
 =NF6J
 -----END PGP SIGNATURE-----
mergetag object aa47ad3f85
 type commit
 tag ib-mfd-platform-x86-v5.13
 tagger Lee Jones <lee.jones@linaro.org> 1615373744 +0000
 
 Immutable branch between MFD and Platform/x86 due for the v5.13 merge window
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmBIpbAACgkQUa+KL4f8
 d2H/NA//bVtt5HlRE0LE8QYOrP2+KmAOOOmIH4eU4eTfn82xMWVmsX+1AsC7ANx0
 eq2pPB3BDQU2MkT9YvtZCud5/3TKYPJfzDl5qppkYTxS7BgRPPnFMXLSi5CofiH9
 dDYSE1Iv0XMPBboJoce/RaBck/yWm5DLWHUR2w8Nc3n61uHCFrPBZeI058ZZXYnh
 DZyiItaVIHDs1jIrVjS87SGcIoSXjfWgBFQkTS9jLneZcC0HRebGA78raEHzeBVK
 Zpx5syisRoPkT+Hxb+Qe28ffqf9Qc/RyOpRnhmCDA0xxskembakati/XhnHtbHaT
 kXmSvsC+OeDXZw8jeVTPz8ZGEmd4H2GLXuVAMuQbOlfuPZgFP+9V5C4LFu2oiT9v
 t9USjr3VgqjGocVntP9B1PgqiDlHuzLinvB614WYPFIXiHJa0xKoEzTQlUbUTn22
 v9Tvyfgx5oczktpavCm3YzgWRyFxphaE++vSIBOJlACoqYQT6At0wnn2qr2+mTL0
 dZy6H/vEXLQFGRcwDmHWDRBoU9D1QTQzWIsl8u8+Pq9SGoa12YmpwOjsuK3WP3wS
 iRl1q35AuyEp6zaclowlW4qcTGlwRMN5rUzReMmRbfg3xqwxj6FwxY87fYtDc7Uu
 E3dklJjeZeSGw3rAJSRQzm0JMhlkRWyFdZ6KPxfnWzsPmrza2vY=
 =340a
 -----END PGP SIGNATURE-----
mergetag object ee0975c308
 type commit
 tag ib-mfd-power-v5.13
 tagger Lee Jones <lee.jones@linaro.org> 1616489771 +0000
 
 Immutable branch between MFD and Power due for the v5.13 merge window
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmBZrSsACgkQUa+KL4f8
 d2EyiA/9GRBj8piXoHnlqA4lkExInTddmts2r7aDtmPa1iCUT5XeyIoiSWdnFz++
 fr9ion87/T89zVJWLMGHi5HRlOEQwR0eG8VUF7rAp8qV9ANOOB8sYi0KC4k1ADet
 +SNTqUYIbA3xrlH+DSPBRmyWMJ6EHkrtmzBCO4PUyxEexFFGSGz3BuEkCdhKMsUb
 /t/AqxLEs9v8dHOIWHTlKK9M1divTdBkqN8mwUfGMDqvtCpFXIuSZ3koTnK9wJyd
 Pqw+5XAoL8cMfSkQrwIpZGRdzyCa9f0iOJz8gdYYKxq1575zGxUTM53z3MYb+ujX
 ei3oO99bCNLezcWozBNEJIlk4LK2FdzWFrlimsxE+2IStH9p1TE3voWFUJh+tL3f
 mbYHNJr35pBNRXA07iQccA9V2zCFAeN4GaeRrY59blcfw8fvOGcWwni8YDbWmmGz
 E/xYv7WeNtrzrELNDMpGJ4w909EItfXEsWyzItJBhI5ThsRPOpET7uBolkEfbd5M
 jjGM2pGeLq++Zd1c2kBzc3a2gW60iGNI6dMBpZWCwCCPe1Vz7okiu1hVULMYYXgZ
 B7F8xzM60phdlMUrFu/tFyYPOs8/0w8tk5QjGiD7/FkLsFhD6UdJsD0r02PCtqN+
 4BRGwOmZWED83XVDTkwVR61GWPP7mWl5AUywe2XdPBo6/jhWTBY=
 =+5eM
 -----END PGP SIGNATURE-----
mergetag object edbda8f787
 type commit
 tag ib-mfd-pwm-rtc-v5.13-1
 tagger Lee Jones <lee.jones@linaro.org> 1615374433 +0000
 
 Immutable branch between MFD, PWM and RTC due for the v5.13 merge window
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmBIqH8ACgkQUa+KL4f8
 d2F8EhAAi4vdKdfmlkJYcOS/wwWHR+wF3LOrTdmv80oP19/QY5Ctk/zgjYOmet+K
 WOLFOH0WCwp+NlEpiFDhlhAqApFNw4F24Dp4iiMGfYF+ohpoDNMIV9bYC9PpLeF1
 IsXo/vRsYQN9JtHZEHlICbw+W60jfTx4F1woQVuMM1sTIb65DVlHHEGKBFH4v+ys
 fXZWTIhMCnVrJvM26dU4YZ0uj3RbAZlzK5itOzIwaU6OLitc0XlFGH+zsIiHioNl
 wsfJJc5WzeJwCbanqsdiA+lAQ3oRhzns0bOSeTyf0xWS1HzKSMBhpkvGLa//5kmD
 I5HEtw46OvWtvZ8AaBVeHVlIGZ+00Yxs3ORFK/koGOFcTayh/7QjhS8/wSIW0yp8
 Nxwr8OXpHLicJceIm7/1OpfSbawnY0f93Cu2c6rzDLWz0JTzO6f5EmfFr8I/T+bB
 7gexysH3JoOYutsPD9EsEoaexFx4ZsYSoPQJ5Jf74pmMJUUkDwzSo2DQb34DM8Ja
 uRwka56ayuubhEX8jd5hru/X7Ikl2GYoMG/ZsZ09BfWhGA3F55R6cn0+UiEwj03M
 rn6/FSl8EHgAQ5W7JT85rucbBAT2HmuZWV2OFSM3ldlD1Tws/GucDRELn9q37YpS
 w7bq+hXd6sHEJnx1vtVnJoXx+0DJdZ00koj4h3xdNm936p7K9/w=
 =DySP
 -----END PGP SIGNATURE-----

Merge tags 'ib-mfd-clk-gpio-regulator-rtc-v5.13', 'ib-mfd-extcon-v5.13', 'ib-mfd-input-v5.13-1', 'ib-mfd-platform-x86-v5.13', 'ib-mfd-power-v5.13', 'ib-mfd-pwm-rtc-v5.13-1' and 'ib-regulator-list-ramp-helpers-v5.13' into ibs-for-mfd-merged

Immutable branch between MFD, Clock, GPIO, Regulator and RTC due for the v5.13 merge window

Immutable branch between MFD and Extcon due for the v5.13 merge window

Immutable branch between MFD and Input due for the v5.13 merge window

Immutable branch between MFD and Platform/x86 due for the v5.13 merge window

Immutable branch between MFD and Power due for the v5.13 merge window

Immutable branch between MFD, PWM and RTC due for the v5.13 merge window
2021-04-14 15:59:22 +01:00
Matti Vaittinen
1aad39001e regulator: Support ROHM BD71815 regulators
Support voltage control for regulators on ROHM BD71815 PMIC.

ROHM BD71815 contains 5 bucks, 7 LDOs and a boost (intended for LED).
Bucks 1 and 2 support HW state based voltage level and enable states. Other
regulators support HW state based enable states. All bucks and LDOs 1-5
allow voltage changes for RUN state and LDO4 can be enabled/disabled via
GPIO.

LDO3 does support changing between two predetermined voltages by using
a GPIO but this functionality is not included in this commit.

This work is derived from driver originally written by Tony Luo
<luofc@embedinfo.com> - although not much of original work is left.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2021-04-14 10:20:50 +01:00
Matti Vaittinen
18f3c62586 regulator: bd718x7, bd71828: Use ramp-delay helper
Use generic regamp ramp-delay helper function instead of implementing own.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2021-04-14 10:19:59 +01:00
Matti Vaittinen
80a7117064 regulator: rohm-regulator: Support SNVS HW state.
The ROHM BD71815 supports setting voltage levels/regulator status
for HW-states "RUN", "SUSPEND", "LPSR" and "SNVS". Add DT parsing
helper also for SNVS state.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2021-04-14 10:19:48 +01:00
Matti Vaittinen
9cf37cec4b regulator: rohm-regulator: linear voltage support
The helper for obtaining HW-state based DVS voltage levels currently only
works for regulators using linear-ranges. Extend support to regulators with
simple linear mappings and add also proper error path if pickable-ranges
regulators call this.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2021-04-14 10:19:36 +01:00
Mark Brown
aaa8c4e05e
Merge series "Support ROHM BD71815 PMIC" from Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>:
Patch series introducing support for ROHM BD71815 PMIC

ROHM BD71815 is a power management IC used in some battery powered
systems. It contains regulators, GPO(s), charger + coulomb counter, RTC
and a clock gate.

All regulators can be controlled via I2C. LDO4 can additionally be set to
be enabled/disabled by a GPIO. LDO3 voltage could be selected from two
voltages written into separate VSEL reisters using GPIO but this mode is
not supported by driver. On top of that the PMIC has the typical HW
state machine which is present also on many other ROHM PMICs.

IC contains two GPOs - but one of the GPOs is marked as GND in
data-sheet. Thus the driver by default only exposes one GPO. The second
GPO can be enabled by special DT property.

RTC is almost similar to what is on BD71828. For currently used features
only the register address offset to RTC block differs.

The charger driver is not included in this series. ROHM has a charger
driver with some fuel-gauging logig written in but this is not included
here. I am working on separating the logic from HW specific driver and
supporting both BD71815 and BD71828 chargers in separate patch series.

Changelog v5:
  Regulator:
  - Added regmap helper for regulator ramp-delay and taken it in use
    (patches 13, 14, 16 - they can be just dropped if ramp-delay helper is not
    a good idea. Patch 15 implements old-fashioned ramp-delay)
  GPIO:
  - styling changes to GPIO (Mostly suggested by Andy)
  - implemented init_valid_mask (but can't count on it yet)
Changelog v4:
  - Sorted ROHM chip ID enum
  - Statcized DVS structures in regulator driver
  - Minor styling for regulator driver
  - rebased on v5.12-rc4
Changelog v3:
  - GPIO clean-up as suggested by Bartosz
  - MFD clean-up as suggested by Lee
  - clk-mode dt-binding handling in MFD driver corrected to reflect new
    property values.
  - Dropped already applied patches
  - Rebased on v5.12-rc2
Changelog v2:
  - Rebased on top of v5.11-rc3
  - Added another "preliminary patch" which fixes HW-dvs voltage
    handling (patch 1)
  - split regulator patch to two.
  - changed dt-binding patch ordering.
  regulators:
    - staticized probe
    - removed some unnecessary defines
    - updated comments
    - split rohm-regulator patch adding SNVS and supporting simple
      linear mapping into two - one adding support for mapping, other
      adding SNVS.
  GPIO:
    - removed unnecessary headers
    - clarified dev/parent->dev usage
    - removed forgotten #define DEBUG
  dt-bindings:
    - changed patch order to meet ref-dependencies
    - added missing regulator nodes
    - changed string property for clk mode to tristated
  MFD:
    - header cleanups.
  CLK:
    - fixed commit message

--

Matti Vaittinen (19):
  rtc: bd70528: Do not require parent data
  mfd: bd718x7: simplify by cleaning unnecessary device data
  dt_bindings: bd71828: Add clock output mode
  dt_bindings: regulator: Add ROHM BD71815 PMIC regulators
  dt_bindings: mfd: Add ROHM BD71815 PMIC
  mfd: Add ROHM BD71815 ID
  mfd: Sort ROHM chip ID list for better readability
  mfd: Support for ROHM BD71815 PMIC core
  gpio: support ROHM BD71815 GPOs
  regulator: helpers: Export helper voltage listing
  regulator: rohm-regulator: linear voltage support
  regulator: rohm-regulator: Support SNVS HW state.
  regulator: Add regmap helper for ramp-delay setting
  regulator: bd718x7, bd71828: Use ramp-delay helper
  regulator: Support ROHM BD71815 regulators
  regulator: bd71815: use ramp-delay helper
  clk: bd718x7: Add support for clk gate on ROHM BD71815 PMIC
  rtc: bd70528: Support RTC on ROHM BD71815
  MAINTAINERS: Add ROHM BD71815AGW

 .../bindings/mfd/rohm,bd71815-pmic.yaml       | 201 ++++++
 .../bindings/mfd/rohm,bd71828-pmic.yaml       |   6 +
 .../regulator/rohm,bd71815-regulator.yaml     | 116 ++++
 MAINTAINERS                                   |   3 +
 drivers/clk/clk-bd718x7.c                     |   9 +-
 drivers/gpio/Kconfig                          |  10 +
 drivers/gpio/Makefile                         |   1 +
 drivers/gpio/gpio-bd71815.c                   | 193 ++++++
 drivers/mfd/Kconfig                           |  15 +-
 drivers/mfd/rohm-bd71828.c                    | 486 +++++++++----
 drivers/mfd/rohm-bd718x7.c                    |  43 +-
 drivers/regulator/Kconfig                     |  11 +
 drivers/regulator/Makefile                    |   1 +
 drivers/regulator/bd71815-regulator.c         | 651 ++++++++++++++++++
 drivers/regulator/bd71828-regulator.c         |  51 +-
 drivers/regulator/bd718x7-regulator.c         |  60 +-
 drivers/regulator/helpers.c                   | 101 ++-
 drivers/regulator/rohm-regulator.c            |  23 +-
 drivers/rtc/Kconfig                           |   6 +-
 drivers/rtc/rtc-bd70528.c                     | 104 +--
 include/linux/mfd/rohm-bd71815.h              | 562 +++++++++++++++
 include/linux/mfd/rohm-bd71828.h              |   3 +
 include/linux/mfd/rohm-bd718x7.h              |  13 -
 include/linux/mfd/rohm-generic.h              |  15 +-
 include/linux/regulator/driver.h              |   7 +
 25 files changed, 2393 insertions(+), 298 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/rohm,bd71815-pmic.yaml
 create mode 100644 Documentation/devicetree/bindings/regulator/rohm,bd71815-regulator.yaml
 create mode 100644 drivers/gpio/gpio-bd71815.c
 create mode 100644 drivers/regulator/bd71815-regulator.c
 create mode 100644 include/linux/mfd/rohm-bd71815.h

base-commit: 0d02ec6b31
--
2.25.4

--
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =]
2021-04-02 20:29:01 +01:00
Matti Vaittinen
fb8fee9efd
regulator: Add regmap helper for ramp-delay setting
Quite a few regulator ICs do support setting ramp-delay by writing a value
matching the delay to a ramp-delay register.

Provide a simple helper for table-based delay setting.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Link: https://lore.kernel.org/r/f101f1db564cf32cb58719c77af0b00d7236bb89.1617020713.git.matti.vaittinen@fi.rohmeurope.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-02 18:33:59 +01:00
Matti Vaittinen
e3baacf542
regulator: helpers: Export helper voltage listing
Some drivers need to translate voltage values to selectors prior regulator
registration. Currently a regulator_desc based list_voltages helper is only
exported for regulators using the linear_ranges. Export similar helper also
for regulators using simple linear mapping.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Link: https://lore.kernel.org/r/1200ef7a50c84327ada019b85f6527b4fc9b5ce1.1617020713.git.matti.vaittinen@fi.rohmeurope.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-02 18:33:58 +01:00
Mauro Carvalho Chehab
507614ba25 regulator: hi6421v600-regulator: move it from staging
This driver is ready for mainstream. Move it out of staging.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/815b79a4e93f133478d9a5b2dd429526dcfe1dde.1616695231.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-02 15:11:17 +02:00
satya priya
c4e5aa3dbe
regulator: qcom-rpmh: Add PM7325/PMR735A regulator support
Add support for PM7325/PMR735A regulators. This ensures
that consumers are able to modify the physical state of PMIC
regulators.

Signed-off-by: satya priya <skakit@codeaurora.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Link: https://lore.kernel.org/r/1617192339-3760-3-git-send-email-skakit@codeaurora.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-01 19:42:41 +01:00
satya priya
9405b4f7fa
regulator: qcom-rpmh: Add pmic5_ftsmps520 buck
Add pmic5_ftsmps520 buck as this is required for PM7325
and PMR735A PMICs.

Signed-off-by: satya priya <skakit@codeaurora.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Link: https://lore.kernel.org/r/1617192339-3760-2-git-send-email-skakit@codeaurora.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-01 19:42:40 +01: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
Jian Dong
f56f2b953b
regulator: mt6360: remove redundant error print
fixes coccicheck warning:

drivers/regulator/mt6360-regulator.c:384:3-10: line 384 is
redundant because platform_get_irq() already prints an error

in fact it is not platform_get_irq but platform_get_irq_byname print error

Signed-off-by: Jian Dong <dongjian@yulong.com>
Link: https://lore.kernel.org/r/1616555474-158789-1-git-send-email-dj0227@163.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-24 19:50:21 +00:00
Matti Vaittinen
b668801515 regulator: qcom_spmi-regulator: Clean-up by using managed work init
Few drivers implement remove call-back only for ensuring a delayed
work gets cancelled prior driver removal. Clean-up these by switching
to use devm_delayed_work_autocancel() instead.

Additionally, this helps avoiding mixing devm and manual resource
management and cleans up a (theoretical?) bug where devm managed
over-current IRQ might schedule a new work item after wq was cleaned
at remove().

This change is compile-tested only. All testing is appreciated.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Link: https://lore.kernel.org/r/3bd35bb43257f4bf5b99f75d207ed5e1e08d1d38.1616506559.git.matti.vaittinen@fi.rohmeurope.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-23 15:22:40 +01:00
Dan Carpenter
320fcd6bbd
regulator: bd9576: Fix return from bd957x_probe()
The probe() function returns an uninitialized variable in the success
path.  There is no need for the "err" variable at all, just delete it.

Fixes: b014e9fae7 ("regulator: Support ROHM BD9576MUF and BD9573MUF")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Link: https://lore.kernel.org/r/YEsbfLJfEWtnRpoU@mwanda
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-15 15:42:15 +00:00
Geert Uytterhoeven
1deceabbdc
regulator: bd9571mwv: Convert device attribute to sysfs_emit()
Convert the "backup_mode" device attribute from sprintf() to
sysfs_emit(), as the latter is aware of the PAGE_SIZE buffer.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20210312130242.3390038-4-geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-15 15:42:12 +00:00
Geert Uytterhoeven
9cbc23f7d5
regulator: bd9571mwv: Fix regulator name printed on registration failure
If a regulator fails to register, the driver prints an error message
like:

    bd9571mwv-regulator bd9571mwv-regulator.6.auto: failed to register bd9571mwv-regulator regulator

However, the platform device's name is already printed as part of
dev_err(), and does not allow the user to distinguish among the various
regulators that are part of the PMIC.

Fix this by printing regulator_desc.name instead, to change the message
like:

    bd9571mwv-regulator bd9571mwv-regulator.6.auto: failed to register DVFS regulator

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Link: https://lore.kernel.org/r/20210312130242.3390038-3-geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-15 15:42:11 +00:00
Geert Uytterhoeven
3b6e7088af
regulator: bd9571mwv: Fix AVS and DVFS voltage range
According to Table 30 ("DVFS_MoniVDAC [6:0] Setting Table") in the
BD9571MWV-M Datasheet Rev. 002, the valid voltage range is 600..1100 mV
(settings 0x3c..0x6e).  While the lower limit is taken into account (by
setting regulator_desc.linear_min_sel to 0x3c), the upper limit is not.

Fix this by reducing regulator_desc.n_voltages from 0x80 to 0x6f.

Fixes: e85c5a153f ("regulator: Add ROHM BD9571MWV-M PMIC regulator driver")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20210312130242.3390038-2-geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-15 15:42:10 +00:00
Axel Lin
d450293c55
regulator: mt6315: Fix off-by-one for .n_voltages
The valid selector is 0 ~ 0xbf, so the .n_voltages should be 0xc0.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Link: https://lore.kernel.org/r/20210311020558.579597-1-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-11 13:23:21 +00: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
Axel Lin
1e50433c57
regulator: pf8x00: Use regulator_map_voltage_ascend for pf8x00_buck7_ops
The voltages in pf8x00_sw7_voltages are in ascendant order, so use
regulator_map_voltage_ascend.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Adrien Grassein <adrien.grassein@gmail.com>
Link: https://lore.kernel.org/r/20210216060128.126938-1-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10 12:47:46 +00:00
AngeloGioacchino Del Regno
438421b07b
regulator: spmi: Add support for ULT LV_P50 and ULT P300
The ULT LV_P50 shares the same configuration as the other ULT LV_Pxxx
and the ULT P300 shares the same as the other ULT Pxxx.

These two regulator types are found on PM8950 and its variants.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Signed-off-by: Konrad Dybcio <konrad.dybcio@somainline.org>
Link: https://lore.kernel.org/r/20210225213514.117031-1-konrad.dybcio@somainline.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10 12:47:45 +00:00
Wei Yongjun
e9e7fce038
regulator: rt4831: Fix return value check in rt4831_regulator_probe()
In case of error, the function dev_get_regmap() returns NULL
pointer not ERR_PTR(). The IS_ERR() test in the return value
check should be replaced with NULL test.

Fixes: 9351ab8b0c ("regulator: rt4831: Adds support for Richtek RT4831 DSV regulator")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20210305034930.3236099-1-weiyongjun1@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10 12:22:27 +00:00
Frieder Schrempf
98b94b6e38
regulator: pca9450: Clear PRESET_EN bit to fix BUCK1/2/3 voltage setting
The driver uses the DVS registers PCA9450_REG_BUCKxOUT_DVS0 to set the
voltage for the buck regulators 1, 2 and 3. This has no effect as the
PRESET_EN bit is set by default and therefore the preset values are used
instead, which are set to 850 mV.

To fix this we clear the PRESET_EN bit at time of initialization.

Fixes: 0935ff5f1f ("regulator: pca9450: add pca9450 pmic driver")
Cc: <stable@vger.kernel.org>
Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Link: https://lore.kernel.org/r/20210222115229.166620-1-frieder.schrempf@kontron.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10 12:22:26 +00:00
satya priya
dfe03bca8d
regulator: qcom-rpmh: Use correct buck for S1C regulator
Use correct buck, that is, pmic5_hfsmps515 for S1C regulator
of PM8350C PMIC.

Signed-off-by: satya priya <skakit@codeaurora.org>
Link: https://lore.kernel.org/r/1614155592-14060-7-git-send-email-skakit@codeaurora.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10 12:22:25 +00:00
satya priya
e610e072c8
regulator: qcom-rpmh: Correct the pmic5_hfsmps515 buck
Correct the REGULATOR_LINEAR_RANGE and n_voltges for
pmic5_hfsmps515 buck.

Signed-off-by: satya priya <skakit@codeaurora.org>
Link: https://lore.kernel.org/r/1614155592-14060-4-git-send-email-skakit@codeaurora.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10 12:22:24 +00:00
Frieder Schrempf
5fe5f17dc5
regulator: pca9450: Fix return value when failing to get sd-vsel GPIO
This fixes the return value of pca9450_i2c_probe() to use the correct
error code when getting the sd-vsel GPIO fails.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Link: https://lore.kernel.org/r/20210222150809.208942-1-frieder.schrempf@kontron.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10 12:22:23 +00:00
Axel Lin
fbc102fb4c
regulator: mt6315: Return REGULATOR_MODE_INVALID for invalid mode
-EINVAL is not a valid return value for .of_map_mode, return
REGULATOR_MODE_INVALID instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Link: https://lore.kernel.org/r/20210215034813.45510-1-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10 12:22:22 +00:00
Linus Torvalds
f158bbee94 - Core Frameworks
- Standardise MFD_CELL_* helpers
 
  - New Drivers
    - Add support for Acer Iconia Tab A500 Embedded Controller
 
  - New Device Support
    - Add support for ROHM BD9574MWF to BD9571MWV
    - Add support for Intel Alder Lake PCH-P PCI to LPSS
    - Add support for Intel Alder Lake PCH-S PCI to LPSS
 
  - New Functionality
    - Support ACPI enumeration; arizona
 
  - Fix-ups
    - Managed resources; bd9571mwv
    - DT additions/fix-ups; bd9571mwv, iqs62x, max8997, gateworks-gsc, ene-kb930
    - Convert to SPDX; bd9571mw
    - Fix return values/error handling; sunxi
    - Provide SOFTDEP; arizona
    - Make use of DIV_ROUND_UP; mcp-sa11x0
    - Use generic APIs; arizona
    - Add MAC address sysfs entries; intel-m10-bmc
    - Trivial: Coding-style fix-ups; iqs62x
    - Trivial: Remove superflouous code; iqs62x
    - Clear-up naming conventions; iqs62x
 
  - Bug Fixes
    - Fix 'pointer from integer' error; altera-sysmgr
    - Convert SGI_MFD_IOC3 from tristate to bool; Kconfig
    - Fix interrupt handling; gateworks-gsc
    - Extend required delay; iqs62x
    - Do not use I2C polling during calibration; iqs62x
    - Do no adjust clock frequency during calibration; iqs62x
    - Fix use-after-free; wm831x-auxad
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmAr4agACgkQUa+KL4f8
 d2GcqhAAkfGRWU7RVWlOK2NcYIDGiSU5kAJgirwIpDxkZM+kNjYITm+jt5JYBdIc
 B1ShJSgc3kgcs62nTUTqkGjL6IQyI6aPsI4oF57XnN6nmIGzSQ84cCSbBn7eXUIP
 wF2/4V0L+eE7i6TaZNcyZ4EltkKvo06MCs35eUATyFLB/9ZfhBCRjQlk5z4YOG6n
 Mc3VJiLSpNv8PWTL+tw76RMk8mScUFaKwra8fYK4OVG/zjJ43tsADu4G6gF7FkZE
 Erlp+fvFFmSR5STEri8cY0AFjHYHGWrST7lQ0HUsgM72A+TjFsy2X6WsDZzwVp+Z
 Ymk0T4NAQWJ/QBu2kwws0L2EieYTtzY1DjKJV6MIiwp1OWIK+TQGV9zPgkXFq404
 Rcw6LZjkEgeMJFx/4ljK5xC/y6CKGguxrXCYDVj0aeU+OcC1nnjx9KJwYWCsfwWU
 0QUIPK0Fy0m2L0Jy/MeDakHtdkPzBLWOe5ybE9EmY8EV+RUorH6bEWVA6cmsJNgq
 ycUlx8hK0nO+yIOMFua8Tk4+0gpcS9QrSGNoz3Iw/sZa6knX4vyvHxyebu/91qas
 VwnU//s8LzpeiYu8hsjlbZsZTlP4Gnc2QhaWW757hTwykwMjhlHLAo/CZ85LVzCg
 mmd1xybdMsQFAAoemp6D1HixLG/cMP5bflqCB+hZ8SUhHOiPZNU=
 =ieAS
 -----END PGP SIGNATURE-----

Merge tag 'mfd-next-5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MFD updates from Lee Jones:
 "Core Frameworks:
   - Standardise MFD_CELL_* helpers

  New Drivers:
   - Add support for Acer Iconia Tab A500 Embedded Controller

  New Device Support:
   - Add support for ROHM BD9574MWF to BD9571MWV
   - Add support for Intel Alder Lake PCH-P PCI to LPSS
   - Add support for Intel Alder Lake PCH-S PCI to LPSS

  New Functionality:
   - Support ACPI enumeration; arizona

  Fix-ups:
   - Managed resources; bd9571mwv
   - DT additions/fix-ups; bd9571mwv, iqs62x, max8997, gateworks-gsc, ene-kb930
   - Convert to SPDX; bd9571mw
   - Fix return values/error handling; sunxi
   - Provide SOFTDEP; arizona
   - Make use of DIV_ROUND_UP; mcp-sa11x0
   - Use generic APIs; arizona
   - Add MAC address sysfs entries; intel-m10-bmc
   - Trivial: Coding-style fix-ups; iqs62x
   - Trivial: Remove superflouous code; iqs62x
   - Clear-up naming conventions; iqs62x

  Bug Fixes:
   - Fix 'pointer from integer' error; altera-sysmgr
   - Convert SGI_MFD_IOC3 from tristate to bool; Kconfig
   - Fix interrupt handling; gateworks-gsc
   - Extend required delay; iqs62x
   - Do not use I2C polling during calibration; iqs62x
   - Do no adjust clock frequency during calibration; iqs62x
   - Fix use-after-free; wm831x-auxad"

* tag 'mfd-next-5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (32 commits)
  mfd: wm831x-auxadc: Prevent use after free in wm831x_auxadc_read_irq()
  mfd: iqs62x: Do not change clock frequency during ATI
  mfd: iqs62x: Do not poll during ATI
  mfd: iqs62x: Increase interrupt handler return delay
  mfd: iqs62x: Rename regmap_config struct
  mfd: iqs62x: Remove unused bit mask
  mfd: iqs62x: Remove superfluous whitespace above fallthroughs
  mfd: intel-lpss: Add Intel Alder Lake PCH-S PCI IDs
  mfd: intel-m10-bmc: Expose MAC address and count
  mfd: Add driver for Embedded Controller found on Acer Iconia Tab A500
  dt-bindings: mfd: Add ENE KB930 Embedded Controller binding
  dt-bindings: mfd: gateworks-gsc: Add fan-tach mode
  mfd: intel-lpss: Add Intel Alder Lake PCH-P PCI IDs
  mfd: gateworks-gsc: Fix interrupt type
  mfd: Standardise MFD_CELL_* helper names
  mfd: mcp-sa11x0: Use DIV_ROUND_UP to calculate rw_timeout
  mfd: max8997: Add of_compatible to Extcon and Charger mfd_cell
  dt-bindings: mfd: Correct the node name of the panel LED
  mfd: sgi-ioc3: Turn Kconfig option into a bool
  mfd: altera-sysmgr: Fix physical address storing more
  ...
2021-02-22 09:29:42 -08:00
Mark Brown
f03e2a72e5
Merge remote-tracking branch 'regulator/for-5.12' into regulator-next 2021-02-12 14:00:07 +00:00
Matti Vaittinen
c294554111
regulator: bd718x7, bd71828, Fix dvs voltage levels
The ROHM BD718x7 and BD71828 drivers support setting HW state
specific voltages from device-tree. This is used also by various
in-tree DTS files.

These drivers do incorrectly try to compose bit-map using enum
values. By a chance this works for first two valid levels having
values 1 and 2 - but setting values for the rest of the levels
do indicate capability of setting values for first levels as
well. Luckily the regulators which support setting values for
SUSPEND/LPSR do usually also support setting values for RUN
and IDLE too - thus this has not been such a fatal issue.

Fix this by defining the old enum values as bits and fixing the
parsing code. This allows keeping existing IC specific drivers
intact and only slightly changing the rohm-regulator.c

Fixes: 21b72156ed ("regulator: bd718x7: Split driver to common and bd718x7 specific parts")
Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20210212080023.GA880728@localhost.localdomain
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-02-12 12:35:58 +00:00
Frieder Schrempf
f7684f5a04
regulator: pca9450: Enable system reset on WDOG_B assertion
By default the PCA9450 doesn't handle the assertion of the WDOG_B
signal, but this is required to guarantee that things like software
resets triggered by the watchdog work reliably.

As we don't want to rely on the bootloader to enable this, we tell
the PMIC to issue a cold reset in case the WDOG_B signal is
asserted (WDOG_B_CFG = 10), just as the NXP U-Boot code does.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Link: https://lore.kernel.org/r/20210211105534.38972-3-frieder.schrempf@kontron.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-02-11 13:11:35 +00:00
Frieder Schrempf
8c67a11bae
regulator: pca9450: Add SD_VSEL GPIO for LDO5
LDO5 has two separate control registers. LDO5CTRL_L is used if the
input signal SD_VSEL is low and LDO5CTRL_H if it is high.
The current driver implementation only uses LDO5CTRL_H. To make this
work on boards that have SD_VSEL connected to a GPIO, we add support
for specifying an optional GPIO and setting it to high at probe time.

In the future we might also want to add support for boards that have
SD_VSEL set to a fixed low level. In this case we need to change the
driver to be able to use the LDO5CTRL_L register.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Link: https://lore.kernel.org/r/20210211105534.38972-1-frieder.schrempf@kontron.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-02-11 13:11:34 +00:00
Jonathan Marek
20ccc362c3
regulator: qcom-rpmh: fix pm8009 ldo7
Use the correct name to avoid ldo7 commands being sent to ldo6's address.

Fixes: 06369bcc15 ("regulator: qcom-rpmh: Add support for SM8150")
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Vinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/r/20210211034935.5622-1-jonathan@marek.ca
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-02-11 13:04:50 +00:00
Hsin-Hsiung Wang
7aa382cfe7
regulator: mt6315: Add support for MT6315 regulator
The MT6315 is a regulator found on boards based on MediaTek MT8192 and
probably other SoCs. It connects as a slave to SoC using SPMI.

Signed-off-by: Hsin-Hsiung Wang <hsin-hsiung.wang@mediatek.com>
Link: https://lore.kernel.org/r/1612678457-11548-3-git-send-email-hsin-hsiung.wang@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-02-08 11:48:48 +00:00
Matti Vaittinen
337710b312
regulator: qcom-labibb: Use disable_irq_nosync from isr
Calling the disable_irq() from irq handler might be a bad idea as
disable_irq() should wait for handlers to run. I don't see why
this wouldn't deadlock in wait_event waiting for the threaded
handler to complete.

Use disable_irq_nosync() instead.

Fixes: 390af53e04 ("regulator: qcom-labibb: Implement short-circuit and over-current IRQs")

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Reviewed-by: AngeloGioacchino Del Regno  <angelogioacchino.delregno@somainline.org>
Link: https://lore.kernel.org/r/f2c4c88d90bf7473e1b84b8a99b7b33d7a081764.1612249657.git.matti.vaittinen@fi.rohmeurope.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-02-02 16:14:16 +00:00
Axel Lin
64f09ea1b5
regulator: pf8x00: Fix typo for PF8200 chip name
Trivial typo fix.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Adrien Grassein <adrien.grassein@gmail.com>
Link: https://lore.kernel.org/r/20210128120151.554411-1-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-28 17:11:33 +00:00
Christoph Fritz
4288b4ccda
regulator: pf8x00: set ramp_delay for bucks
This patch sets ramp_delay for bucks to the max value given by the
datasheet.

Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
Reviewed-by: Adrien Grassein <adrien.grassein@gmail.com>
Link: https://lore.kernel.org/r/60d8eb8feefd26380cc9c6503f835e569be90465.camel@googlemail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-25 17:17:56 +00:00
Hans de Goede
dbe954d8f1
regulator: core: Avoid debugfs: Directory ... already present! error
Sometimes regulator_get() gets called twice for the same supply on the
same device. This may happen e.g. when a framework / library is used
which uses the regulator; and the driver itself also needs to enable
the regulator in some cases where the framework will not enable it.

Commit ff268b56ce ("regulator: core: Don't spew backtraces on
duplicate sysfs") already takes care of the backtrace which would
trigger when creating a duplicate consumer symlink under
/sys/class/regulator/regulator.%d in this scenario.

Commit c33d442328 ("debugfs: make error message a bit more verbose")
causes a new error to get logged in this scenario:

[   26.938425] debugfs: Directory 'wm5102-codec-MICVDD' with parent 'spi-WM510204:00-MICVDD' already present!

There is no _nowarn variant of debugfs_create_dir(), but we can detect
and avoid this problem by checking the return value of the earlier
sysfs_create_link_nowarn() call.

Add a check for the earlier sysfs_create_link_nowarn() failing with
-EEXIST and skip the debugfs_create_dir() call in that case, avoiding
this error getting logged.

Fixes: c33d442328 ("debugfs: make error message a bit more verbose")
Cc: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210122183250.370571-1-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-25 14:20:11 +00:00
Christoph Fritz
7fefe72b0f
regulator: pf8x00: Add suspend support
This patch adds suspend/resume support so that it is possible to
configure the LDOs and BUCKs as on or off during suspend phase as
well as to configure suspend specific voltages.

Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
Link: https://lore.kernel.org/r/4c2e79d4fa96befdc9a6c59c3ff27b0a34f9fb56.camel@googlemail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-25 13:11:04 +00:00
Dmitry Osipenko
24be0c7156
regulator: Make regulator_sync_voltage() usable by coupled regulators
Make regulator_sync_voltage() to re-balance voltage state of a coupled
regulators instead of changing the voltage directly.

Tested-by: Peter Geis <pgwipeout@gmail.com> # Ouya T30
Tested-by: Dmitry Osipenko <digetx@gmail.com> # A500 T20 and Nexus7 T30
Tested-by: Nicolas Chauvet <kwizart@gmail.com> # PAZ00 T20
Tested-by: Matt Merhar <mattmerhar@protonmail.com> # Ouya T30
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20210122174311.28230-1-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-22 17:47:36 +00:00
Mark Brown
14a71d509a
regulator: Fix lockdep warning resolving supplies
With commit eaa7995c52 (regulator: core: avoid
regulator_resolve_supply() race condition) we started holding the rdev
lock while resolving supplies, an operation that requires holding the
regulator_list_mutex. This results in lockdep warnings since in other
places we take the list mutex then the mutex on an individual rdev.

Since the goal is to make sure that we don't call set_supply() twice
rather than a concern about the cost of resolution pull the rdev lock
and check for duplicate resolution down to immediately before we do the
set_supply() and drop it again once the allocation is done.

Fixes: eaa7995c52 (regulator: core: avoid regulator_resolve_supply() race condition)
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210122132042.10306-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-22 14:03:07 +00:00
Krzysztof Kozlowski
a5872bd339
regulator: s5m8767: Drop regulators OF node reference
The device node reference obtained with of_get_child_by_name() should be
dropped on error paths.

Fixes: 26aec009f6 ("regulator: add device tree support for s5m8767")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20210121155914.48034-1-krzk@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-21 18:14:49 +00:00
Bjorn Andersson
e46c52f7ef
regulator: qcom-rpmh: Add pmc8180 and pmc8180c
The regulators from PMC8180 and PMC8180C exposed by the RPMH in the
Qualcomm SC8180X seems to be the same as PM8150 and PM8150L. Add
compatibles for the two new PMICs and reuse the definition of the
existing PMICs.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20210120224901.1611232-2-bjorn.andersson@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-21 18:14:48 +00:00
Pan Bian
dea6dd2ba6
regulator: s5m8767: Fix reference count leak
Call of_node_put() to drop references of regulators_np and reg_np before
returning error code.

Fixes: 9ae5cc75ce ("regulator: s5m8767: Pass descriptor instead of GPIO number")
Signed-off-by: Pan Bian <bianpan2016@163.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20210121032756.49501-1-bianpan2016@163.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-21 18:14:21 +00:00
Arnd Bergmann
d93d6f52bd
regulator: remove ab3100 driver
The ST-Ericsson U300 platform is getting removed, so this driver is no
longer needed.

Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20210120151307.1726876-1-arnd@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-21 18:14:20 +00:00
Mark Brown
e34578223b
Merge series "Really implement Qualcomm LAB/IBB regulators" from AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>:
Okay, the title may be a little "aggressive"? However, the qcom-labibb
driver wasn't really .. doing much.
The current form of this driver is only taking care of enabling or
disabling the regulators, which is pretty useless if they were not
pre-set from the bootloader, which sets them only if continuous
splash is enabled.
Moreover, some bootloaders are setting a higher voltage and/or a higher
current limit compared to what's actually required by the attached
hardware (which is, in 99.9% of the cases, a display) and this produces
a higher power consumption, higher heat output and a risk of actually
burning the display if kept up for a very long time: for example, this
is true on at least some Sony Xperia MSM8998 (Yoshino platform) and
especially on some Sony Xperia SDM845 (Tama platform) smartphones.

In any case, the main reason why this change was necessary for us is
that, during the bringup of Sony Xperia MSM8998 phones, we had an issue
with the bootloader not turning on the display and not setting the lab
and ibb regulators before booting the kernel, making it impossible to
powerup the display.

With this said, this patchset enables setting voltage, current limiting,
overcurrent and short-circuit protection.. and others, on the LAB/IBB
regulators.
Each commit in this patch series provides as many informations as
possible about what's going on and testing methodology.

Changes in v4:
 - Remove already applied commit
 - Add commit to switch to regulator_{list,map}_voltage_linear
   which in v3 got squashed in the commit that got removed in v4.

Changes in v3:
 - Improved check for PBS disable and short-circuit condition:
   during the testing of short-circuit, coincidentally another
   register reading zero on the interesting bit was probed,
   which didn't trigger a malfunction of the SC logic, but was
   also wrong.
   After the change, the short-circuit test was re-done in the
   same way as described in the commit that is implementing it.
 - From Bjorn Andersson review:
   - Improved documentation about over-current and short-circuit
     protection in the driver
   - Improved maintainability of qcom_labibb_sc_recovery_worker()
   - Flipped around check for PBS vreg disabled in for loop of
     function labibb_sc_err_handler()
 - From Mark Brown (forgotten in v2):
   - Changed regulator_{list,map}_voltage_linear_range usages to
     regulator_{list,map}_voltage_linear (and fixed regulator
     descs to reflect the change).

Changes in v2:
 - From Mark Brown review:
   - Replaced some if branches with switch statements
   - Moved irq get and request in probe function
   - Changed short conditionals to full ones
   - Removed useless check for ocp_irq_requested
 -  Fixed issues with YAML documentation

AngeloGioacchino Del Regno (7):
  regulator: qcom-labibb: Switch voltage ops from linear_range to linear
  regulator: qcom-labibb: Implement current limiting
  regulator: qcom-labibb: Implement pull-down, softstart, active
    discharge
  dt-bindings: regulator: qcom-labibb: Document soft start properties
  regulator: qcom-labibb: Implement short-circuit and over-current IRQs
  dt-bindings: regulator: qcom-labibb: Document SCP/OCP interrupts
  arm64: dts: pmi8998: Add the right interrupts for LAB/IBB SCP and OCP

 .../regulator/qcom-labibb-regulator.yaml      |  30 +-
 arch/arm64/boot/dts/qcom/pmi8998.dtsi         |   8 +-
 drivers/regulator/qcom-labibb-regulator.c     | 720 +++++++++++++++++-
 3 files changed, 735 insertions(+), 23 deletions(-)

--
2.30.0
2021-01-21 00:00:59 +00:00
Pan Bian
e78bf6be7e
regulator: axp20x: Fix reference cout leak
Decrements the reference count of device node and its child node.

Fixes: dfe7a1b058 ("regulator: AXP20x: Add support for regulators subsystem")
Signed-off-by: Pan Bian <bianpan2016@163.com>
Link: https://lore.kernel.org/r/20210120123313.107640-1-bianpan2016@163.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-20 18:48:20 +00:00
AngeloGioacchino Del Regno
390af53e04
regulator: qcom-labibb: Implement short-circuit and over-current IRQs
Short-Circuit Protection (SCP) and Over-Current Protection (OCP) are
very important for regulators like LAB and IBB, which are designed to
provide from very small to relatively big amounts of current to the
device (normally, a display).

Now that this regulator supports both voltage setting and current
limiting in this driver, to me it looked like being somehow essential
to provide support for SCP and OCP, for two reasons:
1. SCP is a drastic measure to prevent damaging "more" hardware in
   the worst situations, if any was damaged, preventing potentially
   drastic issues;
2. OCP is a great way to protect the hardware that we're powering
   through these regulators as if anything bad happens, the HW will
   draw more current than expected: in this case, the OCP interrupt
   will fire and the regulators will be immediately shut down,
   preventing hardware damage in many cases.

Both interrupts were successfully tested in a "sort-of" controlled
manner, with the following methodology:

Short-Circuit Protection (SCP):
1. Set LAB/IBB to 4.6/-1.4V, current limit 200mA/50mA;
2. Connect a 10 KOhm resistor to LAB/IBB by poking the right traces
   on a FxTec Pro1 smartphone for a very brief time (in short words,
   "just a rapid touch with flying wires");
3. The Short-Circuit protection trips: IRQ raises, regulators get
   cut. Recovery OK, test repeated without rebooting, OK.

Over-Current Protection (OCP):
1. Set LAB/IBB to the expected voltage to power up the display of
   a Sony Xperia XZ Premium smartphone (Sharp LS055D1SX04), set
   current limit to LAB 200mA, IBB 50mA (the values that this
   display unit needs are 200/800mA);
2. Boot the kernel: OCP fires. Recovery never happens because
   the selected current limit is too low, but that's expected.
   Test OK.

3. Set LAB/IBB to the expected current limits for XZ Premium
   (LAB 200mA, IBB 800mA), but lower than expected voltage,
   specifically LAB 5.4V, IBB -5.6V (instead of 5.6, -5.8V);
4. Boot the kernel: OCP fires. Recovery never happens because
   the selected voltage (still in the working range limits)
   is producing a current draw of more than 200mA on LAB.
   Test OK.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Link: https://lore.kernel.org/r/20210119174421.226541-6-angelogioacchino.delregno@somainline.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-20 18:48:17 +00:00
AngeloGioacchino Del Regno
3bc7cb99fb
regulator: qcom-labibb: Implement pull-down, softstart, active discharge
Soft start is required to avoid inrush current during LAB ramp-up and
IBB ramp-down, protecting connected hardware to which we supply voltage.

Since soft start is configurable on both LAB and IBB regulators, it
was necessary to add two DT properties, respectively "qcom,soft-start-us"
to control LAB ramp-up and "qcom,discharge-resistor-kohms" to control
the discharge resistor for IBB ramp-down, which obviously brought the
need of implementing a of_parse callback for both regulators.

Finally, also implement pull-down mode in order to avoid unpredictable
behavior when the regulators are disabled (random voltage spikes etc).

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20210119174421.226541-4-angelogioacchino.delregno@somainline.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-20 18:48:16 +00:00
AngeloGioacchino Del Regno
8056704ba9
regulator: qcom-labibb: Implement current limiting
LAB and IBB regulators can be current-limited by setting the
appropriate registers, but this operation is granted only after
sending an unlock code for secure access.

Besides the secure access, it would be possible to use the
regmap helper for get_current_limit, as there is no security
blocking reads, but I chose not to as to avoid having a very
big array containing current limits, especially for IBB.

That said, these regulators support current limiting for:
- LAB (pos): 200-1600mA, with 200mA per step (8 steps),
- IBB (neg):   0-1550mA, with  50mA per step (32 steps).

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Link: https://lore.kernel.org/r/20210119174421.226541-3-angelogioacchino.delregno@somainline.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-20 18:48:15 +00:00
AngeloGioacchino Del Regno
9a12eb704e
regulator: qcom-labibb: Switch voltage ops from linear_range to linear
The LAB and IBB regulator have just one range and it is useless
to use linear_range ops, as these are used to express multiple
linear ranges.

Switch list_voltage and map_voltage callbacks to *_linear instead.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Link: https://lore.kernel.org/r/20210119174421.226541-2-angelogioacchino.delregno@somainline.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-20 18:48:14 +00:00
Mark Brown
f35f6d8c11
Merge series "Really implement Qualcomm LAB/IBB regulators" from AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>:
Okay, the title may be a little "aggressive"? However, the qcom-labibb
driver wasn't really .. doing much.
The current form of this driver is only taking care of enabling or
disabling the regulators, which is pretty useless if they were not
pre-set from the bootloader, which sets them only if continuous
splash is enabled.
Moreover, some bootloaders are setting a higher voltage and/or a higher
current limit compared to what's actually required by the attached
hardware (which is, in 99.9% of the cases, a display) and this produces
a higher power consumption, higher heat output and a risk of actually
burning the display if kept up for a very long time: for example, this
is true on at least some Sony Xperia MSM8998 (Yoshino platform) and
especially on some Sony Xperia SDM845 (Tama platform) smartphones.

In any case, the main reason why this change was necessary for us is
that, during the bringup of Sony Xperia MSM8998 phones, we had an issue
with the bootloader not turning on the display and not setting the lab
and ibb regulators before booting the kernel, making it impossible to
powerup the display.

With this said, this patchset enables setting voltage, current limiting,
overcurrent and short-circuit protection.. and others, on the LAB/IBB
regulators.
Each commit in this patch series provides as many informations as
possible about what's going on and testing methodology.

Changes in v2:
 - From Mark Brown review:
   - Replaced some if branches with switch statements
   - Moved irq get and request in probe function
   - Changed short conditionals to full ones
   - Removed useless check for ocp_irq_requested
 -  Fixed issues with YAML documentation

AngeloGioacchino Del Regno (7):
  regulator: qcom-labibb: Implement voltage selector ops
  regulator: qcom-labibb: Implement current limiting
  regulator: qcom-labibb: Implement pull-down, softstart, active
    discharge
  dt-bindings: regulator: qcom-labibb: Document soft start properties
  regulator: qcom-labibb: Implement short-circuit and over-current IRQs
  dt-bindings: regulator: qcom-labibb: Document SCP/OCP interrupts
  arm64: dts: pmi8998: Add the right interrupts for LAB/IBB SCP and OCP

 .../regulator/qcom-labibb-regulator.yaml      |  30 +-
 arch/arm64/boot/dts/qcom/pmi8998.dtsi         |   8 +-
 drivers/regulator/qcom-labibb-regulator.c     | 661 +++++++++++++++++-
 3 files changed, 686 insertions(+), 13 deletions(-)

--
2.29.2
2021-01-15 17:13:14 +00:00
AngeloGioacchino Del Regno
dd582369c6
regulator: qcom-labibb: Implement voltage selector ops
Implement {get,set}_voltage_sel, list_voltage, map_voltage with
the useful regulator regmap helpers in order to be able to manage
the voltage of LAB (positive) and IBB (negative) regulators.

In particular, the supported ranges are the following:
- LAB (pos):  4600mV to  6100mV with 100mV stepping,
- IBB (neg): -7700mV to -1400mV with 100mV stepping.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20210113194214.522238-2-angelogioacchino.delregno@somainline.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-15 14:27:50 +00:00
Adrien Grassein
475a5d85ff
regulator: pf8x00: fix nxp,phase-shift
Fix the ternary condition which is a bad coding style
in the kernel

I also remove the defering configuration of the nxp,phase-shift.
The configuration is now done at parsing time. It save some memory
and it's better for comprehension.

I also use the OTP default configuration when the parameter is wrong
or not specified.
I think that it's better to use the default configuration from the chip
than an arbitrary value.

Signed-off-by: Adrien Grassein <adrien.grassein@gmail.com>
Link: https://lore.kernel.org/r/20210114174714.122561-7-adrien.grassein@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-15 14:16:15 +00:00
Adrien Grassein
35a9334993
regulator: pf8x00: use linear range for buck 1-6
Use a linear range to describe the voltages of the
bucks 1-6 instead of listing it one by one (via a macro)

Signed-off-by: Adrien Grassein <adrien.grassein@gmail.com>
Link: https://lore.kernel.org/r/20210114174714.122561-6-adrien.grassein@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-15 14:16:14 +00:00
Adrien Grassein
245f5f6522
regulator: pf8x00: mark nxp,ilim-ma property as deprecated
This property seems useless because we can use the
regulator-max-microamp generic property to do the same
and using generic code.

As this property was already released in a kernel version,
we can't remove it, just mark it as deprecated.

Signed-off-by: Adrien Grassein <adrien.grassein@gmail.com>
Link: https://lore.kernel.org/r/20210114174714.122561-5-adrien.grassein@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-15 14:16:13 +00:00
Adrien Grassein
4d23b84d1f
regulator: pf8x00: add a doc for the module
pf8x00 module build was not documented.

Signed-off-by: Adrien Grassein <adrien.grassein@gmail.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Link: https://lore.kernel.org/r/20210114174714.122561-2-adrien.grassein@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-15 14:16:11 +00:00
Yoshihiro Shimoda
ceee9dc13b regulator: bd9571mwv: Add BD9574MWF support
Add support for BD9574MWF which is similar chip with BD9571MWV.
Note that we don't support voltage rails VD{09,18,25,33} by this
driver on BD9574. The VD09 voltage could be read from PMIC but that
is not supported by this commit.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2021-01-14 13:05:54 +00:00
Yoshihiro Shimoda
30402f97f9 regulator: bd9571mwv: rid of using struct bd9571mwv
To simplify this driver, use dev_get_regmap() and
rid of using struct bd9571mwv.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2021-01-14 13:05:54 +00:00
Linus Walleij
3acb64c07e
regulator: ab8500: Decomission platform data header
The platform data header was only used to pass platform
data from board files. We now populate the regulators
exclusively from device tree, so the header contents can
be moved into the regulator drivers.

Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20201205004057.1712753-2-linus.walleij@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-13 11:36:19 +00:00
Linus Walleij
c512150b26
regulator: ab8500: Remove unused platform data
The struct ab8500_regulator_platform_data was a leftover
since the days before we probed all regulators from the
device tree. The ab8500-ext regulator was the only used,
defining platform data and register intialization that
was never used for anything, a copy of a boardfile no
longer in use.

Delete the ab8500_regulator_platform_data and make the
ab8500-ext regulator reference the regulator init data
in the local file directly. We are 100% device tree
these days.

Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20201205004057.1712753-1-linus.walleij@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-13 11:36:18 +00:00
David Collins
eaa7995c52
regulator: core: avoid regulator_resolve_supply() race condition
The final step in regulator_register() is to call
regulator_resolve_supply() for each registered regulator
(including the one in the process of being registered).  The
regulator_resolve_supply() function first checks if rdev->supply
is NULL, then it performs various steps to try to find the supply.
If successful, rdev->supply is set inside of set_supply().

This procedure can encounter a race condition if two concurrent
tasks call regulator_register() near to each other on separate CPUs
and one of the regulators has rdev->supply_name specified.  There
is currently nothing guaranteeing atomicity between the rdev->supply
check and set steps.  Thus, both tasks can observe rdev->supply==NULL
in their regulator_resolve_supply() calls.  This then results in
both creating a struct regulator for the supply.  One ends up
actually stored in rdev->supply and the other is lost (though still
present in the supply's consumer_list).

Here is a kernel log snippet showing the issue:

[   12.421768] gpu_cc_gx_gdsc: supplied by pm8350_s5_level
[   12.425854] gpu_cc_gx_gdsc: supplied by pm8350_s5_level
[   12.429064] debugfs: Directory 'regulator.4-SUPPLY' with parent
               '17a00000.rsc:rpmh-regulator-gfxlvl-pm8350_s5_level'
               already present!

Avoid this race condition by holding the rdev->mutex lock inside
of regulator_resolve_supply() while checking and setting
rdev->supply.

Signed-off-by: David Collins <collinsd@codeaurora.org>
Link: https://lore.kernel.org/r/1610068562-4410-1-git-send-email-collinsd@codeaurora.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-08 18:22:59 +00:00
Mark Brown
90fd840e72
Merge series "regulator: mcp16502: make lpm pin optional" from Claudiu Beznea <claudiu.beznea@microchip.com>:
Hi,

This patch makes the LPM pin as optional as this may be controlled
in the last phase of suspend procedure to decrease the power consumption
while suspended. Along w/ this update the MAINTAINERS entry for this
driver.

Thank you,
Claudiu Beznea

Claudiu Beznea (3):
  dt-bindings: regulator: mcp16502: document lpm as optional
  regulator: mcp16502: lpm pin can be optional on some platforms
  MAINTAINERS: add myself as maintainer for mcp16502

 Documentation/devicetree/bindings/regulator/mcp16502-regulator.txt | 3 ++-
 MAINTAINERS                                                        | 4 ++--
 drivers/regulator/mcp16502.c                                       | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

--
2.7.4

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
2021-01-07 19:59:17 +00:00
Matti Vaittinen
907dfdc945
regulator: bd718x7: Stop using parent data
The ROHM PMIC regulator drivers only need the regmap pointer from
the parent device. Regmap can be obtained via dev_get_regmap()
so do not require parent to populate driver data for that.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Link: https://lore.kernel.org/r/20210107122355.GA35080@localhost.localdomain
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-07 16:15:01 +00:00
Claudiu Beznea
3c42728c18
regulator: mcp16502: lpm pin can be optional on some platforms
On some platform (e.g. SAMA7G5) LPM pin should be optional as it can
be controlled explicitly (via shutdown controller registers) in the
platform specific power saving code to decrease the power consumption
while suspended as this SoC pin may be connected to other devices that
could take power saving actions based on its value.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/1610028927-9842-3-git-send-email-claudiu.beznea@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-07 16:14:58 +00:00
Mark Brown
f45c522cf8
Merge series "Add driver for dvfsrc, support for active state of scpsys" from Henry Chen <henryc.chen@mediatek.com>:
This series is based on v5.10-rc1.

The patchsets add support for MediaTek hardware module named DVFSRC
(dynamic voltage and frequency scaling resource collector). The DVFSRC is
a HW module which is used to collect all the requests from both software
and hardware and turn into the decision of minimum operating voltage and
minimum DRAM frequency to fulfill those requests.

So, This series is to implement the dvfsrc driver to collect all the
requests of operating voltage or DRAM bandwidth from other device drivers
likes GPU/Camera through 3 frameworks basically:

1. interconnect framework: to aggregate the bandwidth
   requirements from different clients

[1] https://patchwork.kernel.org/cover/10766329/

There has a hw module "DRAM scheduler", which used to control the throughput.
The DVFSRC will collect forecast data of dram bandwidth from
SW consumers(camera/gpu...), and according the forecast to change the DRAM
frequency

2. Regualtor framework: to handle the operating voltage requirement from user or
   cosumer which not belong any power domain

Changes in V6:
* Remove the performace state support, because the request from consumer can be
replaced by using interconnect and regulator framework.
* Update the DT patches and convert them to DT schema. (Georgi)
* Modify the comment format and coding style. (Mark)

Changes in V5:
* Support more platform mt6873/mt8192
* Drop the compatible and interconnect provider node and make the parent node an
interconnect provider. (Rob/Georgi)
* Make modification of interconnect driver from coding suggestion. (Georgi)
* Move interconnect diagram into the commit text of patch. (Georgi)
* Register the interconnect provider as a platform sub-device. (Georgi)

Changes in V4:
* Add acked TAG on dt-bindings patches. (Rob)
* Declaration of emi_icc_aggregate since the prototype of aggregate function
has changed meanwhile. (Georgi)
* Used emi_icc_remove instead of icc_provider_del on probe. (Georgi)
* Add dvfsrc regulator driver into series.
* Bug fixed of mt8183_get_current_level.
* Add mutex protection for pstate operation on dvfsrc_set_performance.

Changes in V3:
* Remove RFC from the subject prefix of the series
* Combine dt-binding patch and move interconnect dt-binding document into
dvfsrc. (Rob)
* Remove unused header, add unit descirption to the bandwidth, rename compatible
name on interconnect driver. (Georgi)
* Fixed some coding style: check flow, naming, used readx_poll_timeout
on dvfsrc driver. (Ryan)
* Rename interconnect driver mt8183.c to mtk-emi.c
* Rename interconnect header mtk,mt8183.h to mtk,emi.h
* mtk-scpsys.c: Add opp table check first to avoid OF runtime parse failed

Changes in RFC V2:
* Remove the DT property dram_type. (Rob)
* Used generic dts property 'opp-level' to get the performace state. (Stephen)
* Remove unecessary dependency config on Kconfig. (Stephen)
* Remove unused header file, fixed some coding style issue, typo,
error handling on dvfsrc driver. (Nicolas/Stephen)
* Remove irq handler on dvfsrc driver. (Stephen)
* Remove init table on dvfsrc driver, combine hw init on trustzone.
* Add interconnect support of mt8183 to aggregate the emi bandwidth.
(Georgi)

V5: https://patchwork.kernel.org/project/linux-mediatek/list/?series=348065
V4: https://lore.kernel.org/patchwork/cover/1209284/
V3: https://patchwork.kernel.org/cover/11118867/
RFC V2: https://lore.kernel.org/patchwork/patch/1068113/
RFC V1: https://lore.kernel.org/patchwork/cover/1028535/
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
2021-01-05 15:40:40 +00:00
Matti Vaittinen
3c14dbd4b8
regulator: ROHM bd7xxxx: Do not depend on parent driver data
The ROHM PMIC regulator drivers only need the regmap pointer from
the parent device. Regmap can be obtained via dev_get_regmap()
so do not require parent to populate driver data for that.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Link: https://lore.kernel.org/r/20210105130221.GA3438042@localhost.localdomain
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-05 14:35:27 +00:00
henryc.chen
a0db6b0aa6
regulator: Regulator driver for the Mediatek DVFSRC
Driver for regulators exposed by the DVFSRC (dynamic voltage and
frequency scaling resource collector) found in devices based on
mt8183 and newer platforms.

Signed-off-by: Henry Chen <henryc.chen@mediatek.com>
Link: https://lore.kernel.org/r/1608790134-27425-12-git-send-email-henryc.chen@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-05 14:35:26 +00:00
Mark Brown
c42088491c
Merge branch 'regulator-5.11' into regulator-5.12 2021-01-04 17:09:23 +00:00
Mark Brown
36836f5b37
Merge qcom driver fix into regulator-5.11 2021-01-04 16:23:20 +00:00
Mark Brown
a5694a3ce5
Merge series "regulator: fix pm8009 bindings on sm8250" from Dmitry Baryshkov <dmitry.baryshkov@linaro.org>:
PM8009 has special revision (P=1), which is to be used for sm8250
platform. The major difference is the S2 regulator which supplies 0.95 V
instead of 2.848V. Declare regulators data to be used for this chip
revision. The datasheet calls the chip just pm8009-1, so use the same
name.

base-commit: 5c8fe583cc
2021-01-04 16:22:39 +00:00
Daniel Scally
90cf443d84
regulator: core.c: Replace references to non-existent function
The function regulator_set_device_supply() is referenced a few times in
comments in regulator/core.c; however this function was removed a long
time ago by commit a5766f11cf ("regulator: core - Rework machine API to
remove string based functions."). Update those references to point to
set_consumer_device_supply(), which replaced the old function.

Signed-off-by: Daniel Scally <djrscally@gmail.com>
Link: https://lore.kernel.org/r/20210103165541.784360-1-djrscally@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-04 14:26:17 +00:00
Arnd Bergmann
d957d1610c
regulator: qcom-rpmh: add QCOM_COMMAND_DB dependency
A built-in regulator driver cannot link against a modular cmd_db driver:

qcom-rpmh-regulator.c:(.text+0x174): undefined reference to `cmd_db_read_addr'

There is already a dependency for RPMh, so add another one of this
type for cmd_db.

Fixes: 34c5aa2666 ("regulator: Kconfig: Fix REGULATOR_QCOM_RPMH dependencies to avoid build error")
Fixes: 46fc033eba ("regulator: add QCOM RPMh regulator driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20201230145712.3133110-1-arnd@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-04 14:26:15 +00:00
Dmitry Baryshkov
951384cabc
regulator: qcom-rpmh-regulator: add pm8009-1 chip revision
PM8009 has special revision (P=1), which is to be used for sm8250
platform. The major difference is the S2 regulator which supplies 0.95 V
instead of 2.848V. Declare regulators data to be used for this chip
revision. The datasheet calls the chip just pm8009-1, so use the same
name.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Fixes: 06369bcc15 ("regulator: qcom-rpmh: Add support for SM8150")
Reviewed-by: Vinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/r/20201231122348.637917-4-dmitry.baryshkov@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-04 14:25:04 +00:00
Dmitry Baryshkov
df6b92fa40
regulator: qcom-rpmh-regulator: correct hfsmps515 definition
According to the datasheet pm8009's HFS515 regulators have 16mV
resolution rather than declared 1.6 mV. Correct the resolution.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Fixes: 06369bcc15 ("regulator: qcom-rpmh: Add support for SM8150")
Reviewed-by: Vinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/r/20201231122348.637917-3-dmitry.baryshkov@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-04 14:25:03 +00:00
Cristian Ciocaltea
3b15ccac16
regulator: Add regulator driver for ATC260x PMICs
Add support for the DC-DC converters and LDO regulators found in
the ATC2603C and ATC2609A chip variants of the Actions Semi ATC260x
family of PMICs.

Co-developed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
Link: https://lore.kernel.org/r/1117b1a01b3948446cb3cc407e52de3a5d4212b0.1609258905.git.cristian.ciocaltea@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-30 13:54:24 +00:00
Mark Brown
2ae6f64ce1 Linux 5.11-rc1
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAl/pGQ4eHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGSCsH/AmJzlif2P7bMT12
 2SiVnl/BfK4iHVdGMQPaLZNJVrjFLzhRUj1WiOye0rKq0jp21IVJgwpshiWZeqEg
 8BfT4UEMfdl5uaYIX/7G9AhD2JUy9UHs0VhQEf4oueDAmNl+q2btlXZh/tayqjqc
 DOqLtyJKYRswfBTh260w8/W5EPXJq5IlWf/vOpgGphFWMwolqIAgIlCTulE8pcO6
 EiPuC3tOxBg8zkEkjV94Bvu4+73Hgr8O6beCbbqZlvuTpWci/X1hcVyA+IsGFvL8
 h0YpMrEzvQoroJAVFh7u2KKrU6pObQWsjRb1F7LQIBIGC7hvnzXSzwH2IZQfyFJd
 p/ASNk8=
 =564c
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl/p6ZcACgkQJNaLcl1U
 h9DLcAf/fo1Nolp7vA5xmz4MeTC88BB3yK63NxFX6n91zGGT/dsPzHxsIiaen/IL
 /eaIsZ8Hht5LQIDlMjqnIhso3ooizzppv9FJqZ11H35HIyX+ivxDhE52fUkzYTQY
 kA2euYXT0L8cYPYkJ5j5fPkxAMAhiT1uFSxDGtUfvajlA+QyrF6/sanPdoZjqFFX
 fI7xRsjQBGIWzY3wPbCNOJ5mSh/wlbXFSKtkGYIBt8wB6CaAz8YtyIPUXArz27wz
 MsMqsYJWYL4dDPjX/FwceYFGGgKerigUnjMiwYxWOrkntfpOKMb59IpuWW64YTKX
 VwpNywZD3gTXgLsdp4YRh4ca++PWGg==
 =Pv+C
 -----END PGP SIGNATURE-----

Merge tag 'v5.11-rc1' into regulator-5.11

Linux 5.11-rc1
2020-12-28 14:20:00 +00:00
ChiYuan Huang
9351ab8b0c
regulator: rt4831: Adds support for Richtek RT4831 DSV regulator
Adds support for Richtek RT4831 DSV Regulator

Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
Link: https://lore.kernel.org/r/1608217244-314-6-git-send-email-u0084500@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-28 12:24:50 +00:00
Randy Dunlap
ac6b559d81
regulator: qcom-rpmh: fix build after QCOM_COMMAND_DB is tristate
Restrict REGULATOR_QCOM_RPMH to QCOM_COMMAND_DB it the latter is enabled.

Fixes this build error:
  microblaze-linux-ld: drivers/regulator/qcom-rpmh-regulator.o: in function `rpmh_regulator_probe':
  (.text+0x354): undefined reference to `cmd_db_read_addr'

Fixes: 778279f4f5 ("soc: qcom: cmd-db: allow loading as a module")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Lina Iyer <ilina@codeaurora.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Reviewed-by: Lina Iyer <ilina@codeaurora.org>
Link: https://lore.kernel.org/r/20201225185004.20747-1-rdunlap@infradead.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-28 12:24:48 +00:00
Mark Brown
f518be6ecc
Merge existing fixes from regulator/for-5.11 2020-12-28 12:24:28 +00:00
Guido Günther
3b66e4a8e5
regulator: bd718x7: Add enable times
Use the typical startup times from the data sheet so boards get a
reasonable default. Not setting any enable time can lead to board hangs
when e.g. clocks are enabled too soon afterwards.

This fixes gpu power domain resume on the Librem 5.

[Moved #defines into driver, seems to be general agreement and avoids any
cross tree issues -- broonie]

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Reviewed-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Link: https://lore.kernel.org/r/41fb2ed19f584f138336344e2297ae7301f72b75.1608316658.git.agx@sigxcpu.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-21 18:57:28 +00:00
Mark Brown
df9716ec9a
regulator: pf8x00: Use specific compatible strings for devices
The pf8x00 driver supports three devices, the DT compatible strings
and I2C IDs should enumerate these specifically rather than using a
wildcard so that we don't collide with anything incompatible in the
same ID range in the future and so that we can handle any software
visible differences between the variants we find.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20201215132024.13356-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-16 13:53:55 +00:00
Mark Brown
5e999f10a1
Merge remote-tracking branch 'regulator/for-5.11' into regulator-next 2020-12-11 17:48:32 +00:00
Zheng Yongjun
2819569147
regulator: mc13892-regulator: convert comma to semicolon
Replace a comma between expression statements by a semicolon.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Link: https://lore.kernel.org/r/20201211084510.2264-1-zhengyongjun3@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-11 13:23:07 +00:00
Fabio Estevam
6a6939d5f5
regulator: pfuze100: Convert the driver to DT-only
Since 5.10-rc1 i.MX is a devicetree-only platform, so simplify the code
by removing the unused non-DT support.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/20201210212748.5849-1-festevam@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-11 13:23:06 +00:00
Marek Szyprowski
0da6736ecd
regulator: max14577: Add proper module aliases strings
Add proper modalias structures to let this driver load automatically if
compiled as module, because max14577 MFD driver creates MFD cells with
such compatible strings.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20201210112139.5370-1-m.szyprowski@samsung.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-10 14:28:38 +00:00
Mark Brown
9d125387d9
Merge series "regulator: da9121: bug fixes" from Adam Ward <Adam.Ward.opensource@diasemi.com>:
This patch fixes a couple of bugs in the DA9121 driver.
One in an uninialised string I forgot to remove when changing to of_parse_cb()
The other is an index for an optional DT property which overflows

Adam Ward (2):
  regulator: da9121: Remove uninitialised string variable
  regulator: da9121: Fix index used for DT property

 drivers/regulator/da9121-regulator.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--
1.9.1
2020-12-08 17:06:43 +00:00
Dan Carpenter
8db06423e0
regulator: da9121: Potential Oops in da9121_assign_chip_model()
There is a missing "return ret;" on this error path so we call
"da9121_check_device_type(i2c, chip);" which will end up dereferencing
"chip->regmap" and lead to an Oops.

Fixes: c860476b9e ("regulator: da9121: Add device variant regmaps")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/X85soGKnWAjPUA7a@mwanda
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-08 14:21:13 +00:00
Adam Ward
9536ce6370
regulator: da9121: Fix index used for DT property
Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/2cf324b68d37c4059c7995e8cab5fc9a608ea65d.1607361013.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-07 18:51:32 +00:00
Adam Ward
416c29e9ce
regulator: da9121: Remove uninitialised string variable
Erroneously left in when switched to using of_parse_cb()

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/c7a9e947a9582fe0150d860b5eab7e093cd832bb.1607361013.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-07 18:51:31 +00:00
DingHua Ma
291de1d102
regulator: axp20x: Fix DLDO2 voltage control register mask for AXP22x
When I use the axp20x chip to power my SDIO device on the 5.4 kernel,
the output voltage of DLDO2 is wrong. After comparing the register
manual and source code of the chip, I found that the mask bit of the
driver register of the port was wrong. I fixed this error by modifying
the mask register of the source code. This error seems to be a copy
error of the macro when writing the code. Now the voltage output of
the DLDO2 port of axp20x is correct. My development environment is
Allwinner A40I of arm architecture, and the kernel version is 5.4.

Signed-off-by: DingHua Ma <dinghua.ma.sz@gmail.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Cc: <stable@vger.kernel.org>
Fixes: db4a555f7c ("regulator: axp20x: use defines for masks")
Link: https://lore.kernel.org/r/20201201001000.22302-1-dinghua.ma.sz@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-04 18:56:12 +00:00
Vinod Koul
bebb2c6d5c
regulator: qcom-rpmh: Add support for PM8350/PM8350c
Add support from RPMH regulators found in PM8350 and PM8350c PMICs

Signed-off-by: Vinod Koul <vkoul@kernel.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20201203071244.2652297-2-vkoul@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-04 17:46:18 +00:00
Arnd Bergmann
b4b277760a
regulator: da9121: include linux/gpio/consumer.h
When CONFIG_GPIOLIB is disabled, the declarations from linux/gpio/consumer.h
are not visible:

drivers/regulator/da9121-regulator.c:371:14: error: implicit declaration of function 'fwnode_gpiod_get_index' [-Werror,-Wimplicit-function-declaration]
        ena_gpiod = fwnode_gpiod_get_index(of_fwnode_handle(np), "enable", 0,
                    ^
drivers/regulator/da9121-regulator.c:372:7: error: use of undeclared identifier 'GPIOD_OUT_HIGH'
                                                GPIOD_OUT_HIGH |
                                                ^
drivers/regulator/da9121-regulator.c:373:7: error: use of undeclared identifier 'GPIOD_FLAGS_BIT_NONEXCLUSIVE'
                                                GPIOD_FLAGS_BIT_NONEXCLUSIVE,

Include this explicitly to help compile testing.

Fixes: 46c413d5bb ("regulator: da9121: Add support for device variants via devicetree")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20201204165229.3754763-1-arnd@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-04 17:46:16 +00:00
Zou Wei
c8dbf2f200
regulator: da9121: Mark some symbols with static keyword
Fix the following sparse warnings:

drivers/regulator/da9121-regulator.c:55:21: warning: symbol 'da9121_10A_2phase_current' was not declared. Should it be static?
drivers/regulator/da9121-regulator.c:63:21: warning: symbol 'da9121_6A_2phase_current' was not declared. Should it be static?
drivers/regulator/da9121-regulator.c:71:21: warning: symbol 'da9121_5A_1phase_current' was not declared. Should it be static?
drivers/regulator/da9121-regulator.c:79:21: warning: symbol 'da9121_3A_1phase_current' was not declared. Should it be static?
drivers/regulator/da9121-regulator.c:151:32: warning: symbol 'status_event_handling' was not declared. Should it be static?

Signed-off-by: Zou Wei <zou_wei@huawei.com>
Acked-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/1606994795-36182-1-git-send-email-zou_wei@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-03 14:53:49 +00:00
Adam Ward
5e191d2e05
regulator: da9121: Request IRQ directly and free in release function to avoid masking race
Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/24b2d8b0c3536408369add034221b1141e58bbfc.1606908582.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-02 16:09:00 +00:00
Adam Ward
40bb5b02ff
regulator: da9121: add interrupt support
Adds interrupt handler for variants, and notifications for events; over
temperature/voltage/current. Because the IRQs are triggered by persisting
status, they must be masked and the status polled until clear, before the
IRQ can be enabled again.

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/fe21796bbcbadff84a472a4cc581ae8fafc7f8f5.1606755367.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-01 12:18:04 +00:00
Adam Ward
65ac97042d
regulator: da9121: add mode support
Adds get/set for mode, and mapping from REGULATOR_MODE_* to select
PFM/PWM/Auto operation.

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/7844c8f6facb6f7c0649381629cc75ccad14723d.1606755367.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-01 12:18:03 +00:00
Adam Ward
5c4b62af1d
regulator: da9121: add current support
This commit adds support for getting/setting current for all supported
variants. Limits are adjusted per variant to match HW implementation.

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/9aa80b909893dbe609730919ed595c6a8ac26606.1606755367.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-01 12:18:02 +00:00
Adam Ward
9929900d18
regulator: da9121: Update registration to support multiple buck variants
Add function which iterates the regulator descriptors for the confirmed
variant ID and registers each buck.

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/1fd53c3ab032ef3c8a92f80a2247381db1c09ced.1606755367.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-01 12:18:01 +00:00
Adam Ward
46c413d5bb
regulator: da9121: Add support for device variants via devicetree
Add devicetree configuration and device variant parameters. Use the latter
to enable the check and use of parameters specific to dual buck variants.

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/5849ce60595aef1018bdde7dcfb54a7397597545.1606755367.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-01 12:18:00 +00:00
Adam Ward
91863239ce
regulator: da9121: Add device variant descriptors
Descriptors for bucks in all variants, ready for of_regulator_match

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/8f7a11d59e5ac3ba1bfd448bcfc905efc99b7874.1606755367.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-01 12:17:59 +00:00
Adam Ward
c860476b9e
regulator: da9121: Add device variant regmaps
Add ability to probe device and validate configuration, then apply a regmap
configuration for a single or dual buck device accordingly.

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/068c6b8d5e1b4e221e899e4c914c429429a2ec7d.1606755367.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-01 12:17:58 +00:00
Adam Ward
f3fbd5566f
regulator: da9121: Add device variants
Add basic support for configuration to reference variants of this device,
and track the selected variant within the driver.

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/aaabd3063593e5172fa6b605884d475df64e6d65.1606755367.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-01 12:17:57 +00:00
Adam Ward
86f162c91f
regulator: da9121: Add header file
Add header file for Dialog Semiconductor DA9121 regulator and related
devices, mostly autogenerated from the chip design databases, and update
driver to replace local defines with those from header.

Signed-off-by: Adam Ward <Adam.Ward.opensource@diasemi.com>
Link: https://lore.kernel.org/r/3527d84448d1e6ddc0fcb883ae564880f75a6cb0.1606755367.git.Adam.Ward.opensource@diasemi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-01 12:17:56 +00:00
Jagan Teki
d3795d6321
regulator: Add NXP PF8X00 regulator driver
Add NXP PF8100/PF8121A/PF8200 regulator driver.

PF8100/PF8121A/PF8200 is PMIC designed for highperformance
consumer applications. It features seven high efficiency buck,
four linear and one vsnvs regulators.

Tested in Engicam i.Core MX8M Mini SOM platform boards.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Link: https://lore.kernel.org/r/20201130112329.104614-2-jagan@amarulasolutions.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-30 12:56:19 +00:00
Vinod Koul
36dd70ceb4
regulator: qcom-rpmh: Add support for SDX55
Add support from RPMH regulators found in SDX55 platform

Signed-off-by: Vinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/r/20201126093018.1085594-2-vkoul@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-26 13:08:17 +00:00
Claudiu Beznea
55cca73931
regulator: core: return zero for selectors lower than linear_min_sel
Selectors lower than linear_min_sel should not be considered invalid.
Thus return zero in case _regulator_list_voltage(),
regulator_list_hardware_vsel() or regulator_list_voltage_table()
receives such selectors as argument.

Fixes: bdcd117757 ("regulator: core: validate selector against linear_min_sel")
Reported-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/1606325147-606-1-git-send-email-claudiu.beznea@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-26 13:08:15 +00:00
John Stultz
34c5aa2666
regulator: Kconfig: Fix REGULATOR_QCOM_RPMH dependencies to avoid build error
The kernel test robot reported the following build error:

All errors (new ones prefixed by >>):

   xtensa-linux-ld: drivers/regulator/qcom-rpmh-regulator.o: in function `rpmh_regulator_vrm_get_voltage_sel':
   qcom-rpmh-regulator.c:(.text+0x270): undefined reference to `rpmh_write'
   xtensa-linux-ld: drivers/regulator/qcom-rpmh-regulator.o: in function `rpmh_regulator_send_request':
   qcom-rpmh-regulator.c:(.text+0x2f2): undefined reference to `rpmh_write'
   xtensa-linux-ld: drivers/regulator/qcom-rpmh-regulator.o: in function `rpmh_regulator_vrm_get_voltage_sel':
>> qcom-rpmh-regulator.c:(.text+0x274): undefined reference to `rpmh_write_async'
   xtensa-linux-ld: drivers/regulator/qcom-rpmh-regulator.o: in function `rpmh_regulator_send_request':
   qcom-rpmh-regulator.c:(.text+0x2fc): undefined reference to `rpmh_write_async'

Which is due to REGULATOR_QCOM_RPMH depending on
QCOM_RPMH || COMPILE_TEST. The problem is that QOM_RPMH can now
be a module, which in that case requires REGULATOR_QCOM_RPMH=m
to build.

However, if COMPILE_TEST is enabled, REGULATOR_QCOM_RPMH can be
set to =y while QCOM_RPMH=m which will cause build failures.

The fix here is to add (QCOM_RPMH=n && COMPILE_TEST) to the
dependency.

Feedback would be appreciated!

Cc: Todd Kjos <tkjos@google.com>
Cc: Saravana Kannan <saravanak@google.com>
Cc: Andy Gross <agross@kernel.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Rajendra Nayak <rnayak@codeaurora.org>
Cc: Maulik Shah <mkshah@codeaurora.org>
Cc: Stephen Boyd <swboyd@chromium.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: linux-arm-msm@vger.kernel.org
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20201123222359.103822-1-john.stultz@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-24 14:14:01 +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
Mark Brown
5d16a4f954
Merge series "Add support for SCMIv3.0 Voltage Domain Protocol and SCMI-Regulator" from Cristian Marussi <cristian.marussi@arm.com>:
Hi,

this series introduces the support for the new SCMI Voltage Domain Protocol
defined by the upcoming SCMIv3.0 specification, whose BETA release is
available at [1].

Afterwards, a new generic SCMI Regulator driver is developed on top of the
new SCMI VD Protocol.

In V4 Patch 3/5 introduced a needed fix in Regulator framework to cope with
generic named nodes.

The series is currently based on for-next/scmi [2] on top of:

commit b141fca08207 ("firmware: arm_scmi: Fix missing destroy_workqueue()")

Any feedback welcome,

Thanks,

Cristian

---
v5 --> v6
- reordered dt bindings patch
- removed single field struct
- reviewed args to scmi_init_voltage_levels()
- allocating scmi_voltage_info_array contiguously

v4 --> v5
- rebased
- VD Protocol
 - removed inline
 - moved segmented intervals defines
 - fixed some macros complaints by checkpatch

v3 --> v4
- DT bindings
 - using generic node names
 - listing explicitly subset of supported regulators bindings
- SCMI Regulator
 - using of_match_full_name core regulator flag
 - avoid coccinelle false flag complaints
- VD Protocol
 - avoid coccinelle false flag complaints
 - avoiding fixed size typing

v2 --> v3
- DT bindings
  - avoid awkard examples based on _cpu/_gpu regulators
- SCMI Regulator
  - remove multiple linear mappings support
  - removed duplicated voltage name printout
  - added a few comments
  - simplified return path in scmi_reg_set_voltage_sel()
- VD Protocol
  - restrict segmented voltage domain descriptors to one triplet
  - removed unneeded inline
  - free allocated resources for invalid voltage domain
  - added __must_check to info_get voltage operations
  - added a few comments
  - removed fixed size typing from struct voltage_info

v1 --> v2
- rebased on for-next/scmi v5.10
- DT bindings
  - removed any reference to negative voltages
- SCMI Regulator
  - removed duplicate regulator naming
  - removed redundant .get/set_voltage ops: only _sel variants implemented
  - removed condexpr on fail path to increase readability
- VD Protocol
  - fix voltage levels query loop to reload full cmd description
    between iterations as reported by Etienne Carriere
  - ensure transport rx buffer is properly sized calli scmi_reset_rx_to_maxsz
    between transfers

[1]:https://developer.arm.com/documentation/den0056/c/
[2]:https://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux.git/log/?h=for-next/scmi

Cristian Marussi (5):
  firmware: arm_scmi: Add Voltage Domain Support
  firmware: arm_scmi: add SCMI Voltage Domain devname
  regulator: core: add of_match_full_name boolean flag
  dt-bindings: arm: add support for SCMI Regulators
  regulator: add SCMI driver

 .../devicetree/bindings/arm/arm,scmi.txt      |  43 ++
 drivers/firmware/arm_scmi/Makefile            |   2 +-
 drivers/firmware/arm_scmi/common.h            |   1 +
 drivers/firmware/arm_scmi/driver.c            |   3 +
 drivers/firmware/arm_scmi/voltage.c           | 380 ++++++++++++++++
 drivers/regulator/Kconfig                     |   9 +
 drivers/regulator/Makefile                    |   1 +
 drivers/regulator/of_regulator.c              |   8 +-
 drivers/regulator/scmi-regulator.c            | 409 ++++++++++++++++++
 include/linux/regulator/driver.h              |   3 +
 include/linux/scmi_protocol.h                 |  64 +++
 11 files changed, 920 insertions(+), 3 deletions(-)
 create mode 100644 drivers/firmware/arm_scmi/voltage.c
 create mode 100644 drivers/regulator/scmi-regulator.c

--
2.17.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
2020-11-23 20:36:50 +00:00
Gustavo A. R. Silva
b52b417cca
regulator: as3722: Fix fall-through warnings for Clang
In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
by explicitly adding a fallthrough pseudo-keyword instead of letting the
code fall through to the next case.

Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/c0efb81064f71837f19408f65b52d155103ee514.1605896059.git.gustavoars@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-23 18:46:31 +00:00
Cristian Marussi
e7095c35ab
regulator: core: add of_match_full_name boolean flag
During regulators registration, if .of_match and .regulators_node are
defined as non-null strings in struct regulator_desc the core searches the
DT subtree rooted at .regulators_node trying to match, at first, .of_match
against the 'regulator-compatible' property and, then, falling back to use
the name of the node itself to determine a good match.

Property 'regulator-compatible', though, is now deprecated and falling back
to match against the node name, works fine only as long as the involved
nodes are named in an unique way across the searched subtree; if that's not
the case, like when using <common-name>@<unit> style naming for properties
indexed via 'reg' property (as advised by the standard), the above matching
mechanism based on the simple common name will lead to multiple matches and
the only viable alternative would be to properly define the now deprecated
'regulator-compatible' as the node full name, i.e. <common-name>@<unit>.

In order to address this case without using such deprecated binding, define
a new boolean flag .of_match_full_name in struct regulator_desc to force
the core to match against the node full-name instead of the plain name.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Link: https://lore.kernel.org/r/20201119191051.46363-4-cristian.marussi@arm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-23 18:38:13 +00:00
Nishanth Menon
2ba546ebe0
regulator: ti-abb: Fix array out of bound read access on the first transition
At the start of driver initialization, we do not know what bias
setting the bootloader has configured the system for and we only know
for certain the very first time we do a transition.

However, since the initial value of the comparison index is -EINVAL,
this negative value results in an array out of bound access on the
very first transition.

Since we don't know what the setting is, we just set the bias
configuration as there is nothing to compare against. This prevents
the array out of bound access.

NOTE: Even though we could use a more relaxed check of "< 0" the only
valid values(ignoring cosmic ray induced bitflips) are -EINVAL, 0+.

Fixes: 40b1936efe ("regulator: Introduce TI Adaptive Body Bias(ABB) on-chip LDO driver")
Link: https://lore.kernel.org/linux-mm/CA+G9fYuk4imvhyCN7D7T6PMDH6oNp6HDCRiTUKMQ6QXXjBa4ag@mail.gmail.com/
Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Nishanth Menon <nm@ti.com>
Link: https://lore.kernel.org/r/20201118145009.10492-1-nm@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-18 17:59:24 +00:00
Claudiu Beznea
ab97800e08
regulator: core: do not continue if selector match
Do not continue if selector has already been located.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/1605290164-11556-1-git-send-email-claudiu.beznea@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-13 18:02:07 +00:00
Mark Brown
2f595d0861
Merge series "regulator: mcp16502: add support for ramp delay" from Claudiu Beznea <claudiu.beznea@microchip.com>:
Hi,

This series adds support for ramp delay on mcp16502. It also adds
some cleanup on mcp16502.

Apart from that patches 1/6 fixes the selector validation in case
the regulator::desc::linear_min_sel is not zero.

Thank you,
Claudiu Beznea

Changes in v3:
- fix compilation error in patch 5/6
  Reported-by: kernel test robot <lkp@intel.com>

Changes in v2:
- rebase on top of regulator/for-next
- checked 1/6 and 3/6 applies on top of regulator/for-5.10

Claudiu Beznea (6):
  regulator: core: validate selector against linear_min_sel
  regulator: core: do not continue if selector match
  regulator: mcp16502: add linear_min_sel
  regulator: mcp16502: adapt for get/set on other registers
  regulator: mcp16502: add support for ramp delay
  regulator: mcp16502: remove void documentation of struct mcp16502

 drivers/regulator/core.c     |  12 +++-
 drivers/regulator/helpers.c  |   3 +-
 drivers/regulator/mcp16502.c | 135 ++++++++++++++++++++++++++++++++++++-------
 3 files changed, 127 insertions(+), 23 deletions(-)

--
2.7.4

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
2020-11-13 17:09:18 +00:00
Claudiu Beznea
bdcd117757
regulator: core: validate selector against linear_min_sel
There are regulators who's min selector is not zero. Selectors loops
(looping b/w zero and regulator::desc::n_voltages) might throw errors
because invalid selectors are used (lower than
regulator::desc::linear_min_sel). For this situations validate selectors
against regulator::desc::linear_min_sel.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/1605280870-32432-2-git-send-email-claudiu.beznea@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-13 16:13:11 +00:00
Claudiu Beznea
842f44806e
regulator: mcp16502: remove void documentation of struct mcp16502
struct mcp16502 has no members called rdev or rmap. Remove the
documentation.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/1605280870-32432-7-git-send-email-claudiu.beznea@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-13 16:13:11 +00:00
Claudiu Beznea
322eb8666d
regulator: mcp16502: add support for ramp delay
MCP16502 have configurable ramp delay support (via DVSR bits in
regulators' CFG register).

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/1605280870-32432-6-git-send-email-claudiu.beznea@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-13 16:13:10 +00:00
Claudiu Beznea
3e5532a011
regulator: mcp16502: adapt for get/set on other registers
MCP16502 have multiple registers for each regulator (as described
in enum mcp16502_reg). Adapt the code to be able to get/set all these
registers. This is necessary for the following commits.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/1605280870-32432-5-git-send-email-claudiu.beznea@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-13 16:13:09 +00:00
Claudiu Beznea
478f808916
regulator: mcp16502: add linear_min_sel
Selectors b/w zero and VDD_LOW_SEL are not valid. Use linear_min_sel.

Fixes: 919261c03e ("regulator: mcp16502: add regulator driver for MCP16502")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/1605280870-32432-4-git-send-email-claudiu.beznea@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-13 16:13:08 +00:00
Michał Mirosław
0917c9db23
regulator: debug early supply resolving
Help debugging the case when set_machine_constraints() needs to be
repeated.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de> # stpmic1
Link: https://lore.kernel.org/r/f9cba575580369e46661a9278ee6c6a8d8564c2a.1605226675.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-13 16:10:05 +00:00
Michał Mirosław
f5c042b23f
regulator: workaround self-referent regulators
Workaround regulators whose supply name happens to be the same as its
own name. This fixes boards that used to work before the early supply
resolving was removed. The error message is left in place so that
offending drivers can be detected.

Fixes: aea6cb9970 ("regulator: resolve supply after creating regulator")
Cc: stable@vger.kernel.org
Reported-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de> # stpmic1
Link: https://lore.kernel.org/r/d703acde2a93100c3c7a81059d716c50ad1b1f52.1605226675.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-13 14:21:26 +00:00
Michał Mirosław
4b639e254d
regulator: avoid resolve_supply() infinite recursion
When a regulator's name equals its supply's name the
regulator_resolve_supply() recurses indefinitely. Add a check
so that debugging the problem is easier. The "fixed" commit
just exposed the problem.

Fixes: aea6cb9970 ("regulator: resolve supply after creating regulator")
Cc: stable@vger.kernel.org
Reported-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de> # stpmic1
Link: https://lore.kernel.org/r/c6171057cfc0896f950c4d8cb82df0f9f1b89ad9.1605226675.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-13 14:21:25 +00:00
Michał Mirosław
57a6ad482a
regulator: fix memory leak with repeated set_machine_constraints()
Fixed commit introduced a possible second call to
set_machine_constraints() and that allocates memory for
rdev->constraints. Move the allocation to the caller so
it's easier to manage and done once.

Fixes: aea6cb9970 ("regulator: resolve supply after creating regulator")
Cc: stable@vger.kernel.org
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de> # stpmic1
Link: https://lore.kernel.org/r/78c3d4016cebc08d441aad18cb924b4e4d9cf9df.1605226675.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-13 14:21:24 +00:00
Mark Brown
811c732f46
Merge branch 'for-5.10' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-5.11 2020-11-11 12:37:42 +00:00
Sean Nyekjaer
365ec8b616
regulator: pfuze100: limit pfuze-support-disable-sw to pfuze{100,200}
Limit the fsl,pfuze-support-disable-sw to the pfuze100 and pfuze200
variants.
When enabling fsl,pfuze-support-disable-sw and using a pfuze3000 or
pfuze3001, the driver would choose pfuze100_sw_disable_regulator_ops
instead of the newly introduced and correct pfuze3000_sw_regulator_ops.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Fixes: 6f1cf5257a ("regualtor: pfuze100: correct sw1a/sw2 on pfuze3000")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20201110174113.2066534-1-sean@geanix.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-11 12:34:27 +00:00
Mark Brown
51c0a0c63f
Merge series "regulator: bd718x7: support voltage scaling" from Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>:
RFC for adding a support for typical voltage scaling connection

In few occasions there has been a need to scale the voltage output
from bucks on BD71837. Usually this is done when buck8 is used to
power specific GPU which can utilize voltages down to 0.7V. As lowest
the buck8 on BD71837 can go is 0.8V, and external connection is used to
scale the voltages.

The BD71837, BD71847 and BD71850 bucks can be adjusted by pulling up the
feedback pin using suitable voltage/resistors.

	|---------------|
	|       buck 8  |-------+----->Vout
	|               |       |
	|---------------|       |
	       |                |
	       |                |
	       +-------+--R2----+
	               |
	               R1
	               |
	       V FB-pull-up

This will scale the voltage as follows:
 - Vout_o = Vo - (Vpu - Vo)*R2/R1
 - Linear_step = step_orig*(R1+R2)/R1
where:
Vout_o is adjusted voltage output at vsel reg value 0
Vo is original voltage output at vsel reg value 0
Vpu is the pull-up voltage V FB-pull-up in the picture
R1 and R2 are resistor values.

>From HW point of view this does not need to be limited to buck 8. This
connection can be used to adjust output from any of the bucks on
BD71837/47/50.

As this seems to be a 'de-facto' way to scale the voltages on BD71837 it
might be a good idea to support computing the new voltage ranges for
bucks based on the V-pull-up and resistor R1/R2 values given from
device-tree. This allows describing the external HW connection using DT
to correctly scale the voltages.

This RFC uses "rohm,feedback-pull-up-r1-ohms" and
"rohm,feedback-pull-up-r2-ohms" to provide the resistor values - but
these names (without the picture) might not be too descriptive. I am
grateful for all suggestions as better and more descriptive names.

This patch series is an RFC because this connection feels somewhat
"hacky". OTOH - when hack becomes widely used, it is less of an hack and
more of a standard - and occasionally supporting HW hacks using SW may
benefit us all, right? :)

The other thing some projects do is allowing the change of BD71837 buck8
voltages when buck8 is enabled. This however will introduce voltage
spikes as buck8 was not originally designed for this. The specific HW
platform must be evaluated to be able to tolerate these spikes. Thus
this patch series does not support buck8 voltage changes when buck8 is
enabled. I wonder if this should be allowed per some config option(?) I
don't want to help people frying their boards... Opinions? Is there
suggested way of allowing this type of features at own risk? Config or
even Some #ifdef which is not listed in Kconfig? Device-tree property?
 If you have (good) suggestions I could add the optional (non default)
DVS support for non DVS bucks on BD71837.

Matti Vaittinen (3):
  dt-bindings: regulator: BD71837 support commonly used feedback
    connection
  dt-bindings: regulator: BD71847 support commonly used feedback
    connection
  regulator: bd718x7: Support external connection to scale voltages

 .../regulator/rohm,bd71837-regulator.yaml     |  48 +++++
 .../regulator/rohm,bd71847-regulator.yaml     |  49 ++++++
 drivers/regulator/bd718x7-regulator.c         | 164 +++++++++++++++++-
 3 files changed, 254 insertions(+), 7 deletions(-)

base-commit: 3cea11cd5e
--
2.21.3

--
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =]
2020-11-10 21:36:14 +00:00
Matti Vaittinen
d2ad981151
regulator: bd718x7: Support external connection to scale voltages
Setups where regulator (especially the buck8) output voltage is scaled
by adding external connection where some other regulator output is
connected to feedback-pin (over suitable resistors) is getting popular
amongst users of BD71837. This allows for example scaling down the
buck8 voltages to suit lover GPU voltages for projects where buck8 is
(ab)used to supply power for GPU. As a note - some setups do allow DVS
for buck8. This do produce voltage spikes and the HW must be evaluated
to be able to survive them. Thus this commit still keep the DVS disabled
for non DVS bucks by default. Let's not help you burn your proto board.

Allow describing this external connection from DT and scale the
voltages accordingly. This is what the connection should look like:

|------------|
|    buck 8  |-------+----->Vout
|            |       |
|------------|       |
     | FB pin        |
     |               |
     +-------+--R2---+
             |
             R1
             |
     V FB-pull-up

     Here the buck output is sifted according to formula:

Vout_o = Vo - (Vpu - Vo)*R2/R1
Linear_step = step_orig*(R1+R2)/R1

where:
Vout_o is adjusted voltage output at vsel reg value 0
Vo is original voltage output at vsel reg value 0
Vpu is the pull-up voltage V FB-pull-up in the picture
R1 and R2 are resistor values.

Bring support for specifying the Vpu, R1 and R2 from device tree and
scale voltages if they are given.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Link: https://lore.kernel.org/r/89b2be87074f307a8823f15f34e1f662023cbf36.1604994184.git.matti.vaittinen@fi.rohmeurope.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-10 17:31:41 +00:00
Pi-Hsun Shih
c088a4985e
regulator: core: don't disable regulator if is_enabled return error.
In regulator_late_cleanup when is_enabled failed, don't try to disable
the regulator since it would likely to fail too and causing confusing
error messages.

Signed-off-by: Pi-Hsun Shih <pihsun@chromium.org>
Link: https://lore.kernel.org/r/20201106064817.3290927-1-pihsun@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-10 17:27:42 +00:00
Vincent Whitchurch
e6ff10f24c
regulator: Add support for DA9121 regulator
Add support for the Dialog Semiconductor DA9121, a single-channel
dual-phase buck converter controlled via I2C.

Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Link: https://lore.kernel.org/r/20201103100021.19603-3-vincent.whitchurch@axis.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-03 13:19:46 +00:00
Michał Mirosław
cf1ad559a2
regulator: defer probe when trying to get voltage from unresolved supply
regulator_get_voltage_rdev() is called in regulator probe() when
applying machine constraints.  The "fixed" commit exposed the problem
that non-bypassed regulators can forward the request to its parent
(like bypassed ones) supply. Return -EPROBE_DEFER when the supply
is expected but not resolved yet.

Fixes: aea6cb9970 ("regulator: resolve supply after creating regulator")
Cc: stable@vger.kernel.org
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Reported-by: Ondřej Jirman <megous@megous.com>
Reported-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Tested-by: Ondřej Jirman <megous@megous.com>
Link: https://lore.kernel.org/r/a9041d68b4d35e4a2dd71629c8a6422662acb5ee.1604351936.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-03 13:19:01 +00:00
Mauro Carvalho Chehab
d73e873bcf
regulator: fix a kernel-doc markup
It seems that the function was renamed. kernel-doc markup
should follow it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/dffad16d4d6427d7d0fc89797e4126fe7c69d5de.1603469755.git.mchehab+huawei@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-28 16:21:39 +00:00
Mark Brown
f88d47190a
Merge series " [PATCH v2 0/5]" from Dmitry Baryshkov <dmitry.baryshkov@linaro.org>:
On SM8250 MDSS_GDSC (and the rest of display clock controller) is
supplied power by MMCX power domain. Handle this link in GDSC code by
binding the power domain in dts file.

This patchset depends on [1]

Changes since v1:
 - Define fixed-regulator-domain regulator using power domain
   performance state for enabling/disabling.
 - Rework to use new fixed regulator type (fixed-regulator-domain)
   instead of controlling power domain directly from gdsc code.

Changes since RFC:
 - Fix naming of gdsc_supply_on/gdsc_supply_off functions
 - Fix detaching of solo gdsc's power domain in error handling code
 - Drop the dts patch, as respective display nodes are still not
   submitted to the mailing list.

[1]
https://lore.kernel.org/linux-arm-msm/20200927190653.13876-1-jonathan@marek.ca/
2020-10-26 20:56:59 +00:00
Colin Ian King
390d828f56
regulator: lp872x: make a const array static, makes object smaller
Don't populate const array lp872x_num_regulators  on the stack but
instead make it static. Makes the object code smaller by 29 bytes.

Before:
   text	   data	    bss	    dec	    hex	filename
  18441	   4624	     64	  23129	   5a59	drivers/regulator/lp872x.o

After:
   text	   data	    bss	    dec	    hex	filename
  18316	   4720	     64	  23100	   5a3c	drivers/regulator/lp872x.o

(gcc version 10.2.0)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20201016222235.686981-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-26 20:56:58 +00:00
Dmitry Baryshkov
bf3a28cf42
regulator: fixed: support using power domain for enable/disable
Adds possibility to choose the compatible "fixed-regulator-domain" for
regulators which use power domain for enabling/disabling corresponding
regulator.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20201023131925.334864-3-dmitry.baryshkov@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-26 20:46:26 +00:00
Mark Brown
c6e70a6fd5
Merge remote-tracking branch 'regulator/for-5.10' into regulator-next 2020-10-05 16:54:56 +01:00
Matti Vaittinen
184cdb8f6d
regulator: bd9576: Fix print
The print in probe is done using pr_info. Correct print call would be
dev_dbg because:
 - Severity should really be dbg
 - The dev pointer is given as first argument

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Link: https://lore.kernel.org/r/c4f55add237455555df0597c72052022f7a669f6.1601885841.git.matti.vaittinen@fi.rohmeurope.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-05 16:18:40 +01:00
Vladimir Lypak
b1a2fb10b8
regulator: qcom_smd: add pm8953 regulators
The PM8953 is commonly used on board with MSM8953 SoCs or its variants:
APQ8053, SDM(SDA)450 and SDM(SDA)632.
It provides 7 SMPS and 23 LDO regulators.

Signed-off-by: Vladimir Lypak <junak.pub@gmail.com>
Link: https://lore.kernel.org/r/20201004083413.324351-1-junak.pub@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-05 16:18:37 +01:00
Geert Uytterhoeven
c845f21ad8
regulator: Make constraint debug processing conditional on DEBUG
If debugging is disabled, print_constraints() does not print the actual
constraints, but still performs some processing and string formatting,
only to throw away the result later.

Fix this by moving all constraint debug processing to a separate
function, and replacing it by a dummy when debugging is disabled.
This reduces kernel size by almost 800 bytes (on arm/arm64).

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20201005131546.22448-1-geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-05 16:18:36 +01:00
Mark Brown
0b5a218706
Merge series "Support for PM660/PM660L SPMI and SMD regulators" from kholk11@gmail.com
AngeloGioacchino Del Regno <kholk11@gmail.com>:

From: AngeloGioacchino Del Regno <kholk11@gmail.com>

This patch series enables support for the regulators as found in
the PM660 and PM660L PMICs.
While at it, and to make them work, along with other regulators
for other qcom PMICs, enlarge the maximum property name length in
the regulator core, so that we're able to correctly parse the
supply parents, which have got very long names (details in patch 1/5).

This patch series has been tested against the following devices:
 - Sony Xperia XA2 Ultra (SDM630 Nile Discovery)
 - Sony Xperia 10        (SDM630 Ganges Kirin)
 - Sony Xperia 10 Plus   (SDM636 Ganges Mermaid)

AngeloGioacchino Del Regno (7):
  regulator: core: Enlarge max OF property name length to 64 chars
  regulator: qcom_spmi: Add support for new regulator types
  regulator: qcom_spmi: Add PM660/PM660L regulators
  regulator: dt-bindings: Document the PM660/660L SPMI PMIC entries
  regulator: qcom_smd: Add PM660/PM660L regulator support
  mfd: qcom-spmi-pmic: Add support for PM660/PM660L
  regulator: dt-bindings: Document the PM660/PM660L PMICs entries

 .../regulator/qcom,smd-rpm-regulator.yaml     |   7 ++
 .../regulator/qcom,spmi-regulator.txt         |  31 +++++
 drivers/mfd/qcom-spmi-pmic.c                  |   4 +
 drivers/regulator/core.c                      |   4 +-
 drivers/regulator/qcom_smd-regulator.c        | 113 ++++++++++++++++++
 drivers/regulator/qcom_spmi-regulator.c       | 107 +++++++++++++++++
 include/linux/soc/qcom/smd-rpm.h              |   4 +
 7 files changed, 268 insertions(+), 2 deletions(-)

--
2.28.0
2020-10-01 21:43:17 +01:00
Rikard Falkeborn
e6f5ff17ca
regulator: qcom: labibb: Constify static structs
The only usage of qcom_labibb_ops is to assign it to the ops field in
the regulator_desc struct, which is a const pointer. The only usage of
pmi8998_lab_desc and pmi8998_ibb_desc is to assign their address to the
desc field in the labibb_regulator_data struct which can be made const,
since it is only copied into the desc field in the
labbibb_regulator_data struct. This struct is modified, but that's a
copy of the static one. Make them const to allow the compiler to put
them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20200930162602.18583-1-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-01 21:43:16 +01:00
AngeloGioacchino Del Regno
6d849653b0
regulator: qcom_smd: Add PM660/PM660L regulator support
The PM660 and PM660L are a very very common PMIC combo, found on
boards using the SDM630, SDM636, SDM660 (and SDA variants) SoC.

PM660 provides 6 SMPS and 19 LDOs (of which one is unaccesible),
while PM660L provides 5 SMPS (of which S3 and S4 are combined),
10 LDOs and a Buck-or-Boost (BoB) regulator.

The PM660L IC also provides other regulators that are very
specialized (for example, for the display) and will be managed
in the other appropriate drivers (for example, labibb).

Signed-off-by: AngeloGioacchino Del Regno <kholk11@gmail.com>
Link: https://lore.kernel.org/r/20200926125549.13191-6-kholk11@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-01 21:25:25 +01:00
AngeloGioacchino Del Regno
0074c4472d
regulator: qcom_spmi: Add PM660/PM660L regulators
The PM660 PMIC is very often paired with the PM660L option on
SDM630/663/660 (and SDA variants) boards.

The PM660 has 11 "660" LDOs (2 NMOS, 9 PMOS) and 7 HT LDOs (4 NMOS,
3 PMOS) and a quirk: the L4 regulator is unaccessible or does not
exist on the PMIC.
The PM660L has 8 "660" LDOs (1 NMOS, 7 PMOS) and 2 HT NMOS LDOs.

Signed-off-by: AngeloGioacchino Del Regno <kholk11@gmail.com>
Link: https://lore.kernel.org/r/20200926125549.13191-4-kholk11@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-01 21:25:23 +01:00
AngeloGioacchino Del Regno
328816c203
regulator: qcom_spmi: Add support for new regulator types
This commit adds the support for some regulator types that are
missing in this driver, such as the ht nmos-ldo, ht-lv nmos-ldo
and new gen n/pmos-ldo, all belonging to the FTSMPS426 register
layout.
This is done in preparation for adding support for the PM660 and
PM660L PMICs.

Signed-off-by: AngeloGioacchino Del Regno <kholk11@gmail.com>
Link: https://lore.kernel.org/r/20200926125549.13191-3-kholk11@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-01 21:25:22 +01:00
AngeloGioacchino Del Regno
e9bb4a068b
regulator: core: Enlarge max OF property name length to 64 chars
Some regulator drivers may be defining very long names: this is the
case with the qcom_smd and qcom_spmi regulators, where we need to
parse the regulator parents from DT.

For clarity, this is an example:
{ "l13a", QCOM_SMD_RPM_LDOA, 13, &pm660_ht_lvpldo,
  "vdd_l8_l9_l10_l11_l12_l13_l14" },
pm660-regulators {
	...
	vdd_l8_l9_l10_l11_l12_l13_l14-supply = <&vreg_s4a_2p04>
	...
};
Now, with a 32 characters limit, the function is trying to parse,
exactly, "vdd_l8_l9_l10_l11_l12_l13_l14-s" (32 chars) instead of
the right one, which is 37 chars long in this specific case.

... And this is not only the case with PM660/PM660L, but also with
PMA8084, PM8916, PM8950 and others that are not implemented yet.

The length of 64 chars was chosen based on the longest parsed property
name that I could find, which is in PM8916, and would be 53 characters
long.
At that point, rounding that to 64 looked like being the best idea.

Signed-off-by: AngeloGioacchino Del Regno <kholk11@gmail.com>
Link: https://lore.kernel.org/r/20200926125549.13191-2-kholk11@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-01 21:25:21 +01:00
Michał Mirosław
bd8e2cad4e
regulator: tps65910: use regmap accessors
Use regmap accessors directly for register manipulation - removing
one layer of abstraction.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Link: https://lore.kernel.org/r/e82886d0f8f5131c9fccf2a17e3a15acce507d6f.1601164493.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-01 16:29:17 +01:00
ChiYuan Huang
6228cc8aed
regulator: rtmv20: Add missing regcache cache only before marked as dirty
Add missing regcache cache only before masked as dirty.

Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
Link: https://lore.kernel.org/r/1601461132-15251-1-git-send-email-u0084500@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-30 12:58:09 +01:00
ChiYuan Huang
89a5f77e3f
regulator: rtmv20: Update DT binding document and property name parsing
1. Add vendor suffix to all proprietary properties.
2. Fix typo.
3. Change lsw to normal property, not pattern property.
4. Due to item 1, modify source code for property parsing.

Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
Link: https://lore.kernel.org/r/1601460480-4259-1-git-send-email-u0084500@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-30 12:58:08 +01:00
Mark Brown
71d5f4dc7b
Merge series "regulator: debugging aids" from Michał Mirosław <mirq-linux@rere.qmqm.pl>:
Three simple patches to aid in debugging regulators.

Michał Mirosław (3):
  regulator: print state at boot
  regulator: print symbolic errors in kernel messages
  regulator: resolve supply after creating regulator

 drivers/regulator/core.c | 124 ++++++++++++++++++++++-----------------
 1 file changed, 69 insertions(+), 55 deletions(-)

--
2.20.1
2020-09-28 19:26:34 +01:00
ChiYuan Huang
b8c054a5ea
regulator: rtmv20: Adds support for Richtek RTMV20 load switch regulator
Add support for Richtek RTMV20 load switch regulator.

Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
Link: https://lore.kernel.org/r/1601277584-5526-1-git-send-email-u0084500@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 19:26:32 +01:00
Michał Mirosław
aea6cb9970
regulator: resolve supply after creating regulator
When creating a new regulator its supply cannot create the sysfs link
because the device is not yet published. Remove early supply resolving
since it will be done later anyway. This makes the following error
disappear and the symlinks get created instead.

  DCDC_REG1: supplied by VSYS
  VSYS: could not add device link regulator.3 err -2

Note: It doesn't fix the problem for bypassed regulators, though.

Fixes: 45389c4752 ("regulator: core: Add early supply resolution for regulators")
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Link: https://lore.kernel.org/r/ba09e0a8617ffeeb25cb4affffe6f3149319cef8.1601155770.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 19:03:17 +01:00