summaryrefslogtreecommitdiff
path: root/src/device/i2c_bus.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/device/i2c_bus.c')
-rw-r--r--src/device/i2c_bus.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/device/i2c_bus.c b/src/device/i2c_bus.c
index a63086cf41..c355506f72 100644
--- a/src/device/i2c_bus.c
+++ b/src/device/i2c_bus.c
@@ -6,6 +6,12 @@
#include <device/i2c_bus.h>
#include <commonlib/endian.h>
+bool i2c_dev_detect(struct device *dev, unsigned int addr)
+{
+ struct i2c_msg seg = { .flags = 0, .slave = addr, .buf = NULL, .len = 0 };
+ return dev->ops->ops_i2c_bus->transfer(dev, &seg, 0) == 0;
+}
+
struct bus *i2c_link(const struct device *const dev)
{
if (!dev || !dev->bus)