From: Guru Das Srinagesh <gurus@codeaurora.org>
To: Mark Brown <broonie@kernel.org>,
Markus Elfring <Markus.Elfring@web.de>,
Lee Jones <lee.jones@linaro.org>,
Rob Herring <robh+dt@kernel.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>,
Greg KH <gregkh@linuxfoundation.org>,
Guenter Roeck <linux@roeck-us.net>, Joe Perches <joe@perches.com>,
Subbaraman Narayanamurthy <subbaram@codeaurora.org>,
David Collins <collinsd@codeaurora.org>,
Anirudh Ghayal <aghayal@codeaurora.org>,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org,
Guru Das Srinagesh <gurus@codeaurora.org>
Subject: [PATCH v5 2/2] regmap-irq: Add driver callback to configure virtual regs
Date: Wed, 24 Mar 2021 12:28:54 -0700 [thread overview]
Message-ID: <07e058cdec2297d15c95c825aa0263064d962d5a.1616613838.git.gurus@codeaurora.org> (raw)
In-Reply-To: <cover.1616613838.git.gurus@codeaurora.org>
In-Reply-To: <cover.1616613838.git.gurus@codeaurora.org>
Enable drivers to configure and modify "virtual" registers, which are
non-standard registers that further configure irq type on some devices.
Since they are non-standard, enable drivers to configure them according
to their particular idiosyncrasies by specifying an optional callback
function while registering with the framework.
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
---
drivers/base/regmap/regmap-irq.c | 5 +++++
include/linux/regmap.h | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index d1ade76..e6343ccc 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -333,6 +333,11 @@ static int regmap_irq_set_type(struct irq_data *data, unsigned int type)
default:
return -EINVAL;
}
+
+ if (d->chip->set_type_virt)
+ return d->chip->set_type_virt(d->virt_buf, type, data->hwirq,
+ reg);
+
return 0;
}
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 97ec733..f87a11a 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -1426,6 +1426,8 @@ struct regmap_irq_sub_irq_map {
* before regmap_irq_handler process the interrupts.
* @handle_post_irq: Driver specific callback to handle interrupt from device
* after handling the interrupts in regmap_irq_handler().
+ * @set_type_virt: Driver specific callback to extend regmap_irq_set_type()
+ * and configure virt regs.
* @irq_drv_data: Driver specific IRQ data which is passed as parameter when
* driver specific pre/post interrupt handler is called.
*
@@ -1473,6 +1475,8 @@ struct regmap_irq_chip {
int (*handle_pre_irq)(void *irq_drv_data);
int (*handle_post_irq)(void *irq_drv_data);
+ int (*set_type_virt)(unsigned int **buf, unsigned int type,
+ unsigned long hwirq, int reg);
void *irq_drv_data;
};
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
next prev parent reply other threads:[~2021-03-24 19:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-24 19:28 [PATCH v5 0/2] Add support for Qualcomm MFD PMIC register layout Guru Das Srinagesh
2021-03-24 19:28 ` [PATCH v5 1/2] regmap-irq: Introduce virtual regs to handle more config regs Guru Das Srinagesh
2021-03-24 19:28 ` Guru Das Srinagesh [this message]
2021-04-01 10:16 ` [PATCH v5 0/2] Add support for Qualcomm MFD PMIC register layout Mark Brown
2021-04-06 1:11 ` Guru Das Srinagesh
2021-04-09 0:48 ` Guru Das Srinagesh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=07e058cdec2297d15c95c825aa0263064d962d5a.1616613838.git.gurus@codeaurora.org \
--to=gurus@codeaurora.org \
--cc=Markus.Elfring@web.de \
--cc=aghayal@codeaurora.org \
--cc=bjorn.andersson@linaro.org \
--cc=broonie@kernel.org \
--cc=collinsd@codeaurora.org \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=joe@perches.com \
--cc=lee.jones@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=robh+dt@kernel.org \
--cc=subbaram@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).