summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/max8952.c
AgeCommit message (Collapse)Author
2019-06-18Merge tag 'v5.2-rc4' into regulator-5.3Mark Brown
Linux 5.2-rc4
2019-06-13regulator: max8952: Convert to use GPIO descriptorsLinus Walleij
This finalizes the descriptor conversion of the MAX8952 driver by letting the VID0 and VID1 GPIOs be fetched from descriptors. Both VID0 and VID1 must be supplied for the VID selection to work, I add some code to preserve the semantics that if only one of the two VID gpios is supplied, it will be initialized to low. This might be a bit overzealous, but I want to preserve any implicit semantics. This is currently only used by device tree in-kernel but it is still also possible to supply the same GPIOs using a machine descriptor table if a board file is used. Ideally this should be phased over to using gpio-regulator.c that does the same thing, but it might require some refactoring and needs testing on real hardware. Cc: Tomasz Figa <tfiga@chromium.org> Cc: MyungJoo Ham <myungjoo.ham@samsung.com> Cc: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-06-10regulator: max8952: simplify getting the adapter of a clientWolfram Sang
We have a dedicated pointer for that, so use it. Much easier to read and less computation involved. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156Thomas Gleixner
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 as published by the free software foundation either version 2 of the license or at your option any later version 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 you should have received a copy of the gnu general public license along with this program if not write to the free software foundation inc 59 temple place suite 330 boston ma 02111 1307 usa extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 1334 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-11regulator: max8952: Let core handle GPIO descriptorLinus Walleij
Use the gpiod_get() rather than the devm_* version so that the regulator core can handle the lifecycle of these descriptors. Fixes: d7a261c2d1f2 ("regulator: max8952: Pass descriptor instead of GPIO number") Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-10-15regulator: Fetch enable gpiods nonexclusiveLinus Walleij
Since the core regulator code is treating GPIO descriptors as nonexclusive, i.e. it assumes that the enable GPIO line may be shared with several regulators, let's add the flag introduced for fixing this problem on fixed regulators to all drivers fetching GPIO descriptors to avoid possible regressions. Reported-by: Mark Brown <broonie@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-24regulator: max8952: Pass descriptor instead of GPIO numberLinus Walleij
Instead of passing a global GPIO number for the enable GPIO, pass a descriptor looked up with the standard devm_gpiod_get_optional() call. All users of this regulator use device tree so the transition is pretty smooth. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-01-31regulator: max8952: constify regulator_ops structureBhumika Goyal
Declare regulator_ops structure as const as it is only stored in the ops field of a regulator_desc structure. This field is of type const, so regulator_ops structures having this property can be made const too. File size before: drivers/regulator/max8952.o text data bss dec hex filename 3048 496 0 3544 dd8 drivers/regulator/max8952.o File size after: drivers/regulator/max8952.o text data bss dec hex filename 3304 240 0 3544 dd8 drivers/regulator/max8952.o Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-05Merge remote-tracking branches 'regulator/topic/max77686', ↵Mark Brown
'regulator/topic/max77693', 'regulator/topic/max77802', 'regulator/topic/power-off' and 'regulator/topic/rk808' into regulator-next
2014-11-26regulator: of: Add regulator desc param to of_get_regulator_init_data()Javier Martinez Canillas
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-07regulator: Set ena_gpio_initialized in regulator driversMarkus Pargmann
This patch sets ena_gpio_initialized for all drivers which set a ena_gpio from parsed DT properties. Drivers using pdata may get zero initialized pdata and therefore copy a 0 into the regulator_config ena_gpio field. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-06-27regulator: max8952: Convert to devm_gpio_request_one()Axel Lin
Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-07regulator: max8952: Make of_device_id array constJingoo Han
Make of_device_id array const, because all OF functions handle it as const. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-18regulator: max8952: Silence checkpatch warningSachin Kamat
Silences the following type of checkpatch warning: WARNING: Missing a blank line after declarations Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-10regulator: max8952: Use managed regulator registrationKrzysztof Kozlowski
Use managed devm_regulator_register to simplify the driver probe and driver remove functions. This allows removing from state container the pointer to regulator_dev returned on registering the regulator. Patch also removes from state container pointer to 'struct device' as it is not used anywhere outside of max8952_pmic_probe() function. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-20regulator: max8952: Remove redundant error messageSachin Kamat
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>
2013-07-30regulator: use dev_get_platdata()Jingoo Han
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-04-26regulator: max8952: Add missing config.of_node setting for regulator registerAxel Lin
Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-05regulator: max8952: Add Device Tree supportTomasz Figa
This patch adds Device Tree support to max8952 regulator driver. Signed-off-by: Tomasz Figa <t.figa@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-05regulator: max8952: Separate constraints from platform data structTomasz Figa
This patch modifies platform data structure of max8952 driver to use pointer to regulator_init_data struct instead of embedding it. This is a prerequisite for adding Device Tree support for the driver. Signed-off-by: Tomasz Figa <t.figa@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-20regulator: remove use of __devexitBill Pemberton
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-20regulator: remove use of __devinitBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-20regulator: remove use of __devexit_pBill Pemberton
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-07-10regulator: max8952: Use core GPIO enable supportAxel Lin
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-09regulator: max8952: Remove wrong set_suspend_disable callback settingAxel Lin
Using the same ops for both .disable and .set_suspend_disable callbacks is actively broken. This patch removes .set_suspend_disable callback setting. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-16regulator: max8952: Use devm_kzallocAxel Lin
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-20regulator: max8952: Convert to get_voltage_selAxel Lin
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-09regulator: core: Use a struct to pass in regulator runtime configurationMark Brown
Rather than adding new arguments to regulator_register() every time we want to add a new bit of dynamic information at runtime change the function to take these via a struct. By doing this we avoid needing to do further changes like the recent addition of device tree support which required each regulator driver to be updated to take an additional parameter. The regulator_desc which should (mostly) be static data is still passed separately as most drivers are able to configure this statically at build time. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-09Merge branch 'regulator-register' into regulator-driversMark Brown
2012-04-06regulator: max8952: Constify regulator_descAxel Lin
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01regulator: Convert max8952 to set_voltage_selAxel Lin
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01regulator: max8952: Simplify the logic to get vid[0|1] statusAxel Lin
The syntax "(((vid >> 1) % 2) == 1)" is inefficient and also hard to read. Use bitwidse AND operator instead. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23regulator: pass additional of_node to regulator_register()Rajendra Nayak
With device tree support for regulators, its needed that the regulator_dev->dev device has the right of_node attached. To be able to do this add an additional parameter to the regulator_register() api, wherein the dt-adapted driver can then pass this additional info onto the regulator core. Signed-off-by: Rajendra Nayak <rnayak@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-08-08regulator: max8952: removed unused mutex.MyungJoo Ham
This patch removes a mutex that is never used in the driver. Reported-by: Axel Lin Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-07-08regulator: max8952 - fix wrong gpio valid checkJonghwan Choi
Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com> Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-03-31Fix common misspellingsLucas De Marchi
Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-01-12regulator: Report actual configured voltage to set_voltage()Mark Brown
Change the interface used by set_voltage() to report the selected value to the regulator core in terms of a selector used by list_voltage(). This allows the regulator core to know the voltage that was chosen without having to do an explict get_voltage(), which would be much more expensive as it will generally access hardware. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-10-28regulator: max8952 - fix max8952_set_voltageAxel Lin
In current implementation, vid is declared as u8, then "vid == -1" is always false, and "vid >= 0" is always true. Thus change it to s8. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-10-28regulator: max8952 - fix max8952_pmic_probe error pathAxel Lin
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-10-28MAX8952 PMIC Driver Initial ReleaseMyungJoo Ham
MAX8952 PMIC is used to provide voltage output between 770mV - 1400mV with DVS support. In this initial release, users can set voltages for four DVS modes, RAMP delay values, and SYNC frequency. Controlling FPWM/SYNC_MODE/Pull-Down/Ramp Modes and reading CHIP_ID is not supported in this release. If GPIO of EN is not valid in platform data, the driver assumes that it is always-on. If GPIO of VID0 or VID1 is invalid, the driver pulls down VID0 and VID1 to fix DVS mode as 0 and disables DVS support. We assume that V_OUT is capable to provide every voltage from 770mV to 1.40V in 10mV steps although the data sheet has some ambiguity on it. Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> -- v2: - Style correction - Can accept platform_data with invalid GPIOs - Removed unnecessary features - Improved error handling Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>