aboutsummaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-twl.c
AgeCommit message (Collapse)AuthorFilesLines
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152Thomas Gleixner1-5/+1
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 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 3029 file(s). Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Allison Randal <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-09-04mfd: twl: Move header file out of I2C realmWolfram Sang1-1/+1
include/linux/i2c is not for client devices. Move the header file to a more appropriate location. Signed-off-by: Wolfram Sang <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Acked-by: Alexandre Belloni <[email protected]> Acked-by: Mark Brown <[email protected]> Acked-by: Sebastian Reichel <[email protected]> Acked-by: Jonathan Cameron <[email protected]> Acked-by: Dmitry Torokhov <[email protected]> Acked-by: Kishon Vijay Abraham I <[email protected]> Acked-by: Bartlomiej Zolnierkiewicz <[email protected]> Acked-by: Thierry Reding <[email protected]> Acked-by: Tony Lindgren <[email protected]> Acked-by: Daniel Thompson <[email protected]> Acked-by: Linus Walleij <[email protected]> Acked-by: Guenter Roeck <[email protected]> Signed-off-by: Lee Jones <[email protected]>
2016-11-30rtc: twl: make driver DT onlyNicolae Rosia1-5/+7
Since there are no platform based users and all users of this code are TI OMAP-based which is DT only, it makes sense to remove unused code. Signed-off-by: Nicolae Rosia <[email protected]> Tested-by: Tony Lindgren <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2016-11-30rtc: twl: kill static variablesNicolae Rosia1-76/+114
The current code uses static variables which prevent the use of multiple rtc twl instances. We also make it clear that this driver supports only TWL4030 and TWL6030 classes. Signed-off-by: Nicolae Rosia <[email protected]> Tested-by: Tony Lindgren <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2016-09-02rtc: constify rtc_class_ops structuresJulia Lawall1-1/+1
Check for rtc_class_ops structures that are only passed to devm_rtc_device_register, rtc_device_register, platform_device_register_data, all of which declare the corresponding parameter as const. Declare rtc_class_ops structures that have these properties as const. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r disable optional_qualifier@ identifier i; position p; @@ static struct rtc_class_ops i@p = { ... }; @ok@ identifier r.i; expression e1,e2,e3,e4; position p; @@ ( devm_rtc_device_register(e1,e2,&i@p,e3) | rtc_device_register(e1,e2,&i@p,e3) | platform_device_register_data(e1,e2,e3,&i@p,e4) ) @bad@ position p != {r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct rtc_class_ops i = { ... }; // </smpl> Signed-off-by: Julia Lawall <[email protected]> Acked-by: Baruch Siach <[email protected]> Acked-by: Hans Ulli Kroll <[email protected]> Acked-by: Linus Walleij <[email protected]> Acked-by: Thierry Reding <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
2015-04-17rtc: use more standard kernel logging stylesJoe Perches1-4/+5
Neaten the logging a bit by adding #define pr_fmt Miscellanea: o Remove __FILE__/__func__ uses o Coalesce formats adding missing spaces o Align arguments o (rtc-cmos) Integrated 2 consecutive messages Signed-off-by: Joe Perches <[email protected]> Acked-by: Alexandre Belloni <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Joshua Kinard <[email protected]> Cc: Chanwoo Choi <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Tested-by: Krzysztof Kozlowski <[email protected]> Cc: Aaro Koskinen <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-10-20rtc: drop owner assignment from platform_driversWolfram Sang1-1/+0
A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <[email protected]>
2014-01-23drivers/rtc/rtc-twl.c: use devm_*() functionsJingoo Han1-25/+13
Use devm_*() functions to make cleanup paths simpler, and remove unnecessary remove(). Signed-off-by: Jingoo Han <[email protected]> Cc: Yoichi Yuasa <[email protected]> Cc: Grygorii Strashko <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-07-31drivers/rtc/rtc-twl.c: fix: rtcX/wakealarm attribute isn't createdGrygorii Strashko1-1/+2
The device_init_wakeup() should be called before rtc_device_register(). Otherwise, sysfs "sys/class/rtc/rtcX/wakealarm" attribute will not be seen from User space. Signed-off-by: Grygorii Strashko <[email protected]> Cc: Kevin Hilman <[email protected]> Cc: Tony Lindgren <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-07-03drivers/rtc/rtc-twl.c: cleanup with module_platform_driver() conversionPeter Ujfalusi1-11/+1
Use module_platform_driver() to register the platform driver. Signed-off-by: Peter Ujfalusi <[email protected]> Acked-by: Kevin Hilman <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-07-03drivers/rtc/rtc-twl.c: fix rtc_reg_map initializationPeter Ujfalusi1-5/+6
Initialize the rtc_reg_map in platform_driver's probe function instead at module_init time. This way we can make sure that the twl-core has been already probed and initialized (twl_priv->twl_id is valid) since the platform device for the RTC driver will be created by the twl-core after it finished its init. Reported-by: Christoph Fritz <[email protected]> Signed-off-by: Peter Ujfalusi <[email protected]> Tested-by: Kevin Hilman <[email protected]> Tested-by: Grygorii Strashko <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-07-03drivers/rtc/rtc-twl.c: ensure IRQ is wakeup enabledKevin Hilman1-2/+14
Currently, the RTC IRQ is never wakeup-enabled so is not capable of bringing the system out of suspend. On OMAP platforms, we have gotten by without this because the TWL RTC is on an I2C-connected chip which is capable of waking up the OMAP via the IO ring when the OMAP is in low-power states. However, if the OMAP suspends without hitting the low-power states (and the IO ring is not enabled), RTC wakeups will not work because the IRQ is not wakeup enabled. To fix, ensure the RTC IRQ is wakeup enabled whenever the RTC alarm is set. Signed-off-by: Kevin Hilman <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Tony Lindgren <[email protected]> Cc: Grygorii Strashko <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-07-03rtc: rtc-twl: remove unnecessary platform_set_drvdata()Jingoo Han1-1/+0
The driver core clears the driver data to NULL after device_release or on probe failure, since commit 0998d063100 ("device-core: Ensure drvdata = NULL when no driver is bound"). Thus, it is not needed to manually clear the device driver data to NULL. Signed-off-by: Jingoo Han <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-06-12drivers/rtc/rtc-twl.c: fix missing device_init_wakeup() when booted with ↵Tony Lindgren1-0/+1
device tree When booted in legacy mode device_init_wakeup() gets called by drivers/mfd/twl-core.c when the children are initialized. However, when booted using device tree, the children are created with of_platform_populate() instead add_children(). This means that the RTC driver will not have device_init_wakeup() set, and we need to call it from the driver probe like RTC drivers typically do. Without this we cannot test PM wake-up events on omaps for cases where there may not be any physical wake-up event. Signed-off-by: Tony Lindgren <[email protected]> Reported-by: Kevin Hilman <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Jingoo Han <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-04-29rtc: rtc-twl: convert twl4030rtc_driver to dev_pm_opsJingoo Han1-10/+6
Instead of using legacy suspend/resume methods, using newer dev_pm_ops structure allows better control over power management. Signed-off-by: Jingoo Han <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-02-21drivers/rtc: use of_match_ptr() macroSachin Kamat1-1/+5
This eliminates having an #ifdef returning NULL for the case when OF is disabled. Maintains consistency in cases where OF is always selected. Signed-off-by: Sachin Kamat <[email protected]> Cc: Alessandro Zummo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2013-01-03Drivers: rtc: remove __dev* attributes.Greg Kroah-Hartman1-3/+3
CONFIG_HOTPLUG is going away as an option. As a result, the __dev* markings need to be removed. This change removes the use of __devinit, __devexit_p, __devinitdata, __devinitconst, and __devexit from these drivers. Based on patches originally written by Bill Pemberton, but redone by me in order to handle some of the coding style issues better, by hand. Cc: Bill Pemberton <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Srinidhi Kasagar <[email protected]> Cc: Linus Walleij <[email protected]> Cc: Mike Frysinger <[email protected]> Cc: Wan ZongShun <[email protected]> Cc: Guan Xuetao <[email protected]> Cc: Mark Brown <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2012-11-21mfd/rtc/gpio: twl: No need to allocate bigger buffer for writePeter Ujfalusi1-16/+16
Since the twl-core has been converted to use regmap it is no longer needed to allocate bigger buffer for data when writing to twl. CC: Grant Likely <[email protected]> CC: Alessandro Zummo <[email protected]> Acked-by: Linus Walleij <[email protected]> Acked-by: Tero Kristo <[email protected]> Signed-off-by: Peter Ujfalusi <[email protected]> Signed-off-by: Samuel Ortiz <[email protected]>
2012-09-17drivers/rtc/rtc-twl.c: ensure all interrupts are disabled during probeKevin Hilman1-0/+5
On some platforms, bootloaders are known to do some interesting RTC programming. Without going into the obscurities as to why this may be the case, suffice it to say the the driver should not make any assumptions about the state of the RTC when the driver loads. In particular, the driver probe should be sure that all interrupts are disabled until otherwise programmed. This was discovered when finding bursty I2C traffic every second on Overo platforms. This I2C overhead was keeping the SoC from hitting deep power states. The cause was found to be the RTC firing every second on the I2C-connected TWL PMIC. Special thanks to Felipe Balbi for suggesting to look for a rogue driver as the source of the I2C traffic rather than the I2C driver itself. Special thanks to Steve Sakoman for helping track down the source of the continuous RTC interrups on the Overo boards. Signed-off-by: Kevin Hilman <[email protected]> Cc: Felipe Balbi <[email protected]> Tested-by: Steve Sakoman <[email protected]> Cc: Alessandro Zummo <[email protected]> Tested-by: Shubhrajyoti Datta <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2012-07-11drivers/rtc/rtc-twl.c: fix threaded IRQ to use IRQF_ONESHOTKevin Hilman1-1/+1
Requesting a threaded interrupt without a primary handler and without IRQF_ONESHOT is dangerous, and after commit 1c6c6952 ("genirq: Reject bogus threaded irq requests"), these requests are rejected. This causes ->probe() to fail, and the RTC driver not to be availble. To fix, add IRQF_ONESHOT to the IRQ flags. Tested on OMAP3730/OveroSTORM and OMAP4430/Panda board using rtcwake to wake from system suspend multiple times. Signed-off-by: Kevin Hilman <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Thomas Gleixner <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2012-04-12drivers/rtc/rtc-twl.c: use static register while reading timeKonstantin Shlyakhovoy1-5/+38
RTC stores time and date in several registers. Due to the fact that these registers can't be read instantaneously, there is a chance that reading from counting registers gives an error of one minute, one hour, one day, etc. To address this issue, the RTC has hardware support to copy the RTC counting registers to static shadowed registers. The current implementation does not use this feature, and in a stress test, we can reproduce this error at a rate of around two times per 300000 readings. Fix the implementation to ensure that the right snapshot of time is captured. Signed-off-by: Konstantin Shlyakhovoy <[email protected]> Signed-off-by: Nishanth Menon <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Benoit Cousson <[email protected]> Cc: linux-omap <[email protected]> Acked-by: Mykola Oleksiienko <[email protected]> Acked-by: Oleksandr Dmytryshyn <[email protected]> Acked-by: Graeme Gregory <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2012-03-23drivers/rtc/rtc-twl.c: return correct RTC event from ISRVenu Byravarasu1-3/+3
Following changes are made as part of this change: 1. As TWL RTC supports periodic interrupt, the correct event should be RTC_PF instead of RTC_UF. 2. No need to initialize variable "events" to 0 & then OR it with the event values. Hence fixing it. Signed-off-by: Venu Byravarasu <[email protected]> Cc: Alessandro Zummo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2012-03-23drivers/rtc/rtc-twl.c: simplify RTC interrupt clearingVenu Byravarasu1-1/+1
For clearing RTC interrupt, programming ALARM bit only is sufficient, as all other bits are any way not affected by writing 0 to them. Hence removed unwanted OR operation. Signed-off-by: Venu Byravarasu <[email protected]> Cc: Alessandro Zummo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2012-03-23drivers/rtc/rtc-twl.c: enable RTC irrespective of its prior stateVenu Byravarasu1-10/+2
As part of probe, before enabling RTC, RTC_CTRL register is read to check if it is already running. If RTC is used by kernel alone, then this read is not required. Even if RTC was enabled already by boot loader, setting STOP_RTC bit again should not harm. Hence removed unwanted read operation. Signed-off-by: Venu Byravarasu <[email protected]> Cc: Alessandro Zummo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2012-03-23drivers/rtc/rtc-twl.c: optimize IRQ bit accessVenu Byravarasu1-0/+8
As the TWL RTC driver has a cached copy of enabled RTC interrupt bits in variable rtc_irq_bits, that can be checked before really setting or masking any of the interrupt bits. Signed-off-by: Venu Byravarasu <[email protected]> Cc: Alessandro Zummo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2012-01-10drivers/rtc/rtc-twl.c: add DT support for RTC inside twl4030/twl6030Benoit Cousson1-2/+8
Add the DT support for the TI rtc-twl present in the twl4030 and twl6030 devices. Signed-off-by: Benoit Cousson <[email protected]> Acked-by: Alessandro Zummo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2011-08-26rtc: twl: Fix registration vs. init orderTodd Poynor1-28/+24
Only register as an RTC device after the hardware has been successfully initialized. The RTC class driver will call back to this driver to read a pending alarm, and other drivers watching for new devices on the RTC class may read the RTC time upon registration. Such access might occur while the RTC is stopped, prior to clearing pending alarms, etc. The new ordering also avoids leaving the platform device drvdata set to an unregistered struct rtc_device * on probe errors. Signed-off-by: Todd Poynor <[email protected]> Signed-off-by: John Stultz <[email protected]>
2011-08-10rtc: rtc-twl: Remove lockdep related local_irq_enable()Sebastian Reichel1-8/+0
Now that the irq is properly threaded (due to it needing i2c access) we should also remove the local_irq_enable() call in twl_rtc_interrupt. Testing this with Pandaboard, the RTC is still working. [Reworked commit message -jstultz] Signed-off-by: John Stultz <[email protected]>
2011-08-10rtc: rtc-twl: Switch to using threaded irqIlkka Koskinen1-1/+1
The driver is accessing to i2c bus in interrupt handler. Therefore, it should use threaded irq. Signed-off-by: Ilkka Koskinen <[email protected]> Acked-by: Balaji T K <[email protected]> Signed-off-by: John Stultz <[email protected]>
2011-07-25drivers/rtc/rtc-twl.c: check return value of twl_rtc_write_u8() in ↵Jesper Juhl1-1/+1
twl_rtc_set_time() We forget to save the return value of the call to twl_rtc_write_u8(save_control, REG_RTC_CTRL_REG); in 'ret', making the test of 'ret < 0' dead code since 'ret' then couldn't possibly have changed since the last test just a few lines above. It also makes us not detect failures from that specific twl_rtc_write_u8() call. Signed-off-by: Jesper Juhl <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Alexandre Rusev <[email protected]> Cc: "George G. Davis" <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2011-03-09RTC: Cleanup rtc_class_ops->update_irq_enable()John Stultz1-13/+0
Now that the generic code handles UIE mode irqs via periodic alarm interrupts, no one calls the rtc_class_ops->update_irq_enable() method anymore. This patch removes the driver hooks and implementations of update_irq_enable if no one else is calling it. CC: Thomas Gleixner <[email protected]> CC: Alessandro Zummo <[email protected]> CC: Marcelo Roberto Jimenez <[email protected]> CC: [email protected] Signed-off-by: John Stultz <[email protected]>
2010-03-06rtc-twl: Storage class should be before const qualifierTobias Klauser1-2/+2
The C99 specification states in section 6.11.5: The placement of a storage-class specifier other than at the beginning of the declaration specifiers in a declaration is an obsolescent feature. Signed-off-by: Tobias Klauser <[email protected]> Signed-off-by: Alessandro Zummo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2009-12-14rtc: Add twl6030 RTC supportBalaji T K1-41/+111
This patch adds support for RTC in phoenix TWL6030. Register offset addresses have changed in TWL6030 rtc-twl.c will hence forth support all twl RTC (4030, 5030, 6030 ..) Signed-off-by: Balaji T K <[email protected]> Signed-off-by: Santosh Shilimkar <[email protected]> Reviewed-by: Tony Lindgren <[email protected]> Reviewed-by: Kevin Hilman <[email protected]> Signed-off-by: Samuel Ortiz <[email protected]>
2009-12-13mfd: Rename twl4030_ routines in rtc-twl.cBalaji T K1-68/+68
This patch renames all twl4030_ functions to twl_ so that RTC driver can be shared between Triton and Phoenix. Signed-off-by: Balaji T K <[email protected]> Signed-off-by: Nayak Rajendra <[email protected]> Signed-off-by: Santosh Shilimkar <[email protected]> Acked-by: Kevin Hilman <[email protected]> Signed-off-by: Samuel Ortiz <[email protected]>
2009-12-13mfd: Rename all twl4030_i2c*Balaji T K1-7/+7
This patch renames function names like twl4030_i2c_write_u8, twl4030_i2c_read_u8 to twl_i2c_write_u8, twl_i2c_read_u8 and also common variable in twl-core.c Signed-off-by: Rajendra Nayak <[email protected]> Signed-off-by: Balaji T K <[email protected]> Signed-off-by: Santosh Shilimkar <[email protected]> Acked-by: Kevin Hilman <[email protected]> Signed-off-by: Samuel Ortiz <[email protected]>
2009-12-13mfd: Rename twl4030* driver files to enable re-useSantosh Shilimkar1-0/+540
The upcoming TWL6030 is companion chip for OMAP4 like the current TWL4030 for OMAP3. The common modules like RTC, Regulator creates opportunity to re-use the most of the code from twl4030. This patch renames few common drivers twl4030* files to twl* to enable the code re-use. Signed-off-by: Rajendra Nayak <[email protected]> Signed-off-by: Balaji T K <[email protected]> Signed-off-by: Santosh Shilimkar <[email protected]> Acked-by: Kevin Hilman <[email protected]> Signed-off-by: Samuel Ortiz <[email protected]>