summaryrefslogtreecommitdiffstats
path: root/drivers/rtc
Commit message (Collapse)AuthorAgeFilesLines
* rtc: m41t80: m41t80_sqw_set_rate should return 0 on successTroy Kisky2017-11-081-4/+1
| | | | | | | Previously it was returning -EINVAL upon success. Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: add support for NXP PCF85363 real-time clockEric Nelson2017-11-083-0/+234
| | | | | | | | | | | | | | | Note that alarms are not currently implemented. 64 bytes of nvmem is supported and exposed in sysfs (# is the instance number, starting with 0): /sys/bus/nvmem/devices/pcf85363-#/nvmem Signed-off-by: Eric Nelson <eric@nelint.com> Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com> Tested-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: omap: Support scratch registersAlexandre Belloni2017-11-081-0/+45
| | | | | | | | | | Register an nvmem device to expose the 3 scratch registers (total of 12 bytes) to both userspace and kernel space. Reviewed-by: Sekhar Nori <nsekhar@ti.com> Tested-by: Keerthy <j-keerthy@ti.com> Reviewed-by: Keerthy <j-keerthy@ti.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: omap: switch to rtc_register_deviceAlexandre Belloni2017-10-311-2/+7
| | | | | | | This removes a possible race condition and crash and allows for further improvement of the driver. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: omap: fix error path when pinctrl_register failsAlexandre Belloni2017-10-311-1/+2
| | | | | | | | | If pinctrl_register() fails probe will return with an error without locking the RTC and disabling pm_runtime. Set ret and jump to err instead. Fixes: 97ea1906b3c2 ("rtc: omap: Support ext_wakeup configuration") Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: ds1390: Add OF device ID tableAlexandre Belloni2017-10-271-0/+7
| | | | | | | | | | The driver doesn't have a struct of_device_id table but supported devices are registered via Device Trees. Worse, the compatible is documented but doesn't currently match the driver. Add the proper compatible to the driver. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: ds1307: add OF and ACPI entries for Epson RX8130Bastian Stender2017-10-261-0/+5
| | | | | | | | Make Epson RX8130 device tree and ACPI aware. Fixes: ee0981be7704 ("rtc: ds1307: Add support for Epson RX8130CE") Signed-off-by: Bastian Stender <bst@pengutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: mediatek: enhance the description for MediaTek PMIC based RTCSean Wang2017-10-261-4/+4
| | | | | | | | | | | Give a better description for original MediaTek RTC driver as PMIC based RTC in order to distinguish SoC based RTC. Also turning all words with Mediatek to MediaTek here. Cc: Eddie Huang <eddie.huang@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Acked-by: Eddie Huang <eddie.huang@mediatek.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: mediatek: add driver for RTC on MT7622 SoCSean Wang2017-10-263-0/+433
| | | | | | | | This patch introduces the driver for the RTC on MT7622 SoC. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Reviewed-by: Yingjoe Chen <yingjoe.chen@mediatek.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: pcf8523: add support for trimming the RTC oscillatorRussell King2017-10-251-0/+40
| | | | | | | | | | | | | Add support for reading and writing the RTC offset register, converting it to the corresponding parts-per-billion value. When setting the drift, the PCF8523 has two modes: one applies the adjustment every two hours, the other applies the adjustment every minute. We select between these two modes according to which ever gives the closest PPB value to the one requested. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: armada38x: add support for trimming the RTCRussell King2017-10-251-0/+101
| | | | | | | | | | Add support for trimming the RTC using the offset mechanism. This RTC supports two modes: low update mode and high update mode. Low update mode has finer precision than high update mode, so we use the low mode where possible. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: clarify the RTC offset correctionRussell King2017-10-251-0/+4
| | | | | | | | | The RTC offset correction documentation is not very clear about the exact relationship between "offset" and the effect it has on the RTC. Supplement the documentation with an equation giving the relationship. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: ds1511: use generic nvmemAlexandre Belloni2017-10-131-36/+22
| | | | | | | | 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>
* rtc: ds1511: allow waking platformAlexandre Belloni2017-10-131-9/+1
| | | | | | | Disabling interrupts when removing the driver is bad practice as this will prevent some platform from waking up when using that RTC. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: ds1511: switch to rtc_register_deviceAlexandre Belloni2017-10-131-2/+7
| | | | | | This allows for future improvement of the driver. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: abx80x: solve race conditionAlexandre Belloni2017-10-131-5/+5
| | | | | | | | There is a race condition that can happen if abx80x_probe() fails after the rtc registration succeeded. Solve that by moving the registration at the end of the probe function. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: abx80x: switch to rtc_register_deviceAlexandre Belloni2017-10-131-3/+7
| | | | | | This allows for future improvement of the driver. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: m48t86: use generic nvmemAlexandre Belloni2017-10-131-25/+23
| | | | | | | | 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>
* rtc: m48t86: switch to rtc_register_deviceAlexandre Belloni2017-10-131-2/+8
| | | | | | This allows for future improvement of the driver. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: ds1305: use generic nvmemAlexandre Belloni2017-10-131-38/+21
| | | | | | | | 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>
* rtc: ds1305: switch to rtc_register_deviceAlexandre Belloni2017-10-131-3/+8
| | | | | | This allows for future improvement of the driver. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: pl031: make interrupt optionalRussell King2017-10-121-6/+8
| | | | | | | | | On some platforms, the interrupt for the PL031 is optional. Avoid trying to claim the interrupt if it's not specified. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: pl031: avoid exposing alarm if no interruptRussell King2017-10-121-3/+12
| | | | | | | | | | If the RTC has no interrupt, there is little point in exposing the RTC alarm capabilities, as it can't be used as a wakeup source nor can it deliver an event to userspace. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: pl031: use devm_* for allocating memory and mapping resourceRussell King2017-10-121-11/+6
| | | | | | | | | | Use the devm_* APIs for allocating memory and mapping the memory in the probe function to relieve the driver from having to deal with this in the cleanup paths. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: pl031: constify amba_idsRussell King2017-10-121-1/+1
| | | | | | | | The AMBA device IDs should be marked const. Make that so. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: rv3029: Clean up error handling in rv3029_eeprom_write()Dan Carpenter2017-10-121-8/+8
| | | | | | | | | | We don't need both "ret" and "err" when they do the same thing. All the functions called here return zero on success or negative error codes. It's more clear to return a literal zero at the end instead of "return ret;" Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: jz4740: fix loading of rtc driverMathieu Malaterre2017-10-121-2/+2
| | | | | | | | | | | | | | | The current timeout for waiting for WRDY is not always sufficient. Always increase it to 10000 even on JZ4740. This is technically only required on JZ4780, where the current symptoms seen after a hard reboot are: jz4740-rtc 10003000.rtc: rtc core: registered 10003000.rtc as rtc0 jz4740-rtc 10003000.rtc: Could not write to RTC registers jz4740-rtc: probe of 10003000.rtc failed with error -5 Suggested-by: Alex Smith <alex.smith@imgtec.com> Cc: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com> Signed-off-by: Mathieu Malaterre <malat@debian.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: jz4740: remove duplicate 'write' in messageMathieu Malaterre2017-10-121-1/+1
| | | | | | | Trivial fix in error message with duplicate 'write' Signed-off-by: Mathieu Malaterre <malat@debian.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: ds1307: improve weekday handlingHeiner Kallweit2017-10-121-26/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current code for checking and fixing the weekday in ds1307_probe faces some issues: - This check is applied to all chips even if its applicable (AFAIK) to mcp794xx only - The check uses MCP794XX constants for registers and bits even though it's executed also on other chips (ok, this could be fixed easily) - It relies on tm_wday being properly populated when core calls set_time and set_alarm. This is not guaranteed at all. First two issue we could solve by moving the check to the mcp794xx-specific initialization (where also VBATEN flag is set). The proposed alternative is in the set_alarm path for mcp794xx only and calculates the alarm weekday based on the current weekday in the RTC timekeeping regs and the difference between alarm date and current date. So we are fine with any weekday even if it doesn't match the date. Still there are cases where this could fail, e.g.: - rtc date/time + weekday have power-on-reset default values - alarm is set to actual date/time + x - set_time is called (may change diff between rtc weekday and actual weekday) But similar issues we have with the current code too: - rtc date/time + weekday have power-on-reset default values - alarm is set to rtc date/time + x - set_time is called before the alarm triggers Using random rtc date/time with relative alarms simply can interfere with set_time. I'm not totally convinced of either option yet. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: set the alarm to the next expiring timerAlexandre Belloni2017-09-281-1/+1
| | | | | | | | | | | If there is any non expired timer in the queue, the RTC alarm is never set. This is an issue when adding a timer that expires before the next non expired timer. Ensure the RTC alarm is set in that case. Fixes: 2b2f5ff00f63 ("rtc: interface: ignore expired timers when enqueuing new timers") Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* rtc: rv3029: fix vendor stringAlexandre Belloni2017-09-261-0/+2
| | | | | | | The vendor string for Microcrystal is microcrystal. Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
* Merge tag 'rtc-4.14' of ↵Linus Torvalds2017-09-1319-475/+908
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ...
| * rtc: ds1307: use octal permissionsAlexandre Belloni2017-09-051-1/+1
| | | | | | | | | | | | Octal permissions are preferred over symbolic permissions. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
| * rtc: ds1307: fix bracesAlexandre Belloni2017-09-051-3/+3
| | | | | | | | | | | | Fix unnecessary or unbalanced braces. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
| * rtc: ds1307: fix alignments and blank linesAlexandre Belloni2017-09-051-11/+10
| | | | | | | | | | | | | | Alignment should always match open parenthesis. Also remove two unnecessary blank lines Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
| * rtc: ds1307: use BITAlexandre Belloni2017-09-051-9/+9
| | | | | | | | | | | | Use the BIT macro were possbiel. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
| * rtc: ds1307: use u32Alexandre Belloni2017-09-051-4/+4
| | | | | | | | | | | | u32 should be used instead of uint32_t Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
| * rtc: ds1307: use sizeofAlexandre Belloni2017-09-051-8/+16
| | | | | | | | | | | | | | 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>
| * rtc: ds1307: remove regs memberAlexandre Belloni2017-09-051-100/+107
| | | | | | | | | | | | | | | | | | | | 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>
| * rtc: Add Realtek RTD1295Andreas Färber2017-09-053-0/+251
| | | | | | | | | | | | | | | | | | | | | | 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>
| * rtc: sun6i: Add support for the external oscillator gateMaxime Ripard2017-09-011-3/+21
| | | | | | | | | | | | | | | | | | | | | | | | 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>
| * rtc: goldfish: Add RTC driver for Android emulatorMiodrag Dinic2017-09-013-0/+246
| | | | | | | | | | | | | | | | | | | | | | | | 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>
| * rtc: ds1307: add basic support for ds1341 chipNikita Yushchenko2017-09-012-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * rtc: ds1307: remove member nvram_offset from struct ds1307Heiner Kallweit2017-09-011-4/+4
| | | | | | | | | | | | | | | | 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>
| * rtc: ds1307: factor out offset to struct chip_descHeiner Kallweit2017-09-011-11/+7
| | | | | | | | | | | | | | 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>
| * rtc: ds1307: factor out rtc_ops to struct chip_descHeiner Kallweit2017-09-011-23/+28
| | | | | | | | | | | | | | 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>
| * rtc: ds1307: factor out irq_handler to struct chip_descHeiner Kallweit2017-09-011-8/+7
| | | | | | | | | | | | | | 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>
| * rtc: ds1307: improve irq setupHeiner Kallweit2017-09-011-17/+10
| | | | | | | | | | | | | | | | | | | | | | 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>
| * rtc: ds1307: constify struct chip_desc variablesHeiner Kallweit2017-09-011-3/+3
| | | | | | | | | | | | | | Constify struct chip_desc variables. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
| * rtc: ds1307: improve trickle charger initializationHeiner Kallweit2017-09-011-17/+16
| | | | | | | | | | | | | | | | | | | | 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>
OpenPOWER on IntegriCloud