Re: [PATCH v6] i2c: i2c-qcom-geni: serve transfers during early resume

From: Mukesh Savaliya

Date: Fri Jul 03 2026 - 01:47:46 EST


Thanks Aniket for the review !

On 7/3/2026 10:21 AM, Aniket RANDIVE wrote:


On 6/29/2026 7:11 PM, Mukesh Kumar Savaliya wrote:
[...]

index d2f5055b0b10..d56b36bd1d26 100644
--- a/drivers/i2c/busses/i2c-qcom-geni.c
+++ b/drivers/i2c/busses/i2c-qcom-geni.c
@@ -913,6 +913,10 @@ static int geni_i2c_xfer(struct i2c_adapter *adap,
      gi2c->err = 0;
      reinit_completion(&gi2c->done);
      ret = pm_runtime_get_sync(gi2c->se.dev);
+    if (ret == -EACCES) {
+        dev_warn(gi2c->se.dev, "Runtime PM is disabled:%d\n", ret);
+        ret = 0;
+    }

Why we are checking specific error code here? Why can't we use the below error check directly?
if get sync itself is failed with pm runtime disabled then why we are going ahead by making ret = 0 here? How you will make sure resources are enabled?

This reason is also mentioned in the commit log. we surely get -EACCESS as runtime PM is disabled during no_irq resume phase. We still need to serve the transfer, hence we need to override it.

Review geni_i2c_resume_noirq() to know what all we do to enable resources. That's guaranteed and tested with system suspend/resume test back to back and PCIe could do i2c transfer successfully.


      if (ret < 0) {
          dev_err(gi2c->se.dev, "error turning SE resources:%d\n", ret);
          pm_runtime_put_noidle(gi2c->se.dev);
@@ -1045,7 +1049,8 @@ static int geni_i2c_probe(struct platform_device *pdev)
      platform_set_drvdata(pdev, gi2c);
      /* Keep interrupts disabled initially to allow for low-power modes */
-    ret = devm_request_irq(dev, gi2c->irq, geni_i2c_irq, IRQF_NO_AUTOEN,
+    ret = devm_request_irq(dev, gi2c->irq, geni_i2c_irq,
+                   IRQF_NO_AUTOEN | IRQF_NO_SUSPEND | IRQF_EARLY_RESUME,
                     dev_name(dev), gi2c);
      if (ret)
          return dev_err_probe(dev, ret,
@@ -1257,7 +1262,12 @@ static int __maybe_unused geni_i2c_resume_noirq(struct device *dev)
      if (ret)
          return ret;
+    /* Enforced disable_depth = 0 to actually enable runtime PM during noirq phase */
+    if (!pm_runtime_enabled(dev))
+        pm_runtime_enable(dev);

Here we are enabling the pm runtime so where we are disabling it?

when system goes to suspend, runtime PM gets disabled. Since we are in early resume and runtime PM is still disabled, we need to enable it.
+
      i2c_mark_adapter_resumed(&gi2c->adap);
+
      return 0;
  }