ltc1427.c revision 88294e09b5c27cbb12b6735e2fb247a86b76666d
/*
* 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 *ltc1427soft_statep;
static int ltc1427_do_attach(dev_info_t *);
static int ltc1427_do_detach(dev_info_t *);
static int ltc1427_do_resume(void);
static int ltc1427_do_suspend(void);
/*
* cb ops (only need ioctl)
*/
static struct cb_ops ltc1427_cbops = {
ltc1427_open, /* open */
ltc1427_close, /* close */
nodev, /* strategy */
nodev, /* print */
nodev, /* dump */
nodev, /* read */
nodev, /* write */
ltc1427_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
*/
static struct dev_ops ltc1427_ops = {
0,
NULL,
NULL,
ddi_quiesce_not_needed, /* quiesce */
};
extern struct mod_ops mod_driverops;
static struct modldrv ltc1427_modldrv = {
&mod_driverops, /* type of module - driver */
"LTC1427 i2c device driver",
};
static struct modlinkage ltc1427_modlinkage = {
0
};
int
_init(void)
{
int error;
if (!error)
(void) ddi_soft_state_init(<c1427soft_statep,
sizeof (struct ltc1427_unit), 1);
return (error);
}
int
_fini(void)
{
int error;
if (!error)
return (error);
}
int
{
}
static int
{
struct ltc1427_unit *unitp;
int instance;
int error = 0;
if (instance < 0) {
return (ENXIO);
}
unitp = (struct ltc1427_unit *)
return (ENXIO);
}
return (EINVAL);
}
if (unitp->ltc1427_oflag != 0) {
} else {
}
} else {
} else {
}
}
return (error);
}
static int
{
struct ltc1427_unit *unitp;
int instance;
if (instance < 0) {
return (ENXIO);
}
unitp = (struct ltc1427_unit *)
return (ENXIO);
}
unitp->ltc1427_oflag = 0;
return (DDI_SUCCESS);
}
static int
{
struct ltc1427_unit *unitp;
int instance;
int err = 0;
"= NULL\n"));
return (err);
}
unitp = (struct ltc1427_unit *)
switch (cmd) {
case I2C_GET_OUTPUT:
if (unitp->current_set_flag == 0) {
break;
} else {
mode) != DDI_SUCCESS) {
"%s: Failed in I2C_GET_OUTPUT "
"ddi_copyout routine\n",
unitp->ltc1427_name));
break;
}
}
break;
case I2C_SET_OUTPUT:
"%s: Failed in I2C_SET_OUTPUT "
"ioctl before switch\n",
unitp->ltc1427_name));
break;
}
if (i2c_tran_pointer == NULL) {
"%s: Failed in I2C_SET_OUTPUT "
"i2c_transfer_pointer not allocated\n",
unitp->ltc1427_name));
break;
}
i2c_tran_pointer->i2c_wbuf[0] =
if (!err) {
}
break;
default:
}
return (err);
}
static int
{
switch (cmd) {
case DDI_ATTACH:
return (ltc1427_do_attach(dip));
case DDI_RESUME:
return (ltc1427_do_resume());
default:
return (DDI_FAILURE);
}
}
static int
{
switch (cmd) {
case DDI_DETACH:
return (ltc1427_do_detach(dip));
case DDI_SUSPEND:
return (ltc1427_do_suspend());
default:
return (DDI_FAILURE);
}
}
static int
{
struct ltc1427_unit *unitp;
int instance;
return (DDI_FAILURE);
}
return (ENOMEM);
}
return (DDI_FAILURE);
}
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
static int
{
int ret = DDI_SUCCESS;
return (ret);
}
static int
{
int ret = DDI_SUCCESS;
return (ret);
}
static int
{
struct ltc1427_unit *unitp;
int instance;
return (ENOMEM);
}
return (DDI_SUCCESS);
}