History log of /linux-master/drivers/rtc/rtc-pcf85363.c
Revision Date Author Comments
# 2be36c09 13-Oct-2023 Javier Carrasco <javier.carrasco.cruz@gmail.com>

rtc: pcf85363: fix wrong mask/val parameters in regmap_update_bits call

The current implementation passes PIN_IO_INTA_OUT (2) as a mask and
PIN_IO_INTAPM (GENMASK(1, 0)) as a value.
Swap the variables to assign mask and value the right way.

This error was first introduced with the alarm support. For better or
worse it worked as expected because 0x02 was applied as a mask to 0x03,
resulting 0x02 anyway. This will of course not work for any other value.

Fixes: e5aac267a10a ("rtc: pcf85363: add alarm support")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20231013-topic-pcf85363_regmap_update_bits-v1-1-c454f016f71f@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 1e786b03 21-Aug-2023 Mike Looijmans <mike.looijmans@topic.nl>

rtc: pcf85363: Allow to wake up system without IRQ

When wakeup-source is set in the devicetree, set up the device for
using the output as interrupt instead of clock. This is similar to
how other RTC devices handle this.

This allows the clock chip to turn on the board when wired to do
so in hardware.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Link: https://lore.kernel.org/r/20230821072013.7072-1-mike.looijmans@topic.nl
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 48144c28 24-Jul-2023 Rob Herring <robh@kernel.org>

rtc: Explicitly include correct DT includes

The DT of_device.h and of_platform.h date back to the separate
of_platform_bus_type before it as merged into the regular platform bus.
As part of that merge prepping Arm DT support 13 years ago, they
"temporarily" include each other. They also include platform_device.h
and of.h. As a result, there's a pretty much random mix of those include
files used throughout the tree. In order to detangle these headers and
replace the implicit includes with struct declarations, users need to
explicitly include the correct includes.

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


# 31b0cecb 05-May-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

rtc: Switch i2c drivers back to use .probe()

After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert
back to (the new) .probe() to be able to eventually drop .probe_new() from
struct i2c_driver.

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


# fd9a6a13 15-Feb-2023 Javier Carrasco <javier.carrasco@wolfvision.net>

rtc: pcf85363: add support for the quartz-load-femtofarads property

The quartz oscillator load capacitance of the PCF85263 and PCF85363 can
be adjusted to 6 pF, 7 pF (default) and 12.5 pF with the CL[1:0] bits in
the oscillator control register (address 25h).

Signed-off-by: Javier Carrasco <javier.carrasco@wolfvision.net>
Link: https://lore.kernel.org/r/20230215081815.3141776-3-javier.carrasco@wolfvision.net
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# dd7166c8 23-Jan-2023 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: pcf85363: use IRQ flags obtained fromfwnode

Allow the IRQ type to be passed from the device tree if available as there
may be components changing the trigger type of the interrupt between the
RTC and the IRQ controller.

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


# 3f4a3322 10-Jun-2022 Stephen Kitt <steve@sk2.org>

rtc: use simple i2c probe

All these drivers have an i2c probe function which doesn't use the
"struct i2c_device_id *id" parameter, so they can trivially be
converted to the "probe_new" style of probe with a single argument.

This change was done using the following Coccinelle script, and fixed
up for whitespace changes:

@ rule1 @
identifier fn;
identifier client, id;
@@

- static int fn(struct i2c_client *client, const struct i2c_device_id *id)
+ static int fn(struct i2c_client *client)
{
...when != id
}

@ rule2 depends on rule1 @
identifier rule1.fn;
identifier driver;
@@

struct i2c_driver driver = {
- .probe
+ .probe_new
=
(
fn
|
- &fn
+ fn
)
,
};

Signed-off-by: Stephen Kitt <steve@sk2.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220610162346.4134094-1-steve@sk2.org


# c506bc10 01-Feb-2021 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: pcf85363: quiet maybe-unused variable warning

When CONFIG_OF is disabled then the matching table is not referenced.

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


# 732b7341 10-Jan-2021 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: pcf85363: drop a struct rtc_class_ops

Merge both struct rtc_class_ops in a single one and use RTC_FEATURE_ALARM
to signal to the core whether alarms are available.

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


# 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


# 7ef66122 28-Aug-2019 Biwen Li <biwen.li@nxp.com>

rtc: pcf85363/pcf85263: fix regmap error in set_time

Issue:
- # hwclock -w
hwclock: RTC_SET_TIME: Invalid argument

Why:
- Relative commit: 8b9f9d4dc511 ("regmap: verify if register is
writeable before writing operations"), this patch
will always check for unwritable registers, it will compare reg
with max_register in regmap_writeable.

- The pcf85363/pcf85263 has the capability of address wrapping
which means if you access an address outside the allowed range
(0x00-0x2f) hardware actually wraps the access to a lower address.
The rtc-pcf85363 driver will use this feature to configure the time
and execute 2 actions in the same i2c write operation (stopping the
clock and configure the time). However the driver has also
configured the `regmap maxregister` protection mechanism that will
block accessing addresses outside valid range (0x00-0x2f).

How:
- Split of writing regs to two parts, first part writes control
registers about stop_enable and resets, second part writes
RTC time and date registers.

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Link: https://lore.kernel.org/r/20190829021418.4607-1-biwen.li@nxp.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 56573ca7 10-Apr-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: pcf85363: convert to SPDX identifier

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

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


# b21a841c 10-Apr-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: pcf85363: remove useless forward declaration

It is not necessary to forward declare pcf85363_driver as it is not used
before being declared.

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


# 176a5ee3 10-Apr-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: pcf85363: remove bogus i2c functionality check

regmap is abstracting the i2c functionalities the best it can, there is no
need to check.

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


# c0ec8319 10-Apr-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: pcf85363: set range

This is a standard BCD RTC that will fail in 2100.

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


# 8f7b1d71 10-Apr-2019 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: pcf85363: remove unused struct pcf85363 member

pcf85363->dev is unused, remove it.

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


# fc979933 07-Dec-2018 Biju Das <biju.das@bp.renesas.com>

rtc: pcf85363: Add support for NXP pcf85263 rtc

Add support for NXP pcf85263 real-time clock. pcf85263 rtc is compatible
with pcf85363,except that pcf85363 has additional 64 bytes of RAM.

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

Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>


# 188306ac 23-Feb-2018 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: pcf85363: set time accurately

As per 8.2.6 Setting and reading the time in RTC mode, first stop the clok,
then reset it before setting the date and time registers. Finally, start
the clock.

This uses register address wrap around from 0x2f to 0x00 for efficiency.

This allows to set the clock with a millisecond accuracy (drift is not
corrected in this example):

RTC System
1325388767 1325388767.000029180
1325388768 1325388768.000018362
1325388769 1325388769.000006544
1325388770 1325388769.999992725
1325388771 1325388770.999974544

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


# e5aac267 28-Feb-2018 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: pcf85363: add alarm support

Handle alarms, currently only on INTA

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


# c57849dd 23-Feb-2018 Alexandre Belloni <alexandre.belloni@bootlin.com>

rtc: pcf85363: add .max_register in regmap_config

This helps debugging as it allows reading registers from debugfs.

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


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

rtc: pcf85363: put struct nvmem_config on the stack

Avoid allocating memory for struct nvmem_config.

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


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

rtc: pcf85363: call rtc_nvmem_register()

Call rtc_nvmem_register instead of letting the core do it and stop using
the nvmem_config member of struct rtc_device.

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


# a9687aa2 01-Nov-2017 Eric Nelson <eric@nelint.com>

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>