Commit Graph

3091 Commits

Author SHA1 Message Date
Alexandre Belloni a652e00ee1 rtc: xgene: fix possible race condition
The IRQ is requested before the struct rtc is allocated and registered, but
this struct is used in the IRQ handler. This may lead to a NULL pointer
dereference.

Switch to devm_rtc_allocate_device/rtc_register_device to allocate the rtc
struct before requesting the IRQ.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-04 10:07:08 +02:00
Alexandre Belloni 540a11d8bd rtc: test: do not use assignment in if condition
Fix checkpatch error:
drivers/rtc/rtc-test.c:155: ERROR: do not use assignment in if condition

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-04 10:07:08 +02:00
Alexandre Belloni 8bc9630ad1 rtc: 88pm80x: convert to SPDX identifier
Use SPDX-License-Identifier instead of a verbose license text.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-04 10:07:08 +02:00
Alexandre Belloni 9c3ab85586 rtc: ab-b5ze-s3: correct checkpatch issues
Correct trivial whitespace and split strings issues.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-04 10:07:08 +02:00
Alexandre Belloni 606cc43c72 rtc: core: correct trivial checkpatch warnings
Correct trivial checkpatch warnings, mostly whitespace issues and
unbalanced braces.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-04 10:07:08 +02:00
Linus Walleij 6875404fdb rtc: x1205: Add DT probing support
This makes it possible to probe the X1205 RTC from the
device tree. This is needed when adding device tree boot
support for the IXP4xx-based NSLU2 which has this RTC.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-04 10:07:08 +02:00
Wolfram Sang 737842e575 rtc: da9063: convert header to SPDX
Covnert the header of the source file to SPDX.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-04 10:07:07 +02:00
Alexandre Belloni 35118b7a4e rtc: omap: let the core handle range
Let the core handle the RTC range instead of open coding it.

Tested-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-04 10:07:03 +02:00
Alexandre Belloni b46c5815be rtc: mv: add range
This RTC handles time from 2000-01-01 00:00:00 to 2099-12-31 23:59:59 with
a weird rollover to 2000-06-23 00:00:00.

Tested-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-04 10:06:54 +02:00
Alexandre Belloni 5b25a71b68 rtc: mv: convert to devm_rtc_allocate_device
This allows further improvement of the driver.

Tested-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-04 10:06:41 +02:00
Alexandre Belloni b674361529 rtc: mv: convert to SPDX identifier
Use SPDX-License-Identifier instead of a verbose license text.

Reviewed-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-04 10:02:58 +02:00
Alexandre Belloni cdf7545aef rtc: convert core to SPDX identifier
Use SPDX-License-Identifier instead of a verbose license text. Also fix the
block comment alignment.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-18 03:36:01 +01:00
Alexandre Belloni 33fee143ac rtc: ab-b5ze-s3: remove unnecessary check
The core already checks that the alarm is set in the future. IT is not
necessary to do it again in the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-18 03:36:01 +01:00
Alexandre Belloni 8188064985 rtc: ab-b5ze-s3: convert to SPDX identifier
Use SPDX-License-Identifier instead of a verbose license text.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-18 03:36:01 +01:00
Alexandre Belloni 8a94112445 rtc: ab-b5ze-s3: switch to rtc_time64_to_tm/rtc_tm_to_time64
Call the 64bit versions of rtc_time_to_tm as the range is enforced by the
core.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-18 03:36:01 +01:00
Alexandre Belloni 5d049837dd rtc: ab-b5ze-s3: remove unnecessary gotos
Rework error handling to remove unnecessary gotos.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-18 03:36:01 +01:00
Alexandre Belloni ac24673822 rtc: ab-b5ze-s3: remove mutex
The rtc_ops are already called with the RTC mutex locked so there is no
need to have a separate lock, unless it is used in the irq handler.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-18 03:36:01 +01:00
Alexandre Belloni 28e7861cfc rtc: zynqmp: convert to SPDX identifier
Use SPDX-License-Identifier instead of a verbose license text.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-18 03:36:01 +01:00
Alexandre Belloni 60b7f4cbdc rtc: abx80x: remove useless .remove
.remove is empty, remove it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-18 03:36:01 +01:00
Alexandre Belloni 559e883e0f rtc: abx80x: use rtc_add_group
Use rtc_add_group to add the sysfs group in a race free manner.
This has the side effect of moving the files to their proper location.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-18 03:36:01 +01:00
Alexandre Belloni 2fcdf5fd7c rtc: abx80x: convert to SPDX identifier
Use SPDX-License-Identifier instead of a verbose license text.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-18 03:36:01 +01:00
Linus Torvalds f47d633134 chrome platform changes for v5.1
1. SPDX identifier cleanup for platform/chrome
 2. Cleanup series between mfd and chrome/platform, moving
    cros-ec attributes from mfd/cros_ec_dev to sub-drivers in platform/chrome.
 3. Wilco EC driver
 4. Maintainership change to new group repository.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE6gYDF28Li+nEiKLaHwn1ewov5lgFAlyG4dIACgkQHwn1ewov
 5lhoqA//SXO5HU1qkhfvwUKyNsYxtIj4wDQF+j9tAPbVaOOaztq0b5D1PQgDGcEL
 SDl9FAXZtwhmPr5xiGPrPUxwn4JG+tUcgSSgIOCtClpA/SZUPt2wekAB64hLt1ui
 nkBRSgeRnXeeRE0nDh7EUrwAeaYj6yCg4AS8FMHmjWTG0tI6iivhuc39v/zDV8Br
 f4chOu/KEWS/EhItVlDBHE0mYDW2JGLSD3nqJR9MdujvYzbkN5WusJIXBDK6MOUl
 z1gqptVYyq/FQOQOCZ+vHjTNVYQ3N3NbPOnnQn4xAyYiqTQJVJv+x6dd7htncjVO
 567PFbbqbKzqrGWZOrdksxVa4JkIGfcgNG2mskRYKpEtHVOpMlHxwHqKv/93TQvw
 F0z4+43ZeAo0Fx2k+oOiDylpClDvUVOeH0z5suqIK15MZbpfWZF6d38Pz1Zwd8hY
 0TEldpyH83HiXylEuYabBwq3ABfj4VncYcMWfaW517LUrnH9nkJDNOlXQFreGTPt
 uHQPz+Xzfirk9wNwlEtfhqh3fjRWIfmiHc8bLmCB2XuJqavF0pozoQnJprw+72LR
 h4ALkUBr8laVfXYgG8SzNm/K4DlMjKqvJRY6m2b7AY8CTVgMur7ct0WJsvmECF+4
 2XDDvHwkQJt3XifVLpLgFRfR5YRlFxjwMNS8Zq0Bb/gjRqSSCo4=
 =2nC0
 -----END PGP SIGNATURE-----

Merge tag 'tag-chrome-platform-for-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux

Pull chrome platform updates from Benson Leung:

 - SPDX identifier cleanup for platform/chrome

 - Cleanup series between mfd and chrome/platform, moving cros-ec
   attributes from mfd/cros_ec_dev to sub-drivers in platform/chrome

 - Wilco EC driver

 - Maintainership change to new group repository

* tag 'tag-chrome-platform-for-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux:
  platform/chrome: fix wilco-ec dependencies
  platform/chrome: wilco_ec: Add RTC driver
  platform/chrome: wilco_ec: Add support for raw commands in debugfs
  platform/chrome: Add new driver for Wilco EC
  platform/chrome: cros_ec: Remove cros_ec dependency in lpc_mec
  MAINTAINERS: chrome-platform: change the git tree to a chrome-platform group git tree
  platform/chrome: cros_ec_sysfs: remove pr_fmt() define
  platform/chrome: cros_ec_lightbar: remove pr_fmt() define
  platform/chrome: cros_kbd_led_backlight: switch to SPDX identifier
  platform/chrome: cros_ec_spi: switch to SPDX identifier
  platform/chrome: cros_ec_proto: switch to SPDX identifier
  platform/chrome: cros_ec_lpc: switch to SPDX identifier
  platform/chrome: cros_ec_i2c: switch to SPDX identifier
  platform/chrome: cros_ec_vbc: switch to SPDX identifier
  platform/chrome: cros_ec_sysfs: switch to SPDX identifier
  platform/chrome: cros_ec_lightbar: switch to SPDX identifier
  platform/chrome: cros_ec_debugfs: switch to SPDX identifier
  platform/chrome: cromeos_pstore: switch to SPDX identifier
2019-03-12 09:46:32 -07:00
Alexandre Belloni e91b94fd2b rtc: pic32: convert to SPDX identifier
Use SPDX-License-Identifier instead of a verbose license text.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-04 20:23:15 +01:00
Alexandre Belloni c145e5f4a4 rtc: pic32: let the core handle range
Let the core handle the RTC range instead of open coding it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-04 20:21:19 +01:00
Alexandre Belloni 6515e23b9f rtc: pic32: convert to devm_rtc_allocate_device
This allows further improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-04 20:21:19 +01:00
Alexandre Belloni 7d1e5bfe17 rtc: update my email address
Use my current email address.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-04 20:21:19 +01:00
Alexandre Belloni 182ae2bb64 rtc: rv8803: convert to SPDX identifier
Use SPDX-License-Identifier instead of a verbose license text.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-04 20:21:19 +01:00
Alexandre Belloni 2e17f8b982 rtc: rv8803: let the core handle range
Let the core handle the RTC range instead of open coding it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-04 20:21:19 +01:00
Alexandre Belloni 1a9de2100d rtc: tx4939: convert to SPDX identifier
Use SPDX-License-Identifier instead of a verbose license text.

The original text refers to the COPYING file in the main directory which is
GPL v2 only so also update MODULE_LICENSE() to "GPL v2" instead of "GPL".

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-04 20:21:19 +01:00
Alexandre Belloni 1ebb909d5a rtc: tx4939: use .set_time
Switch from .set_mmss to .set_time as the former is deprecated.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-03 23:19:30 +01:00
Alexandre Belloni e230b2c26d rtc: tx4939: switch to rtc_time64_to_tm/rtc_tm_to_time64
Call the 64bit versions of rtc_time_to_tm now that the range is enforced by
the core.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-03 23:14:35 +01:00
Alexandre Belloni e866cbdf6e rtc: tx4939: set range
The TX4939 RTC is a 48bit counter that counts two on every clock edge of
32.768 KHz oscillator clock so it counts 32bit seconds.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-03 23:08:09 +01:00
Alexandre Belloni 72d3819744 rtc: tx4939: remove useless test
The tested condition will never happen as the core always passes a fully
set struct tm (using rtc_ktime_to_tm) to the .set_alarm callback.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-03 22:54:49 +01:00
Alexandre Belloni 3199fc3d74 rtc: zynqmp: let the core handle range
Let the core handle the RTC range instead of open coding it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-03 22:38:34 +01:00
Alexandre Belloni b8541798a8 rtc: zynqmp: fix possible race condition
The IRQ is requested before the struct rtc is allocated and registered, but
this struct is used in the IRQ handler. This may lead to a NULL pointer
dereference.

Switch to devm_rtc_allocate_device/rtc_register_device to allocate the rtc
struct before requesting the IRQ.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-03 22:36:19 +01:00
Alexandre Belloni 30adde6b18 rtc: imx-sc: use rtc_time64_to_tm
The imx-sc driver properly sets range_max, use rtc_time64_to_tm() instead
of the deprecated rtc_time_to_tm()

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-03 22:12:38 +01:00
Biju Das 51f896ffd1 rtc: rx8581: Add support for Epson rx8571 RTC
Add support for Epson rx8571 real-time clock. rx8571 rtc is compatible
with rx8581,except that rx8571 has additional 16 bytes of RAM.

16 bytes of nvmem is supported and exposed in sysfs (# is the instance
number,starting with 0): /sys/bus/nvmem/devices/rx8571-#/nvmem

Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-02 22:20:58 +01:00
Alexey Roslyakov 069e28e571 rtc: pcf85063: remove dead code
Some of defines are not in use since
7b5768486a. Remove it to make the code
easier to read and understand.

Signed-off-by: Alexey Roslyakov <alexey.roslyakov@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-03-02 21:55:47 +01:00
Alexandre Belloni ad5ea5b9d5 rtc: remove rtc_class_ops.read_callback
Since commit 416f0e8056 ("RTC: sa1100: Update the sa1100 RTC driver."),
the last user of .read_callback is gone. It has been 8 years and now new
user appeared. Simply remove it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-02-25 21:20:45 +01:00
Nick Crews 0d2f2a3da1 platform/chrome: wilco_ec: Add RTC driver
This Embedded Controller has an internal RTC that is exposed
as a standard RTC class driver with read/write functionality.

The driver is added to the drivers/rtc/ so that the maintainer of that
directory will be able to comment on this change, as that maintainer is
the expert on this system. In addition, the driver code is called
indirectly after a corresponding device is registered from core.c,
as opposed to core.c registering the driver callbacks directly.

To test:
> hwclock --show --rtc /dev/rtc1
2007-12-31 16:01:20.460959-08:00
> hwclock --systohc --rtc /dev/rtc1
> hwclock --show --rtc /dev/rtc1
2018-11-29 17:08:00.780793-08:00

> hwclock --show --rtc /dev/rtc1
2007-12-31 16:01:20.460959-08:00
> hwclock --systohc --rtc /dev/rtc1
> hwclock --show --rtc /dev/rtc1
2018-11-29 17:08:00.780793-08:00

Signed-off-by: Duncan Laurie <dlaurie@google.com>
Signed-off-by: Nick Crews <ncrews@chromium.org>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
[Fix the sparse warning: symbol 'wilco_ec_rtc_read/write' was not declared]
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-02-21 21:36:53 +01:00
Artem Panfilov 67075b63cc rtc: add AB-RTCMC-32.768kHz-EOZ9 RTC support
This patch adds support for AB-RTCMC-32.768kHz-EOZ9 RTC/Calendar
module with I2C interface.

Signed-off-by: Artem Panfilov <panfilov.artyom@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-02-18 22:39:30 +01:00
Alexandre Belloni 3cbb7b638f rtc: hid-sensor-time: stop selecting IIO
Make RTC_DRV_HID_SENSOR_TIME depend on IIO and HID_SENSOR_HUB to remove
possible circular dependencies as this is the only symbol selecting those.

Suggested-by: Florian Lohoff <f@zz.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-02-17 21:29:10 +01:00
Alexandre Belloni e6e7376cfd rtc: rv3028: add new driver
Add a driver for the MicroCrystal RV-3028. It is a SMT Real-Time Clock
Module that incorporates an integrated CMOS circuit together with an XTAL.
It has an i2c interface.

The driver handles date/time, alarms, trickle charging, timestamping,
frequency offset correction, EEPROM and NVRAM.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-02-17 21:29:10 +01:00
Trent Piepho c3544f6f51 rtc: isl1208: Add new style nvmem support to driver
Add support for the RTC's NVRAM using the standard nvmem support that is
part of the Linux RTC framework.

This driver already has a sysfs attribute that provides access to the
RTC's NVRAM as a single 16-bit value.  Some chips have more than two
bytes of NVRAM, so this will not work for them.  It's also non-standard.

This sysfs attribute is left in for backward compatibility, but will only
be able to read the first two bytes of NVRAM.  The nvmem interface will
allow access to all NVRAM, e.g. eight bytes on the isl1218.

Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Trent Piepho <tpiepho@impinj.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-02-17 21:29:10 +01:00
Trent Piepho 5909b87db8 rtc: isl1208: Support more chip variations
Add more support in the driver for dealing with differences in is1208
compatible chips.  Put the 1208, 1209, 1218, and 1219 in the list and
encode information about nvram size, tamper, and timestamp features.

This adds support for the isl1209, which has a tamper detect but no
timestamp feature.

Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Trent Piepho <tpiepho@impinj.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-02-17 21:29:10 +01:00
Trent Piepho ed3c52a075 rtc: isl1208: Introduce driver state struct
This driver has no state of its own, depending entirely on what is in
the generic rtc device.

Intoduce a state struct.  For now it only contains a pointer to the rtc
device struct, but future patches will add more data.

Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Trent Piepho <tpiepho@impinj.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-02-17 21:29:10 +01:00
Alexandre Belloni 5736610ab6 rtc: meson: remove useless rtc_nvmem_unregister call
rtc_nvmem_unregister() is called on rtc_device release so it is not
necessary to call it from the driver.

Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-02-17 21:28:39 +01:00
Martin Blumenstingl d8fe6009aa rtc: support for the Amlogic Meson RTC
Add support for the RTC block on the 32-bit Amlogic Meson6, Meson8,
Meson8b and Meson8m2 SoCs.

The RTC is split in to two parts, which are both managed by this driver:
- the AHB front end
- and a simple serial connection to the actual registers

The RTC_COUNTER register which holds the time is 32-bits wide.

There are four 32-bit wide (in total: 16 bytes) "regmem" registers which
are exposed using nvmem. On Amlogic's 3.10 kernel this is used to store
data which needs to survive a suspend / resume cycle.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
[resurrected Ben's patches after 2 years]
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-02-11 09:41:21 +01:00
Oliver.Rohe@wago.com 09832dc059 rtc: rs5c372: Fix reading from rtc when the oscillator got interrupted.
When the oscillator of the rtc gets interrupted,
e.g. due to an empty battery, reading from the rtc will now return an error
and the oscillator bit will be cleared, once the rtc is successfully reset.

Signed-off-by: Oliver Rohe <oliver.rohe@wago.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-02-11 09:41:21 +01:00
Alexandre Belloni 7dd63ec076 rtc: imx-sc: depend on HAVE_ARM_SMCCC
Fix the following build issue:

drivers/rtc/rtc-imx-sc.o: In function `imx_sc_rtc_set_time':
>> rtc-imx-sc.c:(.text+0x212): undefined reference to `__arm_smccc_smc'

Fixes: 13a929f38a ("rtc: imx-sc: add rtc set time support")
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-02-08 12:08:39 +01:00