summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorraj <raj@FreeBSD.org>2009-01-26 13:53:39 +0000
committerraj <raj@FreeBSD.org>2009-01-26 13:53:39 +0000
commit65b10fa5bed8c519892470c538b6b043962f6421 (patch)
tree8456a8111054da64f1956422c4d26bb416864a52
parentd8594296c6acfb8563e755122aceccea14d0ae97 (diff)
downloadFreeBSD-src-65b10fa5bed8c519892470c538b6b043962f6421.zip
FreeBSD-src-65b10fa5bed8c519892470c538b6b043962f6421.tar.gz
Teach iic(4) the 'repeated start' I2C condition. This will be used by the
upcoming i2c(8) diag utility. Reviewed by: bms, stas Obtained from: Semihalf
-rw-r--r--share/man/man4/iic.48
-rw-r--r--sys/dev/iicbus/iic.c5
-rw-r--r--sys/dev/iicbus/iic.h1
3 files changed, 13 insertions, 1 deletions
diff --git a/share/man/man4/iic.4 b/share/man/man4/iic.4
index 0112ff8..7d6141c 100644
--- a/share/man/man4/iic.4
+++ b/share/man/man4/iic.4
@@ -45,13 +45,19 @@ In order to control I2C devices, use
.Pa /dev/iic?
with the
following ioctls:
-.Bl -tag -width ".Dv I2CRSTCARD"
+.Bl -tag -width ".Dv I2CRPTSTART"
.It Dv I2CSTART
.Pq Vt "struct iiccmd"
Sends the start condition to the slave specified by the
.Va slave
element to the bus.
All other elements are ignored.
+.It Dv I2CRPTSTART
+.Pq Vt "struct iiccmd"
+Sends the repeated start condition to the slave specified by the
+.Va slave
+element to the bus.
+All other elements are ignored.
.It Dv I2CSTOP
No argument is passed.
Sends the stop condition to the bus.
diff --git a/sys/dev/iicbus/iic.c b/sys/dev/iicbus/iic.c
index ebc167d..673d635 100644
--- a/sys/dev/iicbus/iic.c
+++ b/sys/dev/iicbus/iic.c
@@ -368,6 +368,11 @@ iicioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *t
}
free(usrbufs, M_TEMP);
break;
+
+ case I2CRPTSTART:
+ error = iicbus_repeated_start(parent, s->slave, 0);
+ break;
+
default:
error = ENOTTY;
}
diff --git a/sys/dev/iicbus/iic.h b/sys/dev/iicbus/iic.h
index 471f976..bc29fa0 100644
--- a/sys/dev/iicbus/iic.h
+++ b/sys/dev/iicbus/iic.h
@@ -60,5 +60,6 @@ struct iic_rdwr_data {
#define I2CWRITE _IOW('i', 4, struct iiccmd) /* send data */
#define I2CREAD _IOW('i', 5, struct iiccmd) /* receive data */
#define I2CRDWR _IOW('i', 6, struct iic_rdwr_data) /* General read/write interface */
+#define I2CRPTSTART _IOW('i', 7, struct iiccmd) /* repeated start */
#endif
OpenPOWER on IntegriCloud