Adding I2C support to RX6110 RTC
cover Adding I2C support to RX6110 RTC
Hi,
this patch introduces I2C support to the RX6110 RTC driver and also adds an ACPI identifier to it.
Since we are also pushing the coreboot changes for the ACPI table upstream in parallel, we are free to name this ACPI entry however we like it seems. So any feedback on that would be welcome ;)
kind regards,
Claudius
Claudius Heine (1):
rtc: rx6110: add i2c support
Johannes Hahn (1):
rtc: rx6110: add ACPI bindings to I2C
drivers/rtc/Kconfig | 20 ++--- drivers/rtc/rtc-rx6110.c | 155 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 158 insertions(+), 17 deletions(-)
Signature · 1 line
2.20.1
PATCH 1/2 rtc: rx6110: add i2c support
The RX6110 also supports I2C, so this patch adds support for it to the driver.
This also renames the SPI specific functions and variables to include _spi_ in their names.
--- drivers/rtc/Kconfig | 20 +++--- drivers/rtc/rtc-rx6110.c | 143 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 146 insertions(+), 17 deletions(-)
drivers/rtc/Kconfig +11 -9
@@ -817,15 +817,6 @@ config RTC_DRV_RX4581 This driver can also be built as a module. If so the module will be called rtc-rx4581. -config RTC_DRV_RX6110 - tristate "Epson RX-6110" - select REGMAP_SPI - help - If you say yes here you will get support for the Epson RX-6610. - - This driver can also be built as a module. If so the module - will be called rtc-rx6110. - config RTC_DRV_RS5C348 tristate "Ricoh RS5C348A/B" help
@@ -936,6 +927,17 @@ config RTC_DRV_RV3029_HWMON Say Y here if you want to expose temperature sensor data on rtc-rv3029. +config RTC_DRV_RX6110 + tristate "Epson RX-6110" + depends on RTC_I2C_AND_SPI + select REGMAP_SPI if SPI_MASTER + select REGMAP_I2C if I2C + help + If you say yes here you will get support for the Epson RX-6610. + + This driver can also be built as a module. If so the module + will be called rtc-rx6110. + comment "Platform RTC drivers" # this 'CMOS' RTC driver is arch dependent because it requires
drivers/rtc/rtc-rx6110.c +135 -8
184 lines not on this page · raw message
Signature · 1 line
2.20.1
Alexandre Belloni
maintainerRe: [PATCH 1/2] rtc: rx6110: add i2c support
Quoted 29 lines · Claudius Heine
drivers/rtc/rtc-rx6110.c +29
-0+static int rx6110_i2c_probe (struct i2c_client *client, +const struct i2c_device_id *id) +{ +struct i2c_adapter *adapter =to_i2c_adapter (client->dev.parent); +struct rx6110_data *rx6110; +int err; + +if (!i2c_check_functionality (adapter,I2C_FUNC_SMBUS_BYTE_DATA + |I2C_FUNC_SMBUS_I2C_BLOCK )) { +dev_err (&adapter->dev, +"doesn't support required functionality\n" ); +return -EIO ; + } + + rx6110 =devm_kzalloc (&client->dev,sizeof (*rx6110),GFP_KERNEL ); +if (!rx6110) +return -ENOMEM ; + + rx6110->regmap =devm_regmap_init_i2c (client, ®map_i2c_config); +if (IS_ERR (rx6110->regmap)) { +dev_err (&client->dev,"regmap init failed for rtc rx6110\n" ); +return PTR_ERR (rx6110->regmap); + } + +i2c_set_clientdata (client, rx6110); + + rx6110->rtc =devm_rtc_device_register (&client->dev, + client->name, + &rx6110_rtc_ops,THIS_MODULE );
drivers/rtc/rtc-rx6110.c static const struct of_device_id rx6110_spi_of_match[] = { · line 454
Quoted 10 lines
drivers/rtc/rtc-rx6110.c +10
-0+ +if (IS_ERR (rx6110->rtc)) +return PTR_ERR (rx6110->rtc); + + err =rx6110_init (rx6110); +if (err) +return err; + + rx6110->rtc->max_user_freq =1 ; +
I would prefer if you could have a common function doing the RTC registration and init for both i2c and spi. It wouldn't do much yet but ideally, it would set the RTC range too and it would be better to not have to duplicate that.
Signature · 3 lines
Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 2/2 rtc: rx6110: add ACPI bindings to I2C
In reply to Claudius HeineFrom: Johannes Hahn <[email protected]>
This allows the RX6110 driver to be automatically assigned to the right device on the I2C bus.
--- drivers/rtc/rtc-rx6110.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/rtc/rtc-rx6110.c +12 -0
@@ -13,6 +13,7 @@#include <linux/of_gpio.h> #include <linux/regmap.h> #include <linux/rtc.h> +#include <linux/acpi.h> #include <linux/of.h> #include <linux/of_device.h> #include <linux/spi/spi.h>
@@ -455,6 +456,14 @@ static int rx6110_i2c_probe(struct i2c_client *client,return 0 ; } +#ifdef CONFIG_ACPI +static const struct acpi_device_id rx6110_i2c_acpi_match[] = { + {"RX6110SA" , }, + { }, +}; +MODULE_DEVICE_TABLE (acpi, rx6110_i2c_acpi_match); +#endif +static const struct i2c_device_id rx6110_i2c_id[] = { {"rx6110" ,0 }, { }
@@ -464,6 +473,9 @@ MODULE_DEVICE_TABLE(i2c, rx6110_i2c_id);static struct i2c_driver rx6110_i2c_driver = { .driver = { .name =RX6110_DRIVER_NAME , +#ifdef CONFIG_ACPI + .acpi_match_table =ACPI_PTR (rx6110_i2c_acpi_match), +#endif }, .probe = rx6110_i2c_probe, .id_table = rx6110_i2c_id,
Signature · 1 line
2.20.1
Alexandre Belloni
maintainerHello Claudius!
It has been a while ;)
Quoted 9 lines · Claudius Heine
Hi,
this patch introduces I2C support to the RX6110 RTC driver and also adds an ACPI identifier to it.
Since we are also pushing the coreboot changes for the ACPI table upstream in parallel, we are free to name this ACPI entry however we like it seems. So any feedback on that would be welcome ;)
I don't care too much about ACPI so if you are really looking for advice there, I guess you should ask seom of the ACPI guys (but I guess you are free to choose whatever you want).
Signature · 3 lines
Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Hi Alex,
Quoted 3 lines · Alexandre Belloni
Hello Claudius!
It has been a while ;)
yeah, lots of downstream stuff for me :/
Quoted 7 lines · Claudius Heine
Quoted 5 lines
Hi,
this patch introduces I2C support to the RX6110 RTC driver and also adds an ACPI identifier to it.
Quoted 8 lines
Quoted 4 lines
Since we are also pushing the coreboot changes for the ACPI table upstream in parallel, we are free to name this ACPI entry however we like it seems. So any feedback on that would be welcome ;)
I don't care too much about ACPI so if you are really looking for advice there, I guess you should ask seom of the ACPI guys (but I guess you are free to choose whatever you want).
As Henning said, we are also getting feedback from the coreboot people.
See you hopefully soon again, when all this sitting at home is over.
regards,
Claudius
Hi,
Am Thu, 5 Nov 2020 23:14:51 +0100
schrieb Alexandre Belloni <[email protected]>:
Quoted 10 lines
Hello Claudius!
It has been a while ;)
Quoted 5 lines · Claudius Heine
Hi,
this patch introduces I2C support to the RX6110 RTC driver and also adds an ACPI identifier to it.
Quoted 9 lines
Quoted 4 lines
Since we are also pushing the coreboot changes for the ACPI table upstream in parallel, we are free to name this ACPI entry however we like it seems. So any feedback on that would be welcome ;)
I don't care too much about ACPI so if you are really looking for advice there, I guess you should ask seom of the ACPI guys (but I guess you are free to choose whatever you want).
This is the coreboot stuff currently under review.
https://review.coreboot.org/c/coreboot/+/47235
Henning
Alexandre Belloni
maintainerQuoted 20 lines · Henning Schild
Hi,
Am Thu, 5 Nov 2020 23:14:51 +0100
schrieb Alexandre Belloni <[email protected]>:Quoted 15 lines
Hello Claudius!
It has been a while ;)
Quoted 9 lines · Claudius Heine
Hi,
this patch introduces I2C support to the RX6110 RTC driver and also adds an ACPI identifier to it.
Since we are also pushing the coreboot changes for the ACPI table upstream in parallel, we are free to name this ACPI entry however we like it seems. So any feedback on that would be welcome ;)
Quoted 9 lines
Quoted 4 lines
I don't care too much about ACPI so if you are really looking for advice there, I guess you should ask seom of the ACPI guys (but I guess you are free to choose whatever you want).
This is the coreboot stuff currently under review.
I can't really comment on the patch, however another part is worrying:
if VLF is set, coreboot is resetting the time to a valid value (user defined or the build date). This is nasty because this hides the event from the kernel and ulimately, userspace has no way of knowing whether the RTC date is the real date or just a dummy date.
Signature · 3 lines
Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Am Fri, 6 Nov 2020 08:59:08 +0100
schrieb Alexandre Belloni <[email protected]>:
Quoted 28 lines · Henning Schild
Quoted 27 lines
Hi,
Am Thu, 5 Nov 2020 23:14:51 +0100
schrieb Alexandre Belloni <[email protected]>:Quoted 10 lines
Hello Claudius!
It has been a while ;)
Quoted 5 lines · Claudius Heine
Hi,
this patch introduces I2C support to the RX6110 RTC driver and also adds an ACPI identifier to it.
Quoted 9 lines
Quoted 4 lines
Since we are also pushing the coreboot changes for the ACPI table upstream in parallel, we are free to name this ACPI entry however we like it seems. So any feedback on that would be welcome ;)
I don't care too much about ACPI so if you are really looking for advice there, I guess you should ask seom of the ACPI guys (but I guess you are free to choose whatever you want).
This is the coreboot stuff currently under review.
Quoted 8 lines
Quoted 2 lines
I can't really comment on the patch, however another part is worrying:
if VLF is set, coreboot is resetting the time to a valid value (user defined or the build date). This is nasty because this hides the event from the kernel and ulimately, userspace has no way of knowing whether the RTC date is the real date or just a dummy date.
Is that worrying problem part of the patch, or just a general observation looking at their driver?
I think in the patches we should focus on whether I2C and ACPI support should be added, and how.
Henning
Alexandre Belloni
maintainerQuoted 34 lines · Henning Schild
Am Fri, 6 Nov 2020 08:59:08 +0100
schrieb Alexandre Belloni <[email protected]>:Quoted 31 lines · Henning Schild
Quoted 29 lines
Hi,
Am Thu, 5 Nov 2020 23:14:51 +0100
schrieb Alexandre Belloni <[email protected]>:Quoted 10 lines
Hello Claudius!
It has been a while ;)
Quoted 5 lines · Claudius Heine
Hi,
this patch introduces I2C support to the RX6110 RTC driver and also adds an ACPI identifier to it.
Quoted 9 lines
Quoted 4 lines
Since we are also pushing the coreboot changes for the ACPI table upstream in parallel, we are free to name this ACPI entry however we like it seems. So any feedback on that would be welcome ;)
I don't care too much about ACPI so if you are really looking for advice there, I guess you should ask seom of the ACPI guys (but I guess you are free to choose whatever you want).
This is the coreboot stuff currently under review.
Quoted 9 lines
Quoted 5 lines
I can't really comment on the patch, however another part is worrying:
if VLF is set, coreboot is resetting the time to a valid value (user defined or the build date). This is nasty because this hides the event from the kernel and ulimately, userspace has no way of knowing whether the RTC date is the real date or just a dummy date.Is that worrying problem part of the patch, or just a general observation looking at their driver?
It is a separate observation on their driver.
Signature · 3 lines
Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com