From: Praveen Talari <praveen.talari@oss.qualcomm.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
konrad.dybcio@oss.qualcomm.com, bjorn.andersson@oss.qualcomm.com
Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-serial@vger.kernel.org,
chandana.chiluveru@oss.qualcomm.com,
mukesh.savaliya@oss.qualcomm.com,
Praveen Talari <praveen.talari@oss.qualcomm.com>
Subject: [PATCH v2 1/3] serial: qcom-geni: Use common GENI resource initialisation helpers
Date: Sat, 01 Aug 2026 11:18:15 +0530 [thread overview]
Message-ID: <20260801-reuse_common_geni_framework_helpers-v2-1-13753256ef71@oss.qualcomm.com> (raw)
In-Reply-To: <20260801-reuse_common_geni_framework_helpers-v2-0-13753256ef71@oss.qualcomm.com>
The UART driver maintains local helpers for resource and power-domain
initialisation that duplicate functionality already provided by the common
GENI framework.
Replace the driver-specific implementations with geni_se_resources_init()
and geni_se_domain_attach(), and use the power-domain list stored in
struct geni_se. This reduces code duplication and centralises GENI resource
management without functional changes.
Signed-off-by: Praveen Talari <praveen.talari@oss.qualcomm.com>
---
drivers/tty/serial/qcom_geni_serial.c | 81 ++++-------------------------------
1 file changed, 9 insertions(+), 72 deletions(-)
diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
index fa4adb543562..c8c4f01d3143 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -115,8 +115,7 @@ static DEFINE_IDA(port_ida);
struct qcom_geni_device_data {
bool console;
enum geni_se_xfer_mode mode;
- struct dev_pm_domain_attach_data pd_data;
- int (*resources_init)(struct uart_port *uport);
+ int (*resources_init)(struct geni_se *se);
int (*set_rate)(struct uart_port *uport, unsigned int baud);
int (*power_state)(struct uart_port *uport, bool state);
};
@@ -159,7 +158,6 @@ struct qcom_geni_serial_port {
struct irq_work tx_kick;
struct qcom_geni_private_data private_data;
const struct qcom_geni_device_data *dev_data;
- struct dev_pm_domain_list *pd_list;
struct notifier_block panic_nb;
};
@@ -1500,7 +1498,7 @@ static int geni_serial_set_rate(struct uart_port *uport, unsigned int baud)
static int geni_serial_set_level(struct uart_port *uport, unsigned int baud)
{
struct qcom_geni_serial_port *port = to_dev_port(uport);
- struct device *perf_dev = port->pd_list->pd_devs[DOMAIN_IDX_PERF];
+ struct device *perf_dev = port->se.pd_list->pd_devs[DOMAIN_IDX_PERF];
/*
* The performance protocol sets UART communication
@@ -1860,57 +1858,6 @@ static int geni_serial_resource_state(struct uart_port *uport, bool power_on)
return power_on ? geni_serial_resources_on(uport) : geni_serial_resources_off(uport);
}
-static int geni_serial_pwr_init(struct uart_port *uport)
-{
- struct qcom_geni_serial_port *port = to_dev_port(uport);
- int ret;
-
- ret = dev_pm_domain_attach_list(port->se.dev,
- &port->dev_data->pd_data, &port->pd_list);
- if (ret <= 0)
- return -EINVAL;
-
- return 0;
-}
-
-static int geni_serial_resource_init(struct uart_port *uport)
-{
- struct qcom_geni_serial_port *port = to_dev_port(uport);
- int ret;
-
- port->se.clk = devm_clk_get(port->se.dev, "se");
- if (IS_ERR(port->se.clk)) {
- ret = PTR_ERR(port->se.clk);
- dev_err(port->se.dev, "Err getting SE Core clk %d\n", ret);
- return ret;
- }
-
- ret = geni_icc_get(&port->se, NULL);
- if (ret)
- return ret;
-
- port->se.icc_paths[GENI_TO_CORE].avg_bw = GENI_DEFAULT_BW;
- port->se.icc_paths[CPU_TO_GENI].avg_bw = GENI_DEFAULT_BW;
-
- /* Set BW for register access */
- ret = geni_icc_set_bw(&port->se);
- if (ret)
- return ret;
-
- ret = devm_pm_opp_set_clkname(port->se.dev, "se");
- if (ret)
- return ret;
-
- /* OPP table is optional */
- ret = devm_pm_opp_of_add_table(port->se.dev);
- if (ret && ret != -ENODEV) {
- dev_err(port->se.dev, "invalid OPP table in device tree\n");
- return ret;
- }
-
- return 0;
-}
-
/**
* qcom_geni_rs485_config - Configure RS485 settings for the UART port
* @uport: Pointer to the UART port structure
@@ -2024,7 +1971,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
port->se.dev = &pdev->dev;
port->se.wrapper = dev_get_drvdata(pdev->dev.parent);
- ret = port->dev_data->resources_init(uport);
+ ret = port->dev_data->resources_init(&port->se);
if (ret)
return ret;
@@ -2137,7 +2084,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
DMA_RX_BUF_SIZE, DMA_FROM_DEVICE);
port->rx_dma_addr = 0;
}
- dev_pm_domain_detach_list(port->pd_list);
+ dev_pm_domain_detach_list(port->se.pd_list);
return ret;
}
@@ -2162,7 +2109,7 @@ static void qcom_geni_serial_remove(struct platform_device *pdev)
port->rx_dma_addr = 0;
}
- dev_pm_domain_detach_list(port->pd_list);
+ dev_pm_domain_detach_list(port->se.pd_list);
}
static int __maybe_unused qcom_geni_serial_runtime_suspend(struct device *dev)
@@ -2242,7 +2189,7 @@ static int qcom_geni_serial_resume(struct device *dev)
static const struct qcom_geni_device_data qcom_geni_console_data = {
.console = true,
.mode = GENI_SE_FIFO,
- .resources_init = geni_serial_resource_init,
+ .resources_init = geni_se_resources_init,
.set_rate = geni_serial_set_rate,
.power_state = geni_serial_resource_state,
};
@@ -2250,12 +2197,7 @@ static const struct qcom_geni_device_data qcom_geni_console_data = {
static const struct qcom_geni_device_data sa8255p_qcom_geni_console_data = {
.console = true,
.mode = GENI_SE_FIFO,
- .pd_data = {
- .pd_flags = PD_FLAG_DEV_LINK_ON,
- .pd_names = (const char*[]) { "power", "perf" },
- .num_pd_names = 2,
- },
- .resources_init = geni_serial_pwr_init,
+ .resources_init = geni_se_domain_attach,
.set_rate = geni_serial_set_level,
};
#endif
@@ -2263,7 +2205,7 @@ static const struct qcom_geni_device_data sa8255p_qcom_geni_console_data = {
static const struct qcom_geni_device_data qcom_geni_uart_data = {
.console = false,
.mode = GENI_SE_DMA,
- .resources_init = geni_serial_resource_init,
+ .resources_init = geni_se_resources_init,
.set_rate = geni_serial_set_rate,
.power_state = geni_serial_resource_state,
};
@@ -2271,12 +2213,7 @@ static const struct qcom_geni_device_data qcom_geni_uart_data = {
static const struct qcom_geni_device_data sa8255p_qcom_geni_uart_data = {
.console = false,
.mode = GENI_SE_DMA,
- .pd_data = {
- .pd_flags = PD_FLAG_DEV_LINK_ON,
- .pd_names = (const char*[]) { "power", "perf" },
- .num_pd_names = 2,
- },
- .resources_init = geni_serial_pwr_init,
+ .resources_init = geni_se_domain_attach,
.set_rate = geni_serial_set_level,
};
--
2.34.1
next prev parent reply other threads:[~2026-08-01 5:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-01 5:48 [PATCH v2 0/3] serial: qcom-geni: Reuse common GENI framework helpers Praveen Talari
2026-08-01 5:48 ` Praveen Talari [this message]
2026-08-01 5:48 ` [PATCH v2 2/3] serial: qcom-geni: Use resources helper APIs in runtime PM functions Praveen Talari
2026-08-01 5:48 ` [PATCH v2 3/3] serial: qcom-geni: Use geni_se_set_perf_level() for baud rate perf level Praveen Talari
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=20260801-reuse_common_geni_framework_helpers-v2-1-13753256ef71@oss.qualcomm.com \
--to=praveen.talari@oss.qualcomm.com \
--cc=bjorn.andersson@oss.qualcomm.com \
--cc=chandana.chiluveru@oss.qualcomm.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=konrad.dybcio@oss.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@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