summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/max8998.c
Commit message (Collapse)AuthorAgeFilesLines
* regulator: max8998: Remove unnecessary **rdev from struct max8998_dataAxel Lin2014-03-101-14/+6
| | | | | | | | | | Now we are using devm_regulator_register(), so we don't need to allocate *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: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* regulator: max8998: Add missing of_node_putSachin Kamat2014-02-181-1/+6
| | | | | | | 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: max8998: Use devm_regulator_registerSachin Kamat2013-09-171-27/+8
| | | | | | | devm_* simplifies the code. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
* mfd: max8998: Add support for Device TreeTomasz Figa2013-06-301-4/+127
| | | | | | | | This patch adds Device Tree support to max8998 driver. Signed-off-by: Tomasz Figa <t.figa@samsung.com> Acked-by: Mark Brown <broonie@linaro.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* regulator: max8998: Use arrays for specifying voltages in platform dataTomasz Figa2013-06-301-67/+29
| | | | | | | | | | | | | This patch modifies the platform data of max8998 to use arrays for specifying predefined voltages of buck1 and buck2 instead of separate field for each voltage. This allows to simplify the code a bit and will help in adding support for Device Tree, which will be introduced in further patch. Signed-off-by: Tomasz Figa <t.figa@samsung.com> Acked-by: Mark Brown <broonie@linaro.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* regulators: max8998.c: use dev_err() instead of printk()Thiago Farina2013-03-041-3/+6
| | | | | | | | | Fixes the following checkpatch warning: WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ... Signed-off-by: Thiago Farina <tfarina@chromium.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* Merge remote-tracking branch 'regulator/topic/max8998' into regulator-nextMark Brown2013-02-191-13/+1
|\
| * regulator: max8998: Let regulator core handle the case selector == old_selectorAxel Lin2013-02-081-13/+1
| | | | | | | | | | Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | regulator: max8998: fix incorrect min_uV value for ldo10Marek Szyprowski2013-01-261-1/+1
|/ | | | | | | | | | | Correct value for minimal voltage for ldo10 output is 950000 uV. This patch fixes the typo introduced by patch adf6178ad5552a7f2f742a8c85343c50 ("regulator: max8998: Use uV in voltage_map_desc"), what solves broken probe of max8998 in v3.8-rc4. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Cc: stable@vger.kernel.org Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regulator: max8998: Ensure enough delay time for ↵Axel Lin2013-01-101-1/+1
| | | | | | | | | | | max8998_set_voltage_buck_time_sel Use DIV_ROUND_UP to prevent truncation by integer division issue. This ensures we return enough delay time. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@vger.kernel.org
* regulator: max8998: Use uV in voltage_map_descAxel Lin2013-01-081-21/+21
| | | | | | | | | | | Integer division may truncate. This happens when pdata->buckx_voltagex setting is not align with 1000 uV. Thus use uV in voltage_map_desc, this ensures the selected voltage won't less than pdata buckx_voltagex settings. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@vger.kernel.org
* regulator: remove use of __devexitBill Pemberton2012-11-201-1/+1
| | | | | | | | 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>
* regulator: remove use of __devinitBill Pemberton2012-11-201-1/+1
| | | | | | | | 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>
* regulator: remove use of __devexit_pBill Pemberton2012-11-201-1/+1
| | | | | | | | 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>
* regulator: max8998: Remove wrong set_suspend_[en|dis]able callback settingsAxel Lin2012-07-091-6/+0
| | | | | | | | | Using the same ops for both [en|dis]able and set_suspend_[en|dis]able callbacks is actively broken. This patch removes .set_suspend_disable and .set_suspend_enable callback setting. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regulator: max8998: Convert to set_voltage_sel and regulator_map_voltage_linearAxel Lin2012-06-231-70/+27
| | | | | Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regulator: max8998: Convert to regulator_list_voltage_linear()Axel Lin2012-06-231-25/+7
| | | | | Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regulator: max8998: Convert ot use devm_kzallocAxel Lin2012-04-231-28/+17
| | | | | | | | | | | Also simplify the error handling to start unwind from the place regulator_register fails. No need to check rdev[i] is NULL or not before calling regulator_unregister. regulator_unregister is safe if rdev is NULL, Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regulator: Remove unneeded include of linux/delay.h from regulator driversAxel Lin2012-04-231-1/+0
| | | | | | | | | | | | | All the drivers that need delay for the regulator voltage output voltage to stabilize after being enabled or after being set to a new value has been converted to implement enable_time and set_voltage_time_sel callbacks. Then regulator core will take care of the necessary delay. For the drivers that don't need the delay, don't need to include linux/delay.h. This patch removes the unneeded include of linux/delay.h in regulator drivers. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regulator: Convert max8998 to set_voltage_time_selAxel Lin2012-04-131-7/+28
| | | | | Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regulator: Convert max8998 to get_voltage_selAxel Lin2012-04-131-9/+10
| | | | | Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regulator: max8998: Use simple equation to get selectorAxel Lin2012-04-101-9/+10
| | | | | | | It's more efficient to get the best selector by simple equation. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regulator: core: Use a struct to pass in regulator runtime configurationMark Brown2012-04-091-2/+7
| | | | | | | | | | | | | | 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>
* regulator: Silence error message in max8998_pmic_probeAxel Lin2012-03-111-1/+0
| | | | | | | This looks like a mistakenly committed debug logging. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regulator: Kill max8998_get_ldo functionAxel Lin2012-03-111-10/+5
| | | | | | | Use rdev_get_id() directly. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regulator: pass additional of_node to regulator_register()Rajendra Nayak2011-11-231-1/+1
| | | | | | | | | | | 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>
* regulator: Fix memory leak in max8998_pmic_probe failure pathAxel Lin2011-05-271-9/+13
| | | | | | | Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
* treewide: cleanup continuations and remove logging message whitespaceJoe Perches2011-04-261-2/+2
| | | | | | | | | | | | | | Using C line continuation inside format strings is error prone. Clean up the unintended whitespace introduced by misuse of \. Neaten correctly used line continations as well for consistency. drivers/scsi/arcmsr/arcmsr_hba.c has these errors as well, but arcmsr needs a lot more work and the driver should likely be moved to staging instead. Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* regulator: Add MODULE_DEVICE_TABLE to max8997 and max8998Axel Lin2011-03-271-0/+1
| | | | | | | | | | | The device table is required to load modules based on modaliases. Signed-off-by: Axel Lin <axel.lin@gmail.com> Cc: MyungJoo Ham <myungjoo.ham@smasung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Cc: Marek Szyprowski <m.szyprowski@samsung.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
* regulator: Support MAX8998/LP3974 DVS-GPIOMyungJoo Ham2011-01-141-20/+67
| | | | | | | | | | | The previous driver did not support BUCK1-DVS3, BUCK1-DVS4, and BUCK2-DVS2 modes. This patch adds such modes and an option to block setting buck1/2 voltages out of the preset values. 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> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* mfd: Support LP3974 RTCMyungJoo Ham2011-01-141-0/+7
| | | | | | | | | | | | | | | | | | | | | | The first releases of LP3974 have a large delay in RTC registers, which requires 2 seconds of delay after writing to a rtc register (recommended by National Semiconductor's engineers) before reading it. If "rtc_delay" field of the platform data is true, the rtc driver assumes that such delays are required. Although we have not seen LP3974s without requiring such delays, we assume that such LP3974s will be released soon (or they have done so already) and they are supported by "lp3974" without setting "rtc_delay" at the platform data. This patch adds delays with msleep when writing values to RTC registers if the platform data has rtc_delay set. Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* regulator: Fix prototype for MAX8998 buck set_voltage()Mark Brown2011-01-121-1/+1
| | | | | Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
* regulator: Report actual configured voltage to set_voltage()Mark Brown2011-01-121-2/+6
| | | | | | | | | | | 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>
* regulator: max8998 BUCK1/2 voltage change with use of GPIOsLukasz Majewski2010-10-291-21/+193
| | | | | | | | | | | | | | | | | | | | | | max8998_pmic_probe: - modified to check if valid pins are defined at platform data - maximal voltage values (predefined at platform data) are uploaded to max8998 device max8998_set_voltage_buck: - BUCK1/2 voltages change between values already defined - Checks if valid GPIO pins are passed from platform data - If requested voltage cannot be satisfied from already defined values, then one of free slots is used - Predefined maximum voltages (as defined at platform data) are always available Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* regulator: max8998 BUCK1/2 internal voltages and indexes definedLukasz Majewski2010-10-291-2/+8
| | | | | | | | | | | | BUCK1/2 internal voltages and indexes defined in the struct max8998_data max_get_voltage_register now uses index values to chose proper register More generic BUCK1/2 registers names provided Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* regulator: Separate set_voltage for max8998 ldo and buckLukasz Majewski2010-10-291-3/+40
| | | | | | | | Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* mfd: Use i2c_client as an argument on MAX8998 i2c routinesJoonyoung Shim2010-10-291-6/+11
| | | | | | | | | | | | | The MAX8998 chip have regulator and rtc features. The i2c slave address of regulator and rtc is different, so needs each i2c client on i2c operation functions. Also, this patch exports i2c operation functions instead of callback to make easy to read. Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* regulator: set max8998->dev to &pdev->dev.Axel Lin2010-09-011-0/+1
| | | | | | | | | | | max8998->dev is NULL in current implementation, set it to &pdev->dev. regulator_register() still return success if max8998->dev is NULL, but rdev->dev.parent will be set to NULL which is incorrect. 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>
* regulator: max8998 - set max8998->num_regulatorsAxel Lin2010-09-011-0/+1
| | | | | | | | | Set max8998->num_regulators = pdata->num_regulators, otherwise it's default value is 0. 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>
* regulator: max8998 - fix memory allocation size for max8998->rdevAxel Lin2010-09-011-3/+3
| | | | | | | | | | We only use max8998->rdev[0] .. max8998->rdev[pdata->num_regulators-1], max8998->rdev[pdata->num_regulators] is not used. Thus fix the memory allocation size. 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>
* max8998: fix off-by-one value range checkingAxel Lin2010-08-111-2/+2
| | | | | | | | | | | In max8998_list_voltage() and max8998_set_voltage(), we use ldo as array index of ldo_voltage_map. Thus the valid range should be 0 .. ARRAY_SIZE(ldo_voltage_map)-1. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
* regulator: MAX8998: set_voltage bugfix. ramp_up delay and min/max voltageMyungJoo Ham2010-08-111-2/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Two issues are addressed for max8998_set_voltage function. 1. Min/Max Voltage. max8998_set_voltage had been using the voltage value of min ( voltage[i] >= max_vol , i ) This is corrected to use: min ( voltage[i] >= min_vol , i ) 2. Ramp Up Delay. max8998_set_voltage should provide delay for BUCK1/2 if ENRAMP is on. It reads RAMP value from ONOFF4 register to determine RAMP delay length. However, when max8998_set_voltage's new voltage is lower than the previous, we don't care because it does not deteriorate the stability. Changes since v1: - rebased onto latest regulator-for-next tree Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
* drivers: regulator: add Maxim 8998 driverKyungmin Park2010-08-111-0/+610
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> This patch adds voltage regulator driver for Maxim 8998 chip. This chip is used on Samsung Aquila and GONI boards and provides following functionalities: - 4 BUCK voltage converters, 17 LDO power regulators and 5 other power controllers - battery charger This patch adds basic driver for voltage regulators and MAX 8998 MFD core. Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>