summaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-ds1343.c
AgeCommit message (Collapse)Author
2019-10-19rtc: ds1343: cleanup .removeAlexandre Belloni
It is not necessary to call device_init_wakeup(dev, false) in .remove as device_del will take care of that. It is also not necessary to devm_free_irq. Finally, dev_pm_clear_wake_irq can be called unconditionally. Link: https://lore.kernel.org/r/20191019204941.6203-9-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-10-19rtc: ds1343: rework interrupt handlingAlexandre Belloni
Rework the interrupt handling to avoid caching the values as the core is already doing that. The core also always ensures the rtc_time passed for the alarm is fully populated. The only trick is in read_alarm where status needs to be read before the alarm registers to ensure the potential irq is not cleared. Link: https://lore.kernel.org/r/20191019204941.6203-8-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-10-19rtc: ds1343: remove unnecessary mutexAlexandre Belloni
Use rtc_lock and rtc_unlock to lock the rtc from the interrupt handler. This removes the need for a driver specific lock. Link: https://lore.kernel.org/r/20191019204941.6203-7-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-10-19rtc: ds1343: check regmap_read return valueAlexandre Belloni
Check whether regmap_read fails before continuing in the sysfs .show callbacks. Link: https://lore.kernel.org/r/20191019204941.6203-6-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-10-19rtc: ds1343: use regmap_update_bits for glitch filterAlexandre Belloni
Use regmap_update_bits to update DS1343_CONTROL_REG in a race free manner when setting the glitch filter. Link: https://lore.kernel.org/r/20191019204941.6203-5-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-10-19rtc: ds1343: use rtc_add_groupAlexandre Belloni
Use rtc_add_group to add the sysfs group in a race free manner. This has the side effect of moving the files to their proper location. Link: https://lore.kernel.org/r/20191019204941.6203-4-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-10-19rtc: ds1343: use burst write to set timeAlexandre Belloni
To avoid possible race condition, use regmap_bulk_write to write all the date/time registers at once instead of sequentially. Link: https://lore.kernel.org/r/20191019204941.6203-3-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-10-19rtc: ds1343: remove dead codeAlexandre Belloni
RTC_SET_CHARGE doesn't exist, the ioctl code is never used. Link: https://lore.kernel.org/r/20191019204941.6203-2-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-10-19rtc: ds1343: set rangeAlexandre Belloni
This is a standard BCD rtc with a useless century bit (no leap year correction after 2099). Link: https://lore.kernel.org/r/20191019204941.6203-1-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
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>
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>
2018-03-01rtc: ds1343: 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@bootlin.com>
2018-03-01rtc: ds1343: remove undocumented and useless sysfs filesAlexandre Belloni
A documented ABI already exists to get information about the alarm. It is the only one that is used. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-03-01rtc: ds1343: switch to rtc_register_deviceAlexandre Belloni
This allows for future improvement of the driver. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-03-01rtc: ds1343: simplify regmap initializationAlexandre Belloni
Avoid using memset as gcc can properly initialize structures. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.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-05-20rtc: remove useless DRV_VERSIONAlexandre Belloni
Many drivers are defining a DRV_VERSION. This is often only used for MODULE_VERSION and sometimes to print an info message at probe time. This is kind of pointless as they are all versionned with the kernel anyway. Also the core will print a message when a new rtc is found. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-11-10Merge tag 'rtc-v4.4' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux Pull RTC updates from Alexandre Belloni: "Core: - Fix rtctest error path New drivers: - Microcrystal RV8803 Subsystem wide cleanups: - remove misuse of IRQF_NO_SUSPEND flag Drivers: - at91rm9200: clear RTC alarm status flag prior to suspending - davinci: remove incorrect reference to probe function - ds1307: Fix alarm programming for mcp794xx - ds1390: trickle charger support, fix ds1390_get_reg - isl1208: Pass the IRQF_ONESHOT flag - opal: fix type of token - pcf2127: fix RTC_READ_VL, remove useless driver version - pcf85063: return an error when date is invalid - pcf8563: add CLKOUT to common clock framework - rx8025: remove unnecessary braces - s3c: Set year, month, day value for setting alarm - stmp3xxx: unify register access macros - License fixes: pcf2127, da9063 - wakeup-source support for isl12057 and opal" * tag 'rtc-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (23 commits) rtc: Add a driver for Micro Crystal RV8803 rtc: s3c: Set year, month, day value for setting alarm rtc: ds1307: Fix alarm programming for mcp794xx rtc: isl12057: enable support for the standard "wakeup-source" property rtc: opal: enable support for the stardard "wakeup-source" property rtc: isl1208: Pass the IRQF_ONESHOT flag rtc: pcf8563: add CLKOUT to common clock framework rtc: davinci: remove incorrect reference to probe function rtc: at91rm9200: clear RTC alarm status flag prior to suspending rtc: pcf2127: remove useless driver version rtc: pcf2127: fix reading uninitialized value on RTC_READ_VL ioctl rtc: stmp3xxx: unify register access macros rtc: da9063: GPL copyright inconsistency fix rtc: pcf85063: return an error when date is invalid rtc: rx8025: remove unnecessary braces rtc: ds1343: remove misuse of IRQF_NO_SUSPEND flag rtc: ab8500: remove misuse of IRQF_NO_SUSPEND flag rtc: pl031: remove misuse of IRQF_NO_SUSPEND flag rtc: opal: fix type of token rtc: ds1390: Add trickle charger device tree binding ...
2015-11-08rtc: ds1343: remove misuse of IRQF_NO_SUSPEND flagSudeep Holla
The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup. This patch removes the use of IRQF_NO_SUSPEND flags and uses newly introduce PM wakeup APIs dev_pm_{set,clear}_wake_irq. Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com> Cc: rtc-linux@googlegroups.com Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2015-10-28spi: Drop owner assignment from spi_driversAndrew F. Davis
An spi_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Andrew F. Davis <afd@ti.com> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-05rtc: ds1343: clean up ds1343_nvram_read()/ds1343_nvram_write()Vladimir Zapolskiy
The change removes redundant sysfs binary file boundary checks, since this task is already done on caller side in fs/sysfs/file.c Signed-off-by: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2014-08-08drivers/rtc/rtc-ds1343.c: add support of nvram for maxim dallas rtc ds1343Raghavendra Ganiga
This is a patch to add support of nvram for maxim dallas rtc ds1343. Signed-off-by: Raghavendra Chandra Ganiga <ravi23ganiga@gmail.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-06-06drivers/rtc/rtc-ds1343.c: fix potential race conditionRaghavendra Ganiga
Avoid the potential race condition by avoiding bailing out of driver in probe after registering with rtc subsystem Also the set_alarm , read_alarm and alarm_irq_enable returns error if irq registration fails in probe. Also the sysfs will not create entry for alarm if irq registration fails in probe. Signed-off-by: Raghavendra Chandra Ganiga <ravi23ganiga@gmail.com> Acked-by: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-06-06drivers/rtc: add support for maxim dallas rtc ds1343 and ds1344Raghavendra Ganiga
Signed-off-by: Raghavendra Chandra Ganiga <ravi23ganiga@gmail.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>