Re: [PATCH v2 7/9] i2c: qcom-geni: Vote for SE clock rate using OPP

From: Praveen Talari

Date: Fri Sep 11 2026 - 13:54:50 EST


Hi Konrad,

On 04-09-2026 14:22, Konrad Dybcio wrote:
On 8/27/26 7:59 PM, Praveen Talari wrote:
The I2C driver currently assumes a fixed source clock selection and always
programs SE_GENI_CLK_SEL to 0, which is not sufficient when the controller
needs to switch between different source clocks.

Add the source clock index and frequency to the I2C clock map entries and
use them while configuring the controller. Request the required
source clock rate through dev_pm_opp_set_rate() and program SE_GENI_CLK_SEL
with the matching source index.

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

+ dev_pm_opp_set_rate(dev, 0);
This and the below call are unnecessary, rate and enablement/disablement
of a clock are orthogonal operations
Yes, you are correct.

However, in this case the rate change is primarily
used to satisfy the voltage/performance requirements
associated with the selected source clock frequency
rather than the clock enable/disable state itself.

The runtime PM handling follows the same approach
currently used by the SPI and UART GENI drivers, where
the performance vote is restored during runtime resume
and released during runtime suspend.

Please let me know if I'm overlooking something here.


Thanks,

Praveen Talari


Konrad

+
return 0;
}
@@ -1236,6 +1249,12 @@ static int __maybe_unused geni_i2c_runtime_resume(struct device *dev)
int ret = 0;
struct geni_i2c_dev *gi2c = dev_get_drvdata(dev);
+ if (gi2c->clk_fld && gi2c->clk_fld->src_clk_freq) {
+ ret = dev_pm_opp_set_rate(dev, gi2c->clk_fld->src_clk_freq);
+ if (ret)
+ return ret;
+ }
+
if (gi2c->dev_data->power_on) {
ret = gi2c->dev_data->power_on(&gi2c->se);
if (ret)