Add the ability to parse regulator-data from the devicetree.
Signed-off-by: Heiko Stuebner <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
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 <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
The regulator constraints already provide a field for the ramp_delay, so
there is no need to set this manually. Therefore implement the set_ramp_delay
callback and convert the pdata value to the constraint value if necessary.
Signed-off-by: Heiko Stuebner <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
The regulator can be supplied by a parent regulator through its vin pin,
so add the supply_name for it.
Signed-off-by: Heiko Stuebner <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
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 <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Fix ERROR: "devm_regmap_init_i2c" [drivers/regulator/isl9305.ko] undefined!
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Currently regulator drivers which support DT all repeat very similar code
to supply a list of known regulator identifiers to be matched with DT,
convert that to platform data which is then matched up with the regulators
as they are registered. This is both fiddly to get right and for devices
which can use the standard helpers to provide their operations is the main
source of code in the driver.
Since this code is essentially identical for most drivers we can factor it
out into the core, moving the identifiers in the match table into the
regulator descriptors and also allowing drivers to pass in the name of the
subnode to search. When a driver provides an of_match string for the
regulator the core will attempt to use that to obtain init_data, allowing
the driver to remove all explicit code for DT parsing and simply provide
data instead.
The current code leaks the phandles for the child nodes, this will be
addressed incrementally and makes no practical difference for FDT anyway
as the DT data structures are never freed.
Signed-off-by: Mark Brown <[email protected]>
These of_node_get() were added to balance refcount decrements inside of
of_find_node_by_name().
See: commit c92f5dd2c4 ("regulator: Add missing of_node_put()")
However of_find_node_by_name() was then replaced by of_get_child_by_name(),
which doesn't call of_node_put() against its input parameter.
So, need to remove these unnecessary of_node_get() calls.
Signed-off-by: Guodong Xu <[email protected]>
Reviewed-by: Axel Lin <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
The max_uV is not used, so remove it from struct as3711_regulator_info.
Current code is using devm_regulator_register(), so we don't need to store *rdev
in struct as3711_regulator for clean up.
Also clean up AS3711_REG macro to remove _vshift, _min_uV and _max_uV arguments.
_vshift is always 0, so remove it.
_min_uV and _max_uV are not required, all required settings are set in
REGULATOR_LINEAR_RANGE macro.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
We should always be able to probe a regulator with no platform data. This
will enable readback of current state, though no changes can be made to
the device configuration.
Signed-off-by: Mark Brown <[email protected]>
The ISL9305 and ISL9305H are mini-PMICs offering two DCDC regulators and
two LDO regulators. While there are some register differences between them
these do not affect the current Linux driver as the relevant features are
not yet supported.
Signed-off-by: Mark Brown <[email protected]>
Also move da9211_i2c_id and da9211_dt_ids close to the user for better
readability.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
The original RK808 regulator driver didn't setup input supplies
properly. Add them.
Signed-off-by: Doug Anderson <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Add device-tree support to max1586.
The driver can still be used with the legacy platform data, or the new
device-tree way.
This work is heavily inspired by the device-tree support of its cousin
max8660 driver.
Signed-off-by: Robert Jarzmik <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
This driver supports the 3 DCDC and 7 LDO regulators available on
Ricoh RN5T618 PMIC.
Signed-off-by: Beniamino Galvani <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
In some cases we need to know when a regulator is about to be changed.
Add a way for clients to be notified. Note that for set_voltage() we
don't necessarily know what voltage we'll end up with, so we tell the
client what the range will be so they can prepare.
Signed-off-by: Heiko Stübner <[email protected]>
Signed-off-by: Doug Anderson <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
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 <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
The max77802 driver reads the default operating mode (opmode)
set for regulators when enabled from the hardware registers.
But if a regulator is disabled and the system warm restarted,
the hardware reports OFF as the opmode so the regulator is
not enabled. Default to operating mode NORMAL if OFF is read
from the hardware register.
Reported-by: Yuvaraj Cd <[email protected]>
Signed-off-by: Javier Martinez Canillas <[email protected]>
Reviewed-by: Doug Anderson <[email protected]>
Tested-by: Yuvaraj Kumar CD <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
This is a patch for supporting device tree of DA9211/DA9213.
Signed-off-by: James Ban <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
remove the redundant code, since pdata has been removed from stuct rk808
Signed-off-by: Chris Zhong <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
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 <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
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 <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
The valid_modes_mask and *dev are not used in this driver, remove them.
Current code uses devm_regulator_register, so we don't need *regulator in
hi6421_regulator_info. Use a local variable instead.
Also removes a few unnecessary inclusion of header files.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
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 <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Both num_regulators and *rdev[MAX77802_REG_MAX] are not used, remove them.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
style fix for warnings. 'else' with a single 'return' is usually not
required.
Signed-off-by: Guodong Xu <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Commit 272e2315fa ("regulator: core: add const qualifier to ops in
struct regulator_desc") introduced const qualifier to ops in regulator_desc.
This patch adds 'const' to regulator_ops vars in newly added core APIs
for v3.17-rc1:
- regulator_get_hardware_vsel_register()
- regulator_list_hardware_vsel()
This patch also fix a build error in mc13892-regulator.c due to const
regulator_desc.ops. Modification of regulator_desc.ops' member fields is not
allowed.
Signed-off-by: Guodong Xu <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
The MAX77802 PMIC has 10 high-efficiency Buck and 32 Low-dropout
(LDO) regulators. This patch adds support for all these regulators
found on the MAX77802 PMIC and is based on a driver added by Simon
Glass to the Chrome OS kernel 3.8 tree.
Signed-off-by: Javier Martinez Canillas <[email protected]>
Tested-by: Naveen Krishna Chatradhi <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Add driver support for HiSilicon Hi6421 voltage regulators.
Two rules for regulator enabling are defined in hi6421 spec:
1) Between disable and enable of each regulator (LDOs or BUCKs), there must
be a protection gap. Use @off_on_delay of regulator core to implement this.
2) No two regulators can be enabled at the same time. Use mutex in
hi6421_regulator_pdata to ensure this. A protection gap of 100us is added
into each LDO/BUCK's .enable_time.
Signed-off-by: Guodong Xu <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Some regulator require a minimum delay between its disable and next enable.
This is to avoid damages when out-of-range frequent disable/enable of a
single regulator can bring to the regulator chip.
Add @off_on_delay to struct regulator_desc. Device drivers' can use this field
to set this guard time.
Add @last_off_jiffy to struct regulator_dev. When @off_on_delay is set by
driver, regulator core can store its last off (disable) time into this field.
Signed-off-by: Guodong Xu <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
A common delay function can be helpful when implementing new features. Factor
it out to maximize code reusability.
Signed-off-by: Guodong Xu <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
struct regulator_ops *ops is a member in struct regulator_desc, which gets
its value from individual regulator driver upon regulator_register() and
is used by regulator core APIs. It's not allowed for regulator core to
modify any of these callbacks in *ops. Add 'const' qualifier to enforce that.
Signed-off-by: Guodong Xu <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
The regulator core supports this to allow the configuration to be inspected
at runtime even if no software management is enabled.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Mark Brown <[email protected]>