summaryrefslogtreecommitdiffstats
path: root/drivers/rtc
AgeCommit message (Collapse)Author
2019-01-09rtc: m41t80: Correct alarm month range with RTC readsMaciej W. Rozycki
commit 3cc9ffbb1f51eb4320575a48e4805a8f52e0e26b upstream. Add the missing adjustment of the month range on alarm reads from the RTC, correcting an issue coming from commit 9c6dfed92c3e ("rtc: m41t80: add alarm functionality"). The range is 1-12 for hardware and 0-11 for `struct rtc_time', and is already correctly handled on alarm writes to the RTC. It was correct up until commit 48e9766726eb ("drivers/rtc/rtc-m41t80.c: remove disabled alarm functionality") too, which removed the previous implementation of alarm support. Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org> Fixes: 9c6dfed92c3e ("rtc: m41t80: add alarm functionality") References: 48e9766726eb ("drivers/rtc/rtc-m41t80.c: remove disabled alarm functionality") Cc: stable@vger.kernel.org # 4.7+ Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05iio/hid-sensors: Fix IIO_CHAN_INFO_RAW returning wrong values for signed numbersHans de Goede
commit 0145b50566e7de5637e80ecba96c7f0e6fff1aad upstream. Before this commit sensor_hub_input_attr_get_raw_value() failed to take the signedness of 16 and 8 bit values into account, returning e.g. 65436 instead of -100 for the z-axis reading of an accelerometer. This commit adds a new is_signed parameter to the function and makes all callers pass the appropriate value for this. While at it, this commit also fixes up some neighboring lines where statements were needlessly split over 2 lines to improve readability. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-01rtc: pcf2127: fix a kmemleak caused in pcf2127_i2c_gather_writeXulin Sun
[ Upstream commit 9bde0afb7a906f1dabdba37162551565740b862d ] pcf2127_i2c_gather_write() allocates memory as local variable for i2c_master_send(), after finishing the master transfer, the allocated memory should be freed. The kmemleak is reported: unreferenced object 0xffff80231e7dba80 (size 64): comm "hwclock", pid 27762, jiffies 4296880075 (age 356.944s) hex dump (first 32 bytes): 03 00 12 03 19 02 11 13 00 80 98 18 00 00 ff ff ................ 00 50 00 00 00 00 00 00 02 00 00 00 00 00 00 00 .P.............. backtrace: [<ffff000008221398>] create_object+0xf8/0x278 [<ffff000008a96264>] kmemleak_alloc+0x74/0xa0 [<ffff00000821070c>] __kmalloc+0x1ac/0x348 [<ffff0000087ed1dc>] pcf2127_i2c_gather_write+0x54/0xf8 [<ffff0000085fd9d4>] _regmap_raw_write+0x464/0x850 [<ffff0000085fe3f4>] regmap_bulk_write+0x1a4/0x348 [<ffff0000087ed32c>] pcf2127_rtc_set_time+0xac/0xe8 [<ffff0000087eaad8>] rtc_set_time+0x80/0x138 [<ffff0000087ebfb0>] rtc_dev_ioctl+0x398/0x610 [<ffff00000823f2c0>] do_vfs_ioctl+0xb0/0x848 [<ffff00000823fae4>] SyS_ioctl+0x8c/0xa8 [<ffff000008083ac0>] el0_svc_naked+0x34/0x38 [<ffffffffffffffff>] 0xffffffffffffffff Signed-off-by: Xulin Sun <xulin.sun@windriver.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
2018-12-01rtc: cmos: Do not export alarm rtc_ops when we do not support alarmsHans de Goede
[ Upstream commit fbb974ba693bbfb4e24a62181ef16d4e45febc37 ] When there is no IRQ configured for the RTC, the rtc-cmos code does not support alarms, all alarm rtc_ops fail with -EIO / -EINVAL. The rtc-core expects a rtc driver which does not support rtc alarms to not have alarm ops at all. Otherwise the wakealarm sysfs attr will read as empty rather then returning an error, making it impossible for userspace to find out beforehand if alarms are supported. A system without an IRQ for the RTC before this patch: [root@localhost ~]# cat /sys/class/rtc/rtc0/wakealarm [root@localhost ~]# After this patch: [root@localhost ~]# cat /sys/class/rtc/rtc0/wakealarm cat: /sys/class/rtc/rtc0/wakealarm: No such file or directory [root@localhost ~]# This fixes gnome-session + systemd trying to use suspend-then-hibernate, which causes systemd to abort the suspend when writing the RTC alarm fails. BugLink: https://github.com/systemd/systemd/issues/9988 Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
2018-11-21rtc: hctosys: Add missing range error reportingMaciej W. Rozycki
commit 7ce9a992ffde8ce93d5ae5767362a5c7389ae895 upstream. Fix an issue with the 32-bit range error path in `rtc_hctosys' where no error code is set and consequently the successful preceding call result from `rtc_read_time' is propagated to `rtc_hctosys_ret'. This in turn makes any subsequent call to `hctosys_show' incorrectly report in sysfs that the system time has been set from this RTC while it has not. Set the error to ERANGE then if we can't express the result due to an overflow. Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org> Fixes: b3a5ac42ab18 ("rtc: hctosys: Ensure system time doesn't overflow time_t") Cc: stable@vger.kernel.org # 4.17+ Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-13rtc: cmos: Remove the `use_acpi_alarm' module parameter for !ACPIMaciej W. Rozycki
commit bc51098cdd9573bfdecfd02fc8ed474419d73ea0 upstream. Fix a problem with commit 311ee9c151ad ("rtc: cmos: allow using ACPI for RTC alarm instead of HPET") defining `use_acpi_alarm' module parameter even for non-ACPI platforms, which ignore it. Wrap the definition into #ifdef CONFIG_ACPI and use a static inline wrapper function, hardcoded to return 0 and consequently optimized away for !ACPI, following the existing pattern with HPET handling functions. Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org> Fixes: 311ee9c151ad ("rtc: cmos: allow using ACPI for RTC alarm instead of HPET") Cc: stable@vger.kernel.org # 4.18+ Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-13rtc: cmos: Fix non-ACPI undefined reference to `hpet_rtc_interrupt'Maciej W. Rozycki
commit d197a253855d2d8e507a003880aab35c4e2473db upstream. Fix a commit 311ee9c151ad ("rtc: cmos: allow using ACPI for RTC alarm instead of HPET") `rtc-cmos' regression causing a link error: drivers/rtc/rtc-cmos.o: In function `cmos_platform_probe': rtc-cmos.c:(.init.text+0x33c): undefined reference to `hpet_rtc_interrupt' rtc-cmos.c:(.init.text+0x3f4): undefined reference to `hpet_rtc_interrupt' with non-ACPI platforms using this driver. The cause is the change of the condition guarding the use of `hpet_rtc_interrupt'. Previously it was a call to `is_hpet_enabled'. That function is static inline and has a hardcoded 0 result for non-ACPI platforms, which imply !HPET_EMULATE_RTC. Consequently the compiler optimized the whole block away including the reference to `hpet_rtc_interrupt', which never made it to the link stage. Now the guarding condition is a call to `use_hpet_alarm', which is not static inline and therefore the compiler may not be able to prove that it actually always returns 0 for non-ACPI platforms. Consequently the build breaks with an unsatisfied reference, because `hpet_rtc_interrupt' is nowhere defined at link time. Fix the problem by marking `use_hpet_alarm' inline. As the `inline' keyword serves as an optimization hint rather than a requirement the compiler is still free to choose whether inlining will be beneficial or not for ACPI platforms. Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org> Fixes: 311ee9c151ad ("rtc: cmos: allow using ACPI for RTC alarm instead of HPET") Cc: stable@vger.kernel.org # 4.18+ Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-13rtc: ds1307: fix ds1339 wakealarm supportSoeren Moch
commit 7dceef78f310f5351735060d78a1777c69606016 upstream. Commit 51ed73eb998a1c79a2b0e9bed68f75a8a2c93b9b ("rtc: ds1340: Add support for trickle charger.") breaks ds1339 wakealarm support by limiting accessible registers. Fix this. Fixes: 51ed73eb998a ("rtc: ds1340: Add support for trickle charger.") Cc: stable@vger.kernel.org Signed-off-by: Soeren Moch <smoch@web.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-20Merge tag 'rtc-4.19' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux Pull RTC updates from Alexandre Belloni: "It is now possible to add custom sysfs attributes while avoiding a possible race condition. Unused code has been removed resulting in a nice reduction of the code base. And more drivers have been switched to SPDX by their maintainers. Summary: Subsystem: - new helpers to add custom sysfs attributes - struct rtc_task removal along with rtc_irq_[un]register() - rtc_irq_set_state and rtc_irq_set_freq are not exported anymore Drivers: - armada38x: reset after rtc power loss - ds1307: now supports m41t11 - isl1208: now supports isl1219 and tamper detection - pcf2127: internal SRAM support" * tag 'rtc-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (34 commits) rtc: ds1307: simplify hwmon config rtc: s5m: Add SPDX license identifier rtc: maxim: Add SPDX license identifiers rtc: isl1219: add device tree documentation rtc: isl1208: set ev-evienb bit from device tree rtc: isl1208: Add "evdet" interrupt source for isl1219 rtc: isl1208: add support for isl1219 with tamper detection rtc: sysfs: facilitate attribute add to rtc device rtc: remove struct rtc_task char: rtc: remove task handling rtc: pcf85063: preserve control register value between stop and start rtc: sh: remove unused variable rtc_dev rtc: unexport rtc_irq_set_* rtc: simplify rtc_irq_set_state/rtc_irq_set_freq rtc: remove irq_task and irq_task_lock rtc: remove rtc_irq_register/rtc_irq_unregister rtc: sh: remove dead code rtc: sa1100: don't set PIE frequency rtc: ds1307: support m41t11 variant rtc: ds1307: fix data pointer to m41t0 ...
2018-08-16rtc: ds1307: simplify hwmon configHeiner Kallweit
We don't have to define an extra config symbol, IS_REACHABLE does what we need. And having this config symbol just to save the few bytes of hwmon support on non-DS3231 chips isn't worth it IMO (especially as the symbol is set per default). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-08-14rtc: s5m: Add SPDX license identifierKrzysztof Kozlowski
Replace GPL v2.0+ license statement with SPDX license identifier. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-08-14rtc: maxim: Add SPDX license identifiersKrzysztof Kozlowski
Replace GPL v2.0+ license statements with SPDX license identifiers. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-08-14rtc: isl1208: set ev-evienb bit from device treeDenis Osterland
Add support to disable event in pull-up. Signed-off-by: Denis Osterland <Denis.Osterland@diehl.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-08-14rtc: isl1208: Add "evdet" interrupt source for isl1219Denis Osterland
Add support for "evdet" named interrupt source. The check if i2c client irq matches evdet irq is needed for the case that there is only one interrupt named "evdet". In this case i2c client code handles this like an unnamed interrupt souce and assigns the value. Signed-off-by: Denis Osterland <Denis.Osterland@diehl.com> Reviewed-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-08-14rtc: isl1208: add support for isl1219 with tamper detectionMichael Grzeschik
We add support for the ISL1219 chip that got an integrated tamper detection function. This patch implements the feature by adding an additional timestamp0 file to sysfs device path. This file contains seconds since epoch, if an event occurred, or is empty, if none occurred. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Denis Osterland <Denis.Osterland@diehl.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-08-14rtc: sysfs: facilitate attribute add to rtc deviceDenis Osterland
This patches addresses following problem: rtc_allocate_device devm_device_add_group <-- kernel oops / null pointer, because sysfs entry does not yet exist rtc_register_device rc = devm_device_add_group if (rc) return rc; <-- forbidden to return error code after device register This patch adds rtc_add_group(s) functions. The functions store the sum of attribute groups as device resource. Signed-off-by: Denis Osterland <Denis.Osterland@diehl.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-08-02rtc: remove struct rtc_taskAlexandre Belloni
Include rtc_task members directly in rtc_timer member. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-28rtc: pcf85063: preserve control register value between stop and startAlvin Šipraga
Fix a bug that caused the Control_1 register to get zeroed whenever the RTC time is set. The problem occurred between stopping and starting the RTC clock, wherein the return value of a successful I2C write function would get written to the register. Also update variables of the start and stop functions to be more consistent with the rest of the driver. Signed-off-by: Alvin Šipraga <alvin@airtame.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-27rtc: sh: remove unused variable rtc_devAnders Roxell
When building rtc-sh, rtc_dev isn't used in function __sh_rtc_periodic. drivers/rtc/rtc-sh.c: In function ‘__sh_rtc_periodic’: drivers/rtc/rtc-sh.c:146:21: warning: unused variable ‘rtc_dev’ [-Wunused-variable] struct rtc_device *rtc_dev = rtc->rtc_dev; ^~~~~~~ Remove the declaration of rtc_dev to dispose the warning. Fixes: ec623ff014c4 ("rtc: sh: remove dead code") Signed-off-by: Anders Roxell <anders.roxell@linaro.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-26rtc: unexport rtc_irq_set_*Alexandre Belloni
Make the rtc_irq_set interface internale to the RTC subsystem. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-26rtc: simplify rtc_irq_set_state/rtc_irq_set_freqAlexandre Belloni
The PIE doesn't handle tasks anymore, remove the pointer from the interface. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-26rtc: remove irq_task and irq_task_lockAlexandre Belloni
There is no way to set a periodic task anymore, remove task pointer and lock. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-26rtc: remove rtc_irq_register/rtc_irq_unregisterAlexandre Belloni
The rtc_irq_* interface is not used from outside the RTC subsytem since 2016. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-26rtc: sh: remove dead codeAlexandre Belloni
Since commit 80d4bb515b78 ("RTC: Cleanup rtc_class_ops->irq_set_state") and commit 696160fec162 ("RTC: Cleanup rtc_class_ops->irq_set_freq()"), sh_rtc_irq_set_state and sh_rtc_irq_set_freq are never called. Remove them along with task handling. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-25rtc: sa1100: don't set PIE frequencyAlexandre Belloni
It doesn't make sense to set the PIE frequency from the driver. Let userspace do its job. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-16rtc: ds1307: support m41t11 variantGiulio Benetti
The m41t11 variant is very similar to the already supported m41t00 and m41t0, but it has also 56 bytes of NVRAM. Add it to driver taking into account NVRAM section. Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-16rtc: ds1307: fix data pointer to m41t0Giulio Benetti
data field points to m41t00, instead it should point to m41t0. Driver works correctly because on both cases(m41t0 and m41t00) chip_desc are equal. Point to right enum m41t0 instead of m41t00. Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-16Merge 4.18-rc5 into char-misc-nextGreg Kroah-Hartman
We want the char-misc fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-13rtc: use ktime_get_real_ts64() instead of getnstimeofday64()Arnd Bergmann
getnstimeofday64() is just a wrapper around the ktime accessor, so we should use that directly. I considered using ktime_get_boottime_ts64() (to avoid leap second problems) or ktime_get_real_seconds() (to simplify the calculation, but in the end concluded that the existing interface is probably the most appropriate in this case. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-13rtc: fix alarm read and set offsetAlexandre Belloni
The offset needs to be added after reading the alarm value. It also needs to be subtracted after the now < alarm test. Tested-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-12rtc: m48t59: remove redundant pointer 'name'Colin Ian King
Pointer 'name' is being assigned but is never used hence it is redundant and can be removed. Cleans up clang warning: warning: variable 'name' set but not used [-Wunused-but-set-variable] Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-12rtc: omap: drop unnecessary register unlock around readsJohan Hovold
Drop unnecessary register write-unlock around two read accesses. Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-12rtc: omap: add missing register lock in error pathJohan Hovold
For completeness re-lock the registers also in the power-off error path. Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-12rtc: omap: fix resource leak in registration error pathJohan Hovold
Make sure to deregister the pin controller in case rtc registration fails. Fixes: 57072758623f ("rtc: omap: switch to rtc_register_device") Cc: stable <stable@vger.kernel.org> # 4.14 Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-12rtc: omap: fix potential crash on power offJohan Hovold
Do not set the system power-off callback and omap power-off rtc pointer until we're done setting up our device to avoid leaving stale pointers around after a late probe error. Fixes: 97ea1906b3c2 ("rtc: omap: Support ext_wakeup configuration") Cc: stable <stable@vger.kernel.org> # 4.9 Cc: Marcin Niestroj <m.niestroj@grinn-global.com> Cc: Tony Lindgren <tony@atomide.com> Signed-off-by: Johan Hovold <johan@kernel.org> Acked-by: Tony Lindgren <tony@atomide.com> Reviewed-by: Marcin Niestroj <m.niestroj@grinn-global.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-12rtc: test: make array pdev staticColin Ian King
The array pdev is local to the source and does not need to be in global scope, so make it static. Cleans up sparse warning: symbol 'pdev' was not declared. Should it be static? Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-12rtc: armada38x: reset after rtc power lossBaruch Siach
When the RTC block looses power it needs a reset sequence to make it usable again. Otherwise, writes to the time register have no effect. This reset sequence combines information from the mvebu_rtc driver in the Marvell provided U-Boot, and the SolidRun provided U-Boot repo. Tested on the Armada 388 based SolidRun Clearfog Base. Signed-off-by: Baruch Siach <baruch@tkos.co.il> Acked-by: Gregory CLEMENT <gregory.clement@bootlin.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-11rtc: stmp3xxx: Don't reset the rtc in .probe() when watchdog is runningUwe Kleine-König
As pointed out in the added comment resetting the rtc also stops the included watchdog. This is bad if the bootloader started the watchdog to secure the boot process. So don't reset if the watchdog is running. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-11rtc: pcf2127: add support for accessing internal static RAMUwe Kleine-König
The PCF2127 has 512 bytes of internal static RAM and this patch expands the driver to access this memory. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-11rtc: snvs: Add timeouts to avoid kernel lockupsTrent Piepho
In order to read correctly from asynchronously updated RTC registers, it's necessary to read repeatedly until their values do not change from read to read. It's also necessary to wait for three RTC clock ticks for certain operations. There are no timeouts in this code and these operations could possibly loop forever. To avoid kernel hangs, put in timeouts. The iMX7d can be configured to stop the SRTC on a tamper event, which will lockup the kernel inside this driver as described above. These hangs can happen when running under qemu, which doesn't emulate the SNVS RTC, though currently the driver will refuse to load on qemu due to a timeout in the driver probe method. It could also happen if the SRTC block where somehow placed into reset or the slow speed clock that drives the SRTC counter (but not the CPU) were to stop. The symptoms on a two core iMX7d are a work queue hang on rtc_timer_do_work(), which eventually blocks a systemd fsnotify operation that triggers a work queue flush, causing systemd to hang and thus causing all services that should be started by systemd, like a console getty, to fail to start or stop. Also optimize the wait code to wait less. It only needs to wait for the clock to advance three ticks, not to see it change three times. Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Fabio Estevam <fabio.estevam@nxp.com> Cc: Shawn Guo <shawn.guo@linaro.org> Cc: Bryan O'Donoghue <pure.logic@nexus-software.ie> Signed-off-by: Trent Piepho <tpiepho@impinj.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-11rtc: bq4802: add error handling for devm_ioremapZhouyang Jia
When devm_ioremap fails, the lack of error-handling code may cause unexpected results. This patch adds error-handling code after calling devm_ioremap. Signed-off-by: Zhouyang Jia <jiazhouyang09@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-07-07headers: separate linux/mod_devicetable.h from linux/platform_device.hRandy Dunlap
At over 4000 #includes, <linux/platform_device.h> is the 9th most #included header file in the Linux kernel. It does not need <linux/mod_devicetable.h>, so drop that header and explicitly add <linux/mod_devicetable.h> to source files that need it. 4146 #include <linux/platform_device.h> After this patch, there are 225 files that use <linux/mod_devicetable.h>, for a reduction of around 3900 times that <linux/mod_devicetable.h> does not have to be read & parsed. 225 #include <linux/mod_devicetable.h> This patch was build-tested on 20 different arch-es. It also makes these drivers SubmitChecklist#1 compliant. Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Reported-by: kbuild test robot <lkp@intel.com> # drivers/media/platform/vimc/ Reported-by: kbuild test robot <lkp@intel.com> # drivers/pinctrl/pinctrl-u300.c Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-20rtc: mrst: fix error code in probe()Dan Carpenter
We should be returning "retval". The "mrst_rtc.rtc" variable is a valid pointer. Fixes: 32b41f93dcaf ("rtc: mrst: switch to devm functions") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-06-20rtc: ds1685: remove sysfs access to control registersAlexandre Belloni
Access to the control registers is mostly not needed and can cause runtime issues (like missed interrupts). Remove this debugging interface. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-06-20rtc: ds1685: remove improper datetime access ABIAlexandre Belloni
The driver exposes an undocumented ABI to access the date and time registers. It is not actually used by any userspace tools. Remove it. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-06-11Merge tag 'mfd-next-4.18' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd Pull MFD updates from Lee Jones: "New Device Support: - Add support for AXP813 ADC to AXP20x - Add support for PM8005, PM8998 and PMI8998 New Functionality: - Add support for Battery Power Supply to AXP813 - Add support for SYSCON to SPARD SC27XX SPI - Add support for RTC to ChromeOS Embedded-Controller Fix-ups: - Remove unused code; exynos{4,5}-pmu, cros_ec, cros_ec_acpi_gpe - Remove duplicate error messages (-ENOMEM, etc); htc-i2cpld, janz-cmodio, max8997, rc5t583, sm501, smsc-ece1099, abx500-core, si476x-i2c, ti_am335x_tscadc, tps65090, tps6586x, tps65910, tps80031, twl6030-irq, viperboard - Succinctly use ptr to struct in sizeof(); rc5t583, abx500-core, sm501, smsc-ece1099 - Simplify syntax for NULL ptr checking; abx500-core, sm501 - No not unnecessarily initialise variables; tps65910, tps65910 - Reorganise and simplify driver data; omap-usb-tll - Move to SPDX license statement; tps68470 - Probe ADCs via DT; axp20x - Use new GPIOD API; arizona-core - Constify things; axp20x - Reduce code-size (use MACROS, etc); axp20x, omap-usb-host - Add DT support/docs; motorola-cpcap - Remove VLAs; rave-sp - Use devm_* managed resources; cros_ec - Interrogate HW for firmware version; rave-sp - Provide ACPI support for ChromeOS Embedded-Controller Bug Fixes: - Reorder ordered (enum) device list; tps65218 - Only accept valid data from the offset; rave-sp - Refrain from copying junk from failed SPI read; cros_ec_dev - Fix potential memory leaks; pcf50633-core - Fix clock initialisation; twl-core - Fix build-issue; tps65911 - Fix off-by-one error; tps65911 - Fix code ordering issues; intel-lpss - Fix COMPILE_TEST related issues; pwm-stm32 - Fix broken MMC card detection; asic3 - Fix clocking related issues; intel-lpss-pci" * tag 'mfd-next-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (84 commits) mfd: cros_ec: Remove unused __remove function mfd: wm97xx-core: Platform data can be NULL mfd: cros_ec_dev: Don't advertise junk features on failure mfd: cros_ec: Use devm_kzalloc for private data mfd: intel-lpss: Fix Intel Cannon Lake LPSS I2C input clock mfd: asic3: Fix broken MMC card detection mfd: timberdale: Fix spelling mistake "Uknown" -> "Unknown" mfd: omap-usb-host: Use match_string() helper mfd: stm32-timers: Fix pwm-stm32 linker issue with COMPILE_TEST pwm: stm32: Initialize raw local variables mfd: arizona: Update DT doc to support more standard Reset binding dt-bindings: mfd: Add bindings for DA9063L mfd: intel-lpss: Correct names of RESETS register bits mfd: qcom-spmi-pmic: Add support for pm8005, pm8998 and pmi8998 mfd: intel-lpss: Program REMAP register in PIO mode mfd: cros_ec_i2c: Moving the system sleep pm ops to late mfd: cros_ec_i2c: Add ACPI module device table mfd: cros_ec_dev: Register shutdown function for debugfs mfd: cros_ec_dev: Register cros-ec-rtc driver as a subdevice mfd: cros_ec: Don't try to grab log when suspended ...
2018-06-10Merge tag 'rtc-4.18' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux Pull RTC updates from Alexandre Belloni: "Setting the supported range from drivers for RTCs failing soon has started. A few fixes are developed along the way. Some drivers have been switched to SPDX by their maintainers. Subsystem: - rework of the rtc-test driver which allows to test the core more thoroughly - rtc_set_alarm() now fails early when alarms are not supported Drivers: - mktime() is now replaced by mktime64() - RTC range added for 88pm80x, ab-b5ze-s3, at91rm9200, brcmstb-waketimer, ds1685, ftrtc010, ls1x, mxc_v2, rx8581, sprd, st-lpc, tps6586x, tps65910 and vr41xx - fixed a possible race condition in probe functions - pxa: fix the probe function that is broken since v4.3 - stm32: now supports stm32mp1" * tag 'rtc-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (78 commits) rtc: pxa: fix probe function rtc: cros-ec: Switch to SPDX identifier. rtc: cros-ec: Make license text and module license match. rtc: ensure rtc_set_alarm fails when alarms are not supported rtc: test: remove alarm support from the first device rtc: test: convert to devm_rtc_allocate_device rtc: ftrtc010: let the core handle range rtc: ftrtc010: handle dates after 2106 rtc: ftrtc010: switch to devm_rtc_allocate_device rtc: mrst: switch to devm functions rtc: sunxi: fix possible race condition rtc: test: remove irq sysfs file rtc: test: emulate alarms using timers rtc: test: store time as an offset to system time rtc: test: allow registering many devices rtc: test: remove useless proc info rtc: ds1685: Add range rtc: ds1685: fix possible race condition rtc: sprd: Add new RTC power down check method rtc: sun6i: Fix bit_idx value for clk_register_gate ...
2018-06-07rtc: pxa: fix probe functionDan Carpenter
This patch is from static analysis and I don't have the hardware to to test it. I think the test is reversed so now the probe function will return success early and the last part of the function is dead code. Fixes: 3cdf4ad9633e ("rtc: pxa: convert to use shared sa1100 functions") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-06-07rtc: cros-ec: Switch to SPDX identifier.Enric Balletbo i Serra
Adopt the SPDX license identifier headers to ease license compliance management. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-06-07rtc: cros-ec: Make license text and module license match.Enric Balletbo i Serra
The license text is specifying "GPLv2" but the MODULE_LICENSE is set to GPL which means GNU Public License v2 or later. When MODULE_LICENSE and boiler plate does not match, go for boiler plate license. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>