Commit Graph

31 Commits

Author SHA1 Message Date
Paul Kocialkowski 7e6213f434 regulator: lp872x: Add enable GPIO pin support
LP872x regulators are made active via the EN pin, which might be hooked to a
GPIO. This adds support for driving the GPIO high when the driver is in use.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-02-05 18:57:09 +00:00
Paul Kocialkowski 690f44badf regulator: lp872x: Remove warning about invalid DVS GPIO
Some devices don't hook the DVS pin to a GPIO but to ground or VCC.
In those cases, it is not a problem to have no DVS GPIO provided, as the current
code will already switch to software-only DVS selection:

When the DVS GPIO is invalid, lp872x_init_dvs jumps to the set_default_dvs_mode
label, which instructs the chip not to use the DVS pin at all and do it all in
software instead (by clearing the LP8720_EXT_DVS_M bit in the
LP872X_GENERAL_CFG register).

That is reflected later in the code, when setting the bucks (the DVS pin only
applies to the bucks) by checking for the LP8720_EXT_DVS_M bit on the
LP872X_GENERAL_CFG register (in lp872x_select_buck_vout_addr) to decide whether
to use software or hardware DVS selection.

Thus, there is no need to print a warning when the DVS GPIO is invalid.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-02-05 18:57:08 +00:00
Paul Kocialkowski 8a99cc6ff5 regulator: lp872x: Get rid of duplicate reference to DVS GPIO
The lp872x structure holds a reference to the DVS GPIO, but it is never actually
used anywhere, since a first reference exists from the lp872x_dvs structure.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-23 12:12:46 +00:00
Paul Kocialkowski 1f97fe4777 regulator: lp872x: Add missing of_match in regulators descriptions
In order to select the regulators via of_find_regulator_by_node (and thus use
them in devicetree), defining of_match for each regulator is required.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-23 12:12:46 +00:00
Mark Brown 3e683126f4 Merge remote-tracking branches 'regulator/topic/mt6311', 'regulator/topic/ocp', 'regulator/topic/owner', 'regulator/topic/pfuze100' and 'regulator/topic/pwm' into regulator-next 2015-08-30 14:39:48 +01:00
Milo Kim 804486b19d regulator: lp872x: handle error case
If memory allocation gets failed on parsing the DT, then it returns error
'-ENOMEM' explicitly. Then, the driver exists from the _probe().

Signed-off-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-25 19:36:24 +01:00
Milo Kim d9ffae15f7 regulator: lp872x: use the private data instead of updating I2C device platform data
Currently, lp872x driver parses the DT and copies values into the
'cl->dev.platform_data' if 'of_node' exists.
This may have architectural issue. Platform data is configurable through
the DT or I2C board info inside the platform area.
However, lp872x driver changes this configuration when it is loaded.

The lp872x driver should get data from the platform side and use the private
data, 'lp872x->pdata' instead of changing the original platform data.

Signed-off-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-25 19:36:15 +01:00
Krzysztof Kozlowski a807a6cc29 regulator: drivers: Drop owner assignment from i2c_driver
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-14 18:53:01 +01:00
Axel Lin 8538c4075e regulator: lp872x: Remove **regulators from struct lp872x
Current code is using devm_regulator_register(), so we don't need to store *rdev
in struct lp872x for clean up.
Also clean up lp872x_probe() a bit to remove unnecessary goto and num_regulators
variable.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-01-26 19:10:55 +00:00
Mark Brown 404d4df260 regulator: lp872x: Don't set constraints within the regulator driver
Regulator drivers should not be specifying constraints since the valid
configurations depend on how the device is used in a given system, there
is no way to know if a configuration is safe for a given board.

Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-28 13:19:23 +01:00
Sachin Kamat ad5ec6cdb2 regulator: lp872x: Do not hardcode return values
Propagate the error values returned by the function instead.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-20 01:26:02 +09:00
Jingoo Han ed602534df regulator: lp872x: use devm_regulator_register()
Use devm_regulator_register() to make cleanup paths simpler,
and remove unnecessary remove().

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-30 18:10:59 +01:00
Mark Brown 6979380d85 Merge remote-tracking branch 'regulator/topic/max8660' into regulator-next 2013-09-01 13:50:16 +01:00
Jingoo Han dff91d0b72 regulator: use dev_get_platdata()
Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-30 12:24:20 +01:00
Milo Kim 37a6f43dd1 regulator: lp872x: fix a build waring and coding styles
Fix a warning below.

  drivers/regulator/lp872x.c:910:33: warning: cast from pointer to integer of
                                     different size [-Wpointer-to-int-cast]

And checkpatch warnings are fixed.

  WARNING: space prohibited before semicolon

Signed-off-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:22:03 +01:00
Kim, Milo 00fd6e6153 regulator: lp872x: support the device tree feature
This patch enables the DT structure of the LP8720 and LP8725 device.
The LP872x platform data is generated when the device tree is configured.
Even if the platform data is NULL, it is no issue at all because the driver is
configured with the default mode.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-05-20 18:13:44 -05:00
Axel Lin a32f9e0202 regulator: lp872x: Use regulator_map_voltage_ascend
All regulators have ascendant voltage list in this driver.
Use regulator_map_voltage_ascend for them.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-25 11:50:23 +01:00
Mark Brown efc828022e Merge remote-tracking branch 'regulator/topic/lp872x' into regulator-next 2013-02-19 12:42:39 +00:00
Axel Lin 2c12992787 regulator: lp872x: Kill _rdev_to_offset() function
There is only one user calling _rdev_to_offset() function.
Remove _rdev_to_offset() makes the code simpler.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-10 12:22:29 +09:00
Bill Pemberton 8dc995f56e regulator: remove use of __devexit
CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-20 10:53:38 +09:00
Bill Pemberton 5eb9f2b963 regulator: remove use of __devexit_p
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-20 10:31:19 +09:00
Kim, Milo 5bab305d3c regulator: lp872x: remove unnecessary function
The lp872x_check_dvs_validity() is used for checking DVS platform data.
 If the DVS platform data is not defined, return as error code.
 Now, this is unnecessary because the default DVS mode is set in this case.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-09-06 07:53:03 +08:00
Kim, Milo 9d6da6fcc2 regulator: lp872x: fix NULL pointer access problem
The lp872x_set_dvs() is used for changing the DVS pin state.
 This function works only when the DVS platform data is defined.
 So don't assume that DVS data is always valid.
 In case the platform data is not defined, the DVS data is set to NULL
 for skipping the DVS pin control.

 DVS selection and GPIO pin number are used for the LP872x DVS pin control.
 For better readability, DVS selection argument is added in lp872x_set_dvs().

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-09-06 07:53:02 +08:00
Kim, Milo 86b3fef0c7 regulator: lp872x: initialize the DVS mode
The platform specific configuration(general_config) is optional.
 However, the DVS settings should be configured explicitly while
 loading the driver.
 This patch enables configuring the default DVS mode even though
 the platform data is not defined.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-09-06 07:53:02 +08:00
Kim, Milo b158fba605 regulator: lp872x: set the default DVS mode
The lp872x driver has the DVS platform data which select the register address
 of the BUCK voltage.
 This patch enables updating the default DVS mode when the DVS platform data
 is not defined.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-09-06 07:53:02 +08:00
Kim, Milo 9ffaa8689e regulator: lp872x: remove regulator platform data dependency
This patch enables registering the regulator driver even though
 the regulator_init_data is not defined in the platform side.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-09-06 07:53:02 +08:00
Axel Lin 4e1d67eddf regulator: lp872x: set_current_limit should select the maximum current in specific range
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-08-28 11:00:26 -07:00
Axel Lin 5bae062830 regulator: lp872x: Simplify implementation of lp872x_find_regulator_init_data()
Pass regulator id rahter than the index to lp872x_find_regulator_init_data(),
then the code can be simpler.
We can also get max_regulators by lp->num_regulators.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Tested-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-16 20:58:30 +01:00
Kim, Milo b222a817b4 regulator: change message level on probing lp872x driver
Use err log rather than warning message when the platform data is NULL

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-21 11:04:06 +01:00
Axel Lin baf73e2c4e regulator: lp872x: Return -EINVAL if pdata is NULL
Return -EINVAL if pdata is NULL, otherwise we have NULL dereference bug.
This patch also moves the code checking pdata earlier in lp872x_probe.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-20 11:18:38 +01:00
Kim, Milo af8b5fc310 regulator: add new regulator driver for lp872x
This driver supports TI/National LP8720, LP8725 PMIC.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Reviewed-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-19 23:14:29 +01:00