There are only a few differences between PCF2127 and PCF2129 (PCF2127
has 512 bytes of general purpose SRAM and count-down timer).
The rtc-pcf2127 driver currently doesn't use the PCF2127 specific
functionality and Kconfig help text already says this driver supports
PCF2127/29, so we can simply add pcf2129 to device id list.
Signed-off-by: Akinobu Mita <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Cc: Alexandre Belloni <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
pcf2127 has selectable I2C-bus and SPI-bus interface support.
Currently rtc-pcf2127 driver only supports I2C.
This is preparation for support for SPI interface.
Signed-off-by: Akinobu Mita <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Cc: Alexandre Belloni <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
This adds support to
- enable/disable the thermometer
- set the temperature scanning interval
- read the current temperature that is used for temp compensation.
via hwmon interface
Signed-off-by: Michael Buesch <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
This simplifies the update of single bits in the eeprom.
Signed-off-by: Michael Buesch <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
objtool reports the following warnings:
drivers/rtc/rtc-ds1685.o: warning: objtool: ds1685_rtc_work_queue()+0x0: duplicate frame pointer save
drivers/rtc/rtc-ds1685.o: warning: objtool: ds1685_rtc_work_queue()+0x3: duplicate frame pointer setup
drivers/rtc/rtc-ds1685.o: warning: objtool: ds1685_rtc_work_queue()+0x0: frame pointer state mismatch
The warning message needs to be improved, but what it really means in
this case is that ds1685_rtc_poweroff() has a possible code path where
it can actually fall through to the next function in the object code,
ds1685_rtc_work_queue().
The bug is caused by the use of the unreachable() macro in a place which
is actually reachable. That causes gcc to assume that the printk()
immediately before the unreachable() macro never returns, when in fact
it does. So gcc places the printk() at the very end of the function's
object code. When the printk() returns, the next function starts
executing.
The surrounding comment and printk message state that the code should
spin forever, which explains the unreachable() statement. However the
actual spin code is missing.
Reported-by: kbuild test robot <[email protected]>
Signed-off-by: Josh Poimboeuf <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
Year field must be in BCD format, according to
hym8563 datasheet.
Due to the bug year 2016 became 2010.
Fixes: dcaf038493 ("rtc: add hym8563 rtc-driver")
Signed-off-by: Alexander Kochetkov <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
ds3232->mutex is used to protect for alarm operations which
need to access status and control registers.
But we can use rtc->ops_lock instead. rtc->ops_lock is held when most
of rtc_class_ops methods are called, so we only need to explicitly
acquire it from irq handler in order to protect form concurrent
accesses.
Signed-off-by: Akinobu Mita <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
ds3232-core requests irq with IRQF_SHARED, so irq can be shared by
several devices. But the irq handler for ds3232 unconditionally
disables the irq at first and the irq is re-enabled only when the
interrupt source was the ds3232's alarm. This behaviour breaks the
devices sharing the same irq in the various scenarios.
This converts to use threaded irq and remove outdated code in
suspend/resume paths.
Signed-off-by: Akinobu Mita <[email protected]>
Suggested-by: Alexandre Belloni <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
UIE mode irqs are handled by the generic rtc core now. But there are
remaining unused code fragments for it.
Signed-off-by: Akinobu Mita <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
The rtctest (tools/testing/selftests/timers/rtctest.c) found that
reading ds3232 rtc device immediately return the value 0x20 (RTC_AF)
without waiting alarm interrupt.
This is because alarm_irq_enable() of ds3232 driver changes RTC_AF
flag in rtc->irq_data. So calling ioctl with RTC_AIE_ON generates
invalid value in rtc device.
The lower-level driver should not touch rtc->irq_data directly.
Signed-off-by: Akinobu Mita <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
According to "Feature Comparison of the DS323x Real-Time Clocks"
(http://pdfserv.maximintegrated.com/en/an/AN5143.pdf), DS3232 and
DS3234 are very similar.
This merges rtc-ds3232 and rtc-ds3234 with using regmap.
This change also enables to support alarm for ds3234.
Signed-off-by: Akinobu Mita <[email protected]>
Suggested-by: Alexandre Belloni <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
The trickle charger resistor can be enabled via device tree
property trickle-resistor-ohms.
Signed-off-by: Michael Buesch <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
This adds functions for access to the EEPROM memory on the rv3029.
Signed-off-by: Michael Buesch <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
This adds all (according to the data sheet) missing register and bit
definitions.
It also fixes the definition of the trickle charger bit masks.
Signed-off-by: Michael Buesch <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
The C2 suffix does not appear in the latest datasheet, so add
a device ID without it.
Signed-off-by: Michael Buesch <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
The C2 suffix does not appear anymore in the latest device and
data sheet versions.
Signed-off-by: Michael Buesch <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
There are several arch-specific RTC drivers that can be successfully
compiled on other platforms. Add a COMPILE_TEST dependency for those.
Signed-off-by: Alexandre Belloni <[email protected]>
Acked-by: Geert Uytterhoeven <[email protected]>
There are four architectures using this driver, but since we can
build it with COMPILE_TEST, we should try dealing with the absence
of the asm/rtc.h header file, to avoid getting a build error:
drivers/rtc/rtc-generic.c:12:21: fatal error: asm/rtc.h: No such file or directory
This creates an alternative use of the driver, allowing architectures
to pass a set of rtc_class_ops in platform data. We can convert the
four architectures to use this and then remove the original
code.
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
The time and date register of the pcf8223 are undefined after a power
reset. Properly handle the OS bit and return -EINVAL when that bit is set.
It is properly removed when setting the time.
This solves an issue where the time and date may be valid for
rtc_valid_tm() but is not the current time.
Signed-off-by: Alexandre Belloni <[email protected]>
No members of struct pcf85063 are used anymore, remove the whole structure.
Reviewed-by: Juergen Borleis <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
We call spin_lock_irqrestore with "flags" set to zero instead of to the
value from spin_lock_irqsave().
Fixes: aaaf5fbf56 ('rtc: add driver for DS1685 family of real time clocks')
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
Use macro REGMAP_IRQ_REG from regmap.h to initialise the
regmap irq table for max77686 to have better coding style
and improve readability.
Signed-off-by: Laxman Dewangan <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
Maxim Semiconductor's PMIC MAX77686 has RTC IP which is
reused in the MAX77620/MAX20024 PMICs.
Add support for these devices in MAX77686 RTC driver. This
device does not have RTC alarm pending status outside of
RTC IP. The RTC IP is having separate I2C address for its
register access.
Signed-off-by: Laxman Dewangan <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
The driver uses the MODULE_ALIAS() macro to export a platform module alias
to allow the module to be autoloaded if the device is registered using the
legacy platform registration mechanism but the driver is always used by OF
only machines so the alias is not needed and should just be removed.
Suggested-by: Arnd Bergmann <[email protected]>
Signed-off-by: Javier Martinez Canillas <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
pcf85063_get_datetime() tries to handle a century bit but that bit is not
documented and the final value is never used anywhere else in the kernel.
Reviewed-by: Juergen Borleis <[email protected]>
Tested-by: Ulrich Ölmann <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
drivers/rtc/rtc-vr41xx.c:229: warning: ‘vr41xx_rtc_alarm_irq_enable’ defined but not used
Apparently the conversion to alarm_irq_enable forgot to wire up the
callback.
Fixes: 16380c153a ("RTC: Convert rtc drivers to use the alarm_irq_enable method")
Signed-off-by: Geert Uytterhoeven <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
as3722 RTC IRQ is nested threaded and wired to the as3722 inerrupt
controller. So, this flag is not required for nested irqs anymore,
since commit 3c646f2c6a ("genirq: Don't suspend nested_thread irqs
over system suspend") was merged.
Cc: Alessandro Zummo <[email protected]>
Cc: Alexandre Belloni <[email protected]>
Cc: Lee Jones <[email protected]>
Cc: Nishanth Menon <[email protected]>
Cc: Laxman Dewangan <[email protected]>
Signed-off-by: Grygorii Strashko <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
tps80031 RTC IRQ is nested threaded and wired to the tps80031
inerrupt controller. So, this flag is not required for nested irqs
anymore, since commit 3c646f2c6a ("genirq: Don't suspend
nested_thread irqs over system suspend") was merged.
Cc: Alessandro Zummo <[email protected]>
Cc: Alexandre Belloni <[email protected]>
Cc: Lee Jones <[email protected]>
Cc: Nishanth Menon <[email protected]>
Signed-off-by: Grygorii Strashko <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
tps6586x RTC IRQ is nested threaded and wired to the tps6586x inerrupt
controller. So, this flag is not required for nested irqs anymore,
since commit 3c646f2c6a ("genirq: Don't suspend nested_thread irqs
over system suspend") was merged.
Cc: Alessandro Zummo <[email protected]>
Cc: Alexandre Belloni <[email protected]>
Cc: Lee Jones <[email protected]>
Cc: Nishanth Menon <[email protected]>
Cc: Laxman Dewangan <[email protected]>
Signed-off-by: Grygorii Strashko <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
Palams RTC IRQ is nested threaded and wired to the Palmas inerrupt
controller. So, this flag is not required for nested irqs anymore,
since commit 3c646f2c6a ("genirq: Don't suspend nested_thread irqs
over system suspend") was merged.
Cc: Alessandro Zummo <[email protected]>
Cc: Alexandre Belloni <[email protected]>
Cc: Tony Lindgren <[email protected]>
Cc: Lee Jones <[email protected]>
Cc: Nishanth Menon <[email protected]>
Signed-off-by: Grygorii Strashko <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
The RTC entries are mostly grouped by vendor. Move the few outliers in
place.
Also, change the one occurrence of 'nxp' to 'NXP' to make all NXP
entries consistent.
Signed-off-by: Soren Brinkmann <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
This driver adds support for the PIC32 real time clock and calendar
peripheral:
- reading and setting time
- alarms provided by dedicated IRQ
Signed-off-by: Joshua Henderson <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
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 <[email protected]>
Cc: Wolfgang Grandegger <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Cc: Alexandre Belloni <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
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 <[email protected]>
Cc: Wolfgang Grandegger <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Cc: Alexandre Belloni <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
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 <[email protected]>
Cc: Wolfgang Grandegger <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Cc: Alexandre Belloni <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
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 <[email protected]>
Cc: Wolfgang Grandegger <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Cc: Alexandre Belloni <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
Few functions were marked inline even though they were relatively large
and sometimes used in multiple places. De-inline them to let the
compiler decide whether optimization makes sense. This fixes inline_hunt
report:
drivers/rtc/rtc-s5m.c: Deinline s5m8767_rtc_set_alarm_reg, save 704 bytes
drivers/rtc/rtc-s5m.c: Deinline s5m8767_wait_for_udr_update, save 192 bytes
Reported-by: Denys Vlasenko <[email protected]>
Cc: Denys Vlasenko <[email protected]>
Signed-off-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Javier Martinez Canillas <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
The Makefile/Kconfig currently controlling compilation of this code is:
obj-$(CONFIG_RTC_CLASS) += rtc-core.o
rtc-core-y := class.o interface.o
drivers/rtc/Kconfig:menuconfig RTC_CLASS
drivers/rtc/Kconfig: bool "Real Time Clock"
...meaning that it currently is not being built as a module by anyone.
Lets remove the modular code that is essentially orphaned, so that
when reading the code there is no doubt it is builtin-only.
We don't replace module.h with init.h since the file does need
to know what a struct module is.
We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.
Signed-off-by: Paul Gortmaker <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
When setting a new time/date the RTC's clock must be stopped first, in
order to write the time/date registers in an atomic manner.
So, this change stops the clock first and then writes the time/date
registers and the clock control register (to re-enable the clock) in one
turn.
Signed-off-by: Juergen Borleis <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
Check if the RTC signals an invalid time/date (due to a battery power loss
for example). In this case ignore the time/date until it is really set again.
Signed-off-by: Juergen Borleis <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
By using i2c_smbus_read_i2c_block_data() the code is now much simpler.
While at it: when reading the RTC's seconds register, all time/date registers
are frozen until the RTC's year register is read. So it is important to read
all time/date registers in one turn to not lose a second event. Make it more
clear why the read must happen in this way.
Signed-off-by: Juergen Borleis <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>