From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: "Lucas De Marchi" <lucas.demarchi@intel.com>,
"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>
Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Jan Dabros <jsd@semihalf.com>, Andi Shyti <andi.shyti@kernel.org>,
Raag Jadav <raag.jadav@intel.com>,
"Tauro, Riana" <riana.tauro@intel.com>,
"Adatrao, Srinivasa" <srinivasa.adatrao@intel.com>,
"Michael J. Ruhl" <michael.j.ruhl@intel.com>,
intel-xe@lists.freedesktop.org, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v6 1/5] i2c: designware: Use polling by default when there is no irq resource
Date: Tue, 1 Jul 2025 15:22:48 +0300 [thread overview]
Message-ID: <20250701122252.2590230-2-heikki.krogerus@linux.intel.com> (raw)
In-Reply-To: <20250701122252.2590230-1-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>
---
Hi guys,
I found the thread with Jarkko's comments from my archives. He wanted
the local flags variable to be added because he wants the order of the
calls to remain as it is now - the device is allocated only after the
irq is checked.
thanks,
---
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.47.2
next prev parent reply other threads:[~2025-07-01 12:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-01 12:22 [PATCH v6 0/5] drm/xe: i2c support Heikki Krogerus
2025-07-01 12:22 ` Heikki Krogerus [this message]
2025-07-01 12:42 ` [PATCH v6 1/5] i2c: designware: Use polling by default when there is no irq resource Andy Shevchenko
2025-07-01 12:55 ` Heikki Krogerus
2025-07-01 13:50 ` Andy Shevchenko
2025-07-01 16:31 ` Andi Shyti
2025-07-01 12:22 ` [PATCH v6 2/5] i2c: designware: Add quirk for Intel Xe Heikki Krogerus
2025-07-01 16:32 ` Andi Shyti
2025-07-01 12:22 ` [PATCH v6 3/5] drm/xe: Support for I2C attached MCUs Heikki Krogerus
2025-07-01 12:22 ` [PATCH v6 4/5] drm/xe/pm: Wire up suspend/resume for I2C controller Heikki Krogerus
2025-07-01 12:22 ` [PATCH v6 5/5] drm/xe/xe_i2c: Add support for i2c in survivability mode Heikki Krogerus
2025-07-02 17:18 ` [PATCH v6 0/5] drm/xe: i2c support Andi Shyti
2025-07-02 21:52 ` Rodrigo Vivi
2025-07-03 17:41 ` Andi Shyti
2025-07-10 14:22 ` 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=20250701122252.2590230-2-heikki.krogerus@linux.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=airlied@gmail.com \
--cc=andi.shyti@kernel.org \
--cc=andriy.shevchenko@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=raag.jadav@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®