1998-09-03 20:51:50 +00:00
|
|
|
/*-
|
2002-03-23 15:49:15 +00:00
|
|
|
* Copyright (c) 1998, 2001 Nicolas Souchu
|
1998-09-03 20:51:50 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
1999-08-28 01:08:13 +00:00
|
|
|
* $FreeBSD$
|
1998-09-03 20:51:50 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
#include <sys/param.h>
|
2008-08-04 21:03:06 +00:00
|
|
|
#include <sys/bus.h>
|
|
|
|
#include <sys/conf.h>
|
|
|
|
#include <sys/fcntl.h>
|
|
|
|
#include <sys/lock.h>
|
1998-09-03 20:51:50 +00:00
|
|
|
#include <sys/kernel.h>
|
2004-05-16 21:19:59 +00:00
|
|
|
#include <sys/malloc.h>
|
1998-09-03 20:51:50 +00:00
|
|
|
#include <sys/module.h>
|
2008-08-04 21:03:06 +00:00
|
|
|
#include <sys/sx.h>
|
|
|
|
#include <sys/systm.h>
|
1998-09-03 20:51:50 +00:00
|
|
|
#include <sys/uio.h>
|
|
|
|
|
|
|
|
#include <dev/iicbus/iiconf.h>
|
|
|
|
#include <dev/iicbus/iicbus.h>
|
2002-09-19 03:25:46 +00:00
|
|
|
#include <dev/iicbus/iic.h>
|
1998-09-03 20:51:50 +00:00
|
|
|
|
|
|
|
#include "iicbus_if.h"
|
|
|
|
|
|
|
|
#define BUFSIZE 1024
|
|
|
|
|
|
|
|
struct iic_softc {
|
|
|
|
|
2008-08-04 21:03:06 +00:00
|
|
|
device_t sc_dev;
|
2002-03-23 15:49:15 +00:00
|
|
|
u_char sc_addr; /* 7 bit address on iicbus */
|
1998-09-03 20:51:50 +00:00
|
|
|
int sc_count; /* >0 if device opened */
|
|
|
|
|
|
|
|
char sc_buffer[BUFSIZE]; /* output buffer */
|
|
|
|
char sc_inbuf[BUFSIZE]; /* input buffer */
|
2002-03-23 15:49:15 +00:00
|
|
|
|
2004-06-16 09:47:26 +00:00
|
|
|
struct cdev *sc_devnode;
|
2008-08-04 21:03:06 +00:00
|
|
|
struct sx sc_lock;
|
1998-09-03 20:51:50 +00:00
|
|
|
};
|
|
|
|
|
2008-08-04 21:03:06 +00:00
|
|
|
#define IIC_LOCK(sc) sx_xlock(&(sc)->sc_lock)
|
|
|
|
#define IIC_UNLOCK(sc) sx_xunlock(&(sc)->sc_lock)
|
1998-09-03 20:51:50 +00:00
|
|
|
|
|
|
|
static int iic_probe(device_t);
|
|
|
|
static int iic_attach(device_t);
|
2002-03-23 15:49:15 +00:00
|
|
|
static int iic_detach(device_t);
|
|
|
|
static void iic_identify(driver_t *driver, device_t parent);
|
1998-09-03 20:51:50 +00:00
|
|
|
|
|
|
|
static devclass_t iic_devclass;
|
|
|
|
|
|
|
|
static device_method_t iic_methods[] = {
|
|
|
|
/* device interface */
|
2002-03-23 15:49:15 +00:00
|
|
|
DEVMETHOD(device_identify, iic_identify),
|
1998-09-03 20:51:50 +00:00
|
|
|
DEVMETHOD(device_probe, iic_probe),
|
|
|
|
DEVMETHOD(device_attach, iic_attach),
|
2002-03-23 15:49:15 +00:00
|
|
|
DEVMETHOD(device_detach, iic_detach),
|
1998-09-03 20:51:50 +00:00
|
|
|
|
|
|
|
/* iicbus interface */
|
|
|
|
DEVMETHOD(iicbus_intr, iicbus_generic_intr),
|
|
|
|
|
|
|
|
{ 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static driver_t iic_driver = {
|
|
|
|
"iic",
|
|
|
|
iic_methods,
|
|
|
|
sizeof(struct iic_softc),
|
|
|
|
};
|
|
|
|
|
|
|
|
static d_open_t iicopen;
|
|
|
|
static d_close_t iicclose;
|
|
|
|
static d_write_t iicwrite;
|
|
|
|
static d_read_t iicread;
|
|
|
|
static d_ioctl_t iicioctl;
|
|
|
|
|
1999-05-30 16:53:49 +00:00
|
|
|
static struct cdevsw iic_cdevsw = {
|
2004-02-21 21:10:55 +00:00
|
|
|
.d_version = D_VERSION,
|
2008-08-04 21:03:06 +00:00
|
|
|
.d_flags = D_TRACKCLOSE,
|
2003-03-03 12:15:54 +00:00
|
|
|
.d_open = iicopen,
|
|
|
|
.d_close = iicclose,
|
|
|
|
.d_read = iicread,
|
|
|
|
.d_write = iicwrite,
|
|
|
|
.d_ioctl = iicioctl,
|
|
|
|
.d_name = "iic",
|
1999-05-30 16:53:49 +00:00
|
|
|
};
|
1998-09-03 20:51:50 +00:00
|
|
|
|
2002-03-23 15:49:15 +00:00
|
|
|
static void
|
|
|
|
iic_identify(driver_t *driver, device_t parent)
|
|
|
|
{
|
2008-08-04 21:03:06 +00:00
|
|
|
|
|
|
|
if (device_find_child(parent, "iic", -1) == NULL)
|
|
|
|
BUS_ADD_CHILD(parent, 0, "iic", -1);
|
2002-03-23 15:49:15 +00:00
|
|
|
}
|
|
|
|
|
1998-09-03 20:51:50 +00:00
|
|
|
static int
|
|
|
|
iic_probe(device_t dev)
|
|
|
|
{
|
2002-03-23 15:49:15 +00:00
|
|
|
device_set_desc(dev, "I2C generic I/O");
|
1998-09-03 20:51:50 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
iic_attach(device_t dev)
|
|
|
|
{
|
2002-03-23 15:49:15 +00:00
|
|
|
struct iic_softc *sc = (struct iic_softc *)device_get_softc(dev);
|
|
|
|
|
2008-08-04 21:03:06 +00:00
|
|
|
sc->sc_dev = dev;
|
|
|
|
sx_init(&sc->sc_lock, "iic");
|
2002-03-23 15:49:15 +00:00
|
|
|
sc->sc_devnode = make_dev(&iic_cdevsw, device_get_unit(dev),
|
1999-11-18 05:43:32 +00:00
|
|
|
UID_ROOT, GID_WHEEL,
|
|
|
|
0600, "iic%d", device_get_unit(dev));
|
2008-08-04 21:03:06 +00:00
|
|
|
if (sc->sc_devnode == NULL) {
|
|
|
|
device_printf(dev, "failed to create character device\n");
|
|
|
|
sx_destroy(&sc->sc_lock);
|
|
|
|
return (ENXIO);
|
|
|
|
}
|
|
|
|
sc->sc_devnode->si_drv1 = sc;
|
|
|
|
|
2002-03-23 15:49:15 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
iic_detach(device_t dev)
|
|
|
|
{
|
|
|
|
struct iic_softc *sc = (struct iic_softc *)device_get_softc(dev);
|
|
|
|
|
|
|
|
if (sc->sc_devnode)
|
|
|
|
destroy_dev(sc->sc_devnode);
|
2008-08-04 21:03:06 +00:00
|
|
|
sx_destroy(&sc->sc_lock);
|
2002-03-23 15:49:15 +00:00
|
|
|
|
1998-09-03 20:51:50 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2006-04-04 23:29:17 +00:00
|
|
|
iicopen(struct cdev *dev, int flags, int fmt, struct thread *td)
|
1998-09-03 20:51:50 +00:00
|
|
|
{
|
2008-08-04 21:03:06 +00:00
|
|
|
struct iic_softc *sc = dev->si_drv1;
|
1998-09-03 20:51:50 +00:00
|
|
|
|
2008-08-04 21:03:06 +00:00
|
|
|
IIC_LOCK(sc);
|
|
|
|
if (sc->sc_count > 0) {
|
|
|
|
IIC_UNLOCK(sc);
|
1998-09-03 20:51:50 +00:00
|
|
|
return (EBUSY);
|
2008-08-04 21:03:06 +00:00
|
|
|
}
|
1998-09-03 20:51:50 +00:00
|
|
|
|
|
|
|
sc->sc_count++;
|
2008-08-04 21:03:06 +00:00
|
|
|
IIC_UNLOCK(sc);
|
1998-09-03 20:51:50 +00:00
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2004-06-16 09:47:26 +00:00
|
|
|
iicclose(struct cdev *dev, int flags, int fmt, struct thread *td)
|
1998-09-03 20:51:50 +00:00
|
|
|
{
|
2008-08-04 21:03:06 +00:00
|
|
|
struct iic_softc *sc = dev->si_drv1;
|
1998-09-03 20:51:50 +00:00
|
|
|
|
2008-08-04 21:03:06 +00:00
|
|
|
IIC_LOCK(sc);
|
|
|
|
if (!sc->sc_count) {
|
|
|
|
/* XXX: I don't think this can happen. */
|
|
|
|
IIC_UNLOCK(sc);
|
1998-09-03 20:51:50 +00:00
|
|
|
return (EINVAL);
|
2008-08-04 21:03:06 +00:00
|
|
|
}
|
1998-09-03 20:51:50 +00:00
|
|
|
|
|
|
|
sc->sc_count--;
|
|
|
|
|
|
|
|
if (sc->sc_count < 0)
|
2001-12-10 08:09:49 +00:00
|
|
|
panic("%s: iic_count < 0!", __func__);
|
2008-08-04 21:03:06 +00:00
|
|
|
IIC_UNLOCK(sc);
|
1998-09-03 20:51:50 +00:00
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2004-06-16 09:47:26 +00:00
|
|
|
iicwrite(struct cdev *dev, struct uio * uio, int ioflag)
|
1998-09-03 20:51:50 +00:00
|
|
|
{
|
2008-08-04 21:03:06 +00:00
|
|
|
struct iic_softc *sc = dev->si_drv1;
|
|
|
|
device_t iicdev = sc->sc_dev;
|
1998-09-03 20:51:50 +00:00
|
|
|
int sent, error, count;
|
|
|
|
|
2008-08-04 21:03:06 +00:00
|
|
|
IIC_LOCK(sc);
|
|
|
|
if (!sc->sc_addr) {
|
|
|
|
IIC_UNLOCK(sc);
|
1998-09-03 20:51:50 +00:00
|
|
|
return (EINVAL);
|
2008-08-04 21:03:06 +00:00
|
|
|
}
|
1998-09-03 20:51:50 +00:00
|
|
|
|
2008-08-04 21:03:06 +00:00
|
|
|
if (sc->sc_count == 0) {
|
|
|
|
/* XXX: I don't think this can happen. */
|
|
|
|
IIC_UNLOCK(sc);
|
1998-09-03 20:51:50 +00:00
|
|
|
return (EINVAL);
|
2008-08-04 21:03:06 +00:00
|
|
|
}
|
1998-09-03 20:51:50 +00:00
|
|
|
|
2008-08-04 21:03:06 +00:00
|
|
|
error = iicbus_request_bus(device_get_parent(iicdev), iicdev,
|
|
|
|
IIC_DONTWAIT);
|
|
|
|
if (error) {
|
|
|
|
IIC_UNLOCK(sc);
|
1999-02-13 18:01:55 +00:00
|
|
|
return (error);
|
2008-08-04 21:03:06 +00:00
|
|
|
}
|
1999-02-13 18:01:55 +00:00
|
|
|
|
1998-09-03 20:51:50 +00:00
|
|
|
count = min(uio->uio_resid, BUFSIZE);
|
|
|
|
uiomove(sc->sc_buffer, count, uio);
|
|
|
|
|
|
|
|
error = iicbus_block_write(device_get_parent(iicdev), sc->sc_addr,
|
|
|
|
sc->sc_buffer, count, &sent);
|
|
|
|
|
1999-02-13 18:01:55 +00:00
|
|
|
iicbus_release_bus(device_get_parent(iicdev), iicdev);
|
2008-08-04 21:03:06 +00:00
|
|
|
IIC_UNLOCK(sc);
|
1999-02-13 18:01:55 +00:00
|
|
|
|
2008-08-04 21:03:06 +00:00
|
|
|
return (error);
|
1998-09-03 20:51:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2004-06-16 09:47:26 +00:00
|
|
|
iicread(struct cdev *dev, struct uio * uio, int ioflag)
|
1998-09-03 20:51:50 +00:00
|
|
|
{
|
2008-08-04 21:03:06 +00:00
|
|
|
struct iic_softc *sc = dev->si_drv1;
|
|
|
|
device_t iicdev = sc->sc_dev;
|
1998-09-03 20:51:50 +00:00
|
|
|
int len, error = 0;
|
|
|
|
int bufsize;
|
|
|
|
|
2008-08-04 21:03:06 +00:00
|
|
|
IIC_LOCK(sc);
|
|
|
|
if (!sc->sc_addr) {
|
|
|
|
IIC_UNLOCK(sc);
|
1998-09-03 20:51:50 +00:00
|
|
|
return (EINVAL);
|
2008-08-04 21:03:06 +00:00
|
|
|
}
|
1998-09-03 20:51:50 +00:00
|
|
|
|
2008-08-04 21:03:06 +00:00
|
|
|
if (sc->sc_count == 0) {
|
|
|
|
/* XXX: I don't think this can happen. */
|
|
|
|
IIC_UNLOCK(sc);
|
1998-09-03 20:51:50 +00:00
|
|
|
return (EINVAL);
|
2008-08-04 21:03:06 +00:00
|
|
|
}
|
1998-09-03 20:51:50 +00:00
|
|
|
|
2008-08-04 21:03:06 +00:00
|
|
|
error = iicbus_request_bus(device_get_parent(iicdev), iicdev,
|
|
|
|
IIC_DONTWAIT);
|
|
|
|
if (error) {
|
|
|
|
IIC_UNLOCK(sc);
|
1999-02-13 18:01:55 +00:00
|
|
|
return (error);
|
2008-08-04 21:03:06 +00:00
|
|
|
}
|
1999-02-13 18:01:55 +00:00
|
|
|
|
1998-09-03 20:51:50 +00:00
|
|
|
/* max amount of data to read */
|
|
|
|
len = min(uio->uio_resid, BUFSIZE);
|
|
|
|
|
2008-08-04 21:03:06 +00:00
|
|
|
error = iicbus_block_read(device_get_parent(iicdev), sc->sc_addr,
|
|
|
|
sc->sc_inbuf, len, &bufsize);
|
|
|
|
if (error) {
|
|
|
|
IIC_UNLOCK(sc);
|
1998-09-03 20:51:50 +00:00
|
|
|
return (error);
|
2008-08-04 21:03:06 +00:00
|
|
|
}
|
1998-09-03 20:51:50 +00:00
|
|
|
|
|
|
|
if (bufsize > uio->uio_resid)
|
2001-12-10 08:09:49 +00:00
|
|
|
panic("%s: too much data read!", __func__);
|
1998-09-03 20:51:50 +00:00
|
|
|
|
1999-02-13 18:01:55 +00:00
|
|
|
iicbus_release_bus(device_get_parent(iicdev), iicdev);
|
|
|
|
|
2008-08-04 21:03:06 +00:00
|
|
|
error = uiomove(sc->sc_inbuf, bufsize, uio);
|
|
|
|
IIC_UNLOCK(sc);
|
|
|
|
return (error);
|
1998-09-03 20:51:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2004-06-16 09:47:26 +00:00
|
|
|
iicioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td)
|
1998-09-03 20:51:50 +00:00
|
|
|
{
|
2008-08-04 21:03:06 +00:00
|
|
|
struct iic_softc *sc = dev->si_drv1;
|
|
|
|
device_t iicdev = sc->sc_dev;
|
1998-09-03 20:51:50 +00:00
|
|
|
device_t parent = device_get_parent(iicdev);
|
1999-01-09 18:08:24 +00:00
|
|
|
struct iiccmd *s = (struct iiccmd *)data;
|
2006-07-14 23:15:06 +00:00
|
|
|
struct iic_rdwr_data *d = (struct iic_rdwr_data *)data;
|
|
|
|
struct iic_msg *m;
|
|
|
|
int error, count, i;
|
2004-05-16 21:19:59 +00:00
|
|
|
char *buf = NULL;
|
2006-07-14 23:15:06 +00:00
|
|
|
void **usrbufs = NULL;
|
1998-09-03 20:51:50 +00:00
|
|
|
|
2007-03-23 23:08:28 +00:00
|
|
|
if ((error = iicbus_request_bus(parent, iicdev,
|
|
|
|
(flags & O_NONBLOCK) ? IIC_DONTWAIT : (IIC_WAIT | IIC_INTR))))
|
1999-02-13 18:01:55 +00:00
|
|
|
return (error);
|
|
|
|
|
1998-09-03 20:51:50 +00:00
|
|
|
switch (cmd) {
|
|
|
|
case I2CSTART:
|
2008-08-04 21:03:06 +00:00
|
|
|
IIC_LOCK(sc);
|
1999-01-09 18:08:24 +00:00
|
|
|
error = iicbus_start(parent, s->slave, 0);
|
2002-03-23 15:49:15 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Implicitly set the chip addr to the slave addr passed as
|
|
|
|
* parameter. Consequently, start/stop shall be called before
|
|
|
|
* the read or the write of a block.
|
|
|
|
*/
|
|
|
|
if (!error)
|
|
|
|
sc->sc_addr = s->slave;
|
2008-08-04 21:03:06 +00:00
|
|
|
IIC_UNLOCK(sc);
|
2002-03-23 15:49:15 +00:00
|
|
|
|
1998-09-03 20:51:50 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case I2CSTOP:
|
|
|
|
error = iicbus_stop(parent);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case I2CRSTCARD:
|
2006-04-04 17:08:40 +00:00
|
|
|
error = iicbus_reset(parent, IIC_UNKNOWN, 0, NULL);
|
1998-09-03 20:51:50 +00:00
|
|
|
break;
|
|
|
|
|
1999-01-09 18:08:24 +00:00
|
|
|
case I2CWRITE:
|
2004-05-16 21:19:59 +00:00
|
|
|
if (s->count <= 0) {
|
|
|
|
error = EINVAL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
buf = malloc((unsigned long)s->count, M_TEMP, M_WAITOK);
|
|
|
|
error = copyin(s->buf, buf, s->count);
|
|
|
|
if (error)
|
|
|
|
break;
|
|
|
|
error = iicbus_write(parent, buf, s->count, &count, 10);
|
1999-01-09 18:08:24 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case I2CREAD:
|
2004-05-16 21:19:59 +00:00
|
|
|
if (s->count <= 0) {
|
|
|
|
error = EINVAL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
buf = malloc((unsigned long)s->count, M_TEMP, M_WAITOK);
|
|
|
|
error = iicbus_read(parent, buf, s->count, &count, s->last, 10);
|
|
|
|
if (error)
|
|
|
|
break;
|
|
|
|
error = copyout(buf, s->buf, s->count);
|
1999-01-09 18:08:24 +00:00
|
|
|
break;
|
|
|
|
|
2006-07-14 23:15:06 +00:00
|
|
|
case I2CRDWR:
|
|
|
|
buf = malloc(sizeof(*d->msgs) * d->nmsgs, M_TEMP, M_WAITOK);
|
|
|
|
usrbufs = malloc(sizeof(void *) * d->nmsgs, M_TEMP, M_ZERO | M_WAITOK);
|
|
|
|
error = copyin(d->msgs, buf, sizeof(*d->msgs) * d->nmsgs);
|
|
|
|
if (error)
|
|
|
|
break;
|
2006-11-22 06:03:39 +00:00
|
|
|
/* Alloc kernel buffers for userland data, copyin write data */
|
2006-07-14 23:15:06 +00:00
|
|
|
for (i = 0; i < d->nmsgs; i++) {
|
|
|
|
m = &((struct iic_msg *)buf)[i];
|
|
|
|
usrbufs[i] = m->buf;
|
|
|
|
m->buf = malloc(m->len, M_TEMP, M_WAITOK);
|
|
|
|
if (!(m->flags & IIC_M_RD))
|
|
|
|
copyin(usrbufs[i], m->buf, m->len);
|
|
|
|
}
|
2007-03-23 23:08:28 +00:00
|
|
|
error = iicbus_transfer(iicdev, (struct iic_msg *)buf, d->nmsgs);
|
2006-07-14 23:15:06 +00:00
|
|
|
/* Copyout all read segments, free up kernel buffers */
|
|
|
|
for (i = 0; i < d->nmsgs; i++) {
|
|
|
|
m = &((struct iic_msg *)buf)[i];
|
2006-11-22 06:03:39 +00:00
|
|
|
if (m->flags & IIC_M_RD)
|
2006-07-14 23:15:06 +00:00
|
|
|
copyout(m->buf, usrbufs[i], m->len);
|
|
|
|
free(m->buf, M_TEMP);
|
|
|
|
}
|
|
|
|
free(usrbufs, M_TEMP);
|
|
|
|
break;
|
1998-09-03 20:51:50 +00:00
|
|
|
default:
|
2004-05-16 21:19:59 +00:00
|
|
|
error = ENOTTY;
|
1998-09-03 20:51:50 +00:00
|
|
|
}
|
|
|
|
|
2007-03-23 23:08:28 +00:00
|
|
|
iicbus_release_bus(parent, iicdev);
|
1999-02-13 18:01:55 +00:00
|
|
|
|
2004-05-16 21:19:59 +00:00
|
|
|
if (buf != NULL)
|
|
|
|
free(buf, M_TEMP);
|
1998-09-03 20:51:50 +00:00
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
1999-11-08 07:57:03 +00:00
|
|
|
DRIVER_MODULE(iic, iicbus, iic_driver, iic_devclass, 0, 0);
|
2002-03-23 15:49:15 +00:00
|
|
|
MODULE_DEPEND(iic, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER);
|
|
|
|
MODULE_VERSION(iic, 1);
|