Commit graph

2632 commits

Author SHA1 Message Date
Akshay Bhat 804a6cfeb5 rtc: rx8010: Fix for incorrect return value
The err variable is not being reset after a successful read. Explicitly
return 0 at the end of function call to account for all return paths.

Reported-by: Jens-Peter Oswald <oswald@lre.de>
Signed-off-by: Akshay Bhat <akshay.bhat@timesys.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-11-09 01:16:35 +01:00
Akshay Bhat abf57f73ef rtc: rx8010: Specify correct address for RX8010_RESV31
Define for reserved register 31 had the incorrect address. Specify
the correct address.

Reported-by: Jens-Peter Oswald <oswald@lre.de>
Signed-off-by: Akshay Bhat <akshay.bhat@timesys.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-11-08 07:52:25 +01:00
Akshay Bhat e0b6576fcd rtc: rx8010: Remove duplicate define
Remove duplicate define for RX8010_YEAR

Signed-off-by: Akshay Bhat <akshay.bhat@timesys.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-11-08 07:52:25 +01:00
Troy Kisky 05a03bf260 rtc: m41t80: remove unneeded checks from m41t80_sqw_set_rate
m41t80_sqw_set_rate will be called with the result from
m41t80_sqw_round_rate, so might as well make
m41t80_sqw_set_rate(n) same as
m41t80_sqw_set_rate(m41t80_sqw_round_rate(n))

As Russell King wrote[1],
"clk_round_rate() is supposed to tell you what you end up with if you
ask clk_set_rate() to set the exact same value you passed in - but
clk_round_rate() won't modify the hardware."

[1]
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-January/080175.html

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-11-08 07:52:24 +01:00
Troy Kisky 13bb1d78f2 rtc: m41t80: avoid i2c read in m41t80_sqw_is_prepared
This is a little more efficient and avoids the warning

 WARNING: possible circular locking dependency detected
 4.14.0-rc7-00010 #16 Not tainted
 ------------------------------------------------------
 kworker/2:1/70 is trying to acquire lock:
  (prepare_lock){+.+.}, at: [<c049300c>] clk_prepare_lock+0x80/0xf4

 but task is already holding lock:
  (i2c_register_adapter){+.+.}, at: [<c0690b04>]
		i2c_adapter_lock_bus+0x14/0x18

 which lock already depends on the new lock.

 the existing dependency chain (in reverse order) is:

 -> #1 (i2c_register_adapter){+.+.}:
        rt_mutex_lock+0x44/0x5c
        i2c_adapter_lock_bus+0x14/0x18
        i2c_transfer+0xa8/0xbc
        i2c_smbus_xfer+0x20c/0x5d8
        i2c_smbus_read_byte_data+0x38/0x48
        m41t80_sqw_is_prepared+0x18/0x28

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-11-08 07:52:24 +01:00
Troy Kisky 2cb90ed3de rtc: m41t80: avoid i2c read in m41t80_sqw_recalc_rate
This is a little more efficient, and avoids the warning

 WARNING: possible circular locking dependency detected
 4.14.0-rc7-00007 #14 Not tainted
 ------------------------------------------------------
 alsactl/330 is trying to acquire lock:
 (prepare_lock){+.+.}, at: [<c049300c>] clk_prepare_lock+0x80/0xf4

 but task is already holding lock:
 (i2c_register_adapter){+.+.}, at: [<c0690ae0>]
		i2c_adapter_lock_bus+0x14/0x18

 which lock already depends on the new lock.

 the existing dependency chain (in reverse order) is:

 -> #1 (i2c_register_adapter){+.+.}:
        rt_mutex_lock+0x44/0x5c
        i2c_adapter_lock_bus+0x14/0x18
        i2c_transfer+0xa8/0xbc
        i2c_smbus_xfer+0x20c/0x5d8
        i2c_smbus_read_byte_data+0x38/0x48
        m41t80_sqw_recalc_rate+0x24/0x58

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-11-08 07:52:23 +01:00
Troy Kisky c8384bb042 rtc: m41t80: fix m41t80_sqw_round_rate return value
Previously it was returning the best of
32768, 8192, 1024, 64, 2, 0

Now, best of
32768, 8192, 4096, 2048, 1024, 512, 256, 128,
64, 32, 16, 8, 4, 2, 1, 0

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-11-08 07:52:23 +01:00
Troy Kisky de6042d2fa rtc: m41t80: m41t80_sqw_set_rate should return 0 on success
Previously it was returning -EINVAL upon success.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-11-08 07:52:23 +01:00
Eric Nelson a9687aa276 rtc: add support for NXP PCF85363 real-time clock
Note that alarms are not currently implemented.

64 bytes of nvmem is supported and exposed in
sysfs (# is the instance number, starting with 0):

	/sys/bus/nvmem/devices/pcf85363-#/nvmem

Signed-off-by: Eric Nelson <eric@nelint.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Tested-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-11-08 07:52:22 +01:00
Alexandre Belloni b6ee15efe6 rtc: omap: Support scratch registers
Register an nvmem device to expose the 3 scratch registers (total of 12
bytes) to both userspace and kernel space.

Reviewed-by: Sekhar Nori <nsekhar@ti.com>
Tested-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-11-08 07:52:15 +01:00
Alexandre Belloni 5707275862 rtc: omap: 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-10-31 17:31:13 +01:00
Alexandre Belloni 26e480f7bb rtc: omap: fix error path when pinctrl_register fails
If pinctrl_register() fails probe will return with an error without locking
the RTC and disabling pm_runtime.
Set ret and jump to err instead.

Fixes: 97ea1906b3 ("rtc: omap: Support ext_wakeup configuration")
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-10-31 17:31:10 +01:00
Alexandre Belloni 3ba2c76a9d rtc: ds1390: Add OF device ID table
The driver doesn't have a struct of_device_id table but supported devices
are registered via Device Trees. Worse, the compatible is documented but
doesn't currently match the driver.

Add the proper compatible to the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-10-27 13:11:50 +02:00
Bastian Stender 47dd472928 rtc: ds1307: add OF and ACPI entries for Epson RX8130
Make Epson RX8130 device tree and ACPI aware.

Fixes: ee0981be77 ("rtc: ds1307: Add support for Epson RX8130CE")
Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-10-26 23:00:24 +02:00
Sean Wang d00a7ed288 rtc: mediatek: enhance the description for MediaTek PMIC based RTC
Give a better description for original MediaTek RTC driver as PMIC based
RTC in order to distinguish SoC based RTC. Also turning all words with
Mediatek to MediaTek here.

Cc: Eddie Huang <eddie.huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Acked-by: Eddie Huang <eddie.huang@mediatek.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-10-26 10:43:30 +02:00
Sean Wang ba5d018135 rtc: mediatek: add driver for RTC on MT7622 SoC
This patch introduces the driver for the RTC on MT7622 SoC.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Reviewed-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-10-26 10:43:29 +02:00
Russell King bc3bee0252 rtc: pcf8523: add support for trimming the RTC oscillator
Add support for reading and writing the RTC offset register, converting
it to the corresponding parts-per-billion value.

When setting the drift, the PCF8523 has two modes: one applies the
adjustment every two hours, the other applies the adjustment every
minute.  We select between these two modes according to which ever
gives the closest PPB value to the one requested.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-10-25 23:05:52 +02:00
Russell King f94ffbc2c2 rtc: armada38x: add support for trimming the RTC
Add support for trimming the RTC using the offset mechanism.  This RTC
supports two modes: low update mode and high update mode.  Low update
mode has finer precision than high update mode, so we use the low mode
where possible.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-10-25 23:05:52 +02:00
Russell King 8a25c8f66c rtc: clarify the RTC offset correction
The RTC offset correction documentation is not very clear about the
exact relationship between "offset" and the effect it has on the RTC.
Supplement the documentation with an equation giving the relationship.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-10-25 23:05:52 +02:00
Alexandre Belloni 9d7ed21ff4 rtc: ds1511: 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-10-13 00:10:17 +02:00
Alexandre Belloni a283d27625 rtc: ds1511: allow waking platform
Disabling interrupts when removing the driver is bad practice as this will
prevent some platform from waking up when using that RTC.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-10-13 00:10:15 +02:00
Alexandre Belloni 3032269b21 rtc: ds1511: switch to rtc_register_device
This allows for future improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-10-13 00:10:14 +02:00
Alexandre Belloni 9da32ba64d rtc: abx80x: solve race condition
There is a race condition that can happen if abx80x_probe() fails after the
rtc registration succeeded. Solve that by moving the registration at the
end of the probe function.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-10-13 00:10:12 +02:00
Alexandre Belloni 9360a6a818 rtc: abx80x: switch to rtc_register_device
This allows for future improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-10-13 00:10:11 +02:00
Alexandre Belloni f8033aabb2 rtc: m48t86: 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-10-13 00:10:10 +02:00
Alexandre Belloni 5508c72528 rtc: m48t86: switch to rtc_register_device
This allows for future improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-10-13 00:10:08 +02:00
Alexandre Belloni 41e607f21b rtc: ds1305: 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-10-13 00:10:06 +02:00
Alexandre Belloni 6a4e89161e rtc: ds1305: switch to rtc_register_device
This allows for future improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-10-13 00:10:05 +02:00
Russell King 5b64a2965d rtc: pl031: make interrupt optional
On some platforms, the interrupt for the PL031 is optional.  Avoid
trying to claim the interrupt if it's not specified.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-10-12 16:30:30 +02:00
Russell King b86f581f8c rtc: pl031: avoid exposing alarm if no interrupt
If the RTC has no interrupt, there is little point in exposing the RTC
alarm capabilities, as it can't be used as a wakeup source nor can it
deliver an event to userspace.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-10-12 16:30:25 +02:00
Russell King 273c868e85 rtc: pl031: use devm_* for allocating memory and mapping resource
Use the devm_* APIs for allocating memory and mapping the memory in
the probe function to relieve the driver from having to deal with
this in the cleanup paths.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-10-12 16:29:49 +02:00
Russell King eb508b36d5 rtc: pl031: constify amba_ids
The AMBA device IDs should be marked const.  Make that so.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-10-12 16:27:28 +02:00
Dan Carpenter 97f5b0379c rtc: rv3029: Clean up error handling in rv3029_eeprom_write()
We don't need both "ret" and "err" when they do the same thing.  All the
functions called here return zero on success or negative error codes.
It's more clear to return a literal zero at the end instead of
"return ret;"

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-10-12 16:24:19 +02:00
Mathieu Malaterre 695e38d881 rtc: jz4740: fix loading of rtc driver
The current timeout for waiting for WRDY is not always sufficient. Always
increase it to 10000 even on JZ4740. This is technically only required on
JZ4780, where the current symptoms seen after a hard reboot are:

  jz4740-rtc 10003000.rtc: rtc core: registered 10003000.rtc as rtc0
  jz4740-rtc 10003000.rtc: Could not write to RTC registers
  jz4740-rtc: probe of 10003000.rtc failed with error -5

Suggested-by: Alex Smith <alex.smith@imgtec.com>
Cc: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
Signed-off-by: Mathieu Malaterre <malat@debian.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-10-12 14:28:14 +02:00
Mathieu Malaterre 49de982881 rtc: jz4740: remove duplicate 'write' in message
Trivial fix in error message with duplicate 'write'

Signed-off-by: Mathieu Malaterre <malat@debian.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-10-12 14:16:11 +02:00
Heiner Kallweit 584ce30c72 rtc: ds1307: improve weekday handling
The current code for checking and fixing the weekday in ds1307_probe
faces some issues:
- This check is applied to all chips even if its applicable (AFAIK)
  to mcp794xx only
- The check uses MCP794XX constants for registers and bits even though
  it's executed also on other chips (ok, this could be fixed easily)
- It relies on tm_wday being properly populated when core calls set_time
  and set_alarm. This is not guaranteed at all.

First two issue we could solve by moving the check to the
mcp794xx-specific initialization (where also VBATEN flag is set).

The proposed alternative is in the set_alarm path for mcp794xx only and
calculates the alarm weekday based on the current weekday in the RTC
timekeeping regs and the difference between alarm date and current date.
So we are fine with any weekday even if it doesn't match the date.

Still there are cases where this could fail, e.g.:
- rtc date/time + weekday have power-on-reset default values
- alarm is set to actual date/time + x
- set_time is called (may change diff between rtc weekday and actual
  weekday)

But similar issues we have with the current code too:
- rtc date/time + weekday have power-on-reset default values
- alarm is set to rtc date/time + x
- set_time is called before the alarm triggers

Using random rtc date/time with relative alarms simply can interfere
with set_time. I'm not totally convinced of either option yet.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-10-12 14:16:09 +02:00
Alexandre Belloni 74717b28cb rtc: set the alarm to the next expiring timer
If there is any non expired timer in the queue, the RTC alarm is never set.
This is an issue when adding a timer that expires before the next non
expired timer.

Ensure the RTC alarm is set in that case.

Fixes: 2b2f5ff00f ("rtc: interface: ignore expired timers when enqueuing new timers")
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-28 13:53:27 +02:00
Alexandre Belloni 45b611c896 rtc: rv3029: fix vendor string
The vendor string for Microcrystal is microcrystal.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-26 15:34:41 +02:00
Linus Torvalds 561a8eb3e1 RTC for 4.14
Subsystem:
  - Remove .open() and .release() RTC ops
  - constify i2c_device_id
 
 New driver:
  - Realtek RTD1295
  - Android emulator (goldfish) RTC
 
 Drivers:
  - ds1307: Beginning of a huge cleanup
  - s35390a: handle invalid RTC time
  - sun6i: external oscillator gate support
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEXx9Viay1+e7J/aM4AyWl4gNJNJIFAlm5YTcACgkQAyWl4gNJ
 NJKetg//Xz4zK3O1uhfz1/yWOSqbBwYxUvHzSDFuD3FtAskFPPFACgJENkj98DMF
 w6nCqq/TXOY+BpqPTebzc68vvHGCvZ/AEKPzvCV1KciQ+ACMFGxH8xHCLox9AdyL
 VtcWftPPwu3W6oNN1azV++XgVtComzfEi4pTcTXdw9EDA5yBK/Xyg3xWZ1QV/Xs5
 /DFCcY69nhaJxmD/To0csmI1KbMbiprvN0vJHtF589Y4KhBfnlZnq3bAx2Coo1kv
 PpPy0e0kLzzlWMtMsiM6I3w5iwuf5o1Vajcg5ylAK0Wjvfgh7DqYX0ZQySw/5eZT
 f1OCqP0GVSugmJ8SFMVxYbXPGgpUETtT6ztB9fsAYdUye3I/xfqmip3A7vcFlrAb
 /R1gTZOyx/uwv3qVRsx0LJVxJQJ7vq/3dJYFiQo80AbPyY+GQT3xPr3z33DcJYJt
 2CL0pd6NfEzgesuVCnpZxF+wNJ+449Jzmxge5klqH1rYQ/IjOXS0qAg5pQRUaRjC
 CGNkjBWT82HN1Y8G++4FpdmHLUjkO07QyAAZiYvHNXX3aMcyl8Az/2kcrl+yq7tl
 03CxveLD8kP1bVsRMEIbx24l4lB93U5HyFTeli9xjBMbxDrBK2NZXCD7g/yI/sbs
 ryUe5W33Xgxm0DJ9CXts0qOf/ommiBoogYk+oxe+AGWdLR1weRo=
 =Xkx1
 -----END PGP SIGNATURE-----

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

Pull RTC updates from Alexandre Belloni:
 "Subsystem:
   - remove .open() and .release() RTC ops
   - constify i2c_device_id

  New driver:
   - Realtek RTD1295
   - Android emulator (goldfish) RTC

  Drivers:
   - ds1307: Beginning of a huge cleanup
   - s35390a: handle invalid RTC time
   - sun6i: external oscillator gate support"

* tag 'rtc-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (40 commits)
  rtc: ds1307: use octal permissions
  rtc: ds1307: fix braces
  rtc: ds1307: fix alignments and blank lines
  rtc: ds1307: use BIT
  rtc: ds1307: use u32
  rtc: ds1307: use sizeof
  rtc: ds1307: remove regs member
  rtc: Add Realtek RTD1295
  dt-bindings: rtc: Add Realtek RTD1295
  rtc: sun6i: Add support for the external oscillator gate
  rtc: goldfish: Add RTC driver for Android emulator
  dt-bindings: Add device tree binding for Goldfish RTC driver
  rtc: ds1307: add basic support for ds1341 chip
  rtc: ds1307: remove member nvram_offset from struct ds1307
  rtc: ds1307: factor out offset to struct chip_desc
  rtc: ds1307: factor out rtc_ops to struct chip_desc
  rtc: ds1307: factor out irq_handler to struct chip_desc
  rtc: ds1307: improve irq setup
  rtc: ds1307: constify struct chip_desc variables
  rtc: ds1307: improve trickle charger initialization
  ...
2017-09-13 10:56:00 -07:00
Alexandre Belloni b4be271ceb rtc: ds1307: use octal permissions
Octal permissions are preferred over symbolic permissions.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-05 09:55:05 +02:00
Alexandre Belloni e69c056714 rtc: ds1307: fix braces
Fix unnecessary or unbalanced braces.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-05 09:55:05 +02:00
Alexandre Belloni 4057a66e53 rtc: ds1307: fix alignments and blank lines
Alignment should always match open parenthesis.
Also remove two unnecessary blank lines

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-05 09:55:05 +02:00
Alexandre Belloni eb4fd19005 rtc: ds1307: use BIT
Use the BIT macro were possbiel.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-05 09:55:04 +02:00
Alexandre Belloni 57ec2d9580 rtc: ds1307: use u32
u32 should be used instead of uint32_t

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-05 09:55:04 +02:00
Alexandre Belloni f2b4801201 rtc: ds1307: use sizeof
Use sizeof where possible to ensure we don't read/write more than the
allocated buffer.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-05 09:55:03 +02:00
Alexandre Belloni 042fa8c7c0 rtc: ds1307: remove regs member
ds1307->regs is never used before being read or initialized locally. There
is no point in keeping a copy in memory.

Also limit the size of the read buffer to what is really used, rename buf
to regs for consistency and use sizeof() where possible.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-05 09:55:03 +02:00
Andreas Färber ae930c912b rtc: Add Realtek RTD1295
Based on QNAP's arch/arm/mach-rtk119x/driver/rtk_rtc_drv.c code and
mach-rtk119x/driver/dc2vo/fpga/include/mis_reg.h register definitions.

The base year 2014 was observed on all of Zidoo X9S, ProBox2 Ava and
Beelink Lake I.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-05 09:55:02 +02:00
Lee Jones 3f979bf8f5 Merge branches 'ib-mfd-arm-i2c-4.14', 'ib-mfd-arm-usb-video-4.14', 'ib-mfd-hwmon-4.14', 'ib-mfd-iio-pwm-4.14', 'ib-mfd-input-rtc-4.14', 'ib-mfd-many-4.14' and 'ib-mfd-pinctrl-regulator-4.14' into ibs-for-mfd-merged 2017-09-05 08:45:36 +01:00
Wolfram Sang a205425658 mfd: twl: Move header file out of I2C realm
include/linux/i2c is not for client devices. Move the header file to a
more appropriate location.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Mark Brown <broonie@kernel.org>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Acked-by: Thierry Reding <thierry.reding@gmail.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Acked-by: Daniel Thompson <daniel.thompson@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-09-04 14:41:02 +01:00
Maxime Ripard 17ecd24641 rtc: sun6i: Add support for the external oscillator gate
The RTC can output its 32kHz clock outside of the SoC, for example to clock
a WiFi chip.

Create a new clock that other devices will be able to retrieve, while
maintaining the DT stability by providing a default name for that clock if
clock-output-names doesn't list one.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-09-01 01:10:19 +02:00