Message ID | 20230403154342.3108-3-Ibrahim.Tilki@analog.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2401143vqo; Mon, 3 Apr 2023 08:50:37 -0700 (PDT) X-Google-Smtp-Source: AKy350ZapEOhejxFbwPNJLBsSS5usaa5tChOw44vLDJGVys8GtNW8RXuVT0L+R/eqbHXwJci37Xe X-Received: by 2002:a17:902:f315:b0:19e:7f6f:8c32 with SMTP id c21-20020a170902f31500b0019e7f6f8c32mr28215072ple.48.1680537037210; Mon, 03 Apr 2023 08:50:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680537037; cv=none; d=google.com; s=arc-20160816; b=qIIl2XqhZ7zrzp7nziRWHHok0bCqNWpF2BQscPJmbaO95PNO4Tha6ZFlDzeQ+mCasd viCE68xrpRINwq0EQLW3CbjkX24MT81JzLxBY7V/iZsAP5TeKRBezCx/EoHj+1wMZJKD kue8O8wX4v9gGrpss9lx6uICsaucPTnqy2ZxhVoZiStj79F+7wRaWMt//UMXHGBiTBpL 6LIUj2sW6mxRvrMRSsbeJtLXJQe63Xw72Ty504geKjStRj7IwJZRlCOJxq7RkfyuUWl3 Vj6UKsGS7RX6fzqE4KtMTt3kjUXEbL++iTujDyQdC8JBAGn5suimSEXVfeAL1Q1qnH7y DJIg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=js12ZhHvLA1Hi+oS3ucyJkMPlN8LylczmdADiH332cw=; b=RTISXUIsBahq9DhxgkkMhN+8862F1xMNGVlnlKWnla9o9+BQTN/sqmvt/iyIcsfHJh Rz6ODDHrB7mtxOmQ79sWyqpS47BP6WCVQ45Hu23wxo96jz8o4GRXXdiuMsdy4JZ/3ZEK 4RantzAVYmy0noUkFGd67lQmF1wciUzWCQHJr/LmEDV7svT8eMM+C0Y2JAQtwq5dOSFt x5FDCGD4mMqBEHkIgcU63fGw67Upfu28OXqy0Ff+6+Ug7f4ERKDr/vPz4fHzUNMIIUPx tco5zacBlE8qEAZI8O3RTU2Jlwq6u+eedkJWe4kLUuiW9wA37b9BunLdJi+8KtejpmPa u7yw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=analog.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l8-20020a170902f68800b001968124dc22si8561765plg.560.2023.04.03.08.50.01; Mon, 03 Apr 2023 08:50:37 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=analog.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232966AbjDCPpM (ORCPT <rfc822;zwp10758@gmail.com> + 99 others); Mon, 3 Apr 2023 11:45:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232071AbjDCPpI (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 3 Apr 2023 11:45:08 -0400 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1232530F1; Mon, 3 Apr 2023 08:45:04 -0700 (PDT) Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 333D9TNr029235; Mon, 3 Apr 2023 11:44:43 -0400 Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 3pphh8abm0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 03 Apr 2023 11:44:42 -0400 Received: from ASHBMBX8.ad.analog.com (ASHBMBX8.ad.analog.com [10.64.17.5]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 333Fif5R052647 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 3 Apr 2023 11:44:41 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBMBX8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Mon, 3 Apr 2023 11:44:40 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Mon, 3 Apr 2023 11:44:40 -0400 Received: from IST-LT-39247.ad.analog.com (IST-LT-39247.ad.analog.com [10.25.16.17]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 333Fi2OR024018; Mon, 3 Apr 2023 11:44:29 -0400 From: Ibrahim Tilki <Ibrahim.Tilki@analog.com> To: <a.zummo@towertech.it>, <alexandre.belloni@bootlin.com>, <jdelvare@suse.com>, <linux@roeck-us.net>, <robh+dt@kernel.org>, <krzysztof.kozlowski+dt@linaro.org> CC: Ibrahim Tilki <Ibrahim.Tilki@analog.com>, <linux-rtc@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-hwmon@vger.kernel.org>, <devicetree@vger.kernel.org>, Zeynep Arslanbenzer <Zeynep.Arslanbenzer@analog.com> Subject: [PATCH v5 2/2] dt-bindings: rtc: add max313xx RTCs Date: Mon, 3 Apr 2023 18:43:42 +0300 Message-ID: <20230403154342.3108-3-Ibrahim.Tilki@analog.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230403154342.3108-1-Ibrahim.Tilki@analog.com> References: <20230403154342.3108-1-Ibrahim.Tilki@analog.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-GUID: cyUH7xeTZJIQvvu5oxSTGldr_3hVtBt- X-Proofpoint-ORIG-GUID: cyUH7xeTZJIQvvu5oxSTGldr_3hVtBt- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-03_12,2023-04-03_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 spamscore=0 impostorscore=0 lowpriorityscore=0 bulkscore=0 malwarescore=0 suspectscore=0 clxscore=1015 priorityscore=1501 mlxlogscore=999 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304030114 X-Spam-Status: No, score=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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?1762170803947670937?= X-GMAIL-MSGID: =?utf-8?q?1762170803947670937?= |
Series |
drivers: rtc: add max313xx series rtc driver
|
|
Commit Message
Tilki, Ibrahim
April 3, 2023, 3:43 p.m. UTC
Devicetree binding documentation for Analog Devices MAX313XX RTCs Signed-off-by: Ibrahim Tilki <Ibrahim.Tilki@analog.com> Signed-off-by: Zeynep Arslanbenzer <Zeynep.Arslanbenzer@analog.com> --- .../devicetree/bindings/rtc/adi,max313xx.yaml | 144 ++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 Documentation/devicetree/bindings/rtc/adi,max313xx.yaml
Comments
On 03/04/2023 17:43, Ibrahim Tilki wrote: > Devicetree binding documentation for Analog Devices MAX313XX RTCs > > Signed-off-by: Ibrahim Tilki <Ibrahim.Tilki@analog.com> > Signed-off-by: Zeynep Arslanbenzer <Zeynep.Arslanbenzer@analog.com> > --- > .../devicetree/bindings/rtc/adi,max313xx.yaml | 144 ++++++++++++++++++ > 1 file changed, 144 insertions(+) > create mode 100644 Documentation/devicetree/bindings/rtc/adi,max313xx.yaml > > diff --git a/Documentation/devicetree/bindings/rtc/adi,max313xx.yaml b/Documentation/devicetree/bindings/rtc/adi,max313xx.yaml > new file mode 100644 > index 000000000..0c17a395e > --- /dev/null > +++ b/Documentation/devicetree/bindings/rtc/adi,max313xx.yaml > @@ -0,0 +1,144 @@ > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) > +# Copyright 2022 Analog Devices Inc. > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/rtc/adi,max313xx.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Analog Devices MAX313XX series I2C RTCs > + > +maintainers: > + - Ibrahim Tilki <Ibrahim.Tilki@analog.com> > + - Zeynep Arslanbenzer <Zeynep.Arslanbenzer@analog.com> > + > +description: Analog Devices MAX313XX series I2C RTCs. > + > +properties: > + compatible: > + enum: > + - adi,max31328 > + - adi,max31329 > + - adi,max31331 > + - adi,max31334 > + - adi,max31341 > + - adi,max31342 > + - adi,max31343 > + > + reg: > + description: I2C address of the RTC > + items: > + - enum: [0x68, 0x69] > + > + interrupts: > + description: | Do not need '|'. > + Alarm1 interrupt line of the RTC. Some of the RTCs have two interrupt > + lines and alarm1 interrupt muxing depends on the clockin/clockout > + configuration. > + maxItems: 1 > + > + "#clock-cells": > + description: | Do not need '|'. > + RTC can be used as a clock source through its clock output pin when > + supplied. > + const: 0 > + > + clocks: > + description: | Do not need '|'. > + RTC uses this clock for clock input when supplied. Clock has to provide > + one of these four frequencies: 1Hz, 50Hz, 60Hz or 32.768kHz. > + maxItems: 1 > + > + aux-voltage-chargeable: > + enum: [0, 1, 2] > + description: | > + Enables trickle charger. > + 0: Charger is disabled (default) > + 1: Charger is enabled > + 2: Charger is enabled with a diode 2 is not an allowed value. I asked to drop this property. It is coming from rtc.yaml. I also do not understand "with a diode". So otherwise it is charging with, I don't know, FET? > + > + trickle-resistor-ohms: > + description: Selected resistor for trickle charger. > + enum: [3000, 6000, 11000] > + > +required: > + - compatible > + - reg > + Best regards, Krzysztof
On 04/04/2023 08:17:40+0200, Krzysztof Kozlowski wrote: > On 03/04/2023 17:43, Ibrahim Tilki wrote: > > Devicetree binding documentation for Analog Devices MAX313XX RTCs > > > > Signed-off-by: Ibrahim Tilki <Ibrahim.Tilki@analog.com> > > Signed-off-by: Zeynep Arslanbenzer <Zeynep.Arslanbenzer@analog.com> > > --- > > .../devicetree/bindings/rtc/adi,max313xx.yaml | 144 ++++++++++++++++++ > > 1 file changed, 144 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/rtc/adi,max313xx.yaml > > > > diff --git a/Documentation/devicetree/bindings/rtc/adi,max313xx.yaml b/Documentation/devicetree/bindings/rtc/adi,max313xx.yaml > > new file mode 100644 > > index 000000000..0c17a395e > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/rtc/adi,max313xx.yaml > > @@ -0,0 +1,144 @@ > > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) > > +# Copyright 2022 Analog Devices Inc. > > +%YAML 1.2 > > +--- > > +$id: http://devicetree.org/schemas/rtc/adi,max313xx.yaml# > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > + > > +title: Analog Devices MAX313XX series I2C RTCs > > + > > +maintainers: > > + - Ibrahim Tilki <Ibrahim.Tilki@analog.com> > > + - Zeynep Arslanbenzer <Zeynep.Arslanbenzer@analog.com> > > + > > +description: Analog Devices MAX313XX series I2C RTCs. > > + > > +properties: > > + compatible: > > + enum: > > + - adi,max31328 > > + - adi,max31329 > > + - adi,max31331 > > + - adi,max31334 > > + - adi,max31341 > > + - adi,max31342 > > + - adi,max31343 > > + > > + reg: > > + description: I2C address of the RTC > > + items: > > + - enum: [0x68, 0x69] > > + > > + interrupts: > > + description: | > > Do not need '|'. > > > + Alarm1 interrupt line of the RTC. Some of the RTCs have two interrupt > > + lines and alarm1 interrupt muxing depends on the clockin/clockout > > + configuration. > > + maxItems: 1 > > + > > + "#clock-cells": > > + description: | > > Do not need '|'. > > > + RTC can be used as a clock source through its clock output pin when > > + supplied. > > + const: 0 > > + > > + clocks: > > + description: | > > Do not need '|'. > > > + RTC uses this clock for clock input when supplied. Clock has to provide > > + one of these four frequencies: 1Hz, 50Hz, 60Hz or 32.768kHz. > > + maxItems: 1 > > + > > + aux-voltage-chargeable: > > + enum: [0, 1, 2] > > + description: | > > + Enables trickle charger. > > + 0: Charger is disabled (default) > > + 1: Charger is enabled > > + 2: Charger is enabled with a diode > > 2 is not an allowed value. I asked to drop this property. It is coming > from rtc.yaml. I also do not understand "with a diode". So otherwise it > is charging with, I don't know, FET? No, what is not explained here (and maybe not unsterstood by the submitter) is that the RTC has an extra diode so, charging will always enable a diode, select a resistor and then have or not an extra diode. Figure2 of the MAX31329 datasheet is great. > > > + > > + trickle-resistor-ohms: > > + description: Selected resistor for trickle charger. > > + enum: [3000, 6000, 11000] > > + > > +required: > > + - compatible > > + - reg > > + > Best regards, > Krzysztof >
On 04/04/2023 09:10, Alexandre Belloni wrote: >> >>> + RTC can be used as a clock source through its clock output pin when >>> + supplied. >>> + const: 0 >>> + >>> + clocks: >>> + description: | >> >> Do not need '|'. >> >>> + RTC uses this clock for clock input when supplied. Clock has to provide >>> + one of these four frequencies: 1Hz, 50Hz, 60Hz or 32.768kHz. >>> + maxItems: 1 >>> + >>> + aux-voltage-chargeable: >>> + enum: [0, 1, 2] >>> + description: | >>> + Enables trickle charger. >>> + 0: Charger is disabled (default) >>> + 1: Charger is enabled >>> + 2: Charger is enabled with a diode >> >> 2 is not an allowed value. I asked to drop this property. It is coming >> from rtc.yaml. I also do not understand "with a diode". So otherwise it >> is charging with, I don't know, FET? > > No, what is not explained here (and maybe not unsterstood by the > submitter) is that the RTC has an extra diode so, Value of 2 is still not allowed and if the patch was tested, it would be clearly visible. Unfortunately patch was not tested... > charging will always > enable a diode, select a resistor and then have or not an extra diode. > Figure2 of the MAX31329 datasheet is great. So the diode is in the max313xx? Then why enabling it is a property of DT? Either this should be inferred from compatible or is even a policy, not a DT property. Just because device has a register for something, is not an argument that "something" should be in DT. Best regards, Krzysztof
On 04/04/2023 09:21:56+0200, Krzysztof Kozlowski wrote: > On 04/04/2023 09:10, Alexandre Belloni wrote: > >> > >>> + RTC can be used as a clock source through its clock output pin when > >>> + supplied. > >>> + const: 0 > >>> + > >>> + clocks: > >>> + description: | > >> > >> Do not need '|'. > >> > >>> + RTC uses this clock for clock input when supplied. Clock has to provide > >>> + one of these four frequencies: 1Hz, 50Hz, 60Hz or 32.768kHz. > >>> + maxItems: 1 > >>> + > >>> + aux-voltage-chargeable: > >>> + enum: [0, 1, 2] > >>> + description: | > >>> + Enables trickle charger. > >>> + 0: Charger is disabled (default) > >>> + 1: Charger is enabled > >>> + 2: Charger is enabled with a diode > >> > >> 2 is not an allowed value. I asked to drop this property. It is coming > >> from rtc.yaml. I also do not understand "with a diode". So otherwise it > >> is charging with, I don't know, FET? > > > > No, what is not explained here (and maybe not unsterstood by the > > submitter) is that the RTC has an extra diode so, > > Value of 2 is still not allowed and if the patch was tested, it would be > clearly visible. Unfortunately patch was not tested... > > > charging will always > > enable a diode, select a resistor and then have or not an extra diode. > > Figure2 of the MAX31329 datasheet is great. > > So the diode is in the max313xx? Then why enabling it is a property of > DT? Either this should be inferred from compatible or is even a policy, > not a DT property. Just because device has a register for something, is > not an argument that "something" should be in DT. Well, it depends on the battery that is installed on the board so it makes sense to have it in DT.
On 04/04/2023 09:44, Alexandre Belloni wrote: >> >>> charging will always >>> enable a diode, select a resistor and then have or not an extra diode. >>> Figure2 of the MAX31329 datasheet is great. >> >> So the diode is in the max313xx? Then why enabling it is a property of >> DT? Either this should be inferred from compatible or is even a policy, >> not a DT property. Just because device has a register for something, is >> not an argument that "something" should be in DT. > > Well, it depends on the battery that is installed on the board so it > makes sense to have it in DT. OK, that would be a good reason, but I wonder why? Why choosing diode or not depends on the battery? Wouldn't you always want to have the diode? Best regards, Krzysztof
> On 04/04/2023 08:17:40+0200, Krzysztof Kozlowski wrote: > > On 03/04/2023 17:43, Ibrahim Tilki wrote: > > > Devicetree binding documentation for Analog Devices MAX313XX RTCs > > > > > > Signed-off-by: Ibrahim Tilki <Ibrahim.Tilki@analog.com> > > > Signed-off-by: Zeynep Arslanbenzer <Zeynep.Arslanbenzer@analog.com> > > > --- > > > .../devicetree/bindings/rtc/adi,max313xx.yaml | 144 ++++++++++++++++++ > > > 1 file changed, 144 insertions(+) > > > create mode 100644 Documentation/devicetree/bindings/rtc/adi,max313xx.yaml > > > > > > diff --git a/Documentation/devicetree/bindings/rtc/adi,max313xx.yaml \ > > > b/Documentation/devicetree/bindings/rtc/adi,max313xx.yaml new file mode 100644 > > > index 000000000..0c17a395e > > > --- /dev/null > > > +++ b/Documentation/devicetree/bindings/rtc/adi,max313xx.yaml > > > @@ -0,0 +1,144 @@ > > > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) > > > +# Copyright 2022 Analog Devices Inc. > > > +%YAML 1.2 > > > +--- > > > +$id: http://devicetree.org/schemas/rtc/adi,max313xx.yaml# > > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > > + > > > +title: Analog Devices MAX313XX series I2C RTCs > > > + > > > +maintainers: > > > + - Ibrahim Tilki <Ibrahim.Tilki@analog.com> > > > + - Zeynep Arslanbenzer <Zeynep.Arslanbenzer@analog.com> > > > + > > > +description: Analog Devices MAX313XX series I2C RTCs. > > > + > > > +properties: > > > + compatible: > > > + enum: > > > + - adi,max31328 > > > + - adi,max31329 > > > + - adi,max31331 > > > + - adi,max31334 > > > + - adi,max31341 > > > + - adi,max31342 > > > + - adi,max31343 > > > + > > > + reg: > > > + description: I2C address of the RTC > > > + items: > > > + - enum: [0x68, 0x69] > > > + > > > + interrupts: > > > + description: | > > > > Do not need '|'. > > > > > + Alarm1 interrupt line of the RTC. Some of the RTCs have two interrupt > > > + lines and alarm1 interrupt muxing depends on the clockin/clockout > > > + configuration. > > > + maxItems: 1 > > > + > > > + "#clock-cells": > > > + description: | > > > > Do not need '|'. > > > > > + RTC can be used as a clock source through its clock output pin when > > > + supplied. > > > + const: 0 > > > + > > > + clocks: > > > + description: | > > > > Do not need '|'. > > > > > + RTC uses this clock for clock input when supplied. Clock has to provide > > > + one of these four frequencies: 1Hz, 50Hz, 60Hz or 32.768kHz. > > > + maxItems: 1 > > > + > > > + aux-voltage-chargeable: > > > + enum: [0, 1, 2] > > > + description: | > > > + Enables trickle charger. > > > + 0: Charger is disabled (default) > > > + 1: Charger is enabled > > > + 2: Charger is enabled with a diode > > > > 2 is not an allowed value. I asked to drop this property. It is coming > > from rtc.yaml. I also do not understand "with a diode". So otherwise it > > is charging with, I don't know, FET? > > No, what is not explained here (and maybe not unsterstood by the > submitter) is that the RTC has an extra diode so, charging will always > enable a diode, select a resistor and then have or not an extra diode. > Figure2 of the MAX31329 datasheet is great. > That is exactly why I had "adi,trickle-diode-enable" property in previous patch. So if I can't have "adi,trickle-diode-enable" and can't add an additional value to "aux-voltage-chargeable", I am not sure how to add support for the extra diode at this point. Best regards, Ibrahim > > > > > + > > > + trickle-resistor-ohms: > > > + description: Selected resistor for trickle charger. > > > + enum: [3000, 6000, 11000] > > > + > > > +required: > > > + - compatible > > > + - reg > > > + > > Best regards, > > Krzysztof > >
> On 04/04/2023 09:44, Alexandre Belloni wrote: > >> > >>> charging will always > >>> enable a diode, select a resistor and then have or not an extra diode. > >>> Figure2 of the MAX31329 datasheet is great. > >> > >> So the diode is in the max313xx? Then why enabling it is a property of > >> DT? Either this should be inferred from compatible or is even a policy, > >> not a DT property. Just because device has a register for something, is > >> not an argument that "something" should be in DT. > > > > Well, it depends on the battery that is installed on the board so it > > makes sense to have it in DT. > > OK, that would be a good reason, but I wonder why? Why choosing diode or > not depends on the battery? Wouldn't you always want to have the diode? > > Best regards, > Krzysztof The datasheet doesn't say much about the extra diode but there is always a schottky diode. The extra diode might be there to cause voltage drop. Best regards, Ibrahim
On 04/04/2023 10:14:33+0200, Krzysztof Kozlowski wrote: > On 04/04/2023 09:44, Alexandre Belloni wrote: > >> > >>> charging will always > >>> enable a diode, select a resistor and then have or not an extra diode. > >>> Figure2 of the MAX31329 datasheet is great. > >> > >> So the diode is in the max313xx? Then why enabling it is a property of > >> DT? Either this should be inferred from compatible or is even a policy, > >> not a DT property. Just because device has a register for something, is > >> not an argument that "something" should be in DT. > > > > Well, it depends on the battery that is installed on the board so it > > makes sense to have it in DT. > > OK, that would be a good reason, but I wonder why? Why choosing diode or > not depends on the battery? Wouldn't you always want to have the diode? > It limits the maximum current used to charge the battery or supercap to not exceed what is allowed.
On 04/04/2023 11:56, Alexandre Belloni wrote: > On 04/04/2023 10:14:33+0200, Krzysztof Kozlowski wrote: >> On 04/04/2023 09:44, Alexandre Belloni wrote: >>>> >>>>> charging will always >>>>> enable a diode, select a resistor and then have or not an extra diode. >>>>> Figure2 of the MAX31329 datasheet is great. >>>> >>>> So the diode is in the max313xx? Then why enabling it is a property of >>>> DT? Either this should be inferred from compatible or is even a policy, >>>> not a DT property. Just because device has a register for something, is >>>> not an argument that "something" should be in DT. >>> >>> Well, it depends on the battery that is installed on the board so it >>> makes sense to have it in DT. >> >> OK, that would be a good reason, but I wonder why? Why choosing diode or >> not depends on the battery? Wouldn't you always want to have the diode? >> > > It limits the maximum current used to charge the battery or supercap to > not exceed what is allowed. and I still wonder why someone would like to allow exceeding what is allowed. IOW, what is the use case to disable the diode? Best regards, Krzysztof
On 04/04/2023 11:26, Tilki, Ibrahim wrote: >>>> + aux-voltage-chargeable: >>>> + enum: [0, 1, 2] >>>> + description: | >>>> + Enables trickle charger. >>>> + 0: Charger is disabled (default) >>>> + 1: Charger is enabled >>>> + 2: Charger is enabled with a diode >>> >>> 2 is not an allowed value. I asked to drop this property. It is coming >>> from rtc.yaml. I also do not understand "with a diode". So otherwise it >>> is charging with, I don't know, FET? >> >> No, what is not explained here (and maybe not unsterstood by the >> submitter) is that the RTC has an extra diode so, charging will always >> enable a diode, select a resistor and then have or not an extra diode. >> Figure2 of the MAX31329 datasheet is great. >> > > That is exactly why I had "adi,trickle-diode-enable" property in previous patch. > So if I can't have "adi,trickle-diode-enable" and can't add an additional value > to "aux-voltage-chargeable", I am not sure how to add support for the extra > diode at this point. Ask the person who asked you to remove adi,trickle-diode-enable... Anyway even if you decided to go with such advise, the solution is not to create binding which fails. Best regards, Krzysztof
>>>>> + aux-voltage-chargeable: >>>>> + enum: [0, 1, 2] >>>>> + description: | >>>>> + Enables trickle charger. >>>>> + 0: Charger is disabled (default) >>>>> + 1: Charger is enabled >>>>> + 2: Charger is enabled with a diode >>>> >>>> 2 is not an allowed value. I asked to drop this property. It is coming >>>> from rtc.yaml. I also do not understand "with a diode". So otherwise it >>>> is charging with, I don't know, FET? >>> >>> No, what is not explained here (and maybe not unsterstood by the >>> submitter) is that the RTC has an extra diode so, charging will always >>> enable a diode, select a resistor and then have or not an extra diode. >>> Figure2 of the MAX31329 datasheet is great. >>> >> >> That is exactly why I had "adi,trickle-diode-enable" property in previous patch. >> So if I can't have "adi,trickle-diode-enable" and can't add an additional value >> to "aux-voltage-chargeable", I am not sure how to add support for the extra >> diode at this point. > > Ask the person who asked you to remove adi,trickle-diode-enable... That was the purpose. > Anyway even if you decided to go with such advise, the solution is not > to create binding which fails. I didn't see that it would fail, should have checked the binding with using the property in examples. I'm sorry about that. Best regards, Ibrahim
On 04/04/2023 12:06:14+0200, Krzysztof Kozlowski wrote: > On 04/04/2023 11:56, Alexandre Belloni wrote: > > On 04/04/2023 10:14:33+0200, Krzysztof Kozlowski wrote: > >> On 04/04/2023 09:44, Alexandre Belloni wrote: > >>>> > >>>>> charging will always > >>>>> enable a diode, select a resistor and then have or not an extra diode. > >>>>> Figure2 of the MAX31329 datasheet is great. > >>>> > >>>> So the diode is in the max313xx? Then why enabling it is a property of > >>>> DT? Either this should be inferred from compatible or is even a policy, > >>>> not a DT property. Just because device has a register for something, is > >>>> not an argument that "something" should be in DT. > >>> > >>> Well, it depends on the battery that is installed on the board so it > >>> makes sense to have it in DT. > >> > >> OK, that would be a good reason, but I wonder why? Why choosing diode or > >> not depends on the battery? Wouldn't you always want to have the diode? > >> > > > > It limits the maximum current used to charge the battery or supercap to > > not exceed what is allowed. > > and I still wonder why someone would like to allow exceeding what is > allowed. IOW, what is the use case to disable the diode? > The battery or supercap is the part defining the current limit. why would you want to limit the current if you can charge faster?
On 04/04/2023 10:35:53+0000, Tilki, Ibrahim wrote: > >>>>> + aux-voltage-chargeable: > >>>>> + enum: [0, 1, 2] > >>>>> + description: | > >>>>> + Enables trickle charger. > >>>>> + 0: Charger is disabled (default) > >>>>> + 1: Charger is enabled > >>>>> + 2: Charger is enabled with a diode > >>>> > >>>> 2 is not an allowed value. I asked to drop this property. It is coming > >>>> from rtc.yaml. I also do not understand "with a diode". So otherwise it > >>>> is charging with, I don't know, FET? > >>> > >>> No, what is not explained here (and maybe not unsterstood by the > >>> submitter) is that the RTC has an extra diode so, charging will always > >>> enable a diode, select a resistor and then have or not an extra diode. > >>> Figure2 of the MAX31329 datasheet is great. > >>> > >> > >> That is exactly why I had "adi,trickle-diode-enable" property in previous patch. > >> So if I can't have "adi,trickle-diode-enable" and can't add an additional value > >> to "aux-voltage-chargeable", I am not sure how to add support for the extra > >> diode at this point. > > > > Ask the person who asked you to remove adi,trickle-diode-enable... > > That was the purpose. > If the earlier submission was clearer my answer would have been different but note how I had to dig up the datasheet to understand there were two diodes. All the trickle chargers have a schottky diode so "adi,trickle-diode-enable" nor the commit log were explicit about the second diode (which is a regular diode). aux-voltage-chargeable is enabling a diode on all the existing RTC drivers so instead of trying to make me look like the bad guy you should rather thank for taking the time trying to get better DT bindings.
On 04/04/2023 14:26:18+0200, Alexandre Belloni wrote: > On 04/04/2023 10:35:53+0000, Tilki, Ibrahim wrote: > > >>>>> + aux-voltage-chargeable: > > >>>>> + enum: [0, 1, 2] > > >>>>> + description: | > > >>>>> + Enables trickle charger. > > >>>>> + 0: Charger is disabled (default) > > >>>>> + 1: Charger is enabled > > >>>>> + 2: Charger is enabled with a diode > > >>>> > > >>>> 2 is not an allowed value. I asked to drop this property. It is coming > > >>>> from rtc.yaml. I also do not understand "with a diode". So otherwise it > > >>>> is charging with, I don't know, FET? > > >>> > > >>> No, what is not explained here (and maybe not unsterstood by the > > >>> submitter) is that the RTC has an extra diode so, charging will always > > >>> enable a diode, select a resistor and then have or not an extra diode. > > >>> Figure2 of the MAX31329 datasheet is great. > > >>> > > >> > > >> That is exactly why I had "adi,trickle-diode-enable" property in previous patch. > > >> So if I can't have "adi,trickle-diode-enable" and can't add an additional value > > >> to "aux-voltage-chargeable", I am not sure how to add support for the extra > > >> diode at this point. > > > > > > Ask the person who asked you to remove adi,trickle-diode-enable... > > > > That was the purpose. > > > > If the earlier submission was clearer my answer would have been > different but note how I had to dig up the datasheet to understand there > were two diodes. All the trickle chargers have a schottky diode so > "adi,trickle-diode-enable" nor the commit log were explicit about the > second diode (which is a regular diode). > > aux-voltage-chargeable is enabling a diode on all the existing RTC > drivers so instead of trying to make me look like the bad guy you should > rather thank for taking the time trying to get better DT bindings. > BTW, Krzysztof, you should focus more on how v5 of the driver is still abusing the #clock-cells property to do pinmuxing after I repeatedly explain to not do that.
On 04/04/2023 14:29, Alexandre Belloni wrote: > On 04/04/2023 14:26:18+0200, Alexandre Belloni wrote: >> On 04/04/2023 10:35:53+0000, Tilki, Ibrahim wrote: >>>>>>>> + aux-voltage-chargeable: >>>>>>>> + enum: [0, 1, 2] >>>>>>>> + description: | >>>>>>>> + Enables trickle charger. >>>>>>>> + 0: Charger is disabled (default) >>>>>>>> + 1: Charger is enabled >>>>>>>> + 2: Charger is enabled with a diode >>>>>>> >>>>>>> 2 is not an allowed value. I asked to drop this property. It is coming >>>>>>> from rtc.yaml. I also do not understand "with a diode". So otherwise it >>>>>>> is charging with, I don't know, FET? >>>>>> >>>>>> No, what is not explained here (and maybe not unsterstood by the >>>>>> submitter) is that the RTC has an extra diode so, charging will always >>>>>> enable a diode, select a resistor and then have or not an extra diode. >>>>>> Figure2 of the MAX31329 datasheet is great. >>>>>> >>>>> >>>>> That is exactly why I had "adi,trickle-diode-enable" property in previous patch. >>>>> So if I can't have "adi,trickle-diode-enable" and can't add an additional value >>>>> to "aux-voltage-chargeable", I am not sure how to add support for the extra >>>>> diode at this point. >>>> >>>> Ask the person who asked you to remove adi,trickle-diode-enable... >>> >>> That was the purpose. >>> >> >> If the earlier submission was clearer my answer would have been >> different but note how I had to dig up the datasheet to understand there >> were two diodes. All the trickle chargers have a schottky diode so >> "adi,trickle-diode-enable" nor the commit log were explicit about the >> second diode (which is a regular diode). >> >> aux-voltage-chargeable is enabling a diode on all the existing RTC >> drivers so instead of trying to make me look like the bad guy you should >> rather thank for taking the time trying to get better DT bindings. >> > > BTW, Krzysztof, you should focus more on how v5 of the driver is still > abusing the #clock-cells property to do pinmuxing after I repeatedly > explain to not do that. Uh, I assumed #clock-cells in the binding is for its purpose - clocks. I am rarely verifying driver implementation. Best regards, Krzysztof
On 03/04/2023 17:43, Ibrahim Tilki wrote: > Devicetree binding documentation for Analog Devices MAX313XX RTCs > > Signed-off-by: Ibrahim Tilki <Ibrahim.Tilki@analog.com> > Signed-off-by: Zeynep Arslanbenzer <Zeynep.Arslanbenzer@analog.com> > --- > .../devicetree/bindings/rtc/adi,max313xx.yaml | 144 ++++++++++++++++++ > 1 file changed, 144 insertions(+) > create mode 100644 Documentation/devicetree/bindings/rtc/adi,max313xx.yaml > > diff --git a/Documentation/devicetree/bindings/rtc/adi,max313xx.yaml b/Documentation/devicetree/bindings/rtc/adi,max313xx.yaml > new file mode 100644 > index 000000000..0c17a395e > --- /dev/null > +++ b/Documentation/devicetree/bindings/rtc/adi,max313xx.yaml > @@ -0,0 +1,144 @@ > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) > +# Copyright 2022 Analog Devices Inc. > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/rtc/adi,max313xx.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Analog Devices MAX313XX series I2C RTCs > + > +maintainers: > + - Ibrahim Tilki <Ibrahim.Tilki@analog.com> > + - Zeynep Arslanbenzer <Zeynep.Arslanbenzer@analog.com> > + > +description: Analog Devices MAX313XX series I2C RTCs. > + > +properties: > + compatible: > + enum: > + - adi,max31328 > + - adi,max31329 > + - adi,max31331 > + - adi,max31334 > + - adi,max31341 > + - adi,max31342 > + - adi,max31343 > + > + reg: > + description: I2C address of the RTC > + items: > + - enum: [0x68, 0x69] > + > + interrupts: > + description: | > + Alarm1 interrupt line of the RTC. Some of the RTCs have two interrupt > + lines and alarm1 interrupt muxing depends on the clockin/clockout > + configuration. > + maxItems: 1 > + > + "#clock-cells": > + description: | > + RTC can be used as a clock source through its clock output pin when > + supplied. This part is correct, but your implementation is not. I don't think you can disable or enable interrupts, based on usage of clock. Either this is clock (gated or not) or interrupt, not both. Best regards, Krzysztof
> >>>>>> + aux-voltage-chargeable: > >>>>>> + enum: [0, 1, 2] > >>>>>> + description: | > >>>>>> + Enables trickle charger. > >>>>>> + 0: Charger is disabled (default) > >>>>>> + 1: Charger is enabled > >>>>>> + 2: Charger is enabled with a diode > >>>>> > >>>>> 2 is not an allowed value. I asked to drop this property. It is coming > >>>>> from rtc.yaml. I also do not understand "with a diode". So otherwise it > >>>>> is charging with, I don't know, FET? > >>>> > >>>> No, what is not explained here (and maybe not unsterstood by the > >>>> submitter) is that the RTC has an extra diode so, charging will always > >>>> enable a diode, select a resistor and then have or not an extra diode. > >>>> Figure2 of the MAX31329 datasheet is great. > >>>> > >>> > >>> That is exactly why I had "adi,trickle-diode-enable" property in previous patch. > >>> So if I can't have "adi,trickle-diode-enable" and can't add an additional value > >>> to "aux-voltage-chargeable", I am not sure how to add support for the extra > >>> diode at this point. > >> > >> Ask the person who asked you to remove adi,trickle-diode-enable... > > > > That was the purpose. > > > > If the earlier submission was clearer my answer would have been > different but note how I had to dig up the datasheet to understand there > were two diodes. All the trickle chargers have a schottky diode so > "adi,trickle-diode-enable" nor the commit log were explicit about the > second diode (which is a regular diode). > > aux-voltage-chargeable is enabling a diode on all the existing RTC > drivers so instead of trying to make me look like the bad guy you should > rather thank for taking the time trying to get better DT bindings. With all due respect, I am not trying to make you look like the bad guy. It wouldn't help me in any way. It is just that this is a non-verbal communication channel, if anything. I didn't think "That was the purpose" would sound rude here and my apoligies if it does. I am just trying to understand your expectations and this was my interpretation of your comment on v4. So, "adi,trickle-diode-enable" it is or should I change the name? The datasheet doesn't say anything but "diode". Best regards, Ibrahim
> > + interrupts: > > + description: | > > + Alarm1 interrupt line of the RTC. Some of the RTCs have two interrupt > > + lines and alarm1 interrupt muxing depends on the clockin/clockout > > + configuration. > > + maxItems: 1 > > + > > + "#clock-cells": > > + description: | > > + RTC can be used as a clock source through its clock output pin when > > + supplied. > > This part is correct, but your implementation is not. I don't think you > can disable or enable interrupts, based on usage of clock. Either this > is clock (gated or not) or interrupt, not both. > The driver doesn't enable or disable interrupts based on clock usage. It checks whether the IRQ is possible or not. Enablement of interrupt depends on the "interrupts" property. The tricky part is that interrupt muxing depends on clock configuration. Let me briefly explain the behavior of RTCs and the driver[v4] MAX31328: - Has a single pin which is either used as IRQ or clock output. - Driver aborts probe with "-EOPNOTSUPP" when user requests irq and clockout at the same time. In other words, when both "interrupts" and "#clock-cells" properties are present. Otherwise, we are fine. MAX31331: MAX31334: - Has two pins: INTA and INTB/CLOCKOUT. INTA pin is dedicated for interrupt. INTB pin is used as either interrupt or clockout. The Alarm1 interrupt is muxed into INTB by default. If the CLOCKOUT is enabled, Alarm1 irq is muxed into INTA. We don't have further control over interrupt muxing. - Driver checks for "#clock-cells". If it is present, it enables the clockout so that we can get interrupt from INTA. The Rest: - Has two pins: INTA/CLKIN and INTB/CLOCKOUT. Alarm1 interrupt is muxed into INTA by default, muxed into INTB if and only if we enable CLKIN. - Driver aborts probe with -EOPNOTSUPP when user requests interrupt, clockin and clockout at the same time. We can't have all three with two pins. Unfortunately we don't have control over the interrupt muxing other than clock configuration. How should the driver approach this? Best regards, Ibrahim
On 04/04/2023 17:40, Tilki, Ibrahim wrote: >>> + interrupts: >>> + description: | >>> + Alarm1 interrupt line of the RTC. Some of the RTCs have two interrupt >>> + lines and alarm1 interrupt muxing depends on the clockin/clockout >>> + configuration. >>> + maxItems: 1 >>> + >>> + "#clock-cells": >>> + description: | >>> + RTC can be used as a clock source through its clock output pin when >>> + supplied. >> >> This part is correct, but your implementation is not. I don't think you >> can disable or enable interrupts, based on usage of clock. Either this >> is clock (gated or not) or interrupt, not both. >> > > The driver doesn't enable or disable interrupts based on clock usage. It checks > whether the IRQ is possible or not. Enablement of interrupt depends on the > "interrupts" property. The tricky part is that interrupt muxing depends on > clock configuration. I think it is not what your driver is doing. It checks if clock-cells... > > Let me briefly explain the behavior of RTCs and the driver[v4] > > MAX31328: > - Has a single pin which is either used as IRQ or clock output. > - Driver aborts probe with "-EOPNOTSUPP" when user requests irq and clockout > at the same time. In other words, when both "interrupts" and "#clock-cells" > properties are present. Otherwise, we are fine. Why? These are fixed properties of the device. It is always a clock controller and always has interrupt line. The choice between them is depending on pins, so pin control. > > MAX31331: > MAX31334: > - Has two pins: INTA and INTB/CLOCKOUT. INTA pin is dedicated for interrupt. > INTB pin is used as either interrupt or clockout. The Alarm1 interrupt is > muxed into INTB by default. If the CLOCKOUT is enabled, Alarm1 irq is muxed > into INTA. We don't have further control over interrupt muxing. > - Driver checks for "#clock-cells". If it is present, it enables the clockout > so that we can get interrupt from INTA. > > The Rest: > - Has two pins: INTA/CLKIN and INTB/CLOCKOUT. Alarm1 interrupt is muxed into > INTA by default, muxed into INTB if and only if we enable CLKIN. > - Driver aborts probe with -EOPNOTSUPP when user requests interrupt, clockin > and clockout at the same time. We can't have all three with two pins. > > > Unfortunately we don't have control over the interrupt muxing other than clock > configuration. How should the driver approach this? Pinmux with two states - interrupt or clock. Best regards, Krzysztof
diff --git a/Documentation/devicetree/bindings/rtc/adi,max313xx.yaml b/Documentation/devicetree/bindings/rtc/adi,max313xx.yaml new file mode 100644 index 000000000..0c17a395e --- /dev/null +++ b/Documentation/devicetree/bindings/rtc/adi,max313xx.yaml @@ -0,0 +1,144 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +# Copyright 2022 Analog Devices Inc. +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/rtc/adi,max313xx.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Analog Devices MAX313XX series I2C RTCs + +maintainers: + - Ibrahim Tilki <Ibrahim.Tilki@analog.com> + - Zeynep Arslanbenzer <Zeynep.Arslanbenzer@analog.com> + +description: Analog Devices MAX313XX series I2C RTCs. + +properties: + compatible: + enum: + - adi,max31328 + - adi,max31329 + - adi,max31331 + - adi,max31334 + - adi,max31341 + - adi,max31342 + - adi,max31343 + + reg: + description: I2C address of the RTC + items: + - enum: [0x68, 0x69] + + interrupts: + description: | + Alarm1 interrupt line of the RTC. Some of the RTCs have two interrupt + lines and alarm1 interrupt muxing depends on the clockin/clockout + configuration. + maxItems: 1 + + "#clock-cells": + description: | + RTC can be used as a clock source through its clock output pin when + supplied. + const: 0 + + clocks: + description: | + RTC uses this clock for clock input when supplied. Clock has to provide + one of these four frequencies: 1Hz, 50Hz, 60Hz or 32.768kHz. + maxItems: 1 + + aux-voltage-chargeable: + enum: [0, 1, 2] + description: | + Enables trickle charger. + 0: Charger is disabled (default) + 1: Charger is enabled + 2: Charger is enabled with a diode + + trickle-resistor-ohms: + description: Selected resistor for trickle charger. + enum: [3000, 6000, 11000] + +required: + - compatible + - reg + +allOf: + - $ref: rtc.yaml# + - if: + properties: + compatible: + contains: + enum: + - adi,max31328 + - adi,max31342 + + then: + properties: + aux-voltage-chargeable: false + trickle-resistor-ohms: false + + - if: + properties: + compatible: + contains: + enum: + - adi,max31328 + - adi,max31331 + - adi,max31334 + - adi,max31343 + + then: + properties: + clocks: false + + - if: + properties: + compatible: + contains: + enum: + - adi,max31341 + - adi,max31342 + + then: + properties: + reg: + items: + - const: 0x69 + + else: + properties: + reg: + items: + - const: 0x68 + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + i2c { + #address-cells = <1>; + #size-cells = <0>; + + rtc@68 { + reg = <0x68>; + compatible = "adi,max31329"; + clocks = <&clkin>; + interrupt-parent = <&gpio>; + interrupts = <26 IRQ_TYPE_EDGE_FALLING>; + }; + }; + - | + #include <dt-bindings/interrupt-controller/irq.h> + i2c { + #address-cells = <1>; + #size-cells = <0>; + + rtc@68 { + reg = <0x68>; + compatible = "adi,max31331"; + #clock-cells = <0>; + }; + };