Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp733183pxf; Wed, 10 Mar 2021 16:44:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJz60HVYo7HCvi1Ee5Hj5LEUd1veWM4ZezEUt9rYNGfVQQJz0Mqwiy4qgqk95PeaJuoSK8Pb X-Received: by 2002:a50:ec07:: with SMTP id g7mr5979004edr.72.1615423449455; Wed, 10 Mar 2021 16:44:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615423449; cv=none; d=google.com; s=arc-20160816; b=GrcwF4NEgGdpCxsPC/4MJnmSKD/92edcBhLhszAPPvpOCTBh04m7hZjbs54aZQSWq0 NWhPghKjiaCKMYciEvaA0LRogtt4RaZSs94O0CGhvSw5HFi7P+c26D/TjSWKVNgXLxZT KtKcNdrEQxnzP1nFYLVwMhIjJcJrEOOCagpqmtYmSlcrZZGmJ2ompKQlrwe6OvC/PBnc 9JX+xXCrIyA/p0RRYxolf79DZ32r2FB/A72r/iw5VeRsy+0pdEF40BZP0P39eUD94xp2 nxsODY9KZgHj5NLq2LH2kOvNjmAdC4sV9Y0ZGDDN9i1zwOajIltIjMdxixO6jBtrZVZk S0BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=ZlRzlXoBPewMEtBTe7xd8d2ADFGaNinKKENKlhihMZo=; b=DRRqcZFrln7L/rJGALL4spTP7GdXB8Y/C6bTcrGufGtVWcBNHZWlG40hGYEhFyBdBY idigyfA9p9rEkKYFAM58m6O6xgwkJNpCoLn6ghRCjmGPO2z2CXNrwTUoz4e2MYs33Pwv I8K64CNee/5ff2FUTbS0E+Kg+Hp2521QTL6pkBWrv4y2otEkmFJhlNIcecOMSkuhFL+1 zdVaBXV6qul0FFEs9iNzf0cLrIf1Hf3vQew4hshaFQhVY6wP7hbi7pZpyAtCNa1W+d3T UnDUW8IB3DCayDXYOvfeovwkvb4qAKVn6CEjoyecqFG8s0fU+X2k39ap7IpMLmliBKCM 9Mpg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id de4si575726ejc.539.2021.03.10.16.43.47; Wed, 10 Mar 2021 16:44:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229517AbhCKAk0 (ORCPT + 99 others); Wed, 10 Mar 2021 19:40:26 -0500 Received: from alexa-out-sd-01.qualcomm.com ([199.106.114.38]:27978 "EHLO alexa-out-sd-01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229546AbhCKAj5 (ORCPT ); Wed, 10 Mar 2021 19:39:57 -0500 Received: from unknown (HELO ironmsg-SD-alpha.qualcomm.com) ([10.53.140.30]) by alexa-out-sd-01.qualcomm.com with ESMTP; 10 Mar 2021 16:39:57 -0800 X-QCInternal: smtphost Received: from gurus-linux.qualcomm.com (HELO gurus-linux.localdomain) ([10.46.162.81]) by ironmsg-SD-alpha.qualcomm.com with ESMTP; 10 Mar 2021 16:39:56 -0800 Received: by gurus-linux.localdomain (Postfix, from userid 383780) id B083919F4; Wed, 10 Mar 2021 16:39:56 -0800 (PST) From: Guru Das Srinagesh To: Mark Brown , Markus Elfring , Lee Jones , Rob Herring Cc: Bjorn Andersson , Greg KH , Guenter Roeck , Joe Perches , Subbaraman Narayanamurthy , David Collins , Anirudh Ghayal , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Guru Das Srinagesh Subject: [RFC PATCH v3 0/3] Add support for Qualcomm MFD PMIC register layout Date: Wed, 10 Mar 2021 16:39:51 -0800 Message-Id: X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Changes from v2: - Split up framework changes patch for better comprehension. - Dropped PM8008 driver example and converted it into example code in cover letter and commit text. - Added more info in cover letter and commit message as per v2 feedback. This is a follow-up as promised [1] to the earlier attempts [2] [3] to upstream the driver that has been hitherto used to handle IRQs for Qualcomm's PMICs that have multiple on-board peripherals when they are interfaced over the I2C interface. This series is a rewrite of that driver while making use of the regmap-irq framework, which needs some modifications to handle the register layout of Qualcomm's PMICs. This is an RFC because I would like to get feedback on my general approach before submitting as a patch per se. Qualcomm's MFD chips have a top level interrupt status register and sub-irqs (peripherals). When a bit in the main status register goes high, it means that the peripheral corresponding to that bit has an unserviced interrupt. If the bit is not set, this means that the corresponding peripheral does not. The differences between Qualcomm's register layout and what the regmap-irq framework assumes are best described with an example: Suppose that there are three peripherals onboard an MFD chip: MISC, TEMP_ALARM and GPIO01. Each of these peripherals has the following IRQ configuration registers: mask, type and ack. There is a top level interrupt status register and per-peripheral status registers as well (not shown below). The regmap-irq framework expects all similar registers to be at a fixed stride from each other, for each peripheral, as below (with stride = 1). /* All mask registers together */ MISC_INT_MASK 0x1011 TEMP_ALARM_INT_MASK 0x1012 GPIO01_INT_MASK 0x1013 /* All type registers together */ MISC_INT_TYPE 0x2011 TEMP_ALARM_INT_TYPE 0x2012 GPIO01_INT_TYPE 0x2013 /* All ack registers together */ MISC_INT_ACK 0x3011 TEMP_ALARM_INT_ACK 0x3012 GPIO01_INT_ACK 0x3013 In contrast, QCOM's registers are laid out as follows: /* All of MISC peripheral's registers together */ MISC_INT_MASK 0x1011 MISC_INT_TYPE 0x1012 MISC_INT_ACK 0x1013 /* All of TEMP_ALARM peripheral's registers together */ TEMP_ALARM_INT_MASK 0x2011 TEMP_ALARM_INT_TYPE 0x2012 TEMP_ALARM_INT_ACK 0x2013 /* All of GPIO01 peripheral's registers together */ GPIO01_INT_MASK 0x3011 GPIO01_INT_TYPE 0x3012 GPIO01_INT_ACK 0x3013 As is evident, the different IRQ configuration registers are just (0x11, 0x12, 0x13) with offsets of (0x1000, 0x2000 and 0x3000) respectively in QCOM's case. If the *_base registers fed to the struct regmap_irq_chip could be set to the first peripheral (MISC in this example), then through the sub_reg_offsets mechanism, we could add the offsets _to_ the *_base register values to get at the configuration registers for each peripheral. Hopefully this will help when reviewing the changes in this series. [1] https://lore.kernel.org/lkml/20200519185757.GA13992@codeaurora.org/ [2] https://lore.kernel.org/lkml/cover.1588037638.git.gurus@codeaurora.org/ [3] https://lore.kernel.org/lkml/cover.1588115326.git.gurus@codeaurora.org/ Guru Das Srinagesh (3): regmap-irq: Extend sub-irq to support non-fixed reg strides regmap-irq: Add support for POLARITY_HI and POLARITY_LO config regs regmap-irq: Modify type_buf handling for IRQ_TYPE_LEVEL_* drivers/base/regmap/regmap-irq.c | 152 +++++++++++++++++++++++++++++++-------- include/linux/regmap.h | 11 +++ 2 files changed, 133 insertions(+), 30 deletions(-) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project