* [PATCH v1 0/2] rtc: max77686: convert to i2c_new_ancillary_device
@ 2026-02-11 18:49 Svyatoslav Ryhel
2026-02-11 18:49 ` [PATCH v1 1/2] dt-bindings: mfd: maxim,max77686: document optional RTC address Svyatoslav Ryhel
2026-02-11 18:49 ` [PATCH v1 2/2] rtc: max77686: convert to i2c_new_ancillary_device Svyatoslav Ryhel
0 siblings, 2 replies; 6+ messages in thread
From: Svyatoslav Ryhel @ 2026-02-11 18:49 UTC (permalink / raw)
To: Chanwoo Choi, Krzysztof Kozlowski, Lee Jones, Rob Herring,
Conor Dooley, Alexandre Belloni
Cc: linux-kernel, devicetree, linux-rtc
Convert RTC I2C device creation from devm_i2c_new_dummy_device() to
i2c_new_ancillary_device() to enable the use of a device tree-specified
RTC address instead of a hardcoded value. If the device tree does not
provide an address, use hardcoded values as a fallback.
This addresses an issue with the MAX77663 PMIC, which can have the RTC at
different I2C positions (either 0x48, like the MAX77714, or 0x68, like
the MAX77620). The MAX77620 value is used as the default. The I2C position
of the MAX77663 is factory-set and cannot be detected from the chip
itself.
I have tested this patch on LG Optimus Vu P895 with max77663 PMIC and
non-default RTC position. RTC is registered correctly.
Svyatoslav Ryhel (2):
dt-bindings: mfd: maxim,max77686: document optional RTC address
rtc: max77686: convert to i2c_new_ancillary_device
.../devicetree/bindings/mfd/maxim,max77686.yaml | 15 +++++++++++++--
drivers/rtc/rtc-max77686.c | 14 ++++++++++++--
2 files changed, 25 insertions(+), 4 deletions(-)
--
2.51.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v1 1/2] dt-bindings: mfd: maxim,max77686: document optional RTC address
2026-02-11 18:49 [PATCH v1 0/2] rtc: max77686: convert to i2c_new_ancillary_device Svyatoslav Ryhel
@ 2026-02-11 18:49 ` Svyatoslav Ryhel
2026-02-12 7:26 ` Krzysztof Kozlowski
2026-02-11 18:49 ` [PATCH v1 2/2] rtc: max77686: convert to i2c_new_ancillary_device Svyatoslav Ryhel
1 sibling, 1 reply; 6+ messages in thread
From: Svyatoslav Ryhel @ 2026-02-11 18:49 UTC (permalink / raw)
To: Chanwoo Choi, Krzysztof Kozlowski, Lee Jones, Rob Herring,
Conor Dooley, Alexandre Belloni
Cc: linux-kernel, devicetree, linux-rtc
Document an optional second I2C address for the PMIC's RTC device, to be
used if the RTC is located at a non-default I2C address
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
.../devicetree/bindings/mfd/maxim,max77686.yaml | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/mfd/maxim,max77686.yaml b/Documentation/devicetree/bindings/mfd/maxim,max77686.yaml
index c13d51e462ba..2d4aad8feaeb 100644
--- a/Documentation/devicetree/bindings/mfd/maxim,max77686.yaml
+++ b/Documentation/devicetree/bindings/mfd/maxim,max77686.yaml
@@ -32,7 +32,17 @@ properties:
maxItems: 1
reg:
- maxItems: 1
+ description:
+ Can contain an optional second I2C address pointing to the PMIC's
+ RTC device. If no RTC address is provided, a default address specific
+ to this PMIC will be used.
+ minItems: 1
+ maxItems: 2
+
+ reg-names:
+ items:
+ - const: pmic
+ - const: rtc
voltage-regulators:
$ref: /schemas/regulator/maxim,max77686.yaml
@@ -59,7 +69,8 @@ examples:
max77686: pmic@9 {
compatible = "maxim,max77686";
- reg = <0x09>;
+ reg = <0x09>, <0x06>;
+ reg-names = "pmic", "rtc";
interrupt-parent = <&gpx0>;
interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v1 2/2] rtc: max77686: convert to i2c_new_ancillary_device
2026-02-11 18:49 [PATCH v1 0/2] rtc: max77686: convert to i2c_new_ancillary_device Svyatoslav Ryhel
2026-02-11 18:49 ` [PATCH v1 1/2] dt-bindings: mfd: maxim,max77686: document optional RTC address Svyatoslav Ryhel
@ 2026-02-11 18:49 ` Svyatoslav Ryhel
1 sibling, 0 replies; 6+ messages in thread
From: Svyatoslav Ryhel @ 2026-02-11 18:49 UTC (permalink / raw)
To: Chanwoo Choi, Krzysztof Kozlowski, Lee Jones, Rob Herring,
Conor Dooley, Alexandre Belloni
Cc: linux-kernel, devicetree, linux-rtc
Convert RTC I2C device creation from devm_i2c_new_dummy_device() to
i2c_new_ancillary_device() to enable the use of a device tree-specified
RTC address instead of a hardcoded value. If the device tree does not
provide an address, use hardcoded values as a fallback.
This addresses an issue with the MAX77663 PMIC, which can have the RTC at
different I2C positions (either 0x48, like the MAX77714, or 0x68, like
the MAX77620). The MAX77620 value is used as the default. The I2C position
of the MAX77663 is factory-set and cannot be detected from the chip
itself.
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
drivers/rtc/rtc-max77686.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c
index 69ea3ce75b5a..3cdfd78a07cc 100644
--- a/drivers/rtc/rtc-max77686.c
+++ b/drivers/rtc/rtc-max77686.c
@@ -686,6 +686,11 @@ static int max77686_rtc_init_reg(struct max77686_rtc_info *info)
return ret;
}
+static void max77686_rtc_release_dev(void *client)
+{
+ i2c_unregister_device(client);
+}
+
static int max77686_init_rtc_regmap(struct max77686_rtc_info *info)
{
struct device *parent = info->dev->parent;
@@ -713,12 +718,17 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info)
goto add_rtc_irq;
}
- client = devm_i2c_new_dummy_device(info->dev, parent_i2c->adapter,
- info->drv_data->rtc_i2c_addr);
+ client = i2c_new_ancillary_device(parent_i2c, "rtc",
+ info->drv_data->rtc_i2c_addr);
if (IS_ERR(client))
return dev_err_probe(info->dev, PTR_ERR(client),
"Failed to allocate I2C device for RTC\n");
+ ret = devm_add_action_or_reset(info->dev, max77686_rtc_release_dev,
+ client);
+ if (ret)
+ return ret;
+
info->rtc_regmap = devm_regmap_init_i2c(client,
info->drv_data->regmap_config);
if (IS_ERR(info->rtc_regmap))
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v1 1/2] dt-bindings: mfd: maxim,max77686: document optional RTC address
2026-02-11 18:49 ` [PATCH v1 1/2] dt-bindings: mfd: maxim,max77686: document optional RTC address Svyatoslav Ryhel
@ 2026-02-12 7:26 ` Krzysztof Kozlowski
2026-02-12 8:08 ` Svyatoslav Ryhel
0 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Kozlowski @ 2026-02-12 7:26 UTC (permalink / raw)
To: Svyatoslav Ryhel, Chanwoo Choi, Lee Jones, Rob Herring,
Conor Dooley, Alexandre Belloni
Cc: linux-kernel, devicetree, linux-rtc
On 11/02/2026 19:49, Svyatoslav Ryhel wrote:
> Document an optional second I2C address for the PMIC's RTC device, to be
> used if the RTC is located at a non-default I2C address
MAX77686 did not allow changing the I2C address and there are no other
devices in the bindings.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 1/2] dt-bindings: mfd: maxim,max77686: document optional RTC address
2026-02-12 7:26 ` Krzysztof Kozlowski
@ 2026-02-12 8:08 ` Svyatoslav Ryhel
2026-02-12 11:27 ` Krzysztof Kozlowski
0 siblings, 1 reply; 6+ messages in thread
From: Svyatoslav Ryhel @ 2026-02-12 8:08 UTC (permalink / raw)
To: Krzysztof Kozlowski, Chanwoo Choi, Lee Jones, Rob Herring,
Conor Dooley, Alexandre Belloni
Cc: linux-kernel, devicetree, linux-rtc
12 лютого 2026 р. 09:26:33 GMT+02:00, Krzysztof Kozlowski <krzk@kernel.org> пише:
>On 11/02/2026 19:49, Svyatoslav Ryhel wrote:
>> Document an optional second I2C address for the PMIC's RTC device, to be
>> used if the RTC is located at a non-default I2C address
>
>MAX77686 did not allow changing the I2C address and there are no other
>devices in the bindings.
>
That is true, MAX77663 RTC does this, should I adjust Documentation/devicetree/bindings/mfd/max77620.txt instead?
>
>Best regards,
>Krzysztof
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 1/2] dt-bindings: mfd: maxim,max77686: document optional RTC address
2026-02-12 8:08 ` Svyatoslav Ryhel
@ 2026-02-12 11:27 ` Krzysztof Kozlowski
0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2026-02-12 11:27 UTC (permalink / raw)
To: Svyatoslav Ryhel, Chanwoo Choi, Lee Jones, Rob Herring,
Conor Dooley, Alexandre Belloni
Cc: linux-kernel, devicetree, linux-rtc
On 12/02/2026 09:08, Svyatoslav Ryhel wrote:
>
>
> 12 лютого 2026 р. 09:26:33 GMT+02:00, Krzysztof Kozlowski <krzk@kernel.org> пише:
>> On 11/02/2026 19:49, Svyatoslav Ryhel wrote:
>>> Document an optional second I2C address for the PMIC's RTC device, to be
>>> used if the RTC is located at a non-default I2C address
>>
>> MAX77686 did not allow changing the I2C address and there are no other
>> devices in the bindings.
>>
>
> That is true, MAX77663 RTC does this, should I adjust Documentation/devicetree/bindings/mfd/max77620.txt instead?
I don't know which binding you should update instead, but I know that it
must not be max77686. Please update the binding for the device you are
actually changing, not some other devices.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-02-12 11:27 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-11 18:49 [PATCH v1 0/2] rtc: max77686: convert to i2c_new_ancillary_device Svyatoslav Ryhel
2026-02-11 18:49 ` [PATCH v1 1/2] dt-bindings: mfd: maxim,max77686: document optional RTC address Svyatoslav Ryhel
2026-02-12 7:26 ` Krzysztof Kozlowski
2026-02-12 8:08 ` Svyatoslav Ryhel
2026-02-12 11:27 ` Krzysztof Kozlowski
2026-02-11 18:49 ` [PATCH v1 2/2] rtc: max77686: convert to i2c_new_ancillary_device Svyatoslav Ryhel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox