diff options
| author | pgoyette <pgoyette@NetBSD.org> | 2009-02-03 16:17:54 +0000 |
|---|---|---|
| committer | pgoyette <pgoyette@NetBSD.org> | 2009-02-03 16:17:54 +0000 |
| commit | b4d7d7bb1dc2a32f3efdd300cfe481018af83486 (patch) | |
| tree | ae2d968b0be86fd9e625d5709e90d37493298b7f /sys/dev/i2c | |
| parent | 9e46f319a5cc7925f4354187dfb75b67cd0d55e7 (diff) | |
Handle i2c quick_read/quick_write bus protocol in the generic i2c_exec()
routine, since we have already have the iic_smbus_* interfaces.
NOTE: i2c controllers that provide their own i2c_exec() routine also need
to be modified. I'll be committing most of these shortly.
Diffstat (limited to 'sys/dev/i2c')
| -rw-r--r-- | sys/dev/i2c/i2c_exec.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sys/dev/i2c/i2c_exec.c b/sys/dev/i2c/i2c_exec.c index 6c93ec53414..46cb3e91ecd 100644 --- a/sys/dev/i2c/i2c_exec.c +++ b/sys/dev/i2c/i2c_exec.c @@ -1,4 +1,4 @@ -/* $NetBSD: i2c_exec.c,v 1.6 2007/12/11 12:09:22 lukem Exp $ */ +/* $NetBSD: i2c_exec.c,v 1.7 2009/02/03 16:17:54 pgoyette Exp $ */ /* * Copyright (c) 2003 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: i2c_exec.c,v 1.6 2007/12/11 12:09:22 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i2c_exec.c,v 1.7 2009/02/03 16:17:54 pgoyette Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -115,6 +115,17 @@ iic_exec(i2c_tag_t tag, i2c_op_t op, i2c_addr_t addr, const void *vcmd, if ((error = iic_write_byte(tag, *cmd++, flags)) != 0) goto bad; } + } else if (buflen == 0) { + /* + * This is a quick_read()/quick_write() command with + * neither command nor data bytes + */ + if (I2C_OP_STOP_P(op)) + flags |= I2C_F_STOP; + if (I2C_OP_READ_P(op)) + flags |= I2C_F_READ; + if ((error = iic_initiate_xfer(tag, addr, flags)) != 0) + goto bad; } if (I2C_OP_READ_P(op)) |
