summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/act8865-regulator.c
Commit message (Collapse)AuthorAgeFilesLines
* regulator: act8865: Fix missing of_node_put() in act8865_pdata_from_dt()Wei Yongjun2016-07-141-6/+6
| | | | | | | | | | | | This node pointer is returned by of_get_child_by_name() with refcount incremented in this function. of_node_put() is missing when exitting this function while invalid device type. Fix it by move of_get_child_by_name() code after device type check. Found by Coccinelle. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: act8865: Configure register access for act8600Maarten ter Huurne2016-03-281-1/+73
| | | | | | | This can be used to expose the act8600 registers via debugfs. Signed-off-by: Maarten ter Huurne <maarten@treewalker.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: act8865: Pass of_node via act8865_regulator_dataMaarten ter Huurne2016-03-281-16/+12
| | | | | | | | This makes the code easier to read and it avoids a dynamic memory allocation. Signed-off-by: Maarten ter Huurne <maarten@treewalker.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: act8865: Remove "too many regulators" error handlerMaarten ter Huurne2016-03-211-6/+0
| | | | | | | | | | | | | | | | | The check would dereference pdata, which can be NULL in the non-DT use case. Nothing will break if pdata->num_regulators is larger than the number of regulators that the driver defines: pdata->num_regulators is only read in act8865_get_init_data() to iterate through pdata->regulators. The error handler might have some value as a sanity check on the platform data, but the platform data could be broken in many other ways that are not checked for (unknown IDs, duplicate IDs), so I see no reason to perform only this specific check. Signed-off-by: Maarten ter Huurne <maarten@treewalker.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: act8865: Remove redundant dev lookupsMaarten ter Huurne2016-03-211-3/+2
| | | | | | | | The local variable "dev" already contains a pointer to the device, so there is no need to take the address of "client->dev" again. Signed-off-by: Maarten ter Huurne <maarten@treewalker.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: act8865: Specify fixed voltage of 3.3V for ACT8600's REG9Maarten ter Huurne2016-02-291-1/+1
| | | | | | | | | | | | | The documentation lists both 1.8V and 3.3V for this regulator output, but 3.3V is mentioned more often and also matches what JZ4770 and JZ4780 expect as an input. Note that the voltage of REG9 is not programmable, so this commit only changes the voltage reported in sysfs and debugfs, not the actual output voltage of the hardware. Signed-off-by: Maarten ter Huurne <maarten@treewalker.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: act8865: Rename platform_data field to init_dataMaarten ter Huurne2016-02-291-2/+2
| | | | | | | Make the field name match its type. Signed-off-by: Maarten ter Huurne <maarten@treewalker.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: act8865: Remove "static" from local variableMaarten ter Huurne2016-02-291-1/+1
| | | | | | | | There is no need to preserve its value between calls. I guess this was a copy-paste slip-up. Signed-off-by: Maarten ter Huurne <maarten@treewalker.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: act8865: support output voltage by VSET2[] bitsWenyou Yang2015-10-021-2/+22
| | | | | | | | | | | | | | For the step-down DC/DC regulators, the output voltage is selectable by setting VSEL pin that when VSEL is low, output voltage is programmed by VSET1[] bits, and when VSEL is high, output voltage is programmed by VSET2[] bits. The DT property "active-semi,vsel-high" is used to specify the VSEL pin at high on the board. Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com> Reviewed-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: drivers: Drop owner assignment from i2c_driverKrzysztof Kozlowski2015-07-141-1/+0
| | | | | | | | 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>
* regulator: act8865: add input supply handlingHeiko Stuebner2015-03-071-27/+28
| | | | | | | | | | | | | | The act88600/act8846/act8865 regulators have a number of input supplies supplying the individual regulators. This may even be recursively like on most Rockchip boards using the act8846 where REG4 is most of the time connected to the inl1-supply. Therefore add the ability to specify the input supplies for the individual inputs. The input-names are taken from the datasheets of act8600, act8846 and act8865. On the act8600 some regulators do not have separate input supplies. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: act8865: Add act8600 supportZubair Lutfullah Kakakhel2015-03-061-1/+119
| | | | | | | | | | | This patch adds act8600 support to the act8865 driver. VBUS and USB charger supported by this chip can be added later Tested on MIPS Creator CI20 Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* of: Rename "poweroff-source" property to "system-power-controller"Romain Perier2014-12-011-1/+1
| | | | | | | | | | | | | | | | | | It reverts commit a4b4e0461ec5 ("of: Add standard property for poweroff capability"). As discussed on the mailing list, it makes more sense to rename back to the old established property name, without the vendor prefix. Problem being that the word "source" usually tends to be used for inputs and that is out of control of the OS. The poweroff capability is an output which simply turns the system-power off. Also, this property might be used by drivers which power-off the system and power back on subsequent RTC alarms. This seems to suggest to remove "poweroff" from the property name and to choose "system-power-controller" as the more generic name. This patchs adds the required renaming changes and defines an helper function which checks if this property is set. Signed-off-by: Romain Perier <romain.perier@gmail.com> Acked-by: Grant Likely <grant.likely@linaro.org> Acked-by: Johan Hovold <johan@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: act8865: Add support to turn off all outputsRomain Perier2014-10-221-0/+31
| | | | | | | | | | When the property "poweroff-source" is found in the devicetree, the function pm_power_off is defined. This function sends the rights bit fields to the global off control register. shutdown/poweroff commands are now supported for hardware components which use these PMU. Signed-off-by: Romain Perier <romain.perier@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: act8865: fix build when OF is not enabledBeniamino Galvani2014-08-051-9/+20
| | | | | | | | | | act8846_matches and act8865_matches are defined only when OF is enabled. Move references to them to the act8865_pdata_from_dt() function to avoid a build error when OF is disabled. Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Beniamino Galvani <b.galvani@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* regulator: act8865: add support for act8846Beniamino Galvani2014-08-051-0/+71
| | | | | | | | | | Add device id and definition of registers and regulators to support the act8846 PMU. Signed-off-by: Beniamino Galvani <b.galvani@gmail.com> Tested-by: Wenyou Yang <wenyou.yang@atmel.com> Reviewed-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* regulator: act8865: prepare support for other act88xx devicesBeniamino Galvani2014-08-051-128/+83
| | | | | | | | | | | | This patch prepares support for other devices in the act88xx family of PMUs manufactured by Active-Semi. http://www.active-semi.com/products/power-management-units/act88xx/ Signed-off-by: Beniamino Galvani <b.galvani@gmail.com> Tested-by: Wenyou Yang <wenyou.yang@atmel.com> Reviewed-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* regulator: act8865: set correct number of regulators in pdataBeniamino Galvani2014-08-051-1/+1
| | | | | | | | | | | | | | act8865_pdata_from_dt() populates the array pdata->regulators with all the regulators and then assigns the field init_data only for the ones actually found in the DT. The patch changes the value assigned to pdata->num_regulators to match the size of the array. Signed-off-by: Beniamino Galvani <b.galvani@gmail.com> Tested-by: Wenyou Yang <wenyou.yang@atmel.com> Reviewed-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* regulator: act8865: Remove error variable in act8865_pmic_probeAxel Lin2014-08-051-5/+4
| | | | | | | | Simply use ret variable instead. Also remove unneeded initialize for ret variable. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* regulator: act8865: fix parsing of platform dataBeniamino Galvani2014-08-051-8/+21
| | | | | | | | | | | | | The driver loops through all available regulators (ACT8865_REG_NUM) and accesses pdata->regulators[i].platform_data without checking the actual value of num_regulators in platform data, potentially causing a invalid memory access. Fix this and look up the regulator init_data by id in platform data. Signed-off-by: Beniamino Galvani <b.galvani@gmail.com> Tested-by Wenyou.Yang <wenyou.yang@atmel.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* regulator: act8865: Remove unnecessary *rdev[] from struct act8865Axel Lin2014-03-101-8/+5
| | | | | | | | | | Now we are using devm_regulator_register(), so we don't need the *rdev[] array to store return value of devm_regulator_register. Use a *rdev variable is enough for checking return status. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Wenyou Yang <Wenyou.yang@atmel.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* regulator: act8865: Remove redundant error messageSachin Kamat2014-02-201-4/+1
| | | | | | | kzalloc prints its own OOM message upon failure. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
* regulator: act8865: Add missing of_node_putSachin Kamat2014-02-181-0/+1
| | | | | | | Add of_node_put to decrement the ref count. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
* regulator: act8865: Use of_get_child_by_nameSachin Kamat2014-02-141-1/+1
| | | | | | | | of_find_node_by_name walks the allnodes list, and can thus walk outside of the parent node. Use of_get_child_by_name instead. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
* regulator: act8865: Fix build error when !OFAxel Lin2014-01-061-1/+1
| | | | | | | | | | | | | | | | Fix below build error when !OF: CC [M] drivers/regulator/act8865-regulator.o drivers/regulator/act8865-regulator.c: In function 'act8865_pmic_probe': drivers/regulator/act8865-regulator.c:306:18: error: 'act8865_matches' undeclared (first use in this function) drivers/regulator/act8865-regulator.c:306:18: note: each undeclared identifier is reported only once for each function it appears in drivers/regulator/act8865-regulator.c:306:18: error: negative width in bit-field '<anonymous>' make[2]: *** [drivers/regulator/act8865-regulator.o] Error 1 make[1]: *** [drivers/regulator] Error 2 make: *** [drivers] Error 2 Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* regulator: act8865: register all regulators regardless of how many are usedWenyou Yang2013-12-311-7/+4
| | | | | | | | | | As Mark pointed out, the driver should register all regulators regardless of how many are used in the system in order to aid diagnostics. But in the previous patch, only register the regulators that are used. Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* regulator: act8865: fix incorrect devm_kzalloc for act8865Wenyou Yang2013-12-301-3/+1
| | | | | | | Which cause to allocate more needless memory. Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* regulator: act8865: Remove set_suspend_[en|dis]able implementationAxel Lin2013-12-301-2/+0
| | | | | | | | There is no suspend enable/disable settings mentioned in datasheet, so just don't implement .set_suspend_[en|dis]able callbacks. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* regulator: act8865: Remove unneeded regulator_unregister() callsAxel Lin2013-12-301-12/+0
| | | | | | | | This is not required because current code use devm_regulator_register() to register regulators. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* regulator: act8865: add PMIC act8865 driverWenyou Yang2013-12-241-0/+368
Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com> Signed-off-by: Mark Brown <broonie@linaro.org>
OpenPOWER on IntegriCloud