Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5476180imu; Wed, 26 Dec 2018 03:45:05 -0800 (PST) X-Google-Smtp-Source: ALg8bN48TvHdlQR798kW+OLPcsMSRwNoj2P5Hp1L/9px0gz5ZDrgQS0DVE5jN/tekAabu5QLKPbK X-Received: by 2002:a17:902:bd4a:: with SMTP id b10mr19543940plx.232.1545824705925; Wed, 26 Dec 2018 03:45:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545824705; cv=none; d=google.com; s=arc-20160816; b=grUPoJv8PWED0Z616j2FD1isAvf+lE261OS3pbCMrFaWH+K/vm11NQyCcpDSaCV/fs FPEDNhl2MpxyngjTBmqIxUieNXMH/qCKsbvUAY00d7p9FuPs0WtfHyvktG71vXhmcRxq 38hAiid6qGZO7w5pmzW7AWiCb4hNlU3f4Ju/9pwtEqEzyVwGUK5R7Xq9Yqx/qTWu8cxS XCUPZDepsSBcH+3avzJUT9pIvPpek/y6X6MSvySwSOq5CSNx1aWr0uWywYsB1htCAeF7 anhHtkdMFM+ZLWw1s9/fWHert6GICEa82RqknJjM4MOYgZ0pX6zyou9Hk6te9nDFowva K83g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=K8uHQBK+p8bWU3jeZO+0SoK4bhEO6ltE34jcIg+t5uo=; b=OFDStfhCzYUyxs2dZ7vWyRUhoRAw0B/G2w6iZPt+zb8GrundiwSoD1QaSZKwL4y4X7 BHRp3ty9Jwb4t59vFO3Qc3A1rZEeqQZbd0fX7nuLUfZeSGBHIGbRNLf/ByIyoAPPGvai iL4jGZkK27zIsMhYTCWMA2+ham+7YJT8zKU7TvvbieBYPESpDyZZB4GRpZof7Wr/ZGMs 38SSZaj6xZL7YXlJUD2pns9qhEasEfw795aUk5HN81buJAo+4CLOQOq6wt+ZdV/GDxWt OvwlEPDrPi5SfrOKBx/JEUp69egzepgNiNAc9m4pXooH4QdbvJ/hdMlebUa1EWuYDlZX Ztgg== 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 j10si30770539pll.179.2018.12.26.03.44.50; Wed, 26 Dec 2018 03:45:05 -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 S1726686AbeLZLjb (ORCPT + 99 others); Wed, 26 Dec 2018 06:39:31 -0500 Received: from mail-ua1-f68.google.com ([209.85.222.68]:36356 "EHLO mail-ua1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726523AbeLZLjb (ORCPT ); Wed, 26 Dec 2018 06:39:31 -0500 Received: by mail-ua1-f68.google.com with SMTP id j3so5021112uap.3; Wed, 26 Dec 2018 03:39:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=K8uHQBK+p8bWU3jeZO+0SoK4bhEO6ltE34jcIg+t5uo=; b=WuDf89GR2wJXiJJwpmtdF7vCbVk0A6uC5BlyJfIMF8D8mN1LePsVAxC7TN+aFUWb0a SOV5MpqNRnL6vV7zg/ycjoG9fxgWzUKE3qZCl9eqkaOO56WP4eriz2YvWmfk/ZajV0lh caid5TYn6yxjiMmhgjRNGaLmm7y6j3sAEleQpXkuJTLm4jxlp3fM2eW9SkEeV6dcoMGF N6OqsmBIFj2oyDCc0TwW/XKDh7x8M3ECPYX4U3IZxtuo3/vrYKeY9NPclabFwGLRB5Ed /WUVlkWaOHnnd1KOdWkHnNT9vRh60JFcN+fqkisqM+EaXn051LvHTUd3PSqc43V3Z57E iOIw== X-Gm-Message-State: AJcUukfoSEnHdfpRuNPJfAYfhrrtdSTf9OX+y2iKKUdwP+uqak3BQ46g BIN9YfAvMHEr3vmD3I0Mmqgxtp0x8Ir8tDMWVRY= X-Received: by 2002:ab0:216:: with SMTP id 22mr7339580uas.28.1545824369729; Wed, 26 Dec 2018 03:39:29 -0800 (PST) MIME-Version: 1.0 References: <20181218115931.GA21253@localhost.localdomain> In-Reply-To: <20181218115931.GA21253@localhost.localdomain> From: Geert Uytterhoeven Date: Wed, 26 Dec 2018 12:39:17 +0100 Message-ID: Subject: Re: [PATCH v3] regmap: regmap-irq/gpio-max77620: add level-irq support To: Matti Vaittinen Cc: mazziesaccount@gmail.com, heikki.haikola@fi.rohmeurope.com, mikko.mutanen@fi.rohmeurope.com, Mark Brown , Greg KH , "Rafael J. Wysocki" , Linus Walleij , Linux Kernel Mailing List , "open list:GPIO SUBSYSTEM" , Vladimir Zapolskiy , Linux-Renesas Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Matti, On Tue, Dec 18, 2018 at 1:00 PM Matti Vaittinen wrote: > Add level active IRQ support to regmap-irq irqchip. Change breaks > existing regmap-irq type setting. Convert the existing drivers which Indeed it does. > 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 This is now upstream as commit 1c2928e3e3212252 ("regmap: regmap-irq/gpio-max77620: add level-irq support"), and breaks da9063-rtc on the Renesas Koelsch board: genirq: Setting trigger mode 8 for irq 157 failed (regmap_irq_set_type+0x0/0x140) da9063-rtc da9063-rtc: Failed to request ALARM IRQ 157: -524 da9063-rtc: probe of da9063-rtc failed with error -524 > --- > > Version 3 of this patch is intended to be functionally identical to v2. > This patch is rebased on top of a tree which contains changes: > "regmap: irq: handle HW using separate rising/falling edge interrupts" > from Bartosz Golaszewski and the change > "regmap: regmap-irq: Remove default irq type setting from core" > (proposed here): > https://lore.kernel.org/lkml/20181218105813.GA6957@localhost.localdomain/ > > There should not be direct dependency to "regmap: regmap-irq: Remove > default irq type setting from core" though. Patch was also tested to > apply cleany on regmap-tree. > > Same statement regarding testing applies - gpio-max77620 are only > tested to compile. All real testing would be _HIGHLY_ appreciated. > > drivers/base/regmap/regmap-irq.c | 35 ++++++++++----- > drivers/gpio/gpio-max77620.c | 96 ++++++++++++++++++++++++++-------------- > include/linux/regmap.h | 27 ++++++++--- > 3 files changed, 110 insertions(+), 48 deletions(-) > > diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c > index 8b216b2e2c19..31d23c9a5ae7 100644 > --- a/drivers/base/regmap/regmap-irq.c > +++ b/drivers/base/regmap/regmap-irq.c > @@ -199,7 +199,7 @@ static void regmap_irq_enable(struct irq_data *data) > const struct regmap_irq *irq_data = irq_to_regmap_irq(d, data->hwirq); > unsigned int mask, type; > > - type = irq_data->type_falling_mask | irq_data->type_rising_mask; > + type = irq_data->type.type_falling_val | irq_data->type.type_rising_val; > > /* > * The type_in_mask flag means that the underlying hardware uses > @@ -234,27 +234,42 @@ static int regmap_irq_set_type(struct irq_data *data, unsigned int type) > struct regmap_irq_chip_data *d = irq_data_get_irq_chip_data(data); > struct regmap *map = d->map; > const struct regmap_irq *irq_data = irq_to_regmap_irq(d, data->hwirq); > - int reg = irq_data->type_reg_offset / map->reg_stride; > + int reg; > + const struct regmap_irq_type *t = &irq_data->type; > > - if (!(irq_data->type_rising_mask | irq_data->type_falling_mask)) > - return 0; > + if ((t->types_supported & type) != type) > + return -ENOTSUPP; Given types_supported defaults to zero, I think this breaks every existing setup using REGMAP_IRQ_REG(). Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds