From: Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>
To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Pratham Pratap <pratham.pratap@oss.qualcomm.com>,
Jack Pham <jack.pham@oss.qualcomm.com>,
Wesley Cheng <wesley.cheng@oss.qualcomm.com>,
Peter Chen <peter.chen@oss.qualcomm.com>,
linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org,
Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>
Subject: [PATCH RFC 1/2] usb: dwc3: qcom: Refactor DDR ICC bandwidth setting into helper
Date: Mon, 30 Nov 2026 23:11:12 +0530 [thread overview]
Message-ID: <20261130-dynamic-icc-voting-v1-1-1a05a5320adc@oss.qualcomm.com> (raw)
In-Reply-To: <20261130-dynamic-icc-voting-v1-0-1a05a5320adc@oss.qualcomm.com>
Extract the icc_set_bw() calls for the DDR path from interconnect_init()
into a new helper function. This avoids code duplication and prepares a
reusable interface for future callers that need to update the DDR
interconnect vote at runtime based on the connected USB device speed.
No functional change intended.
Signed-off-by: Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>
---
drivers/usb/dwc3/dwc3-qcom.c | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index 5a68025ccea5..52ec7a0709ef 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -159,6 +159,24 @@ static int dwc3_qcom_interconnect_disable(struct dwc3_qcom *qcom)
return ret;
}
+static int dwc3_qcom_interconnect_set_ddr_bw(struct dwc3_qcom *qcom,
+ enum usb_device_speed max_speed)
+{
+ struct device *dev = qcom->dev;
+ int ret;
+
+ if (max_speed >= USB_SPEED_SUPER || max_speed == USB_SPEED_UNKNOWN)
+ ret = icc_set_bw(qcom->icc_path_ddr,
+ USB_MEMORY_AVG_SS_BW, USB_MEMORY_PEAK_SS_BW);
+ else
+ ret = icc_set_bw(qcom->icc_path_ddr,
+ USB_MEMORY_AVG_HS_BW, USB_MEMORY_PEAK_HS_BW);
+ if (ret)
+ dev_err(dev, "failed to set bandwidth for usb-ddr path: %d\n", ret);
+
+ return ret;
+}
+
/**
* dwc3_qcom_interconnect_init() - Get interconnect path handles
* and set bandwidth.
@@ -185,17 +203,9 @@ static int dwc3_qcom_interconnect_init(struct dwc3_qcom *qcom)
}
max_speed = usb_get_maximum_speed(qcom->dwc.dev);
- if (max_speed >= USB_SPEED_SUPER || max_speed == USB_SPEED_UNKNOWN) {
- ret = icc_set_bw(qcom->icc_path_ddr,
- USB_MEMORY_AVG_SS_BW, USB_MEMORY_PEAK_SS_BW);
- } else {
- ret = icc_set_bw(qcom->icc_path_ddr,
- USB_MEMORY_AVG_HS_BW, USB_MEMORY_PEAK_HS_BW);
- }
- if (ret) {
- dev_err(dev, "failed to set bandwidth for usb-ddr path: %d\n", ret);
+ ret = dwc3_qcom_interconnect_set_ddr_bw(qcom, max_speed);
+ if (ret)
goto put_path_apps;
- }
ret = icc_set_bw(qcom->icc_path_apps, APPS_USB_AVG_BW, APPS_USB_PEAK_BW);
if (ret) {
--
2.34.1
next prev parent reply other threads:[~2026-11-30 17:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 17:41 [PATCH RFC 0/2] Support dynamic icc voting based on negotiated usb speed Krishna Kurapati
2026-11-30 17:41 ` Krishna Kurapati [this message]
2026-11-30 17:41 ` [PATCH RFC 2/2] usb: dwc3: qcom: Vote ICC DDR bandwidth based on connected device speed Krishna Kurapati
2026-12-01 17:58 ` Val Packett
2026-12-01 18:21 ` Krishna Kurapati
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=20261130-dynamic-icc-voting-v1-1-1a05a5320adc@oss.qualcomm.com \
--to=krishna.kurapati@oss.qualcomm.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=gregkh@linuxfoundation.org \
--cc=jack.pham@oss.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=peter.chen@oss.qualcomm.com \
--cc=pratham.pratap@oss.qualcomm.com \
--cc=wesley.cheng@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®