Commit graph

2570 commits

Author SHA1 Message Date
Heiner Kallweit
340fd7bce0 rtc: ds1307: remove member irq from struct ds1307
The irq number is used in the probe function only, so we don't have
to store it in struct ds1307.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-01 01:10:12 +02:00
Elaine Zhang
79c676c4e3 rtc: rk808: Name RK805 in Kconfig for RTC_DRV_RK808
The RK808 and RK805 PMICs are using a similar register map.
We can reuse the rtc driver for the RK805 PMIC. So let's add
the RK805 in the Kconfig description.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-01 01:10:12 +02:00
Arvind Yadav
45a6351849 rtc: constify i2c_device_id
i2c_device_id are not supposed to change at runtime. All functions
working with i2c_device_id provided by <linux/i2c.h> work with
const i2c_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-01 01:10:11 +02:00
Alexandre Belloni
ea369ea6d8 rtc: remove .open() and .release()
There are no driver left using .open and .release. There is no good use
case for them as there is nothing the character device interface does that
should not be done in the sysfs interface or in-kernel interface.

Remove those callbacks now to avoid future confusion.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-08-24 16:34:51 +02:00
Alexandre Belloni
604c78235a rtc: mxc: avoid disabling interrupts on device close
Currently, the IRQs are disabled when the rtc character device is closed.
This means that the device needs to stay open to get alarms while the usual
use case will open the device, set the alarm and close the device as is
done in rtcwake.

Keep the alarm functional on character device release so the platform can
actually wakeup.

Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-08-24 16:23:16 +02:00
Alexandre Belloni
0a53a16722 rtc: vr41xx: make alarms useful
Currently, the IRQs are disabled when the rtc character device is closed.
This means that the device needs to stay open to get alarms while the usual
use case will open the device, set the alarm and close the device.

Keep the alarms functional on character device release. Note that the PIE
are never enabled and would anyway be disabled by the core.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-08-24 11:03:36 +02:00
Alexandre Belloni
512053a43d rtc: sa1100: make alarms useful
Currently, the driver unregisters the IRQs when the rtc character device is
closed. This means that the device needs to stay open to get alarms while
the usual use case will open the device, set the alarm and close the
device.

Move the IRQ requests to sa1100_rtc_probe() and use the devm managed
versions so we don't need to free them.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-08-24 11:03:35 +02:00
Alexandre Belloni
1cf85b2327 rtc: sa1100: fix unbalanced clk_prepare_enable/clk_disable_unprepare
In the error path of sa1100_rtc_open(), info->clk is disabled which will
happen again in sa1100_rtc_remove() when the module is removed whereas it
is only enabled once in sa1100_rtc_init().

Fixes: 0cc0c38e91 ("drivers/rtc/rtc-sa1100.c: move clock enable/disable to probe/remove")
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-08-24 11:03:35 +02:00
Alexandre Belloni
56c0c52984 rtc: pxa: fix possible race condition
pxa_rtc_open() registers the interrupt handler which will access the RTC
registers. However, pxa_rtc_open() is called before the register range is
ioremapped. Instead, call it after devm_ioremap().

Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-08-24 11:03:34 +02:00
Alexandre Belloni
be8e274646 rtc: m41t80: remove debug sysfs attribute
The last remaining sysfs attribute is undocumented and useless as it can
only be used to debug the driver. Remove it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-08-24 11:03:34 +02:00
Eric Cooper
d4473b9b77 rtc: m41t80: enable wakealarm when "wakeup-source" is specified
Don't require an IRQ if the wakeup-source device-tree property is present.

Signed-off-by: Eric Cooper <ecc@cmu.edu>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-08-24 11:03:34 +02:00
Alexandre Belloni
60d3455211 rtc: puv3: make alarms useful
Currently, the driver unregisters the IRQs when the rtc character device is
closed. This means that the device needs to stay open to get alarms while
the usual use case will open the device, set the alarm and close the
device.

Move the IRQ requests to puv3_rtc_probe() and use the devm managed versions
so we don't need to free them.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-08-22 12:05:21 +02:00
Alexandre Belloni
5539ba54b3 rtc: puv3: switch to devm_rtc_allocate_device()/rtc_register_device()
Use managed RTC device allocation as this allows for further cleanup.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-08-22 12:05:20 +02:00
Colin Ian King
2f7f1b780d rtc: max8925: remove redundant check on ret
The check on ret < 0 is redundant as the goto destination is the
next statment.  Remove this redudant check and goto.

Detected by CoverityScan, CID#1268785 ("Identical code for different
branches")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-31 00:17:48 +02:00
Colin Ian King
1a37c34811 rtc: sun6i: ensure clk_data is kfree'd on error
There are two error return paths that do not kfree clk_data and
we end up with a memory leak. Fix these with a kfree error exit
path.

Detected by CoverityScan, CID#1402959 ("Resource Leak")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-31 00:17:46 +02:00
Alexey Klimov
319ff835d6 rtc: sun6i: Remove double init of spinlock in sun6i_rtc_clk_init()
Remove double init of spinlock in sun6i_rtc_clk_init()

Fixes: 847b8bf62eb4 ("rtc: sun6i: Expose the 32kHz oscillator")
Signed-off-by: Alexey Klimov <alexey.klimov@arm.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-31 00:17:46 +02:00
Heiner Kallweit
11909f0be7 rtc: ds1307: remove legacy check for "isil, irq2-can-wakeup-machine" property
Commit 8b44f5be20 ("ARM: dts: armada: replace isil,irq2-can-wakeup-machine with wakeup-source property")
removed the last usage of "isil,irq2-can-wakeup-machine" almost
two years ago. So I think we can get rid of supporting this
legacy binding.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-31 00:17:45 +02:00
Fabien Lahoudere
7a1fe407fc rtc: s35390a: implement ioctls
Implements RTC_VL_READ and RTC_VL_CLR ioctls.

Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-31 00:17:44 +02:00
Fabien Lahoudere
16486d0c1c rtc: s35390a: handle invalid RTC time
If RTC time have been altered by low voltage, we notify users
that RTC time is invalid by returning -EINVAL.
The RTC time needs to be set correctly to clear the invalid flag.

Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-31 00:17:39 +02:00
Linus Torvalds
3a00be1923 RTC for 4.13
Subsystem:
  - expose non volatile RAM using nvmem instead of open coding in many
  drivers. Unfortunately, this option has to be enabled by default to not
  break existing users.
  - rtctest can now test for cutoff dates, showing when an RTC will start
  failing to properly save time and date.
  - new RTC registration functions to remove race conditions in drivers
 
 Newly supported RTCs:
  - Broadcom STB wake-timer
  - Epson RX8130CE
  - Maxim IC DS1308
  - STMicroelectronics STM32H7
 
 Drivers:
  - ds1307: use regmap, use nvmem, more cleanups
  - ds3232: temperature reading support
  - gemini: renamed to ftrtc010
  - m41t80: use CCF to expose the clock
  - rv8803: use nvmem
  - s3c: many cleanups
  - st-lpc: fix y2106 bug
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEXx9Viay1+e7J/aM4AyWl4gNJNJIFAllnMUIACgkQAyWl4gNJ
 NJJGNxAAqMTrggkF6KTvFCVAoMHdkeAxuoyigwCH8BCm2gOm5Qj8ZodZxndcl3Gb
 dWG+c1pHf4KXrz59h6ZGI4qFgIpCyJpjGpyJs0Pvt6gY7YIqHrEa1nvcrPO7DaWw
 fPPcszyiymDOsb6d+wJzriA2ISJUHy7Kf6FUb0fjQLoYNl7ezgzdV6+dvePOPcW1
 kaAfRX8XqrkECrDFFHlX1Szb78qGhcUB1TmWFW+hadICTguBLX/fro0DKWRw2POQ
 y3cHKqMzFhTD1+jkp26o535x/D9CWDXzLmLvRF5tBQ0X7V2UIGchj4aNEHT0Ruwx
 YlGzB3WDwfj/Jl+VALmY27mplf71z5ppJRhaFn84OWrJmvjS/2EF9TCCBc4XvzzX
 dH/5nvPyNrUYnayTTCXiPhN3p4ivywHXqA9gkHcWb3BagNIpuvwNVnJT/Sxz3Y5R
 Gt2zGl07NKQ1EtEThQEIBOMXy9nJ2PVJdQFmLehj1PfxX+Gbs42tWBILzl4n1rgT
 yUFLMGw1Y0/h39jw7t+uKM7v0aXPHOXLrwaDKIj+c4ffVXD8IALhgG7BL4dOQPSF
 rRPKi5QNYJMnuBeKHJrFlq7xWqHRVUfTFh16eyYvwGLGWiUuGe9akhlabl6bE8jG
 fm3TlHPNieGMObXijwEVePkY6z7E0CLE+d1iQsDK6ZgO/z3pdOo=
 =QDxE
 -----END PGP SIGNATURE-----

Merge tag 'rtc-4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux

Pull RTC updates from Alexandre Belloni:
 "Here is the pull-request for the RTC subsystem for 4.13.

  Subsystem:

   - expose non volatile RAM using nvmem instead of open coding in many
     drivers. Unfortunately, this option has to be enabled by default to
     not break existing users.

   - rtctest can now test for cutoff dates, showing when an RTC will
     start failing to properly save time and date.

   - new RTC registration functions to remove race conditions in drivers

  Newly supported RTCs:

   - Broadcom STB wake-timer

   - Epson RX8130CE

   - Maxim IC DS1308

   - STMicroelectronics STM32H7

  Drivers:

   - ds1307: use regmap, use nvmem, more cleanups

   - ds3232: temperature reading support

   - gemini: renamed to ftrtc010

   - m41t80: use CCF to expose the clock

   - rv8803: use nvmem

   - s3c: many cleanups

   - st-lpc: fix y2106 bug"

* tag 'rtc-4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (51 commits)
  rtc: Remove wrong deprecation comment
  nvmem: include linux/err.h from header
  rtc: st-lpc: make it robust against y2038/2106 bug
  rtc: rtctest: add check for problematic dates
  tools: timer: add rtctest_setdate
  rtc: ds1307: remove ds1307_remove
  rtc: ds1307: use generic nvmem
  rtc: ds1307: switch to rtc_register_device
  rtc: rv8803: remove rv8803_remove
  rtc: rv8803: use generic nvmem support
  rtc: rv8803: switch to rtc_register_device
  rtc: add generic nvmem support
  rtc: at91rm9200: remove race condition
  rtc: introduce new registration method
  rtc: class separate id allocation from registration
  rtc: class separate device allocation from registration
  rtc: stm32: add STM32H7 RTC support
  dt-bindings: rtc: stm32: add support for STM32H7
  rtc: ds1307: add ds1308 variant
  rtc: ds3232: add temperature support
  ...
2017-07-13 12:15:06 -07:00
Benjamin Gaignard
f4b82d39e4 rtc: st-lpc: make it robust against y2038/2106 bug
Make driver use u64 variables and functions to be sure that
it will support dates after year 2038.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Acked-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-09 22:32:18 +02:00
Alexandre Belloni
bed8e28047 rtc: ds1307: remove ds1307_remove
ds1307_remove() is now empty, remove it

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-07 13:14:25 +02:00
Alexandre Belloni
abc925f72c rtc: ds1307: use generic nvmem
Instead of adding a binary sysfs attribute from the driver (which suffers
from a race condition as the attribute appears after the device), use the
core to register an nvmem device.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-07 13:14:23 +02:00
Alexandre Belloni
69b119a642 rtc: ds1307: switch to rtc_register_device
This removes a possible race condition and crash and allows for further
improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-07 13:14:21 +02:00
Alexandre Belloni
2a52482ffb rtc: rv8803: remove rv8803_remove
rv8803_remove() is now empty, remove it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-07 13:14:19 +02:00
Alexandre Belloni
16d70a78b4 rtc: rv8803: use generic nvmem support
Instead of adding a binary sysfs attribute from the driver (which suffers
from a race condition as the attribute appears after the device), use the
core to register an nvmem device.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-07 13:14:18 +02:00
Alexandre Belloni
7133eca195 rtc: rv8803: switch to rtc_register_device
This removes a possible race condition and allows for further improvement
of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-07 13:14:16 +02:00
Alexandre Belloni
697e5a47aa rtc: add generic nvmem support
Many RTCs have an on board non volatile storage. It can be battery backed
RAM or an EEPROM. Use the nvmem subsystem to export it to both userspace
and in-kernel consumers.

This stays compatible with the previous (non documented) ABI that was using
/sys/class/rtc/rtcx/device/nvram to export that memory. But will warn about
the deprecation.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-07 13:14:14 +02:00
Alexandre Belloni
735ae2056b rtc: at91rm9200: remove race condition
While highly unlikely, it is possible to get an interrupt as soon as it is
requested. In that case, at91_rtc_interrupt() will be called with rtc ==
NULL.

Solve that by using devm_rtc_allocate_device/rtc_register_device.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-07 13:14:12 +02:00
Alexandre Belloni
3068a254d5 rtc: introduce new registration method
Introduce rtc_register_device() to register an already allocated and
initialized struct rtc_device. It automatically sets up the owner and the
two steps allocation/registration will allow to remove race conditions in
the IRQ handling of some driver. It also allows to properly extend the core
without adding more arguments to rtc_device_register().

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-07 13:14:10 +02:00
Alexandre Belloni
b91336df8a rtc: class separate id allocation from registration
Create rtc_device_get_id to allocate the id for an RTC.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-07 13:14:08 +02:00
Alexandre Belloni
d1bec20fac rtc: class separate device allocation from registration
Create rtc_allocate_device to allocate memory for a struct rtc_device and
initialize it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-07 13:14:06 +02:00
Amelie Delaunay
9a6757eadc rtc: stm32: add STM32H7 RTC support
This patch adds support for STM32H7 RTC. On STM32H7, the RTC bus interface
clock (APB clock) needs to be enabled.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-06 22:52:54 +02:00
Sean Nyekjaer
300a7735be rtc: ds1307: add ds1308 variant
The ds1308 variant is very similar to the already supported ds1338
variant, it have more debug registers and a square wave clock output.

Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-06 22:37:17 +02:00
Kirill Esipov
c35c4195f9 rtc: ds3232: add temperature support
DS3232/DS3234 has the temperature registers with a resolution of 0.25
degree celsius. This enables to get the value through hwmon.

	# cat /sys/class/hwmon/hwmon0/temp1_input
	37250

Signed-off-by: Kirill Esipov <yesipov@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-06 22:37:16 +02:00
Dan Carpenter
d0a67c372d rtc: rtc-nuc900: fix loop timeout test
We should change this post-op to a pre-op because we want the loop to
exit with "timeout" set to zero.

Fixes: 0a89b55364 ("nuc900/rtc: change the waiting for device ready implement")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-06 22:37:16 +02:00
Linus Walleij
1d61d2592c rtc: gemini/ftrtc010: rename driver and symbols
The Gemini RTC is actually a generic IP block from Faraday
Technology names FTRTC010. Rename the driver file and all
symbols to match this IP name.

The relationship can be clearly seen in the U-Boot driver
posted by Po-Yu Chuang for the Faraday A320 board:
https://lists.denx.de/pipermail/u-boot/2009-September/061326.html

Remove the dependency on ARCH_GEMINI but select the driver
for ARCH_GEMINI so we get a smooth transition. The IP block
is synthsized on different silicon and architectures.

Cc: Po-Yu Chuang <ratbert@faraday-tech.com>
Acked-by: Hans Ulli Kroll <ulli.kroll@googlemail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-06 22:37:15 +02:00
Linus Walleij
ac05fba39c rtc: gemini: Add optional clock handling
This makes the Gemini optionally take two clock references to
the PCLK and EXTCLK. As we are adding a clock framework to the
Gemini platform we need to make sure that we get the right
references.

Acked-by: Hans Ulli Kroll <ulli.kroll@googlemail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-06 22:37:14 +02:00
Heiner Kallweit
e48585dec2 rtc: ds1307: factor out century bit handling
The driver has lots of places with chip-specific code what doesn't
necessarily facilitate maintenance.

Let's describe chip-specific differences in century bit handling
in struct chip_desc to improve this.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-06 22:37:08 +02:00
Heiner Kallweit
078f3f6452 rtc: ds1307: use regmap_update_bits where applicable
After the switch to regmap we can now make use of regmap_update_bits
to simplify read/modify/write ops.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-05 23:12:34 +02:00
Brian Norris
c4f07ecee2 rtc: brcmstb-waketimer: Add Broadcom STB wake-timer
This adds support for the Broadcom STB wake-timer which is a timer in
the chip's 27Mhz clock domain that offers the ability to wake the system
(wake-up source) from suspend states (S2, S3, S5). It is supported using
the rtc framework allowing us to configure alarms for system wake-up.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Markus Mayer <mmayer@broadcom.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-05 23:11:59 +02:00
Marek Vasut
ee0981be77 rtc: ds1307: Add support for Epson RX8130CE
Add support for yet another RTC chip, Epson RX8130CE. This time around,
the chip has slightly permutated registers and also the register starts
at 0x10 instead of 0x0 .

So far, we only support the RTC and NVRAM parts of the chip, Alarm and
Timer is not supported.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Nishanth Menon <nm@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-06-24 22:59:38 +02:00
Krzysztof Kozlowski
498bcf3139 rtc: s3c: Handle clock enable failures
clk_enable() can fail so handle such case.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-06-24 22:52:43 +02:00
Krzysztof Kozlowski
9903f68af6 rtc: s3c: Handle clock prepare failures in probe
clk_prepare_enable() can fail so handle such case.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-06-24 22:52:40 +02:00
Krzysztof Kozlowski
6b72086d85 rtc: s3c: Do not remove const from rodata memory
All instances of struct s3c_rtc_data are in fact static const thus
put in rodata so we should not drop the const while getting the pointer
to them.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-06-24 22:52:38 +02:00
Krzysztof Kozlowski
21df6fed0d rtc: s3c: Drop unneeded cast to void pointer
There is no need for casting to void pointer for of_device_id data.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-06-24 22:52:35 +02:00
Krzysztof Kozlowski
fc1afe6053 rtc: s3c: Minor white-space cleanups
Minor cleanups to make the code easier to read. No functional changes.
1. Remove one space before labels as this is nowadays mostly preferred.
2. Fix indentation of arguments in function calls.
3. Split structure member declaration.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-06-24 22:52:34 +02:00
Krzysztof Kozlowski
8768e7b3e3 rtc: s3c: Jump to central exit point on getting src clock error
In other error paths in probe, centralized exit point was used so make
this consistent.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-06-24 22:52:32 +02:00
Diaz de Grenu, Jose
fe6d94fe66 rtc: mxc: remove unused variable
This variable was never used. With GCC 6.2, we get the following warning:

drivers/rtc/rtc-mxc.c:44:18: warning: ‘PIE_BIT_DEF’ defined but not used [-Wunused-const-variable=]
 static const u32 PIE_BIT_DEF[MAX_PIE_NUM][2] = {

Signed-off-by: Diaz de Grenu, Jose <Jose.DiazdeGrenu@digi.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-06-24 07:58:09 +02:00
Vaibhav Jain
0ec7769a98 rtc: opal: Implement rtc_class_ops.alarm_irq_enable callback
Provide an implementation of the callback
rtc_class_ops.alarm_irq_enable for rtc-opal driver. This callback is
called when the wake alarm is disabled via the command:

'echo 0 > /sys/class/rtc/rtc0/wakealarm'

Without this the Timed-Power-On(TPO) config remains set even when its
disabled by the above command and FSP will still force machine
boot at previously configured alarm time.

The callback is implemented as function opal_tpo_alarm_irq_enable()
which calls opal_set_tpo_time() with alarm.enabled == 0. A branch is
added to opal_set_tpo_time() to handle this case by passing y_m_d ==
h_m_s_ms == 0 to opal as arguments for opal_tpo_write() call.

Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-06-24 07:48:30 +02:00