History log of /linux-master/drivers/rtc/rtc-ds1343.c
Revision Date Author Comments
# a0386bba 23-Jan-2022 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

spi: make remove callback a void function

The value returned by an spi driver's remove function is mostly ignored.
(Only an error message is printed if the value is non-zero that the
error is ignored.)

So change the prototype of the remove function to return no value. This
way driver authors are not tempted to assume that passing an error to
the upper layer is a good idea. All drivers are adapted accordingly.
There is no intended change of behaviour, all callbacks were prepared to
return 0 before.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Claudius Heine <ch@denx.de>
Acked-by: Stefan Schmidt <stefan@datenfreihafen.org>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org> # For MMC
Acked-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Acked-by: Łukasz Stelmach <l.stelmach@samsung.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220123175201.34839-6-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>


# 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


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

rtc: add devm_ prefix to rtc_nvmem_register()

rtc_nvmem_register() is a managed interface. It doesn't require any
release function to be called at driver detach. To avoid confusing
driver authors, let's rename it to devm_rtc_nvmem_register() and add it
to the list of managed interfaces in Documentation/.

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-6-brgl@bgdev.pl


# 25ece305 09-Nov-2020 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: nvmem: remove nvram ABI

The nvram sysfs attributes have been deprecated at least since v4.13, more
than 3 years ago and nobody ever complained about the deprecation warning.

Remove the sysfs attributes now.

[Bartosz: remove the declaration of rtc_nvmem_unregister()]

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


# d6e62e7f 18-Dec-2019 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>

rtc: ds1343: Remove unused struct spi_device in struct ds1343_priv

struct spi_device in struct ds1343_priv is not used, remove it.

CC: Alessandro Zummo <a.zummo@towertech.it>
CC: Alexandre Belloni <alexandre.belloni@bootlin.com>
CC: Raghavendra Chandra Ganiga <ravi23ganiga@gmail.com>
CC: Ankur Srivastava <sankurece@gmail.com>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Link: https://lore.kernel.org/r/20191218081917.3308211-1-iwamatsu@nigauri.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 3b52093d 04-Dec-2019 Linus Walleij <linus.walleij@linaro.org>

rtc: ds1343: Do not hardcode SPI mode flags

The current use of mode flags to us SPI_MODE_3 and
SPI_CS_HIGH is fragile: it overwrites anything already
assigned by the SPI core. Change it thusly:

- Just |= the SPI_MODE_3 so we keep other flags
- Assign ^= SPI_CS_HIGH since we might be active high
already, and that is usually the case with GPIOs used
for chip select, even if they are in practice active low.

Add a comment clarifying why ^= SPI_CS_HIGH is the right
choice here.

Reported-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20191204225731.20306-1-linus.walleij@linaro.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 05df5572 19-Oct-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: ds1343: cleanup .remove

It is not necessary to call device_init_wakeup(dev, false) in .remove as
device_del will take care of that. It is also not necessary to
devm_free_irq. Finally, dev_pm_clear_wake_irq can be called
unconditionally.

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


# 0680a6cd 19-Oct-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: ds1343: rework interrupt handling

Rework the interrupt handling to avoid caching the values as the core is
already doing that. The core also always ensures the rtc_time passed for
the alarm is fully populated.

The only trick is in read_alarm where status needs to be read before the
alarm registers to ensure the potential irq is not cleared.

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


# a9864290 19-Oct-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: ds1343: remove unnecessary mutex

Use rtc_lock and rtc_unlock to lock the rtc from the interrupt handler.
This removes the need for a driver specific lock.

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


# ce0fd9db 19-Oct-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: ds1343: check regmap_read return value

Check whether regmap_read fails before continuing in the sysfs .show
callbacks.

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


# ac08888b 19-Oct-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: ds1343: use regmap_update_bits for glitch filter

Use regmap_update_bits to update DS1343_CONTROL_REG in a race free manner
when setting the glitch filter.

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


# 580daaf4 19-Oct-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: ds1343: 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.

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


# f308b682 19-Oct-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: ds1343: use burst write to set time

To avoid possible race condition, use regmap_bulk_write to write all the
date/time registers at once instead of sequentially.

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


# 8c9a88fa 19-Oct-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: ds1343: remove dead code

RTC_SET_CHARGE doesn't exist, the ioctl code is never used.

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


# 21783322 19-Oct-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: ds1343: set range

This is a standard BCD rtc with a useless century bit (no leap year
correction after 2099).

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


# d2912cb1 04-Jun-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500

Based on 2 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation #

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 4122 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Enrico Weigelt <info@metux.net>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


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

rtc: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

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


# d7501f70 12-Feb-2018 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: ds1343: 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@bootlin.com>


# ab392864 12-Feb-2018 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: ds1343: remove undocumented and useless sysfs files

A documented ABI already exists to get information about the alarm. It is
the only one that is used.

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


# 1536f6dc 12-Feb-2018 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: ds1343: switch to rtc_register_device

This allows for future improvement of the driver.

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


# b5086150 12-Feb-2018 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: ds1343: simplify regmap initialization

Avoid using memset as gcc can properly initialize structures.

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


# 56d86a7e 28-Jun-2016 Uwe Kleine-König <uwe@kleine-koenig.org>

rtc: simplify implementations of read_alarm

Since commit d68778b80dd7 ("rtc: initialize output parameter for read
alarm to "uninitialized"") there is no need to explicitly set
unsupported members to -1. So drop the respective assignments from
drivers.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>


# fa569113 31-Mar-2016 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: remove useless DRV_VERSION

Many drivers are defining a DRV_VERSION. This is often only used for
MODULE_VERSION and sometimes to print an info message at probe time. This
is kind of pointless as they are all versionned with the kernel anyway.
Also the core will print a message when a new rtc is found.

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


# caff0cc4 21-Sep-2015 Sudeep Holla <Sudeep.Holla@arm.com>

rtc: ds1343: remove misuse of IRQF_NO_SUSPEND flag

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should
be left enabled so as to allow them to work as expected during the
suspend-resume cycle, but doesn't guarantee that it will wake the system
from a suspended state, enable_irq_wake is recommended to be used for
the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags and uses newly
introduce PM wakeup APIs dev_pm_{set,clear}_wake_irq.

Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: rtc-linux@googlegroups.com
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>


# 3821a065 23-Oct-2015 Andrew F. Davis <afd@ti.com>

spi: Drop owner assignment from spi_drivers

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

Signed-off-by: Andrew F. Davis <afd@ti.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# f4843b19 26-Jul-2015 Vladimir Zapolskiy <vz@mleia.com>

rtc: ds1343: clean up ds1343_nvram_read()/ds1343_nvram_write()

The change removes redundant sysfs binary file boundary checks, since
this task is already done on caller side in fs/sysfs/file.c

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>


# 571eb883 08-Aug-2014 Raghavendra Ganiga <ravi23ganiga@gmail.com>

drivers/rtc/rtc-ds1343.c: add support of nvram for maxim dallas rtc ds1343

This is a patch to add support of nvram for maxim dallas rtc ds1343.

Signed-off-by: Raghavendra Chandra Ganiga <ravi23ganiga@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 10b06b87 06-Jun-2014 Raghavendra Ganiga <ravi23ganiga@gmail.com>

drivers/rtc/rtc-ds1343.c: fix potential race condition

Avoid the potential race condition by avoiding bailing out of driver in
probe after registering with rtc subsystem

Also the set_alarm , read_alarm and alarm_irq_enable returns error if irq
registration fails in probe.

Also the sysfs will not create entry for alarm if irq registration fails
in probe.

Signed-off-by: Raghavendra Chandra Ganiga <ravi23ganiga@gmail.com>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 1d6316f5 06-Jun-2014 Raghavendra Ganiga <ravi23ganiga@gmail.com>

drivers/rtc: add support for maxim dallas rtc ds1343 and ds1344

Signed-off-by: Raghavendra Chandra Ganiga <ravi23ganiga@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
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>