audiocmi.h revision af145792def4317aeeb9d20f7772b32a35a0161f
/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Purpose: Driver for CMEDIA CM8738 PCI audio controller.
*/
/*
* 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.
*/
#ifndef _AUDIOCMI_H
#define _AUDIOCMI_H
#define CMEDIA_VENDOR_ID 0x13F6
#define CMEDIA_CM8738 0x0111
#define CMEDIA_CM8338A 0x0100
#define CMEDIA_CM8338B 0x0101
/*
* CM8338 registers definition
*/
#define REG_FUNCTRL0 0x00
#define REG_FUNCTRL1 0x04
#define REG_CHFORMAT 0x08
#define REG_INTCTRL 0x0C
#define REG_INTSTAT 0x10
#define REG_LEGACY 0x14
#define REG_MISC 0x18
#define REG_TDMAPOS 0x1C
#define REG_MIX2 0x24
#define REG_MIX3 0x25
#define REG_VAUX 0x26
#define REG_CH1_PADDR 0x88
#define REG_CH1_BUFSZ 0x8C
#define REG_CH1_FRAGSZ 0x8E
#define REG_SPDIF_STAT 0x90
#define REG_MISC2 0x92
#define FUNCTRL0_CH0_REC BIT(0)
#define CHFORMAT_VER_033 0
#define CHFORMAT_VER_037 1
#define CHFORMAT_CH0_MASK (0x3 << 0)
#define CHFORMAT_CH0_16ST (0x3 << 0)
#define CHFORMAT_CH0_16MO (0x2 << 0)
#define CHFORMAT_CH0_8ST (0x1 << 0)
#define CHFORMAT_CH0_8MO (0x0 << 0)
#define INTSTAT_CH0_INT BIT(0)
#define VAUX_L_MASK 0xf0
#define VAUX_R_MASK 0x0f
/* Indexes via SBINDEX */
#define IDX_MASTER_LEFT 0x30
#define IDX_MASTER_RIGHT 0x31
#define IDX_VOICE_RIGHT 0x33
#define IDX_CDDA_LEFT 0x36
#define IDX_CDDA_RIGHT 0x37
#define IDX_LINEIN_LEFT 0x38
#define IDX_LINEIN_RIGHT 0x39
#define IDX_MIC 0x3A
#define IDX_SPEAKER 0x3B
#define IDX_OUTMIX 0x3C
#define OUTMIX_MIC 0x01
#define OUTMIX_CD_R 0x02
#define OUTMIX_CD_L 0x04
#define OUTMIX_LINE_R 0x08
#define OUTMIX_LINE_L 0x10
#define IDX_INMIX_L 0x3D
#define IDX_INMIX_R 0x3E
#define INMIX_LINE_R 0x08
#define INMIX_LINE_L 0x10
#define INMIX_CD_R 0x20
#define INMIX_CD_L 0x40
#define INMIX_MIC 0x01
#define IDX_IGAIN_L 0x3F
#define IDX_IGAIN_R 0x40
#define IDX_OGAIN_L 0x41
#define IDX_OGAIN_R 0x42
#define IDX_AGC 0x43
#define IDX_TREBLE_L 0x44
#define IDX_TREBLE_R 0x45
#define IDX_BASS_L 0x46
#define IDX_BASS_R 0x47
#define IDX_EXTENSION 0xf0
#define EXTENSION_VADCMIC3 BIT(0)
enum {
SRC_MIC = 0,
};
enum {
CTL_VOLUME = 0,
};
typedef struct cmpci_port cmpci_port_t;
typedef struct cmpci_dev cmpci_dev_t;
typedef struct cmpci_ctrl cmpci_ctrl_t;
struct cmpci_ctrl {
};
struct cmpci_port {
int num;
unsigned fragfr;
unsigned nfrags;
unsigned nframes;
unsigned bufsz;
unsigned nchan;
/* registers & bit masks */
int sync_dir;
void (*callb)(audio_engine_t *);
};
#define PORT_MAX 2
struct cmpci_dev {
int pintrs;
int rintrs;
int model;
#define MDL_CM8738 1
#define MDL_CM8338A 2
#define MDL_CM8338B 3
#define MDL_CM8768 4
int maxch;
};
/*
* The hardware appears to be able to address up to 16-bits worth of samples,
* giving a total address space of 256K. Note, however, that we will restrict
* this further when we do fragment and memory allocation.
*/
#define DEFINTS 175
#define BIT(n) (1U << (n))
#endif /* _AUDIOCMI_H */