1
0
Fork 0
Commit Graph

55 Commits (redonkable)

Author SHA1 Message Date
Laxman Dewangan 3dc6f4aaaf mfd: sec: Use devm_mfd_add_devices and devm_regmap_add_irq_chip
Use devm_mfd_add_devices() for adding MFD child devices and
devm_regmap_add_irq_chip() for IRQ chip registration.

This reduces the error code path and .remove callback for removing
MFD child devices and deleting IRQ chip data.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Tested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2016-05-09 13:27:38 +01:00
Geliang Tang 1b5420e1f5 mfd: Use to_i2c_client() instead of open-coding it
Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2016-01-14 08:43:50 +00:00
Alim Akhtar 2fadbbf02d mfd: sec-core: Rename MFD and regulator names differently
Currently S2MPSXX multifunction device is named as *-pmic,
and these MFDs also supports regulator as a one of its MFD cell which
has the same name, because current name is confusing and we want to
sort it out.

We did discussed different approaches about how the MFD and it
cells need to be named here [1].
Based in the discussion this patch rename MFD regulator name as
*-regulator instead of current *-pmic.

This patch also changes the corresponding entries in the regulator driver
to keep git-bisect happy.

[1]-> https://lkml.org/lkml/2015/10/28/417

Suggested-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-11-24 11:11:16 +00:00
Thomas Abraham 9e4808d2c6 mfd: sec: Add support for S2MPS15 PMIC
Add support for S2MPS15 PMIC which is similar to S2MPS11 PMIC. The S2MPS15
PMIC supports 27 LDO regulators, 10 buck regulators, RTC, three 32.768KHz
clock outputs and battery charger. This patch adds initial support for
LDO and buck regulators of S2MPS15 device.

Signed-off-by: Thomas Abraham <thomas.ab@samsung.com>
Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
[Alim: Added s2mps15_devs like rtc and clk and related changes]
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-11-23 10:33:16 +00:00
Krzysztof Kozlowski 644a3746d9 mfd: sec-core: Remove unused s2mpu02-rtc and s2mpu02-clk children
The commit 54e8827d5f ("mfd: sec-core: Add support for S2MPU02
device") added new MFD child devices for S2MPU02: RTC and clock
provider (the clock provider with new compatible). However support for
these devices was not added to existing drivers (rtc-s5m, clk-s2mps11).
New drivers were not submitted neither.

This means that the name of children devices is completely unused. The
"samsung,s2mpu02-clk" compatible remains undocumented so it is unclear
what is provided by that compatible.

Clean up this by removing unused child devices and undocumented
compatible.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-10-30 18:57:38 +00:00
Krzysztof Kozlowski 8a97d4287e mfd: sec-core: Disable buck voltage reset on watchdog falling edge
The WRSTBI bit (disabled by default but enabled by bootloader), when
set, is responsible for resetting voltages to default values of
certain bucks on falling edge of Warm Reset Input pin from AP.

However on some boards (with S2MPS13) the pin is pulled down so any
suspend will effectively trigger the reset of bucks supplying the power
to the little and big cores. In the same time when resuming, these bucks
must provide voltage greater or equal to voltage before suspend to match
the frequency chosen by cpufreq. If voltage (default value of voltage
after reset) is lower than one set by cpufreq before suspend, then
system will hang during resuming.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reported-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Tested-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-10-30 17:20:37 +00:00
Krzysztof Kozlowski c2c9f1fe4b mfd: sec-core: Dump PMIC revision to find out the HW
There are different revisions of the same chipset. For example S2MPS13 has
more than 2 revisions. They differ slightly in regulator constraints.
Print the revision number to easily find which PMIC is used on the board.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-10-30 17:20:37 +00:00
Krzysztof Kozlowski d785334a0d mfd: s2mps11: Add manual shutdown method for Odroid XU3
On Odroid XU3 board (with S2MPS11 PMIC) the PWRHOLD bit in CTRL1
register must be manually set to 0 before initiating power off sequence.

One of usual power down methods for Exynos based devices looks like:
1. PWRHOLD pin of PMIC is connected to PSHOLD of Exynos SoC.
2. Exynos holds up this pin during system operation.
3. ACOKB pin of PMIC is pulled up to VBATT and optionally to pin in
   other device.
4. When PWRHOLD/PSHOLD goes low, the PMIC will turn off the power if
   ACOKB goes high.

On Odroid XU3 family the difference is in (3) - the ACOKB is grounded.
This means that PMIC must manually set PWRHOLD field to low and then
wait for signal from Application Processor (the usual change in
PWRHOLD/PSHOLD pin will actually cut off the power).

The patch adds respective binding allowing Odroid XU3 device to be
powered off.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Reported-by: Anand Moon <linux.amoon@gmail.com>
Tested-by: Anand Moon <linux.amoon@gmail.com>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-10-26 14:49:04 +00:00
Krzysztof Kozlowski 0e777366fb mfd: Drop owner assignment from i2c_drivers
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: Lee Jones <lee.jones@linaro.org>
2015-08-11 15:08:48 +01:00
Krzysztof Kozlowski eea2e59606 mfd: sec-core: Enable RTC on S2MPS11 PMIC
The S2MPS11 PMIC (present on Arndale Octa board) has the same RTC module
as S2MPS14 device. Add respective mfd cell to enable it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-26 14:20:19 +00:00
Krzysztof Kozlowski 82a00c49ed mfd: sec: Remove unnecessary out of memory message
There is no need to print additional ENOMEM message for
sec_platform_data allocation failure.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-03 17:30:26 +00:00
Krzysztof Kozlowski ef9c80b37a mfd: sec: Cleanup unused RTC fields: ono, WTSR and SMPL
The WTSR (Watchdog Timer Software Reset) and SMPL (Sudden Momentary
Power Loss) were removed from rtc-s5m driver because they were not used.
Remove them (and on/off interrupt) from main MFD driver and header.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-03 17:30:18 +00:00
Javier Martinez Canillas 6ce286f182 Revert "mfd: sec-core: Prepare regulators for suspend state to reduce power-consumption"
This reverts commit b7cde7078d
("mfd: sec-core: Prepare regulators for suspend state to reduce power-consumption")

Commit b7cde7078d 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-25 16:18:47 +00:00
Chanwoo Choi 76b9840b24 regulator: s2mps11: Add support S2MPS13 regulator device
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-25 15:55:06 +00:00
Chanwoo Choi 3bc2ee91a4 mfd: sec-core: Add support for S2MPS13 device
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-11-25 15:55:01 +00:00
Lee Jones b6c1cb4d96 mfd: sec-core: Fix 'missing blank line after declarations' warning
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-22 13:17:07 +01:00
Chanwoo Choi b7cde7078d mfd: sec-core: Prepare regulators for suspend state to reduce power-consumption
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-09 14:58:12 +01:00
Chanwoo Choi 00e2573d2c regulator: s2mps11: Add support S2MPU02 regulator device
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-09 14:58:11 +01:00
Chanwoo Choi 54e8827d5f mfd: sec-core: Add support for S2MPU02 device
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-07-09 14:58:11 +01:00
Krzysztof Kozlowski df20b7c534 mfd: sec-core: Make of_device_id array const
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-03 08:11:35 +01:00
Krzysztof Kozlowski 360d15d6ef mfd: sec-core: Fix IRQ handling after resume if this is not a wakeup source
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-03 08:11:22 +01:00
Krzysztof Kozlowski 9549b5ff00 mfd: sec-core: Remove duplicated device type from sec_pmic_dev
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-03 08:11:21 +01:00
Krzysztof Kozlowski e349c910e2 mfd/rtc: s5m: Do not allocate RTC I2C dummy and regmap for unsupported chipsets
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-06-03 08:11:16 +01:00
Krzysztof Kozlowski 5a78401623 mfd: sec-core: Fix uninitialized 'regmap_rtc' on S2MPA01
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-20 15:57:23 +00:00
Krzysztof Kozlowski 8c66eeced1 mfd: sec-core: Fix I2C dummy device resource leak on probe failure
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-19 09:00:08 +00:00
Krzysztof Kozlowski 53c31b3437 mfd: sec-core: Add of_compatible strings for clock MFD cells
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-19 09:00:07 +00:00
Sachin Kamat ce24991e1e mfd: Add support for S2MPA01 device
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-18 10:56:17 +00:00
Pankaj Dubey 8f695de515 mfd: sec-core: Silence compiler warning
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-18 10:50:20 +00:00
Krzysztof Kozlowski 65aba1e049 mfd: sec-core: Fix possible NULL pointer dereference when i2c_new_dummy error
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-18 10:50:18 +00:00
Krzysztof Kozlowski dc6919663f mfd: sec: Add support for S2MPS14
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-18 10:50:09 +00:00
Krzysztof Kozlowski 3e5a45f7f1 mfd: sec-core: Select different RTC regmaps for devices
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-18 10:49:38 +00:00
Krzysztof Kozlowski b07e2b70b9 mfd: sec-core: Add maximum RTC register for regmap config
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-03-18 10:48:43 +00:00
Geert Uytterhoeven 8321bbf890 mfd: sec-core: sec_pmic_{suspend,resume}() should depend on CONFIG_PM_SLEEP
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-02-19 13:30:34 +00:00
Linus Torvalds 15333539a9 regulator: Updates for v3.14
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.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJS4QTYAAoJELSic+t+oim92bMP/09kMG+4zS6TGM+ljselfYLQ
 XmqEAfLpND+07HmxlCRMHIRdrzMm7QrrW076UT3u6Q/RUi6L7LjXWdFNhm9d7k4V
 l45lvpo8C+bJkmX9Y9+dBPKbY5qnz9Kttpr/8wn0uAz1zhqhCCG2GYp0eV7Qcz7L
 XrBfiWmmeu11ArFtQcVPheGMdjiG2hpxbHqJ4e5nZ8kJ3C31RgfTR2r8xA8xr99H
 LhzuwoKjlsjzIuXUgd2F/i4TqtOkpg69wQocRnOYyyEpd4TnI+q4pk4GiMx4EuH1
 GMZ/XGmd1GuiAa7hXIWOyz7vNe54RPoLTWN8QEaYGXf8m/AUUVbje33BTtWbwEeU
 VXWbKpNEWWzykE6lPtxY9I0KMYbqAUvcflIL7kLYbxLS6RE5U4+dwYVEF0gwAWor
 svwgwXhjzNCJhb+DQlzKQa2zcWwJr0uT+DllPXEXJE5yIIn7cHEraYcS4cPfLNL5
 MLnB9BGX5zJQDJVsex/8jnCafI7M/CefIB06CbLK4klR1OtyTJc3yEhGCgWlJU4C
 NKdUbUhirCkPqY2v4RwWwOaxGs0WFWsyd5gYhCy3gL7O22pGW5yGO3MG524mRWrU
 ccU9lbpXgtHTTcb+RKBEwr9fWEcsCIt5gImcRoMxqfkjY0CsQJD8tVdl4Md7OYYv
 BjJexZZulWce7R3F7+Kf
 =1NsR
 -----END PGP SIGNATURE-----

Merge tag 'regulator-v3.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

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-25 13:19:10 -08:00
Tushar Behera 39fed00f0b mfd: sec-core: Add cells for S5M8767-clocks
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-21 08:28:57 +00:00
Wei Yongjun 005718c08b mfd: sec-core: Fix sparse NULL pointer warning
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-21 08:28:03 +00:00
Krzysztof Kozlowski a30fffb060 mfd: sec: Constify regmap configs and regmap irqs
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-21 08:13:37 +00:00
Krzysztof Kozlowski f6d6daaf9b mfd: sec: Add PM ops and make it a wake up source
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-21 08:13:35 +00:00
Geert Uytterhoeven 5ac98553af mfd: Constify struct mfd_cell where possible
As of commit 03e361b25e ("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>
2014-01-06 09:13:29 +00:00
Krzysztof Kozlowski ee5182b59f mfd: sec: Remove sec_reg* regmap helpers
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-18 17:25:26 +00:00
Krzysztof Kozlowski 3e1e4a5f3a mfd/rtc: s5m: fix register updating by adding regmap for RTC
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-12-12 18:19:26 -08:00
Sachin Kamat 1c5a099b29 mfd: sec-core: Include linux/of.h header
'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-10-23 16:22:15 +01:00
Yadwinder Singh Brar 3134bcae4f mfd: sec: Add clock cell for s2mps11
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-08-14 18:53:15 +01:00
Jingoo Han 334a41ce9b mfd: 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: Lee Jones <lee.jones@linaro.org>
2013-07-31 13:01:29 +01:00
Mark Brown 6b845ba934 mfd: sec: Add register cache for interrupt mask registers
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-31 02:02:55 +02:00
Yadwinder Singh Brar aa32acadcf mfd: s2mps11: Add device tree support
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-31 02:02:52 +02:00
Mark Brown 25f311fa58 mfd: sec: Provide max_register to regmap
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-07-02 00:54:39 +02:00
Leon Romanovsky 15447a46a5 mfd: sec-core: Remove explicit call to mfd_remove_devices
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-06-11 19:27:51 +02:00
Mark Brown 197bf85630 regulator: s5m8767: Fix build in non-DT case
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-04 18:31:25 +00:00
Amit Daniel Kachhap 26aec009f6 regulator: add device tree support for s5m8767
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>
2013-02-04 10:31:31 +00:00