Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4303893ybl; Mon, 9 Dec 2019 08:37:40 -0800 (PST) X-Google-Smtp-Source: APXvYqzp/QqGP17ACoKmtybkEOZ0g9TKp+GPDCd1de8pM8BeqnGdZ11LoHObusud7GhfvFC1KN58 X-Received: by 2002:aca:de88:: with SMTP id v130mr25288235oig.108.1575909460129; Mon, 09 Dec 2019 08:37:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575909460; cv=none; d=google.com; s=arc-20160816; b=IihCyJkMY/DxEdzFbIP3bCLM0V5MPT35vNuyOtFBdd8Sq+OqesPZtRycZAOtWkg4gf 6Z9kI8+ySgeKLEsbFwXAwR+ZR2O+cvCUXDtpLFnD0XwUQLEw5Y1cJxS/GrWDuY8HklG3 uZeIe+kPlxnJ7y3OeNae6r5QCXxRV4wzqwik739rqHrI8XJdV18JaJR3KhMfzBQdLeut yoS5qXychTzxt3neNyJOVSVG3iu5oHH/GbK7vq2DRc5YWDIBEPOY7zHLDKkk070rW7OM CKaArrcwCwFdx3JHfVOHf5Aevkxvl/XuSm76xrQCaZebt+K+Xf1cgit+IRFQ3RP/vFv9 KuFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Ht2amruhm602sDL3MT9oDU9N9id33kA5LEg7t1L379Y=; b=R4xsI7QP08DRVIxW/js++VyQQ+eoMy3Z41iDkYfctkIwPDEJAW6bhcw7PuwMzXPzMB jDYR4TsFxRhdH3hG0lwDgG/AcqxwiattygB9o4JN4Q0ANEWSDANNE2ZUi/Bcare6R2vh bpzk9gKdjltRMKZpJb2GCTMIK8o6DAYKoB2aSQ1FQlevrUAnnb8krn+KgUF6C2jaWEgv TgjY+M8Eo9R7CxMAUGQyNKAyGy9RTQBg1GZJICjMeJRh74m4em+4LfhgMdF2UkoL7BzH GPF9zfq1DTIuSpUEYPWP4SdqRhHS9sgxCp0VhroMw8XleaepNw8nkIdciw0NIcgcU6WH 7tKg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z23si80666otk.166.2019.12.09.08.37.28; Mon, 09 Dec 2019 08:37:40 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726538AbfLIQhB (ORCPT + 99 others); Mon, 9 Dec 2019 11:37:01 -0500 Received: from mga12.intel.com ([192.55.52.136]:65260 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725904AbfLIQhB (ORCPT ); Mon, 9 Dec 2019 11:37:01 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Dec 2019 08:37:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,296,1571727600"; d="scan'208";a="244511160" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga002.fm.intel.com with ESMTP; 09 Dec 2019 08:36:59 -0800 Received: from andy by smile with local (Exim 4.93-RC5) (envelope-from ) id 1ieM1q-00011F-Qo; Mon, 09 Dec 2019 18:36:58 +0200 Date: Mon, 9 Dec 2019 18:36:58 +0200 From: Andy Shevchenko To: Jan Kiszka Cc: Linus Walleij , Bartosz Golaszewski , Linux Kernel Mailing List , linux-gpio@vger.kernel.org, Mika Westerberg , ACPI Devel Maling List , "Rafael J . Wysocki" Subject: Re: [PATCH v3 1/2] gpio: sch: Add edge event support Message-ID: <20191209163658.GL32742@smile.fi.intel.com> References: <42ae6149a14f81fd86c5acb5bd33e987123b6bed.1574277614.git.jan.kiszka@siemens.com> <20191122111219.GW32742@smile.fi.intel.com> <5d7399ce-1776-18ef-3bb5-6e3e8e7e7524@siemens.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5d7399ce-1776-18ef-3bb5-6e3e8e7e7524@siemens.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 22, 2019 at 04:33:05PM +0100, Jan Kiszka wrote: > On 22.11.19 12:12, Andy Shevchenko wrote: > > On Wed, Nov 20, 2019 at 08:20:13PM +0100, Jan Kiszka wrote: > > > + switch (type & IRQ_TYPE_SENSE_MASK) { > > > + case IRQ_TYPE_EDGE_RISING: > > > + rising = 1; > > > + break; > > > + case IRQ_TYPE_EDGE_FALLING: > > > + falling = 1; > > > + break; > > > + case IRQ_TYPE_EDGE_BOTH: > > > + rising = 1; > > > + falling = 1; > > > + break; > > > + default: > > > + return -EINVAL; > > > + } > > Won't we need to set up IRQ handler here and use handle_bad_irq() during > > initialization phase? > > Why? This is just defining the edge type, not whether an interrupt could be > generated or not. Also, we only have edge events here, so no reason to > switch types. OK. > > > + irq_base = devm_irq_alloc_descs(&pdev->dev, -1, 0, sch->chip.ngpio, > > > + NUMA_NO_NODE); > > > + if (irq_base < 0) > > > + return irq_base; > > > + sch->irq_base = irq_base; > > > + > > > + gc = devm_irq_alloc_generic_chip(&pdev->dev, "sch_gpio", 1, irq_base, > > > + NULL, handle_simple_irq); > > > + if (!gc) > > > + return -ENOMEM; > > > + > > > + gc->private = sch; > > > + ct = gc->chip_types; > > > + > > > + ct->chip.irq_mask = sch_irq_mask; > > > + ct->chip.irq_unmask = sch_irq_unmask; > > > + ct->chip.irq_set_type = sch_irq_type; > > > + > > > + ret = devm_irq_setup_generic_chip(&pdev->dev, gc, > > > + IRQ_MSK(sch->chip.ngpio), > > > + 0, IRQ_NOREQUEST | IRQ_NOPROBE, 0); > > > + if (ret) > > > + return ret; > > > > Shan't we do this in the (similar) way how it's done in pinctrl-cherryview.c > > driver? (Keep in mind later patches which are going to be v5.5) > > > > Can you be a bit more specific for me? Do you mean the pattern > gpiochip_irqchip_add / gpiochip_set_chained_irqchip? What would be the > difference / benefit? And how would I link sch_sci_handler to that pattern? Now we have struct irq_chip is part of GPIO chip, so, we may use it and supply needed callbacks and settings before calling gpiochip_add_data(). Will it work in this case? -- With Best Regards, Andy Shevchenko