summaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-tps65910.c
Commit message (Collapse)AuthorAgeFilesLines
* rtc: tps65910: Remove redundant dev_warn() and do not check for 0 return ↵Ruan Jinjie2023-08-171-5/+2
| | | | | | | | | | | | | | | | after calling platform_get_irq() It is not possible for platform_get_irq() to return 0. Use the return value from platform_get_irq(). And there is no need to call the dev_warn() function directly to print a custom message when handling an error from platform_get_irq() function as it is going to display an appropriate error message in case of a failure. Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com> Link: https://lore.kernel.org/r/20230803080713.4061782-3-ruanjinjie@huawei.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: tps65910: Correct driver module aliasDmitry Osipenko2021-08-171-1/+1
| | | | | | | | | | | | The TPS65910 RTC driver module doesn't auto-load because of the wrong module alias that doesn't match the device name, fix it. Cc: stable@vger.kernel.org Reported-by: Anton Bambura <jenneron@protonmail.com> Tested-by: Anton Bambura <jenneron@protonmail.com> Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20210808160030.8556-1-digetx@gmail.com
* rtc: tps65910: include linux/property.hArnd Bergmann2021-03-151-0/+1
| | | | | | | | | | | | | The added device_property_present() call causes a build failure in some configurations because of the missing header: drivers/rtc/rtc-tps65910.c:422:7: error: implicit declaration of function 'device_property_present' [-Werror,-Wimplicit-function-declaration] Fixes: 454ba154a62c ("rtc: tps65910: Support wakeup-source property") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20210225134215.2263694-1-arnd@kernel.org
* rtc: tps65910: Support wakeup-source propertyDmitry Osipenko2021-01-251-3/+7
| | | | | | | | | | | | | | TPS65910 is a PMIC MFD device and RTC is one of its functions. The wakeup-source DT property is specified for the parent MFD device and we need to use this property for the RTC in order to allow to use RTC alarm for waking up system from suspend by default, instead of requiring user to enable wakeup manually via sysfs. Tested-by: Peter Geis <pgwipeout@gmail.com> Tested-by: Matt Merhar <mattmerhar@protonmail.com> Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20210120211603.18555-1-digetx@gmail.com
* rtc: tps65910: remove tps65910_rtc_ops_noirqAlexandre Belloni2021-01-161-11/+4
| | | | | | | | Clear RTC_FEATURE_ALARM to signal that alarms are not available instead of having a supplementary struct rtc_class_ops without alarm callbacks. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20210110231752.1418816-18-alexandre.belloni@bootlin.com
* rtc: rework rtc_register_device() resource managementBartosz Golaszewski2020-11-191-1/+1
| | | | | | | | | | | | | | | | | | | | rtc_register_device() is a managed interface but it doesn't use devres by itself - instead it marks an rtc_device as "registered" and the devres callback for devm_rtc_allocate_device() takes care of resource release. This doesn't correspond with the design behind devres where managed structures should not be aware of being managed. The correct solution here is to register a separate devres callback for unregistering the device. While at it: rename rtc_register_device() to devm_rtc_register_device() and add it to the list of managed interfaces in devres.rst. This way we can avoid any potential confusion of driver developers who may expect there to exist a corresponding unregister function. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20201109163409.24301-8-brgl@bgdev.pl
* rtc: tps65910: allow using RTC without alarm interruptAndrey Skvortsov2019-11-171-6/+15
| | | | | | | | | | If tps65910 INT1 pin (IRQ output) is not wired to any IRQ controller, then it can't be used as system wakeup/alarm source, but it is still possible to read/write time from/to RTC. Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com> Link: https://lore.kernel.org/r/20191116203748.27166-1-andrej.skvortzov@gmail.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: remove superfluous error messageAlexandre Belloni2019-08-211-7/+1
| | | | | | | | | The RTC core now has error messages in case of registration failure, there is no need to have other messages in the drivers. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20190818220041.17833-2-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* Merge tag 'rtc-5.3' of ↵Linus Torvalds2019-07-171-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux Pull RTC updates from Alexandre Belloni: "A quiet cycle this time. - ds1307: properly handle oscillator failure flags - imx-sc: alarm support - pcf2123: alarm support, correct offset handling - sun6i: add R40 support - simplify getting the adapter of an i2c client" * tag 'rtc-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (37 commits) rtc: wm831x: Add IRQF_ONESHOT flag rtc: stm32: remove one condition check in stm32_rtc_set_alarm() rtc: pcf2123: Fix build error rtc: interface: Change type of 'count' from int to u64 rtc: pcf8563: Clear event flags and disable interrupts before requesting irq rtc: pcf8563: Fix interrupt trigger method rtc: pcf2123: fix negative offset rounding rtc: pcf2123: add alarm support rtc: pcf2123: use %ptR rtc: pcf2123: port to regmap rtc: pcf2123: remove sysfs register view rtc: rx8025: simplify getting the adapter of a client rtc: rx8010: simplify getting the adapter of a client rtc: rv8803: simplify getting the adapter of a client rtc: m41t80: simplify getting the adapter of a client rtc: fm3130: simplify getting the adapter of a client rtc: tegra: Drop MODULE_ALIAS rtc: sun6i: Add R40 compatible dt-bindings: rtc: sun6i: Add the R40 RTC compatible dt-bindings: rtc: Convert Allwinner A31 RTC to a schema ...
| * rtc: tps65910: fix typo in register name in read_alarm()Michał Mirosław2019-06-011-1/+1
| | | | | | | | | | | | | | | | Fix an obvious typo: in read_alarm() call we should read alarm setting (starting at ALARM_SECONDS register) and not current time. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* | treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152Thomas Gleixner2019-05-301-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 <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* rtc: tps65910: add rangeAlexandre Belloni2018-05-171-0/+2
| | | | | | The tps65910 RTC can support dates from 01/01/2000 to 31/12/2099. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: tps65910: allow platform power upAlexandre Belloni2018-05-171-12/+0
| | | | | | | | Currently, the IRQs are disabled when the rtc driver is removed (e.g. when shutting down the platform). This means that the RTC will be unable to power up the platform. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: tps65910: fix possible race conditionAlexandre Belloni2018-05-171-4/+8
| | | | | | | | | | | The IRQ is requested before the struct rtc is allocated and registered, but this struct is used in the IRQ handler. This may lead to a NULL pointer dereference. Switch to devm_rtc_allocate_device/rtc_register_device to allocate the rtc before requesting the IRQ. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
* rtc: tps65910: use 'unsigned int' instead of 'unsigned' in argumentsVesa Jääskeläinen2017-01-101-1/+2
| | | | | | | | Fixes checkpatch.pl warning: WARNING: Prefer 'unsigned int' to bare use of 'unsigned' Signed-off-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: tps65910: Add RTC calibration supportVesa Jääskeläinen2017-01-101-0/+143
| | | | | | | | | | Texas Instrument's TPS65910 has support for compensating RTC crystal inaccuracies. When enabled every hour RTC counter value will be compensated with two's complement value. Signed-off-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: tps65910: Drop IRQF_EARLY_RESUME flagGrygorii Strashko2016-03-141-1/+1
| | | | | | | | | | | | | | | | tps65910 RTC IRQ is nested threaded and wired to the tps65910 inerrupt controller. So, this flag is not required for nested irqs anymore, since commit 3c646f2c6aa9 ("genirq: Don't suspend nested_thread irqs over system suspend") was merged. Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com> Cc: Lee Jones <lee.jones@linaro.org> Cc: Tony Lindgren <tony@atomide.com> Cc: Nishanth Menon <nm@ti.com> Cc: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: drop owner assignment from platform_driversWolfram Sang2014-10-201-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 <wsa@the-dreams.de>
* drivers/rtc/rtc-tps65910.c: fix potential NULL-pointer dereferenceThierry Reding2014-08-081-2/+2
| | | | | | | | | | | | | | | The interrupt handler gets the driver data associated with the RTC device and doesn't check it for validity. This can cause a NULL pointer being dereferenced when and interrupt fires before the driver data was properly set up. Fix this by setting the driver data earlier (before the interrupt is requested). Signed-off-by: Thierry Reding <treding@nvidia.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>
* drivers/rtc/rtc-tps65910.c: remove unnecessary includeManish Badarkhe2013-11-131-1/+0
| | | | | | | | | Currently, driver includes 'pm_runtime.h' which is not used anywhere in code hence remove this unnecessory inclusion. Signed-off-by: Manish Badarkhe <badarkhe.manish@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* drivers/rtc/rtc-tps65910.c: fix incorrect return value on errorSachin Kamat2013-04-291-1/+1
| | | | | | | | | | | | | | | | 'ret' was not initialized to correct error value before returning. Since 'irq' is also being tested for 0, we cannot return irq itself as it means function is success even though we are returning before completing the probe. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Acked-by: Venu Byravarasu <vbyravarasu@nvidia.com> Cc: Chiwoong Byun <woong.byun@samsung.com> Cc: Jonghwa Lee <jonghwa3.lee@samsung.com> Cc: Laxman dewangan <ldewangan@nvidia.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>
* rtc: rtc-tps65910: switch to using SIMPLE_DEV_PM_OPSJingoo Han2013-04-291-3/+2
| | | | | | | | | Switch to using the SIMPLE_DEV_PM_OPS macro to declare the driver's pm_ops. It reduces code size. 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>
* rtc: rtc-tps65910: use devm_rtc_device_register()Jingoo Han2013-04-291-5/+1
| | | | | | | | | devm_rtc_device_register() is device managed and makes cleanup paths simpler. 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>
* drivers/rtc/rtc-tps65910.c: set irq flag to IRQF_EARLY_RESUME during irq requestLaxman Dewangan2013-02-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | All interrupt get disabled during system suspend and enabled during system resume. The enabling/disabling of interrupt happen in sequence of interrupt registration with framework. Therefore, in resume, the parent interrupt of this device enabled before the RTC irq interrupt enabled. If RTC is enabled for alarm wake and if system wake by alarm then there is interrupt pending for RTC. In resume, the parent interrupt get enabled before the rtc interrupt and hence ISR get served. In ISR, it founds that rtc interrupt is disabled and so it does not call the rtc isr handler and hence it misses the interrupt. Setting flag for early resume so that rtc interrupt get enabled before parent interrupt and so rtc interrupt get enabled when parent interrupt handler check for interrupt of device and call the rtc handler if it is there. This way it will not miss the interrupt. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* drivers/rtc/rtc-tps65910.c: use sleep_pm_ops macro for initialising ↵Laxman Dewangan2013-02-211-9/+4
| | | | | | | | | | | | suspend/resume callbacks Use SET_SYSTEM_SLEEP_PM_OPS for setting suspend/resume callbacks for dev_pm_ops. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* drivers/rtc/rtc-tps65910.c: remove unnecessary irq stat save and restoreLaxman Dewangan2013-02-211-19/+2
| | | | | | | | | | | | | | | | | | | The driver stores the interrupt enable register before going to suspend and restore in resume. Also it enables alarm before going to suspend. The driver only write the Interrupt enable register for enabling ALARM and does not enable any other bits. So it is not require to save complete register and enable ALARM interrupt before suspend and restore in resume. Also ALARM interrupt already enable if alarm is enabled before going to suspend and hence it is not require to enable explictly in suspend. Removing such above code. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* drivers/rtc/rtc-tps65910.c: enable/disable wake in suspend/resumeLaxman Dewangan2013-02-211-1/+11
| | | | | | | | | | | | | | | | Making the rtc driver as wakeup capabale and leaving the wake enable/disable decision to user space through a sysfs attribute. In suspend, enable wake if device wakeup enabled. In resume disable wake again. This change is inline with the Documentation/power/devices.txt# /sys/devices/.../power/wakeup files Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Drivers: rtc: remove __dev* attributes.Greg Kroah-Hartman2013-01-031-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 <wfp5p@virginia.edu> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Mike Frysinger <vapier.adi@gmail.com> Cc: Wan ZongShun <mcuos.com@gmail.com> Cc: Guan Xuetao <gxt@mprc.pku.edu.cn> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* drivers/rtc/rtc-tps65910.c: enable RTC power domain on initializationKim, Milo2012-12-171-0/+7
| | | | | | | | | | | | | | | | | | | | Enabling RTC HW block depends on the default value of TPS65910 register. In some mode, RTC block is disabled by default.(eg. AM3517 Craneboard) In this case, RTC_PWDN(RTC power down) bit should be cleared to enable the RTC HW block. This patch also works in case that RTC block is active by default, because there is no side effect even if the bit is updated again. Tested on AM3517 Craneboard. Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com> Acked-by: Venu Byravarasu <vbyravarasu@nvidia.com> Cc: Samuel Ortiz <sameo@linux.intel.com> Cc: Sivaram Nair <sivaramn@nvidia.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>
* drivers/rtc/rtc-tps65910.c: rename irq to match deviceSivaram Nair2012-12-171-1/+1
| | | | | | | | | A cosmetic change to rename the irq name to match the device name. Signed-off-by: Sivaram Nair <sivaramn@nvidia.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>
* drivers/rtc/rtc-tps65910.c: fix invalid pointer access on _remove()Kim, Milo2012-11-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | The tps65910_rtc data is registered as the platform driver data in _probe(= ). Therefore the tps65910_rtc should be used on unregistering the rtc device. And device pointer should be retrieved from the platform_device structure. This patch fixes the below oops: Unable to handle kernel NULL pointer dereference at virtual address 00000008 Modules linked in: rtc_tps65910(-) CPU: 0 Not tainted (3.7.0-rc7-next-20121128-g6b1f974-dirty #7) PC is at tps65910_rtc_alarm_irq_enable+0x20/0x2c [rtc_tps65910] (tps65910_rtc_alarm_irq_enable+0x20/0x2c [rtc_tps65910]) (tps65910_rtc_remove+0x18/0x28 [rtc_tps65910]) (platform_drv_remove+0x18/0x1c) (__device_release_driver+0x70/0xcc) (driver_detach+0xb4/0xb8) (bus_remove_driver+0x7c/0xc0) (sys_delete_module+0x148/0x21c) Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* drivers/rtc/rtc-tps65910.c: use platform_get_irq() to get RTC irq detailsVenu Byravarasu2012-10-061-4/+1
| | | | | | | | | | As RTC driver needs only irq number from platform data, using platform_get_irq(), instead of generic dev_get_platdata(). Signed-off-by: Venu Byravarasu <vbyravarasu@nvidia.com> Acked-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* rtc: tps65910: add RTC driver for TPS65910 PMIC RTCVenu Byravarasu2012-10-061-0/+352
TPS65910 PMIC is a MFD with RTC as one of the device. Adding RTC driver for supporting RTC device present inside TPS65910 PMIC. Only support for RTC alarm is implemented as part of this patch. Signed-off-by: Venu Byravarasu <vbyravarasu@nvidia.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> 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>