Message ID | 20230308083759.11692-1-clamor95@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp213875wrd; Wed, 8 Mar 2023 00:47:13 -0800 (PST) X-Google-Smtp-Source: AK7set8zeSj4+KH6+w303hu/DnrALCB5l8v4HxNPpC/THatwfrPDBJF0RkCY5zDTvmHmvBJY4Pwi X-Received: by 2002:aa7:d9c9:0:b0:4c4:95dc:8ca3 with SMTP id v9-20020aa7d9c9000000b004c495dc8ca3mr15783924eds.3.1678265233081; Wed, 08 Mar 2023 00:47:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678265233; cv=none; d=google.com; s=arc-20160816; b=D69CHHWTgx3/hIjdN/efSVBjGaP1jtR9TAEM+SUJz+JY6zyf2p8vf2EpTZsog0Re19 38fKT0d0zTGtwJkazXKm3CcqWZaMwRDbc4Fyck5p/XWb4/DYbwbl45JF5LX6klapFMAu MTTg8ZVjLFz8R/a5uxg5pEVPQW9d7x9xf1ubDKvfxBfk6ODE8Y6y2XCLFWUTb+Mgli9B 4uQI1giPJvb4qu13UN+SNKOzEaNeOaUw8JEwswqhNI91zYIdTlZ5EvmMgEmXCQu68Oy+ fzkHm6GuKD30XRQ/ePsqd0Gk5ECx7T3VcK2+N6ocVE0h4wKNTKqwQdSx2gNxB7niWppO /tPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=FjcDlz4XTRjbVMkK7ur7l1kd35DIiV7fVBc0YXc8Pfk=; b=aipF6CKPaz5DxLilzJbKff1RpU8AG0psXCX7N8ulVQv90c56NrzGSGs+Vw6/gbAESa AYxk7lqfPoT24CLhehgW6bwqm4u9vmeOsl4KLlb/wucob4xQjX2fMka1Ol3BbkKjx3ih y1NEX51JrfRM3yCefEpK4GKvbJ0y9ltfFpXP/2B6fMNPR2zzvvwxVLLrOt2HQZZFvH1O SrtShXKnCuvREN2tk48tRcgpFOmnAWjGNq0Jo4YasAJUR6ka494BGzuMw23YVq9QZxCn pCgiy/SlUyYYek/TPOaGBNDMeJFLR4QhdUDC43qMoZ52CFW3JIUyzwiI+qurvqqonlHs 0Zig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CiNyVTkT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l3-20020a056402124300b004c0e614f887si15833494edw.94.2023.03.08.00.46.49; Wed, 08 Mar 2023 00:47:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CiNyVTkT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230360AbjCHIiq (ORCPT <rfc822;toshivichauhan@gmail.com> + 99 others); Wed, 8 Mar 2023 03:38:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229772AbjCHIiP (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 8 Mar 2023 03:38:15 -0500 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56BAAC64D; Wed, 8 Mar 2023 00:38:12 -0800 (PST) Received: by mail-ed1-x535.google.com with SMTP id cy23so62402102edb.12; Wed, 08 Mar 2023 00:38:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678264691; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=FjcDlz4XTRjbVMkK7ur7l1kd35DIiV7fVBc0YXc8Pfk=; b=CiNyVTkTUk5idm4lvZK53mA0Qada/38QZ1MYF4CZX6P8Xf0S8lo2XN5xMcgBWTSdN5 i5duPacjeQzfcYql+JwzqccufOmqB3JHHjV6dzmKCecSA10+RQ6i4dCEld+fXjFercsR E89Iv0Mv4D/84bE7pM9dDjiteg71w335VaSO0sR+vzQY59r9auj9TMFWVaBTCwCvze9P qTVJAdJG8RwPDTCRS1eXfwlEP57dTBuj1RKse97aCqF9zDrN/9gN01Bo1Dx9nHJb5lTm PL9j74yzkfG62z5g4wU6lnaEdmmBkC6Ui9KuXPPGSm7uf5to70niDJcEDdL82GX+kc7l f3bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678264691; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FjcDlz4XTRjbVMkK7ur7l1kd35DIiV7fVBc0YXc8Pfk=; b=Hs60iQfsW2HygGMx/n9A19kK0v0MEdKZXHkwIZJ3MsuNgT5EPM9YsWsrQtpPFqqX/X BSdAlbOBEgKHu/Z9EdHBoNXVpCgW3b/ccVXr5G0yvEy7Al8a2Iw7s/MOeD/ya89edoMH UgbKW60XxASGfEd4oJ6Mq1abBizVBSYoXUf3hVMgb4G9CXj9XVFxSNMfeDimiq5zYjo9 5XtAScmVDTvfcYFbQB8J8VChv+iqlPdOqUaV4tFXzMjE3f+/fUN0MamO7bIim4VHnlos VSLGz3dM4J21sxy5FnaKc6XEYXs2ZNqGk8FXlBRupzhh6wmLwzFbgH62HpWsA9gZIMnz i2QQ== X-Gm-Message-State: AO0yUKXnL+VpaUpJKO6x1GpnvoUoxYD/by2dPJIFBNFgPGC4IiC18mnK OakgXgOrt2an/7QgUezNgkM= X-Received: by 2002:aa7:c0da:0:b0:4c0:9bd7:54cc with SMTP id j26-20020aa7c0da000000b004c09bd754ccmr13365511edp.11.1678264690784; Wed, 08 Mar 2023 00:38:10 -0800 (PST) Received: from xeon.. ([188.163.112.76]) by smtp.gmail.com with ESMTPSA id k7-20020a170906578700b008b904cb2bcdsm7300511ejq.11.2023.03.08.00.38.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 00:38:10 -0800 (PST) From: Svyatoslav Ryhel <clamor95@gmail.com> To: Chanwoo Choi <cw00.choi@samsung.com>, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>, Alessandro Zummo <a.zummo@towertech.it>, Alexandre Belloni <alexandre.belloni@bootlin.com>, Svyatoslav Ryhel <clamor95@gmail.com> Cc: linux-kernel@vger.kernel.org, linux-rtc@vger.kernel.org Subject: [PATCH v1] max77663-rtc: pass rtc address from device tree node if exists Date: Wed, 8 Mar 2023 10:37:59 +0200 Message-Id: <20230308083759.11692-1-clamor95@gmail.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759788645223568062?= X-GMAIL-MSGID: =?utf-8?q?1759788645223568062?= |
Series |
[v1] max77663-rtc: pass rtc address from device tree node if exists
|
|
Commit Message
Svyatoslav Ryhel
March 8, 2023, 8:37 a.m. UTC
MAX77663 PMIC can have RTC on both 0x63 i2c address (like grouper)
which is main address but on some devices RTC is located on 0x48
i2c address (like p880 and p895 from LG). Lets add property to be
able to use alternative address if needed without breaking existing
bindings.
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
drivers/rtc/rtc-max77686.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
Comments
Hello, the subject is not correct, please use the subsystem style On 08/03/2023 10:37:59+0200, Svyatoslav Ryhel wrote: > MAX77663 PMIC can have RTC on both 0x63 i2c address (like grouper) > which is main address but on some devices RTC is located on 0x48 > i2c address (like p880 and p895 from LG). Lets add property to be > able to use alternative address if needed without breaking existing > bindings. > > Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> > --- > drivers/rtc/rtc-max77686.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c > index b0250d91fb00..218177375531 100644 > --- a/drivers/rtc/rtc-max77686.c > +++ b/drivers/rtc/rtc-max77686.c > @@ -691,6 +691,7 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) > { > struct device *parent = info->dev->parent; > struct i2c_client *parent_i2c = to_i2c_client(parent); > + int rtc_i2c_addr; > int ret; > > if (info->drv_data->rtc_irq_from_platform) { > @@ -714,8 +715,13 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) > goto add_rtc_irq; > } > > + ret = device_property_read_u32(parent, "maxim,rtc-i2c-address", > + &rtc_i2c_addr); This property needs to be documented > + if (ret) > + rtc_i2c_addr = info->drv_data->rtc_i2c_addr; > + > info->rtc = devm_i2c_new_dummy_device(info->dev, parent_i2c->adapter, > - info->drv_data->rtc_i2c_addr); > + rtc_i2c_addr); > if (IS_ERR(info->rtc)) { > dev_err(info->dev, "Failed to allocate I2C device for RTC\n"); > return PTR_ERR(info->rtc); > -- > 2.37.2 >
ср, 8 бер. 2023 р. о 10:44 Alexandre Belloni <alexandre.belloni@bootlin.com> пише: > > Hello, > > the subject is not correct, please use the subsystem style > > On 08/03/2023 10:37:59+0200, Svyatoslav Ryhel wrote: > > MAX77663 PMIC can have RTC on both 0x63 i2c address (like grouper) > > which is main address but on some devices RTC is located on 0x48 > > i2c address (like p880 and p895 from LG). Lets add property to be > > able to use alternative address if needed without breaking existing > > bindings. > > > > Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> > > --- > > drivers/rtc/rtc-max77686.c | 8 +++++++- > > 1 file changed, 7 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c > > index b0250d91fb00..218177375531 100644 > > --- a/drivers/rtc/rtc-max77686.c > > +++ b/drivers/rtc/rtc-max77686.c > > @@ -691,6 +691,7 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) > > { > > struct device *parent = info->dev->parent; > > struct i2c_client *parent_i2c = to_i2c_client(parent); > > + int rtc_i2c_addr; > > int ret; > > > > if (info->drv_data->rtc_irq_from_platform) { > > @@ -714,8 +715,13 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) > > goto add_rtc_irq; > > } > > > > + ret = device_property_read_u32(parent, "maxim,rtc-i2c-address", > > + &rtc_i2c_addr); > > This property needs to be documented > max776xx pmic has no yaml to document > > + if (ret) > > + rtc_i2c_addr = info->drv_data->rtc_i2c_addr; > > + > > info->rtc = devm_i2c_new_dummy_device(info->dev, parent_i2c->adapter, > > - info->drv_data->rtc_i2c_addr); > > + rtc_i2c_addr); > > if (IS_ERR(info->rtc)) { > > dev_err(info->dev, "Failed to allocate I2C device for RTC\n"); > > return PTR_ERR(info->rtc); > > -- > > 2.37.2 > > > > -- > Alexandre Belloni, co-owner and COO, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com
On 08/03/2023 09:46, Svyatoslav Ryhel wrote: > ср, 8 бер. 2023 р. о 10:44 Alexandre Belloni > <alexandre.belloni@bootlin.com> пише: >> >> Hello, >> >> the subject is not correct, please use the subsystem style >> >> On 08/03/2023 10:37:59+0200, Svyatoslav Ryhel wrote: >>> MAX77663 PMIC can have RTC on both 0x63 i2c address (like grouper) >>> which is main address but on some devices RTC is located on 0x48 >>> i2c address (like p880 and p895 from LG). Lets add property to be >>> able to use alternative address if needed without breaking existing >>> bindings. >>> >>> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> >>> --- >>> drivers/rtc/rtc-max77686.c | 8 +++++++- >>> 1 file changed, 7 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c >>> index b0250d91fb00..218177375531 100644 >>> --- a/drivers/rtc/rtc-max77686.c >>> +++ b/drivers/rtc/rtc-max77686.c >>> @@ -691,6 +691,7 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) >>> { >>> struct device *parent = info->dev->parent; >>> struct i2c_client *parent_i2c = to_i2c_client(parent); >>> + int rtc_i2c_addr; >>> int ret; >>> >>> if (info->drv_data->rtc_irq_from_platform) { >>> @@ -714,8 +715,13 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) >>> goto add_rtc_irq; >>> } >>> >>> + ret = device_property_read_u32(parent, "maxim,rtc-i2c-address", >>> + &rtc_i2c_addr); >> >> This property needs to be documented >> > > max776xx pmic has no yaml to document Of course it has, otherwise on what did I work? git grep max77686 Best regards, Krzysztof
Ooof, my bad. I will resend v2 with fix asap. ср, 8 бер. 2023 р. о 10:49 Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> пише: > > On 08/03/2023 09:46, Svyatoslav Ryhel wrote: > > ср, 8 бер. 2023 р. о 10:44 Alexandre Belloni > > <alexandre.belloni@bootlin.com> пише: > >> > >> Hello, > >> > >> the subject is not correct, please use the subsystem style > >> > >> On 08/03/2023 10:37:59+0200, Svyatoslav Ryhel wrote: > >>> MAX77663 PMIC can have RTC on both 0x63 i2c address (like grouper) > >>> which is main address but on some devices RTC is located on 0x48 > >>> i2c address (like p880 and p895 from LG). Lets add property to be > >>> able to use alternative address if needed without breaking existing > >>> bindings. > >>> > >>> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> > >>> --- > >>> drivers/rtc/rtc-max77686.c | 8 +++++++- > >>> 1 file changed, 7 insertions(+), 1 deletion(-) > >>> > >>> diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c > >>> index b0250d91fb00..218177375531 100644 > >>> --- a/drivers/rtc/rtc-max77686.c > >>> +++ b/drivers/rtc/rtc-max77686.c > >>> @@ -691,6 +691,7 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) > >>> { > >>> struct device *parent = info->dev->parent; > >>> struct i2c_client *parent_i2c = to_i2c_client(parent); > >>> + int rtc_i2c_addr; > >>> int ret; > >>> > >>> if (info->drv_data->rtc_irq_from_platform) { > >>> @@ -714,8 +715,13 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) > >>> goto add_rtc_irq; > >>> } > >>> > >>> + ret = device_property_read_u32(parent, "maxim,rtc-i2c-address", > >>> + &rtc_i2c_addr); > >> > >> This property needs to be documented > >> > > > > max776xx pmic has no yaml to document > > Of course it has, otherwise on what did I work? > > git grep max77686 > > > Best regards, > Krzysztof >
On 08/03/2023 09:37, Svyatoslav Ryhel wrote: > MAX77663 PMIC can have RTC on both 0x63 i2c address (like grouper) > which is main address but on some devices RTC is located on 0x48 > i2c address (like p880 and p895 from LG). Lets add property to be > able to use alternative address if needed without breaking existing > bindings. Use subject prefixes matching the subsystem (which you can get for example with `git log --oneline -- DIRECTORY_OR_FILE` on the directory your patch is touching). Anyway this is not max77663 driver. The property does not make sense in the context of max77686. Maybe for max77802/77620 and 77714 would have... but still max77663 is not there. Don't add properties for unrelated and unsupported devices. Best regards, Krzysztof
On 08/03/2023 09:51, Svyatoslav Ryhel wrote:
> Ooof, my bad. I will resend v2 with fix asap.
This was for max77686. Other PMICs have their own. None of them is
max77663, but that's another topic.
Best regards,
Krzysztof
I would love to, but max77663 uses max77686 rtc https://github.com/torvalds/linux/blob/master/drivers/mfd/max77620.c#L123 how to handle this? ср, 8 бер. 2023 р. о 10:54 Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> пише: > > On 08/03/2023 09:37, Svyatoslav Ryhel wrote: > > MAX77663 PMIC can have RTC on both 0x63 i2c address (like grouper) > > which is main address but on some devices RTC is located on 0x48 > > i2c address (like p880 and p895 from LG). Lets add property to be > > able to use alternative address if needed without breaking existing > > bindings. > > Use subject prefixes matching the subsystem (which you can get for > example with `git log --oneline -- DIRECTORY_OR_FILE` on the directory > your patch is touching). > > Anyway this is not max77663 driver. > > The property does not make sense in the context of max77686. Maybe for > max77802/77620 and 77714 would have... but still max77663 is not there. > Don't add properties for unrelated and unsupported devices. > > Best regards, > Krzysztof >
On 08/03/2023 09:58, Svyatoslav Ryhel wrote: > I would love to, but max77663 uses max77686 rtc > https://github.com/torvalds/linux/blob/master/drivers/mfd/max77620.c#L123 > how to handle this? Don't top post. Hm, so it seems max7763 is already documented via max77620. I missed that. Add the new property to max77620, not to max77686 RTC. It does not look like RTC's property, but the PMIC's. Best regards, Krzysztof
On 08/03/2023 10:11, Krzysztof Kozlowski wrote: > On 08/03/2023 09:58, Svyatoslav Ryhel wrote: >> I would love to, but max77663 uses max77686 rtc >> https://github.com/torvalds/linux/blob/master/drivers/mfd/max77620.c#L123 >> how to handle this? > > Don't top post. > > Hm, so it seems max7763 is already documented via max77620. I missed > that. Add the new property to max77620, not to max77686 RTC. It does not > look like RTC's property, but the PMIC's. To clarify - the I2C address selection for regmap is in max77686 RTC, but I meant DT property. Different thing is that we do not pass addresses as property fields. These should be devices on the I2C bus rather... unless you are aware of existing property like this? Best regards, Krzysztof
ср, 8 бер. 2023 р. о 11:11 Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> пише: > > On 08/03/2023 09:58, Svyatoslav Ryhel wrote: > > I would love to, but max77663 uses max77686 rtc > > https://github.com/torvalds/linux/blob/master/drivers/mfd/max77620.c#L123 > > how to handle this? > > Don't top post. > > Hm, so it seems max7763 is already documented via max77620. I missed > that. Add the new property to max77620, not to max77686 RTC. It does not > look like RTC's property, but the PMIC's. There is no max77620 yaml, only txt. Add property to txt? > Best regards, > Krzysztof >
On 08/03/2023 10:14:22+0100, Krzysztof Kozlowski wrote: > On 08/03/2023 10:11, Krzysztof Kozlowski wrote: > > On 08/03/2023 09:58, Svyatoslav Ryhel wrote: > >> I would love to, but max77663 uses max77686 rtc > >> https://github.com/torvalds/linux/blob/master/drivers/mfd/max77620.c#L123 > >> how to handle this? > > > > Don't top post. > > > > Hm, so it seems max7763 is already documented via max77620. I missed > > that. Add the new property to max77620, not to max77686 RTC. It does not > > look like RTC's property, but the PMIC's. > > To clarify - the I2C address selection for regmap is in max77686 RTC, > but I meant DT property. > > Different thing is that we do not pass addresses as property fields. > These should be devices on the I2C bus rather... unless you are aware of > existing property like this? > I'd say that the RTC should have been modeled as a discrete component from the beginning instead of using an i2c dummy device > Best regards, > Krzysztof >
On 08/03/2023 10:29, Svyatoslav Ryhel wrote: > ср, 8 бер. 2023 р. о 11:11 Krzysztof Kozlowski > <krzysztof.kozlowski@linaro.org> пише: >> >> On 08/03/2023 09:58, Svyatoslav Ryhel wrote: >>> I would love to, but max77663 uses max77686 rtc >>> https://github.com/torvalds/linux/blob/master/drivers/mfd/max77620.c#L123 >>> how to handle this? >> >> Don't top post. >> >> Hm, so it seems max7763 is already documented via max77620. I missed >> that. Add the new property to max77620, not to max77686 RTC. It does not >> look like RTC's property, but the PMIC's. > > There is no max77620 yaml, only txt. Add property to txt? If property was to accept, then unfortunately no, you need to convert first. Best regards, Krzysztof
On 08/03/2023 10:42, Alexandre Belloni wrote: > On 08/03/2023 10:14:22+0100, Krzysztof Kozlowski wrote: >> On 08/03/2023 10:11, Krzysztof Kozlowski wrote: >>> On 08/03/2023 09:58, Svyatoslav Ryhel wrote: >>>> I would love to, but max77663 uses max77686 rtc >>>> https://github.com/torvalds/linux/blob/master/drivers/mfd/max77620.c#L123 >>>> how to handle this? >>> >>> Don't top post. >>> >>> Hm, so it seems max7763 is already documented via max77620. I missed >>> that. Add the new property to max77620, not to max77686 RTC. It does not >>> look like RTC's property, but the PMIC's. >> >> To clarify - the I2C address selection for regmap is in max77686 RTC, >> but I meant DT property. >> >> Different thing is that we do not pass addresses as property fields. >> These should be devices on the I2C bus rather... unless you are aware of >> existing property like this? >> > > I'd say that the RTC should have been modeled as a discrete component > from the beginning instead of using an i2c dummy device Yeah, exactly. Current design was working for existing use cases/devices, but has limits, thus RTC should be reworked. Actually even for oldest PMIC max77686, the RTC was a separate device on I2C bus. We just made it for simplicity part of PMIC. Best regards, Krzysztof
diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c index b0250d91fb00..218177375531 100644 --- a/drivers/rtc/rtc-max77686.c +++ b/drivers/rtc/rtc-max77686.c @@ -691,6 +691,7 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) { struct device *parent = info->dev->parent; struct i2c_client *parent_i2c = to_i2c_client(parent); + int rtc_i2c_addr; int ret; if (info->drv_data->rtc_irq_from_platform) { @@ -714,8 +715,13 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) goto add_rtc_irq; } + ret = device_property_read_u32(parent, "maxim,rtc-i2c-address", + &rtc_i2c_addr); + if (ret) + rtc_i2c_addr = info->drv_data->rtc_i2c_addr; + info->rtc = devm_i2c_new_dummy_device(info->dev, parent_i2c->adapter, - info->drv_data->rtc_i2c_addr); + rtc_i2c_addr); if (IS_ERR(info->rtc)) { dev_err(info->dev, "Failed to allocate I2C device for RTC\n"); return PTR_ERR(info->rtc);