rtc: abx80x: add support for ABX81X
Subsystems (2)
cover rtc: abx80x: add support for ABX81X
Hello,
This patch series adds support for the ABX81X RTCs, which are essentially SPI versions of the ABX80X RTCs. The first patches contain cleanup and reorganization changes (converting the driver to use the regmap API was needed for this), followed by the actual ABX81X support.
Kind regards,
Antoni Pokusinski
Antoni Pokusinski (6):
dt-bindings: rtc: abx80x: document ABX81X RTCs
rtc: abx80x: add irq to struct abx80x_priv
rtc: abx80x: use regmap instead of I2C specific API
rtc: abx80x: replace read-modify-write pattern with regmap helpers
rtc: abx80x: create abx80x_i2c_probe()
rtc: abx80x: add support for ABX81X
.../bindings/rtc/abracon,abx80x.yaml | 15 +- drivers/rtc/Kconfig | 25 +- drivers/rtc/rtc-abx80x.c | 595 +++++++++++------- 3 files changed, 384 insertions(+), 251 deletions(-)
Signature · 1 line
2.55.0
PATCH 1/6 dt-bindings: rtc: abx80x: document ABX81X RTCs
Abracon AB0815 and AB1815 are RTC modules with SPI interface.
--- .../devicetree/bindings/rtc/abracon,abx80x.yaml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/rtc/abracon,abx80x.yaml +14 -1
@@ -4,7 +4,7 @@ $id: http://devicetree.org/schemas/rtc/abracon,abx80x.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: Abracon ABX80X I2C ultra low power RTC/Alarm chip +title: Abracon ABX80X (I2C) and ABX81X (SPI) ultra low power RTC/Alarm chips maintainers: - [email protected]
@@ -21,10 +21,12 @@ properties: - abracon,ab0803 - abracon,ab0804 - abracon,ab0805 + - abracon,ab0815 - abracon,ab1801 - abracon,ab1803 - abracon,ab1804 - abracon,ab1805 + - abracon,ab1815 - microcrystal,rv1805 reg:
@@ -96,3 +98,14 @@ examples: interrupts = <44 IRQ_TYPE_EDGE_FALLING>; }; }; + + - | + spi { + #address-cells = <1>; + #size-cells = <0>; + + rtc@0 { + compatible = "abracon,ab1815"; + reg = <0>; + }; + };
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH 1/6] dt-bindings: rtc: abx80x: document ABX81X RTCs
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Low] The newly added SPI compatible strings `abracon,ab0815` and `abracon,ab1815` were omitted from the…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] The newly added SPI compatible strings abracon,ab0815 and abracon,ab1815 were omitted from the if-then conditional block that restricts trickle charger properties.
- [Low] The schema explicitly introduces SPI support but fails to reference the standard SPI peripheral properties schema, causing common SPI properties to be rejected. --
--- Patch [1]: [PATCH 1/6] dt-bindings: rtc: abx80x: document ABX81X RTCs --- commit 74ad54b7ffcb981494fb52031a1edb5415b809ae
Author: Antoni Pokusinski <[email protected]>
dt-bindings: rtc: abx80x: document ABX81X RTCs
Abracon AB0815 and AB1815 are RTC modules with SPI interface.
Quoted 4 lines
Documentation/devicetree/bindings/rtc/abracon,abx80x.yaml +0
-0
[ ... ]
Documentation/devicetree/bindings/rtc/abracon,abx80x.yaml properties: · line 30
Quoted 11 lines
Documentation/devicetree/bindings/rtc/abracon,abx80x.yaml +2
-0@@ -21,10 +21,12 @@ properties: - abracon,ab0803 - abracon,ab0804 - abracon,ab0805 + - abracon,ab0815 - abracon,ab1801 - abracon,ab1803 - abracon,ab1804 - abracon,ab1805 + - abracon,ab1815 - microcrystal,rv1805
[Severity: Low]
Will the schema validator reject standard trickle charger properties for the newly added AB0815 and AB1815 compatible strings?
Looking at the conditional block later in the file:
allOf:
- $ref: rtc.yaml#
- if:
properties:
compatible:
not:
contains:
enum:
- abracon,abx80x
- abracon,ab0804
- abracon,ab1804
- abracon,ab0805
- abracon,ab1805
Because abracon,ab0815 and abracon,ab1815 were omitted from this enum list, abracon,tc-diode and abracon,tc-resistor will evaluate to false for these variants. Should they be added to the list?
[ ... ]
Quoted 5 lines
Documentation/devicetree/bindings/rtc/abracon,abx80x.yaml +1
-0@@ -96,3 +98,14 @@ examples: interrupts = <44 IRQ_TYPE_EDGE_FALLING>; }; }; +
Documentation/devicetree/bindings/rtc/abracon,abx80x.yaml examples: · line 111
Quoted 10 lines
Documentation/devicetree/bindings/rtc/abracon,abx80x.yaml +10
-0+ - | + spi { + #address-cells = <1>; + #size-cells = <0>; + + rtc@0 { + compatible = "abracon,ab1815"; + reg = <0>; + }; + };
[Severity: Low]
Does this binding need to reference the standard SPI peripheral properties?
Because the schema adds SPI support and specifies unevaluatedProperties: false, standard SPI properties like spi-max-frequency will be rejected by the validator.
Could a reference to /schemas/spi/spi-peripheral-props.yaml# be added to the allOf block to permit these common SPI properties?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Re: [PATCH 1/6] dt-bindings: rtc: abx80x: document ABX81X RTCs
Quoted 50 lines · On Wed, Jul 22, 2026 at 08:09:45PM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] The newly added SPI compatible stringsabracon,ab0815andabracon,ab1815were omitted from theif-thenconditional block that restricts trickle charger properties.
- [Low] The schema explicitly introduces SPI support but fails to reference the standard SPI peripheral properties schema, causing common SPI properties to be rejected. ----- Patch [1]: [PATCH 1/6] dt-bindings: rtc: abx80x: document ABX81X RTCs --- commit
74ad54b7ffcb981494fb52031a1edb5415b809ae
Author: Antoni Pokusinski <[email protected]>dt-bindings: rtc: abx80x: document ABX81X RTCs
Abracon AB0815 and AB1815 are RTC modules with SPI interface.
Quoted 4 lines
Documentation/devicetree/bindings/rtc/abracon,abx80x.yaml +0
-0[ ... ]
Documentation/devicetree/bindings/rtc/abracon,abx80x.yaml properties: · line 30
Quoted 11 lines
Documentation/devicetree/bindings/rtc/abracon,abx80x.yaml +2
-0@@ -21,10 +21,12 @@ properties: - abracon,ab0803 - abracon,ab0804 - abracon,ab0805 + - abracon,ab0815 - abracon,ab1801 - abracon,ab1803 - abracon,ab1804 - abracon,ab1805 + - abracon,ab1815 - microcrystal,rv1805[Severity: Low]
Will the schema validator reject standard trickle charger properties for the newly added AB0815 and AB1815 compatible strings?Looking at the conditional block later in the file:
allOf:
- $ref: rtc.yaml#
- if:
properties:
compatible:
not:
contains:
enum:
- abracon,abx80x
- abracon,ab0804
- abracon,ab1804
- abracon,ab0805
- abracon,ab1805
Quoted 5 lines
Because abracon,ab0815 and abracon,ab1815 were omitted from this enum list, abracon,tc-diode and abracon,tc-resistor will evaluate to false for these variants. Should they be added to the list?
[ ... ]
Yes, the new compatible strings are missing here, will add them in v2.
Re: [PATCH 1/6] dt-bindings: rtc: abx80x: document ABX81X RTCs
In reply to Antoni PokusinskiQuoted 21 lines · Antoni Pokusinski
Abracon AB0815 and AB1815 are RTC modules with SPI interface.
Signed-off-by Antoni Pokusinski <[email protected]>--- .../devicetree/bindings/rtc/abracon,abx80x.yaml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/rtc/abracon,abx80x.yaml +1
-1@@ -4,7 +4,7 @@ $id: http://devicetree.org/schemas/rtc/abracon,abx80x.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: Abracon ABX80X I2C ultra low power RTC/Alarm chip +title: Abracon ABX80X (I2C) and ABX81X (SPI) ultra low power RTC/Alarm chips maintainers: - [email protected]
Documentation/devicetree/bindings/rtc/abracon,abx80x.yaml properties: · line 30
Quoted 10 lines
Documentation/devicetree/bindings/rtc/abracon,abx80x.yaml +2
-0@@ -21,10 +21,12 @@ properties: - abracon,ab0803 - abracon,ab0804 - abracon,ab0805 + - abracon,ab0815 - abracon,ab1801 - abracon,ab1803 - abracon,ab1804 - abracon,ab1805 + - abracon,ab1815 - microcrystal,rv1805
No ref to spi-peripheral-properties.yaml? Do you not need any spi properties, e.g. spi-max-frequency?
Quoted 20 lines
Documentation/devicetree/bindings/rtc/abracon,abx80x.yaml +11
-0reg:@@ -96,3 +98,14 @@ examples: interrupts = <44 IRQ_TYPE_EDGE_FALLING>; }; }; + + - | + spi { + #address-cells = <1>; + #size-cells = <0>; + + rtc@0 { + compatible = "abracon,ab1815"; + reg = <0>; + }; + };Signature · 1 line
2.55.0
Re: [PATCH 1/6] dt-bindings: rtc: abx80x: document ABX81X RTCs
Quoted 19 lines · Conor Dooley
Quoted 18 lines · Antoni Pokusinski
Abracon AB0815 and AB1815 are RTC modules with SPI interface.
Signed-off-by Antoni Pokusinski <[email protected]>--- .../devicetree/bindings/rtc/abracon,abx80x.yaml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/rtc/abracon,abx80x.yaml +1
-1@@ -4,7 +4,7 @@ $id: http://devicetree.org/schemas/rtc/abracon,abx80x.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: Abracon ABX80X I2C ultra low power RTC/Alarm chip +title: Abracon ABX80X (I2C) and ABX81X (SPI) ultra low power RTC/Alarm chips
Quoted 17 lines
Documentation/devicetree/bindings/rtc/abracon,abx80x.yaml properties: · line 30
Quoted 13 lines
Documentation/devicetree/bindings/rtc/abracon,abx80x.yaml +2
-0maintainers: - [email protected]@@ -21,10 +21,12 @@ properties: - abracon,ab0803 - abracon,ab0804 - abracon,ab0805 + - abracon,ab0815 - abracon,ab1801 - abracon,ab1803 - abracon,ab1804 - abracon,ab1805 + - abracon,ab1815 - microcrystal,rv1805No ref to
spi-peripheral-properties.yaml? Do you not need any spi properties, e.g. spi-max-frequency?
Ah yes, missed this... Will add in v2.
Quoted 20 lines
Quoted 20 lines
Documentation/devicetree/bindings/rtc/abracon,abx80x.yaml +11
-0reg:@@ -96,3 +98,14 @@ examples: interrupts = <44 IRQ_TYPE_EDGE_FALLING>; }; }; + + - | + spi { + #address-cells = <1>; + #size-cells = <0>; + + rtc@0 { + compatible = "abracon,ab1815"; + reg = <0>; + }; + };Signature · 1 line
2.55.0
Re: [PATCH 1/6] dt-bindings: rtc: abx80x: document ABX81X RTCs
In reply to Antoni PokusinskiQuoted 1 line · Antoni Pokusinski
Abracon AB0815 and AB1815 are RTC modules with SPI interface.
Binding does not allow SPI interface, you need spi-peripheral-props.
Best regards,
Krzysztof
PATCH 2/6 rtc: abx80x: add irq to struct abx80x_priv
In reply to Antoni PokusinskiThis way the irq number is not tied to the i2c_client and can be easily accessed also in the case of ABX81X SPI clocks.
--- drivers/rtc/rtc-abx80x.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/rtc/rtc-abx80x.c +11 -7
@@ -127,6 +127,7 @@ struct abx80x_priv {struct rtc_device *rtc;struct i2c_client *client;struct watchdog_device wdog; +int irq; };static int abx80x_write_config_key (struct i2c_client *client,u8 key)
@@ -285,11 +286,12 @@ static irqreturn_t abx80x_handle_irq(int irq, void *dev_id)static int abx80x_read_alarm (struct device *dev,struct rtc_wkalrm *t) {struct i2c_client *client =to_i2c_client (dev); +struct abx80x_priv *priv =i2c_get_clientdata (client);unsigned char buf[7 ];int irq_mask, err; -if (client->irq <=0 ) +if (priv->irq <=0 )return -EINVAL ; err = i2c_smbus_read_i2c_block_data(client, ABX8XX_REG_ASC,
@@ -317,10 +319,11 @@ static int abx80x_read_alarm(struct device *dev, struct rtc_wkalrm *t)static int abx80x_set_alarm (struct device *dev,struct rtc_wkalrm *t) {struct i2c_client *client =to_i2c_client (dev); +struct abx80x_priv *priv =i2c_get_clientdata (client);u8 alarm[6 ];int err; -if (client->irq <=0 ) +if (priv->irq <=0 )return -EINVAL ; alarm[0 ] =0x0 ;
@@ -908,6 +911,7 @@ static int abx80x_probe(struct i2c_client *client) priv->rtc->ops = &abx80x_rtc_ops; priv->client = client; + priv->irq = client->irq;i2c_set_clientdata (client, priv);
@@ -921,19 +925,19 @@ static int abx80x_probe(struct i2c_client *client)if (err)return err; -if (client->irq >0 ) { -dev_info (&client->dev,"IRQ %d supplied\n" , client->irq); - err =devm_request_threaded_irq (&client->dev, client->irq,NULL , +if (priv->irq >0 ) { +dev_info (&client->dev,"IRQ %d supplied\n" , priv->irq); + err =devm_request_threaded_irq (&client->dev, priv->irq,NULL , abx80x_handle_irq,IRQF_SHARED |IRQF_ONESHOT ,"abx8xx" , client);if (err) {dev_err (&client->dev,"unable to request IRQ, alarms disabled\n" ); - client->irq =0 ; + priv->irq =0 ; } } -if (client->irq <=0 ) +if (priv->irq <=0 )clear_bit (RTC_FEATURE_ALARM , priv->rtc->features); err =rtc_add_group (priv->rtc, &rtc_calib_attr_group);
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH 2/6] rtc: abx80x: add irq to struct abx80x_priv
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] The shared IRQ handler unconditionally returns IRQ_HANDLED and inadvertently clears all status bits.
- [High] The abx80x_read_alarm function fails unconditionally on success due to incorrect error checking. --
--- Patch [2]: [PATCH 2/6] rtc: abx80x: add irq to struct abx80x_priv --- commit ccef71986338cc749e8440b88d073968d465ea5c
Author: Antoni Pokusinski <[email protected]>
rtc: abx80x: add irq to struct abx80x_priv
This patch moves the irq number into struct abx80x_priv so that it is no longer tied to the i2c_client. This allows the irq number to be accessed in the case of ABX81X SPI clocks.
Quoted 4 lines
drivers/rtc/rtc-abx80x.c +0
-0
[ ... ]
Quoted 4 lines
drivers/rtc/rtc-abx80x.c +0
-0@@ -285,11 +286,12 @@ static irqreturn_t abx80x_handle_irq(int irq, void *dev_id)static int abx80x_read_alarm (struct device *dev,struct rtc_wkalrm *t) {struct i2c_client *client =to_i2c_client (dev);
drivers/rtc/rtc-abx80x.c static irqreturn_t abx80x_handle_irq(int irq, void *dev_id) · line 297
Quoted 10 lines
drivers/rtc/rtc-abx80x.c +2
-1+struct abx80x_priv *priv =i2c_get_clientdata (client);unsigned char buf[7 ];int irq_mask, err; -if (client->irq <=0 ) +if (priv->irq <=0 )return -EINVAL ; err = i2c_smbus_read_i2c_block_data(client, ABX8XX_REG_ASC,
[Severity: High]
This is a pre-existing issue, but doesn't i2c_smbus_read_i2c_block_data() return the number of bytes read on success?
Looking at drivers/rtc/rtc-abx80x.c:abx80x_read_alarm():
err = i2c_smbus_read_i2c_block_data(client, ABX8XX_REG_ASC, sizeof(buf), buf); if (err) return err;
Since it returns 7 on success, will this unconditionally fail and return early with an error code, leaving the alarm structure uninitialized?
[ ... ]
drivers/rtc/rtc-abx80x.c static int abx80x_probe(struct i2c_client *client) · line 932
Quoted 12 lines
drivers/rtc/rtc-abx80x.c +3
-3@@ -921,19 +925,19 @@ static int abx80x_probe(struct i2c_client *client)if (err)return err; -if (client->irq >0 ) { -dev_info (&client->dev,"IRQ %d supplied\n" , client->irq); - err = devm_request_threaded_irq(&client->dev, client->irq, NULL, +if (priv->irq >0 ) { +dev_info (&client->dev,"IRQ %d supplied\n" , priv->irq); + err = devm_request_threaded_irq(&client->dev, priv->irq, NULL, abx80x_handle_irq, IRQF_SHARED | IRQF_ONESHOT,
[Severity: High]
This isn't a bug introduced by this patch, but since the IRQ is registered here with IRQF_SHARED, does abx80x_handle_irq() correctly handle shared interrupts?
Looking at drivers/rtc/rtc-abx80x.c:abx80x_handle_irq():
static irqreturn_t abx80x_handle_irq(int irq, void *dev_id)
{
[ ... ]
status = i2c_smbus_read_byte_data(client, ABX8XX_REG_STATUS);
if (status < 0)
return IRQ_NONE;
[ ... ]
i2c_smbus_write_byte_data(client, ABX8XX_REG_STATUS, 0);
return IRQ_HANDLED;
}If no relevant interrupt flags are set for this device, it still returns IRQ_HANDLED and writes 0 to ABX8XX_REG_STATUS, clearing all status bits including non-IRQ bits like BLF. Can this break other devices sharing the interrupt line and silently drop hardware status flags?
Quoted 2 lines
drivers/rtc/rtc-abx80x.c +0
-0"abx8xx" , client);
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Re: [PATCH 2/6] rtc: abx80x: add irq to struct abx80x_priv
Quoted 48 lines · On Wed, Jul 22, 2026 at 08:13:53PM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] The shared IRQ handler unconditionally returnsIRQ_HANDLEDand inadvertently clears all status bits.
- [High] Theabx80x_read_alarmfunction fails unconditionally on success due to incorrect error checking. ----- Patch [2]: [PATCH 2/6] rtc: abx80x: add irq to struct
abx80x_priv--- commitccef71986338cc749e8440b88d073968d465ea5c
Author: Antoni Pokusinski <[email protected]>rtc: abx80x: add irq to struct
abx80x_privThis patch moves the irq number into struct
abx80x_privso that it is no longer tied to thei2c_client. This allows the irq number to be accessed in the case of ABX81X SPI clocks.Quoted 4 lines
drivers/rtc/rtc-abx80x.c +0
-0[ ... ]
Quoted 4 lines
drivers/rtc/rtc-abx80x.c +0
-0@@ -285,11 +286,12 @@ static irqreturn_t abx80x_handle_irq(int irq, void *dev_id)static int abx80x_read_alarm (struct device *dev,struct rtc_wkalrm *t) {struct i2c_client *client =to_i2c_client (dev);drivers/rtc/rtc-abx80x.c static irqreturn_t abx80x_handle_irq(int irq, void *dev_id) · line 297
Quoted 10 lines
drivers/rtc/rtc-abx80x.c +2
-1+struct abx80x_priv *priv =i2c_get_clientdata (client);unsigned char buf[7 ];int irq_mask, err; -if (client->irq <=0 ) +if (priv->irq <=0 )return -EINVAL ; err = i2c_smbus_read_i2c_block_data(client, ABX8XX_REG_ASC,[Severity: High]
This is a pre-existing issue, but doesn'ti2c_smbus_read_i2c_block_data()return the number of bytes read on success?Looking at drivers/rtc/rtc-abx80x.c:abx80x_read_alarm():
err = i2c_smbus_read_i2c_block_data(client, ABX8XX_REG_ASC, sizeof(buf), buf); if (err) return err;
Quoted 4 lines
Since it returns 7 on success, will this unconditionally fail and return early with an error code, leaving the alarm structure uninitialized?
[ ... ]
True but this is fixed in one of the subsequent patches where the regmap usage is introduced.
Quoted 32 lines
drivers/rtc/rtc-abx80x.c static int abx80x_probe(struct i2c_client *client) · line 932
Quoted 12 lines
drivers/rtc/rtc-abx80x.c +3
-3@@ -921,19 +925,19 @@ static int abx80x_probe(struct i2c_client *client)if (err)return err; -if (client->irq >0 ) { -dev_info (&client->dev,"IRQ %d supplied\n" , client->irq); - err = devm_request_threaded_irq(&client->dev, client->irq, NULL, +if (priv->irq >0 ) { +dev_info (&client->dev,"IRQ %d supplied\n" , priv->irq); + err = devm_request_threaded_irq(&client->dev, priv->irq, NULL, abx80x_handle_irq, IRQF_SHARED | IRQF_ONESHOT,[Severity: High]
This isn't a bug introduced by this patch, but since the IRQ is registered here withIRQF_SHARED, doesabx80x_handle_irq()correctly handle shared interrupts?Looking at drivers/rtc/rtc-abx80x.c:abx80x_handle_irq():
static
irqreturn_tabx80x_handle_irq(int irq, void *dev_id){ [ ... ] status = i2c_smbus_read_byte_data(client, ABX8XX_REG_STATUS); if (status < 0) return IRQ_NONE; [ ... ] i2c_smbus_write_byte_data(client, ABX8XX_REG_STATUS, 0); return IRQ_HANDLED; }
Quoted 5 lines
If no relevant interrupt flags are set for this device, it still returns
IRQ_HANDLEDand writes 0 toABX8XX_REG_STATUS, clearing all status bits including non-IRQ bits like BLF. Can this break other devices sharing the interrupt line and silently drop hardware status flags?
Yeah so this looks like a genuine bug and should be fixed in a separate patch I guess. In REG_STATUS we should only clear the bits AF or WDT if they were set.
Quoted 5 lines
Quoted 2 lines
drivers/rtc/rtc-abx80x.c +0
-0"abx8xx" , client);Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
PATCH 3/6 rtc: abx80x: use regmap instead of I2C specific API
In reply to Antoni PokusinskiRework the driver so that it uses regmap_* functions for communication with the device instead of the i2c_smbus_* API. This way the support for ABX81X RTCs which use SPI can be added later.
--- drivers/rtc/Kconfig | 1 + drivers/rtc/rtc-abx80x.c | 331 +++++++++++++++++++++------------------ 2 files changed, 180 insertions(+), 152 deletions(-)
drivers/rtc/Kconfig +1 -0
@@ -215,6 +215,7 @@ config RTC_DRV_ABEOZ9 config RTC_DRV_ABX80X tristate "Abracon ABx80x" select WATCHDOG_CORE if WATCHDOG + select REGMAP_I2C help If you say yes here you get support for Abracon AB080X and AB180X families of ultra-low-power battery- and capacitor-backed real-time
drivers/rtc/rtc-abx80x.c +179 -152
674 lines not on this page · raw message
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH 3/6] rtc: abx80x: use regmap instead of I2C specific API
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] Hardware unlock sequence is broken by read-modify-write inversion - [Low] Incompatible pointer…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Hardware unlock sequence is broken by read-modify-write inversion
- [Low] Incompatible pointer types passed to regmap_read()
--
--- Patch [3]: [PATCH 3/6] rtc: abx80x: use regmap instead of I2C specific API --- commit 97cd1f33d168c96f848a8f59ba284bfe9c5f89fe
Author: Antoni Pokusinski <[email protected]> Date: Wed Jul 22 19:58:11 2026 +0000
rtc: abx80x: use regmap instead of I2C specific API
Rework the driver so that it uses regmap_* functions for communication with the device instead of the i2c_smbus_* API. This way the support for ABX81X RTCs which use SPI can be added later.
Quoted 5 lines
drivers/rtc/rtc-abx80x.c +0
-0@@ -125,52 +126,53 @@ static struct abx80x_cap abx80x_caps[] = {
[ ... ]
drivers/rtc/rtc-abx80x.c static struct abx80x_cap abx80x_caps[] = { · line 151
Quoted 13 lines
drivers/rtc/rtc-abx80x.c +4
-7-static int abx80x_is_rc_mode (struct i2c_client *client) +static int abx80x_is_rc_mode (struct device *dev) { -int flags =0 ; +struct abx80x_priv *priv =dev_get_drvdata (dev); +int err, flags =0 ; - flags =i2c_smbus_read_byte_data (client,ABX8XX_REG_OSS ); -if (flags <0 ) { -dev_err (&client->dev, -"Failed to read autocalibration attribute\n" ); -return flags; + err =regmap_read (priv->regmap,ABX8XX_REG_OSS , &flags);
[Severity: Low]
Does this pass an incompatible pointer type to regmap_read()?
The API signature of regmap_read() expects an unsigned int * for its third argument, but the address of a local int variable (&flags) is passed here. While this may not cause memory corruption since int and unsigned int are the same size, it violates the function signature and generates -Wincompatible-pointer-types warnings, which can break builds compiling with -Werror.
Quoted 4 lines
drivers/rtc/rtc-abx80x.c +3
-0+if (err <0 ) { +dev_err (dev,"Failed to read autocalibration attribute\n" ); +return err; }
[ ... ]
Quoted 5 lines
drivers/rtc/rtc-abx80x.c +0
-1@@ -259,13 +260,13 @@ static int abx80x_rtc_set_time(struct device *dev, struct rtc_time *tm)static irqreturn_t abx80x_handle_irq (int irq,void *dev_id) { -struct i2c_client *client = dev_id;
drivers/rtc/rtc-abx80x.c static int abx80x_rtc_set_time(struct device *dev, struct rtc_time *tm) · line 268
Quoted 10 lines
drivers/rtc/rtc-abx80x.c +4
-4-struct abx80x_priv *priv =i2c_get_clientdata (client); +struct device *dev = dev_id; +struct abx80x_priv *priv =dev_get_drvdata (dev);struct rtc_device *rtc = priv->rtc; -int status; +int err, status; - status =i2c_smbus_read_byte_data (client,ABX8XX_REG_STATUS ); -if (status <0 ) + err =regmap_read (priv->regmap,ABX8XX_REG_STATUS , &status);
[Severity: Low]
Does this pass an incompatible pointer type to regmap_read()?
Similar to abx80x_is_rc_mode() above, this passes an int pointer (&status) instead of an unsigned int pointer.
Quoted 2 lines
drivers/rtc/rtc-abx80x.c +1
-0+if (err <0 )return IRQ_NONE ;
[ ... ]
Quoted 4 lines
drivers/rtc/rtc-abx80x.c +0
-0@@ -294,14 +294,13 @@ static int abx80x_read_alarm(struct device *dev, struct rtc_wkalrm *t)if (priv->irq <=0 )return -EINVAL ;
drivers/rtc/rtc-abx80x.c static int abx80x_read_alarm(struct device *dev, struct rtc_wkalrm *t) · line 301
Quoted 10 lines
drivers/rtc/rtc-abx80x.c +2
-5- err =i2c_smbus_read_i2c_block_data (client,ABX8XX_REG_ASC , -sizeof (buf), buf); + err =regmap_bulk_read (priv->regmap,ABX8XX_REG_ASC , buf,sizeof (buf));if (err)return err; - irq_mask =i2c_smbus_read_byte_data (client,ABX8XX_REG_IRQ ); -if (irq_mask <0 ) -return irq_mask; + err =regmap_read (priv->regmap,ABX8XX_REG_IRQ , &irq_mask);
[Severity: Low]
Does this pass an incompatible pointer type to regmap_read()?
This passes an int pointer (&irq_mask) instead of an unsigned int pointer.
Quoted 2 lines
drivers/rtc/rtc-abx80x.c +2
-0+if (err <0 ) +return err;
[ ... ]
drivers/rtc/rtc-abx80x.c static int abx80x_rtc_set_autocalibration(struct device *dev, · line 382
Quoted 10 lines
drivers/rtc/rtc-abx80x.c +2
-2@@ -379,22 +376,22 @@ static int abx80x_rtc_set_autocalibration(struct device *dev, }/* Unlock write access to Oscillator Control Register */ -if (abx80x_write_config_key (client,ABX8XX_CFG_KEY_OSC ) <0 ) +if (abx80x_write_config_key (dev,ABX8XX_CFG_KEY_OSC ) <0 )return -EIO ; - retval =i2c_smbus_write_byte_data (client,ABX8XX_REG_OSC , flags); + retval =regmap_write (priv->regmap,ABX8XX_REG_OSC , flags);
[Severity: High]
Does this hardware unlock sequence get broken by read-modify-write inversion?
According to the datasheet, any subsequent I2C access (read or write) resets the configuration key to zero. If this sequence uses a read-modify-write operation (such as regmap_write_bits()), a hardware read is performed after the unlock key is written. This read resets the configuration key, causing the hardware to ignore the subsequent write and breaking features like autocalibration.
Quoted 5 lines
drivers/rtc/rtc-abx80x.c +0
-0return retval; }static int abx80x_rtc_get_autocalibration (struct device *dev)
drivers/rtc/rtc-abx80x.c static int abx80x_rtc_set_autocalibration(struct device *dev, · line 392
Quoted 10 lines
drivers/rtc/rtc-abx80x.c +3
-5{ -struct i2c_client *client =to_i2c_client (dev); -int flags =0 , autocalibration; +struct abx80x_priv *priv =dev_get_drvdata (dev); +int flags =0 , autocalibration, err; - flags =i2c_smbus_read_byte_data (client,ABX8XX_REG_OSC ); -if (flags <0 ) -return flags; + err =regmap_read (priv->regmap,ABX8XX_REG_OSC , &flags);
[Severity: Low]
Does this pass an incompatible pointer type to regmap_read()?
This passes an int pointer (&flags) instead of an unsigned int pointer.
Quoted 2 lines
drivers/rtc/rtc-abx80x.c +2
-0+if (err <0 ) +return err;
[ ... ]
drivers/rtc/rtc-abx80x.c static ssize_t oscillator_store(struct device *dev, · line 470
Quoted 10 lines
drivers/rtc/rtc-abx80x.c +2
-2@@ -467,10 +464,10 @@ static ssize_t oscillator_store(struct device *dev, flags |= (ABX8XX_OSC_OSEL );/* Unlock write access on Oscillator Control register */ -if (abx80x_write_config_key (client,ABX8XX_CFG_KEY_OSC ) <0 ) +if (abx80x_write_config_key (dev->parent,ABX8XX_CFG_KEY_OSC ) <0 )return -EIO ; - retval =i2c_smbus_write_byte_data (client,ABX8XX_REG_OSC , flags); + retval =regmap_write (priv->regmap,ABX8XX_REG_OSC , flags);
[Severity: High]
Does this hardware unlock sequence get broken by read-modify-write inversion?
As noted in abx80x_rtc_set_autocalibration() above, a hardware read performed after the unlock key is written clears the key. This resets the key before the protected write if a read-modify-write operation like regmap_write_bits() is used.
Quoted 2 lines
drivers/rtc/rtc-abx80x.c +0
-0if (retval <0 ) {dev_err (dev,"Failed to write Oscillator Control register\n" );
[ ... ]
Quoted 4 lines
drivers/rtc/rtc-abx80x.c +0
-0@@ -513,45 +509,43 @@ static const struct attribute_group rtc_calib_attr_group = {static int abx80x_alarm_irq_enable (struct device *dev,unsigned int enabled) {
[ ... ]
drivers/rtc/rtc-abx80x.c static const struct attribute_group rtc_calib_attr_group = { · line 531
Quoted 13 lines
static int
abx80x_ioctl(struct device *dev, unsigned int cmd, unsigned long arg){drivers/rtc/rtc-abx80x.c +3
-5-struct i2c_client *client =to_i2c_client (dev); -int status, tmp; +struct abx80x_priv *priv =dev_get_drvdata (dev); +int err, status, tmp;switch (cmd) {case RTC_VL_READ : - status =i2c_smbus_read_byte_data (client,ABX8XX_REG_STATUS ); -if (status <0 ) -return status; + err =regmap_read (priv->regmap,ABX8XX_REG_STATUS , &status);
[Severity: Low]
Does this pass an incompatible pointer type to regmap_read()?
This passes an int pointer (&status) instead of an unsigned int pointer.
Quoted 2 lines
drivers/rtc/rtc-abx80x.c +2
-0+if (err <0 ) +return err;
[ ... ]
drivers/rtc/rtc-abx80x.c static int abx80x_probe(struct i2c_client *client) · line 905
Quoted 12 lines
drivers/rtc/rtc-abx80x.c +3
-3@@ -856,11 +898,11 @@ static int abx80x_probe(struct i2c_client *client)* Write the configuration key register to enable access to * the config2 register */ -if (abx80x_write_config_key (client,ABX8XX_CFG_KEY_MISC ) <0 ) +if (abx80x_write_config_key (&client->dev,ABX8XX_CFG_KEY_MISC ) <0 )return -EIO ; - err =i2c_smbus_write_byte_data (client,ABX8XX_REG_OUT_CTRL , - data |ABX8XX_OUT_CTRL_EXDS ); + err =regmap_write (regmap,ABX8XX_REG_OUT_CTRL , + data |ABX8XX_OUT_CTRL_EXDS );
[Severity: High]
Does this hardware unlock sequence get broken by read-modify-write inversion?
For RV1805, the key is written, but if a read-modify-write operation like regmap_write_bits() is used here, it performs a read before writing the EXTI disable bit. This read clears the key, leaving the write ineffective and defeating the extra power leakage workaround.
Quoted 3 lines
drivers/rtc/rtc-abx80x.c +0
-0if (err <0 ) {dev_err (&client->dev,"Unable to write output control register\n" );
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
Re: [PATCH 3/6] rtc: abx80x: use regmap instead of I2C specific API
Quoted 70 lines · On Wed, Jul 22, 2026 at 08:16:45PM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Hardware unlock sequence is broken by read-modify-write inversion
- [Low] Incompatible pointer types passed toregmap_read()
----- Patch [3]: [PATCH 3/6] rtc: abx80x: use regmap instead of I2C specific API --- commit
97cd1f33d168c96f848a8f59ba284bfe9c5f89feAuthor: Antoni Pokusinski <[email protected]> Date: Wed Jul 22 19:58:11 2026 +0000rtc: abx80x: use regmap instead of I2C specific API
Rework the driver so that it uses regmap_* functions for communication with the device instead of the i2c_smbus_* API. This way the support for ABX81X RTCs which use SPI can be added later.
Quoted 5 lines
drivers/rtc/rtc-abx80x.c +0
-0@@ -125,52 +126,53 @@ static struct abx80x_cap abx80x_caps[] = {[ ... ]
drivers/rtc/rtc-abx80x.c static struct abx80x_cap abx80x_caps[] = { · line 151
Quoted 13 lines
drivers/rtc/rtc-abx80x.c +4
-7-static int abx80x_is_rc_mode (struct i2c_client *client) +static int abx80x_is_rc_mode (struct device *dev) { -int flags =0 ; +struct abx80x_priv *priv =dev_get_drvdata (dev); +int err, flags =0 ; - flags =i2c_smbus_read_byte_data (client,ABX8XX_REG_OSS ); -if (flags <0 ) { -dev_err (&client->dev, -"Failed to read autocalibration attribute\n" ); -return flags; + err =regmap_read (priv->regmap,ABX8XX_REG_OSS , &flags);[Severity: Low]
Does this pass an incompatible pointer type toregmap_read()?The API signature of
regmap_read()expects an unsigned int * for its third argument, but the address of a local int variable (&flags) is passed here. While this may not cause memory corruption since int and unsigned int are the same size, it violates the function signature and generates(quoted diff) +0
-2-Wincompatible-pointer-types warnings, which can break builds compiling with -Werror.Quoted 5 lines
drivers/rtc/rtc-abx80x.c +3
-0+if (err <0 ) { +dev_err (dev,"Failed to read autocalibration attribute\n" ); +return err; }[ ... ]
Quoted 5 lines
drivers/rtc/rtc-abx80x.c +0
-1@@ -259,13 +260,13 @@ static int abx80x_rtc_set_time(struct device *dev, struct rtc_time *tm)static irqreturn_t abx80x_handle_irq (int irq,void *dev_id) { -struct i2c_client *client = dev_id;drivers/rtc/rtc-abx80x.c static int abx80x_rtc_set_time(struct device *dev, struct rtc_time *tm) · line 268
Quoted 10 lines
drivers/rtc/rtc-abx80x.c +4
-4-struct abx80x_priv *priv =i2c_get_clientdata (client); +struct device *dev = dev_id; +struct abx80x_priv *priv =dev_get_drvdata (dev);struct rtc_device *rtc = priv->rtc; -int status; +int err, status; - status =i2c_smbus_read_byte_data (client,ABX8XX_REG_STATUS ); -if (status <0 ) + err =regmap_read (priv->regmap,ABX8XX_REG_STATUS , &status);[Severity: Low]
Does this pass an incompatible pointer type toregmap_read()?
Quoted 3 lines
Similar to
abx80x_is_rc_mode()above, this passes an int pointer (&status) instead of an unsigned int pointer.
I don't think it matters in all these cases, but I could make these values unsigned int just to maintain the pointer type compatibility.
Quoted 40 lines
Quoted 2 lines
drivers/rtc/rtc-abx80x.c +1
-0+if (err <0 )return IRQ_NONE ;[ ... ]
Quoted 4 lines
drivers/rtc/rtc-abx80x.c +0
-0@@ -294,14 +294,13 @@ static int abx80x_read_alarm(struct device *dev, struct rtc_wkalrm *t)if (priv->irq <=0 )return -EINVAL ;drivers/rtc/rtc-abx80x.c static int abx80x_read_alarm(struct device *dev, struct rtc_wkalrm *t) · line 301
Quoted 10 lines
drivers/rtc/rtc-abx80x.c +2
-5- err =i2c_smbus_read_i2c_block_data (client,ABX8XX_REG_ASC , -sizeof (buf), buf); + err =regmap_bulk_read (priv->regmap,ABX8XX_REG_ASC , buf,sizeof (buf));if (err)return err; - irq_mask =i2c_smbus_read_byte_data (client,ABX8XX_REG_IRQ ); -if (irq_mask <0 ) -return irq_mask; + err =regmap_read (priv->regmap,ABX8XX_REG_IRQ , &irq_mask);[Severity: Low]
Does this pass an incompatible pointer type toregmap_read()?This passes an int pointer (
&irq_mask) instead of an unsigned int pointer.Quoted 2 lines
drivers/rtc/rtc-abx80x.c +2
-0+if (err <0 ) +return err;[ ... ]
drivers/rtc/rtc-abx80x.c static int abx80x_rtc_set_autocalibration(struct device *dev, · line 382
Quoted 10 lines
drivers/rtc/rtc-abx80x.c +2
-2@@ -379,22 +376,22 @@ static int abx80x_rtc_set_autocalibration(struct device *dev, }/* Unlock write access to Oscillator Control Register */ -if (abx80x_write_config_key (client,ABX8XX_CFG_KEY_OSC ) <0 ) +if (abx80x_write_config_key (dev,ABX8XX_CFG_KEY_OSC ) <0 )return -EIO ; - retval =i2c_smbus_write_byte_data (client,ABX8XX_REG_OSC , flags); + retval =regmap_write (priv->regmap,ABX8XX_REG_OSC , flags);[Severity: High]
Does this hardware unlock sequence get broken by read-modify-write inversion?
Quoted 7 lines
According to the datasheet, any subsequent I2C access (read or write) resets the configuration key to zero. If this sequence uses a read-modify-write operation (such as
regmap_write_bits()), a hardware read is performed after the unlock key is written. This read resets the configuration key, causing the hardware to ignore the subsequent write and breaking features like autocalibration.
I see no issue here. The datasheet clearly states that
"CONFKEY is reset to 0x00 on any register **write**". I experienced no issues with the current version of the driver when testing it on AB1815 hardware.
(this comment also applies to the other read-modify-write "bug" reports by sashiko in this patch series)
PATCH 4/6 rtc: abx80x: replace read-modify-write pattern with regmap helpers
In reply to Antoni PokusinskiBefore introducing the regmap usage in the driver, updating specific bits of a register was performed using the read-modify-write pattern. Now, the functions regmap_update_bits() and regmap_write_bits() can be used to simplify the code.
--- drivers/rtc/rtc-abx80x.c | 105 +++++++++++---------------------------- 1 file changed, 28 insertions(+), 77 deletions(-)
drivers/rtc/rtc-abx80x.c +28 -77
@@ -222,7 +222,7 @@ static int abx80x_rtc_set_time(struct device *dev, struct rtc_time *tm) {struct abx80x_priv *priv =dev_get_drvdata (dev);unsigned char buf[8 ]; -int err, flags; +int err;if (tm->tm_year <100 )return -EINVAL ;
@@ -244,18 +244,11 @@ static int abx80x_rtc_set_time(struct device *dev, struct rtc_time *tm) }/* Clear the OF bit of Oscillator Status Register */ - err =regmap_read (priv->regmap,ABX8XX_REG_OSS , &flags); + err =regmap_update_bits (priv->regmap,ABX8XX_REG_OSS ,ABX8XX_OSS_OF ,0 );if (err <0 ) -return err; - - err =regmap_write (priv->regmap,ABX8XX_REG_OSS , - flags & ~ABX8XX_OSS_OF ); -if (err <0 ) {dev_err (dev,"Unable to write oscillator status register\n" ); -return err; - } -return 0 ; +return err; }static irqreturn_t abx80x_handle_irq (int irq,void *dev_id)
@@ -352,7 +345,7 @@ static int abx80x_rtc_set_autocalibration(struct device *dev, int autocalibration) {struct abx80x_priv *priv =dev_get_drvdata (dev); -int retval, flags =0 ; +int flags =0 ;if ((autocalibration !=0 ) && (autocalibration !=1024 ) && (autocalibration !=512 )) {
@@ -360,10 +353,6 @@ static int abx80x_rtc_set_autocalibration(struct device *dev,return -EINVAL ; } - retval =regmap_read (priv->regmap,ABX8XX_REG_OSC , &flags); -if (retval <0 ) -return retval; -if (autocalibration ==0 ) { flags &= ~(ABX8XX_OSC_ACAL_512 |ABX8XX_OSC_ACAL_1024 ); }else if (autocalibration ==1024 ) {
@@ -379,9 +368,9 @@ static int abx80x_rtc_set_autocalibration(struct device *dev,if (abx80x_write_config_key (dev,ABX8XX_CFG_KEY_OSC ) <0 )return -EIO ; - retval =regmap_write (priv->regmap,ABX8XX_REG_OSC , flags); - -return retval; +return regmap_write_bits (priv->regmap,ABX8XX_REG_OSC , +ABX8XX_OSC_ACAL_1024 |ABX8XX_OSC_ACAL_512 , + flags); }static int abx80x_rtc_get_autocalibration (struct device *dev)
@@ -443,7 +432,7 @@ static ssize_t oscillator_store(struct device *dev, const char *buf, size_t count) {struct abx80x_priv *priv =dev_get_drvdata (dev->parent); -int retval, flags, rc_mode =0 ; +int retval, rc_mode =0 ;if (strncmp (buf,"rc" ,2 ) ==0 ) { rc_mode =1 ;
@@ -454,24 +443,14 @@ static ssize_t oscillator_store(struct device *dev,return -EINVAL ; } - retval =regmap_read (priv->regmap,ABX8XX_REG_OSC , &flags); -if (retval <0 ) -return retval; - -if (rc_mode ==0 ) - flags &= ~(ABX8XX_OSC_OSEL ); -else - flags |= (ABX8XX_OSC_OSEL ); -/* Unlock write access on Oscillator Control register */ if (abx80x_write_config_key (dev->parent,ABX8XX_CFG_KEY_OSC ) <0 )return -EIO ; - retval =regmap_write (priv->regmap,ABX8XX_REG_OSC , flags); -if (retval <0 ) { + retval =regmap_write_bits (priv->regmap,ABX8XX_REG_OSC ,ABX8XX_OSC_OSEL , + rc_mode ==0 ?0 : (ABX8XX_OSC_OSEL )); +if (retval <0 )dev_err (dev,"Failed to write Oscillator Control register\n" ); -return retval; - }return retval ? retval : count; }
@@ -537,17 +516,8 @@ static int abx80x_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)return put_user (tmp, (unsigned int __user *)arg);case RTC_VL_CLR : - err =regmap_read (priv->regmap,ABX8XX_REG_STATUS , &status); -if (err <0 ) -return err; - - status &= ~ABX8XX_STATUS_BLF ; - - err =regmap_write (priv->regmap,ABX8XX_REG_STATUS , status); -if (err <0 ) -return err; - -return 0 ; +return regmap_update_bits (priv->regmap,ABX8XX_REG_STATUS , +ABX8XX_STATUS_BLF ,0 );default :return -ENOIOCTLCMD ;
@@ -799,7 +769,7 @@ static int abx80x_probe(struct i2c_client *client)struct regmap *regmap;struct device_node *np = client->dev.of_node;struct abx80x_priv *priv; -int i, data, err, trickle_cfg = -EINVAL ; +int i, err, trickle_cfg = -EINVAL ;char buf[7 ];unsigned int part = (uintptr_t )i2c_get_match_data (client);unsigned int partnumber;
@@ -846,14 +816,9 @@ static int abx80x_probe(struct i2c_client *client)dev_info (&client->dev,"model %04x, revision %u.%u, lot %x, wafer %x, uid %x\n" , partnumber, majrev, minrev, lot, wafer, uid); - err =regmap_read (regmap,ABX8XX_REG_CTRL1 , &data); -if (err <0 ) { -dev_err (&client->dev,"Unable to read control register\n" ); -return -EIO ; - } - - err =regmap_write (regmap,ABX8XX_REG_CTRL1 , - (data & ~(ABX8XX_CTRL_12_24 |ABX8XX_CTRL_ARST )) |ABX8XX_CTRL_WRITE ); + err =regmap_update_bits (regmap,ABX8XX_REG_CTRL1 , +ABX8XX_CTRL_12_24 |ABX8XX_CTRL_ARST |ABX8XX_CTRL_WRITE , +ABX8XX_CTRL_WRITE );if (err <0 ) {dev_err (&client->dev,"Unable to write control register\n" );return -EIO ;
@@ -867,30 +832,10 @@ static int abx80x_probe(struct i2c_client *client)* register is set. RV-1805-C3 datasheet indicates that * the bit should be cleared in section 11h - Control2. */ - err =regmap_read (regmap,ABX8XX_REG_CTRL2 , &data); -if (err <0 ) { -dev_err (&client->dev, -"Unable to read control2 register\n" ); -return -EIO ; - } - - err =regmap_write (regmap,ABX8XX_REG_CTRL2 , - data & ~ABX8XX_CTRL2_RSVD ); -if (err <0 ) { -dev_err (&client->dev, -"Unable to write control2 register\n" ); -return -EIO ; - } - -/* -* Avoid extra power leakage. The RV1805 uses smaller -* 10pin package and the EXTI input is not present. -* Disable it to avoid leakage. -*/ - err =regmap_read (regmap,ABX8XX_REG_OUT_CTRL , &data); + err =regmap_update_bits (regmap,ABX8XX_REG_CTRL2 , +ABX8XX_CTRL2_RSVD ,0 );if (err <0 ) { -dev_err (&client->dev, -"Unable to read output control register\n" ); +dev_err (&client->dev,"Unable to write control2 register\n" );return -EIO ; }
@@ -901,8 +846,14 @@ static int abx80x_probe(struct i2c_client *client)if (abx80x_write_config_key (&client->dev,ABX8XX_CFG_KEY_MISC ) <0 )return -EIO ; - err =regmap_write (regmap,ABX8XX_REG_OUT_CTRL , - data |ABX8XX_OUT_CTRL_EXDS ); +/* +* Avoid extra power leakage. The RV1805 uses smaller +* 10pin package and the EXTI input is not present. +* Disable it to avoid leakage. +*/ + err =regmap_write_bits (regmap,ABX8XX_REG_OUT_CTRL , +ABX8XX_OUT_CTRL_EXDS , +ABX8XX_OUT_CTRL_EXDS );if (err <0 ) {dev_err (&client->dev,"Unable to write output control register\n" );
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH 4/6] rtc: abx80x: replace read-modify-write pattern with regmap helpers
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Replacing manual read-modify-write patterns with `regmap_write_bits()` or `regmap_update_bits()`…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Replacing manual read-modify-write patterns with regmap_write_bits() or regmap_update_bits() breaks the hardware's unlock sequence because they inject an implicit I2C read between unlocking the configuration key and the actual write, causing the hardware to re-lock the register. --
--- Patch [4]: [PATCH 4/6] rtc: abx80x: replace read-modify-write pattern with regmap helpers --- commit ac40d4eea0cf607d67d28eb1332803662646f9c2
Author: Antoni Pokusinski <[email protected]>
rtc: abx80x: replace read-modify-write pattern with regmap helpers
This patch refactors the driver to use regmap_update_bits() and regmap_write_bits() instead of manually reading, modifying, and writing registers. The goal is to simplify the codebase.
Quoted 4 lines
drivers/rtc/rtc-abx80x.c +0
-0
[ ... ]
drivers/rtc/rtc-abx80x.c static int abx80x_rtc_set_autocalibration(struct device *dev, · line 373
Quoted 10 lines
drivers/rtc/rtc-abx80x.c +3
-3@@ -379,9 +368,9 @@ static int abx80x_rtc_set_autocalibration(struct device *dev,if (abx80x_write_config_key (dev,ABX8XX_CFG_KEY_OSC ) <0 )return -EIO ; - retval =regmap_write (priv->regmap,ABX8XX_REG_OSC , flags); - -return retval; +return regmap_write_bits (priv->regmap,ABX8XX_REG_OSC , +ABX8XX_OSC_ACAL_1024 |ABX8XX_OSC_ACAL_512 , + flags);
[Severity: High]
Does replacing regmap_write() with regmap_write_bits() here break the hardware's unlock sequence?
The regmap_write_bits() function performs an implicit read before writing. Because it is called immediately after abx80x_write_config_key(), this injects an I2C read between unlocking the configuration key and the actual write.
Since the AB08XX/RV1805 RTC requires the protected register write to be the very next transaction after the configuration key write, won't this read clear the unlock state and cause the hardware to silently discard the write?
Quoted 3 lines
drivers/rtc/rtc-abx80x.c +0
-0}static int abx80x_rtc_get_autocalibration (struct device *dev)
[ ... ]
Quoted 11 lines
drivers/rtc/rtc-abx80x.c +0
-7@@ -454,24 +443,14 @@ static ssize_t oscillator_store(struct device *dev,return -EINVAL ; } - retval =regmap_read (priv->regmap,ABX8XX_REG_OSC , &flags); -if (retval <0 ) -return retval; - -if (rc_mode ==0 ) - flags &= ~(ABX8XX_OSC_OSEL ); -else
drivers/rtc/rtc-abx80x.c static ssize_t oscillator_store(struct device *dev, · line 451
Quoted 10 lines
drivers/rtc/rtc-abx80x.c +2
-4- flags |= (ABX8XX_OSC_OSEL ); -/* Unlock write access on Oscillator Control register */ if (abx80x_write_config_key (dev->parent,ABX8XX_CFG_KEY_OSC ) <0 )return -EIO ; - retval =regmap_write (priv->regmap,ABX8XX_REG_OSC , flags); -if (retval <0 ) { + retval =regmap_write_bits (priv->regmap,ABX8XX_REG_OSC ,ABX8XX_OSC_OSEL , + rc_mode ==0 ?0 : (ABX8XX_OSC_OSEL ));
[Severity: High]
Could the implicit read introduced by regmap_write_bits() cause the hardware to re-lock the register?
As with abx80x_rtc_set_autocalibration(), the injected read operation occurs after unlocking the configuration key with abx80x_write_config_key(), which disrupts the sequence required to successfully write to the Oscillator Control register.
Quoted 7 lines
drivers/rtc/rtc-abx80x.c +1
-2+if (retval <0 )dev_err (dev,"Failed to write Oscillator Control register\n" ); -return retval; - }return retval ? retval : count; }
[ ... ]
Quoted 4 lines
drivers/rtc/rtc-abx80x.c +0
-0@@ -901,8 +846,14 @@ static int abx80x_probe(struct i2c_client *client)if (abx80x_write_config_key (&client->dev,ABX8XX_CFG_KEY_MISC ) <0 )return -EIO ;
drivers/rtc/rtc-abx80x.c static int abx80x_probe(struct i2c_client *client) · line 856
Quoted 10 lines
drivers/rtc/rtc-abx80x.c +8
-2- err =regmap_write (regmap,ABX8XX_REG_OUT_CTRL , - data |ABX8XX_OUT_CTRL_EXDS ); +/* +* Avoid extra power leakage. The RV1805 uses smaller +* 10pin package and the EXTI input is not present. +* Disable it to avoid leakage. +*/ + err =regmap_write_bits (regmap,ABX8XX_REG_OUT_CTRL , +ABX8XX_OUT_CTRL_EXDS , +ABX8XX_OUT_CTRL_EXDS );
[Severity: High]
Is it possible that the OUT_CTRL EXDS bit configuration silently fails here?
Since regmap_write_bits() performs a read under the hood, placing it directly after the abx80x_write_config_key() unlock command interrupts the required write sequence, causing the hardware to discard the write operation.
Quoted 3 lines
drivers/rtc/rtc-abx80x.c +0
-0if (err <0 ) {dev_err (&client->dev,"Unable to write output control register\n" );
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
PATCH 5/6 rtc: abx80x: create abx80x_i2c_probe()
In reply to Antoni PokusinskiMove the I2C-specific code from abx80x_probe() to the newly created function. This is a preparation for introducing the support for ABX81X RTCs which use SPI interface.
--- drivers/rtc/rtc-abx80x.c | 165 ++++++++++++++++++++++++--------------- 1 file changed, 102 insertions(+), 63 deletions(-)
drivers/rtc/rtc-abx80x.c +102 -63
@@ -740,70 +740,35 @@ static const struct regmap_access_table abx80x_write_table = { .n_no_ranges = ARRAY_SIZE(abx80x_no_write_ranges), }; -static const struct regmap_config abx80x_regmap_config_i2c = { - .reg_bits =8 , - .val_bits =8 , - .max_register =ABX8XX_SRAM_BASE +ABX8XX_SRAM_WIN_SIZE -1 , - - .rd_table = &abx80x_read_table, - .wr_table = &abx80x_write_table, -}; - -static const struct i2c_device_id abx80x_id[] = { - { .name ="abx80x" , .driver_data =ABX80X }, - { .name ="ab0801" , .driver_data =AB0801 }, - { .name ="ab0803" , .driver_data =AB0803 }, - { .name ="ab0804" , .driver_data =AB0804 }, - { .name ="ab0805" , .driver_data =AB0805 }, - { .name ="ab1801" , .driver_data =AB1801 }, - { .name ="ab1803" , .driver_data =AB1803 }, - { .name ="ab1804" , .driver_data =AB1804 }, - { .name ="ab1805" , .driver_data =AB1805 }, - { .name ="rv1805" , .driver_data =RV1805 }, - { } -}; -MODULE_DEVICE_TABLE (i2c, abx80x_id); - -static int abx80x_probe (struct i2c_client *client) +static int abx80x_probe (struct device *dev,struct regmap *regmap,int irq, +struct device_node *np,unsigned int part) { -struct regmap *regmap; -struct device_node *np = client->dev.of_node;struct abx80x_priv *priv;int i, err, trickle_cfg = -EINVAL ;char buf[7 ]; -unsigned int part = (uintptr_t )i2c_get_match_data (client);unsigned int partnumber;unsigned int majrev, minrev;unsigned int lot;unsigned int wafer;unsigned int uid; -if (!i2c_check_functionality (client->adapter,I2C_FUNC_I2C )) -return -ENODEV ; - - regmap =devm_regmap_init_i2c (client, &abx80x_regmap_config_i2c); -if (IS_ERR (regmap)) { -dev_err (&client->dev,"Unable to allocate regmap\n" ); -return -EIO ; - } - - priv =devm_kzalloc (&client->dev,sizeof (*priv),GFP_KERNEL ); + priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL );if (priv ==NULL )return -ENOMEM ; - priv->rtc =devm_rtc_allocate_device (&client->dev); + priv->rtc =devm_rtc_allocate_device (dev);if (IS_ERR (priv->rtc))return PTR_ERR (priv->rtc); priv->rtc->ops = &abx80x_rtc_ops; - priv->irq = client->irq; + priv->irq = irq; priv->regmap = regmap; -dev_set_drvdata (&client->dev, priv); +dev_set_drvdata (dev, priv); err =regmap_bulk_read (regmap,ABX8XX_REG_ID0 , buf,sizeof (buf));if (err <0 ) { -dev_err (&client->dev,"Unable to read partnumber\n" ); +dev_err (dev,"Unable to read partnumber\n" );return -EIO ; }
@@ -813,14 +778,14 @@ static int abx80x_probe(struct i2c_client *client) lot = ((buf[4 ] &0x80 ) <<2 ) | ((buf[6 ] &0x80 ) <<1 ) | buf[3 ]; uid = ((buf[4 ] &0x7f ) <<8 ) | buf[5 ]; wafer = (buf[6 ] &0x7c ) >>2 ; -dev_info (&client->dev,"model %04x, revision %u.%u, lot %x, wafer %x, uid %x\n" , +dev_info (dev,"model %04x, revision %u.%u, lot %x, wafer %x, uid %x\n" , partnumber, majrev, minrev, lot, wafer, uid); err =regmap_update_bits (regmap,ABX8XX_REG_CTRL1 ,ABX8XX_CTRL_12_24 |ABX8XX_CTRL_ARST |ABX8XX_CTRL_WRITE ,ABX8XX_CTRL_WRITE );if (err <0 ) { -dev_err (&client->dev,"Unable to write control register\n" ); +dev_err (dev,"Unable to write control register\n" );return -EIO ; }
@@ -835,7 +800,7 @@ static int abx80x_probe(struct i2c_client *client) err =regmap_update_bits (regmap,ABX8XX_REG_CTRL2 ,ABX8XX_CTRL2_RSVD ,0 );if (err <0 ) { -dev_err (&client->dev,"Unable to write control2 register\n" ); +dev_err (dev,"Unable to write control2 register\n" );return -EIO ; }
@@ -843,7 +808,7 @@ static int abx80x_probe(struct i2c_client *client)* Write the configuration key register to enable access to * the config2 register */ -if (abx80x_write_config_key (&client->dev,ABX8XX_CFG_KEY_MISC ) <0 ) +if (abx80x_write_config_key (dev,ABX8XX_CFG_KEY_MISC ) <0 )return -EIO ;/*
@@ -855,7 +820,7 @@ static int abx80x_probe(struct i2c_client *client)ABX8XX_OUT_CTRL_EXDS , ABX8XX_OUT_CTRL_EXDS);if (err <0 ) { -dev_err (&client->dev, +dev_err (dev,"Unable to write output control register\n" );return -EIO ; }
@@ -867,26 +832,24 @@ static int abx80x_probe(struct i2c_client *client)if (partnumber == abx80x_caps[i].pn)break ;if (abx80x_caps[i].pn ==0 ) { -dev_err (&client->dev,"Unknown part: %04x\n" , - partnumber); +dev_err (dev,"Unknown part: %04x\n" , partnumber);return -EINVAL ; } part = i; }if (partnumber != abx80x_caps[part].pn) { -dev_err (&client->dev,"partnumber mismatch %04x != %04x\n" , +dev_err (dev,"partnumber mismatch %04x != %04x\n" , partnumber, abx80x_caps[part].pn);return -EINVAL ; }if (np && abx80x_caps[part].has_tc) - trickle_cfg =abx80x_dt_trickle_cfg (&client->dev); + trickle_cfg =abx80x_dt_trickle_cfg (dev);if (trickle_cfg >0 ) { -dev_info (&client->dev,"Enabling trickle charger: %02x\n" , - trickle_cfg); -abx80x_enable_trickle_charger (&client->dev, trickle_cfg); +dev_info (dev,"Enabling trickle charger: %02x\n" , trickle_cfg); +abx80x_enable_trickle_charger (dev, trickle_cfg); } err =regmap_write (regmap,ABX8XX_REG_CD_TIMER_CTL ,BIT (2 ));
@@ -894,7 +857,7 @@ static int abx80x_probe(struct i2c_client *client)return err;if (abx80x_caps[part].has_wdog) { - err =abx80x_setup_watchdog (&client->dev); + err =abx80x_setup_watchdog (dev);if (err)return err; }
@@ -904,14 +867,14 @@ static int abx80x_probe(struct i2c_client *client)return err;if (priv->irq >0 ) { -dev_info (&client->dev,"IRQ %d supplied\n" , priv->irq); - err =devm_request_threaded_irq (&client->dev, priv->irq,NULL , +dev_info (dev,"IRQ %d supplied\n" , priv->irq); + err =devm_request_threaded_irq (dev, priv->irq,NULL , abx80x_handle_irq,IRQF_SHARED |IRQF_ONESHOT ,"abx8xx" , - &client->dev); + dev);if (err) { -dev_err (&client->dev,"unable to request IRQ, alarms disabled\n" ); +dev_err (dev,"unable to request IRQ, alarms disabled\n" ); priv->irq =0 ; } }
@@ -920,14 +883,39 @@ static int abx80x_probe(struct i2c_client *client) err =rtc_add_group (priv->rtc, &rtc_calib_attr_group);if (err) { -dev_err (&client->dev,"Failed to create sysfs group: %d\n" , - err); +dev_err (dev,"Failed to create sysfs group: %d\n" , err);return err; }return devm_rtc_register_device (priv->rtc); } +#if IS_ENABLED(CONFIG_I2C) + +static const struct regmap_config abx80x_regmap_config_i2c = { + .reg_bits = 8, + .val_bits = 8, + .max_register = ABX8XX_SRAM_BASE + ABX8XX_SRAM_WIN_SIZE - 1, + + .rd_table = &abx80x_read_table, + .wr_table = &abx80x_write_table, +}; + +static const struct i2c_device_id abx80x_id[] = { + { .name = "abx80x", .driver_data = ABX80X }, + { .name = "ab0801", .driver_data = AB0801 }, + { .name = "ab0803", .driver_data = AB0803 }, + { .name = "ab0804", .driver_data = AB0804 }, + { .name = "ab0805", .driver_data = AB0805 }, + { .name = "ab1801", .driver_data = AB1801 }, + { .name = "ab1803", .driver_data = AB1803 }, + { .name = "ab1804", .driver_data = AB1804 }, + { .name = "ab1805", .driver_data = AB1805 }, + { .name = "rv1805", .driver_data = RV1805 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, abx80x_id); + #ifdef CONFIG_OF static const struct of_device_id abx80x_of_match[] = { {
@@ -975,16 +963,67 @@ static const struct of_device_id abx80x_of_match[] = {MODULE_DEVICE_TABLE (of, abx80x_of_match);#endif +static int abx80x_i2c_probe (struct i2c_client *client) +{ +unsigned int part = (uintptr_t )i2c_get_match_data (client); +struct regmap *regmap; + +if (!i2c_check_functionality (client->adapter,I2C_FUNC_I2C )) +return -ENODEV ; + + regmap =devm_regmap_init_i2c (client, &abx80x_regmap_config_i2c); +if (IS_ERR (regmap)) { +dev_err (&client->dev,"Unable to allocate regmap\n" ); +return -EIO ; + } + +return abx80x_probe (&client->dev, regmap, client->irq, + client->dev.of_node, part); +} +static struct i2c_driver abx80x_driver = { .driver = { .name ="rtc-abx80x" , .of_match_table =of_match_ptr (abx80x_of_match), }, - .probe = abx80x_probe, + .probe = abx80x_i2c_probe, .id_table = abx80x_id, }; -module_i2c_driver (abx80x_driver); +static int abx80x_register_driver (void ) +{ +return i2c_add_driver (&abx80x_driver); +} + +static void abx80x_unregister_driver (void ) +{ +i2c_del_driver (&abx80x_driver); +} + +#else + +static int abx80x_register_driver (void ) +{ +return 0 ; +} + +static void abx80x_unregister_driver (void ) +{ +} + +#endif /* IS_ENABLED(CONFIG_I2C) */ + +static int __init abx80x_init (void ) +{ +return abx80x_register_driver (); +} +module_init (abx80x_init); + +static void __exit abx80x_exit(void) +{ +abx80x_unregister_driver (); +} +module_exit (abx80x_exit);MODULE_AUTHOR ("Philippe De Muyter <[email protected]>" );MODULE_AUTHOR ("Alexandre Belloni <[email protected]>" );
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH 5/6] rtc: abx80x: create abx80x_i2c_probe()
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] RV1805 hardware workarounds are skipped during auto-detection. --
--- Patch [5]: [PATCH 5/6] rtc: abx80x: create abx80x_i2c_probe() --- commit 0661079a8b8384fb14bc67f5100b45ebe0a01c3e
Author: Antoni Pokusinski <[email protected]>
rtc: abx80x: create abx80x_i2c_probe()
Move the I2C-specific code from abx80x_probe() to the newly created function. This is a preparation for introducing the support for ABX81X RTCs which use SPI interface.
Quoted 4 lines
drivers/rtc/rtc-abx80x.c +0
-0
[ ... ]
Quoted 10 lines
drivers/rtc/rtc-abx80x.c +1
-1@@ -855,7 +820,7 @@ static int abx80x_probe(struct i2c_client *client)ABX8XX_OUT_CTRL_EXDS , ABX8XX_OUT_CTRL_EXDS);if (err <0 ) { -dev_err (&client->dev, +dev_err (dev,"Unable to write output control register\n" );return -EIO ; }
drivers/rtc/rtc-abx80x.c static int abx80x_probe(struct i2c_client *client) · line 839
Quoted 10 lines
drivers/rtc/rtc-abx80x.c +1
-2@@ -867,26 +832,24 @@ static int abx80x_probe(struct i2c_client *client)if (partnumber == abx80x_caps[i].pn)break ;if (abx80x_caps[i].pn ==0 ) { -dev_err (&client->dev,"Unknown part: %04x\n" , - partnumber); +dev_err (dev,"Unknown part: %04x\n" , partnumber);return -EINVAL ; } part = i; }
[Severity: High]
This is a pre-existing issue, but are the RV1805 hardware workarounds being skipped during auto-detection?
Looking at abx80x_probe() in drivers/rtc/rtc-abx80x.c, the RV1805 specifics are configured before the part auto-detection logic resolves the hardware type:
/* Configure RV1805 specifics */
if (part == RV1805) {
...
}
/* part autodetection */
if (part == ABX80X) {
for (i = 0; abx80x_caps[i].pn; i++)
if (partnumber == abx80x_caps[i].pn)
break;
...
part = i;
}When the driver is bound using the generic "abracon,abx80x" compatible string or I2C ID, the part argument is initialized to ABX80X. Because the workarounds check if (part == RV1805) before part is updated to RV1805, they appear to be silently bypassed.
Could this cause the RV1805 RTC to accidentally enter test mode and suffer from extra power leakage?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
Re: [PATCH 5/6] rtc: abx80x: create abx80x_i2c_probe()
Quoted 63 lines · On Wed, Jul 22, 2026 at 08:10:57PM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] RV1805 hardware workarounds are skipped during auto-detection. ----- Patch [5]: [PATCH 5/6] rtc: abx80x: create
abx80x_i2c_probe()--- commit0661079a8b8384fb14bc67f5100b45ebe0a01c3e
Author: Antoni Pokusinski <[email protected]>rtc: abx80x: create
abx80x_i2c_probe()Move the I2C-specific code from
abx80x_probe()to the newly created function. This is a preparation for introducing the support for ABX81X RTCs which use SPI interface.Quoted 4 lines
drivers/rtc/rtc-abx80x.c +0
-0[ ... ]
Quoted 10 lines
drivers/rtc/rtc-abx80x.c +1
-1@@ -855,7 +820,7 @@ static int abx80x_probe(struct i2c_client *client)ABX8XX_OUT_CTRL_EXDS , ABX8XX_OUT_CTRL_EXDS);if (err <0 ) { -dev_err (&client->dev, +dev_err (dev,"Unable to write output control register\n" );return -EIO ; }drivers/rtc/rtc-abx80x.c static int abx80x_probe(struct i2c_client *client) · line 839
Quoted 10 lines
drivers/rtc/rtc-abx80x.c +1
-2@@ -867,26 +832,24 @@ static int abx80x_probe(struct i2c_client *client)if (partnumber == abx80x_caps[i].pn)break ;if (abx80x_caps[i].pn ==0 ) { -dev_err (&client->dev,"Unknown part: %04x\n" , - partnumber); +dev_err (dev,"Unknown part: %04x\n" , partnumber);return -EINVAL ; } part = i; }[Severity: High]
This is a pre-existing issue, but are the RV1805 hardware workarounds being skipped during auto-detection?Looking at
abx80x_probe()indrivers/rtc/rtc-abx80x.c, the RV1805 specifics are configured before the part auto-detection logic resolves the hardware type:/* Configure RV1805 specifics */ if (part == RV1805) { ... } /* part autodetection */ if (part == ABX80X) { for (i = 0; abx80x_caps[i].pn; i++) if (partnumber == abx80x_caps[i].pn) break; ... part = i; }
Quoted 7 lines
When the driver is bound using the generic "abracon,abx80x" compatible string or I2C ID, the part argument is initialized to ABX80X. Because the workarounds check if (part == RV1805) before part is updated to RV1805, they appear to be silently bypassed.
Could this cause the RV1805 RTC to accidentally enter test mode and suffer from extra power leakage?
Yes, this makes sense. The fix would be to simply move the autodetection before the "Configure RV1805 specifics" section. Will add this as a separate patch in v2.
Quoted 3 lines
Signature · 2 lines
-- Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
PATCH 6/6 rtc: abx80x: add support for ABX81X
In reply to Antoni PokusinskiAbracon ABX81X is a family of RTCs with SPI interface featuring the same functionalities as the ABX80X I2C clocks.
--- drivers/rtc/Kconfig | 26 +++++----- drivers/rtc/rtc-abx80x.c | 106 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 115 insertions(+), 17 deletions(-)
drivers/rtc/Kconfig +14 -12
@@ -212,18 +212,6 @@ config RTC_DRV_ABEOZ9 This driver can also be built as a module. If so, the module will be called rtc-ab-e0z9. -config RTC_DRV_ABX80X - tristate "Abracon ABx80x" - select WATCHDOG_CORE if WATCHDOG - select REGMAP_I2C - help - If you say yes here you get support for Abracon AB080X and AB180X - families of ultra-low-power battery- and capacitor-backed real-time - clock chips. - - This driver can also be built as a module. If so, the module - will be called rtc-abx80x. - config RTC_DRV_AC100 tristate "X-Powers AC100" depends on MFD_AC100
@@ -955,6 +943,20 @@ config RTC_I2C_AND_SPI comment "SPI and I2C RTC drivers" +config RTC_DRV_ABX80X + tristate "Abracon ABx80x" + depends on RTC_I2C_AND_SPI + select WATCHDOG_CORE if WATCHDOG + select REGMAP_I2C if I2C + select REGMAP_SPI if SPI_MASTER + help + If you say yes here you get support for Abracon AB080X, AB180X, + AB081X and AB181X families of ultra-low-power battery- and + capacitor-backed real-time clock chips. + + This driver can also be built as a module. If so, the module + will be called rtc-abx80x. + config RTC_DRV_DS3232 tristate "Dallas/Maxim DS3232/DS3234" depends on RTC_I2C_AND_SPI
drivers/rtc/rtc-abx80x.c +101 -5
146 lines not on this page · raw message
Signature · 1 line
2.55.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 4 lines
Abracon ABX81X is a family of RTCs with SPI interface featuring the same functionalities as the ABX80X I2C clocks.
Signed-off-by Antoni Pokusinski <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6