/*
* 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.
*/
/*
*
* This driver is used with the original Ensoniq AudioPCI.
*/
/*
* This file is part of Open Sound System
*
* Copyright (C) 4Front Technologies 1996-2008.
*
* 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 "audiopci.h"
/*
* The original OSS driver used a single duplex engine and a separate
* playback only engine. Instead, we expose three engines, one for input
* and two for output.
*/
#define INPUT_MIC 0
static const char *audiopci_insrcs[] = {
};
typedef struct audiopci_port
{
/* Audio parameters */
int speed;
int fmt;
int num;
#define PORT_DAC 0
unsigned nframes;
unsigned frameno;
typedef enum {
CTL_VOLUME = 0,
typedef struct audiopci_ctrl
{
typedef struct audiopci_dev
{
int micbias;
/*
* Controls
*/
#if 0
#endif
};
};
/*
* The hardware appears to be able to address up to 16-bits worth of longwords,
* giving a total address space of 256K. But we need substantially less.
*/
DMA_ATTR_VERSION, /* dma_attr_version */
0x0, /* dma_attr_addr_lo */
0xffffffffU, /* dma_attr_addr_hi */
0x3ffff, /* dma_attr_count_max */
0x8, /* dma_attr_align */
0x7f, /* dma_attr_burstsizes */
0x1, /* dma_attr_minxfer */
0x3ffff, /* dma_attr_maxxfer */
0x3ffff, /* dma_attr_seg */
0x1, /* dma_attr_sgllen */
0x1, /* dma_attr_granular */
0 /* dma_attr_flags */
};
static void audiopci_init_hw(audiopci_dev_t *);
static void audiopci_init_port(audiopci_port_t *);
static uint16_t audiopci_dac_rate(int);
static int audiopci_add_controls(audiopci_dev_t *);
static void audiopci_del_controls(audiopci_dev_t *);
static int
{
for (int i = 4000; i; i--) {
return (DDI_SUCCESS);
drv_usecwait(10);
}
return (DDI_FAILURE);
}
static void
{
for (int i = 0; i < 5; i++) {
return;
}
}
static void
{
/* shadow the value */
/* wait for codec to be available */
}
}
static void
{
/* Select memory page */
}
static uint32_t
{
}
/*
* Audio routines
*/
static int
{
return (AUDIO_FORMAT_S16_LE);
}
static int
{
return (2);
}
static int
{
}
static void
{
unsigned tmp;
case PORT_DAC:
/* Set physical address of the DMA buffer */
/* Set DAC rate */
/* Set format */
/* Set the frame count */
/* Set # of frames between interrupts */
break;
case PORT_SYN:
/* Set physical address of the DMA buffer */
/* Set rate - we force to 44.1 kHz */
/* Set format */
/* Set the frame count */
/* Set # of frames between interrupts */
break;
case PORT_ADC:
/* Set physical address of the DMA buffer */
/* Set ADC rate */
/* Set format - for input we only support 16 bit input */
/* Set the frame count */
/* Set # of frames between interrupts */
break;
}
}
static int
{
/* NB: frame size = 4 (16-bit stereo) */
return (0);
}
static int
{
case PORT_DAC:
break;
case PORT_SYN:
break;
case PORT_ADC:
break;
}
return (0);
}
static void
{
case PORT_DAC:
break;
case PORT_SYN:
break;
case PORT_ADC:
break;
}
}
static uint64_t
{
int frameno, n;
case PORT_DAC:
break;
case PORT_SYN:
break;
case PORT_ADC:
break;
}
/*
* Note that the current frame counter is in the high nybble.
*/
return (val);
}
static void
{
}
static void
{
} else {
}
}
AUDIO_ENGINE_VERSION, /* version number */
NULL,
NULL,
NULL,
};
static uint16_t
{
unsigned short usTemp;
/* samPerSec /= 2; */
if (usTemp & 0x00000001) {
usTemp >>= 1;
usTemp -= 1;
} else {
usTemp >>= 1;
usTemp -= 2;
}
return (usTemp);
}
void
{
int tmp;
/* setup DAC frequency */
/* Turn on CODEC (UART and joystick left disabled) */
/* Reset the UART */
/* Disable NMI */
/* Initialize serial interface */
/* Unmute codec */
/* mixer initialization */
drv_usecwait(10);
/* now powerup and bring out of reset */
/* enable PLL for DAC2 */
/* select input mixer */
/* mark FM for output mixer */
/* initialize some reasonable values for the WAVE and SYNTH inputs */
/* enable microphone phantom power */
}
}
static int
{
for (int i = 0; i <= PORT_MAX; i++) {
unsigned caps;
unsigned dmaflags;
unsigned ccnt;
switch (i) {
case PORT_SYN:
break;
case PORT_DAC:
break;
case PORT_ADC:
break;
}
/*
* Allocate DMA resources.
*/
"port %d: dma handle allocation failed", i);
return (DDI_FAILURE);
}
"port %d: dma memory allocation failed", i);
return (DDI_FAILURE);
}
/* ensure that the buffer is zeroed out properly */
&c, &ccnt) != DDI_DMA_MAPPED) {
"port %d: dma binding failed", i);
return (DDI_FAILURE);
}
/*
* Allocate and configure audio engine.
*/
"port %d: audio_engine_alloc failed", i);
return (DDI_FAILURE);
}
}
/*
* Register audio controls.
*/
return (DDI_FAILURE);
}
"unable to register with audio framework");
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
static void
{
int i;
/* free up ports, including DMA resources for ports */
for (i = 0; i <= PORT_MAX; i++) {
}
}
}
}
}
static void
{
/* convert to attenuation & apply mute if appropriate */
}
static void
{
}
static void
{
}
static int
{
return (0);
}
static void
{
/* front & mono outputs */
/* setup output monitoring as well */
}
static void
{
tmp = 0;
tmp = 0;
tmp = 0;
tmp = 0;
/* configure volumes */
/* activate 30dB mic boost */
}
static int
{
uint8_t l;
uint8_t r;
r = val & 0xff;
if ((l > 100) || (r > 100))
return (EINVAL);
return (0);
}
static int
{
return (0);
}
static int
{
return (EINVAL);
return (0);
}
static int
{
return (EINVAL);
return (0);
}
static int
{
val &= 0xff;
if (val > 100)
return (EINVAL);
return (0);
}
static int
{
uint8_t l;
uint8_t r;
r = val & 0xff;
if ((l > 100) || (r > 100))
return (EINVAL);
return (0);
}
static int
{
val &= 0xff;
if (val > 100)
return (EINVAL);
return (0);
}
static void
{
switch (num) {
case CTL_VOLUME:
desc.acd_minvalue = 0;
break;
case CTL_FRONT:
desc.acd_minvalue = 0;
break;
case CTL_MONO:
desc.acd_minvalue = 0;
break;
case CTL_MIC:
desc.acd_minvalue = 0;
break;
case CTL_LINE:
desc.acd_minvalue = 0;
break;
case CTL_CD:
desc.acd_minvalue = 0;
break;
case CTL_VID:
desc.acd_minvalue = 0;
break;
case CTL_PHONE:
desc.acd_minvalue = 0;
break;
case CTL_RECSRC:
for (int i = 0; audiopci_insrcs[i]; i++) {
}
break;
case CTL_MONSRC:
for (int i = 0; audiopci_insrcs[i]; i++) {
}
break;
case CTL_MICBOOST:
desc.acd_minvalue = 0;
break;
}
}
static int
{
return (DDI_SUCCESS);
}
static void
{
for (int i = 0; i < CTL_NUM; i++) {
}
}
}
static int
{
return (DDI_FAILURE);
}
(device != ENSONIQ_ES1370))
goto err_exit;
goto err_exit;
}
/* activate the device */
/* map registers */
goto err_exit;
}
/* This allocates and configures the engines */
goto err_exit;
}
return (DDI_SUCCESS);
return (DDI_FAILURE);
}
static int
{
int tmp;
/* first unregister us from the DDI framework, might be busy */
return (DDI_FAILURE);
return (DDI_SUCCESS);
}
static int
{
/* reinitialize hardware */
return (DDI_SUCCESS);
}
static int
{
return (DDI_SUCCESS);
}
static int
{
return (DDI_FAILURE);
}
/* This disables all DMA engines and interrupts */
return (DDI_SUCCESS);
}
static int
{
switch (cmd) {
case DDI_ATTACH:
return (audiopci_attach(dip));
case DDI_RESUME:
return (DDI_FAILURE);
}
return (audiopci_resume(dev));
default:
return (DDI_FAILURE);
}
}
static int
{
return (DDI_FAILURE);
}
switch (cmd) {
case DDI_DETACH:
return (audiopci_detach(dev));
case DDI_SUSPEND:
return (audiopci_suspend(dev));
default:
return (DDI_FAILURE);
}
}
DEVO_REV, /* rev */
0, /* refcnt */
NULL, /* getinfo */
nulldev, /* identify */
nulldev, /* probe */
audiopci_ddi_attach, /* attach */
audiopci_ddi_detach, /* detach */
nodev, /* reset */
NULL, /* cb_ops */
NULL, /* bus_ops */
NULL, /* power */
audiopci_quiesce, /* quiesce */
};
&mod_driverops, /* drv_modops */
"Ensoniq 1370 Audio", /* linkinfo */
&audiopci_dev_ops, /* dev_ops */
};
{ &audiopci_modldrv, NULL }
};
int
_init(void)
{
int rv;
}
return (rv);
}
int
_fini(void)
{
int rv;
}
return (rv);
}
int
{
}