/*
* 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 *ssc100soft_statep;
static int ssc100_do_attach(dev_info_t *);
static int ssc100_do_detach(dev_info_t *);
static int ssc100_do_resume(void);
static int ssc100_do_suspend(void);
/*
* cb ops (only need ioctl)
*/
ssc100_open, /* open */
ssc100_close, /* close */
nodev, /* strategy */
nodev, /* print */
nodev, /* dump */
ssc100_read, /* read */
ssc100_write, /* write */
ssc100_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,
NULL,
ddi_quiesce_not_needed, /* quiesce */
};
extern struct mod_ops mod_driverops;
&mod_driverops, /* type of module - driver */
"SSC100 i2c device driver",
};
0
};
int
_init(void)
{
int error;
if (!error)
(void) ddi_soft_state_init(&ssc100soft_statep,
sizeof (struct ssc100_unit), 1);
return (error);
}
int
_fini(void)
{
int error;
if (!error)
return (error);
}
int
{
}
static int
{
struct ssc100_unit *unitp;
int instance;
int error = 0;
if (instance < 0) {
return (ENXIO);
}
unitp = (struct ssc100_unit *)
return (ENXIO);
}
return (EINVAL);
}
if (unitp->ssc100_oflag != 0) {
} else {
}
} else {
} else {
}
}
return (error);
}
static int
{
struct ssc100_unit *unitp;
int instance;
if (instance < 0) {
return (ENXIO);
}
unitp = (struct ssc100_unit *)
return (ENXIO);
}
unitp->ssc100_oflag = 0;
return (DDI_SUCCESS);
}
static int
{
if (i2c_tran_pointer == NULL) {
"i2c_tran_pointer not allocated",
unitp->ssc100_name));
return (ENOMEM);
}
}
if (err) {
}
return (err);
}
static int
{
if (err) {
}
return (err);
}
static int
{
if (err) {
}
return (err);
}
static int
{
if (err) {
}
return (err);
}
static int
{
struct ssc100_unit *unitp;
int instance;
int err = 0;
"= NULL"));
return (err);
}
unitp = (struct ssc100_unit *)
return (ENOMEM);
}
switch (cmd) {
case I2C_GET_PORT:
break;
}
if (err != I2C_SUCCESS) {
break;
}
}
byte));
break;
case I2C_SET_PORT:
break;
}
if (err != I2C_SUCCESS) {
break;
}
break;
case I2C_GET_BIT:
break;
}
" was not between 0 and 7",
unitp->ssc100_name));
break;
}
if (err != I2C_SUCCESS) {
break;
}
}
break;
case I2C_SET_BIT:
break;
}
" in was not between 0 and 7",
unitp->ssc100_name));
break;
}
if (err != I2C_SUCCESS) {
break;
}
if (err != I2C_SUCCESS) {
break;
}
break;
case I2C_GET_REG:
break;
}
}
break;
default:
}
return (err);
}
static int
{
switch (cmd) {
case DDI_ATTACH:
return (ssc100_do_attach(dip));
case DDI_RESUME:
return (ssc100_do_resume());
default:
return (DDI_FAILURE);
}
}
static int
{
switch (cmd) {
case DDI_DETACH:
return (ssc100_do_detach(dip));
case DDI_SUSPEND:
return (ssc100_do_suspend());
default:
return (DDI_FAILURE);
}
}
static int
{
int instance;
return (DDI_FAILURE);
}
return (ENOMEM);
}
return (DDI_FAILURE);
}
/*
* If we had different sizes in the future, this could be read
* from a property.
*/
DDI_PROP_CANSLEEP, "size",
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
static int
{
return (ret);
}
static int
{
return (ret);
}
static int
{
int instance;
return (DDI_SUCCESS);
}
static int
{
}
static int
{
}
static int
{
int ssc100_addr;
int bytes_to_rw;
int err = 0;
int current_xfer_len;
if (instance < 0) {
return (ENXIO);
}
unitp = (struct ssc100_unit *)
return (ENXIO);
}
/*
* Exceeded ssc100 size.
*/
return (ENOSPC);
}
return (0);
}
return (0);
}
"i2c_tran_pointer not allocated",
unitp->ssc100_name));
return (ENOMEM);
}
goto end;
}
I2C_SUCCESS) {
goto end;
}
} else {
/*
* SSC100 read. We need to first write out the address
* that we wish to read.
*/
"i2c_tran_pointer not allocated",
unitp->ssc100_name));
return (ENOMEM);
}
I2C_SUCCESS) {
goto end;
}
goto end;
}
}
end:
return (err);
}