2005-07-29 12:58:59 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 by Christian Gmeiner
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2005-07-29 12:58:59 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _TLV320_H_
|
|
|
|
#define _TLV320_H_
|
|
|
|
|
2006-12-06 13:34:15 +00:00
|
|
|
#define VOLUME_MIN -730
|
|
|
|
#define VOLUME_MAX 60
|
|
|
|
|
2006-12-06 13:48:50 +00:00
|
|
|
extern int tenthdb2master(int db);
|
2006-12-06 13:34:15 +00:00
|
|
|
|
2005-07-29 12:58:59 +00:00
|
|
|
/*** definitions ***/
|
|
|
|
|
2006-11-06 18:07:30 +00:00
|
|
|
/**
|
|
|
|
* Sets internal sample rate for DAC and ADC relative to MCLK
|
|
|
|
* Selection for frequency:
|
|
|
|
* Fs: tlv: with:
|
|
|
|
* 11025: 0 = MCLK/2 MCLK/2 SCLK, LRCK: Audio Clk / 16
|
|
|
|
* 22050: 0 = MCLK/2 MCLK SCLK, LRCK: Audio Clk / 8
|
|
|
|
* 44100: 1 = MCLK MCLK SCLK, LRCK: Audio Clk / 4 (default)
|
|
|
|
* 88200: 2 = MCLK*2 MCLK SCLK, LRCK: Audio Clk / 2
|
|
|
|
*/
|
2006-12-06 10:24:59 +00:00
|
|
|
extern void audiohw_set_frequency(unsigned fsel);
|
|
|
|
extern void audiohw_set_headphone_vol(int vol_l, int vol_r);
|
2005-07-29 12:58:59 +00:00
|
|
|
|
|
|
|
#define HEADPHONE_MUTE 0x30 /* 0110000 = -73db */
|
|
|
|
|
|
|
|
/* ToDo: samplerates */
|
|
|
|
|
|
|
|
/* registers */
|
|
|
|
/* REG_LLIV: Left line input channel volume control */
|
|
|
|
#define REG_LLIV 0x0
|
2006-03-28 20:35:08 +00:00
|
|
|
#define LLIV_LRS (1 << 8) /* simultaneous volume/mute update */
|
2005-08-06 10:12:19 +00:00
|
|
|
#define LLIV_LIM (1 << 7) /* Left line input mute */
|
2006-02-03 23:59:41 +00:00
|
|
|
#define LLIV_LIV(x) ((x) & 0x1f)/* Left line input volume control */
|
2005-07-29 12:58:59 +00:00
|
|
|
|
|
|
|
/* REG_RLIV: Right line input channel volume control */
|
|
|
|
#define REG_RLIV 0x1
|
2006-03-28 20:35:08 +00:00
|
|
|
#define RLIV_RLS (1 << 8) /* simultaneous volume/mute update */
|
|
|
|
#define RLIV_RIM (1 << 7) /* Right line input mute */
|
2006-02-03 23:59:41 +00:00
|
|
|
#define RLIV_RIV(x) ((x) & 0x1f)/* Right line input volume control */
|
2005-07-29 12:58:59 +00:00
|
|
|
|
|
|
|
/* REG_LHV: Left Channel Headphone Volume Control */
|
|
|
|
#define REG_LHV 0x2
|
2006-03-28 20:35:08 +00:00
|
|
|
#define LHV_LRS (1 << 8) /* simultaneous volume/mute update */
|
2006-08-26 21:00:18 +00:00
|
|
|
#define LHV_LZC (1 << 7) /* Left-channel zero-cross detect */
|
2006-02-03 23:59:41 +00:00
|
|
|
#define LHV_LHV(x) ((x) & 0x7f)/* Left headphone volume control */
|
2005-07-29 12:58:59 +00:00
|
|
|
|
|
|
|
/* REG_RHV: Right Channel Headphone Volume Control */
|
|
|
|
#define REG_RHV 0x3
|
2006-03-28 20:35:08 +00:00
|
|
|
#define RHV_LRS (1 << 8) /* simultaneous volume/mute update */
|
|
|
|
#define RHV_RZC (1 << 7) /* Right-channel zero-cross detect */
|
2006-02-03 23:59:41 +00:00
|
|
|
#define RHV_RHV(x) ((x) & 0x7f)/* Right headphone volume control */
|
2005-07-29 12:58:59 +00:00
|
|
|
|
|
|
|
/* REG_AAP: Analog Audio Path Control */
|
|
|
|
#define REG_AAP 0x4
|
|
|
|
#define AAP_DAC (1 << 4) /* DAC select */
|
|
|
|
#define AAP_BYPASS (1 << 3) /* bypass */
|
2006-03-28 20:35:08 +00:00
|
|
|
#define AAP_INSEL (1 << 2) /* Input select for ADC */
|
2005-07-29 12:58:59 +00:00
|
|
|
#define AAP_MICM (1 << 1) /* Microphone mute */
|
|
|
|
#define AAP_MICB (1 << 0) /* Microphone boost */
|
|
|
|
|
|
|
|
/* REG_DAP: Digital Audio Path Control */
|
|
|
|
#define REG_DAP 0x5
|
|
|
|
#define DAP_DACM (1 << 3) /* DAC soft mute */
|
|
|
|
#define DAP_DEEMP_32 (1 << 1) /* De-emphasis control: 32 kHz */
|
|
|
|
#define DAP_DEEMP_44 (2 << 1) /* De-emphasis control: 44.1 kHz */
|
|
|
|
#define DAP_DEEMP_48 (3 << 1) /* De-emphasis control: 48 kHz */
|
2006-03-28 20:35:08 +00:00
|
|
|
#define DAP_ADCHP (1 << 0) /* ADC high-pass filter */
|
2005-07-29 12:58:59 +00:00
|
|
|
|
|
|
|
/* REG_PC: Power Down Control */
|
|
|
|
#define REG_PC 0x6
|
2006-08-26 21:00:18 +00:00
|
|
|
#define PC_OFF (1 << 7) /* Device power */
|
2006-03-28 20:35:08 +00:00
|
|
|
#define PC_CLK (1 << 6) /* Clock */
|
|
|
|
#define PC_OSC (1 << 5) /* Oscillator */
|
|
|
|
#define PC_OUT (1 << 4) /* Outputs */
|
|
|
|
#define PC_DAC (1 << 3) /* DAC */
|
|
|
|
#define PC_ADC (1 << 2) /* ADC */
|
|
|
|
#define PC_MIC (1 << 1) /* Microphone input */
|
|
|
|
#define PC_LINE (1 << 0) /* Line input */
|
2005-08-02 04:47:24 +00:00
|
|
|
|
2005-07-29 12:58:59 +00:00
|
|
|
/* REG_DAIF: Digital Audio Interface Format */
|
|
|
|
#define REG_DAIF 0x7
|
|
|
|
#define DAIF_MS (1 << 6) /* Master/slave mode */
|
|
|
|
#define DAIF_LRSWAP (1 << 5) /* DAC left/right swap */
|
2006-03-28 20:35:08 +00:00
|
|
|
#define DAIF_LRP (1 << 4) /* DAC left/right phase */
|
2005-07-29 12:58:59 +00:00
|
|
|
#define DAIF_IWL_16 (0 << 2) /* Input bit length: 16 bit */
|
|
|
|
#define DAIF_IWL_20 (1 << 2) /* Input bit length: 20 bit */
|
|
|
|
#define DAIF_IWL_24 (2 << 2) /* Input bit length: 24 bit */
|
|
|
|
#define DAIF_IWL_32 (3 << 2) /* Input bit length: 32 bit */
|
|
|
|
#define DAIF_FOR_DSP (3 << 0) /* Data format: DSP */
|
|
|
|
#define DAIF_FOR_I2S (2 << 0) /* Data format: I2S */
|
|
|
|
#define DAIF_FOR_MSBL (1 << 0) /* Data format: MSB first, left aligned */
|
|
|
|
#define DAIF_FOR_MSBR (0 << 0) /* Data format: MSB first, right aligned */
|
|
|
|
|
|
|
|
/* REG_SRC: Sample Rate Control */
|
|
|
|
#define REG_SRC 0x8
|
2008-05-14 18:55:19 +00:00
|
|
|
#define SRC_CLKIN (1 << 6) /* Clock input divider */
|
2006-03-28 20:35:08 +00:00
|
|
|
#define SRC_CLKOUT (1 << 7) /* Clock output divider */
|
2005-07-29 12:58:59 +00:00
|
|
|
/*#define SRC_SR ()*/
|
2005-08-02 04:47:24 +00:00
|
|
|
#define SRC_BOSR (1 << 1) /* Base oversampling rate, depends on SRC_USB */
|
|
|
|
#define SRC_USB (1 << 0) /* Clock mode select */
|
2005-07-29 12:58:59 +00:00
|
|
|
|
|
|
|
/* REG_DIA: Digital Interface Activation */
|
|
|
|
#define REG_DIA 0x9
|
2006-03-28 20:35:08 +00:00
|
|
|
#define DIA_ACT (1 << 0) /* Activate interface */
|
2005-07-29 12:58:59 +00:00
|
|
|
|
|
|
|
/* REG_RR: Reset Register */
|
|
|
|
#define REG_RR 0xf
|
|
|
|
#define RR_RESET 0 /* Reset */
|
|
|
|
|
|
|
|
#endif /*_TLV320_H_*/
|