Commit graph

3508 commits

Author SHA1 Message Date
Geert Uytterhoeven 34719de919 rtc: i2c/spi: Avoid inclusion of REGMAP support when not needed
Merely enabling I2C and RTC selects REGMAP_I2C and REGMAP_SPI, even when
no driver needs it.  While the former can be moduler, the latter cannot,
and thus becomes built-in.

Fix this by moving the select statements for REGMAP_I2C and REGMAP_SPI
from the RTC_I2C_AND_SPI helper to the individual drivers that depend on
it.

Note that the comment for RTC_I2C_AND_SPI refers to SND_SOC_I2C_AND_SPI
for more information, but the latter does not select REGMAP_{I2C,SPI}
itself, and defers that to the individual drivers, too.

Fixes: 080481f54e ("rtc: merge ds3232 and ds3234")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: kbuild test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20200112171349.22268-1-geert@linux-m68k.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-01-27 23:36:35 +01:00
Alexandre Belloni 578c2b661e rtc: Kconfig: select REGMAP_I2C when necessary
Some i2c RTC drivers are using regmap but are not selecting REGMAP_I2C
which may lead to build failures.

Link: https://lore.kernel.org/r/20200127221724.10160-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-01-27 23:36:19 +01:00
Alexandre Belloni c682094107 rtc: Kconfig: properly indent sd3078 entry
The RTC_DRV_SD3078 is indented using spaces, use tabs instead.

Link: https://lore.kernel.org/r/20200127221724.10160-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-01-27 23:36:17 +01:00
Andy Shevchenko 604c521259 rtc: cmos: Refactor code by using the new dmi_get_bios_year() helper
Refactor code by using the new dmi_get_bios_year() helper instead of
open coding its functionality. This also makes logic slightly clearer.

No changes intended.

Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Guilherme G. Piccoli <gpiccoli@canonical.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20200123131437.28157-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-01-25 21:55:14 +01:00
Andy Shevchenko 5848ad2f1b rtc: cmos: Use predefined value for RTC IRQ on legacy x86
When legacy devices are present on x86 machine, the RTC IRQ has
a dedicated pre-defined value. Use it instead of hard coded number.

Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Guilherme G. Piccoli <gpiccoli@canonical.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20200123131437.28157-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-01-25 21:55:12 +01:00
Andy Shevchenko b6da197a2e rtc: cmos: Stop using shared IRQ
As reported by Guilherme G. Piccoli:

---8<---8<---8<---

The rtc-cmos interrupt setting was changed in the commit 079062b28f
("rtc: cmos: prevent kernel warning on IRQ flags mismatch") in order
to allow shared interrupts; according to that commit's description,
some machine got kernel warnings due to the interrupt line being shared
between rtc-cmos and other hardware, and rtc-cmos didn't allow IRQ sharing
that time.

After the aforementioned commit though it was observed a huge increase
in lost HPET interrupts in some systems, observed through the following
kernel message:

[...] hpet1: lost 35 rtc interrupts

After investigation, it was narrowed down to the shared interrupts
usage when having the kernel option "irqpoll" enabled. In this case,
all IRQ handlers are called for non-timer interrupts, if such handlers
are setup in shared IRQ lines. The rtc-cmos IRQ handler could be set to
hpet_rtc_interrupt(), which will produce the kernel "lost interrupts"
message after doing work - lots of readl/writel to HPET registers, which
are known to be slow.

Although "irqpoll" is not a default kernel option, it's used in some contexts,
one being the kdump kernel (which is an already "impaired" kernel usually
running with 1 CPU available), so the performance burden could be considerable.
Also, the same issue would happen (in a shorter extent though) when using
"irqfixup" kernel option.

In a quick experiment, a virtual machine with uptime of 2 minutes produced
>300 calls to hpet_rtc_interrupt() when "irqpoll" was set, whereas without
sharing interrupts this number reduced to 1 interrupt. Machines with more
hardware than a VM should generate even more unnecessary HPET interrupts
in this scenario.

---8<---8<---8<---

After looking into the rtc-cmos driver history and DSDT table from
the Microsoft Surface 3, we may notice that Hans de Goede submitted
a correct fix (see dependency below). Thus, we simply revert
the culprit commit.

Fixes: 079062b28f ("rtc: cmos: prevent kernel warning on IRQ flags mismatch")
Depends-on: a1e23a42f1 ("rtc: cmos: Do not assume irq 8 for rtc when there are no legacy irqs")
Reported-by: Guilherme G. Piccoli <gpiccoli@canonical.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Guilherme G. Piccoli <gpiccoli@canonical.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20200123131437.28157-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-01-25 21:54:57 +01:00
Dmitry Osipenko 4c4ab451ae rtc: tps6586x: Use IRQ_NOAUTOEN flag
The IRQ_NOAUTOEN flag tells interrupt core that interrupt shall not be
auto-enabled at the time of requesting interrupt. This is a minor clean-up
change that doesn't fix any problems.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20200106015615.12602-1-digetx@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-01-25 21:50:18 +01:00
Alexandre Belloni 3c7b90cb14 rtc: at91rm9200: use FIELD_PREP/FIELD_GET
Use FIELD_PREP and FIELD_GET instead of hardcoding already defined values.

Link: https://lore.kernel.org/r/20191229204421.337612-6-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-01-15 15:11:10 +01:00
Alexandre Belloni 565205d5ad rtc: at91rm9200: avoid time readout in at91_rtc_setalarm
The current rtc time is read out in at91_rtc_setalarm but it it immediately
overwritten by the alarm time. Remove the readout.

Link: https://lore.kernel.org/r/20191229204421.337612-5-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-01-15 15:11:08 +01:00
Alexandre Belloni a1243b099e rtc: at91rm9200: move register definitions to C file
The header was simply moved from the arm mach folder to drivers/rtc but
there is not point in having it separated from the driver.

Also remove unused bit definitions and use BIT and GENMASK.

Link: https://lore.kernel.org/r/20191229204421.337612-4-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-01-15 15:11:07 +01:00
Alexandre Belloni ca3fdc989c rtc: at91rm9200: add sama5d4 and sama5d2 compatibles
Both the sama5d4 and sama5d2 RTCs have more features than the previous
RTCs, add a compatible string for them.

Link: https://lore.kernel.org/r/20191229204421.337612-3-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-01-15 12:13:54 +01:00
Alexandre Belloni b7052876d7 rtc: at91rm9200: remove procfs information
The RTC procfs interface is deprecated and hasn't been used by userspace
for years.

Link: https://lore.kernel.org/r/20191229204421.337612-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-01-15 12:10:05 +01:00
Nobuhiro Iwamatsu d53f9b68b3 rtc: pcf8563: Use BIT
Replace (1 << ...) with BIT().

CC: Alessandro Zummo <a.zummo@towertech.it>
CC: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Link: https://lore.kernel.org/r/20191218082553.3309554-1-iwamatsu@nigauri.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-23 11:23:53 +01:00
Nobuhiro Iwamatsu 7dc679ef25 rtc: moxart: Convert to SPDX identifier
Use SPDX-License-Identifier instead of a verbose license text.

CC: Alessandro Zummo <a.zummo@towertech.it>
CC: Alexandre Belloni <alexandre.belloni@bootlin.com>
CC: Jonas Jensen <jonas.jensen@gmail.com>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Link: https://lore.kernel.org/r/20191218082836.3309808-1-iwamatsu@nigauri.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-23 11:23:49 +01:00
Nobuhiro Iwamatsu d6e62e7f10 rtc: ds1343: Remove unused struct spi_device in struct ds1343_priv
struct spi_device in struct ds1343_priv is not used, remove it.

CC: Alessandro Zummo <a.zummo@towertech.it>
CC: Alexandre Belloni <alexandre.belloni@bootlin.com>
CC: Raghavendra Chandra Ganiga <ravi23ganiga@gmail.com>
CC: Ankur Srivastava <sankurece@gmail.com>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Link: https://lore.kernel.org/r/20191218081917.3308211-1-iwamatsu@nigauri.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-23 11:22:32 +01:00
Nobuhiro Iwamatsu 47a3c04837 rtc: rx8025: Remove struct i2c_client from struct rx8025_data
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-12-23 11:22:21 +01:00
Paul Kocialkowski e2ed7507ae rtc: hym8563: Read the valid flag directly instead of caching it
The RTC has a valid bit in the seconds register that indicates whether
power was lost since the pevious time set. This bit is currently read
once at probe time, cached and updated with set_time.

Howeever, caching the bit may prevent detecting power loss at runtime
(which can happen if the RTC's supply is distinct from the the platform's).

Writing the seconds register when setting time will clear the bit,
so there should be no downside in reading the bit directly instead of
caching it.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Link: https://lore.kernel.org/r/20191212153111.966923-2-paul.kocialkowski@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-23 11:18:06 +01:00
Paul Kocialkowski f236a2a2eb rtc: hym8563: Return -EINVAL if the time is known to be invalid
The current code returns -EPERM when the voltage loss bit is set.
Since the bit indicates that the time value is not valid, return
-EINVAL instead, which is the appropriate error code for this
situation.

Fixes: dcaf038493 ("rtc: add hym8563 rtc-driver")
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Link: https://lore.kernel.org/r/20191212153111.966923-1-paul.kocialkowski@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-23 11:18:04 +01:00
Nobuhiro Iwamatsu aeedfe7f89 rtc: rx8010: Fix return code for rx8010_probe
In the current code, the return value of devm_request_threaded_irq may be
returned. This fixes it.

CC: Alessandro Zummo <a.zummo@towertech.it>
CC: Alexandre Belloni <alexandre.belloni@bootlin.com>
CC: Akshay Bhat <akshay.bhat@timesys.com>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Link: https://lore.kernel.org/r/20191217121231.2698817-2-iwamatsu@nigauri.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-23 11:16:23 +01:00
zhengbin de0505660f rtc: omap: Remove unneeded semicolon
Fixes coccicheck warning:

drivers/rtc/rtc-omap.c:619:2-3: Unneeded semicolon

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Link: https://lore.kernel.org/r/1576466353-45384-1-git-send-email-zhengbin13@huawei.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-23 11:16:23 +01:00
Chuhong Yuan 62cbe63f58 rtc: asm9260: add the missed check for devm_clk_get
The driver misses a check for devm_clk_get().
Add the check to fix it.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Link: https://lore.kernel.org/r/20191214074528.16806-1-hslester96@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-23 11:16:23 +01:00
Alexandre Belloni bd0d937928 rtc: rv3029: remove useless error messages
Remove redundant messages or messages that would not add any value because
the information is already conveyed properly using errno.

Link: https://lore.kernel.org/r/20191223100108.1083078-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-23 11:16:23 +01:00
Alexandre Belloni fc219291ea rtc: rv3029: annotate init and exit functions
rv30{2,4}9_register_driver and rv30{2,4}9_unregister_driver are only called
from the init and exit functions of the module. Annotate them properly.

Link: https://lore.kernel.org/r/20191223101430.1091572-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-23 11:16:23 +01:00
Alexandre Belloni 8e99106c92 rtc: rv3029: drop deprecated compatbiles
The compatibles have been marked obsolete for more that 2 years, drop them
now. Note that this doesn't currently prevent the driver from probing
because the i2c core will still match using the i2c_device_id table.

Link: https://lore.kernel.org/r/20191212230239.65784-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-23 11:13:50 +01:00
Alexandre Belloni ec923fcccf rtc: rv3029: add nvram support
Export the 8 byte RAM using nvmem.

Link: https://lore.kernel.org/r/20191214221022.622482-17-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-23 11:13:49 +01:00
Alexandre Belloni cbc943eb37 rtc: rv3029: let the core handle rtc range
Despite the comment, the RV3029 uses a 7bit BCD register for the year,
making 2079 the last supported year.

Link: https://lore.kernel.org/r/20191214221022.622482-14-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:38:07 +01:00
Alexandre Belloni 9346f87066 rtc: rv3029: convert to devm_rtc_allocate_device
This allows further improvement of the driver.

Link: https://lore.kernel.org/r/20191214221022.622482-13-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:38:06 +01:00
Alexandre Belloni cff2e4d278 rtc: rv3029: correctly handle PON and VLOW2
In case the data is invalid (PON or VLOW2 are set in STATUS, explicitly
tell userspace that the time is invalid. Only remove VLOW2 when setting a
new valid time.

Link: https://lore.kernel.org/r/20191214221022.622482-12-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:38:04 +01:00
Alexandre Belloni f630f728a9 rtc: rv3029: add RTC_VL_READ and RTC_VL_CLEAR support
The RV3029 can report three different conditions: power on, voltage dropped
and data is lost and voltage is low and temperature compensation has
stopped. The first two conditions amount to the same status, the RTC data
is invalid.

VLOW1 has to be cleared manually to resume temperature compensation, this
is achieved using RTC_VL_CLEAR.

Link: https://lore.kernel.org/r/20191214221022.622482-11-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:38:02 +01:00
Alexandre Belloni 7518dd9a93 rtc: rv3029: drop rv3029_read_regs and rv3029_write_regs
rv3029_read_regs and rv3029_write_regs are simply calling
regmap_bulk_{read,write}. Drop them and call regmap_{,bulk}_{read,write} as
appropriate.

Link: https://lore.kernel.org/r/20191214221022.622482-10-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:38:01 +01:00
Alexandre Belloni 8fd3d609a5 rtc: rv3029: simplify rv3029_set_alarm
It is unecessay to test alarm->enabled before calling
rv3029_alarm_irq_enable.

Link: https://lore.kernel.org/r/20191214221022.622482-9-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:37:59 +01:00
Alexandre Belloni 38ce8e30f3 rtc: rv3029: simplify rv3029_alarm_irq_enable
Use regmap_update_bits instead of open coding it in
rv3029_alarm_irq_enable.

Link: https://lore.kernel.org/r/20191214221022.622482-8-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:37:57 +01:00
Alexandre Belloni bb72dbba83 rtc: rv3029: get rid of rv3029_get_sr
There is no point in having 2 indirections before calling regmap_read,
especially since rv3029_get_sr also changes the return value without any
good reason. Call regmap_read directly.

Link: https://lore.kernel.org/r/20191214221022.622482-7-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:37:56 +01:00
Alexandre Belloni 35c2daaf55 rtc: rv3029: avoid reading the status register uselessly
RV3029_STATUS is read in multiple location but its value is never used
afterwards. Avoid this register access when not necessary.

Link: https://lore.kernel.org/r/20191214221022.622482-6-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:37:54 +01:00
Alexandre Belloni 54c5970df4 rtc: rv3029: remove race condition when update STATUS
There is no lock preventing concurrent access to the status register from
bth the rtc subsystem and the hwmon subsystem. Use regmap_update_bits to
ensure updating RV3029_STATUS is properly locked.

Link: https://lore.kernel.org/r/20191214221022.622482-5-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:37:52 +01:00
Alexandre Belloni 609e97fe31 rtc: rv3029: remove open coded regmap_update_bits
rv3029_update_bits open codes regmap_update_bits and forgets to properly
lock the register range while doing so. Use regmap_update_bits instead.

Link: https://lore.kernel.org/r/20191214221022.622482-4-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:37:51 +01:00
Alexandre Belloni c509e4344b rtc: rv3029: let regmap validate the register ranges
Instead of trying to validate the accessed registers in custom functions,
let regmap handle that. This allows to defines all the holes in the
register range and gives access to the regmap debugfs register dump.

Link: https://lore.kernel.org/r/20191214221022.622482-3-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:37:49 +01:00
Alexandre Belloni 9b45ef9774 rtc: rv3029: use proper name for the driver
The correct name for the rtc is rv3029. c2 is actually the package form
factor rv3029c3 exists and simply has a smaller form factor.

Link: https://lore.kernel.org/r/20191214221022.622482-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:37:47 +01:00
Alexandre Belloni 8049c11399 rtc: rx8010: return meaningful value for RTC_VL_READ
RX8010_FLAG_VLF means the voltage dropped too low and data has been lost.

Link: https://lore.kernel.org/r/20191214220259.621996-18-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:37:45 +01:00
Alexandre Belloni 894b043200 rtc: rx8010: remove RTC_VL_CLR handling
Remove RTC_VL_CLR handling because it is a disservice to userspace as it
removes the important information that the RTC data is invalid. This may
lead userspace to set an invalid system time later on.

Link: https://lore.kernel.org/r/20191214220259.621996-17-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:37:44 +01:00
Alexandre Belloni bcd17c5082 rtc: rv8803: return meaningful value for RTC_VL_READ
RV8803_FLAG_V1F means the voltage is too low to keep the temperature
compensation running and the accuracy of the RTC is affected.

RV8803_FLAG_V2F means the voltage dropped so low that data is now invalid.

Link: https://lore.kernel.org/r/20191214220259.621996-16-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:37:42 +01:00
Alexandre Belloni 7e890a0f0e rtc: rv8803: avoid clearing RV8803_FLAG_V2F in RTC_VL_CLR
Stop clearing RV8803_FLAG_V2F in RTC_VL_CLR because it is a disservice to
userspace as it removes the important information that the RTC data is
invalid. This may lead userspace to set an invalid system time later on.

Link: https://lore.kernel.org/r/20191214220259.621996-15-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:37:40 +01:00
Alexandre Belloni 86e655f9f3 rtc: rv3028: return meaningful value for RTC_VL_READ
RV3028_STATUS_PORF means the voltage dropped too low and data has been
lost.

Link: https://lore.kernel.org/r/20191214220259.621996-14-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:37:39 +01:00
Alexandre Belloni 92c02daaba rtc: rv3028: remove RTC_VL_CLR handling
Remove RTC_VL_CLR handling because it is a disservice to userspace as it
removes the important information that the RTC data is invalid. This may
lead userspace to set an invalid system time later on.

Link: https://lore.kernel.org/r/20191214220259.621996-13-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:37:37 +01:00
Alexandre Belloni f86dc5bde1 rtc: pcf85063: return meaningful value for RTC_VL_READ
PCF85063_REG_SC_OS means the voltage dropped too low and data has been
lost.

Link: https://lore.kernel.org/r/20191214220259.621996-12-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:37:35 +01:00
Alexandre Belloni 0295c27f90 rtc: pcf85063: remove RTC_VL_CLR handling
Remove RTC_VL_CLR handling because it is a disservice to userspace as it
removes the important information that the RTC data is invalid. This may
lead userspace to set an invalid system time later on.

Link: https://lore.kernel.org/r/20191214220259.621996-11-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:37:33 +01:00
Alexandre Belloni b371b10e94 rtc: pcf8563: return meaningful value for RTC_VL_READ
PCF8563_SC_LV means the voltage dropped too low and data has been lost.

Link: https://lore.kernel.org/r/20191214220259.621996-10-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:37:32 +01:00
Alexandre Belloni 935272aade rtc: pcf8563: stop caching voltage_low
voltage_low is only updated when reading the time, this means that using
RTC_VL_READ will miss the VL flag if the time has not been read before
using the ioctl. Always read the status from the hardware.

Link: https://lore.kernel.org/r/20191214220259.621996-9-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:37:30 +01:00
Alexandre Belloni 75d26f5c23 rtc: pcf8563: remove conditional compilation
Always compile pcf8563_rtc_ioctl as we are sure that CONFIG_RTC_INTF_DEV is
selected on actual kernel configurations.

Link: https://lore.kernel.org/r/20191214220259.621996-8-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:37:28 +01:00
Alexandre Belloni d268f4bd42 rtc: pcf8563: remove RTC_VL_CLR handling
Remove RTC_VL_CLR handling because it is a disservice to userspace as it
removes the important information that the RTC data is invalid. This may
lead userspace to set an invalid system time later on.

Link: https://lore.kernel.org/r/20191214220259.621996-7-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-18 10:37:27 +01:00