aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc (follow)
AgeCommit message (Collapse)AuthorFilesLines
2020-02-04Merge tag 'tag-chrome-platform-for-v5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linuxLinus Torvalds1-1/+0
Pull chrome platform updates from Benson Leung: "CrOS EC: - Refactoring of some of cros_ec's headers: include/linux/mfd/cros_ec.h now removed, new cros_ec.h added to drivers/platform/chrome which contains shared operations of cros_ec transport drivers. - Response tracing in cros_ec_proto Wilco EC: - Fix unregistration order. - Fix keyboard backlight probing on systems without keyboard backlight - Minor cleanup (newlines in printks, COMPILE_TEST) Misc: - chromeos_laptop converted to use i2c_new_scanned_device instead of i2c_new_probed_device" * tag 'tag-chrome-platform-for-v5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux: platform/chrome: cros_ec: Match implementation with headers platform/chrome: cros_ec: Drop unaligned.h include platform/chrome: wilco_ec: Allow wilco to be compiled in COMPILE_TEST platform/chrome: wilco_ec: Add newlines to printks platform/chrome: wilco_ec: Fix unregistration order cros_ec: treewide: Remove 'include/linux/mfd/cros_ec.h' platform/chrome: cros_ec_ishtp: Make init_lock static platform/chrome: chromeos_laptop: Convert to i2c_new_scanned_device platform/chrome: cros_ec_lpc: Use platform_get_irq_optional() for optional IRQs platform/chrome: cros_ec_proto: Add response tracing platform/chrome: cros_ec_trace: Match trace commands with EC commands
2020-02-04Merge tag 'rtc-5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linuxLinus Torvalds23-540/+350
Pull RTC updates from Alexandre Belloni: "The VL_READ and VL_CLR ioctls have been reworked to be more useful. This will not break userspace as there are very few users and they are using the integer value as a boolean. Apart from that, two drivers were reworked and a few fixes here and there for a net reduction of number of lines. Summary: Subsystem: - the VL_READ and VL_CLR ioctls are now documented and their behavior is unified across all the drivers. - RTC_I2C_AND_SPI Kconfig option rework to avoid selecting both REGMAP_I2C and REGMAP_SPI unecessarily. Drivers: - at91rm9200: remove deprecated procfs, add sam9x60, sama5d4 and sama5d2 compatibles. - cmos: solve lost interrupts issue on MS Surface 3 - hym8563: return proper errno when time is invalid - rv3029: many fixes, nvram support" * tag 'rtc-5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (63 commits) dt-bindings: rtc: at91rm9200: document clocks property rtc: i2c/spi: Avoid inclusion of REGMAP support when not needed rtc: Kconfig: select REGMAP_I2C when necessary rtc: Kconfig: properly indent sd3078 entry rtc: cmos: Refactor code by using the new dmi_get_bios_year() helper rtc: cmos: Use predefined value for RTC IRQ on legacy x86 rtc: cmos: Stop using shared IRQ rtc: tps6586x: Use IRQ_NOAUTOEN flag rtc: at91rm9200: use FIELD_PREP/FIELD_GET rtc: at91rm9200: avoid time readout in at91_rtc_setalarm rtc: at91rm9200: move register definitions to C file rtc: at91rm9200: add sama5d4 and sama5d2 compatibles dt-bindings: rtc: at91rm9200: convert bindings to json-schema rtc: at91rm9200: remove procfs information dt-bindings: atmel, at91rm9200-rtc: add microchip, sam9x60-rtc rtc: pcf8563: Use BIT rtc: moxart: Convert to SPDX identifier rtc: ds1343: Remove unused struct spi_device in struct ds1343_priv rtc: rx8025: Remove struct i2c_client from struct rx8025_data rtc: hym8563: Read the valid flag directly instead of caching it ...
2020-02-03Merge tag 'mfd-next-5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfdLinus Torvalds2-42/+181
Pull MFD updates from Lee Jones: "New Drivers: - Add support for ROHM BD71828 PMICs and GPIOs - Add support for Qualcomm Aqstic Audio Codecs WCD9340 and WCD9341 New Device Support: - Add support for BD71828 to BD70528 RTC driver - Add support for Intel's Jasper Lake to LPSS PCI New Functionality: - Add support for Power Key to ROHM BD71828 - Add support for Clocks to ROHM BD71828 - Add support for GPIOs to Dialog DA9062 - Add support for USB PD Notify to ChromiumOS EC - Allow callers to specify args when requesting regmap lookup; syscon Fix-ups: - Improve error handling and sanity checking; atmel-hlcdc, dln2 - Device Tree support/documentation; bd71828, da9062, xylon,logicvc, ab8500, max14577, atmel-usart - Match devices using platform IDs; bd7xxxx - Refactor BD718x7 regulator component; bd718x7-regulator - Use standard interfaces/helpers; syscon, sm501 - Trivial (whitespace, spelling, etc); ab8500-core, Kconfig - Remove unused code; db8500-prcmu, tqmx86 - Wait until boot has finished before accessing registers; madera-core - Provide missing register value defaults; cs47l15-tables - Allow more time for hardware to reset; madera-core Bug Fixes: - Fix erroneous register values; rohm-bd70528 - Fix register volatility; axp20x, rn5t618 - Fix Kconfig dependencies; MFD_MAX77650 - Fix incorrect compatible string; da9062-core - Fix syscon_regmap_lookup_by_phandle_args() stub; syscon" * tag 'mfd-next-5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (41 commits) mfd: syscon: Fix syscon_regmap_lookup_by_phandle_args() dummy mfd: wcd934x: Add support to wcd9340/wcd9341 codec mfd: syscon: Add arguments support for syscon reference mfd: rn5t618: Mark ADC control register volatile dt-bindings: atmel-usart: Add microchip,sam9x60-{usart, dbgu} dt-bindings: atmel-usart: Remove wildcard mfd: cros_ec: Add cros-usbpd-notify subdevice mfd: da9062: Fix watchdog compatible string mfd: madera: Allow more time for hardware reset mfd: cs47l15: Add missing register default mfd: madera: Wait for boot done before accessing any other registers mfd: Kconfig: Rename Samsung to lowercase mfd: tqmx86: remove set but not used variable 'i2c_ien' mfd: dbx500-prcmu: Drop DSI pll clock functions mfd: dbx500-prcmu: Drop set_display_clocks() mfd: max77650: Select REGMAP_IRQ in Kconfig mfd: axp20x: Mark AXP20X_VBUS_IPSOUT_MGMT as volatile mfd: ab8500: Fix ab8500-clk typo mfd: intel-lpss: Add Intel Jasper Lake PCI IDs dt-bindings: mfd: max14577: Add reference to max14040_battery.txt descriptions ...
2020-01-31Merge tag 'mips_5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linuxLinus Torvalds1-0/+11
Pull MIPS changes from Paul Burton: "Nothing too big or scary in here: - Support mremap() for the VDSO, primarily to allow CRIU to restore the VDSO to its checkpointed location. - Restore the MIPS32 cBPF JIT, after having reverted the enablement of the eBPF JIT for MIPS32 systems in the 5.5 cycle. - Improve cop0 counter synchronization behaviour whilst onlining CPUs by running with interrupts disabled. - Better match FPU behaviour when emulating multiply-accumulate instructions on pre-r6 systems that implement IEEE754-2008 style MACs. - Loongson64 kernels now build using the MIPS64r2 ISA, allowing them to take advantage of instructions introduced by r2. - Support for the Ingenic X1000 SoC & the really nice little CU Neo development board that's using it. - Support for WMAC on GARDENA Smart Gateway devices. - Lots of cleanup & refactoring of SGI IP27 (Origin 2*) support in preparation for introducing IP35 (Origin 3*) support. - Various Kconfig & Makefile cleanups" * tag 'mips_5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: (60 commits) MIPS: PCI: Add detection of IOC3 on IO7, IO8, IO9 and Fuel MIPS: Loongson64: Disable exec hazard MIPS: Loongson64: Bump ISA level to MIPSR2 MIPS: Make DIEI support as a config option MIPS: OCTEON: octeon-irq: fix spelling mistake "to" -> "too" MIPS: asm: local: add barriers for Loongson MIPS: Loongson64: Select mac2008 only feature MIPS: Add MAC2008 Support Revert "MIPS: Add custom serial.h with BASE_BAUD override for generic kernel" MIPS: sort MIPS and MIPS_GENERIC Kconfig selects alphabetically (again) MIPS: make CPU_HAS_LOAD_STORE_LR opt-out MIPS: generic: don't unconditionally select PINCTRL MIPS: don't explicitly select LIBFDT in Kconfig MIPS: sync-r4k: do slave counter synchronization with disabled HW interrupts MIPS: SGI-IP30: Check for valid pointer before using it MIPS: syscalls: fix indentation of the 'SYSNR' message MIPS: boot: fix typo in 'vmlinux.lzma.its' target MIPS: fix indentation of the 'RELOCS' message dt-bindings: Document loongson vendor-prefix MIPS: CU1000-Neo: Refresh defconfig to support HWMON and WiFi. ...
2020-01-27rtc: i2c/spi: Avoid inclusion of REGMAP support when not neededGeert Uytterhoeven1-2/+6
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: 080481f54ef62121 ("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-27rtc: Kconfig: select REGMAP_I2C when necessaryAlexandre Belloni1-0/+4
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-27rtc: Kconfig: properly indent sd3078 entryAlexandre Belloni1-6/+6
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-27Merge tag 'ioremap-5.6' of git://git.infradead.org/users/hch/ioremapLinus Torvalds1-1/+1
Pull ioremap updates from Christoph Hellwig: "Remove the ioremap_nocache API (plus wrappers) that are always identical to ioremap" * tag 'ioremap-5.6' of git://git.infradead.org/users/hch/ioremap: remove ioremap_nocache and devm_ioremap_nocache MIPS: define ioremap_nocache to ioremap
2020-01-25rtc: cmos: Refactor code by using the new dmi_get_bios_year() helperAndy Shevchenko1-4/+4
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-25rtc: cmos: Use predefined value for RTC IRQ on legacy x86Andy Shevchenko1-1/+1
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-25rtc: cmos: Stop using shared IRQAndy Shevchenko1-1/+1
As reported by Guilherme G. Piccoli: ---8<---8<---8<--- The rtc-cmos interrupt setting was changed in the commit 079062b28fb4 ("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: 079062b28fb4 ("rtc: cmos: prevent kernel warning on IRQ flags mismatch") Depends-on: a1e23a42f1bd ("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-25rtc: tps6586x: Use IRQ_NOAUTOEN flagDmitry Osipenko1-1/+3
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-24rtc: bd70528: add BD71828 supportMatti Vaittinen2-42/+181
ROHM BD71828 PMIC RTC block is from many parts similar to one on BD70528. Support BD71828 RTC using BD70528 RTC driver and avoid re-inventing the wheel. Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-01-15rtc: at91rm9200: use FIELD_PREP/FIELD_GETAlexandre Belloni1-20/+22
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-15rtc: at91rm9200: avoid time readout in at91_rtc_setalarmAlexandre Belloni1-14/+6
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-15rtc: at91rm9200: move register definitions to C fileAlexandre Belloni2-72/+45
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-15rtc: at91rm9200: add sama5d4 and sama5d2 compatiblesAlexandre Belloni1-0/+6
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-15rtc: at91rm9200: remove procfs informationAlexandre Belloni1-15/+0
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-09MIPS: SGI-IP27: fix readb/writeb addressingThomas Bogendoerfer1-0/+11
Our chosen byte swapping, which is what firmware already uses, is to do readl/writel by normal lw/sw intructions (data invariance). This also means we need to mangle addresses for u8 and u16 accesses. The mangling for 16bit has been done aready, but 8bit one was missing. Correcting this causes different addresses for accesses to the SuperIO and local bus of the IOC3 chip. This is fixed by changing byte order in ioc3 and m48rtc_rtc structs. Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de> Signed-off-by: Paul Burton <paulburton@kernel.org> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: James Hogan <jhogan@kernel.org> Cc: David S. Miller <davem@davemloft.net> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: linux-mips@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: netdev@vger.kernel.org Cc: linux-rtc@vger.kernel.org
2020-01-07cros_ec: treewide: Remove 'include/linux/mfd/cros_ec.h'Enric Balletbo i Serra1-1/+0
This header file now only includes the cros_ec_dev struct, however, is the 'include/linux/platform_data/cros_ec_proto.h' who contains the definition of all the Chrome OS EC related structs. There is no reason to have a separate include for this struct so move to the place where other structs are defined. That way, we can remove the include itself, but also simplify the common pattern #include <linux/mfd/cros_ec.h> #include <linux/platform_data/cros_ec_proto.h> for a single include #include <linux/platform_data/cros_ec_proto.h> The changes to remove the cros_ec.h include were generated with the following shell script: git grep -l "<linux/mfd/cros_ec.h>" | xargs sed -i '/<linux\/mfd\/cros_ec.h>/d' Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Acked-by: Lee Jones <lee.jones@linaro.org> Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Acked-by: Sebastian Reichel <sre@kernel.org> Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2020-01-06remove ioremap_nocache and devm_ioremap_nocacheChristoph Hellwig1-1/+1
ioremap has provided non-cached semantics by default since the Linux 2.6 days, so remove the additional ioremap_nocache interface. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Arnd Bergmann <arnd@arndb.de>
2020-01-04rtc: cmos: Revert "rtc: Fix the AltCentury value on AMD/Hygon platform"Alexandre Belloni1-14/+1
There are multiple reports of this patch breaking RTC time setting for AMD platforms. This reverts commit 7ad295d5196a58c22abecef62dd4f99e2f86e831. Cc: Jinke Fan <fanjinke@hygon.cn> Link: https://lore.kernel.org/r/CABXGCsMLob0DC25JS8wwAYydnDoHBSoMh2_YLPfqm3TTvDE-Zw@mail.gmail.com Fixes: 7ad295d5196a ("rtc: Fix the AltCentury value on AMD/Hygon platform") Link: https://lore.kernel.org/r/20200104043110.707810-1-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-12-23rtc: pcf8563: Use BITNobuhiro Iwamatsu1-2/+2
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-23rtc: moxart: Convert to SPDX identifierNobuhiro Iwamatsu1-4/+1
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-23rtc: ds1343: Remove unused struct spi_device in struct ds1343_privNobuhiro Iwamatsu1-3/+0
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-23rtc: rx8025: Remove struct i2c_client from struct rx8025_dataNobuhiro Iwamatsu1-13/+14
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-23rtc: hym8563: Read the valid flag directly instead of caching itPaul Kocialkowski1-12/+7
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-23rtc: hym8563: Return -EINVAL if the time is known to be invalidPaul Kocialkowski1-1/+1
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: dcaf03849352 ("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-23rtc: rx8010: Fix return code for rx8010_probeNobuhiro Iwamatsu1-1/+1
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-23rtc: omap: Remove unneeded semicolonzhengbin1-1/+1
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-23rtc: asm9260: add the missed check for devm_clk_getChuhong Yuan1-0/+3
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-23rtc: rv3029: remove useless error messagesAlexandre Belloni1-26/+9
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-23rtc: rv3029: annotate init and exit functionsAlexandre Belloni1-6/+6
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-23rtc: rv3029: drop deprecated compatbilesAlexandre Belloni1-4/+0
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-23rtc: rv3029: add nvram supportAlexandre Belloni1-5/+31
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-18rtc: rv3029: let the core handle rtc rangeAlexandre Belloni1-16/+2
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-18rtc: rv3029: convert to devm_rtc_allocate_deviceAlexandre Belloni1-6/+5
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-18rtc: rv3029: correctly handle PON and VLOW2Alexandre Belloni1-6/+15
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-18rtc: rv3029: add RTC_VL_READ and RTC_VL_CLEAR supportAlexandre Belloni1-0/+30
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-18rtc: rv3029: drop rv3029_read_regs and rv3029_write_regsAlexandre Belloni1-58/+46
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-18rtc: rv3029: simplify rv3029_set_alarmAlexandre Belloni1-13/+1
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-18rtc: rv3029: simplify rv3029_alarm_irq_enableAlexandre Belloni1-21/+4
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-18rtc: rv3029: get rid of rv3029_get_srAlexandre Belloni1-19/+10
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-18rtc: rv3029: avoid reading the status register uselesslyAlexandre Belloni1-26/+0
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-18rtc: rv3029: remove race condition when update STATUSAlexandre Belloni1-28/+6
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-18rtc: rv3029: remove open coded regmap_update_bitsAlexandre Belloni1-20/+6
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-18rtc: rv3029: let regmap validate the register rangesAlexandre Belloni1-17/+22
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-18rtc: rv3029: use proper name for the driverAlexandre Belloni1-1/+1
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-18rtc: rx8010: return meaningful value for RTC_VL_READAlexandre Belloni1-5/+2
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-18rtc: rx8010: remove RTC_VL_CLR handlingAlexandre Belloni1-15/+1
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>