Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp104646lql; Fri, 12 Apr 2024 05:20:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW83x6WidaJy7U07emqBRsQes8hvcKrjixrSlnRif/GObwe1t7Mf2HwEnCjwqJEBGOXRVvkggm3ukCn9//W1Xu7pya9qg15tR1m8RBJYQ== X-Google-Smtp-Source: AGHT+IH767yx/oxiOmLUQ+BR2YwDvrfQx+towtSM3T7avi1znjWlIoMjP5wqJkoVHHmZaxH1lo3c X-Received: by 2002:a17:90a:e7c1:b0:2a6:fbf5:6d8b with SMTP id kb1-20020a17090ae7c100b002a6fbf56d8bmr1128089pjb.3.1712924453830; Fri, 12 Apr 2024 05:20:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712924453; cv=pass; d=google.com; s=arc-20160816; b=0Nm9l9QwEdF8FAVjXHfFvTkD9/0GV1ef4DICVdEMV4Y699+wGjEUOH9XOLSx/mWJqd WLSbT8XjQOMrbK6bzvTCV54BtvPJBkTcZ/0U23Hlpn2ugkiUXmnX/ZpUFlevrp9Xia4+ jMz4hlGi4HORI1ZXg2etoORkkft+PfOtd3clCvST2eS7aDOR8qRB1+PM/DGTqMWdhMN7 ihktnKeDrVLUnUm2Q5tqFRFW+EMXFY5GypMyZnqXs31U3bjqkMQYtaTvD499pCNJhM86 0sLCBoJ3Ngy6+6k7yCR095xpZpWwp+V+dS2yt8cObNqbEWCZ7jnuo5QKCfZ2mDeD/nI/ rdCg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=i4sen2yAIZEdwsIiTx7q/1/5M2usUlIfq98X99An4Ik=; fh=tfFaZzpi9p9fRg2PuA3g6757Ibpmo+WpSVLzgfvL2VA=; b=w+6yddVD2leTMHHbfa19wXngdl/TQEB7U7Jhynj9PZpQz2fcoac6H7NTMySaRPEr06 6r/KSeFvrCiFWAEsgMBqoGa8PCxJx3vSl6o5wKxz6mk6K/0C1+eITK4iKr5SXFZf9lUl B/KY3wRhsVDHflIjR5P6w6PHHCdX0V3yaKQz1iBjH5mNqe1KiTmDXvost2wqWgMBKBIE ftSFd7E3DmH3L3rVAWCJTbXq50eEkVb1ndUZUykeZNVEsggb8A/Umhrv3t7blSCordxC Ye+spcokb1Zi/WAU1N+npyYoDvFfQiYRGN2tvy1D0CwLX0PyfP/j2ZpylyRwEtfTJgCy 7n6A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=meRPTo3q; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-142638-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142638-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id u22-20020a17090ae01600b002a46f090421si3279987pjy.51.2024.04.12.05.20.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 05:20:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142638-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=meRPTo3q; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-142638-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142638-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3BC37285328 for ; Fri, 12 Apr 2024 12:20:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E894757867; Fri, 12 Apr 2024 12:20:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="meRPTo3q" Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A0BA57863 for ; Fri, 12 Apr 2024 12:20:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712924431; cv=none; b=c7+m18w2CvXGpSb/9jvC+LeusZNKYVqLe4j4iodcprzw/y1NMd81zNrW8rk64pgC/MEh4pDmgX9jk3ww8iToYkXPQkwz73fgJnjnV/Mall0v8CmJRxVF84PHDPRiU2YacE11C1hsh3ZiB6wM2naCd4npJlQ45ab36nz68v2D4mc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712924431; c=relaxed/simple; bh=u0QycG5sxEy3Ki5TTR/2Bx884/gaAjTNZ8ar0Fu2/1s=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=MMK3TjYcmEVnoybv0e2bgRzWcoKhrBqEHxVS+6WmtQmG0rH/k1Mi2my12jWJAtJYWXwy4sB4imkvgVHpESUbUopXtLT9ACgJ1VvEFtKEZkOtjJiH+H53ipnxw3fGKDdIZbp9491pj/sJyNuFSyAKrAh1dIFvGCiS/zOHQ8EpR60= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=meRPTo3q; arc=none smtp.client-ip=217.70.183.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 5EB6DFF806; Fri, 12 Apr 2024 12:20:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1712924426; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i4sen2yAIZEdwsIiTx7q/1/5M2usUlIfq98X99An4Ik=; b=meRPTo3qwCeQEEBqjbzw02iw9iaEEUF/QTM8TJFY8wTaoYx/Fp9yNBvVj+FRijImlTAP8q Vx90ol5GdbTIz86xpSCMi2AlYWdXH4bgO/EBbeyDUCSDi+n1BcZq+mgpBNl0jL5Coq2rCz 5LRb22Ktmu0Exigy9r2Rj9vKalU3xFag/pTKy9Wna4zzQAqS95j+8dTNwQZKNEqW4U75jN hWU3I1kTG7J6ICPxgiIRaWQohR+T90E1AtO487IM/6JJ2Bg1VzOPMaxnU/zFBMg1XTYUXa gdOSfqbUv4jR0YfFIfXzBvtW3G1ZlJPfZguunUCraEJJIRUwpzj672pyocsz/g== Message-ID: <6f064bd8-7937-4634-8a39-13ee5bcd6193@bootlin.com> Date: Fri, 12 Apr 2024 14:20:25 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/1] pps: clients: gpio: Bypass edge's direction check when not needed To: Rodolfo Giometti Cc: linux-kernel@vger.kernel.org, Thomas Petazzoni , herve.codina@bootlin.com, christophercordahi@nanometrics.ca References: <20240410113502.73038-1-bastien.curutchet@bootlin.com> <1f7f5b2f-54d4-4dc1-90ff-b896c930faed@enneenne.com> <5bda0980-2373-4284-bda4-89f0c6944e76@bootlin.com> <27196117-32bc-4892-b545-d9cf43a89f0a@bootlin.com> <28c5456d-535c-4ed9-b13a-fab7f50412be@bootlin.com> <9255124b-958e-4ab4-a812-67ad5d36e16d@enneenne.com> Content-Language: en-US From: Bastien Curutchet In-Reply-To: <9255124b-958e-4ab4-a812-67ad5d36e16d@enneenne.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-GND-Sasl: bastien.curutchet@bootlin.com Hi Rodolfo, On 4/12/24 08:44, Rodolfo Giometti wrote: > On 11/04/24 14:44, Bastien Curutchet wrote: >>> >>> However we should think very well about this modification since it >>> could be the case where we have a device sending both assert and >>> clear events but we wish to catch just the asserts... in this case we >>> will get doubled asserts! >>> >> >> My understanding is that clear events are to be captured only when this >> capture_clear boolean is set. If it is not set, the PPS_CAPTURECLEAR >> flag is not added to pps_source_info->mode and get_irqf_trigger_flags() >> will return only one edge flag (rising or falling depending on >> assert-falling-edge DT property). > > Yes. You are right. > >> By the way, I see that the capture_clear is never set since the legacy >> platform data support has been dropped (commit ee89646619ba). > > I see, but it can be re-enabled in the future... In this scenario, I > think we should add a DT entry to enable this special behavior. Maybe we > can also add a warning as below: > > static irqreturn_t pps_gpio_irq_handler(int irq, void *data) > { >         ... >         if ((rising_edge && !info->assert_falling_edge) || >                         (!rising_edge && info->assert_falling_edge)) >                 pps_event(info->pps, &ts, PPS_CAPTUREASSERT, data); >         else if (info->capture_clear && >                         ((rising_edge && info->assert_falling_edge) || >                         (!rising_edge && !info->assert_falling_edge))) >                 pps_event(info->pps, &ts, PPS_CAPTURECLEAR, data); >     else >         dev_warn_ratelimited(dev, "no ASSERT or CAPTURE event? " >             "Maybe you need support-tiny-assert-pulse?"); > >         return IRQ_HANDLED; > } > I'm not sure a DT entry is needed. IMO there are two cases: 1) capture_clear is unset. We need to capture only assert events, interrupt will be triggered by assert edge only so there is no need to check GPIO state: we can use the bypass. 2) capture_clear is set. We need to capture assert and/or clear events, interrupt will be triggered by both assert and clear edges so we can't avoid the GPIO state checking to distinguish clear events from assert events: we can't use the bypass. So if we bypass the GPIO's state check when capture_clear is unset and leave current behavior when capture_clear is set: - case 1) will be more efficient and we won't lose tiny pulses anymore - case 2) is unchanged: we still might lose tiny pulses but as bypass can't be done here, I think that we can't do better. I agree that adding warning when the handler is left without triggering a pps event can be useful, I can add it in a V3 version. Best regards, Bastien