lm75.c revision 686928d476b99b8b21fe0d4ae0ddcc1936cd0bd6
/*
* 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 *lm75soft_statep;
static int lm75_do_attach(dev_info_t *);
static int lm75_do_detach(dev_info_t *);
static int lm75_do_resume(void);
static int lm75_do_suspend(void);
/*
* cb ops (only need ioctl)
*/
static struct cb_ops lm75_cbops = {
lm75_open, /* open */
lm75_close, /* close */
nodev, /* strategy */
nodev, /* print */
nodev, /* dump */
nodev, /* read */
nodev, /* write */
lm75_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;
static struct modldrv lm75_modldrv = {
&mod_driverops, /* type of module - driver */
"LM75 i2c device driver",
};
static struct modlinkage lm75_modlinkage = {
0
};
int
_init(void)
{
int error;
if (!error)
(void) ddi_soft_state_init(&lm75soft_statep,
sizeof (struct lm75_unit), 1);
return (error);
}
int
_fini(void)
{
int error;
if (!error)
return (error);
}
int
{
}
static int
{
int instance;
int error = 0;
if (instance < 0) {
return (ENXIO);
}
return (ENXIO);
}
return (EINVAL);
}
if (unitp->lm75_oflag != 0) {
} else {
}
} else {
} else {
}
}
return (error);
}
static int
{
int instance;
if (instance < 0) {
return (ENXIO);
}
return (ENXIO);
}
unitp->lm75_oflag = 0;
return (DDI_SUCCESS);
}
static int
int err = DDI_SUCCESS;
if (i2c_tran_pointer == NULL) {
"i2c_tran_pointer not allocated\n",
return (ENOMEM);
}
if (err) {
"i2c_transfer routine\n",
return (err);
}
i2c_tran_pointer->i2c_rbuf[0]));
if (temp16 & LM75_COMP_MASK) {
} else {
}
"ddi_copyout routine\n",
}
return (err);
}
static int
int err = DDI_SUCCESS;
"ddi_copyin routine\n",
return (EFAULT);
}
3, 0, I2C_SLEEP);
if (i2c_tran_pointer == NULL) {
"i2c_tran_pointer not allocated\n",
return (ENOMEM);
}
/* BEGIN CSTYLED */
/*
* The temperature is 16bits where the top 9 are a twos-complement
* word with the the least significant bit used to indicate 0.5C
*
* |15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0|
* |-----------------------------------------------|
* |+-| Temperature | Unused |
*/
/* END CSTYLED */
return (err);
}
static int
int *rvalp)
{
int instance;
int err = 0;
"= NULL\n"));
return (err);
}
return (err);
}
switch (cmd) {
case I2C_GET_TEMPERATURE:
break;
case LM75_GET_HYST:
break;
case LM75_SET_HYST:
break;
break;
break;
case LM75_GET_CONFIG:
if (i2c_tran_pointer == NULL) {
"i2c_tran_pointer not allocated\n",
break;
}
if (err) {
"i2c_transfer routine\n",
break;
}
"ddi_copyout routine\n",
}
break;
case LM75_SET_CONFIG:
"ddi_copyin routine\n",
break;
}
2, 0, I2C_SLEEP);
if (i2c_tran_pointer == NULL) {
"i2c_tran_pointer not allocated\n",
break;
}
break;
default:
}
return (err);
}
static int
{
switch (cmd) {
case DDI_ATTACH:
return (lm75_do_attach(dip));
case DDI_RESUME:
return (lm75_do_resume());
default:
return (DDI_FAILURE);
}
}
static int
{
switch (cmd) {
case DDI_DETACH:
return (lm75_do_detach(dip));
case DDI_SUSPEND:
return (lm75_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
lm75_do_resume(void)
{
int ret = DDI_SUCCESS;
return (ret);
}
static int
{
int ret = DDI_SUCCESS;
return (ret);
}
static int
{
int instance;
return (ENOMEM);
}
return (DDI_SUCCESS);
}