summaryrefslogtreecommitdiff
path: root/drivers/rtc
AgeCommit message (Collapse)Author
2017-11-13Merge branch 'timers-core-for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull timer updates from Thomas Gleixner: "Yet another big pile of changes: - More year 2038 work from Arnd slowly reaching the point where we need to think about the syscalls themself. - A new timer function which allows to conditionally (re)arm a timer only when it's either not running or the new expiry time is sooner than the armed expiry time. This allows to use a single timer for multiple timeout requirements w/o caring about the first expiry time at the call site. - A new NMI safe accessor to clock real time for the printk timestamp work. Can be used by tracing, perf as well if required. - A large number of timer setup conversions from Kees which got collected here because either maintainers requested so or they simply got ignored. As Kees pointed out already there are a few trivial merge conflicts and some redundant commits which was unavoidable due to the size of this conversion effort. - Avoid a redundant iteration in the timer wheel softirq processing. - Provide a mechanism to treat RTC implementations depending on their hardware properties, i.e. don't inflict the write at the 0.5 seconds boundary which originates from the PC CMOS RTC to all RTCs. No functional change as drivers need to be updated separately. - The usual small updates to core code clocksource drivers. Nothing really exciting" * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (111 commits) timers: Add a function to start/reduce a timer pstore: Use ktime_get_real_fast_ns() instead of __getnstimeofday() timer: Prepare to change all DEFINE_TIMER() callbacks netfilter: ipvs: Convert timers to use timer_setup() scsi: qla2xxx: Convert timers to use timer_setup() block/aoe: discover_timer: Convert timers to use timer_setup() ide: Convert timers to use timer_setup() drbd: Convert timers to use timer_setup() mailbox: Convert timers to use timer_setup() crypto: Convert timers to use timer_setup() drivers/pcmcia: omap1: Fix error in automated timer conversion ARM: footbridge: Fix typo in timer conversion drivers/sgi-xp: Convert timers to use timer_setup() drivers/pcmcia: Convert timers to use timer_setup() drivers/memstick: Convert timers to use timer_setup() drivers/macintosh: Convert timers to use timer_setup() hwrng/xgene-rng: Convert timers to use timer_setup() auxdisplay: Convert timers to use timer_setup() sparc/led: Convert timers to use timer_setup() mips: ip22/32: Convert timers to use timer_setup() ...
2017-11-02License cleanup: add SPDX GPL-2.0 license identifier to files with no licenseGreg Kroah-Hartman
Many source files in the tree are missing licensing information, which makes it harder for compliance tools to determine the correct license. By default all files without license information are under the default license of the kernel, which is GPL version 2. Update the files which contain no license information with the 'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This patch is based on work done by Thomas Gleixner and Kate Stewart and Philippe Ombredanne. How this work was done: Patches were generated and checked against linux-4.14-rc6 for a subset of the use cases: - file had no licensing information it it. - file was a */uapi/* one with no licensing information in it, - file was a */uapi/* one with existing licensing information, Further patches will be generated in subsequent months to fix up cases where non-standard license headers were used, and references to license had to be inferred by heuristics based on keywords. The analysis to determine which SPDX License Identifier to be applied to a file was done in a spreadsheet of side by side results from of the output of two independent scanners (ScanCode & Windriver) producing SPDX tag:value files created by Philippe Ombredanne. Philippe prepared the base worksheet, and did an initial spot review of a few 1000 files. The 4.13 kernel was the starting point of the analysis with 60,537 files assessed. Kate Stewart did a file by file comparison of the scanner results in the spreadsheet to determine which SPDX license identifier(s) to be applied to the file. She confirmed any determination that was not immediately clear with lawyers working with the Linux Foundation. Criteria used to select files for SPDX license identifier tagging was: - Files considered eligible had to be source code files. - Make and config files were included as candidates if they contained >5 lines of source - File already had some variant of a license header in it (even if <5 lines). All documentation files were explicitly excluded. The following heuristics were used to determine which SPDX license identifiers to apply. - when both scanners couldn't find any license traces, file was considered to have no license information in it, and the top level COPYING file license applied. For non */uapi/* files that summary was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 11139 and resulted in the first patch in this series. If that file was a */uapi/* path one, it was "GPL-2.0 WITH Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 WITH Linux-syscall-note 930 and resulted in the second patch in this series. - if a file had some form of licensing information in it, and was one of the */uapi/* ones, it was denoted with the Linux-syscall-note if any GPL family license was found in the file or had no licensing in it (per prior point). Results summary: SPDX license identifier # files ---------------------------------------------------|------ GPL-2.0 WITH Linux-syscall-note 270 GPL-2.0+ WITH Linux-syscall-note 169 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17 LGPL-2.1+ WITH Linux-syscall-note 15 GPL-1.0+ WITH Linux-syscall-note 14 ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5 LGPL-2.0+ WITH Linux-syscall-note 4 LGPL-2.1 WITH Linux-syscall-note 3 ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3 ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1 and that resulted in the third patch in this series. - when the two scanners agreed on the detected license(s), that became the concluded license(s). - when there was disagreement between the two scanners (one detected a license but the other didn't, or they both detected different licenses) a manual inspection of the file occurred. - In most cases a manual inspection of the information in the file resulted in a clear resolution of the license that should apply (and which scanner probably needed to revisit its heuristics). - When it was not immediately clear, the license identifier was confirmed with lawyers working with the Linux Foundation. - If there was any question as to the appropriate license identifier, the file was flagged for further research and to be revisited later in time. In total, over 70 hours of logged manual review was done on the spreadsheet to determine the SPDX license identifiers to apply to the source files by Kate, Philippe, Thomas and, in some cases, confirmation by lawyers working with the Linux Foundation. Kate also obtained a third independent scan of the 4.13 code base from FOSSology, and compared selected files where the other two scanners disagreed against that SPDX file, to see if there was new insights. The Windriver scanner is based on an older version of FOSSology in part, so they are related. Thomas did random spot checks in about 500 files from the spreadsheets for the uapi headers and agreed with SPDX license identifier in the files he inspected. For the non-uapi files Thomas did random spot checks in about 15000 files. In initial set of patches against 4.14-rc6, 3 files were found to have copy/paste license identifier errors, and have been fixed to reflect the correct identifier. Additionally Philippe spent 10 hours this week doing a detailed manual inspection and review of the 12,461 patched files from the initial patch version early this week with: - a full scancode scan run, collecting the matched texts, detected license ids and scores - reviewing anything where there was a license detected (about 500+ files) to ensure that the applied SPDX license was correct - reviewing anything where there was no detection but the patch license was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied SPDX license was correct This produced a worksheet with 20 files needing minor correction. This worksheet was then exported into 3 different .csv files for the different types of files to be modified. These .csv files were then reviewed by Greg. Thomas wrote a script to parse the csv files and add the proper SPDX tag to the file, in the format that the file expected. This script was further refined by Greg based on the output to detect more types of files automatically and to distinguish between header and source .c files (which need different comment types.) Finally Greg ran the script using the .csv files to generate the patches. Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-30rtc: Allow rtc drivers to specify the tv_nsec value for ntpJason Gunthorpe
ntp is currently hardwired to try and call the rtc set when wall clock tv_nsec is 0.5 seconds. This historical behaviour works well with certain PC RTCs, but is not universal to all rtc hardware. Change how this works by introducing the driver specific concept of set_offset_nsec, the delay between current wall clock time and the target time to set (with a 0 tv_nsecs). For x86-style CMOS set_offset_nsec should be -0.5 s which causes the last second to be written 0.5 s after it has started. For compat with the old rtc_set_ntp_time, the value is defaulted to + 0.5 s, which causes the next second to be written 0.5s before it starts, as things were before this patch. Testing shows many non-x86 RTCs would like set_offset_nsec ~= 0, so ultimately each RTC driver should set the set_offset_nsec according to its needs, and non x86 architectures should stop using update_persistent_clock64 in order to access this feature. Future patches will revise the drivers as needed. Since CMOS and RTC now have very different handling they are split into two dedicated code paths, sharing the support code, and ifdefs are replaced with IS_ENABLED. Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@kernel.org> Cc: Miroslav Lichvar <mlichvar@redhat.com> Cc: Richard Cochran <richardcochran@gmail.com> Cc: Prarit Bhargava <prarit@redhat.com> Cc: Stephen Boyd <stephen.boyd@linaro.org> Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Signed-off-by: John Stultz <john.stultz@linaro.org>
2017-09-13Merge tag 'rtc-4.14' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux Pull RTC updates from Alexandre Belloni: "Subsystem: - remove .open() and .release() RTC ops - constify i2c_device_id New driver: - Realtek RTD1295 - Android emulator (goldfish) RTC Drivers: - ds1307: Beginning of a huge cleanup - s35390a: handle invalid RTC time - sun6i: external oscillator gate support" * tag 'rtc-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (40 commits) rtc: ds1307: use octal permissions rtc: ds1307: fix braces rtc: ds1307: fix alignments and blank lines rtc: ds1307: use BIT rtc: ds1307: use u32 rtc: ds1307: use sizeof rtc: ds1307: remove regs member rtc: Add Realtek RTD1295 dt-bindings: rtc: Add Realtek RTD1295 rtc: sun6i: Add support for the external oscillator gate rtc: goldfish: Add RTC driver for Android emulator dt-bindings: Add device tree binding for Goldfish RTC driver rtc: ds1307: add basic support for ds1341 chip rtc: ds1307: remove member nvram_offset from struct ds1307 rtc: ds1307: factor out offset to struct chip_desc rtc: ds1307: factor out rtc_ops to struct chip_desc rtc: ds1307: factor out irq_handler to struct chip_desc rtc: ds1307: improve irq setup rtc: ds1307: constify struct chip_desc variables rtc: ds1307: improve trickle charger initialization ...
2017-09-05rtc: ds1307: use octal permissionsAlexandre Belloni
Octal permissions are preferred over symbolic permissions. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-05rtc: ds1307: fix bracesAlexandre Belloni
Fix unnecessary or unbalanced braces. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-05rtc: ds1307: fix alignments and blank linesAlexandre Belloni
Alignment should always match open parenthesis. Also remove two unnecessary blank lines Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-05rtc: ds1307: use BITAlexandre Belloni
Use the BIT macro were possbiel. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-05rtc: ds1307: use u32Alexandre Belloni
u32 should be used instead of uint32_t Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-05rtc: ds1307: use sizeofAlexandre Belloni
Use sizeof where possible to ensure we don't read/write more than the allocated buffer. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-05rtc: ds1307: remove regs memberAlexandre Belloni
ds1307->regs is never used before being read or initialized locally. There is no point in keeping a copy in memory. Also limit the size of the read buffer to what is really used, rename buf to regs for consistency and use sizeof() where possible. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-05rtc: Add Realtek RTD1295Andreas Färber
Based on QNAP's arch/arm/mach-rtk119x/driver/rtk_rtc_drv.c code and mach-rtk119x/driver/dc2vo/fpga/include/mis_reg.h register definitions. The base year 2014 was observed on all of Zidoo X9S, ProBox2 Ava and Beelink Lake I. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-05Merge branches 'ib-mfd-arm-i2c-4.14', 'ib-mfd-arm-usb-video-4.14', ↵Lee Jones
'ib-mfd-hwmon-4.14', 'ib-mfd-iio-pwm-4.14', 'ib-mfd-input-rtc-4.14', 'ib-mfd-many-4.14' and 'ib-mfd-pinctrl-regulator-4.14' into ibs-for-mfd-merged
2017-09-04mfd: twl: Move header file out of I2C realmWolfram Sang
include/linux/i2c is not for client devices. Move the header file to a more appropriate location. Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Mark Brown <broonie@kernel.org> Acked-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Acked-by: Jonathan Cameron <jic23@kernel.org> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Acked-by: Kishon Vijay Abraham I <kishon@ti.com> Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Thierry Reding <thierry.reding@gmail.com> Acked-by: Tony Lindgren <tony@atomide.com> Acked-by: Daniel Thompson <daniel.thompson@linaro.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-09-01rtc: sun6i: Add support for the external oscillator gateMaxime Ripard
The RTC can output its 32kHz clock outside of the SoC, for example to clock a WiFi chip. Create a new clock that other devices will be able to retrieve, while maintaining the DT stability by providing a default name for that clock if clock-output-names doesn't list one. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-01rtc: goldfish: Add RTC driver for Android emulatorMiodrag Dinic
Add device driver for a virtual RTC device in Android emulator. The compatible string used by OS for binding the driver is defined as "google,goldfish-rtc". Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtec.com> Signed-off-by: Goran Ferenc <goran.ferenc@imgtec.com> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-01rtc: ds1307: add basic support for ds1341 chipNikita Yushchenko
This adds support for reading and writing date/time from/to ds1341 chip. ds1341 chip has other features - alarms, input clock (can be used instead of intercal oscillator for better accuracy), output clock ("square wave generation"). However, not all of that is available at the same time. Same chip pins, CLKIN/nINTA and SQW/nINTB, can be used either for input/output clocks, or for alarm interrupts. Role of these pins on particular board depends on hardware wiring. We can add device tree properties that describe if each of pins is wired as clock, or as interrupt, or left unconnected, and enable support for corresponding functionality based on that. But that is cumbersome, requires hardware for testing, and has to deal with bit enabling/disabling output clock also affects which pins alarm interrupts are routed to. Another factor is that there are hardware setups (i.e. ZII RDU2) that power DS1341 from SuperCap, which makes power saving critical. For such setups, kernel driver should leave register bits that control mentioned pins in the state configured by bootloader. Given all that, it was decided to limit support to "only date/time" for now. That is enough for common use case. Full (and cumbersome) implementation can be added later if ever needed. Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-01rtc: ds1307: remove member nvram_offset from struct ds1307Heiner Kallweit
Remove member nvram_offset from struct ds1307 and use the value stored in struct chip_desc directly. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-01rtc: ds1307: factor out offset to struct chip_descHeiner Kallweit
Factor out offset to struct chip_desc and remove it from struct ds1307. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-01rtc: ds1307: factor out rtc_ops to struct chip_descHeiner Kallweit
Factor out rtc_ops to struct chip_desc and use ds13xx_rtc_ops as default. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-01rtc: ds1307: factor out irq_handler to struct chip_descHeiner Kallweit
Factor out irq_handler to struct chip_desc and use ds1307_irq as default. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-01rtc: ds1307: improve irq setupHeiner Kallweit
Change the usage of variable want_irq to reflect its name. Don't set it to true in case wakeup is enabled but no interrupt number is given. In addition set variable ds1307_can_wakeup_device if chip->alarm is set only. This allows to simplify the code and make it better understandable. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-01rtc: ds1307: constify struct chip_desc variablesHeiner Kallweit
Constify struct chip_desc variables. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-01rtc: ds1307: improve trickle charger initializationHeiner Kallweit
Instead of storing the trickle_charger_setup value in struct chip_desc we can let function ds1307_trickle_init return it because it's used in the probe function only. This allows us to constify struct chip_desc variables in a next step. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-01rtc: ds1307: factor out bbsqi bit to struct chip_descHeiner Kallweit
Factor out the bbsqi bit to struct chip_desc. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-01rtc: ds1307: remove member irq from struct ds1307Heiner Kallweit
The irq number is used in the probe function only, so we don't have to store it in struct ds1307. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-01rtc: rk808: Name RK805 in Kconfig for RTC_DRV_RK808Elaine Zhang
The RK808 and RK805 PMICs are using a similar register map. We can reuse the rtc driver for the RK805 PMIC. So let's add the RK805 in the Kconfig description. Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com> Signed-off-by: Joseph Chen <chenjh@rock-chips.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-01rtc: constify i2c_device_idArvind Yadav
i2c_device_id are not supposed to change at runtime. All functions working with i2c_device_id provided by <linux/i2c.h> work with const i2c_device_id. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-08-24rtc: remove .open() and .release()Alexandre Belloni
There are no driver left using .open and .release. There is no good use case for them as there is nothing the character device interface does that should not be done in the sysfs interface or in-kernel interface. Remove those callbacks now to avoid future confusion. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-08-24rtc: mxc: avoid disabling interrupts on device closeAlexandre Belloni
Currently, the IRQs are disabled when the rtc character device is closed. This means that the device needs to stay open to get alarms while the usual use case will open the device, set the alarm and close the device as is done in rtcwake. Keep the alarm functional on character device release so the platform can actually wakeup. Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-08-24rtc: vr41xx: make alarms usefulAlexandre Belloni
Currently, the IRQs are disabled when the rtc character device is closed. This means that the device needs to stay open to get alarms while the usual use case will open the device, set the alarm and close the device. Keep the alarms functional on character device release. Note that the PIE are never enabled and would anyway be disabled by the core. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-08-24rtc: sa1100: make alarms usefulAlexandre Belloni
Currently, the driver unregisters the IRQs when the rtc character device is closed. This means that the device needs to stay open to get alarms while the usual use case will open the device, set the alarm and close the device. Move the IRQ requests to sa1100_rtc_probe() and use the devm managed versions so we don't need to free them. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-08-24rtc: sa1100: fix unbalanced clk_prepare_enable/clk_disable_unprepareAlexandre Belloni
In the error path of sa1100_rtc_open(), info->clk is disabled which will happen again in sa1100_rtc_remove() when the module is removed whereas it is only enabled once in sa1100_rtc_init(). Fixes: 0cc0c38e9139 ("drivers/rtc/rtc-sa1100.c: move clock enable/disable to probe/remove") Acked-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-08-24rtc: pxa: fix possible race conditionAlexandre Belloni
pxa_rtc_open() registers the interrupt handler which will access the RTC registers. However, pxa_rtc_open() is called before the register range is ioremapped. Instead, call it after devm_ioremap(). Acked-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-08-24rtc: m41t80: remove debug sysfs attributeAlexandre Belloni
The last remaining sysfs attribute is undocumented and useless as it can only be used to debug the driver. Remove it. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-08-24rtc: m41t80: enable wakealarm when "wakeup-source" is specifiedEric Cooper
Don't require an IRQ if the wakeup-source device-tree property is present. Signed-off-by: Eric Cooper <ecc@cmu.edu> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-08-22rtc: puv3: make alarms usefulAlexandre Belloni
Currently, the driver unregisters the IRQs when the rtc character device is closed. This means that the device needs to stay open to get alarms while the usual use case will open the device, set the alarm and close the device. Move the IRQ requests to puv3_rtc_probe() and use the devm managed versions so we don't need to free them. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-08-22rtc: puv3: switch to devm_rtc_allocate_device()/rtc_register_device()Alexandre Belloni
Use managed RTC device allocation as this allows for further cleanup. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-08-21rtc: ds1307: fix regmap configHeiner Kallweit
Current max_register setting breaks reading nvram on certain chips and also reading the standard registers on RX8130 where register map starts at 0x10. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Fixes: 11e5890b5342 "rtc: ds1307: convert driver to regmap" Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-08-15mfd: dm355evm_msp: Move header file out of I2C realmWolfram Sang
include/linux/i2c is not for client devices. Move the header file to a more appropriate location. Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-07-31rtc: max8925: remove redundant check on retColin Ian King
The check on ret < 0 is redundant as the goto destination is the next statment. Remove this redudant check and goto. Detected by CoverityScan, CID#1268785 ("Identical code for different branches") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-31rtc: sun6i: ensure clk_data is kfree'd on errorColin Ian King
There are two error return paths that do not kfree clk_data and we end up with a memory leak. Fix these with a kfree error exit path. Detected by CoverityScan, CID#1402959 ("Resource Leak") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-31rtc: sun6i: Remove double init of spinlock in sun6i_rtc_clk_init()Alexey Klimov
Remove double init of spinlock in sun6i_rtc_clk_init() Fixes: 847b8bf62eb4 ("rtc: sun6i: Expose the 32kHz oscillator") Signed-off-by: Alexey Klimov <alexey.klimov@arm.com> Reviewed-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-31rtc: ds1307: remove legacy check for "isil, irq2-can-wakeup-machine" propertyHeiner Kallweit
Commit 8b44f5be20fd ("ARM: dts: armada: replace isil,irq2-can-wakeup-machine with wakeup-source property") removed the last usage of "isil,irq2-can-wakeup-machine" almost two years ago. So I think we can get rid of supporting this legacy binding. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-31rtc: s35390a: implement ioctlsFabien Lahoudere
Implements RTC_VL_READ and RTC_VL_CLR ioctls. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-31rtc: s35390a: handle invalid RTC timeFabien Lahoudere
If RTC time have been altered by low voltage, we notify users that RTC time is invalid by returning -EINVAL. The RTC time needs to be set correctly to clear the invalid flag. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-13Merge tag 'rtc-4.13' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux Pull RTC updates from Alexandre Belloni: "Here is the pull-request for the RTC subsystem for 4.13. Subsystem: - expose non volatile RAM using nvmem instead of open coding in many drivers. Unfortunately, this option has to be enabled by default to not break existing users. - rtctest can now test for cutoff dates, showing when an RTC will start failing to properly save time and date. - new RTC registration functions to remove race conditions in drivers Newly supported RTCs: - Broadcom STB wake-timer - Epson RX8130CE - Maxim IC DS1308 - STMicroelectronics STM32H7 Drivers: - ds1307: use regmap, use nvmem, more cleanups - ds3232: temperature reading support - gemini: renamed to ftrtc010 - m41t80: use CCF to expose the clock - rv8803: use nvmem - s3c: many cleanups - st-lpc: fix y2106 bug" * tag 'rtc-4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (51 commits) rtc: Remove wrong deprecation comment nvmem: include linux/err.h from header rtc: st-lpc: make it robust against y2038/2106 bug rtc: rtctest: add check for problematic dates tools: timer: add rtctest_setdate rtc: ds1307: remove ds1307_remove rtc: ds1307: use generic nvmem rtc: ds1307: switch to rtc_register_device rtc: rv8803: remove rv8803_remove rtc: rv8803: use generic nvmem support rtc: rv8803: switch to rtc_register_device rtc: add generic nvmem support rtc: at91rm9200: remove race condition rtc: introduce new registration method rtc: class separate id allocation from registration rtc: class separate device allocation from registration rtc: stm32: add STM32H7 RTC support dt-bindings: rtc: stm32: add support for STM32H7 rtc: ds1307: add ds1308 variant rtc: ds3232: add temperature support ...
2017-07-09rtc: st-lpc: make it robust against y2038/2106 bugBenjamin Gaignard
Make driver use u64 variables and functions to be sure that it will support dates after year 2038. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Acked-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-07rtc: ds1307: remove ds1307_removeAlexandre Belloni
ds1307_remove() is now empty, remove it Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-07rtc: ds1307: use generic nvmemAlexandre Belloni
Instead of adding a binary sysfs attribute from the driver (which suffers from a race condition as the attribute appears after the device), use the core to register an nvmem device. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>