tda8444.c revision f47a9c508408507a404eaf38dd597e6ac41f92e6
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* cb ops
*/
/*
* dev ops
*/
void **result);
static struct cb_ops tda8444_cbops = {
tda8444_open, /* open */
tda8444_close, /* close */
nodev, /* strategy */
nodev, /* print */
nodev, /* dump */
tda8444_read, /* read */
tda8444_write, /* write */
nodev, /* 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)() */
};
static struct dev_ops tda8444_ops = {
0,
};
static struct modldrv tda8444_modldrv = {
&mod_driverops, /* type of module - driver */
"tda8444 device driver v%I%",
};
static struct modlinkage tda8444_modlinkage = {
0
};
static void *tda8444_soft_statep;
static int tda8444_debug = 0;
int
_init(void)
{
int error;
if (error == 0) {
(void) ddi_soft_state_init(&tda8444_soft_statep,
sizeof (struct tda8444_unit), TDA8444_MAX_DACS);
}
return (error);
}
int
_fini(void)
{
int error;
if (error == 0) {
}
return (error);
}
int
{
}
/* ARGSUSED */
static int
{
int instance;
if (infocmd == DDI_INFO_DEVT2INSTANCE) {
return (DDI_SUCCESS);
}
return (DDI_FAILURE);
}
static int
{
struct tda8444_unit *unitp;
int channel;
int ret = DDI_SUCCESS;
unitp = (struct tda8444_unit *)
return (ENXIO);
}
ret = DDI_FAILURE;
}
}
unitp->tda8444_flags = 0;
return (ret);
}
static int
{
struct tda8444_unit *unitp;
char name[MAXNAMELEN];
int instance;
int i;
return (DDI_FAILURE);
}
return (DDI_FAILURE);
}
for (i = 0; i < TDA8444_CHANS; i++) {
minor = TDA8444_CHANNEL_TO_MINOR(i) |
return (DDI_FAILURE);
}
}
/*
* preallocate a single buffer for all writes
*/
return (DDI_FAILURE);
}
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
static int
{
switch (cmd) {
case DDI_ATTACH:
return (tda8444_do_attach(dip));
case DDI_RESUME:
return (tda8444_do_resume(dip));
default:
return (DDI_FAILURE);
}
}
static int
{
struct tda8444_unit *unitp;
int instance;
return (DDI_SUCCESS);
}
static int
{
struct tda8444_unit *unitp;
int instance;
/*
* Set the busy flag so that future transactions block
* until resume.
*/
&unitp->tda8444_mutex) <= 0) {
return (DDI_FAILURE);
}
}
return (DDI_SUCCESS);
}
static int
{
switch (cmd) {
case DDI_DETACH:
return (tda8444_do_detach(dip));
case DDI_SUSPEND:
return (tda8444_do_suspend(dip));
default:
return (DDI_FAILURE);
}
}
static int
{
struct tda8444_unit *unitp;
int err = 0;
if (instance < 0) {
return (ENXIO);
}
unitp = (struct tda8444_unit *)
return (ENXIO);
}
return (EINVAL);
}
} else {
}
} else {
} else {
}
}
return (err);
}
static int
{
struct tda8444_unit *unitp;
if (instance < 0) {
return (ENXIO);
}
unitp = (struct tda8444_unit *)
return (ENXIO);
}
return (DDI_SUCCESS);
}
static int
{
}
static int
{
}
static int
{
struct tda8444_unit *unitp;
int ret = 0;
if (instance < 0) {
return (ENXIO);
}
if (len == 0) {
return (0);
}
unitp = (struct tda8444_unit *)
return (ENXIO);
}
} else {
return (EIO);
}
}
/*
* rw == B_WRITE. Make sure each write to a device is single
* threaded since we pre-allocate a single write buffer. This is not a
* bottleneck since concurrent writes would serialize at the
* transport level anyway.
*/
return (EAGAIN);
}
&unitp->tda8444_mutex) <= 0) {
return (EINTR);
}
}
uiop)) == 0) {
/*
* Check bounds
*/
if ((out_value > TDA8444_MAX_OUT) ||
(out_value < TDA8444_MIN_OUT)) {
} else {
} else {
}
}
} else {
}
unitp->tda8444_flags = 0;
return (ret);
}