summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2021-07-26 06:24:23 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2021-07-26 06:24:23 +0000
commitb819847213c9d85476919660e119b04b741abd14 (patch)
tree8c799ed78c17e8c076404b5d6d00bb49e9469348 /sys/dev/pci/drm
parentc76192eba764eca120c08d3a49e9b0db51c1a29b (diff)
retry i2c transfers on -EAGAIN up to the number of times specified in
struct i2c_adapter inteldrm gmbus returns -EAGAIN to fallback to gpio bitbanging
Diffstat (limited to 'sys/dev/pci/drm')
-rw-r--r--sys/dev/pci/drm/drm_linux.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/dev/pci/drm/drm_linux.c b/sys/dev/pci/drm/drm_linux.c
index 58ec65b597e..126c078b56e 100644
--- a/sys/dev/pci/drm/drm_linux.c
+++ b/sys/dev/pci/drm/drm_linux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: drm_linux.c,v 1.80 2021/07/07 02:38:21 jsg Exp $ */
+/* $OpenBSD: drm_linux.c,v 1.81 2021/07/26 06:24:22 jsg Exp $ */
/*
* Copyright (c) 2013 Jonathan Gray <jsg@openbsd.org>
* Copyright (c) 2015, 2016 Mark Kettenis <kettenis@openbsd.org>
@@ -1037,15 +1037,21 @@ fail:
int
i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
{
- int ret;
+ int ret, retries;
if (adap->lock_ops)
adap->lock_ops->lock_bus(adap, 0);
+ retries = adap->retries;
+retry:
if (adap->algo)
ret = adap->algo->master_xfer(adap, msgs, num);
else
ret = i2c_master_xfer(adap, msgs, num);
+ if (ret == -EAGAIN && retries > 0) {
+ retries--;
+ goto retry;
+ }
if (adap->lock_ops)
adap->lock_ops->unlock_bus(adap, 0);