linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Akhil R <akhilrajeev@nvidia.com>
To: <andriy.shevchenko@intel.com>
Cc: <andi.shyti@kernel.org>, <apopple@nvidia.com>, <digetx@gmail.com>,
	<jonathanh@nvidia.com>, <ldewangan@nvidia.com>,
	<leitao@debian.org>, <linux-i2c@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-tegra@vger.kernel.org>,
	<paulmck@kernel.org>, <rmikey@meta.com>,
	<thierry.reding@gmail.com>, <akhilrajeev@nvidia.com>
Subject: Re: [PATCH] [i2c-tegra] Do not mark ACPI devices as irq safe
Date: Fri, 16 Aug 2024 20:14:03 +0530	[thread overview]
Message-ID: <20240816144403.17756-1-akhilrajeev@nvidia.com> (raw)
In-Reply-To: <ZrYJPdW0-MQMejP3@smile.fi.intel.com>

>> I think these are two different goals here. This near term goal is just
>> fix the driver so it can use the pm_runtime_irq_safe() in a saner
>> way, avoiding calling mutexes inside spinlocks.
>> 
>> Getting rid of the IRQ safe PM seems to me to be more a long term
>> desirable goal, and unfortunately I cannot afford doing it now.
>> 
>> Laxman, what is your view on this topic?
>
> Yes, please, comment on this. We would like to get rid of the hack named "IRQ
> safe PM runtime".
>
Any thoughts on how would we handle atomic_xfers without pm_runtime_irq_safe()?

Would the below patch be a good way? I didn't test this though.

@@ -1373,10 +1373,15 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
        struct tegra_i2c_dev *i2c_dev = i2c_get_adapdata(adap);
        int i, ret;

-       ret = pm_runtime_get_sync(i2c_dev->dev);
+       if (i2c_dev->atomic_mode)
+               ret = tegra_i2c_runtime_resume(i2c_dev->dev);
+       else
+               ret = pm_runtime_get_sync(i2c_dev->dev);
+
        if (ret < 0) {
                dev_err(i2c_dev->dev, "runtime resume failed %d\n", ret);
-               pm_runtime_put_noidle(i2c_dev->dev);
+               if (!i2c_dev->atomic_mode)
+                       pm_runtime_put_noidle(i2c_dev->dev);
                return ret;
        }

@@ -1404,7 +1409,10 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
                        break;
        }

-       pm_runtime_put(i2c_dev->dev);
+       if (i2c_dev->atomic_mode)
+               tegra_i2c_runtime_suspend(i2c_dev->dev);
+       else
+               pm_runtime_put(i2c_dev->dev);

        return ret ?: i;
 }


      reply	other threads:[~2024-08-16 14:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-06 13:27 [PATCH] [i2c-tegra] Do not mark ACPI devices as irq safe Breno Leitao
2024-06-11 12:49 ` Andy Shevchenko
2024-06-12 12:12   ` Breno Leitao
2024-08-09 12:19     ` Andy Shevchenko
2024-08-16 14:44       ` Akhil R [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240816144403.17756-1-akhilrajeev@nvidia.com \
    --to=akhilrajeev@nvidia.com \
    --cc=andi.shyti@kernel.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=apopple@nvidia.com \
    --cc=digetx@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=ldewangan@nvidia.com \
    --cc=leitao@debian.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=rmikey@meta.com \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).