From patchwork Tue Oct 30 10:07:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Xie X-Patchwork-Id: 10661245 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1E92E13BF for ; Tue, 30 Oct 2018 16:14:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0895428435 for ; Tue, 30 Oct 2018 16:14:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE11B2A2F7; Tue, 30 Oct 2018 16:14:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_WEB autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 97B6128435 for ; Tue, 30 Oct 2018 16:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=agbH9CJWzktLwsDITrAX1tdKmApsmAL9VCsekWk4/eA=; b=lum8sLDy0MbbD2nhMQzaeGAi0n IyoEjSTjVj1YeN+0+uiTy5Nd2MVhabIwGZctPnjuF/gNHwbGKis/SO3xqM5exjzeTY3n3DZEFK+oO ad8y7VTIWfpkWgrEKPY2nunMQh3zfDpRJGtu/UI1qiYy+lPbUNkMkTqgA1ikpciz1lNsRll3FGBuv H4LoQjt8mUAZhVRKGBtKNiGbECAXonPetOAuqE9+m7ojxm1AZtWqt/teU177+xFLCeCu5xbqvVeRt 041+dk4at5BOqzntE5+ixJIE+EfsvxyMrVuvkDo+faRBnqC1tnQ5C4q2P8iJ2NeHGk700u5tIrKNj 0EZg7leg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHWf2-00075M-Ag; Tue, 30 Oct 2018 16:14:32 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHW0P-00009z-02; Tue, 30 Oct 2018 15:32:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=KXIVPaWwtZ9dYKay0vWRVwb8Bj+9bC0D/B6kH49qajI=; b=eZVoAJhJlVk+lORnmmtY2EUun 6u/TJjiiLF9g2YNbcIjmy63laCygQAnYFjdtr1tvexMfz7azGyHmagIfb6mLT0x4HWoRZRSpcMvJB hugriNJ2gdq1nBt2vL0Uoog3u9IDCFNB3bGXi6Z3h/sM8hnOvrSua9fWSeDrDrHWBo14FX70eD8Cp kMPi6FKniVNcAocXfYMe9JdlD+f+R4Or9NE68Vb1XfXIJuH8aG+eVD+gZ2Id4lV0rzb28GOjwS1OL YotQgdcjIDP73ohUE3GrvdeYH53LiyPXqRxgzqhMhuUKNKCTdui85CHcAbZ5+WsZ+W8ZshumGMGle Mcesfw6iA==; Received: from lucky1.263xmail.com ([211.157.147.135]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHQuO-0000GZ-8t; Tue, 30 Oct 2018 10:06:02 +0000 Received: from tony.xie?rock-chips.com (unknown [192.168.167.73]) by lucky1.263xmail.com (Postfix) with ESMTP id 1587FA4C; Tue, 30 Oct 2018 18:05:16 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTPA id 40562390; Tue, 30 Oct 2018 18:05:11 +0800 (CST) X-RL-SENDER: tony.xie@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: tony.xie@rock-chips.com X-UNIQUE-TAG: <522ef8704b132ace1c41bb00a457b503> X-ATTACHMENT-NUM: 0 X-SENDER: xxx@rock-chips.com X-DNS-TYPE: 0 Received: from unknown (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith SMTP id 11686XWSHB9; Tue, 30 Oct 2018 18:05:15 +0800 (CST) From: Tony Xie To: heiko@sntech.de Subject: [PATCH v6 1/6] regmap: add a new macro:REGMAP_IRQ_REG_LINE(_id, _reg_bits) Date: Tue, 30 Oct 2018 18:07:56 +0800 Message-Id: <1540894081-31270-2-git-send-email-tony.xie@rock-chips.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1540894081-31270-1-git-send-email-tony.xie@rock-chips.com> References: <1540894081-31270-1-git-send-email-tony.xie@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181030_100600_554091_83F524A6 X-CRM114-Status: GOOD ( 14.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, a.zummo@towertech.it, alexandre.belloni@bootlin.com, tony.xie@rock-chips.com, huangtao@rock-chips.com, devicetree@vger.kernel.org, sboyd@kernel.org, zhangqing@rock-chips.com, linux-kernel@vger.kernel.org, robh+dt@kernel.org, xsf@rock-chips.com, linux-rockchip@lists.infradead.org, broonie@kernel.org, chenjh@rock-chips.com, lee.jones@linaro.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rtc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP if there are lots of irqs for a device and the register addresses for these irqs is continuous, we can use this macro to initialize regmap_irq value. Signed-off-by: Tony Xie --- include/linux/regmap.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 4f38068..a468b81 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -1047,6 +1047,12 @@ struct regmap_irq { #define REGMAP_IRQ_REG(_irq, _off, _mask) \ [_irq] = { .reg_offset = (_off), .mask = (_mask) } +#define REGMAP_IRQ_REG_LINE(_id, _reg_bits) \ + [_id] = { \ + .mask = BIT((_id) % (_reg_bits)), \ + .reg_offset = (_id) / (_reg_bits), \ + } + /** * struct regmap_irq_chip - Description of a generic regmap irq_chip. *