aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/sec-core.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2014-11-25Revert "mfd: sec-core: Prepare regulators for suspend state to reduce power-consumption"Javier Martinez Canillas1-10/+0
This reverts commit b7cde7078d2344073c310aa65fc2b0a845d2cb5b ("mfd: sec-core: Prepare regulators for suspend state to reduce power-consumption") Commit b7cde7078d23 called regulator_suspend_prepare() to prepare the regulators for a suspend state. But it did from the device pm suspend handler while the regulator suspend prepare function iterates over all regulators and not only the one managed by this device so it doesn't seems to be correct to call it from within a device driver. It is better to call the regulator suspend prepare/finish functions from platform code instead so this patch reverts the mentioned commit. Suggested-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com> Reviewed-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-11-25regulator: s2mps11: Add support S2MPS13 regulator deviceChanwoo Choi1-0/+13
This patch adds S2MPS13 regulator device to existing S2MPS11 device driver. The S2MPS13 has just different number of regulators from S2MPS14. The S2MPS13 regulator device includes LDO[1-40] and BUCK[1-10]. Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Acked-by: Sangbeom Kim <sbkim73@samsung.com> Acked-by: Mark Brown <broonie@kernel.org> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-11-25mfd: sec-core: Add support for S2MPS13 deviceChanwoo Choi1-0/+16
This patch adds the support for Samsung S2MPS13 PMIC device to the sec-core MFD driver. The S2MPS13 is very similar with existing S2MPS14 and includes PMIC/ RTC/CLOCK devices. Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Acked-by: Sangbeom Kim <sbkim73@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-22mfd: sec-core: Fix 'missing blank line after declarations' warningLee Jones1-0/+1
This is part of an effort to clean-up the MFD subsystem. WARNING: Missing a blank line after declarations + const struct of_device_id *match; + match = of_match_node(sec_dt_match, i2c->dev.of_node); total: 0 errors, 1 warnings, 494 lines checked Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-09mfd: sec-core: Prepare regulators for suspend state to reduce power-consumptionChanwoo Choi1-0/+10
This patch use regulator_suspend_prepare() function to prepare the proper state of regulators for suspend state to remove un-necessary leakage power-consumption. Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-09regulator: s2mps11: Add support S2MPU02 regulator deviceChanwoo Choi1-0/+25
This patch add S2MPU02 regulator device to existing S2MPS11 device driver because of little difference between S2MPS1x and S2MPU02. The S2MPU02 regulator device includes LDO[1-28] and BUCK[1-7]. Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> [Add missing linear_min_sel of S2MPU02 LDO regulators by Jonghwa Lee] Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Acked-by: Mark Brown <broonie@linaro.org> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-09mfd: sec-core: Add support for S2MPU02 deviceChanwoo Choi1-14/+32
Add support for Samsung S2MPU02 PMIC device to the MFD sec-core driver. The S2MPU02 device includes PMIC/RTC/Clock devices. Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-06-03mfd: sec-core: Make of_device_id array constKrzysztof Kozlowski1-1/+1
Array of struct of_device_id may be be const as expected by both of_match_table field and of_match_node() call. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-06-03mfd: sec-core: Fix IRQ handling after resume if this is not a wakeup sourceKrzysztof Kozlowski1-15/+13
During suspend the IRQ should be disabled even if this is not a wakeup source. This is a proper way of fixing the IRQ handling issue during resume (IRQ handler fails because I2C bus did not resume yet). When device is suspended and sec-core interrupt is signaled the irq chip will try to handle it regardless of wakeup source. Device could be woken up by different IRQ but still the IRQ handler will try to read the registers over I2C bus and fail because I2C bus won't be ready yet. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-06-03mfd: sec-core: Remove duplicated device type from sec_pmic_devKrzysztof Kozlowski1-2/+3
The device type was stored in sec_pmic_dev state container twice: - unsigned long type (initialized from of_device_id or i2c_device_id) - int device_type (initialized as above or from board files when there is no DTS) The 'type' field was never used outside of probe so it can be safely removed. Change also the device_type in sec_pmic_dev and sec_platform_data to unsigned long to avoid any casts. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-06-03mfd/rtc: s5m: Do not allocate RTC I2C dummy and regmap for unsupported chipsetsKrzysztof Kozlowski1-52/+1
The rtc-s5m driver does not support all of S2M and S5M chipsets supported by main MFD sec-core driver. For such chipsets unsupported by rtc-s5m, the MFD sec-core driver initialized regmap with default config. This config in such cases wouldn't work at all. The main MFD sec-core driver shouldn't initialize regmap for child drivers which is not used by them and even not valid. Move the allocation of RTC I2C dummy device and initialization of RTC regmap from main MFD sec-core driver to the rtc-s5m driver. The rtc-s5m driver will use proper regmap config for supported devices. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Acked-by: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-03-20mfd: sec-core: Fix uninitialized 'regmap_rtc' on S2MPA01Krzysztof Kozlowski1-0/+7
Initialize the 'regmap_rtc' on S2MPA01 to some sane value. Sane at least for S5M87X chipsets, not S2MPS/S2MPA but it won't be used because rtc-s5m driver does not support S2MPA01. This fixes following error: drivers/mfd/sec-core.c:342:45: warning: ‘regmap_rtc’ may be used uninitialized in this function [-Wuninitialized] Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Acked-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-03-19mfd: sec-core: Fix I2C dummy device resource leak on probe failureKrzysztof Kozlowski1-3/+4
Dummy I2C device allocated in sec_pmic_probe() leaked if devm_regmap_init_i2c() failed. Unregister it before returning from probe. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Reviewed-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-03-19mfd: sec-core: Add of_compatible strings for clock MFD cellsKrzysztof Kozlowski1-0/+3
Add of_compatible strings for S5M8767 and S2MPS14 clock MFD cells. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Reviewed-by: Tomasz Figa <t.figa@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-03-18mfd: Add support for S2MPA01 deviceSachin Kamat1-5/+44
Add the necessary entries required for S2MPA01 multi-function device. While at it also convert whitespaces to tabs in core.h. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-03-18mfd: sec-core: Silence compiler warningPankaj Dubey1-3/+3
When used 64bit compiler GCC warns as drivers/mfd/sec-core.c:199:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] Signed-off-by: Pankaj Dubey <pankaj.dubey@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-03-18mfd: sec-core: Fix possible NULL pointer dereference when i2c_new_dummy errorKrzysztof Kozlowski1-0/+4
During probe the sec-core driver allocates dummy I2C device for RTC with i2c_new_dummy() but return value is not checked. In case of error (i2c_new_device(): memory allocation failure or I2C address cannot be used) this function returns NULL which is later used by devm_regmap_init_i2c() or i2c_unregister_device(). If i2c_new_dummy() fails for RTC device, fail also the probe for main MFD driver. Cc: stable@vger.kernel.org Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-03-18mfd: sec: Add support for S2MPS14Krzysztof Kozlowski1-5/+43
Add support for S2MPS14 PMIC device to the MFD sec-core driver. The S2MPS14 is similar to S2MPS11 but it has fewer regulators, two clocks instead of three and a little different registers layout. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-03-18mfd: sec-core: Select different RTC regmaps for devicesKrzysztof Kozlowski1-3/+12
This patch prepares for adding support for S2MPS14 RTC driver by selecting different regmaps for S2MPS1X/S5M876X RTC devices. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-03-18mfd: sec-core: Add maximum RTC register for regmap configKrzysztof Kozlowski1-0/+2
Add maximum register to the regmap used by rtc-s5m driver. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-02-19mfd: sec-core: sec_pmic_{suspend,resume}() should depend on CONFIG_PM_SLEEPGeert Uytterhoeven1-0/+2
If CONFIG_PM_SLEEP=n: drivers/mfd/sec-core.c:349: warning: ‘sec_pmic_suspend’ defined but not used drivers/mfd/sec-core.c:371: warning: ‘sec_pmic_resume’ defined but not used Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-01-25Merge tag 'regulator-v3.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulatorLinus Torvalds1-30/+0
Pull regulator updates from Mark Brown: "A respin of the merges in the previous pull request with one extra fix. A quiet release for the regulator API, quite a large number of small improvements all over but other than the addition of new drivers for the AS3722 and MAX14577 there is nothing of substantial non-local impact" * tag 'regulator-v3.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (47 commits) regulator: pfuze100-regulator: Improve dev_info() message regulator: pfuze100-regulator: Fix some checkpatch complaints regulator: twl: Fix checkpatch issue regulator: core: Fix checkpatch issue regulator: anatop-regulator: Remove unneeded memset() regulator: s5m8767: Update LDO index in s5m8767-regulator.txt regulator: as3722: set enable time for SD0/1/6 regulator: as3722: detect SD0 low-voltage mode regulator: tps62360: Fix up a pointer-integer size mismatch warning regulator: anatop-regulator: Remove unneeded kstrdup() regulator: act8865: Fix build error when !OF regulator: act8865: register all regulators regardless of how many are used regulator: wm831x-dcdc: Remove unneeded 'err' label regulator: anatop-regulator: Add MODULE_ALIAS() regulator: act8865: fix incorrect devm_kzalloc for act8865 regulator: act8865: Remove set_suspend_[en|dis]able implementation regulator: act8865: Remove unneeded regulator_unregister() calls regulator: s2mps11: Clean up redundant code regulator: tps65910: Simplify setting enable_mask for regulators regulator: act8865: add device tree binding doc ...
2014-01-21mfd: sec-core: Add cells for S5M8767-clocksTushar Behera1-1/+3
S5M8767 chip has 3 crystal oscillators running at 32KHz. These are supported by s2mps11-clk driver. Signed-off-by: Tushar Behera <tushar.behera@linaro.org> Reviewed-by: Tomasz Figa <t.figa@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-01-21mfd: sec-core: Fix sparse NULL pointer warningWei Yongjun1-1/+1
Fixes the following sparse warning: drivers/mfd/sec-core.c:202:16: warning: Using plain integer as NULL pointer Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-01-21mfd: sec: Constify regmap configs and regmap irqsKrzysztof Kozlowski1-4/+4
Add "const" to "static struct regmap_irq" and "static struct regmap_config". Acked-by: Sangbeom Kim <sbkim73@samsung.com> Reviewed-by: Mark Brown <broonie@linaro.org> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-01-21mfd: sec: Add PM ops and make it a wake up sourceKrzysztof Kozlowski1-0/+40
Add PM suspend/resume ops to the sec MFD core driver and make it a wake up source. This allows proper waking from suspend to RAM and also fixes broken interrupts after resuming: [ 42.705703] sec_pmic 7-0066: Failed to read IRQ status: -5 Interrupts stop working after first resume initiated by them (e.g. by RTC Alarm interrupt) because interrupt registers were not cleared properly. When device is woken up from suspend by RTC Alarm, an interrupt occurs before resuming I2C bus controller. The interrupt is handled by regmap_irq_thread which tries to read RTC registers. This read fails (I2C is still suspended) and RTC Alarm interrupt is disabled. Disable the S5M8767 interrupts during suspend (disable_irq()) and enable them during resume so the device will be still woken up but the interrupt won't happen before resuming I2C bus. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-01-06mfd: Constify struct mfd_cell where possibleGeert Uytterhoeven1-4/+4
As of commit 03e361b25ee8dfb1fd9b890072c23c4aae01c6c7 ("mfd: Stop setting refcounting pointers in original mfd_cell arrays"), the "cell" parameter of mfd_add_devices() is "const" again. Hence make all cell data passed to mfd_add_devices() const where possible. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-12-18mfd: sec: Remove sec_reg* regmap helpersKrzysztof Kozlowski1-30/+0
Remove sec_reg* helpers as they are not used anymore. These helpers were error-prone as they mixed u8 with unsigned int and they changed order of some of parameters (val and mask in sec_reg_update()). Also the helpers didn't give any way of useful abstraction as they just called corresponding regmap function. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-12mfd/rtc: s5m: fix register updating by adding regmap for RTCKrzysztof Kozlowski1-8/+22
Rename old regmap field of "struct sec_pmic_dev" to "regmap_pmic" and add new regmap for RTC. On S5M8767A registers were not properly updated and read due to usage of the same regmap as the PMIC. This could be observed in various hangs, e.g. in infinite loop during waiting for UDR field change. On this chip family the RTC has different I2C address than PMIC so additional regmap is needed. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Mark Brown <broonie@linaro.org> Acked-by: Sangbeom Kim <sbkim73@samsung.com> Cc: Samuel Ortiz <sameo@linux.intel.com> Cc: Lee Jones <lee.jones@linaro.org> Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Marek Szyprowski <m.szyprowski@samsung.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-10-23mfd: sec-core: Include linux/of.h headerSachin Kamat1-0/+1
'of_match_ptr' is defined in linux/of.h. Include it explicitly to avoid breakage in the future. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-08-14mfd: sec: Add clock cell for s2mps11Yadwinder Singh Brar1-1/+3
This patch adds clock to list of mfd cells for s2mps11 and DT documentation for clock part. Reviewed-by: Mike Turquette <mturquette@linaro.org> Signed-off-by: Yadwinder Singh Brar <yadi.brar@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-07-31mfd: Use dev_get_platdata()Jingoo Han1-1/+1
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: Lee Jones <lee.jones@linaro.org>
2013-07-31mfd: sec: Add register cache for interrupt mask registersMark Brown1-0/+31
The performance of regmap-irq is improved if the interrupt mask registers can be cached since it does read/modify/update cycles so start using the register cache infrastructure for those registers. We should use this more widely but I don't have a datasheet and this is a nice, conservative starting point. Signed-off-by: Mark Brown <broonie@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-07-31mfd: s2mps11: Add device tree supportYadwinder Singh Brar1-0/+3
This patch adds DT compatible string for s2mps11 and binding documentation. Reviewed-by: Mark Brown <broonie@linaro.org> Signed-off-by: Yadwinder Singh Brar <yadi.brar@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-07-02mfd: sec: Provide max_register to regmapMark Brown1-1/+40
Enable debugfs register dumps and greater error checking within the regmap API providing the maximum register to the regmap API. Signed-off-by: Mark Brown <broonie@linaro.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-06-11mfd: sec-core: Remove explicit call to mfd_remove_devicesLeon Romanovsky1-2/+1
In case mfd_add_devices will fail, it will call to mfd_remove_devices by itself and return non-zero value. Signed-off-by: Leon Romanovsky <leon@leon.nu> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-02-04regulator: s5m8767: Fix build in non-DT caseMark Brown1-1/+1
Fix drift in DT parsing function name in the stub code. Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-04regulator: add device tree support for s5m8767Amit Daniel Kachhap1-2/+73
This device tree support is added for PMIC block of S5m8767 multi function driver. The usage detail is added in the device tree documentation section. This change is tested on exynos5250 based arndale platform by regulator voltage set/get API's. Reviewed-by: Thomas Abraham <thomas.abraham@linaro.org> Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com> Tested-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-09-15mfd: core: Push irqdomain mapping out into devicesMark Brown1-4/+4
Currently the MFD core supports remapping MFD cell interrupts using an irqdomain but only if the MFD is being instantiated using device tree and only if the device tree bindings use the pattern of registering IPs in the device tree with compatible properties. This will be actively harmful for drivers which support non-DT platforms and use this pattern for their DT bindings as it will mean that the core will silently change remapping behaviour and it is also limiting for drivers which don't do DT with this particular pattern. There is also a potential fragility if there are interrupts not associated with MFD cells and all the cells are omitted from the device tree for some reason. Instead change the code to take an IRQ domain as an optional argument, allowing drivers to take the decision about the parent domain for their interrupts. The one current user of this feature is ab8500-core, it has the domain lookup pushed out into the driver. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-16mfd: Add samsung s2mps11 mfd supportSangbeom Kim1-0/+10
This patch add Samsung S2MPS11 mfd driver. The S2MPS11 can support regulators and RTC. Signed-off-by: Sangbeom Kim <sbkim73@samsung.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-16mfd: Modify samsung mfd headerSangbeom Kim1-3/+3
As Prefix of Samsung pmic changed from s5m to s2m, To make common mfd driver for s2m and s5m series, This patch rename header of Samsung mfd and modify mfd driver. Signed-off-by: Sangbeom Kim <sbkim73@samsung.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-16mfd: Modify samsung mfd driver for common apiSangbeom Kim1-65/+65
Previous naming rule of samsung pmic start with s5m prefix. But It is changed by s2m. To cover various samsung s2m and s5m series, This patch modify function and variable name for common usage. Signed-off-by: Sangbeom Kim <sbkim73@samsung.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-16mfd: Rename s5m file and directories to samsungSangbeom Kim1-0/+206
Previously, Samsung PMIC naming rule start with prefix of s5m. But Naming rule is changed. From now on, Prefix will be changed to s2m. So, To support pmic series of s5m and s2m, change mfd file and directory name. Signed-off-by: Sangbeom Kim <sbkim73@samsung.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>