Commit Graph

24 Commits

Author SHA1 Message Date
Uwe Kleine-König a13eaf02e2 regulator: rk808: make better use of the gpiod API
The gpiod functions include variants for managed gpiod resources. Use it
to simplify the remove function.

As the driver handles a device node without a specification of dvs gpios
just fine, additionally use the variant of gpiod_get exactly for this
use case. This makes error checking more strict.

As a third benefit this patch makes the driver use the flags parameter
of gpiod_get* which will not be optional any more after 4.2 and so
prevents a build failure when the respective gpiod commit is merged.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-21 17:11:30 +01:00
Uwe Kleine-König 604d499427 regulator: rk808: add #include for gpiod functions
This fixes a build problem on mips found by the kbuild test robot:

drivers/regulator/rk808-regulator.c: In function 'rk808_buck1_2_get_voltage_sel_regmap':
drivers/regulator/rk808-regulator.c:97:2: error: implicit declaration of function 'gpiod_get_value' [-Werror=implicit-function-declaration]
  if (IS_ERR(gpio) || gpiod_get_value(gpio) == 0)
  ^

Fixes: bad47ad2ee ("regulator: rk808: fixed the overshoot when adjust voltage")
Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-21 17:11:29 +01:00
Chris Zhong bad47ad2ee regulator: rk808: fixed the overshoot when adjust voltage
There is a overshoot in DCDC1/DCDC2, we have 2 method to workaround:
1st is use dvs pin to switch the voltage between value in BUCKn_ON_VSEL
and BUCKn_DVS_VSEL. If DVS pin is inactive, the voltage of DCDC1/DCDC2
are controlled by BUCKn_ON_VSEL, when we pull dvs1/dvs2 pin to active,
they would be controlled by BUCKn_DVS_VSEL. In this case, the ramp rate
is same as the value programmed in BUCKn_RATE, and the fastest rate is
10mv/us.
2nd method is gradual adjustment, adjust the voltage to a target value
step by step via i2c, each step is set to 100 mA. If you write the
voltage directly using an i2c write the rk808 will always ramp as fast
as it possibly can, about 100mv/us.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-20 18:40:44 +01:00
Mark Brown b5dabc8d3b Merge remote-tracking branches 'regulator/fix/da9210' and 'regulator/fix/rk808' into regulator-linus 2015-03-06 21:10:30 +00:00
Doug Anderson 28249b0c2f regulator: rk808: Set the enable time for LDOs
The LDOs are documented in the rk808 datasheet to have a soft start
time of 400us.  Add that to the driver.  If this time takes longer on
a certain board the device tree should be able to override with
"regulator-enable-ramp-delay".

This fixes some dw_mmc probing problems (together with other patches
posted to the mmc maiing lists) on rk3288.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
2015-02-21 23:32:43 +09: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
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
Wei Yongjun 5cb2f03c67 regulator: rk808: Fix sparse non static symbol warnings
Fixes the following sparse warnings:

drivers/regulator/rk808-regulator.c💯5: warning:
 symbol 'rk808_set_suspend_voltage' was not declared. Should it be static?
drivers/regulator/rk808-regulator.c:115:5: warning:
 symbol 'rk808_set_suspend_enable' was not declared. Should it be static?
drivers/regulator/rk808-regulator.c:126:5: warning:
 symbol 'rk808_set_suspend_disable' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-09 16:17:57 +00:00
Mark Brown 92d07a8ff6 Merge remote-tracking branches 'regulator/topic/max77686', 'regulator/topic/max77693', 'regulator/topic/max77802', 'regulator/topic/power-off' and 'regulator/topic/rk808' into regulator-next 2014-12-05 11:14:37 +00:00
Greg Kroah-Hartman a8a93c6f99 Merge branch 'platform/remove_owner' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux into driver-core-next
Remove all .owner fields from platform drivers
2014-11-03 19:53:56 -08: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
Chris Zhong 251ce318df regulator: rk808: Add support setting suspend voltage
support setting suspend voltage and disable regulator in suspend.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-20 12:23:55 +01:00
Chris Zhong 1575e288cb regulator: rk808: Fix min_uV for DCDC1 & DCDC2
The min_uv in DCDC1 & DCDC2 should be 712.5mv

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Reviwed-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-07 20:40:00 +01:00
Doug Anderson 8af252272a regulator: rk808: Add function for ramp delay for buck1/buck2
On rk808 buck1 and buck2 have programmable ramp delays.  Let's add a
function to allow a client of rk808 to set them.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-16 11:27:53 -07:00
Axel Lin 1ed3f8ce83 regulator: rk808: Fix missing of_node_put
1. Pass &pdev->dev rather than &client->dev to of_regulator_match, the *dev
   argument is used for devres to ensure devm_of_regulator_put_matches() will
   be called when unload the module.

2. of_get_child_by_name() returns a node pointer with refcount incremented.
   Thus add missing of_node_put(reg_np).

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-12 14:53:09 +01:00
Axel Lin 1f0c01621a regulator: rk808: Remove unused variables
Also remove non-informative comment.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-12 14:53:09 +01:00
Chris Zhong 571a401084 regulator: rk808: Remove pdata from the regulator
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Tested-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-10 11:50:43 +01:00
Doug Anderson b8074eba2a regulator: RK808: Add proper input supplies for rk808
The original RK808 regulator driver didn't setup input supplies
properly.  Add them.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-02 17:30:31 +01:00
Axel Lin 5a82067f01 regulator: rk808: Fix n_voltages for DCDC4
The min_sel is 0, max_sel is 15, so n_voltages should be 16.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-02 12:08:05 +01:00
Axel Lin c61519fd9a regulator: rk808: Fix memory leak
The memory allocated in rk808_regulator_probe() needs to be freed when the
module is unloaded. Thus pass &pdev->dev rather than &client->dev to
devm_kzalloc.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-28 16:01:25 +01:00
Chris Zhong 2a8d1303c6 regulator: rk808: remove redundant code
remove the redundant code, since pdata has been removed from stuct rk808

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-27 10:00:46 +01:00
Chris Zhong d76c333e9f regulator: RK808: modify for struct rk808 change
The "dev" has been deleted from "struct rk808" in rk808 mfd driver
so rk808->dev should be replaced by &client->dev here.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-26 08:30:23 +01:00
Doug Anderson 462004f121 regulator: rk808: Fix uninitialized value
The RK808 regulator driver was putting its config on the stack but not
initting it.  That means that you got a semi-random config.  Fix this.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-21 21:19:13 -05:00
Chris Zhong 2cd64ae3d5 regulator: RK808: Add regulator driver for RK808
The regulator module consists of 4 DCDCs, 8 LDOs and 2 switches.
The output voltages are configurable and are meant to supply power
to the main processor and other components

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-20 11:28:15 -05:00