Skip to contentSkip to conversation

rtc: pcf8563: add SMBus support

PATCH Applied Michael Walle 3 participants 4 messages Oct 8 Real time clock (RTC)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 rtc: pcf8563: add SMBus support

Since commit 00f1bb9b8486 ("rtc: pcf8563: Switch to regmap") the driver uses regmap to access the RTC. Regmap itself will figure out if there is a suitable I2C or SMBus host controllers. Thus, don't restict the driver to just I2C controllers and make it work on SMBus controllers supporting i2c block accesses, too.

This was tested on a custom x86 board.

---
 drivers/rtc/rtc-pcf8563.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/rtc/rtc-pcf8563.c +2 -1
index 7eebdb058067..56e75664c7b4 100644
@@ -479,7 +479,8 @@ static int pcf8563_probe(struct i2c_client *client)
 
 	dev_dbg(&client->dev, "%s\n", __func__);
 
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
+	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C) &&
+	    !i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK))
 		return -ENODEV;
 
 	pcf8563 = devm_kzalloc(&client->dev, sizeof(struct pcf8563),
Signature · 1 line
2.47.3
#1 lore raw
Quoted 10 lines · Michael Walle

Since commit 00f1bb9b8486 ("rtc: pcf8563: Switch to regmap") the driver uses regmap to access the RTC. Regmap itself will figure out if there is a suitable I2C or SMBus host controllers. Thus, don't restict the driver to just I2C controllers and make it work on SMBus controllers supporting i2c block accesses, too.

This was tested on a custom x86 board.

---

Sorry forgot the changelog:

v2:
- instead of dropping the check altogether, check for either i2c or smbus block support.

#2 lore raw
In reply to Michael Walle
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 9 lines

Since commit 00f1bb9b8486 ("rtc: pcf8563: Switch to regmap") the driver uses regmap to access the RTC. Regmap itself will figure out if there is a suitable I2C or SMBus host controllers. Thus, don't restict the driver to just I2C controllers and make it work on SMBus controllers supporting i2c block accesses, too.

This was tested on a custom x86 board.

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=1
maintainer Applied
#3 lore raw
In reply to Michael Walle
Quoted 9 lines · Michael Walle

Since commit 00f1bb9b8486 ("rtc: pcf8563: Switch to regmap") the driver uses regmap to access the RTC. Regmap itself will figure out if there is a suitable I2C or SMBus host controllers. Thus, don't restict the driver to just I2C controllers and make it work on SMBus controllers supporting i2c block accesses, too.

This was tested on a custom x86 board.

[...]

Applied, thanks!

[1/1] rtc: pcf8563: add SMBus support

      https://git.kernel.org/abelloni/c/237378fd6be4

Best regards,

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com