aboutsummaryrefslogtreecommitdiff
path: root/drivers/rtc
AgeCommit message (Collapse)Author
2013-11-12Merge branch 'timers-core-for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull timer changes from Ingo Molnar: "Main changes in this cycle were: - Updated full dynticks support. - Event stream support for architected (ARM) timers. - ARM clocksource driver updates. - Move arm64 to using the generic sched_clock framework & resulting cleanup in the generic sched_clock code. - Misc fixes and cleanups" * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (50 commits) x86/time: Honor ACPI FADT flag indicating absence of a CMOS RTC clocksource: sun4i: remove IRQF_DISABLED clocksource: sun4i: Report the minimum tick that we can program clocksource: sun4i: Select CLKSRC_MMIO clocksource: Provide timekeeping for efm32 SoCs clocksource: em_sti: convert to clk_prepare/unprepare time: Fix signedness bug in sysfs_get_uname() and its callers timekeeping: Fix some trivial typos in comments alarmtimer: return EINVAL instead of ENOTSUPP if rtcdev doesn't exist clocksource: arch_timer: Do not register arch_sys_counter twice timer stats: Add a 'Collection: active/inactive' line to timer usage statistics sched_clock: Remove sched_clock_func() hook arch_timer: Move to generic sched_clock framework clocksource: tcb_clksrc: Remove IRQF_DISABLED clocksource: tcb_clksrc: Improve driver robustness clocksource: tcb_clksrc: Replace clk_enable/disable with clk_prepare_enable/disable_unprepare clocksource: arm_arch_timer: Use clocksource for suspend timekeeping clocksource: dw_apb_timer_of: Mark a few more functions as __init clocksource: Put nodes passed to CLOCKSOURCE_OF_DECLARE callbacks centrally arm: zynq: Enable arm_global_timer ...
2013-10-17intel_mid: Renamed *mrst* to *intel_mid*Kuppuswamy Sathyanarayanan
Following files contains code that is common to all intel mid soc's. So renamed them as below. mrst/mrst.c -> intel-mid/intel-mid.c mrst/vrtc.c -> intel-mid/intel_mid_vrtc.c mrst/early_printk_mrst.c -> intel-mid/intel_mid_vrtc.c pci/mrst.c -> pci/intel_mid_pci.c Also, renamed the corresponding header files and made changes to the driver files that included these header files. To ensure that there are no functional changes, I have compared the objdump of renamed files before and after rename and found that the only difference is file name change. Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Link: http://lkml.kernel.org/r/1382049336-21316-4-git-send-email-david.a.cohen@linux.intel.com Signed-off-by: David Cohen <david.a.cohen@linux.intel.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2013-10-09drivers: clean-up prom.h implicit includesRob Herring
Powerpc is a mess of implicit includes by prom.h. Add the necessary explicit includes to drivers in preparation of prom.h cleanup. Signed-off-by: Rob Herring <rob.herring@calxeda.com> Acked-by: Grant Likely <grant.likely@linaro.org>
2013-10-01HID RTC: Open sensor hub open closeSrinivas Pandruvada
Open sensor hub when module is loaded and close when module is removed. This helps saving power by opening HID transport only when there is an user. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Acked-by: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-18rtc: rtc-pl031: Set wakeup flag prior to registering rtcdevJohn Stultz
In some recent testing, I noticed the CLOCK_REALTIME_ALARM clockid wasn't functioning on my vexpress qemu environment. Looking into it I noticed the pl031 rtc driver doesn't set the wakeup flag on the device until after registering the device with the RTC subsystem. This causes the alarmtimer subsystem to not see the pl031 driver as a valid backing device, and that resuls in alarm clockids getting ENOTSUPP errors. Thus be sure to set the wakeup flag on the device prior to registering the rtcdev so the pl031 rtc driver can be used as the backing alarmtimer device. Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: "Jon Medhurst (Tixy)" <tixy@linaro.org> Cc: linux-arm-kernel@lists.infradead.org Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: John Stultz <john.stultz@linaro.org>
2013-09-16Merge branch 'fortglx/3.12/time' into fortglx/3.13/timeJohn Stultz
Merge in the timekeeping changes that missed 3.12 Signed-off-by: John Stultz <john.stultz@linaro.org>
2013-09-11rtc: simplify devm_request_mem_region/devm_ioremapJulia Lawall
Convert the composition of devm_request_mem_region and devm_ioremap to a single call to devm_ioremap_resource. The associated call to platform_get_resource is also simplified and moved next to the new call to devm_ioremap_resource. This was done using a combination of the semantic patches devm_ioremap_resource.cocci and devm_request_and_ioremap.cocci, found in the scripts/coccinelle/api directory. In rtc-lpc32xx.c and rtc-mv.c, the local variable size is no longer needed. In rtc-ds1511.c the size field of the local structure is not useful any more, and is deleted. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-11drivers/rtc/rtc-ds1742.c: report to RTC core if retrieved time is invalidAlexander Shiyan
Let RTC core decide if the retrieved time is invalid, instead of processing errors in the driver. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Cc: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-11drivers/rtc/rtc-ds1742.c: remove unused field "rtc" from private structureAlexander Shiyan
Private field "rtc" is not used outside "probe", so there is no reason to keep it. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Cc: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-11drivers/rtc/rtc-ds1742.c: use devm_ioremap_resource()Alexander Shiyan
Replace devm_request_mem_region() and devm_ioremap() with devm_ioremap_resource(). Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Cc: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-11drivers/rtc/rtc-sirfsoc.c: fix kernel warning during wakeupXianglong Du
enable_irq_wake() might fail, if so, we will see kernel warning in resume entries due to it always calls disable_irq_wake(). WARNING: at kernel/irq/manage.c:529 irq_set_irq_wake+0xc4/0xf0() Unbalanced IRQ 52 wake disable Modules linked in: ipv6 libcomposite configfs CPU: 0 PID: 1591 Comm: ash Tainted: G W 3.10.0-00854-gdbd86d4-dirty #100 (unwind_backtrace+0x0/0xf8) from (show_stack+0x10/0x14) (show_stack+0x10/0x14) from (warn_slowpath_common+0x54/0x68) (warn_slowpath_common+0x54/0x68) from (warn_slowpath_fmt+0x30/0x40) (warn_slowpath_fmt+0x30/0x40) from (irq_set_irq_wake+0xc4/0xf0) (irq_set_irq_wake+0xc4/0xf0) from (sirfsoc_rtc_restore+0x30/0x38) (sirfsoc_rtc_restore+0x30/0x38) from (platform_pm_restore+0x2c/0x50) (platform_pm_restore+0x2c/0x50) from (dpm_run_callback.clone.6+0x30/0xb0) (dpm_run_callback.clone.6+0x30/0xb0) from (device_resume+0x88/0x134) (device_resume+0x88/0x134) from (dpm_resume+0x114/0x230) (dpm_resume+0x114/0x230) from (hibernation_snapshot+0x178/0x1d0) (hibernation_snapshot+0x178/0x1d0) from (hibernate+0x130/0x1dc) (hibernate+0x130/0x1dc) from (state_store+0xb4/0xc0) (state_store+0xb4/0xc0) from (kobj_attr_store+0x14/0x20) (kobj_attr_store+0x14/0x20) from (sysfs_write_file+0xfc/0x17c) (sysfs_write_file+0xfc/0x17c) from (vfs_write+0xc8/0x194) (vfs_write+0xc8/0x194) from (SyS_write+0x40/0x6c) (SyS_write+0x40/0x6c) from (ret_fast_syscall+0x0/0x30) To avoid unbalanced "IRQ wake disable", ensure that disable_irq_wake() is called only when enable_irq_wake() have been successfully enabled. Signed-off-by: Xianglong Du <Xianglong.Du@csr.com> Signed-off-by: Barry Song <Baohua.Song@csr.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-11drivers/rtc/rtc-nuc900.c: use NULL instead of 0Jingoo Han
check_rtc_access_enable() returns pointer, thus NULL should be used instead of 0 in order to fix the following sparse warning: drivers/rtc/rtc-nuc900.c:102:16: warning: Using plain integer as NULL pointer Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-11drivers/rtc/rtc-max77686.c: Fix wrong registerSangjung Woo
Fix a read of the wrong register when checking whether the RTC timer has reached the alarm time. Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com> Signed-off-by: Myugnjoo Ham <myungjoo.ham@samsung.com> Reviewed-by: Jonghwa Lee <jonghwa3.lee@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-11drivers/rtc/rtc-hid-sensor-time.c: improve error handling when rtc register ↵Alexander Holler
fails Stop processing hid input when registering the RTC fails and handle a NULL returned from devm_rtc_device_register() as a failure too. Signed-off-by: Alexander Holler <holler@ahsoftware.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-11drivers/rtc/rtc-palmas.c: support for backup battery chargingLaxman Dewangan
Palmas series device like TPS65913, TPS80036 supports the backup battery for powering the RTC when no other energy source is available. The backup battery is optional, connected to the VBACKUP pin, and can be nonrechargeable or rechargeable. The rechargeable battery can be charged from the system supply using the backup battery charger. Add support for enabling charging of this backup battery. Also add the DT binding document and the new properties to have this support. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-by: Felipe Balbi <balbi@ti.com> Acked-by: Kumar Gala <galak@codeaurora.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-11drivers/rtc/rtc-omap.c: add rtc wakeup support to alarm eventsHebbar Gururaja
On some platforms (like AM33xx), a special register (RTC_IRQWAKEEN) is available to enable Alarm Wakeup feature. This register needs to be properly handled for the rtcwake to work properly. Platforms using such IP should set "ti,am3352-rtc" in rtc device dt compatibility node. Signed-off-by: Hebbar Gururaja <gururaja.hebbar@ti.com> Acked-by: Kevin Hilman <khilman@linaro.org> Acked-by: Sekhar Nori <nsekhar@ti.com> Cc: Grant Likely <grant.likely@linaro.org> Cc: Rob Herring <rob.herring@calxeda.com> Cc: Rob Landley <rob@landley.net> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-11rtc: add MOXA ART RTC driverJonas Jensen
Add RTC driver for MOXA ART SoCs. Signed-off-by: Jonas Jensen <jonas.jensen@gmail.com> Reviewed-by: Mark Brown <broonie@linaro.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-11drivers/rtc/rtc-pcf2127.c: remove empty functionSachin Kamat
The 'remove' function is empty and does not do anything. Delete it. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-11drivers/rtc/rtc-hid-sensor-time.c: add module alias to let the module load ↵Alexander Holler
automatically In order to get the module automatically loaded by hotplug mechanisms a MODULE_DEVICE_TABLE is needed. Therefore add one. This makes it also possible to use a module name other than HID-SENSOR-2000a0 which isn't very descriptive in kernel messages. Signed-off-by: Alexander Holler <holler@ahsoftware.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-11rtc: convert rtc-cmos to dev_pm_ops from legacy pm_opsShuah Khan
Convert drivers/rtc/rtc-cmos to use dev_pm_ops instead of legacy pm_ops. This patch depends on pnp driver bus ops change to invoke pnp_driver dev_pm_ops. Signed-off-by: Shuah Khan <shuah.kh@samsung.com> Cc: Matthew Garrett <matthew.garrett@nebula.com> Cc: Leonidas Da Silva Barbosa <leosilva@linux.vnet.ibm.com> Cc: Ashley Lai <ashley@ashleylai.com> Cc: Rajiv Andrade <mail@srajiv.net> Cc: Marcel Selhorst <tpmdd@selhorst.net> Cc: Sirrix AG <tpmdd@sirrix.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Grant Likely <grant.likely@linaro.org> Cc: Rob Herring <rob.herring@calxeda.com> Cc: Peter Hüwe <PeterHuewe@gmx.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-04Merge tag 'PTR_RET-for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux Pull PTR_RET() removal patches from Rusty Russell: "PTR_RET() is a weird name, and led to some confusing usage. We ended up with PTR_ERR_OR_ZERO(), and replacing or fixing all the usages. This has been sitting in linux-next for a whole cycle" [ There are still some PTR_RET users scattered about, with some of them possibly being new, but most of them existing in Rusty's tree too. We have that #define PTR_RET(p) PTR_ERR_OR_ZERO(p) thing in <linux/err.h>, so they continue to work for now - Linus ] * tag 'PTR_RET-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: GFS2: Replace PTR_RET with PTR_ERR_OR_ZERO Btrfs: volume: Replace PTR_RET with PTR_ERR_OR_ZERO drm/cma: Replace PTR_RET with PTR_ERR_OR_ZERO sh_veu: Replace PTR_RET with PTR_ERR_OR_ZERO dma-buf: Replace PTR_RET with PTR_ERR_OR_ZERO drivers/rtc: Replace PTR_RET with PTR_ERR_OR_ZERO mm/oom_kill: remove weird use of ERR_PTR()/PTR_ERR(). staging/zcache: don't use PTR_RET(). remoteproc: don't use PTR_RET(). pinctrl: don't use PTR_RET(). acpi: Replace weird use of PTR_RET. s390: Replace weird use of PTR_RET. PTR_RET is now PTR_ERR_OR_ZERO(): Replace most. PTR_RET is now PTR_ERR_OR_ZERO
2013-09-03Merge tag 'driver-core-3.12-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core patches from Greg KH: "Here's the big driver core pull request for 3.12-rc1. Lots of tiny changes here fixing up the way sysfs attributes are created, to try to make drivers simpler, and fix a whole class race conditions with creations of device attributes after the device was announced to userspace. All the various pieces are acked by the different subsystem maintainers" * tag 'driver-core-3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (119 commits) firmware loader: fix pending_fw_head list corruption drivers/base/memory.c: introduce help macro to_memory_block dynamic debug: line queries failing due to uninitialized local variable sysfs: sysfs_create_groups returns a value. debugfs: provide debugfs_create_x64() when disabled rbd: convert bus code to use bus_groups firmware: dcdbas: use binary attribute groups sysfs: add sysfs_create/remove_groups for when SYSFS is not enabled driver core: add #include <linux/sysfs.h> to core files. HID: convert bus code to use dev_groups Input: serio: convert bus code to use drv_groups Input: gameport: convert bus code to use drv_groups driver core: firmware: use __ATTR_RW() driver core: core: use DEVICE_ATTR_RO driver core: bus: use DRIVER_ATTR_WO() driver core: create write-only attribute macros for devices and drivers sysfs: create __ATTR_WO() driver-core: platform: convert bus code to use dev_groups workqueue: convert bus code to use dev_groups MEI: convert bus code to use dev_groups ...
2013-08-13drivers/rtc/rtc-stmp3xxx.c: provide timeout for potentially endless loop ↵Lothar Waßmann
polling a HW bit It's always a bad idea to poll on HW bits without a timeout. The i.MX28 RTC can be easily brought into a state in which the RTC is not running (until after a power-on-reset) and thus the status bits which are polled in the driver won't ever change. This patch prevents the kernel from getting stuck in this case. Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de> Acked-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-31drivers/rtc/rtc-twl.c: fix: rtcX/wakealarm attribute isn't createdGrygorii Strashko
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 <grygorii.strashko@ti.com> Cc: Kevin Hilman <khilman@linaro.org> Cc: Tony Lindgren <tony@atomide.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-29rtc: convert class code to use dev_groupsGreg Kroah-Hartman
The dev_attrs field of struct class is going away soon, dev_groups should be used instead. This converts the rtc class code to use the correct field. Acked-by: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-22rtc: Keep system awake until all expired RTC timers are handledZoran Markovic
Current implementation of RTC interface allows for system suspend to occur in the following cases: (a) if a timer is set in the past and rtc_timer_do_work() is scheduled to handle it, and (b) if rtc_timer_do_work() is called to handle expired timers whose handlers implement a preemption point. A pending suspend request may be honoured in the above cases causing timer handling to be delayed until after the next resume. This is undesirable since timer handlers may have time-critical code to execute. This patch makes sure that the system stays awake until all expired timers are handled. Note that all calls to pm_stay_awake() are eventually paired with the single pm_relax() call in rtc_timer_do_work(), which is launched using schedule_work(). Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: John Stultz <john.stultz@linaro.org> Cc: Arve Hjonnevag <arve@android.com> Cc: Todd Poynor <toddpoynor@google.com> Signed-off-by: Zoran Markovic <zoran.markovic@linaro.org> Signed-off-by: John Stultz <john.stultz@linaro.org>
2013-07-16drivers/rtc: Replace PTR_RET with PTR_ERR_OR_ZEROSachin Kamat
PTR_RET is now deprecated. Use PTR_ERR_OR_ZERO instead. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2013-07-10Merge tag 'mfd-3.11-1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-next Pull MFD update from Samuel Ortiz: "For the 3.11 merge we only have one new MFD driver for the Kontron PLD. But we also have: - Support for the TPS659038 PMIC from the palmas driver. - Intel's Coleto Creek and Avoton SoCs support from the lpc_ich driver. - RTL8411B support from the rtsx driver. - More DT support for the Arizona, max8998, twl4030-power and the ti_am335x_tsadc drivers. - The SSBI driver move under MFD. - A conversion to the devm_* API for most of the MFD drivers. - The twl4030-power got split from twl-core into its own module. - A major ti_am335x_adc cleanup, leading to a proper DT support. - Our regular arizona and wm* updates and cleanups from the Wolfson folks. - A better error handling and initialization, and a regulator subdevice addition for the 88pm80x driver. - A bulk platform_set_drvdata() call removal that's no longer need since commit 0998d0631001 ("device-core: Ensure drvdata = NULL when no driver is bound") * tag 'mfd-3.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-next: (102 commits) mfd: sec: Provide max_register to regmap mfd: wm8994: Remove duplicate check for active JACKDET MAINTAINERS: Add include directory to MFD file patterns mfd: sec: Remove fields not used since regmap conversion watchdog: Kontron PLD watchdog timer driver mfd: max8998: Add support for Device Tree regulator: max8998: Use arrays for specifying voltages in platform data mfd: max8998: Add irq domain support regulator: palmas: Add TPS659038 support mfd: Kontron PLD mfd driver mfd: palmas: Add TPS659038 PMIC support mfd: palmas: Add SMPS10_BOOST feature mfd: palmas: Check if irq is valid mfd: lpc_ich: iTCO_wdt patch for Intel Coleto Creek DeviceIDs mfd: twl-core: Change TWL6025 references to TWL6032 mfd: davinci_voicecodec: Fix build breakage mfd: vexpress: Make the driver optional for arm and arm64 mfd: htc-egpio: Use devm_ioremap_nocache() instead of ioremap_nocache() mfd: davinci_voicecodec: Convert to use devm_* APIs mfd: twl4030-power: Fix relocking on error ...
2013-07-09drivers/rtc/rtc-stmp3xxx.c: check the return value from stmp_reset_block()Fabio Estevam
stmp_reset_block() may fail, so let's check its return value and propagate it in the case of error. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03drivers/rtc/rtc-sirfsoc.c: add rtc drivers for CSR SiRFprimaII and SiRFatlasVIXianglong Du
On CSR SiRFprimaII/atlasVI, there is a programmable 16-bit divider (RTC_DIV) that divides the input 32.768KHz clock to the frequency that users need (E.g. 1 Hz). The divided real-time clock will be used to drive a 32-bit counter (RTC_COUNTER) that provides users with the actual time. In each cycle of the divided real-time clock, there is a Hertz interrupt generated to the RISC. Users can also configure an alarm (RTC_ALARM). When RTC_COUNTER matches the alarm, there will be an alarm interrupt generated to the RISC. The system RTC can generate an alarm wake-up signal to notify the power controller to wake up from power saving mode. Signed-off-by: Xianglong Du <Xianglong.Du@csr.com> Signed-off-by: Barry Song <Baohua.Song@csr.com> Cc: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03drivers/rtc/rtc-ds1216.c: use module_platform_driver_probe()Fabio Porcedda
Use module_platform_driver_probe() macro which makes the code smaller and simpler. Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03rtc: omap: restore back (hard-code) wakeup supportHebbar Gururaja
rtc-omap driver modules is used both by OMAP1/2, Davinci SoC platforms. However, rtc wake support on OMAP1 is broken. Hence the device_init_wakeup() was removed from rtc-omap driver and moved to platform board files that supported it (DA850/OMAP-L138). [1] However, recently [2] it was suggested that driver should always do a device_init_wakeup(dev, true). Platforms that don't want/need wakeup support can disable it from userspace via: echo disabled > /sys/devices/.../power/wakeup Also, with the new DT boot-up, board file doesn't exist and hence there is no way to have device wakeup support rtc. The fix for above issues, is to hard code device_init_wakeup() inside driver and let platforms that don't need this, handle it through the sysfs power entry. [1] https://patchwork.kernel.org/patch/136731/ [2] http://www.mail-archive.com/davinci-linux-open-source@linux. davincidsp.com/msg26077.html Signed-off-by: Hebbar Gururaja <gururaja.hebbar@ti.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Acked-by: Kevin Hilman <khilman@linaro.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03rtc: add NXP PCF2127 support (i2c)Renaud Cerrato
Added support for NXP PCF2127 RTC (i2c). [akpm@linux-foundation.org: fix typo, fix warnings] Signed-off-by: Renaud Cerrato <r.cerrato@til-technologies.fr> Cc: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03drivers/rtc/rtc-palmas.c: init wakeup before device registerWei Ni
Enable dev as wakeup device before calling rtc_device_register(), so that it can create the "wakealarm" sysfs. Signed-off-by: Wei Ni <wni@nvidia.com> Acked-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03drivers/rtc/class: convert from Legacy pm ops to dev_pm_opsShuah Khan
Convert drivers/rtc/class to use dev_pm_ops for power management and remove Legacy PM ops hooks. With this change, rtc class registers suspend/resume callbacks via class->pm (dev_pm_ops) instead of Legacy class->suspend/resume. When __device_suspend() runs call-backs, it will find class->pm ops for the rtc class. Signed-off-by: Shuah Khan <shuah.kh@samsung.com> Signed-off-by: Jingoo Han <jg1.han@samsung.com> Cc: Shuah Khan <shuahkhan@gmail.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03drivers/rtc/rtc-pcf2123.c: replace strict_strtoul() with kstrtoul()Jingoo Han
The usage of strict_strtoul() is not preferred, because strict_strtoul() is obsolete. Thus, kstrtoul() should be used. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03drivers/rtc/interface.c: return -EBUSY, not -EACCES when device is busyChris Brand
If rtc->irq_task is non-NULL and task is NULL, they always rtc_irq_set_freq(), whenever err is set to -EBUSY it will then immediately be set to -EACCES, misleading the caller as to the underlying problem. Signed-off-by: Chris Brand <chris.brand@broadcom.com> Acked-by: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03drivers/rtc/rtc-twl.c: cleanup with module_platform_driver() conversionPeter Ujfalusi
Use module_platform_driver() to register the platform driver. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Acked-by: Kevin Hilman <khilman@linaro.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03drivers/rtc/rtc-twl.c: fix rtc_reg_map initializationPeter Ujfalusi
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 <chf.fritz@googlemail.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Tested-by: Kevin Hilman <khilman@linaro.org> Tested-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03drivers/rtc/rtc-cmos.c: work around bios clearing rtc controlDerek Basehore
The bios may clear the rtc control register when resuming the system. Since the cmos interrupt handler may now be run before the rtc_cmos is resumed, this can cause the interrupt handler to ignore an alarm since the alarm bit is not set in the rtc control register. To work around this, check if the rtc_cmos is suspended and use the stored value for the rtc control register. Signed-off-by: Derek Basehore <dbasehore@chromium.org> Reviewed-by: Sameer Nanda <snanda@chromium.org> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Jingoo Han <jg1.han@samsung.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: John Stultz <john.stultz@linaro.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03drivers/rtc/rtc-twl.c: ensure IRQ is wakeup enabledKevin Hilman
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 <khilman@linaro.org> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Tony Lindgren <tony@atomide.com> Cc: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03drivers/rtc/rtc-pcf8583.c: use PTR_RET()Sachin Kamat
Use of PTR_RET() simplifies the code. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03drivers/rtc/rtc-pcf8563.c: use PTR_RET()Sachin Kamat
Use of PTR_RET() simplifies the code. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03drivers/rtc/rtc-m48t35.c: use PTR_RET()Sachin Kamat
Use of PTR_RET() simplifies the code. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03drivers/rtc/rtc-isl12022.c: use PTR_RET()Sachin Kamat
Use of PTR_RET() simplifies the code. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: Roman Fietze <roman.fietze@telemotive.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03drivers/rtc/rtc-da9052.c: use PTR_RET()Sachin Kamat
Use of PTR_RET() simplifies the code. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: David Dajun Chen <dchen@diasemi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03drivers/rtc/rtc-mpc5121.c: use platform_{get,set}_drvdata()Jingoo Han
Use the wrapper functions for getting and setting the driver data using platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev, so we can directly pass a struct platform_device. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Cc: Grant Likely <grant.likely@linaro.org> Cc: Rob Herring <rob.herring@calxeda.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03drivers/rtc/rtc-ds1302.c: handle write protectionSergey Yanovich
This chip has a control register and can prevent altering saved clock. Without this patch we could have: (arm)root@pac14:~# date Tue May 21 03:08:27 MSK 2013 (arm)root@pac14:~# /etc/init.d/hwclock.sh show Tue May 21 11:13:58 2013 -0.067322 seconds (arm)root@pac14:~# /etc/init.d/hwclock.sh stop [info] Saving the system clock. [info] Hardware Clock updated to Tue May 21 03:09:01 MSK 2013. (arm)root@pac14:~# /etc/init.d/hwclock.sh show Tue May 21 11:14:15 2013 -0.624272 seconds The patch enables write access to rtc before the driver tries to write time and re-disables when time data is written. Signed-off-by: Sergey Yanovich <ynvich@gmail.com> Acked-by: Marc Zyngier <maz@misterjones.org> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Sachin Kamat <sachin.kamat@linaro.org> Cc: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03drivers/rtc/rtc-ab8500.c: add second resolution to rtc driverAlexandre Torgue
Android expects the RTC to have second resolution. On ab8540 cut2 RTC block has a new register which allows setting seconds for wakeup alarms. Existing registers (minutes hi, mid and low) have seen their offsets changed. Here is the new mapping: * AlarmSec (A) 0x22 * AlarmMinLow (M) from 0x8 to 0x23 * AlarmMinMid (M) from 0x9 to 0x24 * AlarmMinHigh (M) from 0xA to 0x25 Signed-off-by: Julien Delacou <julien.delacou@stericsson.com> Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com> Acked-by: Lee Jones <lee.jones@linaro.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Cc: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03drivers/rtc/rtc-wm831x.c: remove empty functionSachin Kamat
After the switch to devm_* functions and the removal of rtc_device_unregister(), the 'remove' function does not do anything. Delete it. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>