summaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-rx8025.c
AgeCommit message (Collapse)Author
2021-11-10rtc: rx8025: use .set_offset/.read_offsetAlexandre Belloni
The driver has its own sysfs file to adjust the clock. Fortunately, it is already in pbb, however, the sign it expects is the opposite of what the RTC core does (which actually aligns with the RTC). Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20211107225458.111068-12-alexandre.belloni@bootlin.com
2021-11-10rtc: rx8025: use rtc_add_groupAlexandre Belloni
Remove open coded sysfs registration by using rtc_add_group. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20211107225458.111068-11-alexandre.belloni@bootlin.com
2021-11-10rtc: rx8025: clear RTC_FEATURE_ALARM when alarm are not supportedAlexandre Belloni
Clear RTC_FEATURE_ALARM to signal alarms are not supported to the core instead of checking client->irq. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20211107225458.111068-10-alexandre.belloni@bootlin.com
2021-11-10rtc: rx8025: set rangeAlexandre Belloni
Set the RTC range, it is a classic BCD RTC, with 00 being a leap year. Let the core handle range checking. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20211107225458.111068-9-alexandre.belloni@bootlin.com
2021-11-10rtc: rx8025: let the core handle the alarm resolutionAlexandre Belloni
Tell the RTC core UIE are not supported because the resolution of the alarm is a minute. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20211107225458.111068-8-alexandre.belloni@bootlin.com
2021-11-10rtc: rx8025: switch to devm_rtc_allocate_deviceAlexandre Belloni
Switch to devm_rtc_allocate_device/devm_rtc_register_device, this allows for further improvement of the driver. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20211107225458.111068-7-alexandre.belloni@bootlin.com
2021-08-17rtc: rx8025: implement RX-8035 supportMathew McBride
The RX-8035 is a newer RTC from EPSON that is very similar to the RX-8025. The key difference is in the oscillation stop (XSTP) bit which is inverted on the RX-8035. Signed-off-by: Mathew McBride <matt@traverse.com.au> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20210709044518.28769-2-matt@traverse.com.au
2021-01-25rtc: rx8025: use rtc_lock/rtc_unlockAlexandre Belloni
Avoid accessing directly rtc->ops_lock and use the RTC core helpers. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20210119220653.677750-13-alexandre.belloni@bootlin.com
2019-12-23rtc: rx8025: Remove struct i2c_client from struct rx8025_dataNobuhiro Iwamatsu
struct i2c_client can be referenced from the device structure, so this doesn't need to have it in struct rx8025_data. Remove struct i2c_client from struct rx8025_data. CC: Alessandro Zummo <a.zummo@towertech.it> CC: Alexandre Belloni <alexandre.belloni@bootlin.com> CC: Wolfgang Grandegger <wg@grandegger.com> Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> Link: https://lore.kernel.org/r/20191218081624.3307752-1-iwamatsu@nigauri.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-07-17Merge tag 'rtc-5.3' of ↵Linus Torvalds
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 ...
2019-06-19treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500Thomas Gleixner
Based on 2 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 version 2 as published by the free software foundation this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation # extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 4122 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Enrico Weigelt <info@metux.net> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-09rtc: rx8025: simplify getting the adapter of a clientWolfram Sang
We have a dedicated pointer for that, so use it. Much easier to read and less computation involved. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-11rtc: rx8025: Fix a parameter to %ptR in rx8025_read_alarm()Andy Shevchenko
The commit 1921cab11723 ("rtc: rx8025: Switch to use %ptR") converted the driver to use new %p extension, but actually used wrong type of the parameter in one case. Fix a parameter to %ptR in rx8025_read_alarm(). Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-12-10rtc: rx8025: Switch to use %ptRAndy Shevchenko
Use %ptR instead of open coded variant to print content of struct rtc_time in human readable format. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-03-02rtc: stop validating rtc_time in .read_timeAlexandre Belloni
The RTC core is always calling rtc_valid_tm after the read_time callback. It is not necessary to call it just before returning from the callback. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2016-09-02rtc: constify rtc_class_ops structuresJulia Lawall
Check for rtc_class_ops structures that are only passed to devm_rtc_device_register, rtc_device_register, platform_device_register_data, all of which declare the corresponding parameter as const. Declare rtc_class_ops structures that have these properties as const. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r disable optional_qualifier@ identifier i; position p; @@ static struct rtc_class_ops i@p = { ... }; @ok@ identifier r.i; expression e1,e2,e3,e4; position p; @@ ( devm_rtc_device_register(e1,e2,&i@p,e3) | rtc_device_register(e1,e2,&i@p,e3) | platform_device_register_data(e1,e2,e3,&i@p,e4) ) @bad@ position p != {r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct rtc_class_ops i = { ... }; // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Acked-by: Baruch Siach <baruch@tkos.co.il> Acked-by: Hans Ulli Kroll <ulli.kroll@googlemail.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2016-07-09rtc: simplify implementations of read_alarmUwe Kleine-König
Since commit d68778b80dd7 ("rtc: initialize output parameter for read alarm to "uninitialized"") there is no need to explicitly set unsupported members to -1. So drop the respective assignments from drivers. Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2016-03-17Merge branch 'for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial Pull trivial tree updates from Jiri Kosina. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: drivers/rtc: broken link fix drm/i915 Fix typos in i915_gem_fence.c Docs: fix missing word in REPORTING-BUGS lib+mm: fix few spelling mistakes MAINTAINERS: add git URL for APM driver treewide: Fix typo in printk
2016-03-14rtc: rx8025: unsupport UIE modeAkinobu Mita
The alarm for rx8025 only has a minute accuracy, so unsupport UIE mode. pcf8563 and hym8563 also have a minute accuracy and unsupport it. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Wolfgang Grandegger <wg@grandegger.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2016-03-14rtc: rx8025: round up to nearest minute for a minute accuracy alarmAkinobu Mita
The alarm for rx8025 only has a minute accuracy, so round up to nearest minute when setting alarm. Without doing this, rtctest blocks one day after setting alarm to 5 seconds later. pcf8563 and hym8563 also have similar handling. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Wolfgang Grandegger <wg@grandegger.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2016-03-14rtc: rx8025: protect ctrl1 register update by rtc->ops_lockAkinobu Mita
The ctrl1 register is accessed by alarm operations. But it is updated in threaded interrupt handler without acquiring rtc->ops_lock. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Wolfgang Grandegger <wg@grandegger.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2016-03-14rtc: rx8025: fix irq handler registrationAkinobu Mita
When IRQ line for this chips is connected, devm_request_threaded_irq() refuses to register irq handler with the following message. genirq: Threaded irq requested with handler=NULL and !ONESHOT for irq Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Wolfgang Grandegger <wg@grandegger.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2016-02-15drivers/rtc: broken link fixLeslie Lau
In drivers/rtc/rtc-rx8025.c is a broken link that is supposed to lead to a form allowing users to subscribe to the lm-sensors mailing list. The link <http://lists.lm-sensors.org/mailman/listinfo/lmsensors> leads to a page with a 404 error. I believe the link should be replaced with <lm-sensors@lm-sensors.org>. Signed-off-by: Leslie Lau <laulinxk@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-02-04rtc: rx8025: remove rv8803 idAlexandre Belloni
The rv8803 has its own driver that should be used. Remove its id from the rx8025 driver. Fixes: b1f9d790b59dc04f8813a49a92ddd8651770ffee Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-11-08rtc: rx8025: remove unnecessary bracesAlexandre Belloni
braces {} are not necessary for single statement blocks Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-09-05rtc: rx8025: check time validity when necessaryAlexandre Belloni
Check time validity when reading time as this is when we need to know. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-09-05rtc: rx8025: fix RX8025_BIT_CTRL2_CTFG initializationAlexandre Belloni
RX8025_BIT_CTRL2_CTFG was set to 0 only when it was already 0. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-09-05rtc: rx8025: remove useless initializationAlexandre Belloni
irq_freq is already initialized to 1 in rtc_device_register() Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-09-05rtc: rx8025: reset validity when setting timeAlexandre Belloni
Wait for the user to set the time to reset the validity bits. Until then, the time may be invalid. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-09-05rtc: rx8025: fix rx8025_init_client()Alexandre Belloni
rx8025_init_client is modifying ctrl[0] and writing it to RX8025_REG_CTRL2 but ctrl[0] is actually RX8025_REG_CTRL1. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-09-05rtc: rx8025: continue without alarm when irq request failsAlexandre Belloni
Instead of bailing out, disable alarms and continue when devm_request_threaded_irq() fails. This allows to still provide some functionality. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-09-05rtc: rx8025: cleanup accessorsAlexandre Belloni
Remove useless error messages, at that point, the user already knows something went wrong but will not be able to do anything about it anyway. It is also highly unlikely that some registers are readable/writable but not some other ones. Also, transform rx8025_read_reg to be more resemblant to i2c_smbus_read_byte_data() Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-09-05rtc: rx8025: don't reset the timeAlexandre Belloni
Stop setting the time to epoch when it is invalid. The proper way to handle that is to return an error when it is invalid instead of returning an incorrect value. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-09-05rtc: rx8025: fix transfer modeAlexandre Belloni
The datasheet specifies that transfer mode must be 0 for write and either 0x4 (simplified read) or 0 (standard read). 0x8 is not specified, use standard mode. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-09-05rtc: rx8025: only handle dates between 2000 and 2099Alexandre Belloni
The hardware is only capable of handling dates between 2000 and 2099, enforce that. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-09-05rtc: rx8025: use BIT()Alexandre Belloni
Use BIT() instead of hand coding. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-09-05rtc: rx8025: remove useless probe error messageAlexandre Belloni
It is useless to print a message when probe fails as the user is already aware that it failed. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-09-05rtc: rx8025: switch to managed irq allocationAlexandre Belloni
Use devm_request_threaded_irq() so it is not necessary to call free_irq() explicitly. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-09-05rtc: rx8025: Convert to threaded IRQAlexandre Belloni
The driver currently emulates the concept of threaded IRQ using a workqueue, switch to threaded IRQ instead. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-09-05rtc: rx8025: remove useless headers and reorder themAlexandre Belloni
Remove the useless includes and order the remaining ones alphabetically. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-09-05rtc: rx8025: remove obsolete local_irq_disable() and local_irq_enable() for ↵Henri Roosen
rtc_update_irq() Since commit e6229bec25be ("rtc: make rtc_update_irq callable with irqs enabled") rtc_update_irq() is callable with irqs enabled. Signed-off-by: Henri Roosen <henriroosen@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-09-05rtc: Drop owner assignment from i2c_driverKrzysztof Kozlowski
i2c_driver does not need to set an owner because i2c_register_driver() will set it. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2014-04-03rtc: rtc-rx8025: remove unnecessary OOM messagesJingoo Han
The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message. 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-07-03rtc: rtc-rx8025: use devm_*() functionsJingoo Han
Use devm_*() functions to make 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>
2013-01-03Drivers: rtc: remove __dev* attributes.Greg Kroah-Hartman
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>
2012-03-23rtc: convert rtc i2c drivers to module_i2c_driverAxel Lin
Factor out some boilerplate code for i2c driver registration into module_i2c_driver. Signed-off-by: Axel Lin <axel.lin@gmail.com> Cc: Piotr Ziecik <kosmo@semihalf.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Scott Wood <scottwood@freescale.com> Cc: Srikanth Srinivasan <srikanth.srinivasan@freescale.com> Cc: Mike Rapoport <mike@compulab.co.il> Cc: Sergey Lapin <slapin@ossfans.org> Cc: Roman Fietze <roman.fietze@telemotive.de> Cc: Herbert Valerio Riedel <hvr@gnu.org> Cc: Alexander Bigga <ab@mycable.de> Cc: Dale Farnsworth <dale@farnsworth.org> Cc: Gregory Hermant <gregory.hermant@calao-systems.com> Cc: Wolfgang Grandegger <wg@grandegger.com> Cc: Martyn Welch <martyn.welch@ge.com> Cc: Byron Bradley <byron.bbradley@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-03-09RTC: Cleanup rtc_class_ops->irq_set_stateJohn Stultz
With PIE mode interrupts now emulated in generic code via an hrtimer, no one calls rtc_class_ops->irq_set_state(), so this patch removes it along with driver implementations. CC: Thomas Gleixner <tglx@linutronix.de> CC: Alessandro Zummo <a.zummo@towertech.it> CC: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br> CC: rtc-linux@googlegroups.com Signed-off-by: John Stultz <john.stultz@linaro.org>
2010-12-24rtc: don't use flush_scheduled_work()Tejun Heo
flush_scheduled_work() is deprecated and scheduled to be removed. On removal, directly cancel the work, and flush the uie_task in rtc-dev.c::clear_uie(). Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: rtc-linux@googlegroups.com
2010-07-19comment typo fixes: charater => characterThomas Weber
Fix typo in comments. Replace charater with character. Characteristics too. Signed-off-by: Thomas Weber <weber@corscience.de> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-06-03i2c: Remove all i2c_set_clientdata(client, NULL) in driversWolfram Sang
I2C drivers can use the clientdata-pointer to point to private data. As I2C devices are not really unregistered, but merely detached from their driver, it used to be the drivers obligation to clear this pointer during remove() or a failed probe(). As a couple of drivers forgot to do this, it was agreed that it was cleaner if the i2c-core does this clearance when appropriate, as there is no guarantee for the lifetime of the clientdata-pointer after remove() anyhow. This feature was added to the core with commit e4a7b9b04de15f6b63da5ccdd373ffa3057a3681 to fix the faulty drivers. As there is no need anymore to clear the clientdata-pointer, remove all current occurrences in the drivers to simplify the code and prevent confusion. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Acked-by: Richard Purdie <rpurdie@linux.intel.com> Acked-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Jean Delvare <khali@linux-fr.org>