Received: by 2002:a17:90a:37e8:0:0:0:0 with SMTP id v95csp4232540pjb; Mon, 21 Oct 2019 02:10:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxuO0Quf8emfMc+PgmqgVhCvidwUNWB1DeAX4O7VC/J1NvFha6Mifflb1lQy2QvjKkFD3x1 X-Received: by 2002:a17:906:c289:: with SMTP id r9mr4830877ejz.311.1571649043555; Mon, 21 Oct 2019 02:10:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571649043; cv=none; d=google.com; s=arc-20160816; b=CbvK1eYDepzP3ptx5LADmnnaM5TyBHJtJKhQlYKOOFyC/OqCh1zyJ1Hpfjx/HmftjC uQdZ/ZZKabkm6BERQds4HNiQPRzypDOOqkoC47KZybi8twFVMiTMk1vykJz1fvCF1YyS U+rypcHoAjBo6BZuy27EibJ86SwQaS1t+uWiyOAzjLiYLVYXIlSLHurwg6/5Dezs/Qxe AucLOZyq1TqJ4bn2aWF4PMWG8xlRZcGFofyZz1KjctOE5X9xSc1rmkh3hZAHv/fSaFL8 dX0RSfMzNRh3HP+Yf+gANsMG/TpEeV1RvyUrt/ZAIF4FTGLEBqmJ0uzsCXwNsm5MalDv qU5A== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=eKhT42bVAS2YArI9ZvvqpOVOY3SpvrChRSxtNh7T3Gs=; b=Z2FqZEyUUEQFVmz7hTuNGBiXYRYRleIQvJePEpoJk7NKTFF+dxjQI/yGWEOBEJuiM3 qjtCYXFwCqzIod3X9pmJcuGDqy+IjFMVypxHH6KRQc/Qt6HHYmTS43f+hWhnBE8Bhr8z JeZdSKUZ14CMZxJNyIkJLfuGNin5yO7A89Dmj+fcE4eje9SV97D4dL8Ty5QYbfxKNYBD LdPaSuu2WdZGm+dCmoZxHIIGUOCcQifvDnB+7PULVoEpVE768JEeKoCqm0L1ZZOPRPFL pa/fo7b5Smi5vypSm1hBIWh+7rzjQDqMdZW+Va96yeBR59SfqMNKEJflS6QWWIeGJJca YhdA== 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 r17si9830121edx.257.2019.10.21.02.10.20; Mon, 21 Oct 2019 02:10:43 -0700 (PDT) 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 S1727213AbfJUJHO (ORCPT + 99 others); Mon, 21 Oct 2019 05:07:14 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:55467 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726181AbfJUJHO (ORCPT ); Mon, 21 Oct 2019 05:07:14 -0400 X-Originating-IP: 86.207.98.53 Received: from localhost (aclermont-ferrand-651-1-259-53.w86-207.abo.wanadoo.fr [86.207.98.53]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 5AA8B60009; Mon, 21 Oct 2019 09:07:10 +0000 (UTC) Date: Mon, 21 Oct 2019 11:07:10 +0200 From: Alexandre Belloni To: Andreas Kemnade Cc: lee.jones@linaro.org, a.zummo@towertech.it, linux-kernel@vger.kernel.org, linux-rtc@vger.kernel.org, phh@phh.me, b.galvani@gmail.com, stefan@agner.ch, letux-kernel@openphoenux.org Subject: Re: [PATCH 2/5] mfd: rn5t618: add irq support Message-ID: <20191021090710.GT3125@piout.net> References: <20191021054104.26155-1-andreas@kemnade.info> <20191021054104.26155-3-andreas@kemnade.info> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191021054104.26155-3-andreas@kemnade.info> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 21/10/2019 07:41:01+0200, Andreas Kemnade wrote: > +#if 0 > +/* > + * REVISIT when implementing charger: > + * according to some other implementation it needs special treatment, > + * inverted but experiments seem not to confirm that. > + */ > + [RN5T618_IRQ_CHG] = { > + .reg_offset = 0, > + .mask = (1 << 6), > + } > +#endif Please avoid submitting dead code. > +}; > + > +static const struct regmap_irq_chip rc5t619_irq_chip = { > + .name = "rc5t619", > + .irqs = rc5t619_irqs, > + .num_irqs = ARRAY_SIZE(rc5t619_irqs), > + .num_regs = 1, > + .status_base = RN5T618_INTMON, > + .mask_base = RN5T618_INTEN, > + .mask_invert = true, > +}; > + > +int rn5t618_irq_init(struct rn5t618 *rn5t618) > +{ > + const struct regmap_irq_chip *irq_chip; > + int ret; > + > + if (!rn5t618->chip_irq) > + return 0; > + > + switch (rn5t618->variant) { > + case RC5T619: > + irq_chip = &rc5t619_irq_chip; > + break; > + > + /* TODO: check irq definitions for other variants */ > + > + default: > + irq_chip = NULL; > + break; > + } > + > + if (!irq_chip) { > + dev_err(rn5t618->dev, "no IRQ definition known for variant\n"); > + return -ENOENT; > + } > + > + ret = devm_regmap_add_irq_chip(rn5t618->dev, rn5t618->regmap, > + rn5t618->chip_irq, > + IRQF_TRIGGER_FALLING | IRQF_ONESHOT, > + 0, irq_chip, &rn5t618->irq_data); > + if (ret != 0) { > + dev_err(rn5t618->dev, "Failed to register IRQ chip\n"); > + return ret; > + } > + > + return 0; > +} > diff --git a/include/linux/mfd/rn5t618.h b/include/linux/mfd/rn5t618.h > index d62ef48060b5..4d680f34ad2f 100644 > --- a/include/linux/mfd/rn5t618.h > +++ b/include/linux/mfd/rn5t618.h > @@ -242,9 +242,27 @@ enum { > RC5T619, > }; > > + > +/* RN5T618 IRQ definitions */ > +enum { > + RN5T618_IRQ_SYS, > + RN5T618_IRQ_DCDC, > + RN5T618_IRQ_RTC, > + RN5T618_IRQ_ADC, > + RN5T618_IRQ_GPIO, > + RN5T618_IRQ_CHG, > + RN5T618_NR_IRQS, > +}; > + > + Spurious blank line. > struct rn5t618 { > struct regmap *regmap; > + struct device *dev; > long variant; > + > + int chip_irq; > + struct regmap_irq_chip_data *irq_data; > }; > > +extern int rn5t618_irq_init(struct rn5t618 *rn5t618); > #endif /* __LINUX_MFD_RN5T618_H */ > -- > 2.11.0 > -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com