Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp605046lqb; Wed, 29 May 2024 05:45:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVCEKDDWxKgL7HIJ0lLZsZYQbveKdFdMjiLY67aP+6XEL76nDHN/rY516yhUMX6JIUpLGZiRdGsqod6rAi9fwocxNMTdMnWU1369MI6rw== X-Google-Smtp-Source: AGHT+IG9F2rLh0QecrR6ujIks8SHZWqzfPjry2fBdeOvEPEZD8Gtdl6F6TiSZ4H5AnWwTYMbXSkK X-Received: by 2002:a17:90a:a409:b0:2bf:9981:e0bc with SMTP id 98e67ed59e1d1-2bf9981e16fmr8980391a91.27.1716986736393; Wed, 29 May 2024 05:45:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716986736; cv=pass; d=google.com; s=arc-20160816; b=F9N7Dma7bfh3gUGUtdE7vTLKuk6ePdA+kw2u+e4ahbPjBKlD1Hocyd22DqyZlWKqKi Pr3JE07RSzfZhgvPxcSYiAyJGsbiDJPbk/ti/EfpCLN6+hA7Ea7cMbXJEAtLSIFVErve UjKMrwVGPyTL+E9DUGxYY85SbN0M+JvbYXisvo46TSPl8Gr0knLb4mg5vGliKJhWdxc4 1HR3lIFIcmv50KmsCacWTDZybOtkQtbIDNuvB5Co8IJH/sNv2T1GL5ewjbdq27zQi+5N 24ulbqtuIlu6pKtA8lagEanjUVe8wFFdr5rxZNqsLZPggLq10IMwyA/6Mmgz4Lzxa9yP pRgg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature:dkim-signature; bh=VulbFFluIY4V+Dq0KwN290O9m54yLfSK+Ucnvv0/x0g=; fh=xBNAMdAJiKpcazcvQkAyl/FYWNMbQmfaulYeKVm3CHM=; b=vXQfdcwNkkNdMI3jF4e9MC/NzvALrO3y0DSP3yasRwvdZDh8JI1jz9Slvo7vGdQ2eO skjX0WN27WHokvAAY2m8tBglJ/mr98TOUxCrIONOWjBDmNNlG36UsJATjecfBFyQr/07 z0WTUX3ulRtNb2MiBch0SYlc2mM45oQU0AhKwLvswlXYhHAVMxKePWjpkN06rzz/GtGc q5zN67XNl3/mp/gHX47hUhL7ApsrbwoJuxbcJlz6GNbzcd/98DPeEkdBM1Im+bJOjooc F3xiU6EzGPyJmySuP7U1G0o2mPITMbh7+ze1L5GuvPXXpst8r4Wo4z43sjxdwaaq9GYn RcwQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=UFNDaUIB; dkim=temperror (no key for signature) header.i=@ew.tq-group.com header.s=dkim header.b=s+2PZqt9; arc=pass (i=1 spf=pass spfdomain=ew.tq-group.com dkim=pass dkdomain=tq-group.com dmarc=pass fromdomain=ew.tq-group.com); spf=pass (google.com: domain of linux-kernel+bounces-194103-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194103-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bde2fc970dsi11736070a91.139.2024.05.29.05.45.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 05:45:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194103-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=UFNDaUIB; dkim=temperror (no key for signature) header.i=@ew.tq-group.com header.s=dkim header.b=s+2PZqt9; arc=pass (i=1 spf=pass spfdomain=ew.tq-group.com dkim=pass dkdomain=tq-group.com dmarc=pass fromdomain=ew.tq-group.com); spf=pass (google.com: domain of linux-kernel+bounces-194103-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194103-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.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 7BB06285974 for ; Wed, 29 May 2024 12:45:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D609C181CE0; Wed, 29 May 2024 12:44:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tq-group.com header.i=@tq-group.com header.b="UFNDaUIB"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=ew.tq-group.com header.i=@ew.tq-group.com header.b="s+2PZqt9" Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) (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 B0F4C17DE23; Wed, 29 May 2024 12:44:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=93.104.207.81 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716986689; cv=none; b=e8HLu94r8np5XsmSCcTVr/2a1TbgxvfhRXwt3/r9CZnfz3eA6hHLf54Gyu1+LLtCs2x0oys+xTK8tfZT2/ske5dLqtGsXptSqtTsdy4491/FW75EJgNNUIg1PDaMaULTvjHPFk8usBwhrnwnovpxI5ULWYBf0d0UdFGH94OR3Eg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716986689; c=relaxed/simple; bh=VulbFFluIY4V+Dq0KwN290O9m54yLfSK+Ucnvv0/x0g=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=sJChVvGiQhN57VpEp1ngvRsSD60aWfeL1xCj9fM82t2QSJHyufCXqEp3oD3AtF0WQ0uRvcukGe32TwEDvfMn8vzCES+eJD8sK8+4RhzaqsqLT/uZpcVnkBzHejt9paEnMLGzYtdpepna1WL4xXUaiL/R/J9ImEIP38PmkLce4Bw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ew.tq-group.com; spf=pass smtp.mailfrom=ew.tq-group.com; dkim=pass (2048-bit key) header.d=tq-group.com header.i=@tq-group.com header.b=UFNDaUIB; dkim=fail (0-bit key) header.d=ew.tq-group.com header.i=@ew.tq-group.com header.b=s+2PZqt9 reason="key not found in DNS"; arc=none smtp.client-ip=93.104.207.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ew.tq-group.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ew.tq-group.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1716986686; x=1748522686; h=message-id:subject:from:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=VulbFFluIY4V+Dq0KwN290O9m54yLfSK+Ucnvv0/x0g=; b=UFNDaUIBbsWPvapwS0gpfpdkiUPwBs6Joy2jG+QDLwwQwxt5gnkVHshk 8xDC3CQivDNWPNB3+bfa5ahDP+6ROnDWfe37vLqkL8Ao3O6PE24DKh2Pz NUCuFRL5yFmpglITOcObvCVbm0DI8jfXfcBqLGq2tCQ5o5YDJA2G8phji 28bsncjgWyiXJPD16Rlf7F6VJ6V1XZ8LkD4U0g/hMQf0mRzaMXNN0Ic/f /s8kmJNAMl1nDc8jlla/yyjC7R6Ski0pLtUloZ0oo6cCuio13iAQNLUYk tShKbq7Vj+mjj/Fds5huuEWUIpT1yl720Zu8Ps3n127GRvKm6m/6hlcYs g==; X-CSE-ConnectionGUID: CdrFQlHLQlqYJTWEJW+02g== X-CSE-MsgGUID: T6nuZhbMQUi7EaBzqO2Srw== X-IronPort-AV: E=Sophos;i="6.08,198,1712613600"; d="scan'208";a="37128982" Received: from vmailcow01.tq-net.de ([10.150.86.48]) by mx1.tq-group.com with ESMTP; 29 May 2024 14:44:43 +0200 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 76DB0165652; Wed, 29 May 2024 14:44:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ew.tq-group.com; s=dkim; t=1716986679; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=VulbFFluIY4V+Dq0KwN290O9m54yLfSK+Ucnvv0/x0g=; b=s+2PZqt9EQdYDhMMsaSjzPFT3eobtAweRRgds2WvhjijA+3jopJgMfhP2kCMdNJxUrNnD1 Mxg51A02Pi6Pee+YWVIaD93NGRCScWf7Rz56swXL9m2WMGp2OsbZc0GpPby4AHII+x3sH7 MBgdS4FDnO547sz6oKZLfv9B/YAF5L7XXA68wanbo8wxMZbEqhDHeuJBXDj63fIxKurWEA A3T/jDQpmlrSyCKht4VFhn033VeeaWVpsp41CG3WMlktx5T46zgNJtJruT7re7GT4YNLWo W2zMUR3UnIFNaOTTaUyovPONZkVPZ3RUAwOVO2nkIFN10JKXkHPzQtP8wSuXaw== Message-ID: <954848a9ee2967908bc40069c94cea4407e7de7f.camel@ew.tq-group.com> Subject: Re: [PATCH 8/8] gpio: tqmx86: fix broken IRQ_TYPE_EDGE_BOTH interrupt type From: Matthias Schiffer To: Andrew Lunn Cc: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Gregor Herburger , linux@ew.tq-group.com Date: Wed, 29 May 2024 14:44:30 +0200 In-Reply-To: <9f8107e1-4a80-4f20-8862-f85aed578cc6@lunn.ch> References: <2c265b6bcfcde7d2327b94c4f6e3ad6d4f1e2de7.1716967982.git.matthias.schiffer@ew.tq-group.com> <9f8107e1-4a80-4f20-8862-f85aed578cc6@lunn.ch> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 On Wed, 2024-05-29 at 14:37 +0200, Andrew Lunn wrote: > On Wed, May 29, 2024 at 09:45:20AM +0200, Matthias Schiffer wrote: > > The TQMx86 GPIO controller only supports falling and rising edge > > triggers, but not both. Fix this by implementing a software both-edge > > mode that toggles the edge type after every interrupt. >=20 > Do you have a real use case for this, one that will handle lost > interrupts because it cannot swap edge quick enough? >=20 > I personally would not do this, because it is dangerous, it gives the > impression the device can do both, when in fact it cannot reliably. >=20 > For me, the correct fix is to return EOPNOTSUPP or EINVAL for BOTH. >=20 This was the first thing I tried as well, but it seems that supporting IRQ_= TYPE_EDGE_BOTH is mandatory for all GPIO drivers (not doing so results in various error messa= ges when attemting to use *any* type of interrupt for the GPIO; I don't remember the exact errors). F= or this reason, several drivers implement a similar software solution when the hardware doesn't sup= port it. Many drivers implement this in a fragile way that will easily break when an= edge is missed. On the TQMx86 we are lucky, and this software implementation is actually robust an= d will not stop reporting edges when one is missed. The reason is explained in detail in the long com= ment added by this patch. Matthias