Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3710539imj; Tue, 12 Feb 2019 03:25:25 -0800 (PST) X-Google-Smtp-Source: AHgI3IbsQH//uVF5vjz5jbAFC2SU12/dnOj1hjusoHFvp1QEFF0002BM+09ZFdE9th+EoWwKozgz X-Received: by 2002:a62:ea09:: with SMTP id t9mr3634019pfh.228.1549970725751; Tue, 12 Feb 2019 03:25:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549970725; cv=none; d=google.com; s=arc-20160816; b=V2KIF7C/2/eZHY/EbbVo7olgR+U2KLXgt153+OEpwPa4qcdPswu/rnl1DLIjarg7NT BvoaQsTOj0N72JXYXyqhz/Iz2EOI+pDzOc3kJ6FSag/BgcqrRdXg+RlFHgIZcpJC5YnH RIEup7Xgth+OcLjku0GLyqaRsY/oA8fHJyhRKrhnBZPrmrl+cBaCjRcsubXtv2BgtPkM ben3d5CiCuQmSSXQAEQUsHS6hyv+6FxEhp6Fn9wn3LdQvSLcbvV721rhAx9dYKqc2B6S Y5+OGeHKsIA810QrVZGrZlLJ5G70vC0SbHdqemPYsbD5DdBybPrh0Q+9dmDSSyjRRY2E +oAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=9XakLv8LZXy23K5GZga2lutiJEApA1L46AApIT3oYMU=; b=xJrj1gSUXSiEQAuqXypHEijtEC+/d85nG1ZGQT3IIi1oI1KOe2Vcm3QHW4SjuLbiKT UVDBLt/UbfHn3/4d9XvivN25SMmE+FEHXhvtj9DvrbX7BXcvFwoBpCTk4PMlgr2w99w9 TasNMuzbFIXAAHFtdMS7j78D+BEYtL3OMmQ4vn3HW1ncOCQedSKOdFrEBNAzFzLiwszd DFVc1rrBPcxbtyvbk9cBNFePmgV731wT+zKRb7CGSDGJsTxxG2PLyUYA0P6iM+vG8lOS whwfsyTeyzysZr4JESFYgIFjPsPrUHPWbUWekNCwviQiI4ef0PC6k3cUHL8LB+Wav6b/ Aqgw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q2si11895843pgv.124.2019.02.12.03.25.10; Tue, 12 Feb 2019 03:25:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728848AbfBLLFH (ORCPT + 99 others); Tue, 12 Feb 2019 06:05:07 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:35331 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727553AbfBLLFH (ORCPT ); Tue, 12 Feb 2019 06:05:07 -0500 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gtVs7-0003oz-4f; Tue, 12 Feb 2019 12:05:03 +0100 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1gtVs6-0005IS-09; Tue, 12 Feb 2019 12:05:02 +0100 Date: Tue, 12 Feb 2019 12:05:01 +0100 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Marc Zyngier Cc: Bartosz Golaszewski , Bartosz Golaszewski , Linus Walleij , Thomas Gleixner , linux-gpio , LKML Subject: Re: [PATCH v2 3/9] irq/irq_sim: provide irq_sim_fire_type() Message-ID: <20190212110501.wd7ks7vms7pi63dk@pengutronix.de> References: <20190129084411.30495-1-brgl@bgdev.pl> <20190129084411.30495-4-brgl@bgdev.pl> <656763ec-41b9-cdee-22bd-1f32d74473a0@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 12, 2019 at 10:27:54AM +0000, Marc Zyngier wrote: > On 12/02/2019 09:19, Bartosz Golaszewski wrote: > > When userspace wants to monitor GPIO line interrupts, the GPIO > > framework requests a threaded interrupt with IRQF_TRIGGER_FALLING, > > IRQF_TRIGGER_RISING or both. The testing module tries to act like real > > hardware and so if we pass only one of the *_TRIGGER_* flags, we want > > the simulated interrupt of corresponding type to be fired. > > Well, that's not how HW works. I cannot follow. I agree with Bartosz here. If you configure your SoC's irq-controller to only fire on a raising edge, you don't get an event when the line falls. > > Another solution - if you don't like this one - would be to have more > > specialized functions: irq_sim_fire_rising() and > > irq_sim_fire_falling(). How about that? > > I think you're missing the point. So far, your API has been "an > interrupt has fired", no matter what the trigger is, and that's fine. > That's just modeling the output of an abstract interrupt controller into > whatever the irqsim is simulating. > > Now, what you're exposing is "this is how the line changed". Which is an > entirely different business, as you're now exposing the device output > line. Yes, you can model it with raising/falling, but you need at least > resampling for level interrupts, and actual edge detection (raising > followed by raising only generates a single interrupt, while > raising-falling-raising generates two). This matches my concern and that's why I suggested somewhere else in this thread to put the configuration of the sensitiveness and the actual tracking of the line in the same component (either irqsim or gpio-mockup). Given that there are only two irqsim users and the other one (something in iio) doesn't need that sensitiveness stuff (and I cannot imagine another user of irqsim with the sensitiveness support) I think it is best to move this to the mockup driver. That's how "normal" hardware drivers have to do it, too. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |