Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3751178imu; Mon, 10 Dec 2018 07:18:15 -0800 (PST) X-Google-Smtp-Source: AFSGD/XtGUBwitfLG03zMT7RoRPLIawWzLl0S5i52Jm4rtYcu/otlWUfftZPIMVxkTR9Hf6nQGoi X-Received: by 2002:a17:902:bc3:: with SMTP id 61mr12527953plr.15.1544455095108; Mon, 10 Dec 2018 07:18:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544455095; cv=none; d=google.com; s=arc-20160816; b=GJQ9tr6i2AYFiDKRCtuGj5zTjleproyX66Es5WHf8acliBaKkuBMGcPOvLmVRzaFAu xIh8Z2qQXMdVq7jZYqOMED5ZrQGdODXmhJZ2B65xLsrGkl20fI3HViH+Wb9vl6W1oEcZ 9j0Nn7j/oEpYQ2NnqioxXYw8knq520oH1M3810Btqk7YUPdquEvu6yatQBTE9CE5JCpy pYxLaqDoJi0osP0YGQUxSKB3dLdXG359uGSdcuaEfZzfjBw00FBeeB+qV3u/RXDOwiLg X/LwwqCnSI/glkEvBLBcv8hj+UhFvDes4gd7HY5qZ5gTaFGo2owHaBxI1O/7bQ3oUMYE UR/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=JNXkJiwuECc0BHY1JX1SVTPxOOb/dqyDoUoe7rKqJUc=; b=C2SOaBpMndv8mR6pL+ZWLE/esFrMks9Y4bXiwA2qS+GPF3FjsJh0C3oSj7qj0PH1Y9 pehEjeOrCsy4/c9jfWC/1YgBEqecBGmeECwFOB7SEka2iSg9jPV8yweVmFZsURioU0Ud Q1PFKz99uZrt0oEnWwgkk3XL2YB15PxSLo8GIsQyT8DUMChgOLine6MSlQY9OyPoGNVB q03qLz7QIokqdr3YuUdO7Q31NHEhVn/krp3jz/asDtd8YCrsx5FHtZC/BweqQhRPLgmN 1Q8ImHeIlsI7tdRiM0XqC3IvXjV+b8M6ftqGMz5eQc+iDxw1A09p14Y4tiUzV06E0siE cfbw== 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 b3si9620796pgc.587.2018.12.10.07.17.59; Mon, 10 Dec 2018 07:18:15 -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 S1727869AbeLJPQv (ORCPT + 99 others); Mon, 10 Dec 2018 10:16:51 -0500 Received: from relay1.mentorg.com ([192.94.38.131]:44574 "EHLO relay1.mentorg.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726602AbeLJPQv (ORCPT ); Mon, 10 Dec 2018 10:16:51 -0500 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-04.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1gWNIb-0003Vg-25 from Vladimir_Zapolskiy@mentor.com ; Mon, 10 Dec 2018 07:16:45 -0800 Received: from [137.202.108.125] (137.202.0.90) by SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Mon, 10 Dec 2018 15:16:39 +0000 Subject: Re: [PATCH] regmap: regmap-irq/gpio-max77620: add level-irq support To: Matti Vaittinen , References: <20181210081437.GA32228@localhost.localdomain> CC: , , , , , , , From: Vladimir Zapolskiy Message-ID: Date: Mon, 10 Dec 2018 17:16:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Icedove/45.2.0 MIME-Version: 1.0 In-Reply-To: <20181210081437.GA32228@localhost.localdomain> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-08.mgc.mentorg.com (139.181.222.8) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/10/2018 10:14 AM, Matti Vaittinen wrote: > Add level active IRQ support to regmap-irq irqchip. Change breaks > existing regmap-irq type setting. Convert the existing drivers which > use regmap-irq with trigger type setting (gpio-max77620) to work > with this new approach. So we do not magically support level-active > IRQs on gpio-max77620 - but add support to the regmap-irq for chips > which support them =) > > We do not support distinguishing situation where HW supports rising > and falling edge detection but not both. Separating this would require > inventing yet another flags for IRQ types. > > Signed-off-by: Matti Vaittinen > --- > I did both the regmap-irq and max77620 changes in same commit because > I'd rather not cause spot where max77620 breaks. Besides the changes in > max77620 driver are trivial. Please let me know if this is not Ok. > > Reason why I submit this patch now - even though my driver which would > use level active type setting with regmap-irq is not yet ready for > being submited - is that I'd like to minimize amount of existing drivers > we need to patch. And if we add level active irq support like this then > we must patch all existing drivers using type setting with regmap-irq. > So doing this now when only max77620 uses type setting may be easier > than postponing this to the future. > > And finally - I don't have max77620 so I have only done _wery_ limited > testing. So I would really appreciate if someone had time to review this > thoroughly - and even happier if someone had possibility to try this out > with the max77620. > [snip] > diff --git a/include/linux/regmap.h b/include/linux/regmap.h > index a367d59c301d..91c431ad98c3 100644 > --- a/include/linux/regmap.h > +++ b/include/linux/regmap.h > @@ -1098,6 +1098,9 @@ int regmap_fields_update_bits_base(struct regmap_field *field, unsigned int id, > * @type_reg_offset: Offset register for the irq type setting. > * @type_rising_mask: Mask bit to configure RISING type irq. > * @type_falling_mask: Mask bit to configure FALLING type irq. > + * @type_level_low_mask: Mask bit to configure LEVEL_LOW type irq. > + * @type_level_high_mask: Mask bit to configure LEVEL_HIGH type irq. > + * @types_supported: logical OR of IRQ_TYPE_* flags indicating supported types. While the existing interface is awful, you don't make it better. .types_supported value is always derived from non-zero .type_*_mask values, so it is simply not needed, as well as the whole change to gpio-max77620.c driver. > */ > struct regmap_irq { > unsigned int reg_offset; > @@ -1105,6 +1108,9 @@ struct regmap_irq { > unsigned int type_reg_offset; > unsigned int type_rising_mask; > unsigned int type_falling_mask; > + unsigned int type_level_low_mask; > + unsigned int type_level_high_mask; > + unsigned int types_supported; > }; > > #define REGMAP_IRQ_REG(_irq, _off, _mask) \ > -- Best wishes, Vladimir