/*
* 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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Purpose: Driver for the Creative P16X AC97 audio controller
*/
/*
*
* Copyright (C) 4Front Technologies 1996-2009.
*
* This software is released under CDDL 1.0 source license.
* See the COPYING file included in the main directory of this source
* distribution for the license terms and conditions.
*/
#include "audiop16x.h"
/*
* These boards use an AC'97 codec, but don't have all of the
* various outputs that the AC'97 codec can offer. We just
* suppress them for now.
*/
static char *p16x_remove_ac97[] = {
};
};
};
DMA_ATTR_V0, /* version number */
0x00000000, /* low DMA address range */
0xffffffff, /* high DMA address range */
0xfffffffe, /* DMA counter register */
4, /* DMA address alignment */
0x3c, /* DMA burstsizes */
4, /* min effective DMA size */
0xffffffff, /* max DMA xfer size */
0xffffffff, /* segment boundary */
1, /* s/g length */
4, /* granularity of device */
0 /* Bus specific DMA flags */
};
static int p16x_attach(dev_info_t *);
static int p16x_resume(dev_info_t *);
static int p16x_detach(p16x_dev_t *);
static int p16x_suspend(p16x_dev_t *);
static void p16x_close(void *);
static int p16x_start(void *);
static void p16x_stop(void *);
static int p16x_format(void *);
static int p16x_channels(void *);
static int p16x_rate(void *);
static uint64_t p16x_count(void *);
static void p16x_sync(void *, unsigned);
static void p16x_chinfo(void *, int, unsigned *, unsigned *);
static int p16x_alloc_port(p16x_dev_t *, int);
static void p16x_destroy(p16x_dev_t *);
static void p16x_hwinit(p16x_dev_t *);
NULL,
};
static unsigned int
{
unsigned int val;
return (val);
}
static void
{
}
static void
{
unsigned int val;
}
static void
{
unsigned int val;
}
static uint16_t
{
int i;
for (i = 0; i < 10000; i++)
break;
return (value);
}
static void
{
unsigned int i;
for (i = 0; i < 10000; i++)
break;
}
/*
* Audio routines
*/
int
{
return (0);
}
void
{
}
int
{
/* Enable rec channel */
} else {
for (int i = 0; i < 3; i++) {
}
/* Enable play channel */
}
return (0);
}
void
{
/* Disable rec channel */
} else {
/* Disable Play channel */
}
}
int
{
return (AUDIO_FORMAT_S16_LE);
}
int
{
}
int
{
return (48000);
}
void
{
}
{
} else {
}
/* get the offset, and switch to frames */
} else {
}
return (val);
}
static void
{
unsigned mult;
switch (chan) {
case 0: /* left front */
case 1: /* right front */
mult = 0;
break;
case 2: /* center */
case 3: /* lfe */
mult = 2;
break;
case 4: /* left surround */
case 5: /* right surround */
mult = 1;
break;
}
*incr = 2;
} else {
*incr = 2;
}
}
/* private implementation bits */
int
{
int dir;
unsigned caps;
switch (num) {
case P16X_REC:
dir = DDI_DMA_READ;
break;
case P16X_PLAY:
dir = DDI_DMA_WRITE;
break;
default:
return (DDI_FAILURE);
}
/*
* NB: The device operates in pairs of dwords at a time, for
* performance reasons. So make sure that our buffer is
* arranged as a whole number of these. The value below gives
* a reasonably large buffer so we can support a deep
* playahead if we need to (and we should avoid input
* overruns.)
*/
/* now allocate buffers */
return (DDI_FAILURE);
}
return (DDI_FAILURE);
}
&count) != DDI_SUCCESS) {
return (DDI_FAILURE);
}
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
void
{
for (int i = 0; i < P16X_NUM_PORT; i++) {
if (!port)
continue;
}
}
}
}
}
}
}
}
}
}
void
{
int i;
for (i = 0; i < 3; i++) {
}
/* Set physical address of the DMA buffer */
/* Set physical address of the DMA buffer */
/* Clear any pending interrupts */
}
int
{
goto error;
}
goto error;
}
if (vendor != CREATIVE_VENDOR_ID ||
device != SB_P16X_ID) {
goto error;
}
/* set PCI command register */
goto error;
}
goto error;
}
goto error;
}
/* remove the AC'97 controls we don't want to expose */
for (int i = 0; p16x_remove_ac97[i]; i++) {
}
}
goto error;
}
return (DDI_SUCCESS);
return (DDI_FAILURE);
}
int
{
return (DDI_SUCCESS);
}
int
{
return (DDI_FAILURE);
return (DDI_SUCCESS);
}
int
{
return (DDI_SUCCESS);
}
static int p16x_ddi_quiesce(dev_info_t *);
DEVO_REV, /* rev */
0, /* refcnt */
NULL, /* getinfo */
nulldev, /* identify */
nulldev, /* probe */
p16x_ddi_attach, /* attach */
p16x_ddi_detach, /* detach */
nodev, /* reset */
NULL, /* cb_ops */
NULL, /* bus_ops */
NULL, /* power */
p16x_ddi_quiesce, /* quiesce */
};
&mod_driverops, /* drv_modops */
"Creative P16X Audio", /* linkinfo */
&p16x_dev_ops, /* dev_ops */
};
{ &p16x_modldrv, NULL }
};
int
_init(void)
{
int rv;
}
return (rv);
}
int
_fini(void)
{
int rv;
}
return (rv);
}
int
{
}
int
{
switch (cmd) {
case DDI_ATTACH:
return (p16x_attach(dip));
case DDI_RESUME:
return (p16x_resume(dip));
default:
return (DDI_FAILURE);
}
}
int
{
switch (cmd) {
case DDI_DETACH:
return (p16x_detach(dev));
case DDI_SUSPEND:
return (p16x_suspend(dev));
default:
return (DDI_FAILURE);
}
}
int
{
return (DDI_SUCCESS);
}