Commit Graph

28 Commits

Author SHA1 Message Date
Rikard Falkeborn 8d41df6469
regulator: qcom_rpm: Constify struct regulator_ops
These are never modified, so make them const to allow the compiler to
put them in read-only memory.

Before:
   text    data     bss     dec     hex filename
  17485     500       8   17993    4649 drivers/regulator/qcom_rpm-regulator.o

After:
   text    data     bss     dec     hex filename
  17881     104       8   17993    4649 drivers/regulator/qcom_rpm-regulator.o

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20200629194632.8147-2-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-01 18:33:14 +01:00
Mark Brown c50ad6dbf6 lib: Add linear ranges helper library and start using it
Series extracts a "linear ranges" helper out of the regulator
 framework. Linear ranges helper is intended to help converting
 real-world values to register values when conversion is linear. I
 suspect this is useful also for power subsystem and possibly for clk.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl61lKwTHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0HxeB/9dblIbC+28MvcEHXCcYBZBouOnrM8E
 bIOMXkgEj1uL78ozOm7tMCgEpaKgv6BHdDuClCBvjbr0uOtAi0qUiv0IBotuVrdo
 lq73l8l7OPz6TFFKIt8WsgwKnzdkuQC08+qrZasAdluRQnqnmkU2tvl2y9zaaaR4
 6hGw+Nwx/pgeCXCa3pu+rCYwA7g0Tf8a6DDC6LyQWZameBJ1ey/YDjhJEeSmY7P7
 306zs8YVxHhQMLUQ5T7DA6r/KWMNkO1SOueCqTjxWZc/XamGEcbsZG1cWrAnkoE2
 VKLXBtYC75coNxIiu8ZxnQwLLdz1EQPdtg0qmzSjXJ68QjbWWzf4K1ra
 =LG9G
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl61lPUTHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0GuGB/9kDFxKo0DWsH6tqZGS/retk0ddT+4B
 mnkkZGvoKkkDe1lh84vRbrPHhiI9LIXaj3lFgzyYeTuAi9tb77mPNnYIPLDye7bO
 OvgJgovo4tK3dUVSUFatvOhuAMSZLyN2WjWRX+YeHMd1nNZSHxEz0CuG3npNtuKa
 KoZd0Dfom4ds66qDlWdfonFhMJbMvQbEs4BhnfdvpD/soylyDB+29SHlhTBv8+UC
 I7BNzsmVDlp/JyrX3yJbuTum9wbPaMLcyL96EbvRykmTywz5FXudffqzPfPnoQxT
 rbN5DfwKsnySToUYDfp9dcIMyTF0/MtneaeBMRu2NIkpMmnicvExNrbU
 =/+DM
 -----END PGP SIGNATURE-----

Merge tag 'linear-ranges-lib' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-5.8

lib: Add linear ranges helper library and start using it

Series extracts a "linear ranges" helper out of the regulator
framework. Linear ranges helper is intended to help converting
real-world values to register values when conversion is linear. I
suspect this is useful also for power subsystem and possibly for clk.
2020-05-08 18:20:51 +01:00
Matti Vaittinen 60ab7f4153
regulator: use linear_ranges helper
Change the regulator helpers to use common linear_ranges code.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Link: https://lore.kernel.org/r/64f01d5e381b8631a271616b7790f9d5640974fb.1588944082.git.matti.vaittinen@fi.rohmeurope.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-08 18:18:13 +01:00
Jason Yan d2c2c218ea
regulator: qcom_rpm: remove defined but not used 'pm8921_ftsmps'
Fix the following gcc warning:

drivers/regulator/qcom_rpm-regulator.c:607:34: warning: ‘pm8921_ftsmps’
defined but not used [-Wunused-const-variable=]
 static const struct qcom_rpm_reg pm8921_ftsmps = {
                                  ^~~~~~~~~~~~~

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20200409114026.38383-1-yanaijie@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-14 16:57:41 +01:00
Ansuel Smith b5f25304ae
regulator: add smb208 support
Smb208 regulators are used on some ipq806x soc.
Add support for it to make it avaiable on some routers
that use it.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Signed-off-by: Adrian Panella <ianchi74@outlook.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20200219163711.479-1-ansuelsmth@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-02-26 18:29:52 +00:00
Thomas Gleixner 97fb5e8d9b treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284
Based on 1 normalized pattern(s):

  this program is free software you can redistribute it and or modify
  it under the terms of the gnu general public license version 2 and
  only version 2 as published by the free software foundation this
  program is distributed in the hope that it will be useful but
  without any warranty without even the implied warranty of
  merchantability or fitness for a particular purpose see the gnu
  general public license for more details

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-only

has been chosen to replace the boilerplate/reference in 294 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190529141900.825281744@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-05 17:36:37 +02:00
Gustavo A. R. Silva 2f2472baa6 regulator: qcom_rpm-regulator: add NULL check on of_match_device() return value
Check return value from call to of_match_device()
in order to prevent a NULL pointer dereference.

In case of NULL print error message and return.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-07-07 13:42:03 +01:00
Neil Armstrong ddc085d44d regulator: qcom_rpm-regulator: Add support for pm8018 rpm regulator
In order to support the Qualcomm MDM9615 SoC, add support for the
PM8018 RPM regulator in the qcom_rpm-regulator driver.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2016-08-31 09:33:54 +01:00
Bjorn Andersson ce8ae17c5d regulator: qcom: Tidy up probe()
Tidy up error reporting and move rpm reference retrieval out of the for
loop for improved readability.

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-08 12:22:55 +01:00
Bjorn Andersson 087a1b5cdd regulator: qcom: Rework to single platform device
Modeling the individual RPM resources as platform devices consumes at
least 12-15kb of RAM, just to hold the platform_device structs. Rework
this to instead have one device per pmic exposed by the RPM.

With this representation we can more accurately define the input pins on
the pmic and have the supply description match the data sheet.

Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-08 12:22:14 +01:00
Bjorn Andersson 469a951446 regulator: qcom: Refactor of-parsing code
Refactor out all custom property parsing code from the probe function
into a function suitable for regulator_desc->of_parse_cb usage.

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-08 12:22:03 +01:00
Bjorn Andersson 4d1e4d629a regulator: qcom: Don't enable DRMS in driver
The driver itself should not flag regulators as being DRMS compatible,
this should come from board or dt files.

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-08 12:21:39 +01:00
Bjorn Andersson 2b85c28a5a regulator: qcom-rpm: Implement set_load and enable drms
Pass the requested load directly to the rpm.

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-23 23:16:01 +09:00
Linus Torvalds 5c2770079f Changes to existing drivers:
- Repair platform device collision; da9052, wm8994-core
   - Regmap configuration amendments; tps65218
   - Fix runtime PM deadlock; rtsx_usb
   - Remove unused/superfluous code; db8500-prcmu, omap-usb-host
   - Enable watchdog timer; lpc_sch
   - Add start/stop RX URBs helpers; dln2
   - Remove platform device (DT only); max77686, max77802
   - Support suspend and resume; dln2
   - Add Device Tree support; da9063
   - Supply extra error checking; intel_soc_pmic
   - Constify all the things; 88pm860x, hi6421-pmic, intel_soc_pmic,
                              max77686, lm3533, retu, pcf50633,
                              davinci_voicecodec, smsc-ece1099,
                              tps65218, mc13xxx, tps65217, twl-core,
                              twl6040
 New drivers/supported devices:
   - Supply new driver for Richtek RT5033
   - Supply new driver for DA9150 Charger and FuelGauge
   - Supply new driver for Qualcomm Resource Power Manager (RPM)
   - Add support for the ir-clk into sun6i-prcm
   - Add support for FuelGauge into axp20x
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJU4yfwAAoJEFGvii+H/HdhhLQP/iWReuVzIp6bs7MIOWYAI5XZ
 hYGWD4rj/3jR9uAMOPj/h7ZmiMt7pYR2jzzOLIM9lyaAUJ1KkIHhBvimthu0NiMa
 5zE/m8V86FUkuZpBQgXMFYxU69q6Q4Smd9aM6nx3tJpcv7VV2ROotUU+h0Zc+hfa
 2SJhnCLL9joewv6kflELJT7X/WnOnHXwBdo/co79QlQ/Zw4Ry29TTFTWDCKPtY21
 XFmArDNm2OCDu0wffR/rI23DJRqWh3/TSVruFk6AsspdPthjOwxbu7n1od0izkn2
 Ulwte4daLJXsGzlHMVT52xTKiPU+KL5RhlzZSC2BEMhzbQLZQF51zrlWAHIXFRyU
 C6FhIug2CHb/Gv1fBdbxWR9FM2csRTsYam5xBRoy/OnmvdjysAa/KryFg5JwCoAz
 Y8SXT6CZbZwkFVMY+X+jMBcEHRBqo9Wd8S9dPTCfVnYamg27SGMikmZ+4tWMhLFF
 r28itoWMVHVByO9LzJxJVxL3qjHDxqxwZH6l4zO5DFxOJMG9tuY79IbXorUO/maL
 ld6NamfCon8f0m/UlnmImwE1VyIjFJMHHVqJyrSnML4nKFYHrbtxZS0KMtKV6OJg
 zmB/7EmPeltNLrB+OY7lVOyZVod6IM4+mOF/WjIlo7VvC9MAv5kZyjShiZ29JOvD
 wvmnB1bwe98vTjeHKDl7
 =9a/l
 -----END PGP SIGNATURE-----

Merge tag 'mfd-for-linus-3.20' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MFD updates from Lee Jones:
 "Changes to existing drivers:
   - fixr platform device collision; da9052, wm8994-core
   - regmap configuration amendments; tps65218
   - fix runtime PM deadlock; rtsx_usb
   - remove unused/superfluous code; db8500-prcmu, omap-usb-host
   - enable watchdog timer; lpc_sch
   - add start/stop RX URBs helpers; dln2
   - remove platform device (DT only); max77686, max77802
   - support suspend and resume; dln2
   - add Device Tree support; da9063
   - extra error checking; intel_soc_pmic
   - const'ify all the things; 88pm860x, hi6421-pmic, intel_soc_pmic,
                               max77686, lm3533, retu, pcf50633,
                               davinci_voicecodec, smsc-ece1099,
                               tps65218, mc13xxx, tps65217, twl-core,
                               twl6040

  New drivers/supported devices:
   - new driver for Richtek RT5033
   - new driver for DA9150 Charger and FuelGauge
   - new driver for Qualcomm Resource Power Manager (RPM)
   - add support for the ir-clk into sun6i-prcm
   - add support for FuelGauge into axp20x"

* tag 'mfd-for-linus-3.20' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (32 commits)
  mfd: intel_soc_pmic: Add missing error check for devm_kzalloc
  mfd: rtsx_usb: Defer autosuspend while card exists
  mfd: devicetree: Add bindings for DA9063
  mfd: da9063: Add device tree support
  regulator: qcom-rpm: Add missing state flag in call to RPM
  mfd: qcom-rpm: Driver for the Qualcomm RPM
  mfd: devicetree: bindings: Add Qualcomm RPM DT binding
  mfd: max77686/802: Remove support for board files
  mfd: omap-usb-host: Remove some unused functions
  mfd: twl6040: Constify struct regmap_config and reg_default array
  mfd: twl-core: Constify struct regmap_config and reg_default array
  mfd: tps65217: Constify struct regmap_config
  mfd: mc13xxx: i2c/spi: Constify struct regmap_config
  mfd: tps65218: Constify struct regmap_config
  mfd: smsc-ece1099: Constify struct regmap_config
  mfd: davinci_voicecodec: Constify struct regmap_config
  mfd: pcf50633: Constify struct regmap_config
  mfd: retu: Constify struct regmap_config
  mfd: lm3533: Constify struct regmap_config
  mfd: max77686: Constify struct regmap_config
  ...
2015-02-18 09:05:48 -08:00
Mark Brown dd7c2e720a Merge remote-tracking branches 'regulator/topic/rk808', 'regulator/topic/rpm', 'regulator/topic/rt5033' and 'regulator/topic/tps65023' into regulator-next 2015-02-08 11:16:30 +08:00
Mark Brown ffe167b0f2 Merge remote-tracking branches 'regulator/topic/max8649', 'regulator/topic/mode', 'regulator/topic/mt6397', 'regulator/topic/pfuze100' and 'regulator/topic/qcom-rpm' into regulator-next 2015-02-08 11:16:27 +08:00
Bjorn Andersson 00cea31f0f regulator: qcom-rpm: Make it possible to specify supply
Make it possible to specify the supply of a regulator, through the
vin-supply property in dt.

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-01-30 13:39:56 +01:00
Dan Carpenter a412ec2795 regulator: qcom-rpm: signedness bug in probe()
"force_mode" is a u32 so it is never "< 0", but because of type
promotion then comparing "== -1" will do what we want.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-01-28 19:43:43 +00:00
Axel Lin c6515d2f00 regulator: qcom_rpm: Don't update vreg->uV/mV if rpm_reg_write fails
Ensure get_voltage return correct voltage if set_voltage fails.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-01-26 19:11:35 +00:00
Bjorn Andersson 803926825f regulator: qcom-rpm: Add missing state flag in call to RPM
This adds the missing state parameter to the call down to the RPM. This
is currently hard coded to the active state, as that's all we're
supporting at this moment.

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-01-22 16:04:02 +00:00
Linus Torvalds e6b5be2be4 Driver core patches for 3.19-rc1
Here's the set of driver core patches for 3.19-rc1.
 
 They are dominated by the removal of the .owner field in platform
 drivers.  They touch a lot of files, but they are "simple" changes, just
 removing a line in a structure.
 
 Other than that, a few minor driver core and debugfs changes.  There are
 some ath9k patches coming in through this tree that have been acked by
 the wireless maintainers as they relied on the debugfs changes.
 
 Everything has been in linux-next for a while.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iEYEABECAAYFAlSOD20ACgkQMUfUDdst+ylLPACg2QrW1oHhdTMT9WI8jihlHVRM
 53kAoLeteByQ3iVwWurwwseRPiWa8+MI
 =OVRS
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core update from Greg KH:
 "Here's the set of driver core patches for 3.19-rc1.

  They are dominated by the removal of the .owner field in platform
  drivers.  They touch a lot of files, but they are "simple" changes,
  just removing a line in a structure.

  Other than that, a few minor driver core and debugfs changes.  There
  are some ath9k patches coming in through this tree that have been
  acked by the wireless maintainers as they relied on the debugfs
  changes.

  Everything has been in linux-next for a while"

* tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (324 commits)
  Revert "ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries"
  fs: debugfs: add forward declaration for struct device type
  firmware class: Deletion of an unnecessary check before the function call "vunmap"
  firmware loader: fix hung task warning dump
  devcoredump: provide a one-way disable function
  device: Add dev_<level>_once variants
  ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries
  ath: use seq_file api for ath9k debugfs files
  debugfs: add helper function to create device related seq_file
  drivers/base: cacheinfo: remove noisy error boot message
  Revert "core: platform: add warning if driver has no owner"
  drivers: base: support cpu cache information interface to userspace via sysfs
  drivers: base: add cpu_device_create to support per-cpu devices
  topology: replace custom attribute macros with standard DEVICE_ATTR*
  cpumask: factor out show_cpumap into separate helper function
  driver core: Fix unbalanced device reference in drivers_probe
  driver core: fix race with userland in device_add()
  sysfs/kernfs: make read requests on pre-alloc files use the buffer.
  sysfs/kernfs: allow attributes to request write buffer be pre-allocated.
  fs: sysfs: return EGBIG on write if offset is larger than file size
  ...
2014-12-14 16:10:09 -08:00
Mark Brown 1b56ffda75 Merge remote-tracking branches 'regulator/topic/rn5t618', 'regulator/topic/rpm', 'regulator/topic/rt5033', 'regulator/topic/s2mpa01' and 'regulator/topic/s2mps11' into regulator-next 2014-12-05 11:14:40 +00:00
Javier Martinez Canillas 072e78b12b regulator: of: Add regulator desc param to of_get_regulator_init_data()
The of_get_regulator_init_data() function is used to extract the regulator
init_data but information on how to extract certain data is defined in the
static regulator descriptor (e.g: how to map the hardware operating modes).

Add a const struct regulator_desc * parameter to the function signature so
the parsing logic could use the information in the struct regulator_desc.

of_get_regulator_init_data() relies on of_get_regulation_constraints() to
actually extract the init_data so it has to pass the struct regulator_desc
but that is modified on a later patch.

Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-26 18:58:14 +00:00
Josh Cartwright 0f5bb5b5de regulator: rpm: add support for RPM-controller SMB208
The IPQ8064 reference boards make use of SMB208 regulators which are
controlled by RPM.  Implement support for these regulators in the RPM
regulator driver.

Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
Acked-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-21 19:20:58 +00:00
Wolfram Sang 6c794b2654 regulator: drop owner assignment from platform_drivers
A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-10-20 16:21:29 +02:00
Axel Lin 6a64250980 regulator: qcom_rpm: Fix FORCE_MODE_IS_2_BITS macro
Current code does not take the macro parameter, fix it.
This is not a problem at this moment because the only user actually passes
vreg to FORCE_MODE_IS_2_BITS().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-26 09:28:40 +01:00
Axel Lin aad615c632 regulator: qcom_rpm: Don't explicitly initialise the first field of config
Doing so generates a warning as the first field is a pointer but we use
0 to initialize it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-26 09:28:40 +01:00
Bjorn Andersson 2720386ec5 regulator: qcom-rpm: Regulator driver for the Qualcomm RPM
Driver for regulators exposed by the Resource Power Manager (RPM) found
in Qualcomm 8660, 8960 and 8064 based devices.

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-24 09:35:10 +01:00