* [PATCH v1 0/9] Enable QUPs and Serial on SA8255p Qualcomm platforms
@ 2025-04-10 17:40 Praveen Talari
2025-04-10 17:40 ` [PATCH v1 1/9] opp: add new helper API dev_pm_opp_set_level() Praveen Talari
` (8 more replies)
0 siblings, 9 replies; 24+ messages in thread
From: Praveen Talari @ 2025-04-10 17:40 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Bjorn Andersson, Konrad Dybcio, Viresh Kumar,
Nishanth Menon, Stephen Boyd, Rafael J. Wysocki, Praveen Talari,
linux-arm-msm, linux-kernel, linux-serial, devicetree, linux-pm
Cc: psodagud, djaggi, quic_msavaliy, quic_vtanuku, quic_arandive,
quic_mnaresh, quic_shazhuss
The Qualcomm automotive SA8255p SoC relies on firmware to configure
platform resources, including clocks, interconnects and TLMM. The device
drivers request resources operations over SCMI using power and
performance protocols.
The SCMI power protocol enables or disables resources like clocks,
interconnect paths, and TLMM (GPIOs) using runtime PM framework APIs,
such as resume/suspend, to control power states(on/off).
The SCMI performance protocol manages UART baud rates, with each baud
rate represented by a performance level. Drivers use the
dev_pm_opp_set_level() API to request the desired baud rate by
specifying the performance level.
The QUP drivers are SCMI clients, with clocks, interconnects, pinctrl
and power-domains abstracted by a SCMI server.
Nikunj Kela (3):
opp: add new helper API dev_pm_opp_set_level()
dt-bindings: serial: describe SA8255p
dt-bindings: qcom: geni-se: describe SA8255p
Praveen Talari (6):
soc: qcom: geni-se: Enable QUPs on SA8255p Qualcomm platforms
serial: qcom-geni: move resource initialization to separate functions
serial: qcom-geni: move resource control logic to separate functions
serial: qcom-geni: move clock-rate logic to separate function
serial: qcom-geni: Enable PM runtime for serial driver
serial: qcom-geni: Enable Serial on SA8255p Qualcomm platforms
.../serial/qcom,sa8255p-geni-uart.yaml | 59 +++
.../soc/qcom/qcom,sa8255p-geni-se-qup.yaml | 100 +++++
drivers/opp/core.c | 22 ++
drivers/soc/qcom/qcom-geni-se.c | 78 ++--
drivers/tty/serial/qcom_geni_serial.c | 345 ++++++++++++++----
include/linux/pm_opp.h | 6 +
6 files changed, 512 insertions(+), 98 deletions(-)
create mode 100644 Documentation/devicetree/bindings/serial/qcom,sa8255p-geni-uart.yaml
create mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,sa8255p-geni-se-qup.yaml
--
2.17.1
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v1 1/9] opp: add new helper API dev_pm_opp_set_level()
2025-04-10 17:40 [PATCH v1 0/9] Enable QUPs and Serial on SA8255p Qualcomm platforms Praveen Talari
@ 2025-04-10 17:40 ` Praveen Talari
2025-04-10 17:40 ` [PATCH v1 2/9] dt-bindings: serial: describe SA8255p Praveen Talari
` (7 subsequent siblings)
8 siblings, 0 replies; 24+ messages in thread
From: Praveen Talari @ 2025-04-10 17:40 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Bjorn Andersson, Konrad Dybcio, Viresh Kumar,
Nishanth Menon, Stephen Boyd, Rafael J. Wysocki, Praveen Talari,
linux-arm-msm, linux-kernel, linux-serial, devicetree, linux-pm
Cc: psodagud, djaggi, quic_msavaliy, quic_vtanuku, quic_arandive,
quic_mnaresh, quic_shazhuss, Nikunj Kela
From: Nikunj Kela <quic_nkela@quicinc.com>
To configure a device to a specific performance level, consumer drivers
currently need to determine the OPP based on the exact level and then
set it, resulting in code duplication across drivers.
The new helper API, dev_pm_opp_set_level(), addresses this issue by
providing a streamlined method for consumer drivers to find and set the
OPP based on the desired performance level, thereby eliminating
redundancy.
Co-developed-by: Praveen Talari <quic_ptalari@quicinc.com>
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
Signed-off-by: Nikunj Kela <quic_nkela@quicinc.com>
---
drivers/opp/core.c | 22 ++++++++++++++++++++++
include/linux/pm_opp.h | 6 ++++++
2 files changed, 28 insertions(+)
diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index 73e9a3b2f29b..a9bca9502f71 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -3151,3 +3151,25 @@ void dev_pm_opp_remove_table(struct device *dev)
dev_pm_opp_put_opp_table(opp_table);
}
EXPORT_SYMBOL_GPL(dev_pm_opp_remove_table);
+
+/*
+ * dev_pm_opp_set_level() - Configure device for a level
+ * @dev: device for which we do this operation
+ * @level: level to set to
+ *
+ * Return: 0 on success, a negative error number otherwise.
+ */
+int dev_pm_opp_set_level(struct device *dev, unsigned int level)
+{
+ struct dev_pm_opp *opp = dev_pm_opp_find_level_exact(dev, level);
+ int ret;
+
+ if (IS_ERR(opp))
+ return -EINVAL;
+
+ ret = dev_pm_opp_set_opp(dev, opp);
+ dev_pm_opp_put(opp);
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(dev_pm_opp_set_level);
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
index c247317aae38..c17271947f83 100644
--- a/include/linux/pm_opp.h
+++ b/include/linux/pm_opp.h
@@ -196,6 +196,7 @@ int dev_pm_opp_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask)
void dev_pm_opp_remove_table(struct device *dev);
void dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask);
int dev_pm_opp_sync_regulators(struct device *dev);
+int dev_pm_opp_set_level(struct device *dev, unsigned int level);
#else
static inline struct opp_table *dev_pm_opp_get_opp_table(struct device *dev)
{
@@ -454,6 +455,11 @@ static inline int dev_pm_opp_sync_regulators(struct device *dev)
return -EOPNOTSUPP;
}
+static inline int dev_pm_opp_set_level(struct device *dev, unsigned int level)
+{
+ return -EOPNOTSUPP;
+}
+
#endif /* CONFIG_PM_OPP */
#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP)
--
2.17.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v1 2/9] dt-bindings: serial: describe SA8255p
2025-04-10 17:40 [PATCH v1 0/9] Enable QUPs and Serial on SA8255p Qualcomm platforms Praveen Talari
2025-04-10 17:40 ` [PATCH v1 1/9] opp: add new helper API dev_pm_opp_set_level() Praveen Talari
@ 2025-04-10 17:40 ` Praveen Talari
2025-04-11 17:57 ` Rob Herring
2025-04-10 17:40 ` [PATCH v1 3/9] dt-bindings: qcom: geni-se: " Praveen Talari
` (6 subsequent siblings)
8 siblings, 1 reply; 24+ messages in thread
From: Praveen Talari @ 2025-04-10 17:40 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Bjorn Andersson, Konrad Dybcio, Viresh Kumar,
Nishanth Menon, Stephen Boyd, Rafael J. Wysocki, Praveen Talari,
linux-arm-msm, linux-kernel, linux-serial, devicetree, linux-pm
Cc: psodagud, djaggi, quic_msavaliy, quic_vtanuku, quic_arandive,
quic_mnaresh, quic_shazhuss, Nikunj Kela
From: Nikunj Kela <quic_nkela@quicinc.com>
SA8255p platform abstracts resources such as clocks, interconnect and
GPIO pins configuration in Firmware. SCMI power and perf protocols are
used to send request for resource configurations.
Add DT bindings for the QUP GENI UART controller on sa8255p platform.
Co-developed-by: Praveen Talari <quic_ptalari@quicinc.com>
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
Signed-off-by: Nikunj Kela <quic_nkela@quicinc.com>
---
.../serial/qcom,sa8255p-geni-uart.yaml | 59 +++++++++++++++++++
1 file changed, 59 insertions(+)
create mode 100644 Documentation/devicetree/bindings/serial/qcom,sa8255p-geni-uart.yaml
diff --git a/Documentation/devicetree/bindings/serial/qcom,sa8255p-geni-uart.yaml b/Documentation/devicetree/bindings/serial/qcom,sa8255p-geni-uart.yaml
new file mode 100644
index 000000000000..0dbfbfa1d504
--- /dev/null
+++ b/Documentation/devicetree/bindings/serial/qcom,sa8255p-geni-uart.yaml
@@ -0,0 +1,59 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/serial/qcom,sa8255p-geni-uart.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Geni based QUP UART interface
+
+maintainers:
+ - Praveen Talari <quic_ptalari@quicinc.com>
+
+allOf:
+ - $ref: /schemas/serial/serial.yaml#
+
+properties:
+ compatible:
+ enum:
+ - qcom,sa8255p-geni-uart
+ - qcom,sa8255p-geni-debug-uart
+
+ interrupts:
+ minItems: 1
+ items:
+ - description: UART core irq
+ - description: Wakeup irq (RX GPIO)
+
+ power-domains:
+ minItems: 2
+ maxItems: 2
+
+ power-domain-names:
+ items:
+ - const: power
+ - const: perf
+
+ reg:
+ maxItems: 1
+
+required:
+ - compatible
+ - interrupts
+ - reg
+ - power-domains
+ - power-domain-names
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+ serial@990000 {
+ compatible = "qcom,sa8255p-geni-uart";
+ reg = <0x990000 0x4000>;
+ interrupts = <GIC_SPI 531 IRQ_TYPE_LEVEL_HIGH>;
+ power-domains = <&scmi0_pd 0>, <&scmi0_dvfs 0>;
+ power-domain-names = "power", "perf";
+ };
+...
--
2.17.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v1 3/9] dt-bindings: qcom: geni-se: describe SA8255p
2025-04-10 17:40 [PATCH v1 0/9] Enable QUPs and Serial on SA8255p Qualcomm platforms Praveen Talari
2025-04-10 17:40 ` [PATCH v1 1/9] opp: add new helper API dev_pm_opp_set_level() Praveen Talari
2025-04-10 17:40 ` [PATCH v1 2/9] dt-bindings: serial: describe SA8255p Praveen Talari
@ 2025-04-10 17:40 ` Praveen Talari
2025-04-10 18:34 ` Rob Herring (Arm)
2025-04-10 17:40 ` [PATCH v1 4/9] soc: qcom: geni-se: Enable QUPs on SA8255p Qualcomm platforms Praveen Talari
` (5 subsequent siblings)
8 siblings, 1 reply; 24+ messages in thread
From: Praveen Talari @ 2025-04-10 17:40 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Bjorn Andersson, Konrad Dybcio, Viresh Kumar,
Nishanth Menon, Stephen Boyd, Rafael J. Wysocki, Praveen Talari,
linux-arm-msm, linux-kernel, linux-serial, devicetree, linux-pm
Cc: psodagud, djaggi, quic_msavaliy, quic_vtanuku, quic_arandive,
quic_mnaresh, quic_shazhuss, Nikunj Kela
From: Nikunj Kela <quic_nkela@quicinc.com>
SA8255p platform abstracts resources such as clocks, interconnect
configuration in Firmware.
Add DT bindings for the QUP Wrapper on sa8255p platform.
Co-developed-by: Praveen Talari <quic_ptalari@quicinc.com>
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
Signed-off-by: Nikunj Kela <quic_nkela@quicinc.com>
---
.../soc/qcom/qcom,sa8255p-geni-se-qup.yaml | 100 ++++++++++++++++++
1 file changed, 100 insertions(+)
create mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,sa8255p-geni-se-qup.yaml
diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,sa8255p-geni-se-qup.yaml b/Documentation/devicetree/bindings/soc/qcom/qcom,sa8255p-geni-se-qup.yaml
new file mode 100644
index 000000000000..cdc2e032f570
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/qcom/qcom,sa8255p-geni-se-qup.yaml
@@ -0,0 +1,100 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/qcom/qcom,sa8255p-geni-se-qup.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: GENI Serial Engine QUP Wrapper Controller
+
+maintainers:
+ - Praveen Talari <quic_ptalari@quicinc.com>
+
+description:
+ Generic Interface (GENI) based Qualcomm Universal Peripheral (QUP) wrapper
+ is a programmable module for supporting a wide range of serial interfaces
+ like UART, SPI, I2C, I3C, etc. A single QUP module can provide up to 8 Serial
+ Interfaces, using its internal Serial Engines. The GENI Serial Engine QUP
+ Wrapper controller is modeled as a node with zero or more child nodes each
+ representing a serial engine.
+
+properties:
+ compatible:
+ const: qcom,sa8255p-geni-se-qup
+
+ reg:
+ description: QUP wrapper common register address and length.
+ maxItems: 1
+
+ "#address-cells":
+ const: 2
+
+ "#size-cells":
+ const: 2
+
+ ranges: true
+
+ iommus:
+ maxItems: 1
+
+ dma-coherent: true
+
+required:
+ - compatible
+ - reg
+ - "#address-cells"
+ - "#size-cells"
+ - ranges
+
+patternProperties:
+ "spi@[0-9a-f]+$":
+ type: object
+ description: GENI serial engine based SPI controller. SPI in master mode
+ supports up to 50MHz, up to four chip selects, programmable
+ data path from 4 bits to 32 bits and numerous protocol
+ variants.
+ additionalProperties: true
+
+ properties:
+ compatible:
+ const: qcom,sa8255p-geni-spi
+
+ "i2c@[0-9a-f]+$":
+ type: object
+ description: GENI serial engine based I2C controller.
+ additionalProperties: true
+
+ properties:
+ compatible:
+ const: qcom,sa8255p-geni-i2c
+
+ "serial@[0-9a-f]+$":
+ type: object
+ description: GENI Serial Engine based UART Controller.
+ additionalProperties: true
+
+ properties:
+ compatible:
+ const: qcom,sa8255p-geni-uart
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+ geniqup@9c0000 {
+ compatible = "qcom,sa8255p-geni-se-qup";
+ reg = <0 0x9c0000 0 0x6000>;
+ #address-cells = <2>;
+ #size-cells = <2>;
+ ranges;
+
+ serial@990000 {
+ compatible = "qcom,sa8255p-geni-uart";
+ reg = <0 0x990000 0 0x4000>;
+ interrupts = <GIC_SPI 531 IRQ_TYPE_LEVEL_HIGH>;
+ power-domains = <&scmi0_pd 0>, <&scmi0_dvfs 0>;
+ power-domain-names = "power", "perf";
+ };
+ };
+...
--
2.17.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v1 4/9] soc: qcom: geni-se: Enable QUPs on SA8255p Qualcomm platforms
2025-04-10 17:40 [PATCH v1 0/9] Enable QUPs and Serial on SA8255p Qualcomm platforms Praveen Talari
` (2 preceding siblings ...)
2025-04-10 17:40 ` [PATCH v1 3/9] dt-bindings: qcom: geni-se: " Praveen Talari
@ 2025-04-10 17:40 ` Praveen Talari
2025-04-11 18:40 ` kernel test robot
` (2 more replies)
2025-04-10 17:40 ` [PATCH v1 5/9] serial: qcom-geni: move resource initialization to separate functions Praveen Talari
` (4 subsequent siblings)
8 siblings, 3 replies; 24+ messages in thread
From: Praveen Talari @ 2025-04-10 17:40 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Bjorn Andersson, Konrad Dybcio, Viresh Kumar,
Nishanth Menon, Stephen Boyd, Rafael J. Wysocki, Praveen Talari,
linux-arm-msm, linux-kernel, linux-serial, devicetree, linux-pm
Cc: psodagud, djaggi, quic_msavaliy, quic_vtanuku, quic_arandive,
quic_mnaresh, quic_shazhuss
On the sa8255p platform, resources such as clocks,interconnects
and TLMM (GPIO) configurations are managed by firmware.
Introduce a platform data function callback to distinguish whether
resource control is performed by firmware or directly by the driver
in linux.
The refactor ensures clear differentiation of resource
management mechanisms, improving maintainability and flexibility
in handling platform-specific configurations.
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
---
drivers/soc/qcom/qcom-geni-se.c | 78 +++++++++++++++++++++------------
1 file changed, 50 insertions(+), 28 deletions(-)
diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c
index 4cb959106efa..5e2add1e04d3 100644
--- a/drivers/soc/qcom/qcom-geni-se.c
+++ b/drivers/soc/qcom/qcom-geni-se.c
@@ -105,6 +105,8 @@ struct geni_wrapper {
struct geni_se_desc {
unsigned int num_clks;
const char * const *clks;
+ int (*geni_se_rsc_init)(struct geni_wrapper *wrapper,
+ const struct geni_se_desc *desc);
};
static const char * const icc_path_names[] = {"qup-core", "qup-config",
@@ -891,10 +893,44 @@ int geni_icc_disable(struct geni_se *se)
}
EXPORT_SYMBOL_GPL(geni_icc_disable);
+static int geni_se_resource_init(struct geni_wrapper *wrapper,
+ const struct geni_se_desc *desc)
+{
+ struct device *dev = wrapper->dev;
+ int ret;
+ int i;
+
+ wrapper->num_clks = min_t(unsigned int, desc->num_clks, MAX_CLKS);
+
+ for (i = 0; i < wrapper->num_clks; ++i)
+ wrapper->clks[i].id = desc->clks[i];
+
+ ret = of_count_phandle_with_args(dev->of_node, "clocks", "#clock-cells");
+ if (ret < 0) {
+ dev_err(dev, "invalid clocks property at %pOF\n", dev->of_node);
+ return ret;
+ }
+
+ if (ret < wrapper->num_clks) {
+ dev_err(dev, "invalid clocks count at %pOF, expected %d entries\n",
+ dev->of_node, wrapper->num_clks);
+ return -EINVAL;
+ }
+
+ ret = devm_clk_bulk_get(dev, wrapper->num_clks, wrapper->clks);
+ if (ret) {
+ dev_err(dev, "Err getting clks %d\n", ret);
+ return ret;
+ }
+
+ return ret;
+}
+
static int geni_se_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct geni_wrapper *wrapper;
+ const struct geni_se_desc *desc;
int ret;
wrapper = devm_kzalloc(dev, sizeof(*wrapper), GFP_KERNEL);
@@ -906,38 +942,15 @@ static int geni_se_probe(struct platform_device *pdev)
if (IS_ERR(wrapper->base))
return PTR_ERR(wrapper->base);
- if (!has_acpi_companion(&pdev->dev)) {
- const struct geni_se_desc *desc;
- int i;
-
- desc = device_get_match_data(&pdev->dev);
- if (!desc)
- return -EINVAL;
-
- wrapper->num_clks = min_t(unsigned int, desc->num_clks, MAX_CLKS);
-
- for (i = 0; i < wrapper->num_clks; ++i)
- wrapper->clks[i].id = desc->clks[i];
-
- ret = of_count_phandle_with_args(dev->of_node, "clocks", "#clock-cells");
- if (ret < 0) {
- dev_err(dev, "invalid clocks property at %pOF\n", dev->of_node);
- return ret;
- }
+ desc = device_get_match_data(&pdev->dev);
- if (ret < wrapper->num_clks) {
- dev_err(dev, "invalid clocks count at %pOF, expected %d entries\n",
- dev->of_node, wrapper->num_clks);
+ if (!has_acpi_companion(&pdev->dev) && desc->geni_se_rsc_init) {
+ ret = desc->geni_se_rsc_init(wrapper, desc);
+ if (ret)
return -EINVAL;
- }
-
- ret = devm_clk_bulk_get(dev, wrapper->num_clks, wrapper->clks);
- if (ret) {
- dev_err(dev, "Err getting clks %d\n", ret);
- return ret;
- }
}
+out:
dev_set_drvdata(dev, wrapper);
dev_dbg(dev, "GENI SE Driver probed\n");
return devm_of_platform_populate(dev);
@@ -951,6 +964,13 @@ static const char * const qup_clks[] = {
static const struct geni_se_desc qup_desc = {
.clks = qup_clks,
.num_clks = ARRAY_SIZE(qup_clks),
+ .geni_se_rsc_init = geni_se_resource_init,
+};
+
+static const struct geni_se_desc sa8255p_qup_desc = {
+ .clks = NULL,
+ .num_clks = 0,
+ .geni_se_rsc_init = NULL,
};
static const char * const i2c_master_hub_clks[] = {
@@ -960,11 +980,13 @@ static const char * const i2c_master_hub_clks[] = {
static const struct geni_se_desc i2c_master_hub_desc = {
.clks = i2c_master_hub_clks,
.num_clks = ARRAY_SIZE(i2c_master_hub_clks),
+ .geni_se_rsc_init = geni_se_resource_init,
};
static const struct of_device_id geni_se_dt_match[] = {
{ .compatible = "qcom,geni-se-qup", .data = &qup_desc },
{ .compatible = "qcom,geni-se-i2c-master-hub", .data = &i2c_master_hub_desc },
+ { .compatible = "qcom,sa8255p-geni-se-qup", .data = &sa8255p_qup_desc },
{}
};
MODULE_DEVICE_TABLE(of, geni_se_dt_match);
--
2.17.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v1 5/9] serial: qcom-geni: move resource initialization to separate functions
2025-04-10 17:40 [PATCH v1 0/9] Enable QUPs and Serial on SA8255p Qualcomm platforms Praveen Talari
` (3 preceding siblings ...)
2025-04-10 17:40 ` [PATCH v1 4/9] soc: qcom: geni-se: Enable QUPs on SA8255p Qualcomm platforms Praveen Talari
@ 2025-04-10 17:40 ` Praveen Talari
2025-04-14 7:58 ` Jiri Slaby
2025-04-10 17:40 ` [PATCH v1 6/9] serial: qcom-geni: move resource control logic " Praveen Talari
` (3 subsequent siblings)
8 siblings, 1 reply; 24+ messages in thread
From: Praveen Talari @ 2025-04-10 17:40 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Bjorn Andersson, Konrad Dybcio, Viresh Kumar,
Nishanth Menon, Stephen Boyd, Rafael J. Wysocki, Praveen Talari,
linux-arm-msm, linux-kernel, linux-serial, devicetree, linux-pm
Cc: psodagud, djaggi, quic_msavaliy, quic_vtanuku, quic_arandive,
quic_mnaresh, quic_shazhuss
Enhances code readability and future modifications within the new API.
Move the code that handles the actual initialization of resources
like clock and ICC paths to a separate function, making the
probe function cleaner.
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
---
drivers/tty/serial/qcom_geni_serial.c | 65 ++++++++++++++++-----------
1 file changed, 39 insertions(+), 26 deletions(-)
diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
index a80ce7aaf309..889ce8961e0a 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -1572,6 +1572,42 @@ static struct uart_driver qcom_geni_uart_driver = {
.nr = GENI_UART_PORTS,
};
+static int geni_serial_resource_init(struct qcom_geni_serial_port *port)
+{
+ 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;
+}
static void qcom_geni_serial_pm(struct uart_port *uport,
unsigned int new_state, unsigned int old_state)
{
@@ -1674,12 +1710,10 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
port->dev_data = data;
port->se.dev = &pdev->dev;
port->se.wrapper = dev_get_drvdata(pdev->dev.parent);
- port->se.clk = devm_clk_get(&pdev->dev, "se");
- if (IS_ERR(port->se.clk)) {
- ret = PTR_ERR(port->se.clk);
- dev_err(&pdev->dev, "Err getting SE Core clk %d\n", ret);
+
+ ret = geni_serial_resource_init(port);
+ if (ret)
return ret;
- }
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
@@ -1697,17 +1731,6 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
return -ENOMEM;
}
- 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;
-
port->name = devm_kasprintf(uport->dev, GFP_KERNEL,
"qcom_geni_serial_%s%d",
uart_console(uport) ? "console" : "uart", uport->line);
@@ -1729,16 +1752,6 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
if (of_property_read_bool(pdev->dev.of_node, "cts-rts-swap"))
port->cts_rts_swap = true;
- ret = devm_pm_opp_set_clkname(&pdev->dev, "se");
- if (ret)
- return ret;
- /* OPP table is optional */
- ret = devm_pm_opp_of_add_table(&pdev->dev);
- if (ret && ret != -ENODEV) {
- dev_err(&pdev->dev, "invalid OPP table in device tree\n");
- return ret;
- }
-
port->private_data.drv = drv;
uport->private_data = &port->private_data;
platform_set_drvdata(pdev, port);
--
2.17.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v1 6/9] serial: qcom-geni: move resource control logic to separate functions
2025-04-10 17:40 [PATCH v1 0/9] Enable QUPs and Serial on SA8255p Qualcomm platforms Praveen Talari
` (4 preceding siblings ...)
2025-04-10 17:40 ` [PATCH v1 5/9] serial: qcom-geni: move resource initialization to separate functions Praveen Talari
@ 2025-04-10 17:40 ` Praveen Talari
2025-04-14 7:59 ` Jiri Slaby
2025-04-10 17:40 ` [PATCH v1 7/9] serial: qcom-geni: move clock-rate logic to separate function Praveen Talari
` (2 subsequent siblings)
8 siblings, 1 reply; 24+ messages in thread
From: Praveen Talari @ 2025-04-10 17:40 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Bjorn Andersson, Konrad Dybcio, Viresh Kumar,
Nishanth Menon, Stephen Boyd, Rafael J. Wysocki, Praveen Talari,
linux-arm-msm, linux-kernel, linux-serial, devicetree, linux-pm
Cc: psodagud, djaggi, quic_msavaliy, quic_vtanuku, quic_arandive,
quic_mnaresh, quic_shazhuss
Supports use in PM system/runtime frameworks, helping to
distinguish new resource control mechanisms and facilitate
future modifications within the new API.
The code that handles the actual enable or disable of resources
like clock and ICC paths to a separate function
(geni_serial_resources_on() and geni_serial_resources_off()) which
enhances code readability.
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
---
drivers/tty/serial/qcom_geni_serial.c | 53 +++++++++++++++++++++------
1 file changed, 42 insertions(+), 11 deletions(-)
diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
index 889ce8961e0a..e341f5090ecc 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -1572,6 +1572,42 @@ static struct uart_driver qcom_geni_uart_driver = {
.nr = GENI_UART_PORTS,
};
+static int geni_serial_resources_off(struct uart_port *uport)
+{
+ struct qcom_geni_serial_port *port = to_dev_port(uport);
+ int ret;
+
+ dev_pm_opp_set_rate(uport->dev, 0);
+ ret = geni_se_resources_off(&port->se);
+ if (ret)
+ return ret;
+
+ geni_icc_disable(&port->se);
+
+ return ret;
+}
+
+static int geni_serial_resources_on(struct uart_port *uport)
+{
+ struct qcom_geni_serial_port *port = to_dev_port(uport);
+ int ret;
+
+ ret = geni_icc_enable(&port->se);
+ if (ret)
+ return ret;
+
+ ret = geni_se_resources_on(&port->se);
+ if (ret) {
+ geni_icc_disable(&port->se);
+ return ret;
+ }
+
+ if (port->clk_rate)
+ dev_pm_opp_set_rate(uport->dev, port->clk_rate);
+
+ return ret;
+}
+
static int geni_serial_resource_init(struct qcom_geni_serial_port *port)
{
int ret;
@@ -1617,17 +1653,12 @@ static void qcom_geni_serial_pm(struct uart_port *uport,
if (old_state == UART_PM_STATE_UNDEFINED)
old_state = UART_PM_STATE_OFF;
- if (new_state == UART_PM_STATE_ON && old_state == UART_PM_STATE_OFF) {
- geni_icc_enable(&port->se);
- if (port->clk_rate)
- dev_pm_opp_set_rate(uport->dev, port->clk_rate);
- geni_se_resources_on(&port->se);
- } else if (new_state == UART_PM_STATE_OFF &&
- old_state == UART_PM_STATE_ON) {
- geni_se_resources_off(&port->se);
- dev_pm_opp_set_rate(uport->dev, 0);
- geni_icc_disable(&port->se);
- }
+ if (new_state == UART_PM_STATE_ON && old_state == UART_PM_STATE_OFF)
+ geni_serial_resources_on(uport);
+ else if (new_state == UART_PM_STATE_OFF &&
+ old_state == UART_PM_STATE_ON)
+ geni_serial_resources_off(uport);
+
}
static const struct uart_ops qcom_geni_console_pops = {
--
2.17.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v1 7/9] serial: qcom-geni: move clock-rate logic to separate function
2025-04-10 17:40 [PATCH v1 0/9] Enable QUPs and Serial on SA8255p Qualcomm platforms Praveen Talari
` (5 preceding siblings ...)
2025-04-10 17:40 ` [PATCH v1 6/9] serial: qcom-geni: move resource control logic " Praveen Talari
@ 2025-04-10 17:40 ` Praveen Talari
2025-04-11 19:12 ` kernel test robot
2025-04-14 8:01 ` Jiri Slaby
2025-04-10 17:40 ` [PATCH v1 8/9] serial: qcom-geni: Enable PM runtime for serial driver Praveen Talari
2025-04-10 17:40 ` [PATCH v1 9/9] serial: qcom-geni: Enable Serial on SA8255p Qualcomm platforms Praveen Talari
8 siblings, 2 replies; 24+ messages in thread
From: Praveen Talari @ 2025-04-10 17:40 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Bjorn Andersson, Konrad Dybcio, Viresh Kumar,
Nishanth Menon, Stephen Boyd, Rafael J. Wysocki, Praveen Talari,
linux-arm-msm, linux-kernel, linux-serial, devicetree, linux-pm
Cc: psodagud, djaggi, quic_msavaliy, quic_vtanuku, quic_arandive,
quic_mnaresh, quic_shazhuss
Facilitates future modifications within the new function,
leading to better readability and maintainability of the code.
Move the code that handles the actual logic of clock-rate
calculations to a separate function geni_serial_set_rate()
which enhances code readability.
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
---
drivers/tty/serial/qcom_geni_serial.c | 56 +++++++++++++++++----------
1 file changed, 36 insertions(+), 20 deletions(-)
diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
index e341f5090ecc..25d16ac3f406 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -1267,27 +1267,14 @@ static unsigned long get_clk_div_rate(struct clk *clk, unsigned int baud,
return ser_clk;
}
-static void qcom_geni_serial_set_termios(struct uart_port *uport,
- struct ktermios *termios,
- const struct ktermios *old)
+static int geni_serial_set_rate(struct uart_port *uport, unsigned long baud)
{
- unsigned int baud;
- u32 bits_per_char;
- u32 tx_trans_cfg;
- u32 tx_parity_cfg;
- u32 rx_trans_cfg;
- u32 rx_parity_cfg;
- u32 stop_bit_len;
- unsigned int clk_div;
- u32 ser_clk_cfg;
struct qcom_geni_serial_port *port = to_dev_port(uport);
unsigned long clk_rate;
- u32 ver, sampling_rate;
unsigned int avg_bw_core;
- unsigned long timeout;
-
- /* baud rate */
- baud = uart_get_baud_rate(uport, termios, old, 300, 4000000);
+ unsigned int clk_div;
+ u32 ver, sampling_rate;
+ u32 ser_clk_cfg;
sampling_rate = UART_OVERSAMPLING;
/* Sampling rate is halved for IP versions >= 2.5 */
@@ -1301,7 +1288,7 @@ static void qcom_geni_serial_set_termios(struct uart_port *uport,
dev_err(port->se.dev,
"Couldn't find suitable clock rate for %u\n",
baud * sampling_rate);
- return;
+ return -EINVAL;
}
dev_dbg(port->se.dev, "desired_rate = %u, clk_rate = %lu, clk_div = %u\n",
@@ -1323,6 +1310,37 @@ static void qcom_geni_serial_set_termios(struct uart_port *uport,
port->se.icc_paths[CPU_TO_GENI].avg_bw = Bps_to_icc(baud);
geni_icc_set_bw(&port->se);
+ writel(ser_clk_cfg, uport->membase + GENI_SER_M_CLK_CFG);
+ writel(ser_clk_cfg, uport->membase + GENI_SER_S_CLK_CFG);
+ return 0;
+}
+
+static void qcom_geni_serial_set_termios(struct uart_port *uport,
+ struct ktermios *termios,
+ const struct ktermios *old)
+{
+ struct qcom_geni_serial_port *port = to_dev_port(uport);
+ unsigned int baud;
+ unsigned long timeout;
+ u32 bits_per_char;
+ u32 tx_trans_cfg;
+ u32 tx_parity_cfg;
+ u32 rx_trans_cfg;
+ u32 rx_parity_cfg;
+ u32 stop_bit_len;
+ int ret = 0;
+
+ /* baud rate */
+ baud = uart_get_baud_rate(uport, termios, old, 300, 4000000);
+
+ ret = geni_serial_set_rate(uport, baud);
+ if (ret) {
+ dev_err(port->se.dev,
+ "%s: Failed to set baud: %u ret: %d\n",
+ __func__, baud, ret);
+ return;
+ }
+
/* parity */
tx_trans_cfg = readl(uport->membase + SE_UART_TX_TRANS_CFG);
tx_parity_cfg = readl(uport->membase + SE_UART_TX_PARITY_CFG);
@@ -1390,8 +1408,6 @@ static void qcom_geni_serial_set_termios(struct uart_port *uport,
writel(bits_per_char, uport->membase + SE_UART_TX_WORD_LEN);
writel(bits_per_char, uport->membase + SE_UART_RX_WORD_LEN);
writel(stop_bit_len, uport->membase + SE_UART_TX_STOP_BIT_LEN);
- writel(ser_clk_cfg, uport->membase + GENI_SER_M_CLK_CFG);
- writel(ser_clk_cfg, uport->membase + GENI_SER_S_CLK_CFG);
}
#ifdef CONFIG_SERIAL_QCOM_GENI_CONSOLE
--
2.17.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v1 8/9] serial: qcom-geni: Enable PM runtime for serial driver
2025-04-10 17:40 [PATCH v1 0/9] Enable QUPs and Serial on SA8255p Qualcomm platforms Praveen Talari
` (6 preceding siblings ...)
2025-04-10 17:40 ` [PATCH v1 7/9] serial: qcom-geni: move clock-rate logic to separate function Praveen Talari
@ 2025-04-10 17:40 ` Praveen Talari
2025-04-10 17:40 ` [PATCH v1 9/9] serial: qcom-geni: Enable Serial on SA8255p Qualcomm platforms Praveen Talari
8 siblings, 0 replies; 24+ messages in thread
From: Praveen Talari @ 2025-04-10 17:40 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Bjorn Andersson, Konrad Dybcio, Viresh Kumar,
Nishanth Menon, Stephen Boyd, Rafael J. Wysocki, Praveen Talari,
linux-arm-msm, linux-kernel, linux-serial, devicetree, linux-pm
Cc: psodagud, djaggi, quic_msavaliy, quic_vtanuku, quic_arandive,
quic_mnaresh, quic_shazhuss
Add Power Management (PM) runtime support to Qualcomm GENI
serial driver.
Introduce necessary callbacks and updates to ensure seamless
transitions between power states, enhancing overall power efficiency.
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
---
drivers/tty/serial/qcom_geni_serial.c | 35 ++++++++++++++++++++++-----
1 file changed, 29 insertions(+), 6 deletions(-)
diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
index 25d16ac3f406..9649297d4a9e 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -1663,17 +1663,15 @@ static int geni_serial_resource_init(struct qcom_geni_serial_port *port)
static void qcom_geni_serial_pm(struct uart_port *uport,
unsigned int new_state, unsigned int old_state)
{
- struct qcom_geni_serial_port *port = to_dev_port(uport);
-
/* If we've never been called, treat it as off */
if (old_state == UART_PM_STATE_UNDEFINED)
old_state = UART_PM_STATE_OFF;
if (new_state == UART_PM_STATE_ON && old_state == UART_PM_STATE_OFF)
- geni_serial_resources_on(uport);
+ pm_runtime_resume_and_get(uport->dev);
else if (new_state == UART_PM_STATE_OFF &&
old_state == UART_PM_STATE_ON)
- geni_serial_resources_off(uport);
+ pm_runtime_put_sync(uport->dev);
}
@@ -1811,9 +1809,11 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
return ret;
}
+ pm_runtime_enable(port->se.dev);
+
ret = uart_add_one_port(drv, uport);
if (ret)
- return ret;
+ goto error;
if (port->wakeup_irq > 0) {
device_init_wakeup(&pdev->dev, true);
@@ -1822,11 +1822,15 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
if (ret) {
device_init_wakeup(&pdev->dev, false);
uart_remove_one_port(drv, uport);
- return ret;
+ goto error;
}
}
return 0;
+
+error:
+ pm_runtime_disable(port->se.dev);
+ return ret;
}
static void qcom_geni_serial_remove(struct platform_device *pdev)
@@ -1836,9 +1840,26 @@ static void qcom_geni_serial_remove(struct platform_device *pdev)
dev_pm_clear_wake_irq(&pdev->dev);
device_init_wakeup(&pdev->dev, false);
+ pm_runtime_disable(port->se.dev);
uart_remove_one_port(drv, &port->uport);
}
+static int qcom_geni_serial_runtime_suspend(struct device *dev)
+{
+ struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
+ struct uart_port *uport = &port->uport;
+
+ return geni_serial_resources_off(uport);
+};
+
+static int qcom_geni_serial_runtime_resume(struct device *dev)
+{
+ struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
+ struct uart_port *uport = &port->uport;
+
+ return geni_serial_resources_on(uport);
+};
+
static int qcom_geni_serial_suspend(struct device *dev)
{
struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
@@ -1882,6 +1903,8 @@ static const struct qcom_geni_device_data qcom_geni_uart_data = {
};
static const struct dev_pm_ops qcom_geni_serial_pm_ops = {
+ SET_RUNTIME_PM_OPS(qcom_geni_serial_runtime_suspend,
+ qcom_geni_serial_runtime_resume, NULL)
SYSTEM_SLEEP_PM_OPS(qcom_geni_serial_suspend, qcom_geni_serial_resume)
};
--
2.17.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v1 9/9] serial: qcom-geni: Enable Serial on SA8255p Qualcomm platforms
2025-04-10 17:40 [PATCH v1 0/9] Enable QUPs and Serial on SA8255p Qualcomm platforms Praveen Talari
` (7 preceding siblings ...)
2025-04-10 17:40 ` [PATCH v1 8/9] serial: qcom-geni: Enable PM runtime for serial driver Praveen Talari
@ 2025-04-10 17:40 ` Praveen Talari
2025-04-14 8:09 ` Jiri Slaby
8 siblings, 1 reply; 24+ messages in thread
From: Praveen Talari @ 2025-04-10 17:40 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Bjorn Andersson, Konrad Dybcio, Viresh Kumar,
Nishanth Menon, Stephen Boyd, Rafael J. Wysocki, Praveen Talari,
linux-arm-msm, linux-kernel, linux-serial, devicetree, linux-pm
Cc: psodagud, djaggi, quic_msavaliy, quic_vtanuku, quic_arandive,
quic_mnaresh, quic_shazhuss
The Qualcomm automotive SA8255p SoC relies on firmware to configure
platform resources, including clocks, interconnects and TLMM.
The driver requests resources operations over SCMI using power
and performance protocols.
The SCMI power protocol enables or disables resources like clocks,
interconnect paths, and TLMM (GPIOs) using runtime PM framework APIs,
such as resume/suspend, to control power states(on/off).
The SCMI performance protocol manages UART baud rates, with each baud
rate represented by a performance level. The driver uses the
dev_pm_opp_set_level() API to request the desired baud rate by
specifying the performance level.
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
---
drivers/tty/serial/qcom_geni_serial.c | 150 +++++++++++++++++++++++---
1 file changed, 136 insertions(+), 14 deletions(-)
diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
index 9649297d4a9e..40b71d4b7590 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -11,6 +11,7 @@
#include <linux/irq.h>
#include <linux/module.h>
#include <linux/of.h>
+#include <linux/pm_domain.h>
#include <linux/pm_opp.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
@@ -98,9 +99,16 @@
#define DMA_RX_BUF_SIZE 2048
+#define DOMAIN_IDX_POWER 0
+#define DOMAIN_IDX_PERF 1
+
struct qcom_geni_device_data {
bool console;
enum geni_se_xfer_mode mode;
+ struct dev_pm_domain_attach_data pd_data;
+ int (*geni_serial_pwr_rsc_init)(struct uart_port *uport);
+ int (*geni_serial_set_rate)(struct uart_port *uport, unsigned long clk_freq);
+ int (*geni_serial_switch_power_state)(struct uart_port *uport, bool state);
};
struct qcom_geni_private_data {
@@ -138,6 +146,7 @@ struct qcom_geni_serial_port {
struct qcom_geni_private_data private_data;
const struct qcom_geni_device_data *dev_data;
+ struct dev_pm_domain_list *pd_list;
};
static const struct uart_ops qcom_geni_console_pops;
@@ -1315,6 +1324,42 @@ static int geni_serial_set_rate(struct uart_port *uport, unsigned long baud)
return 0;
}
+static int geni_serial_set_level(struct uart_port *uport, unsigned long baud)
+{
+ struct qcom_geni_serial_port *port = to_dev_port(uport);
+ struct device *perf_dev = port->pd_list->pd_devs[DOMAIN_IDX_PERF];
+
+ /*
+ * The performance protocol sets UART communication
+ * speeds by selecting different performance levels
+ * through the OPP framework.
+ *
+ * Supported perf levels for baudrates in firmware are below
+ * +---------------------+--------------------+
+ * | Perf level value | Baudrate values |
+ * +---------------------+--------------------+
+ * | 300 | 300 |
+ * | 1200 | 1200 |
+ * | 2400 | 2400 |
+ * | 4800 | 4800 |
+ * | 9600 | 9600 |
+ * | 19200 | 19200 |
+ * | 38400 | 38400 |
+ * | 57600 | 57600 |
+ * | 115200 | 115200 |
+ * | 230400 | 230400 |
+ * | 460800 | 460800 |
+ * | 921600 | 921600 |
+ * | 2000000 | 2000000 |
+ * | 3000000 | 3000000 |
+ * | 3200000 | 3200000 |
+ * | 4000000 | 4000000 |
+ * +---------------------+--------------------+
+ */
+
+ return dev_pm_opp_set_level(perf_dev, baud);
+}
+
static void qcom_geni_serial_set_termios(struct uart_port *uport,
struct ktermios *termios,
const struct ktermios *old)
@@ -1333,7 +1378,7 @@ static void qcom_geni_serial_set_termios(struct uart_port *uport,
/* baud rate */
baud = uart_get_baud_rate(uport, termios, old, 300, 4000000);
- ret = geni_serial_set_rate(uport, baud);
+ ret = port->dev_data->geni_serial_set_rate(uport, baud);
if (ret) {
dev_err(port->se.dev,
"%s: Failed to set baud: %u ret: %d\n",
@@ -1624,8 +1669,27 @@ static int geni_serial_resources_on(struct uart_port *uport)
return ret;
}
-static int geni_serial_resource_init(struct qcom_geni_serial_port *port)
+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");
@@ -1756,13 +1820,16 @@ 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 = geni_serial_resource_init(port);
+ ret = port->dev_data->geni_serial_pwr_rsc_init(uport);
if (ret)
return ret;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -EINVAL;
+ if (!res) {
+ ret = -EINVAL;
+ goto error;
+ }
+
uport->mapbase = res->start;
port->tx_fifo_depth = DEF_FIFO_DEPTH_WORDS;
@@ -1772,19 +1839,26 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
if (!data->console) {
port->rx_buf = devm_kzalloc(uport->dev,
DMA_RX_BUF_SIZE, GFP_KERNEL);
- if (!port->rx_buf)
- return -ENOMEM;
+ if (!port->rx_buf) {
+ ret = -ENOMEM;
+ goto error;
+ }
}
port->name = devm_kasprintf(uport->dev, GFP_KERNEL,
"qcom_geni_serial_%s%d",
uart_console(uport) ? "console" : "uart", uport->line);
- if (!port->name)
- return -ENOMEM;
+ if (!port->name) {
+ ret = -ENOMEM;
+ goto error;
+ }
irq = platform_get_irq(pdev, 0);
- if (irq < 0)
- return irq;
+ if (irq < 0) {
+ ret = irq;
+ goto error;
+ }
+
uport->irq = irq;
uport->has_sysrq = IS_ENABLED(CONFIG_SERIAL_QCOM_GENI_CONSOLE);
@@ -1806,7 +1880,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
IRQF_TRIGGER_HIGH, port->name, uport);
if (ret) {
dev_err(uport->dev, "Failed to get IRQ ret %d\n", ret);
- return ret;
+ goto error;
}
pm_runtime_enable(port->se.dev);
@@ -1830,6 +1904,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
error:
pm_runtime_disable(port->se.dev);
+ dev_pm_domain_detach_list(port->pd_list);
return ret;
}
@@ -1842,22 +1917,31 @@ static void qcom_geni_serial_remove(struct platform_device *pdev)
device_init_wakeup(&pdev->dev, false);
pm_runtime_disable(port->se.dev);
uart_remove_one_port(drv, &port->uport);
+ dev_pm_domain_detach_list(port->pd_list);
}
static int qcom_geni_serial_runtime_suspend(struct device *dev)
{
struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
struct uart_port *uport = &port->uport;
+ int ret = 0;
- return geni_serial_resources_off(uport);
+ if (port->dev_data->geni_serial_switch_power_state)
+ ret = port->dev_data->geni_serial_switch_power_state(uport, false);
+
+ return ret;
};
static int qcom_geni_serial_runtime_resume(struct device *dev)
{
struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
struct uart_port *uport = &port->uport;
+ int ret = 0;
+
+ if (port->dev_data->geni_serial_switch_power_state)
+ ret = port->dev_data->geni_serial_switch_power_state(uport, true);
- return geni_serial_resources_on(uport);
+ return ret;
};
static int qcom_geni_serial_suspend(struct device *dev)
@@ -1895,11 +1979,41 @@ 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,
+ .geni_serial_pwr_rsc_init = geni_serial_resource_init,
+ .geni_serial_set_rate = geni_serial_set_rate,
+ .geni_serial_switch_power_state = geni_serial_resource_state,
};
static const struct qcom_geni_device_data qcom_geni_uart_data = {
.console = false,
.mode = GENI_SE_DMA,
+ .geni_serial_pwr_rsc_init = geni_serial_resource_init,
+ .geni_serial_set_rate = geni_serial_set_rate,
+ .geni_serial_switch_power_state = geni_serial_resource_state,
+};
+
+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,
+ },
+ .geni_serial_pwr_rsc_init = geni_serial_pwr_init,
+ .geni_serial_set_rate = geni_serial_set_level,
+};
+
+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,
+ },
+ .geni_serial_pwr_rsc_init = geni_serial_pwr_init,
+ .geni_serial_set_rate = geni_serial_set_level,
};
static const struct dev_pm_ops qcom_geni_serial_pm_ops = {
@@ -1913,10 +2027,18 @@ static const struct of_device_id qcom_geni_serial_match_table[] = {
.compatible = "qcom,geni-debug-uart",
.data = &qcom_geni_console_data,
},
+ {
+ .compatible = "qcom,sa8255p-geni-debug-uart",
+ .data = &sa8255p_qcom_geni_console_data,
+ },
{
.compatible = "qcom,geni-uart",
.data = &qcom_geni_uart_data,
},
+ {
+ .compatible = "qcom,sa8255p-geni-uart",
+ .data = &sa8255p_qcom_geni_uart_data,
+ },
{}
};
MODULE_DEVICE_TABLE(of, qcom_geni_serial_match_table);
--
2.17.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH v1 3/9] dt-bindings: qcom: geni-se: describe SA8255p
2025-04-10 17:40 ` [PATCH v1 3/9] dt-bindings: qcom: geni-se: " Praveen Talari
@ 2025-04-10 18:34 ` Rob Herring (Arm)
0 siblings, 0 replies; 24+ messages in thread
From: Rob Herring (Arm) @ 2025-04-10 18:34 UTC (permalink / raw)
To: Praveen Talari
Cc: Bjorn Andersson, linux-arm-msm, Greg Kroah-Hartman, Jiri Slaby,
Rafael J. Wysocki, Nikunj Kela, Conor Dooley, quic_mnaresh,
Nishanth Menon, quic_arandive, linux-pm, quic_msavaliy,
linux-serial, Stephen Boyd, Krzysztof Kozlowski, linux-kernel,
devicetree, psodagud, Konrad Dybcio, quic_vtanuku, quic_shazhuss,
djaggi, Viresh Kumar
On Thu, 10 Apr 2025 23:10:04 +0530, Praveen Talari wrote:
> From: Nikunj Kela <quic_nkela@quicinc.com>
>
> SA8255p platform abstracts resources such as clocks, interconnect
> configuration in Firmware.
>
> Add DT bindings for the QUP Wrapper on sa8255p platform.
>
> Co-developed-by: Praveen Talari <quic_ptalari@quicinc.com>
> Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
> Signed-off-by: Nikunj Kela <quic_nkela@quicinc.com>
> ---
> .../soc/qcom/qcom,sa8255p-geni-se-qup.yaml | 100 ++++++++++++++++++
> 1 file changed, 100 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,sa8255p-geni-se-qup.yaml
>
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
./Documentation/devicetree/bindings/soc/qcom/qcom,sa8255p-geni-se-qup.yaml:13:2: [warning] wrong indentation: expected 2 but found 1 (indentation)
dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/soc/qcom/qcom,sa8255p-geni-se-qup.example.dts:31.13-20: Warning (ranges_format): /example-0/geniqup@9c0000:ranges: empty "ranges" property but its #address-cells (2) differs from /example-0 (1)
Documentation/devicetree/bindings/soc/qcom/qcom,sa8255p-geni-se-qup.example.dts:31.13-20: Warning (ranges_format): /example-0/geniqup@9c0000:ranges: empty "ranges" property but its #size-cells (2) differs from /example-0 (1)
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/soc/qcom/qcom,sa8255p-geni-se-qup.example.dtb: geniqup@9c0000 (qcom,sa8255p-geni-se-qup): reg: [[0, 10223616], [0, 24576]] is too long
from schema $id: http://devicetree.org/schemas/soc/qcom/qcom,sa8255p-geni-se-qup.yaml#
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20250410174010.31588-4-quic_ptalari@quicinc.com
The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v1 2/9] dt-bindings: serial: describe SA8255p
2025-04-10 17:40 ` [PATCH v1 2/9] dt-bindings: serial: describe SA8255p Praveen Talari
@ 2025-04-11 17:57 ` Rob Herring
2025-04-11 18:15 ` Praveen Talari
0 siblings, 1 reply; 24+ messages in thread
From: Rob Herring @ 2025-04-11 17:57 UTC (permalink / raw)
To: Praveen Talari
Cc: Greg Kroah-Hartman, Jiri Slaby, Krzysztof Kozlowski, Conor Dooley,
Bjorn Andersson, Konrad Dybcio, Viresh Kumar, Nishanth Menon,
Stephen Boyd, Rafael J. Wysocki, linux-arm-msm, linux-kernel,
linux-serial, devicetree, linux-pm, psodagud, djaggi,
quic_msavaliy, quic_vtanuku, quic_arandive, quic_mnaresh,
quic_shazhuss, Nikunj Kela
On Thu, Apr 10, 2025 at 11:10:03PM +0530, Praveen Talari wrote:
> From: Nikunj Kela <quic_nkela@quicinc.com>
>
> SA8255p platform abstracts resources such as clocks, interconnect and
> GPIO pins configuration in Firmware. SCMI power and perf protocols are
> used to send request for resource configurations.
>
> Add DT bindings for the QUP GENI UART controller on sa8255p platform.
>
> Co-developed-by: Praveen Talari <quic_ptalari@quicinc.com>
> Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
Your tags go last because you touched this last (I assume). The order
here would be correct if you were the original author, but Nikunj made
significant enough changes to change the author and also sent the
patches. The sender always has the last S-o-b (until the maintainer
adds their's when applying).
> Signed-off-by: Nikunj Kela <quic_nkela@quicinc.com>
> ---
> .../serial/qcom,sa8255p-geni-uart.yaml | 59 +++++++++++++++++++
> 1 file changed, 59 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/serial/qcom,sa8255p-geni-uart.yaml
>
> diff --git a/Documentation/devicetree/bindings/serial/qcom,sa8255p-geni-uart.yaml b/Documentation/devicetree/bindings/serial/qcom,sa8255p-geni-uart.yaml
> new file mode 100644
> index 000000000000..0dbfbfa1d504
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/serial/qcom,sa8255p-geni-uart.yaml
> @@ -0,0 +1,59 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/serial/qcom,sa8255p-geni-uart.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Qualcomm Geni based QUP UART interface
> +
> +maintainers:
> + - Praveen Talari <quic_ptalari@quicinc.com>
> +
> +allOf:
> + - $ref: /schemas/serial/serial.yaml#
> +
> +properties:
> + compatible:
> + enum:
> + - qcom,sa8255p-geni-uart
> + - qcom,sa8255p-geni-debug-uart
> +
> + interrupts:
> + minItems: 1
> + items:
> + - description: UART core irq
> + - description: Wakeup irq (RX GPIO)
If this is a wakeup source, then you should have interrupt-names with
'wakeup' for the 2nd irq.
> +
> + power-domains:
> + minItems: 2
> + maxItems: 2
> +
> + power-domain-names:
> + items:
> + - const: power
> + - const: perf
> +
> + reg:
> + maxItems: 1
'reg' goes after compatible.
> +
> +required:
> + - compatible
> + - interrupts
> + - reg
> + - power-domains
> + - power-domain-names
> +
> +unevaluatedProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/interrupt-controller/arm-gic.h>
> +
> + serial@990000 {
> + compatible = "qcom,sa8255p-geni-uart";
> + reg = <0x990000 0x4000>;
> + interrupts = <GIC_SPI 531 IRQ_TYPE_LEVEL_HIGH>;
> + power-domains = <&scmi0_pd 0>, <&scmi0_dvfs 0>;
> + power-domain-names = "power", "perf";
> + };
> +...
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v1 2/9] dt-bindings: serial: describe SA8255p
2025-04-11 17:57 ` Rob Herring
@ 2025-04-11 18:15 ` Praveen Talari
0 siblings, 0 replies; 24+ messages in thread
From: Praveen Talari @ 2025-04-11 18:15 UTC (permalink / raw)
To: Rob Herring
Cc: Greg Kroah-Hartman, Jiri Slaby, Krzysztof Kozlowski, Conor Dooley,
Bjorn Andersson, Konrad Dybcio, Viresh Kumar, Nishanth Menon,
Stephen Boyd, Rafael J. Wysocki, linux-arm-msm, linux-kernel,
linux-serial, devicetree, linux-pm, psodagud, djaggi,
quic_msavaliy, quic_vtanuku, quic_arandive, quic_mnaresh,
quic_shazhuss, Nikunj Kela
Hi
On 4/11/2025 11:27 PM, Rob Herring wrote:
> On Thu, Apr 10, 2025 at 11:10:03PM +0530, Praveen Talari wrote:
>> From: Nikunj Kela <quic_nkela@quicinc.com>
>>
>> SA8255p platform abstracts resources such as clocks, interconnect and
>> GPIO pins configuration in Firmware. SCMI power and perf protocols are
>> used to send request for resource configurations.
>>
>> Add DT bindings for the QUP GENI UART controller on sa8255p platform.
>>
>> Co-developed-by: Praveen Talari <quic_ptalari@quicinc.com>
>> Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
> Your tags go last because you touched this last (I assume). The order
> here would be correct if you were the original author, but Nikunj made
> significant enough changes to change the author and also sent the
> patches. The sender always has the last S-o-b (until the maintainer
> adds their's when applying).
Do you mean like below
Signed-off-by: Nikunj Kela <quic_nkela@quicinc.com>
Co-developed-by: Praveen Talari <quic_ptalari@quicinc.com>
Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
Are Co-developed-by and Signed-off-by both needed or can i keep s-o-b?
>
>> Signed-off-by: Nikunj Kela <quic_nkela@quicinc.com>
>> ---
>> .../serial/qcom,sa8255p-geni-uart.yaml | 59 +++++++++++++++++++
>> 1 file changed, 59 insertions(+)
>> create mode 100644 Documentation/devicetree/bindings/serial/qcom,sa8255p-geni-uart.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/serial/qcom,sa8255p-geni-uart.yaml b/Documentation/devicetree/bindings/serial/qcom,sa8255p-geni-uart.yaml
>> new file mode 100644
>> index 000000000000..0dbfbfa1d504
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/serial/qcom,sa8255p-geni-uart.yaml
>> @@ -0,0 +1,59 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/serial/qcom,sa8255p-geni-uart.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Qualcomm Geni based QUP UART interface
>> +
>> +maintainers:
>> + - Praveen Talari <quic_ptalari@quicinc.com>
>> +
>> +allOf:
>> + - $ref: /schemas/serial/serial.yaml#
>> +
>> +properties:
>> + compatible:
>> + enum:
>> + - qcom,sa8255p-geni-uart
>> + - qcom,sa8255p-geni-debug-uart
>> +
>> + interrupts:
>> + minItems: 1
>> + items:
>> + - description: UART core irq
>> + - description: Wakeup irq (RX GPIO)
> If this is a wakeup source, then you should have interrupt-names with
> 'wakeup' for the 2nd irq.
We have taken reference of below existing yaml file
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/serial/qcom,serial-geni-qcom.yaml
>
>> +
>> + power-domains:
>> + minItems: 2
>> + maxItems: 2
>> +
>> + power-domain-names:
>> + items:
>> + - const: power
>> + - const: perf
>> +
>> + reg:
>> + maxItems: 1
> 'reg' goes after compatible.
We have taken reference of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/serial/qcom,serial-geni-qcom.yaml
>
>> +
>> +required:
>> + - compatible
>> + - interrupts
>> + - reg
>> + - power-domains
>> + - power-domain-names
>> +
>> +unevaluatedProperties: false
>> +
>> +examples:
>> + - |
>> + #include <dt-bindings/interrupt-controller/arm-gic.h>
>> +
>> + serial@990000 {
>> + compatible = "qcom,sa8255p-geni-uart";
>> + reg = <0x990000 0x4000>;
>> + interrupts = <GIC_SPI 531 IRQ_TYPE_LEVEL_HIGH>;
>> + power-domains = <&scmi0_pd 0>, <&scmi0_dvfs 0>;
>> + power-domain-names = "power", "perf";
>> + };
>> +...
>> --
>> 2.17.1
>>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v1 4/9] soc: qcom: geni-se: Enable QUPs on SA8255p Qualcomm platforms
2025-04-10 17:40 ` [PATCH v1 4/9] soc: qcom: geni-se: Enable QUPs on SA8255p Qualcomm platforms Praveen Talari
@ 2025-04-11 18:40 ` kernel test robot
2025-04-11 18:40 ` kernel test robot
2025-04-14 7:56 ` Jiri Slaby
2 siblings, 0 replies; 24+ messages in thread
From: kernel test robot @ 2025-04-11 18:40 UTC (permalink / raw)
To: Praveen Talari, Greg Kroah-Hartman, Jiri Slaby, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bjorn Andersson, Konrad Dybcio,
Viresh Kumar, Nishanth Menon, Stephen Boyd, Rafael J. Wysocki,
linux-arm-msm, linux-kernel, linux-serial, devicetree, linux-pm
Cc: llvm, oe-kbuild-all, psodagud, djaggi, quic_msavaliy,
quic_vtanuku, quic_arandive, quic_mnaresh, quic_shazhuss
Hi Praveen,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tty/tty-testing]
[also build test WARNING on tty/tty-next tty/tty-linus robh/for-next driver-core/driver-core-testing driver-core/driver-core-next driver-core/driver-core-linus usb/usb-testing usb/usb-next usb/usb-linus linus/master v6.15-rc1 next-20250411]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Praveen-Talari/opp-add-new-helper-API-dev_pm_opp_set_level/20250411-015310
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
patch link: https://lore.kernel.org/r/20250410174010.31588-5-quic_ptalari%40quicinc.com
patch subject: [PATCH v1 4/9] soc: qcom: geni-se: Enable QUPs on SA8255p Qualcomm platforms
config: arm-randconfig-001-20250412 (https://download.01.org/0day-ci/archive/20250412/202504120226.2XbpK0yU-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250412/202504120226.2XbpK0yU-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202504120226.2XbpK0yU-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/soc/qcom/qcom-geni-se.c:953:1: warning: unused label 'out' [-Wunused-label]
953 | out:
| ^~~~
1 warning generated.
vim +/out +953 drivers/soc/qcom/qcom-geni-se.c
928
929 static int geni_se_probe(struct platform_device *pdev)
930 {
931 struct device *dev = &pdev->dev;
932 struct geni_wrapper *wrapper;
933 const struct geni_se_desc *desc;
934 int ret;
935
936 wrapper = devm_kzalloc(dev, sizeof(*wrapper), GFP_KERNEL);
937 if (!wrapper)
938 return -ENOMEM;
939
940 wrapper->dev = dev;
941 wrapper->base = devm_platform_ioremap_resource(pdev, 0);
942 if (IS_ERR(wrapper->base))
943 return PTR_ERR(wrapper->base);
944
945 desc = device_get_match_data(&pdev->dev);
946
947 if (!has_acpi_companion(&pdev->dev) && desc->geni_se_rsc_init) {
948 ret = desc->geni_se_rsc_init(wrapper, desc);
949 if (ret)
950 return -EINVAL;
951 }
952
> 953 out:
954 dev_set_drvdata(dev, wrapper);
955 dev_dbg(dev, "GENI SE Driver probed\n");
956 return devm_of_platform_populate(dev);
957 }
958
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v1 4/9] soc: qcom: geni-se: Enable QUPs on SA8255p Qualcomm platforms
2025-04-10 17:40 ` [PATCH v1 4/9] soc: qcom: geni-se: Enable QUPs on SA8255p Qualcomm platforms Praveen Talari
2025-04-11 18:40 ` kernel test robot
@ 2025-04-11 18:40 ` kernel test robot
2025-04-14 7:56 ` Jiri Slaby
2 siblings, 0 replies; 24+ messages in thread
From: kernel test robot @ 2025-04-11 18:40 UTC (permalink / raw)
To: Praveen Talari, Greg Kroah-Hartman, Jiri Slaby, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bjorn Andersson, Konrad Dybcio,
Viresh Kumar, Nishanth Menon, Stephen Boyd, Rafael J. Wysocki,
linux-arm-msm, linux-kernel, linux-serial, devicetree, linux-pm
Cc: oe-kbuild-all, psodagud, djaggi, quic_msavaliy, quic_vtanuku,
quic_arandive, quic_mnaresh, quic_shazhuss
Hi Praveen,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tty/tty-testing]
[also build test WARNING on tty/tty-next tty/tty-linus robh/for-next driver-core/driver-core-testing driver-core/driver-core-next driver-core/driver-core-linus usb/usb-testing usb/usb-next usb/usb-linus linus/master v6.15-rc1 next-20250411]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Praveen-Talari/opp-add-new-helper-API-dev_pm_opp_set_level/20250411-015310
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
patch link: https://lore.kernel.org/r/20250410174010.31588-5-quic_ptalari%40quicinc.com
patch subject: [PATCH v1 4/9] soc: qcom: geni-se: Enable QUPs on SA8255p Qualcomm platforms
config: arc-randconfig-001-20250412 (https://download.01.org/0day-ci/archive/20250412/202504120240.SMbLkgHv-lkp@intel.com/config)
compiler: arc-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250412/202504120240.SMbLkgHv-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202504120240.SMbLkgHv-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/soc/qcom/qcom-geni-se.c: In function 'geni_se_probe':
>> drivers/soc/qcom/qcom-geni-se.c:953:1: warning: label 'out' defined but not used [-Wunused-label]
953 | out:
| ^~~
--
>> drivers/soc/qcom/qcom-geni-se.c:110: warning: Function parameter or struct member 'geni_se_rsc_init' not described in 'geni_se_desc'
vim +/out +953 drivers/soc/qcom/qcom-geni-se.c
928
929 static int geni_se_probe(struct platform_device *pdev)
930 {
931 struct device *dev = &pdev->dev;
932 struct geni_wrapper *wrapper;
933 const struct geni_se_desc *desc;
934 int ret;
935
936 wrapper = devm_kzalloc(dev, sizeof(*wrapper), GFP_KERNEL);
937 if (!wrapper)
938 return -ENOMEM;
939
940 wrapper->dev = dev;
941 wrapper->base = devm_platform_ioremap_resource(pdev, 0);
942 if (IS_ERR(wrapper->base))
943 return PTR_ERR(wrapper->base);
944
945 desc = device_get_match_data(&pdev->dev);
946
947 if (!has_acpi_companion(&pdev->dev) && desc->geni_se_rsc_init) {
948 ret = desc->geni_se_rsc_init(wrapper, desc);
949 if (ret)
950 return -EINVAL;
951 }
952
> 953 out:
954 dev_set_drvdata(dev, wrapper);
955 dev_dbg(dev, "GENI SE Driver probed\n");
956 return devm_of_platform_populate(dev);
957 }
958
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v1 7/9] serial: qcom-geni: move clock-rate logic to separate function
2025-04-10 17:40 ` [PATCH v1 7/9] serial: qcom-geni: move clock-rate logic to separate function Praveen Talari
@ 2025-04-11 19:12 ` kernel test robot
2025-04-14 8:01 ` Jiri Slaby
1 sibling, 0 replies; 24+ messages in thread
From: kernel test robot @ 2025-04-11 19:12 UTC (permalink / raw)
To: Praveen Talari, Greg Kroah-Hartman, Jiri Slaby, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bjorn Andersson, Konrad Dybcio,
Viresh Kumar, Nishanth Menon, Stephen Boyd, Rafael J. Wysocki,
linux-arm-msm, linux-kernel, linux-serial, devicetree, linux-pm
Cc: oe-kbuild-all, psodagud, djaggi, quic_msavaliy, quic_vtanuku,
quic_arandive, quic_mnaresh, quic_shazhuss
Hi Praveen,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tty/tty-testing]
[also build test WARNING on tty/tty-next tty/tty-linus robh/for-next driver-core/driver-core-testing driver-core/driver-core-next driver-core/driver-core-linus usb/usb-testing usb/usb-next usb/usb-linus linus/master v6.15-rc1 next-20250411]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Praveen-Talari/opp-add-new-helper-API-dev_pm_opp_set_level/20250411-015310
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
patch link: https://lore.kernel.org/r/20250410174010.31588-8-quic_ptalari%40quicinc.com
patch subject: [PATCH v1 7/9] serial: qcom-geni: move clock-rate logic to separate function
config: arm-randconfig-002-20250412 (https://download.01.org/0day-ci/archive/20250412/202504120237.YIWM0gvQ-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250412/202504120237.YIWM0gvQ-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202504120237.YIWM0gvQ-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from include/linux/device.h:15:0,
from include/linux/node.h:18,
from include/linux/cpu.h:17,
from arch/arm/include/asm/cpu.h:11,
from arch/arm/include/asm/smp_plat.h:12,
from arch/arm/include/asm/irq_work.h:5,
from include/linux/irq_work.h:64,
from include/linux/console.h:19,
from drivers/tty/serial/qcom_geni_serial.c:8:
drivers/tty/serial/qcom_geni_serial.c: In function 'geni_serial_set_rate':
>> drivers/tty/serial/qcom_geni_serial.c:1289:4: warning: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int' [-Wformat=]
"Couldn't find suitable clock rate for %u\n",
^
include/linux/dev_printk.h:110:16: note: in definition of macro 'dev_printk_index_wrap'
_p_func(dev, fmt, ##__VA_ARGS__); \
^~~
include/linux/dev_printk.h:154:49: note: in expansion of macro 'dev_fmt'
dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
^~~~~~~
drivers/tty/serial/qcom_geni_serial.c:1288:3: note: in expansion of macro 'dev_err'
dev_err(port->se.dev,
^~~~~~~
drivers/tty/serial/qcom_geni_serial.c:1294:24: warning: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'long unsigned int' [-Wformat=]
dev_dbg(port->se.dev, "desired_rate = %u, clk_rate = %lu, clk_div = %u\n",
^
include/linux/dev_printk.h:139:28: note: in definition of macro 'dev_no_printk'
_dev_printk(level, dev, fmt, ##__VA_ARGS__); \
^~~
include/linux/dev_printk.h:171:33: note: in expansion of macro 'dev_fmt'
dev_no_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__)
^~~~~~~
drivers/tty/serial/qcom_geni_serial.c:1294:2: note: in expansion of macro 'dev_dbg'
dev_dbg(port->se.dev, "desired_rate = %u, clk_rate = %lu, clk_div = %u\n",
^~~~~~~
drivers/tty/serial/qcom_geni_serial.c: In function 'qcom_geni_serial_pm':
drivers/tty/serial/qcom_geni_serial.c:1666:32: warning: unused variable 'port' [-Wunused-variable]
struct qcom_geni_serial_port *port = to_dev_port(uport);
^~~~
vim +1289 drivers/tty/serial/qcom_geni_serial.c
c4f528795d1add Karthikeyan Ramasubramanian 2018-03-14 1269
68765ed6fdd109 Praveen Talari 2025-04-10 1270 static int geni_serial_set_rate(struct uart_port *uport, unsigned long baud)
c4f528795d1add Karthikeyan Ramasubramanian 2018-03-14 1271 {
00ce7c6e86b5d1 Bartosz Golaszewski 2022-12-29 1272 struct qcom_geni_serial_port *port = to_dev_port(uport);
c4f528795d1add Karthikeyan Ramasubramanian 2018-03-14 1273 unsigned long clk_rate;
7cf563b2c84624 Akash Asthana 2020-06-23 1274 unsigned int avg_bw_core;
68765ed6fdd109 Praveen Talari 2025-04-10 1275 unsigned int clk_div;
68765ed6fdd109 Praveen Talari 2025-04-10 1276 u32 ver, sampling_rate;
68765ed6fdd109 Praveen Talari 2025-04-10 1277 u32 ser_clk_cfg;
ce734600545fc7 Vivek Gautam 2019-08-01 1278
ce734600545fc7 Vivek Gautam 2019-08-01 1279 sampling_rate = UART_OVERSAMPLING;
ce734600545fc7 Vivek Gautam 2019-08-01 1280 /* Sampling rate is halved for IP versions >= 2.5 */
ce734600545fc7 Vivek Gautam 2019-08-01 1281 ver = geni_se_get_qup_hw_version(&port->se);
c9ca43d42ed8d5 Paras Sharma 2020-09-30 1282 if (ver >= QUP_SE_VERSION_2_5)
ce734600545fc7 Vivek Gautam 2019-08-01 1283 sampling_rate /= 2;
ce734600545fc7 Vivek Gautam 2019-08-01 1284
c2194bc999d41e Vijaya Krishna Nivarthi 2022-05-16 1285 clk_rate = get_clk_div_rate(port->se.clk, baud,
c2194bc999d41e Vijaya Krishna Nivarthi 2022-05-16 1286 sampling_rate, &clk_div);
c474c775716edd Vijaya Krishna Nivarthi 2022-07-16 1287 if (!clk_rate) {
c474c775716edd Vijaya Krishna Nivarthi 2022-07-16 1288 dev_err(port->se.dev,
0fec518018cc5c Douglas Anderson 2022-08-02 @1289 "Couldn't find suitable clock rate for %u\n",
c474c775716edd Vijaya Krishna Nivarthi 2022-07-16 1290 baud * sampling_rate);
68765ed6fdd109 Praveen Talari 2025-04-10 1291 return -EINVAL;
c474c775716edd Vijaya Krishna Nivarthi 2022-07-16 1292 }
c474c775716edd Vijaya Krishna Nivarthi 2022-07-16 1293
18536cc8fab81f Johan Hovold 2023-07-14 1294 dev_dbg(port->se.dev, "desired_rate = %u, clk_rate = %lu, clk_div = %u\n",
c474c775716edd Vijaya Krishna Nivarthi 2022-07-16 1295 baud * sampling_rate, clk_rate, clk_div);
c4f528795d1add Karthikeyan Ramasubramanian 2018-03-14 1296
c4f528795d1add Karthikeyan Ramasubramanian 2018-03-14 1297 uport->uartclk = clk_rate;
8ece7b754bc34f Johan Hovold 2023-07-14 1298 port->clk_rate = clk_rate;
a5819b548af0cc Rajendra Nayak 2020-06-15 1299 dev_pm_opp_set_rate(uport->dev, clk_rate);
c4f528795d1add Karthikeyan Ramasubramanian 2018-03-14 1300 ser_clk_cfg = SER_CLK_EN;
c4f528795d1add Karthikeyan Ramasubramanian 2018-03-14 1301 ser_clk_cfg |= clk_div << CLK_DIV_SHFT;
c4f528795d1add Karthikeyan Ramasubramanian 2018-03-14 1302
7cf563b2c84624 Akash Asthana 2020-06-23 1303 /*
7cf563b2c84624 Akash Asthana 2020-06-23 1304 * Bump up BW vote on CPU and CORE path as driver supports FIFO mode
7cf563b2c84624 Akash Asthana 2020-06-23 1305 * only.
7cf563b2c84624 Akash Asthana 2020-06-23 1306 */
7cf563b2c84624 Akash Asthana 2020-06-23 1307 avg_bw_core = (baud > 115200) ? Bps_to_icc(CORE_2X_50_MHZ)
7cf563b2c84624 Akash Asthana 2020-06-23 1308 : GENI_DEFAULT_BW;
7cf563b2c84624 Akash Asthana 2020-06-23 1309 port->se.icc_paths[GENI_TO_CORE].avg_bw = avg_bw_core;
7cf563b2c84624 Akash Asthana 2020-06-23 1310 port->se.icc_paths[CPU_TO_GENI].avg_bw = Bps_to_icc(baud);
7cf563b2c84624 Akash Asthana 2020-06-23 1311 geni_icc_set_bw(&port->se);
7cf563b2c84624 Akash Asthana 2020-06-23 1312
68765ed6fdd109 Praveen Talari 2025-04-10 1313 writel(ser_clk_cfg, uport->membase + GENI_SER_M_CLK_CFG);
68765ed6fdd109 Praveen Talari 2025-04-10 1314 writel(ser_clk_cfg, uport->membase + GENI_SER_S_CLK_CFG);
68765ed6fdd109 Praveen Talari 2025-04-10 1315 return 0;
68765ed6fdd109 Praveen Talari 2025-04-10 1316 }
68765ed6fdd109 Praveen Talari 2025-04-10 1317
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v1 4/9] soc: qcom: geni-se: Enable QUPs on SA8255p Qualcomm platforms
2025-04-10 17:40 ` [PATCH v1 4/9] soc: qcom: geni-se: Enable QUPs on SA8255p Qualcomm platforms Praveen Talari
2025-04-11 18:40 ` kernel test robot
2025-04-11 18:40 ` kernel test robot
@ 2025-04-14 7:56 ` Jiri Slaby
2025-04-14 17:59 ` Praveen Talari
2 siblings, 1 reply; 24+ messages in thread
From: Jiri Slaby @ 2025-04-14 7:56 UTC (permalink / raw)
To: Praveen Talari, Greg Kroah-Hartman, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bjorn Andersson, Konrad Dybcio,
Viresh Kumar, Nishanth Menon, Stephen Boyd, Rafael J. Wysocki,
linux-arm-msm, linux-kernel, linux-serial, devicetree, linux-pm
Cc: psodagud, djaggi, quic_msavaliy, quic_vtanuku, quic_arandive,
quic_mnaresh, quic_shazhuss
On 10. 04. 25, 19:40, Praveen Talari wrote:
> On the sa8255p platform, resources such as clocks,interconnects
> and TLMM (GPIO) configurations are managed by firmware.
>
> Introduce a platform data function callback to distinguish whether
> resource control is performed by firmware or directly by the driver
> in linux.
>
> The refactor ensures clear differentiation of resource
> management mechanisms, improving maintainability and flexibility
> in handling platform-specific configurations.
>
> Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
> ---
> drivers/soc/qcom/qcom-geni-se.c | 78 +++++++++++++++++++++------------
> 1 file changed, 50 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c
> index 4cb959106efa..5e2add1e04d3 100644
> --- a/drivers/soc/qcom/qcom-geni-se.c
> +++ b/drivers/soc/qcom/qcom-geni-se.c
> @@ -105,6 +105,8 @@ struct geni_wrapper {
> struct geni_se_desc {
> unsigned int num_clks;
> const char * const *clks;
> + int (*geni_se_rsc_init)(struct geni_wrapper *wrapper,
> + const struct geni_se_desc *desc);
> };
>
> static const char * const icc_path_names[] = {"qup-core", "qup-config",
> @@ -891,10 +893,44 @@ int geni_icc_disable(struct geni_se *se)
> }
> EXPORT_SYMBOL_GPL(geni_icc_disable);
>
> +static int geni_se_resource_init(struct geni_wrapper *wrapper,
> + const struct geni_se_desc *desc)
> +{
> + struct device *dev = wrapper->dev;
> + int ret;
> + int i;
> +
> + wrapper->num_clks = min_t(unsigned int, desc->num_clks, MAX_CLKS);
I thought min_t is no longer needed in these cases?
> +
> + for (i = 0; i < wrapper->num_clks; ++i)
FWIW i should be unsigned too.
thanks,
--
js
suse labs
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v1 5/9] serial: qcom-geni: move resource initialization to separate functions
2025-04-10 17:40 ` [PATCH v1 5/9] serial: qcom-geni: move resource initialization to separate functions Praveen Talari
@ 2025-04-14 7:58 ` Jiri Slaby
0 siblings, 0 replies; 24+ messages in thread
From: Jiri Slaby @ 2025-04-14 7:58 UTC (permalink / raw)
To: Praveen Talari, Greg Kroah-Hartman, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bjorn Andersson, Konrad Dybcio,
Viresh Kumar, Nishanth Menon, Stephen Boyd, Rafael J. Wysocki,
linux-arm-msm, linux-kernel, linux-serial, devicetree, linux-pm
Cc: psodagud, djaggi, quic_msavaliy, quic_vtanuku, quic_arandive,
quic_mnaresh, quic_shazhuss
On 10. 04. 25, 19:40, Praveen Talari wrote:
> Enhances code readability and future modifications within the new API.
>
> Move the code that handles the actual initialization of resources
> like clock and ICC paths to a separate function, making the
> probe function cleaner.
The $SUBJ is misleading. There is only one function here.
>
> Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
> ---
> drivers/tty/serial/qcom_geni_serial.c | 65 ++++++++++++++++-----------
> 1 file changed, 39 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
> index a80ce7aaf309..889ce8961e0a 100644
> --- a/drivers/tty/serial/qcom_geni_serial.c
> +++ b/drivers/tty/serial/qcom_geni_serial.c
> @@ -1572,6 +1572,42 @@ static struct uart_driver qcom_geni_uart_driver = {
> .nr = GENI_UART_PORTS,
> };
>
> +static int geni_serial_resource_init(struct qcom_geni_serial_port *port)
> +{
> + int ret;
> +
> + port->se.clk = devm_clk_get(port->se.dev, "se");
> + if (IS_ERR(port->se.clk)) {
> + ret = PTR_ERR(port->se.clk);
You can return this directly, without assigning it to ret, right?
> + 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;
> +}
A \n missing here.
> static void qcom_geni_serial_pm(struct uart_port *uport,
> unsigned int new_state, unsigned int old_state)
> {
thanks,
--
js
suse labs
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v1 6/9] serial: qcom-geni: move resource control logic to separate functions
2025-04-10 17:40 ` [PATCH v1 6/9] serial: qcom-geni: move resource control logic " Praveen Talari
@ 2025-04-14 7:59 ` Jiri Slaby
2025-04-14 8:55 ` Praveen Talari
0 siblings, 1 reply; 24+ messages in thread
From: Jiri Slaby @ 2025-04-14 7:59 UTC (permalink / raw)
To: Praveen Talari, Greg Kroah-Hartman, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bjorn Andersson, Konrad Dybcio,
Viresh Kumar, Nishanth Menon, Stephen Boyd, Rafael J. Wysocki,
linux-arm-msm, linux-kernel, linux-serial, devicetree, linux-pm
Cc: psodagud, djaggi, quic_msavaliy, quic_vtanuku, quic_arandive,
quic_mnaresh, quic_shazhuss
On 10. 04. 25, 19:40, Praveen Talari wrote:
> Supports use in PM system/runtime frameworks, helping to
> distinguish new resource control mechanisms and facilitate
> future modifications within the new API.
>
> The code that handles the actual enable or disable of resources
> like clock and ICC paths to a separate function
> (geni_serial_resources_on() and geni_serial_resources_off()) which
> enhances code readability.
>
> Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
> ---
> drivers/tty/serial/qcom_geni_serial.c | 53 +++++++++++++++++++++------
> 1 file changed, 42 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
> index 889ce8961e0a..e341f5090ecc 100644
> --- a/drivers/tty/serial/qcom_geni_serial.c
> +++ b/drivers/tty/serial/qcom_geni_serial.c
> @@ -1572,6 +1572,42 @@ static struct uart_driver qcom_geni_uart_driver = {
> .nr = GENI_UART_PORTS,
> };
>
> +static int geni_serial_resources_off(struct uart_port *uport)
> +{
> + struct qcom_geni_serial_port *port = to_dev_port(uport);
> + int ret;
> +
> + dev_pm_opp_set_rate(uport->dev, 0);
> + ret = geni_se_resources_off(&port->se);
> + if (ret)
> + return ret;
> +
> + geni_icc_disable(&port->se);
> +
> + return ret;
This is a bit confusing (needs context). return 0 directly.
> +}
> +
> +static int geni_serial_resources_on(struct uart_port *uport)
> +{
> + struct qcom_geni_serial_port *port = to_dev_port(uport);
> + int ret;
> +
> + ret = geni_icc_enable(&port->se);
> + if (ret)
> + return ret;
> +
> + ret = geni_se_resources_on(&port->se);
> + if (ret) {
> + geni_icc_disable(&port->se);
> + return ret;
> + }
> +
> + if (port->clk_rate)
> + dev_pm_opp_set_rate(uport->dev, port->clk_rate);
> +
> + return ret;
Same here.
thanks,
--
js
suse labs
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v1 7/9] serial: qcom-geni: move clock-rate logic to separate function
2025-04-10 17:40 ` [PATCH v1 7/9] serial: qcom-geni: move clock-rate logic to separate function Praveen Talari
2025-04-11 19:12 ` kernel test robot
@ 2025-04-14 8:01 ` Jiri Slaby
1 sibling, 0 replies; 24+ messages in thread
From: Jiri Slaby @ 2025-04-14 8:01 UTC (permalink / raw)
To: Praveen Talari, Greg Kroah-Hartman, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bjorn Andersson, Konrad Dybcio,
Viresh Kumar, Nishanth Menon, Stephen Boyd, Rafael J. Wysocki,
linux-arm-msm, linux-kernel, linux-serial, devicetree, linux-pm
Cc: psodagud, djaggi, quic_msavaliy, quic_vtanuku, quic_arandive,
quic_mnaresh, quic_shazhuss
On 10. 04. 25, 19:40, Praveen Talari wrote:
> Facilitates future modifications within the new function,
> leading to better readability and maintainability of the code.
>
> Move the code that handles the actual logic of clock-rate
> calculations to a separate function geni_serial_set_rate()
> which enhances code readability.
>
> Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
> ---
> drivers/tty/serial/qcom_geni_serial.c | 56 +++++++++++++++++----------
> 1 file changed, 36 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
> index e341f5090ecc..25d16ac3f406 100644
> --- a/drivers/tty/serial/qcom_geni_serial.c
> +++ b/drivers/tty/serial/qcom_geni_serial.c
...
> @@ -1323,6 +1310,37 @@ static void qcom_geni_serial_set_termios(struct uart_port *uport,
> port->se.icc_paths[CPU_TO_GENI].avg_bw = Bps_to_icc(baud);
> geni_icc_set_bw(&port->se);
>
> + writel(ser_clk_cfg, uport->membase + GENI_SER_M_CLK_CFG);
> + writel(ser_clk_cfg, uport->membase + GENI_SER_S_CLK_CFG);
> + return 0;
Did this pass checkpatch?
> +}
> +
> +static void qcom_geni_serial_set_termios(struct uart_port *uport,
> + struct ktermios *termios,
> + const struct ktermios *old)
> +{
> + struct qcom_geni_serial_port *port = to_dev_port(uport);
> + unsigned int baud;
> + unsigned long timeout;
> + u32 bits_per_char;
> + u32 tx_trans_cfg;
> + u32 tx_parity_cfg;
> + u32 rx_trans_cfg;
> + u32 rx_parity_cfg;
> + u32 stop_bit_len;
> + int ret = 0;
> +
> + /* baud rate */
> + baud = uart_get_baud_rate(uport, termios, old, 300, 4000000);
> +
> + ret = geni_serial_set_rate(uport, baud);
> + if (ret) {
> + dev_err(port->se.dev,
> + "%s: Failed to set baud: %u ret: %d\n",
Why the doubled spaces?
> + __func__, baud, ret);
> + return;
> + }
> +
> /* parity */
> tx_trans_cfg = readl(uport->membase + SE_UART_TX_TRANS_CFG);
> tx_parity_cfg = readl(uport->membase + SE_UART_TX_PARITY_CFG);
thanks,
--
js
suse labs
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v1 9/9] serial: qcom-geni: Enable Serial on SA8255p Qualcomm platforms
2025-04-10 17:40 ` [PATCH v1 9/9] serial: qcom-geni: Enable Serial on SA8255p Qualcomm platforms Praveen Talari
@ 2025-04-14 8:09 ` Jiri Slaby
2025-04-14 17:49 ` Praveen Talari
0 siblings, 1 reply; 24+ messages in thread
From: Jiri Slaby @ 2025-04-14 8:09 UTC (permalink / raw)
To: Praveen Talari, Greg Kroah-Hartman, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Bjorn Andersson, Konrad Dybcio,
Viresh Kumar, Nishanth Menon, Stephen Boyd, Rafael J. Wysocki,
linux-arm-msm, linux-kernel, linux-serial, devicetree, linux-pm
Cc: psodagud, djaggi, quic_msavaliy, quic_vtanuku, quic_arandive,
quic_mnaresh, quic_shazhuss
On 10. 04. 25, 19:40, Praveen Talari wrote:
> The Qualcomm automotive SA8255p SoC relies on firmware to configure
> platform resources, including clocks, interconnects and TLMM.
> The driver requests resources operations over SCMI using power
> and performance protocols.
>
> The SCMI power protocol enables or disables resources like clocks,
> interconnect paths, and TLMM (GPIOs) using runtime PM framework APIs,
> such as resume/suspend, to control power states(on/off).
>
> The SCMI performance protocol manages UART baud rates, with each baud
> rate represented by a performance level. The driver uses the
> dev_pm_opp_set_level() API to request the desired baud rate by
> specifying the performance level.
>
> Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
> ---
> drivers/tty/serial/qcom_geni_serial.c | 150 +++++++++++++++++++++++---
> 1 file changed, 136 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
> index 9649297d4a9e..40b71d4b7590 100644
> --- a/drivers/tty/serial/qcom_geni_serial.c
> +++ b/drivers/tty/serial/qcom_geni_serial.c
...
> @@ -1624,8 +1669,27 @@ static int geni_serial_resources_on(struct uart_port *uport)
> return ret;
> }
>
> -static int geni_serial_resource_init(struct qcom_geni_serial_port *port)
> +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;
Any reason to reroute every (sane) error code into EINVAL?
--
js
suse labs
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v1 6/9] serial: qcom-geni: move resource control logic to separate functions
2025-04-14 7:59 ` Jiri Slaby
@ 2025-04-14 8:55 ` Praveen Talari
0 siblings, 0 replies; 24+ messages in thread
From: Praveen Talari @ 2025-04-14 8:55 UTC (permalink / raw)
To: Jiri Slaby, Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Bjorn Andersson, Konrad Dybcio, Viresh Kumar,
Nishanth Menon, Stephen Boyd, Rafael J. Wysocki, linux-arm-msm,
linux-kernel, linux-serial, devicetree, linux-pm
Cc: psodagud, djaggi, quic_msavaliy, quic_vtanuku, quic_arandive,
quic_mnaresh, quic_shazhuss
Hi
On 4/14/2025 1:29 PM, Jiri Slaby wrote:
> On 10. 04. 25, 19:40, Praveen Talari wrote:
>> Supports use in PM system/runtime frameworks, helping to
>> distinguish new resource control mechanisms and facilitate
>> future modifications within the new API.
>>
>> The code that handles the actual enable or disable of resources
>> like clock and ICC paths to a separate function
>> (geni_serial_resources_on() and geni_serial_resources_off()) which
>> enhances code readability.
>>
>> Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
>> ---
>> drivers/tty/serial/qcom_geni_serial.c | 53 +++++++++++++++++++++------
>> 1 file changed, 42 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/tty/serial/qcom_geni_serial.c
>> b/drivers/tty/serial/qcom_geni_serial.c
>> index 889ce8961e0a..e341f5090ecc 100644
>> --- a/drivers/tty/serial/qcom_geni_serial.c
>> +++ b/drivers/tty/serial/qcom_geni_serial.c
>> @@ -1572,6 +1572,42 @@ static struct uart_driver
>> qcom_geni_uart_driver = {
>> .nr = GENI_UART_PORTS,
>> };
>> +static int geni_serial_resources_off(struct uart_port *uport)
>> +{
>> + struct qcom_geni_serial_port *port = to_dev_port(uport);
>> + int ret;
>> +
>> + dev_pm_opp_set_rate(uport->dev, 0);
>> + ret = geni_se_resources_off(&port->se);
>> + if (ret)
>> + return ret;
>> +
>> + geni_icc_disable(&port->se);
>> +
>> + return ret;
>
> This is a bit confusing (needs context). return 0 directly.
here "ret" is also pointing to 0. Why can't we use "ret" directly
instead of 0.
>
>> +}
>> +
>> +static int geni_serial_resources_on(struct uart_port *uport)
>> +{
>> + struct qcom_geni_serial_port *port = to_dev_port(uport);
>> + int ret;
>> +
>> + ret = geni_icc_enable(&port->se);
>> + if (ret)
>> + return ret;
>> +
>> + ret = geni_se_resources_on(&port->se);
>> + if (ret) {
>> + geni_icc_disable(&port->se);
>> + return ret;
>> + }
>> +
>> + if (port->clk_rate)
>> + dev_pm_opp_set_rate(uport->dev, port->clk_rate);
>> +
>> + return ret;
>
> Same here.
>
> thanks,
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v1 9/9] serial: qcom-geni: Enable Serial on SA8255p Qualcomm platforms
2025-04-14 8:09 ` Jiri Slaby
@ 2025-04-14 17:49 ` Praveen Talari
0 siblings, 0 replies; 24+ messages in thread
From: Praveen Talari @ 2025-04-14 17:49 UTC (permalink / raw)
To: Jiri Slaby, Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Bjorn Andersson, Konrad Dybcio, Viresh Kumar,
Nishanth Menon, Stephen Boyd, Rafael J. Wysocki, linux-arm-msm,
linux-kernel, linux-serial, devicetree, linux-pm
Cc: psodagud, djaggi, quic_msavaliy, quic_vtanuku, quic_arandive,
quic_mnaresh, quic_shazhuss
HI
On 4/14/2025 1:39 PM, Jiri Slaby wrote:
> On 10. 04. 25, 19:40, Praveen Talari wrote:
>> The Qualcomm automotive SA8255p SoC relies on firmware to configure
>> platform resources, including clocks, interconnects and TLMM.
>> The driver requests resources operations over SCMI using power
>> and performance protocols.
>>
>> The SCMI power protocol enables or disables resources like clocks,
>> interconnect paths, and TLMM (GPIOs) using runtime PM framework APIs,
>> such as resume/suspend, to control power states(on/off).
>>
>> The SCMI performance protocol manages UART baud rates, with each baud
>> rate represented by a performance level. The driver uses the
>> dev_pm_opp_set_level() API to request the desired baud rate by
>> specifying the performance level.
>>
>> Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
>> ---
>> drivers/tty/serial/qcom_geni_serial.c | 150 +++++++++++++++++++++++---
>> 1 file changed, 136 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/tty/serial/qcom_geni_serial.c
>> b/drivers/tty/serial/qcom_geni_serial.c
>> index 9649297d4a9e..40b71d4b7590 100644
>> --- a/drivers/tty/serial/qcom_geni_serial.c
>> +++ b/drivers/tty/serial/qcom_geni_serial.c
> ...
>> @@ -1624,8 +1669,27 @@ static int geni_serial_resources_on(struct
>> uart_port *uport)
>> return ret;
>> }
>> -static int geni_serial_resource_init(struct qcom_geni_serial_port
>> *port)
>> +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;
>
> Any reason to reroute every (sane) error code into EINVAL?
i opted for EINVAL instead of EBUSY because i don't want the probe to be
re-executed if the firmware does not support SE.
Let me know if you have any suggestions.
Thanks,
Praveen Talari
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v1 4/9] soc: qcom: geni-se: Enable QUPs on SA8255p Qualcomm platforms
2025-04-14 7:56 ` Jiri Slaby
@ 2025-04-14 17:59 ` Praveen Talari
0 siblings, 0 replies; 24+ messages in thread
From: Praveen Talari @ 2025-04-14 17:59 UTC (permalink / raw)
To: Jiri Slaby, Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Bjorn Andersson, Konrad Dybcio, Viresh Kumar,
Nishanth Menon, Stephen Boyd, Rafael J. Wysocki, linux-arm-msm,
linux-kernel, linux-serial, devicetree, linux-pm
Cc: psodagud, djaggi, quic_msavaliy, quic_vtanuku, quic_arandive,
quic_mnaresh, quic_shazhuss
On 4/14/2025 1:26 PM, Jiri Slaby wrote:
> On 10. 04. 25, 19:40, Praveen Talari wrote:
>> On the sa8255p platform, resources such as clocks,interconnects
>> and TLMM (GPIO) configurations are managed by firmware.
>>
>> Introduce a platform data function callback to distinguish whether
>> resource control is performed by firmware or directly by the driver
>> in linux.
>>
>> The refactor ensures clear differentiation of resource
>> management mechanisms, improving maintainability and flexibility
>> in handling platform-specific configurations.
>>
>> Signed-off-by: Praveen Talari <quic_ptalari@quicinc.com>
>> ---
>> drivers/soc/qcom/qcom-geni-se.c | 78 +++++++++++++++++++++------------
>> 1 file changed, 50 insertions(+), 28 deletions(-)
>>
>> diff --git a/drivers/soc/qcom/qcom-geni-se.c
>> b/drivers/soc/qcom/qcom-geni-se.c
>> index 4cb959106efa..5e2add1e04d3 100644
>> --- a/drivers/soc/qcom/qcom-geni-se.c
>> +++ b/drivers/soc/qcom/qcom-geni-se.c
>> @@ -105,6 +105,8 @@ struct geni_wrapper {
>> struct geni_se_desc {
>> unsigned int num_clks;
>> const char * const *clks;
>> + int (*geni_se_rsc_init)(struct geni_wrapper *wrapper,
>> + const struct geni_se_desc *desc);
>> };
>> static const char * const icc_path_names[] = {"qup-core",
>> "qup-config",
>> @@ -891,10 +893,44 @@ int geni_icc_disable(struct geni_se *se)
>> }
>> EXPORT_SYMBOL_GPL(geni_icc_disable);
>> +static int geni_se_resource_init(struct geni_wrapper *wrapper,
>> + const struct geni_se_desc *desc)
>> +{
>> + struct device *dev = wrapper->dev;
>> + int ret;
>> + int i;
>> +
>> + wrapper->num_clks = min_t(unsigned int, desc->num_clks, MAX_CLKS);
>
> I thought min_t is no longer needed in these cases?
it is needed since there are two types of QUPs - the normal QUP which
uses 2 clocks,
and HUB QUP which uses only 1 clock.
>
>> +
>> + for (i = 0; i < wrapper->num_clks; ++i)
>
> FWIW i should be unsigned too.
>
> thanks,
^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2025-04-14 18:00 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-10 17:40 [PATCH v1 0/9] Enable QUPs and Serial on SA8255p Qualcomm platforms Praveen Talari
2025-04-10 17:40 ` [PATCH v1 1/9] opp: add new helper API dev_pm_opp_set_level() Praveen Talari
2025-04-10 17:40 ` [PATCH v1 2/9] dt-bindings: serial: describe SA8255p Praveen Talari
2025-04-11 17:57 ` Rob Herring
2025-04-11 18:15 ` Praveen Talari
2025-04-10 17:40 ` [PATCH v1 3/9] dt-bindings: qcom: geni-se: " Praveen Talari
2025-04-10 18:34 ` Rob Herring (Arm)
2025-04-10 17:40 ` [PATCH v1 4/9] soc: qcom: geni-se: Enable QUPs on SA8255p Qualcomm platforms Praveen Talari
2025-04-11 18:40 ` kernel test robot
2025-04-11 18:40 ` kernel test robot
2025-04-14 7:56 ` Jiri Slaby
2025-04-14 17:59 ` Praveen Talari
2025-04-10 17:40 ` [PATCH v1 5/9] serial: qcom-geni: move resource initialization to separate functions Praveen Talari
2025-04-14 7:58 ` Jiri Slaby
2025-04-10 17:40 ` [PATCH v1 6/9] serial: qcom-geni: move resource control logic " Praveen Talari
2025-04-14 7:59 ` Jiri Slaby
2025-04-14 8:55 ` Praveen Talari
2025-04-10 17:40 ` [PATCH v1 7/9] serial: qcom-geni: move clock-rate logic to separate function Praveen Talari
2025-04-11 19:12 ` kernel test robot
2025-04-14 8:01 ` Jiri Slaby
2025-04-10 17:40 ` [PATCH v1 8/9] serial: qcom-geni: Enable PM runtime for serial driver Praveen Talari
2025-04-10 17:40 ` [PATCH v1 9/9] serial: qcom-geni: Enable Serial on SA8255p Qualcomm platforms Praveen Talari
2025-04-14 8:09 ` Jiri Slaby
2025-04-14 17:49 ` Praveen Talari
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).