Message ID | 20221019133910.282-2-Ibrahim.Tilki@analog.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp402275wrs; Wed, 19 Oct 2022 08:58:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4gr63n6b1tE3gxrimaIGQrwf8cjIrv+fCV6a2TfMALo0nAkNlcHj/QIv5Ix5KzqR8KRmJp X-Received: by 2002:a17:902:b717:b0:184:4a5c:c74a with SMTP id d23-20020a170902b71700b001844a5cc74amr9399728pls.0.1666195097158; Wed, 19 Oct 2022 08:58:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666195097; cv=none; d=google.com; s=arc-20160816; b=hryPMR7LHxaAMdJVzc01RlYxJdT6mplIEgU3G99smzzGoGjqCkubXG1TBwbjyjWYzV MykfDwu1qGbbAUdOHpdeBGI55iC5F/FANXUEy1xxKvtMU6VIZCipAyWyZFOPQPUFUNPj GpTJXMGJti7vGmgfJb1F6/U9YWjLkMd1fFuzj3QcOBB+tdaCZa1yOhPLnmQaH012gtzd B2sEq9jQ+1XwK3YFK2yr013MxEsRNWOFFETwBqFuxq33dkSrJooE88iaZsqhlxcjBe/S 01gtgKR5rOn7v72WbzCuFVJrvRpBawiPV3Ff6yYv94wEhPtR2StBmvlX1YlHQO2KGuLK X4YQ== 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=HCtATNF16KSLtEmn6kQm+lbECWHkomkkHaH6CNe9wZQ=; b=kc6XSfI6wfCf/qoWzQciV8Ktpo+8V7IbOI3dny1ly4VrPwbx16toH7wO7JyIXeDHwP wBXzKG6ge5qnG3GUVjz0v0PkYAtJIBaWLzYsIOUe1lRWBhlTjBYv2DmszZ9v390DOQoM SDdrzBOzCQRDfLQjUvFITN220ulYapsbzsBhna+KfcdFXd8CSz1ufTBbPm2s8wXHO8RG QAZg6E1QiRVcXENBDhDsL7J09q5HzXhZH3zc8O9nezeyzfIu3Q0MOUgMOIO63BM8x6du DE436mY4+kBXsz+wyQIbC29KtIwW1qz6yaRQim0K+iHrFx6kv/cByoDtGP3lkksUwIWF l8Kg== 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 p5-20020a17090a348500b00202be5416b1si238439pjb.109.2022.10.19.08.58.02; Wed, 19 Oct 2022 08:58:17 -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 S231330AbiJSPtu (ORCPT <rfc822;samuel.l.nystrom@gmail.com> + 99 others); Wed, 19 Oct 2022 11:49:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232509AbiJSPtE (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 19 Oct 2022 11:49:04 -0400 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23D503B98A; Wed, 19 Oct 2022 08:44:41 -0700 (PDT) Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29JCPmJW005611; Wed, 19 Oct 2022 09:40:26 -0400 Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 3k7ss6evhb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Oct 2022 09:40:25 -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 29JDeOld012719 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 19 Oct 2022 09:40:24 -0400 Received: from ASHBCASHYB4.ad.analog.com (10.64.17.132) 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; Wed, 19 Oct 2022 09:40:23 -0400 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) by ASHBCASHYB4.ad.analog.com (10.64.17.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Wed, 19 Oct 2022 09:40:23 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Wed, 19 Oct 2022 09:40:23 -0400 Received: from IST-LT-39247.ad.analog.com (IST-LT-39247.ad.analog.com [10.25.16.14]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 29JDdxLT002874; Wed, 19 Oct 2022 09:40:14 -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 2/2] dt-bindings: rtc: add bindings for max313xx RTCs Date: Wed, 19 Oct 2022 16:39:10 +0300 Message-ID: <20221019133910.282-2-Ibrahim.Tilki@analog.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221019133910.282-1-Ibrahim.Tilki@analog.com> References: <20221019133910.282-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-ORIG-GUID: lj5kDgFVGRtH67dsB089N1xDK1Tw9GDK X-Proofpoint-GUID: lj5kDgFVGRtH67dsB089N1xDK1Tw9GDK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-19_08,2022-10-19_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 lowpriorityscore=0 bulkscore=0 impostorscore=0 spamscore=0 phishscore=0 suspectscore=0 clxscore=1015 malwarescore=0 priorityscore=1501 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210190076 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,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?1747127919758820674?= X-GMAIL-MSGID: =?utf-8?q?1747132190204847342?= |
Series |
[1/2] drivers: rtc: add max313xx series rtc driver
|
|
Commit Message
Tilki, Ibrahim
Oct. 19, 2022, 1:39 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 | 163 ++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 Documentation/devicetree/bindings/rtc/adi,max313xx.yaml
Comments
On 19/10/2022 09:39, 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 | 163 ++++++++++++++++++ > 1 file changed, 163 insertions(+) > create mode 100644 Documentation/devicetree/bindings/rtc/adi,max313xx.yaml > Thank you for your patch. There is something to discuss/improve. > + > +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>; > + interrupt-names = "INTB"; > + }; > + }; > + - | > + #include <dt-bindings/interrupt-controller/irq.h> > + i2c { > + #address-cells = <1>; > + #size-cells = <0>; > + > + rtc@68 { > + reg = <0x68>; > + compatible = "adi,max31331"; > + #clock-cells = <0>; > + interrupt-parent = <&gpio>; > + interrupts = <25 IRQ_TYPE_EDGE_FALLING>, <26 IRQ_TYPE_EDGE_FALLING>; > + interrupt-names = "INTA", "INTB"; > + }; > + }; > + - | > + i2c { > + #address-cells = <1>; > + #size-cells = <0>; > + > + rtc@69 { > + reg = <0x69>; > + compatible = "adi,max31341"; > + #clock-cells = <0>; > + clocks = <&clkin>; Drop the last example - it's basically the same as first, without interrupts. With that: Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Best regards, Krzysztof
On 19/10/2022 16:39:10+0300, 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 | 163 ++++++++++++++++++ > 1 file changed, 163 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..1aa491799 > --- /dev/null > +++ b/Documentation/devicetree/bindings/rtc/adi,max313xx.yaml > @@ -0,0 +1,163 @@ > +# 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 RTC driver > + > +maintainers: > + - Ibrahim Tilki <Ibrahim.Tilki@analog.com> > + - Zeynep Arslanbenzer <Zeynep.Arslanbenzer@analog.com> > + > +description: Bindings for the Analog Devices MAX313XX series 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: > + minItems: 1 > + maxItems: 2 > + > + interrupt-names: > + description: | > + Name of the interrupt pin of the RTC used for IRQ. Not required for > + RTCs that only have single interrupt pin available. Some of the RTCs > + share interrupt pins with clock input/output pins. > + minItems: 1 > + items: > + - enum: [INTA, INTB] > + - enum: [INTA, INTB] > + I don't think this is right, what this is doing is essentially pinmuxing interrupts versus clocks. What happens if you want INTB but this goes directly to a PMIC instead of the SoC? It is not something you can express with your current bindings. > + "#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 > + > + trickle-diode-disable: true > + > + trickle-resistor-ohms: > + description: Enables trickle charger with specified resistor value. > + enum: [3000, 6000, 11000] > + > + wakeup-source: true > + > +additionalProperties: false > + > +allOf: > + - $ref: rtc.yaml# > + - if: > + properties: > + compatible: > + contains: > + enum: > + - adi,max31328 > + - adi,max31342 > + > + then: > + properties: > + trickle-diode-disable: 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 > + > +required: > + - compatible > + - reg > + > +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>; > + interrupt-names = "INTB"; > + }; > + }; > + - | > + #include <dt-bindings/interrupt-controller/irq.h> > + i2c { > + #address-cells = <1>; > + #size-cells = <0>; > + > + rtc@68 { > + reg = <0x68>; > + compatible = "adi,max31331"; > + #clock-cells = <0>; > + interrupt-parent = <&gpio>; > + interrupts = <25 IRQ_TYPE_EDGE_FALLING>, <26 IRQ_TYPE_EDGE_FALLING>; > + interrupt-names = "INTA", "INTB"; > + }; > + }; > + - | > + i2c { > + #address-cells = <1>; > + #size-cells = <0>; > + > + rtc@69 { > + reg = <0x69>; > + compatible = "adi,max31341"; > + #clock-cells = <0>; > + clocks = <&clkin>; > + }; > + }; > -- > 2.25.1 >
> On 19/10/2022 16:39:10+0300, 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 | 163 ++++++++++++++++++ > > 1 file changed, 163 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..1aa491799 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/rtc/adi,max313xx.yaml > > @@ -0,0 +1,163 @@ > > +# 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 RTC driver > > + > > +maintainers: > > + - Ibrahim Tilki <Ibrahim.Tilki@analog.com> > > + - Zeynep Arslanbenzer <Zeynep.Arslanbenzer@analog.com> > > + > > +description: Bindings for the Analog Devices MAX313XX series 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: > > + minItems: 1 > > + maxItems: 2 > > + > > + interrupt-names: > > + description: | > > + Name of the interrupt pin of the RTC used for IRQ. Not required for > > + RTCs that only have single interrupt pin available. Some of the RTCs > > + share interrupt pins with clock input/output pins. > > + minItems: 1 > > + items: > > + - enum: [INTA, INTB] > > + - enum: [INTA, INTB] > > + > > I don't think this is right, what this is doing is essentially pinmuxing > interrupts versus clocks. What happens if you want INTB but this goes > directly to a PMIC instead of the SoC? > It is not something you can express with your current bindings. > Why would a user want INTB when it is not connected to SoC? User can specify none, either one or both of the interrupt pins. I don't see what the problem here is. Ibrahim > > > + "#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 > > + > > + trickle-diode-disable: true > > + > > + trickle-resistor-ohms: > > + description: Enables trickle charger with specified resistor value. > > + enum: [3000, 6000, 11000] > > + > > + wakeup-source: true > > + > > +additionalProperties: false > > + > > +allOf: > > + - $ref: rtc.yaml# > > + - if: > > + properties: > > + compatible: > > + contains: > > + enum: > > + - adi,max31328 > > + - adi,max31342 > > + > > + then: > > + properties: > > + trickle-diode-disable: 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 > > + > > +required: > > + - compatible > > + - reg > > + > > +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>; > > + interrupt-names = "INTB"; > > + }; > > + }; > > + - | > > + #include <dt-bindings/interrupt-controller/irq.h> > > + i2c { > > + #address-cells = <1>; > > + #size-cells = <0>; > > + > > + rtc@68 { > > + reg = <0x68>; > > + compatible = "adi,max31331"; > > + #clock-cells = <0>; > > + interrupt-parent = <&gpio>; > > + interrupts = <25 IRQ_TYPE_EDGE_FALLING>, <26 IRQ_TYPE_EDGE_FALLING>; > > + interrupt-names = "INTA", "INTB"; > > + }; > > + }; > > + - | > > + i2c { > > + #address-cells = <1>; > > + #size-cells = <0>; > > + > > + rtc@69 { > > + reg = <0x69>; > > + compatible = "adi,max31341"; > > + #clock-cells = <0>; > > + clocks = <&clkin>; > > + }; > > + }; > > -- > > 2.25.1 > > > > -- > Alexandre Belloni, co-owner and COO, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com
On 21/10/2022 11:44:12+0000, Tilki, Ibrahim wrote: > > > + interrupt-names: > > > + description: | > > > + Name of the interrupt pin of the RTC used for IRQ. Not required for > > > + RTCs that only have single interrupt pin available. Some of the RTCs > > > + share interrupt pins with clock input/output pins. > > > + minItems: 1 > > > + items: > > > + - enum: [INTA, INTB] > > > + - enum: [INTA, INTB] > > > + > > > > I don't think this is right, what this is doing is essentially pinmuxing > > interrupts versus clocks. What happens if you want INTB but this goes > > directly to a PMIC instead of the SoC? > > It is not something you can express with your current bindings. > > > > Why would a user want INTB when it is not connected to SoC? > User can specify none, either one or both of the interrupt pins. > I don't see what the problem here is. > the interrupt pin may be connected to a PMIC that is able to start or wake up the platform. In that case, the user would not have any interrupt-names and your driver will fail to mux the interrupt on INTB. Please fix.
> On 21/10/2022 11:44:12+0000, Tilki, Ibrahim wrote: > > > > + interrupt-names: > > > > + description: | > > > > + Name of the interrupt pin of the RTC used for IRQ. Not required for > > > > + RTCs that only have single interrupt pin available. Some of the RTCs > > > > + share interrupt pins with clock input/output pins. > > > > + minItems: 1 > > > > + items: > > > > + - enum: [INTA, INTB] > > > > + - enum: [INTA, INTB] > > > > + > > > > > > I don't think this is right, what this is doing is essentially pinmuxing > > > interrupts versus clocks. What happens if you want INTB but this goes > > > directly to a PMIC instead of the SoC? > > > It is not something you can express with your current bindings. > > > > > > > Why would a user want INTB when it is not connected to SoC? > > User can specify none, either one or both of the interrupt pins. > > I don't see what the problem here is. > > > > the interrupt pin may be connected to a PMIC that is able to start or > wake up the platform. In that case, the user would not have any > interrupt-names and your driver will fail to mux the interrupt on INTB. > Please fix. Interrupt muxing depends on the clock configuration, not the interrupt-names property. Devices don't support muxing the alarm interrupt independently. For example in the case of max31329, alarm interrupt is muxed into INTA by default. Alarm interrupt is muxed into INTB pin if and only if clkin is enabled. This means that if a user wants the alarm interrupt on INTB pin, they have to provide a clock input through "clocks" property. If that is the case, they can provide an interrupt for INTB pin, otherwise the alarm feature of the rtc gets disabled. Side note: Some devices have 2 Alarms but Alarm2 does not have a register for matching "seconds" so only Alarm1 is used by the driver. Ibrahim
On 21/10/2022 09:05, Tilki, Ibrahim wrote: >> On 21/10/2022 11:44:12+0000, Tilki, Ibrahim wrote: >>>>> + interrupt-names: >>>>> + description: | >>>>> + Name of the interrupt pin of the RTC used for IRQ. Not required for >>>>> + RTCs that only have single interrupt pin available. Some of the RTCs >>>>> + share interrupt pins with clock input/output pins. >>>>> + minItems: 1 >>>>> + items: >>>>> + - enum: [INTA, INTB] >>>>> + - enum: [INTA, INTB] >>>>> + >>>> >>>> I don't think this is right, what this is doing is essentially pinmuxing >>>> interrupts versus clocks. What happens if you want INTB but this goes >>>> directly to a PMIC instead of the SoC? >>>> It is not something you can express with your current bindings. >>>> >>> >>> Why would a user want INTB when it is not connected to SoC? >>> User can specify none, either one or both of the interrupt pins. >>> I don't see what the problem here is. >>> >> >> the interrupt pin may be connected to a PMIC that is able to start or >> wake up the platform. In that case, the user would not have any >> interrupt-names and your driver will fail to mux the interrupt on INTB. >> Please fix. > > Interrupt muxing depends on the clock configuration, not the interrupt-names property. > Devices don't support muxing the alarm interrupt independently. > > For example in the case of max31329, alarm interrupt is muxed into INTA by default. > Alarm interrupt is muxed into INTB pin if and only if clkin is enabled.\ Just to be sure: are you now describing hardware or Linux driver behavior? > > This means that if a user wants the alarm interrupt on INTB pin, they have to > provide a clock input through "clocks" property. If that is the case, they can provide > an interrupt for INTB pin, otherwise the alarm feature of the rtc gets disabled. > > Side note: Some devices have 2 Alarms but Alarm2 does not have a register for > matching "seconds" so only Alarm1 is used by the driver. Best regards, Krzysztof
> On 21/10/2022 09:05, Tilki, Ibrahim wrote: > >> On 21/10/2022 11:44:12+0000, Tilki, Ibrahim wrote: > >>>>> + interrupt-names: > >>>>> + description: | > >>>>> + Name of the interrupt pin of the RTC used for IRQ. Not required for > >>>>> + RTCs that only have single interrupt pin available. Some of the RTCs > >>>>> + share interrupt pins with clock input/output pins. > >>>>> + minItems: 1 > >>>>> + items: > >>>>> + - enum: [INTA, INTB] > >>>>> + - enum: [INTA, INTB] > >>>>> + > >>>> > >>>> I don't think this is right, what this is doing is essentially > >>>> pinmuxing interrupts versus clocks. What happens if you want INTB > >>>> but this goes directly to a PMIC instead of the SoC? > >>>> It is not something you can express with your current bindings. > >>>> > >>> > >>> Why would a user want INTB when it is not connected to SoC? > >>> User can specify none, either one or both of the interrupt pins. > >>> I don't see what the problem here is. > >>> > >> > >> the interrupt pin may be connected to a PMIC that is able to start or > >> wake up the platform. In that case, the user would not have any > >> interrupt-names and your driver will fail to mux the interrupt on INTB. > >> Please fix. > > > > Interrupt muxing depends on the clock configuration, not the interrupt-names property. > > Devices don't support muxing the alarm interrupt independently. > > > > For example in the case of max31329, alarm interrupt is muxed into INTA by default. > > Alarm interrupt is muxed into INTB pin if and only if clkin is > > enabled.\ > > Just to be sure: are you now describing hardware or Linux driver behavior? > That is hardware behavior. Below is Interrupt Modes Table from max31329 datasheet: +--------+---------+------------------------------------------+-----------------------------------------+ | ENCLKO | ENCLKIN | INTA/CLKIN | INTB/CLKOUT | +--------+---------+------------------------------------------+-----------------------------------------+ | 0 | 0 | INTA: Alarm1, Timer, PFAIL, DIN | INTB: Alarm2 | | 0 | 1 | CLKIN | INTB: Alarm1, Alarm2, Timer, PFAIL, DIN | | 1 | 0 | INTA: Alarm1, Alarm2, Timer, PFAIL, DIN | CLKOUT | | 1 | 1 | CLKIN | CLKOUT | +--------+---------+------------------------------------------+-----------------------------------------+ > > > > This means that if a user wants the alarm interrupt on INTB pin, they > > have to provide a clock input through "clocks" property. If that is > > the case, they can provide an interrupt for INTB pin, otherwise the alarm feature of the rtc gets disabled. > > > > Side note: Some devices have 2 Alarms but Alarm2 does not have a > > register for matching "seconds" so only Alarm1 is used by the driver. Regards, Ibrahim
diff --git a/Documentation/devicetree/bindings/rtc/adi,max313xx.yaml b/Documentation/devicetree/bindings/rtc/adi,max313xx.yaml new file mode 100644 index 000000000..1aa491799 --- /dev/null +++ b/Documentation/devicetree/bindings/rtc/adi,max313xx.yaml @@ -0,0 +1,163 @@ +# 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 RTC driver + +maintainers: + - Ibrahim Tilki <Ibrahim.Tilki@analog.com> + - Zeynep Arslanbenzer <Zeynep.Arslanbenzer@analog.com> + +description: Bindings for the Analog Devices MAX313XX series 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: + minItems: 1 + maxItems: 2 + + interrupt-names: + description: | + Name of the interrupt pin of the RTC used for IRQ. Not required for + RTCs that only have single interrupt pin available. Some of the RTCs + share interrupt pins with clock input/output pins. + minItems: 1 + items: + - enum: [INTA, INTB] + - enum: [INTA, INTB] + + "#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 + + trickle-diode-disable: true + + trickle-resistor-ohms: + description: Enables trickle charger with specified resistor value. + enum: [3000, 6000, 11000] + + wakeup-source: true + +additionalProperties: false + +allOf: + - $ref: rtc.yaml# + - if: + properties: + compatible: + contains: + enum: + - adi,max31328 + - adi,max31342 + + then: + properties: + trickle-diode-disable: 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 + +required: + - compatible + - reg + +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>; + interrupt-names = "INTB"; + }; + }; + - | + #include <dt-bindings/interrupt-controller/irq.h> + i2c { + #address-cells = <1>; + #size-cells = <0>; + + rtc@68 { + reg = <0x68>; + compatible = "adi,max31331"; + #clock-cells = <0>; + interrupt-parent = <&gpio>; + interrupts = <25 IRQ_TYPE_EDGE_FALLING>, <26 IRQ_TYPE_EDGE_FALLING>; + interrupt-names = "INTA", "INTB"; + }; + }; + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + rtc@69 { + reg = <0x69>; + compatible = "adi,max31341"; + #clock-cells = <0>; + clocks = <&clkin>; + }; + };