Re: [PATCH v5 07/13] soc: qcom: geni-se: Introduce helper APIs for performance control

From: Praveen Talari

Date: Wed Feb 25 2026 - 22:53:18 EST


Hi Konrad,

On 2/25/2026 7:58 PM, Konrad Dybcio wrote:
On 2/6/26 6:41 PM, Praveen Talari wrote:
The GENI Serial Engine (SE) drivers (I2C, SPI, and SERIAL) currently
manage performance levels and operating points directly. This resulting
in code duplication across drivers. such as configuring a specific level
or find and apply an OPP based on a clock frequency.

Introduce two new helper APIs, geni_se_set_perf_level() and
geni_se_set_perf_opp(), addresses this issue by providing a streamlined
method for the GENI Serial Engine (SE) drivers to find and set the OPP
based on the desired performance level, thereby eliminating redundancy.

Signed-off-by: Praveen Talari <praveen.talari@xxxxxxxxxxxxxxxx>
---

[...]

+/**
+ * geni_se_set_perf_level() - Set performance level for GENI SE.
+ * @se: Pointer to the struct geni_se instance.
+ * @level: The desired performance level.
+ *
+ * Sets the performance level by directly calling dev_pm_opp_set_level
+ * on the performance device associated with the SE.
+ *
+ * Return: 0 on success, or a negative error code on failure.
+ */
+int geni_se_set_perf_level(struct geni_se *se, unsigned long level)
+{
+ return dev_pm_opp_set_level(se->pd_list->pd_devs[DOMAIN_IDX_PERF], level);
+}

My only remaining concern with this patch is this export - on v3 you
mentioned that it'd be used in the UART driver (which currently does
more or less the same thing, open-coded) - are we unable to leverage
dev_pm_opp_set_rate there too? i.e. are the OPP tables produced by the
SCMI servers not populating the rate field for UART specifically?

Yes, it is populated, and we directly pass the baud rate value as the performance level. Therefore, there is no need to convert it to a frequency. Since we already have the performance level value, we do not use dev_pm_opp_set_rate.

The rate_hz (frequency) value is equal to level × 1000.

Thanks,
Praveen Talari


Konrad