Message ID | 20230625142134.33690-3-farbere@amazon.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp6942270vqr; Sun, 25 Jun 2023 07:25:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4GqKliunyxDF0hCYonIJt4STx9FVNxmMZhsp2BmqzjMH/KeGjxobLweOijykQ7g9HAMyAC X-Received: by 2002:a92:c60a:0:b0:340:6db8:e814 with SMTP id p10-20020a92c60a000000b003406db8e814mr28010641ilm.22.1687703101500; Sun, 25 Jun 2023 07:25:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687703101; cv=none; d=google.com; s=arc-20160816; b=CYdhbUhO3n9rAaDlbhHZmkEXKbTTMpV4c+Bl61l98tjSsgZ6RudXd3R9OydOFTR/o5 2l5lBBKFmhEVkCHwhY3N3SZ4/H7xqjvTESNygG4h8SfJQWvBBcWKVr4pJpA3hn4IAwzD wR5i3AyCgl/8H09cliiOGWj9CS1d5MkzmchzN4inNK1ZtP17ZrxuEwGPBTuh66jpPwV2 Pjp/pcTdNTCNx4+1zulz4WHJfquLqKwMMa0nlwkGHOP3m9k2J+t3sDoP1VnXkkE1Bee9 IC7TKYRWr0ZDfoQNdVLeqk/9nVs2VPoIh0eka5/Inu9QWu8azNrXiAmvS+F/x1M9Mgvi bp5Q== 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 :dkim-signature; bh=54pb3GiuxGz5vr3/T2UHe4INajkdgiM6+/jwG7r8Q6Y=; fh=/9rTqK0zswNCgLim86exJ2HNVgKWrjH8Cr/T0xC8qdo=; b=G+uVl1YnvI0BnSBshCspCt0TeKCg6f1nHZsxhaxKNtHaQDEOyE841Obe0yeSsoRsCF nsxLyvhM4+RyzoIeYGL/ZlhVDMoWEObsoTnm9fsntxUBWSJ5CAGXMARZ2xZhz+8Rzrh8 ApW3RUhgG/+a5s6PKu6oZrpZ5ft8hPFwSEfA9Cc0pqRaFtJBtkOSqpt9hkw5xr0L5JiH AlyLKy9h2tnm9lCASmmroGJl7r9F66+STAPIiduls/qLf9yZ0jStlHr1Bnbg5MHI98oc u/wtwcPPzkmQHxASxRZ8RIUQWZzh4YkYIRrkrhxFuZWkvKSnePRVzdvXmz6bf63NPCux 9Jdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=MVrmVkpr; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f28-20020a63101c000000b0053f23ffad1csi3344870pgl.544.2023.06.25.07.24.48; Sun, 25 Jun 2023 07:25:01 -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; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=MVrmVkpr; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230284AbjFYOVm (ORCPT <rfc822;duw91626@gmail.com> + 99 others); Sun, 25 Jun 2023 10:21:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229537AbjFYOVk (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 25 Jun 2023 10:21:40 -0400 Received: from smtp-fw-52005.amazon.com (smtp-fw-52005.amazon.com [52.119.213.156]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7558E43; Sun, 25 Jun 2023 07:21:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1687702900; x=1719238900; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=54pb3GiuxGz5vr3/T2UHe4INajkdgiM6+/jwG7r8Q6Y=; b=MVrmVkprZ6/H+VFEa4d0vEKEQPa/KibNPq7NFTUwzGza5JznxP+/A+fs 3qNE+R6cwttnFkBdYWjgXL+DKCC3wiUXf0SHuKgJKnhnWe+N61mbjNam7 xtT9OjTjg77Nsvv+JwatjngfTI3Opa6C5eEWskfAugrfkiBtk+209CEzr M=; X-IronPort-AV: E=Sophos;i="6.01,157,1684800000"; d="scan'208";a="589290998" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-pdx-2b-m6i4x-7fa2de02.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-52005.iad7.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jun 2023 14:21:37 +0000 Received: from EX19D014EUA003.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-pdx-2b-m6i4x-7fa2de02.us-west-2.amazon.com (Postfix) with ESMTPS id 1B0C940D44; Sun, 25 Jun 2023 14:21:36 +0000 (UTC) Received: from EX19D040EUB004.ant.amazon.com (10.252.61.108) by EX19D014EUA003.ant.amazon.com (10.252.50.119) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Sun, 25 Jun 2023 14:21:34 +0000 Received: from EX19MTAUEB001.ant.amazon.com (10.252.135.35) by EX19D040EUB004.ant.amazon.com (10.252.61.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Sun, 25 Jun 2023 14:21:34 +0000 Received: from dev-dsk-farbere-1a-46ecabed.eu-west-1.amazon.com (172.19.116.181) by mail-relay.amazon.com (10.252.135.35) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Sun, 25 Jun 2023 14:21:34 +0000 Received: by dev-dsk-farbere-1a-46ecabed.eu-west-1.amazon.com (Postfix, from userid 14301484) id 153DE4F0C; Sun, 25 Jun 2023 14:21:34 +0000 (UTC) From: Eliav Farber <farbere@amazon.com> To: <giometti@enneenne.com>, <robh+dt@kernel.org>, <krzysztof.kozlowski+dt@linaro.org>, <conor+dt@kernel.org>, <farbere@amazon.com>, <devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org> CC: <ronenk@amazon.com>, <talel@amazon.com>, <hhhawa@amazon.com>, <jonnyc@amazon.com>, <itamark@amazon.com>, <shellykz@amazon.com>, <amitlavi@amazon.com>, <almogbs@amazon.com> Subject: [PATCH 2/5] dt-bindings: pps: pps-gpio: introduce capture-clear property Date: Sun, 25 Jun 2023 14:21:31 +0000 Message-ID: <20230625142134.33690-3-farbere@amazon.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230625142134.33690-1-farbere@amazon.com> References: <20230625142134.33690-1-farbere@amazon.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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?1769684967490408750?= X-GMAIL-MSGID: =?utf-8?q?1769684967490408750?= |
Series |
Add PPS pulse-width support
|
|
Commit Message
Farber, Eliav
June 25, 2023, 2:21 p.m. UTC
Add a new optional "capture-clear" boolean property.
When present, PPS clear events shall also be reported.
Signed-off-by: Eliav Farber <farbere@amazon.com>
---
Documentation/devicetree/bindings/pps/pps-gpio.txt | 4 ++++
1 file changed, 4 insertions(+)
Comments
On 25/06/2023 16:21, Eliav Farber wrote: > Add a new optional "capture-clear" boolean property. > When present, PPS clear events shall also be reported. > > Signed-off-by: Eliav Farber <farbere@amazon.com> > --- > Documentation/devicetree/bindings/pps/pps-gpio.txt | 4 ++++ Please convert the bindings to DT schema first. > 1 file changed, 4 insertions(+) > > diff --git a/Documentation/devicetree/bindings/pps/pps-gpio.txt b/Documentation/devicetree/bindings/pps/pps-gpio.txt > index 9012a2a02e14..8d588e38c44e 100644 > --- a/Documentation/devicetree/bindings/pps/pps-gpio.txt > +++ b/Documentation/devicetree/bindings/pps/pps-gpio.txt > @@ -14,6 +14,10 @@ Additional required properties for the PPS ECHO functionality: > Optional properties: > - assert-falling-edge: when present, assert is indicated by a falling edge > (instead of by a rising edge) > +- capture-clear: when present, report also PPS clear events, which is the > + opposite of the assert edge (if assert is rising-edge then > + clear is falling-edge and if assert is falling-edge then > + clear is rising-edge). Why this is board-dependant? Falling edge is happening anyway, so it is in the hardware all the time. DT describes the hardware, not Linux driver behavior. What's more, your property name sounds a lot like a driver property, so even if this is suitable for DT, you would need to name it properly to match hardware feature/characteristic. Best regards, Krzysztof
On 6/25/2023 6:46 PM, Krzysztof Kozlowski wrote: > On 25/06/2023 16:21, Eliav Farber wrote: >> Add a new optional "capture-clear" boolean property. >> When present, PPS clear events shall also be reported. >> >> Signed-off-by: Eliav Farber <farbere@amazon.com> >> --- >> Documentation/devicetree/bindings/pps/pps-gpio.txt | 4 ++++ > > Please convert the bindings to DT schema first. I will convert to DT schema first, if I indeed end up modifying this file. >> 1 file changed, 4 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/pps/pps-gpio.txt >> b/Documentation/devicetree/bindings/pps/pps-gpio.txt >> index 9012a2a02e14..8d588e38c44e 100644 >> --- a/Documentation/devicetree/bindings/pps/pps-gpio.txt >> +++ b/Documentation/devicetree/bindings/pps/pps-gpio.txt >> @@ -14,6 +14,10 @@ Additional required properties for the PPS ECHO >> functionality: >> Optional properties: >> - assert-falling-edge: when present, assert is indicated by a >> falling edge >> (instead of by a rising edge) >> +- capture-clear: when present, report also PPS clear events, which >> is the >> + opposite of the assert edge (if assert is >> rising-edge then >> + clear is falling-edge and if assert is falling-edge >> then >> + clear is rising-edge). > > Why this is board-dependant? Falling edge is happening anyway, so it is > in the hardware all the time. DT describes the hardware, not Linux > driver behavior. Falling edge of the pulse is happening all the time, but the falling edge event is currently never reported by the pps-gpio driver. It is because there is no place in the pps-gpio driver that sets info->capture_clear, so pps_event(info->pps, &ts, PPS_CAPTURECLEAR, data); will never be called. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/pps/clients/pps-gpio.c?h=v6.4#n59 There was an option in the past to set info->capture_clear, but that option was removed in commit ee89646619ba ("pps: clients: gpio: Get rid of legacy platform data"). This node in the DT isn't a pure HW device, but rather a SW driver. The patch I shared allows to set capture-clear from device-tree same as setting of assert-falling-edge is done. Do you suggest I enable capture_clear in a different way? Perhaps module-param? > What's more, your property name sounds a lot like a driver property, so > even if this is suitable for DT, you would need to name it properly to > match hardware feature/characteristic. I chose capture-clear as a name since it is aligned with the driver's terminology. It sets the capture_clear parameter, just like assert-falling-edge in DT sets assert_falling_edge parameter. --- Regards, Eliav
On 28/06/2023 10:47, Farber, Eliav wrote: > On 6/25/2023 6:46 PM, Krzysztof Kozlowski wrote: >> On 25/06/2023 16:21, Eliav Farber wrote: >>> Add a new optional "capture-clear" boolean property. >>> When present, PPS clear events shall also be reported. >>> >>> Signed-off-by: Eliav Farber <farbere@amazon.com> >>> --- >>> Documentation/devicetree/bindings/pps/pps-gpio.txt | 4 ++++ >> >> Please convert the bindings to DT schema first. > I will convert to DT schema first, if I indeed end up modifying this file. > >>> 1 file changed, 4 insertions(+) >>> >>> diff --git a/Documentation/devicetree/bindings/pps/pps-gpio.txt >>> b/Documentation/devicetree/bindings/pps/pps-gpio.txt >>> index 9012a2a02e14..8d588e38c44e 100644 >>> --- a/Documentation/devicetree/bindings/pps/pps-gpio.txt >>> +++ b/Documentation/devicetree/bindings/pps/pps-gpio.txt >>> @@ -14,6 +14,10 @@ Additional required properties for the PPS ECHO >>> functionality: >>> Optional properties: >>> - assert-falling-edge: when present, assert is indicated by a >>> falling edge >>> (instead of by a rising edge) >>> +- capture-clear: when present, report also PPS clear events, which >>> is the >>> + opposite of the assert edge (if assert is >>> rising-edge then >>> + clear is falling-edge and if assert is falling-edge >>> then >>> + clear is rising-edge). >> >> Why this is board-dependant? Falling edge is happening anyway, so it is >> in the hardware all the time. DT describes the hardware, not Linux >> driver behavior. > Falling edge of the pulse is happening all the time, but the falling > edge event is currently never reported by the pps-gpio driver. > > It is because there is no place in the pps-gpio driver that sets > info->capture_clear, so > pps_event(info->pps, &ts, PPS_CAPTURECLEAR, data); > will never be called. > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/pps/clients/pps-gpio.c?h=v6.4#n59 > > There was an option in the past to set info->capture_clear, but that > option was removed in commit ee89646619ba ("pps: clients: gpio: Get rid > of legacy platform data"). I know the history and question was not about it. You add DT support, so whatever board files were doing, does not matter really. > > This node in the DT isn't a pure HW device, but rather a SW driver. > The patch I shared allows to set capture-clear from device-tree same as > setting of assert-falling-edge is done. The binding still describes actual hardware - there is a system with a PPS signal on a GPIO. Your reasoning for this property is because you need it: "It is because there is no place in the pps-gpio driver that sets" With this approach we would need to accept every weird or bogus property, because someone needs it for the driver. Bindings are for the hardware, even if the concept is a bit more software-driven. > > Do you suggest I enable capture_clear in a different way? > Perhaps module-param? module params are also disliked, so usually the answer for non-hardware properties is sysfs ABI. Whether this is hardware property or not, I don't know. You did not provide rationale supporting it, so I tend to look at this as candidate for sysfs. > >> What's more, your property name sounds a lot like a driver property, so >> even if this is suitable for DT, you would need to name it properly to >> match hardware feature/characteristic. > I chose capture-clear as a name since it is aligned with the driver's > terminology. It sets the capture_clear parameter, just like > assert-falling-edge in DT sets assert_falling_edge parameter. Sure, poor examples like to multiply. For assert-falling-edge, it looks like some fake property was added instead of using proper, existing properties indicating the polarity of GPIO and/or type of interrupt (rising/falling edge). Best regards, Krzysztof
diff --git a/Documentation/devicetree/bindings/pps/pps-gpio.txt b/Documentation/devicetree/bindings/pps/pps-gpio.txt index 9012a2a02e14..8d588e38c44e 100644 --- a/Documentation/devicetree/bindings/pps/pps-gpio.txt +++ b/Documentation/devicetree/bindings/pps/pps-gpio.txt @@ -14,6 +14,10 @@ Additional required properties for the PPS ECHO functionality: Optional properties: - assert-falling-edge: when present, assert is indicated by a falling edge (instead of by a rising edge) +- capture-clear: when present, report also PPS clear events, which is the + opposite of the assert edge (if assert is rising-edge then + clear is falling-edge and if assert is falling-edge then + clear is rising-edge). Example: pps {