History log of /linux-master/drivers/rtc/rtc-tps6586x.c
Revision Date Author Comments
# 3637bbdc 17-Aug-2023 Guenter Roeck <linux@roeck-us.net>

rtc: tps6586x: Report maximum alarm limit to rtc core

tps6586x only supports alarms up to 16,383 seconds in the future.
Report the limit to the RTC core.

Cc: Brian Norris <briannorris@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20230817225537.4053865-6-linux@roeck-us.net
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# adebcc1c 04-Mar-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

rtc: tps6586x: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230304133028.2135435-37-u.kleine-koenig@pengutronix.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 9d0c49fa 07-Jul-2021 Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>

rtc: tps6586x: convert to SPDX identifier

Use SPDX-License-Identifier instead of a verbose license text.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20210707075804.337458-9-nobuhiro1.iwamatsu@toshiba.co.jp


# fdcfd854 09-Nov-2020 Bartosz Golaszewski <bgolaszewski@baylibre.com>

rtc: rework rtc_register_device() resource management

rtc_register_device() is a managed interface but it doesn't use devres
by itself - instead it marks an rtc_device as "registered" and the devres
callback for devm_rtc_allocate_device() takes care of resource release.

This doesn't correspond with the design behind devres where managed
structures should not be aware of being managed. The correct solution
here is to register a separate devres callback for unregistering the
device.

While at it: rename rtc_register_device() to devm_rtc_register_device()
and add it to the list of managed interfaces in devres.rst. This way we
can avoid any potential confusion of driver developers who may expect
there to exist a corresponding unregister function.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20201109163409.24301-8-brgl@bgdev.pl


# 4c4ab451 05-Jan-2020 Dmitry Osipenko <digetx@gmail.com>

rtc: tps6586x: Use IRQ_NOAUTOEN flag

The IRQ_NOAUTOEN flag tells interrupt core that interrupt shall not be
auto-enabled at the time of requesting interrupt. This is a minor clean-up
change that doesn't fix any problems.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20200106015615.12602-1-digetx@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 44c638ce 18-Aug-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: remove superfluous error message

The RTC core now has error messages in case of registration failure, there
is no need to have other messages in the drivers.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20190818220041.17833-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 180c92c4 17-May-2018 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: tps6586x: let the core handle rtc range

Let the core handle offsetting and windowing the RTC range.

The RTC has a 40-bit counter counting at 1024 Hz. So its maximum value is
2^(40-10) - 1. Also, let the core handle the offset instead of coding it in
the callbacks. Keep the default epoch at the beginning of 2009 (this will
fail in 2043).

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 63d22063 17-May-2018 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: tps6586x: fix possible race condition

The probe function is not allowed to fail after the RTC is registered
because the following may happen:

CPU0: CPU1:
sys_load_module()
do_init_module()
do_one_initcall()
cmos_do_probe()
rtc_device_register()
__register_chrdev()
cdev->owner = struct module*
open("/dev/rtc0")
rtc_device_unregister()
module_put()
free_module()
module_free(mod->module_core)
/* struct module *module is now
freed */
chrdev_open()
spin_lock(cdev_lock)
cdev_get()
try_module_get()
module_is_live()
/* dereferences already
freed struct module* */

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 7982df86 20-Apr-2018 Arnd Bergmann <arnd@arndb.de>

rtc: tps6586x: remove mktime usage

The tps6586x use a 64-bit 'epoch_start' value, but then computes that
value using an 'mktime()', which has a smaller range and overflows
in 2106 at the latest. As both the hardware and the subsystem interface
support wider than 32-bit ranges for rtc times here, let's change all
the operations on 'seconds' to time64_t.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# ab62670e 19-Feb-2018 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: stop validating rtc_time after rtc_time_to_tm

rtc_time_to_tm never generates an invalid tm. It is not necessary to
validate it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# b9ba1eb0 09-May-2016 Nicolas Chauvet <kwizart@gmail.com>

rtc: tps6586x: rename so module can be autoloaded

This module is loaded by the related mfd driver which has
the needed MODULE_DEVICE_TABLE(i2c,...).

This patch fix the modalias when the rtc driver is built
as a module, so the right name is used.
Everything operates correctly when this module is builtin.

Fixes: esdc59ed3865 ("rtc: add RTC driver for TPS6586x")
Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>


# aa1e8069 26-Feb-2016 Grygorii Strashko <grygorii.strashko@ti.com>

rtc: tps6586x: Drop IRQF_EARLY_RESUME flag

tps6586x RTC IRQ is nested threaded and wired to the tps6586x inerrupt
controller. So, this flag is not required for nested irqs anymore,
since commit 3c646f2c6aa9 ("genirq: Don't suspend nested_thread irqs
over system suspend") was merged.

Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Nishanth Menon <nm@ti.com>
Cc: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>


# 0929ae37 20-Oct-2014 Wolfram Sang <wsa@kernel.org>

rtc: drop owner assignment from platform_drivers

A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# 5a280844 12-Jun-2013 Dmitry Osipenko <digetx@gmail.com>

drivers/rtc/rtc-tps6586x.c: device wakeup flags correction

Use device_init_wakeup() instead of device_set_wakeup_capable() and move
it before rtc dev registering. This fixes alarmtimer not registered
when tps6586x rtc is the only wakeup compatible rtc in the system.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Cc: Laxman Dewangan <ldewangan@nvidia.com>
Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# ad3f3cf4 29-Apr-2013 Sachin Kamat <sachin.kamat@linaro.org>

drivers/rtc/rtc-tps6586x.c: remove incorrect use of rtc_device_unregister

Device managed functions do not need explicit freeing/unregistering.
Moreover in this case it was done using non-device managed function
which is incorrect. Hence remove it.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Laxman dewangan <ldewangan@nvidia.com>
Cc: Chiwoong Byun <woong.byun@samsung.com>
Cc: Jonghwa Lee <jonghwa3.lee@samsung.com>
Cc: Venu Byravarasu <vbyravarasu@nvidia.com>
Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 8070d053 29-Apr-2013 Jingoo Han <jg1.han@samsung.com>

rtc: rtc-tps6586x: switch to using SIMPLE_DEV_PM_OPS

Switch to using the SIMPLE_DEV_PM_OPS macro to declare the driver's
pm_ops. It reduces code size.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 77cf81b3 29-Apr-2013 Jingoo Han <jg1.han@samsung.com>

rtc: rtc-tps6586x: use devm_rtc_device_register()

devm_rtc_device_register() is device managed and makes cleanup
paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 190ab4af 21-Feb-2013 Jingoo Han <jg1.han@samsung.com>

rtc: rtc-tps6586x: use devm_request_threaded_irq()

Use devm_request_threaded_irq() to make cleanup paths more simple.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# dc59ed38 04-Jan-2013 Laxman Dewangan <ldewangan@nvidia.com>

rtc: add RTC driver for TPS6586x

Add an RTC driver for TPS6586X chips by TI. This driver supports:

- Setting and getting time and date.
- Setting and reading alarm time.
- Alarm and interrupt functionlity.

[akpm@linux-foundation.org: remove stray semicolons]
[akpm@linux-foundation.org: start epoch in 2009]
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Tested-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>