From: Viken Dadhaniya <viken.dadhaniya@oss.qualcomm.com>
To: Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Abel Vesa <abelvesa@kernel.org>
Cc: mukesh.savaliya@oss.qualcomm.com, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org,
Viken Dadhaniya <viken.dadhaniya@oss.qualcomm.com>
Subject: [PATCH 2/2] soc: qcom: geni-se: Avoid redundant transfer mode selection
Date: Mon, 12 Oct 2026 17:50:22 +0530 [thread overview]
Message-ID: <20261012-cache-se-mode-v1-2-22945ed0da29@oss.qualcomm.com> (raw)
In-Reply-To: <20261012-cache-se-mode-v1-0-22945ed0da29@oss.qualcomm.com>
geni_se_select_mode() is called for every FIFO and SE-DMA transfer, even
when the serial engine is already configured for the requested mode. Each
call clears interrupt status and accesses mode-related registers, causing
unnecessary MMIO operations on the transfer path.
Cache the previously selected mode and skip only redundant mode
programming. Preserve pending interrupt status cleanup and GPI event
routing. Invalidate the cache from geni_se_init(). Update it only after a
valid mode selection.
Signed-off-by: Viken Dadhaniya <viken.dadhaniya@oss.qualcomm.com>
---
drivers/soc/qcom/qcom-geni-se.c | 11 ++++++++++-
include/linux/soc/qcom/geni-se.h | 1 +
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c
index 311046544b4c..ce4de4917a83 100644
--- a/drivers/soc/qcom/qcom-geni-se.c
+++ b/drivers/soc/qcom/qcom-geni-se.c
@@ -370,6 +370,8 @@ void geni_se_init(struct geni_se *se, u32 rx_wm, u32 rx_rfr)
{
u32 val;
+ se->prev_xfer_mode = GENI_SE_INVALID;
+
geni_se_irq_clear(se);
geni_se_io_init(se->base);
geni_se_io_set_mode(se->base);
@@ -462,6 +464,11 @@ void geni_se_select_mode(struct geni_se *se, enum geni_se_xfer_mode mode)
{
WARN_ON(mode != GENI_SE_FIFO && mode != GENI_SE_DMA && mode != GENI_GPI_DMA);
+ if (likely(se->prev_xfer_mode == mode)) {
+ geni_se_clear_irq_status(se);
+ return;
+ }
+
switch (mode) {
case GENI_SE_FIFO:
geni_se_select_fifo_mode(se);
@@ -474,8 +481,10 @@ void geni_se_select_mode(struct geni_se *se, enum geni_se_xfer_mode mode)
break;
case GENI_SE_INVALID:
default:
- break;
+ return;
}
+
+ se->prev_xfer_mode = mode;
}
EXPORT_SYMBOL_GPL(geni_se_select_mode);
diff --git a/include/linux/soc/qcom/geni-se.h b/include/linux/soc/qcom/geni-se.h
index b3372a3147a0..f77c3a47c3d0 100644
--- a/include/linux/soc/qcom/geni-se.h
+++ b/include/linux/soc/qcom/geni-se.h
@@ -78,6 +78,7 @@ struct geni_se {
struct geni_icc_path icc_paths[3];
struct dev_pm_domain_list *pd_list;
bool has_opp;
+ enum geni_se_xfer_mode prev_xfer_mode;
};
/* Common SE registers */
--
2.34.1
prev parent reply other threads:[~2026-10-12 12:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 12:20 [PATCH 0/2] " Viken Dadhaniya
2026-10-12 12:20 ` [PATCH 1/2] soc: qcom: geni-se: Split IRQ status clearing from " Viken Dadhaniya
2026-10-12 12:20 ` Viken Dadhaniya [this message]
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=20261012-cache-se-mode-v1-2-22945ed0da29@oss.qualcomm.com \
--to=viken.dadhaniya@oss.qualcomm.com \
--cc=abelvesa@kernel.org \
--cc=andersson@kernel.org \
--cc=konradybcio@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mukesh.savaliya@oss.qualcomm.com \
/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
all inboxes | Powered by JetHome®