From: Raag Jadav <raag.jadav@intel.com>
To: lucas.demarchi@intel.com, thomas.hellstrom@linux.intel.com,
rodrigo.vivi@intel.com
Cc: jarkko.nikula@linux.intel.com, airlied@gmail.com,
simona@ffwll.ch, andriy.shevchenko@linux.intel.com,
mika.westerberg@linux.intel.com, jsd@semihalf.com,
andi.shyti@kernel.org, raag.jadav@intel.com,
riana.tauro@intel.com, srinivasa.adatrao@intel.com,
michael.j.ruhl@intel.com, intel-xe@lists.freedesktop.org,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Andi Shyti <andi.shyti@linux.intel.com>
Subject: [PATCH v7 1/5] i2c: designware: Use polling by default when there is no irq resource
Date: Thu, 10 Jul 2025 12:46:08 +0530 [thread overview]
Message-ID: <20250710071612.2714990-2-raag.jadav@intel.com> (raw)
In-Reply-To: <20250710071612.2714990-1-raag.jadav@intel.com>
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
The irq resource itself can be used as a generic way to
determine when polling is needed.
This not only removes the need for special additional device
properties that would soon be needed when the platform may
or may not have the irq, but it also removes the need to
check the platform in the first place in order to determine
is polling needed or not.
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
---
drivers/i2c/busses/i2c-designware-platdrv.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 879719e91df2..3104f52e32be 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -205,25 +205,28 @@ static void i2c_dw_remove_lock_support(struct dw_i2c_dev *dev)
static int dw_i2c_plat_probe(struct platform_device *pdev)
{
+ u32 flags = (uintptr_t)device_get_match_data(&pdev->dev);
struct device *device = &pdev->dev;
struct i2c_adapter *adap;
struct dw_i2c_dev *dev;
int irq, ret;
- irq = platform_get_irq(pdev, 0);
- if (irq < 0)
+ irq = platform_get_irq_optional(pdev, 0);
+ if (irq == -ENXIO)
+ flags |= ACCESS_POLLING;
+ else if (irq < 0)
return irq;
dev = devm_kzalloc(device, sizeof(*dev), GFP_KERNEL);
if (!dev)
return -ENOMEM;
- dev->flags = (uintptr_t)device_get_match_data(device);
if (device_property_present(device, "wx,i2c-snps-model"))
- dev->flags = MODEL_WANGXUN_SP | ACCESS_POLLING;
+ flags = MODEL_WANGXUN_SP | ACCESS_POLLING;
dev->dev = device;
dev->irq = irq;
+ dev->flags = flags;
platform_set_drvdata(pdev, dev);
ret = dw_i2c_plat_request_regs(dev);
--
2.34.1
next prev parent reply other threads:[~2025-07-10 7:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-10 7:16 [PATCH v7 0/5] drm/xe: i2c support Raag Jadav
2025-07-10 7:16 ` Raag Jadav [this message]
2025-07-28 13:43 ` [PATCH v7 1/5] i2c: designware: Use polling by default when there is no irq resource Jarkko Nikula
2025-07-10 7:16 ` [PATCH v7 2/5] i2c: designware: Add quirk for Intel Xe Raag Jadav
2025-07-28 13:44 ` Jarkko Nikula
2025-07-10 7:16 ` [PATCH v7 3/5] drm/xe: Support for I2C attached MCUs Raag Jadav
2025-07-10 7:16 ` [PATCH v7 4/5] drm/xe/pm: Wire up suspend/resume for I2C controller Raag Jadav
2025-07-10 7:16 ` [PATCH v7 5/5] drm/xe/xe_i2c: Add support for i2c in survivability mode Raag Jadav
2025-07-10 15:39 ` [PATCH v7 0/5] drm/xe: i2c support Rodrigo Vivi
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=20250710071612.2714990-2-raag.jadav@intel.com \
--to=raag.jadav@intel.com \
--cc=airlied@gmail.com \
--cc=andi.shyti@kernel.org \
--cc=andi.shyti@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=heikki.krogerus@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=jarkko.nikula@linux.intel.com \
--cc=jsd@semihalf.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lucas.demarchi@intel.com \
--cc=michael.j.ruhl@intel.com \
--cc=mika.westerberg@linux.intel.com \
--cc=riana.tauro@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=simona@ffwll.ch \
--cc=srinivasa.adatrao@intel.com \
--cc=thomas.hellstrom@linux.intel.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
all inboxes | Powered by JetHome®