Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751715AbdILQWS (ORCPT ); Tue, 12 Sep 2017 12:22:18 -0400 Received: from smtpcmd01217.aruba.it ([62.149.158.217]:59017 "EHLO smtpcmd01217.aruba.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751515AbdILQWR (ORCPT ); Tue, 12 Sep 2017 12:22:17 -0400 Subject: Re: [PATCH] pps-gpio: use IRQ edge config when not capturing both edges To: Tim Harvey Cc: "discussions@linuxpps.org" , "linux-kernel@vger.kernel.org" , Koen Vandeputte References: <1504900414-1514-1-git-send-email-tharvey@gateworks.com> From: Rodolfo Giometti Message-ID: <627ec6a7-2b7a-a59b-7eb8-b9645e34d796@enneenne.com> Date: Tue, 12 Sep 2017 18:22:11 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2374 Lines: 61 On 12/09/2017 17:54, Tim Harvey wrote: > On Sun, Sep 10, 2017 at 3:43 AM, Rodolfo Giometti wrote: >> On 08/09/2017 21:53, Tim Harvey wrote: >>> >>> PPS signals with very short pulse-widths can be missed if their state >>> changes by the time the interrupt handler reads the GPIO pin state. >>> >>> To avoid this in the case where we are only looking for one edge we can >>> use the edge configuration for the pin state but fall back to reading the >>> pin if both edges are being watched. >> >> >> I disagree. The "rising_edge" status should be get from the hardware and not >> derived by an empirical computation. Or, at least, it should be specifically >> activated by setting something like this: >> >> pps { >> pinctrl-names = "default"; >> pinctrl-0 = <&pinctrl_pps>; >> >> gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>; >> Yes-I-want-get-signal-status-in-an-epirical-way; >> >> compatible = "pps-gpio"; >> status = "okay"; >> }; >> >> This setting should also print a warning in order to be clear for the user >> that he/she should know what he/she is doing. >> >> Then the code should check also the compatibility with property >> "assert-falling-edge"... >> > > Hi Rodolfo, > > Do you agree with using the irq edge in general if/when it is > available to resolve the case where small pulse-widths can be caught? > > I assumed because pps-gpio is the one configuring the irq based on > info->capture_clear and info->assert_falling_edge that that it made > sense to use that logic again when handling the interrupt but there is > likely a call I can make to determine the irq (edge) type based on the > irq. If you get the information from the hardware it's OK for me, otherwise you should enable this behavior by using proper DT property. Ciao, Rodolfo -- HCE Engineering e-mail: giometti@hce-engineering.it GNU/Linux Solutions giometti@enneenne.com Linux Device Driver giometti@linux.it Embedded Systems phone: +39 349 2432127 UNIX programming skype: rodolfo.giometti Cosino Project - the quick prototyping embedded system - www.cosino.it Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it