/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
static void *pcf8574soft_statep;
static int pcf8574_do_attach(dev_info_t *);
static int pcf8574_do_detach(dev_info_t *);
static int pcf8574_do_resume(void);
static int pcf8574_do_suspend(void);
/*
* cb ops (only need ioctl)
*/
pcf8574_open, /* open */
pcf8574_close, /* close */
nodev, /* strategy */
nodev, /* print */
nodev, /* dump */
nodev, /* read */
nodev, /* write */
pcf8574_ioctl, /* ioctl */
nodev, /* devmap */
nodev, /* mmap */
nodev, /* segmap */
nochpoll, /* poll */
ddi_prop_op, /* cb_prop_op */
NULL, /* streamtab */
CB_REV, /* rev */
nodev, /* int (*cb_aread)() */
nodev /* int (*cb_awrite)() */
};
/*
* dev ops
*/
0,
NULL, /* bus_ops */
NULL, /* power */
ddi_quiesce_not_needed, /* quiesce */
};
extern struct mod_ops mod_driverops;
&mod_driverops, /* type of module - driver */
"PCF8574 i2c device driver",
};
0
};
int
_init(void)
{
int error;
if (!error)
(void) ddi_soft_state_init(&pcf8574soft_statep,
sizeof (struct pcf8574_unit), 1);
return (error);
}
int
_fini(void)
{
int error;
if (!error)
return (error);
}
int
{
}
static int
{
struct pcf8574_unit *unitp;
int instance;
int error = 0;
if (instance < 0) {
return (ENXIO);
}
unitp = (struct pcf8574_unit *)
return (ENXIO);
}
return (EINVAL);
}
if (unitp->pcf8574_oflag != 0) {
} else {
}
} else {
} else {
}
}
return (error);
}
static int
{
struct pcf8574_unit *unitp;
int instance;
if (instance < 0) {
return (ENXIO);
}
unitp = (struct pcf8574_unit *)
return (ENXIO);
}
unitp->pcf8574_oflag = 0;
return (DDI_SUCCESS);
}
static int
0, 1, I2C_SLEEP);
if (i2c_tran_pointer == NULL) {
"i2c_tran_pointer not allocated\n",
unitp->pcf8574_name));
return (ENOMEM);
}
if (err) {
unitp->pcf8574_name));
return (err);
}
i2c_tran_pointer->i2c_rbuf[0]));
return (err);
}
static int
1, 0, I2C_SLEEP);
if (i2c_tran_pointer == NULL) {
"i2c_tran_pointer not allocated\n",
unitp->pcf8574_name));
return (ENOMEM);
}
i2c_tran_pointer->i2c_wbuf[0]));
if (err) {
" i2c_transfer routine\n",
unitp->pcf8574_name));
return (err);
}
return (err);
}
static int
{
struct pcf8574_unit *unitp;
int instance;
int err = 0;
"= NULL\n"));
return (err);
}
unitp = (struct pcf8574_unit *)
return (ENOMEM);
}
switch (cmd) {
case I2C_GET_PORT:
" ddi_copyin routine\n",
unitp->pcf8574_name));
break;
}
if (err != I2C_SUCCESS) {
" pcf8574_get routine\n",
unitp->pcf8574_name));
break;
}
"ddi_copyout routine\n",
unitp->pcf8574_name));
}
byte));
break;
case I2C_SET_PORT:
"ddi_cpoyin routine\n",
unitp->pcf8574_name));
break;
}
if (err != I2C_SUCCESS) {
" pcf8574_set routine\n",
unitp->pcf8574_name));
break;
}
break;
case I2C_GET_BIT:
" ddi_copyin routine\n",
unitp->pcf8574_name));
break;
}
" was not between 0 and 7\n",
unitp->pcf8574_name));
break;
}
if (err != I2C_SUCCESS) {
" pcf8574_get routine\n",
unitp->pcf8574_name));
break;
}
" ddi_copyout routine\n",
unitp->pcf8574_name));
}
break;
case I2C_SET_BIT:
" ddi_copyin routine\n",
unitp->pcf8574_name));
break;
}
" in was not between 0 and 7",
unitp->pcf8574_name));
break;
}
if (err != I2C_SUCCESS) {
" pcf8574_get routine\n",
unitp->pcf8574_name));
break;
}
if (err != I2C_SUCCESS) {
" pcf8574_set routine\n",
unitp->pcf8574_name));
break;
}
break;
default:
}
return (err);
}
static int
{
switch (cmd) {
case DDI_ATTACH:
return (pcf8574_do_attach(dip));
case DDI_RESUME:
return (pcf8574_do_resume());
default:
return (DDI_FAILURE);
}
}
static int
{
switch (cmd) {
case DDI_DETACH:
return (pcf8574_do_detach(dip));
case DDI_SUSPEND:
return (pcf8574_do_suspend());
default:
return (DDI_FAILURE);
}
}
static int
{
int instance;
return (DDI_FAILURE);
}
return (ENOMEM);
}
return (DDI_FAILURE);
}
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
static int
{
return (ret);
}
static int
{
return (ret);
}
static int
{
int instance;
return (ENOMEM);
}
return (DDI_SUCCESS);
}