summaryrefslogtreecommitdiff
path: root/firmware/export/pcm1792.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/export/pcm1792.h')
-rw-r--r--firmware/export/pcm1792.h142
1 files changed, 142 insertions, 0 deletions
diff --git a/firmware/export/pcm1792.h b/firmware/export/pcm1792.h
new file mode 100644
index 0000000000..917599edbf
--- /dev/null
+++ b/firmware/export/pcm1792.h
@@ -0,0 +1,142 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 *
11 * Copyright (c) 2013 Andrew Ryabinin
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 ****************************************************************************/
22
23#ifndef _PCM1792_H
24#define _PCM1792_H
25
26#define PCM1792_VOLUME_MIN -1270
27#define PCM1792_VOLUME_MAX 0
28
29#define AUDIOHW_CAPS (FILTER_ROLL_OFF_CAP)
30AUDIOHW_SETTING(VOLUME, "dB", 0, 1, PCM1792_VOLUME_MIN/10, PCM1792_VOLUME_MAX/10, 0)
31AUDIOHW_SETTING(FILTER_ROLL_OFF, "", 0, 1, 0, 1, 0)
32
33#define PCM1792_REG(x) (((x)&0x1f)<<8)
34
35/**
36 * Register #18
37 */
38/* Attenuation Load Control */
39#define PCM1792_ATLD_OFF (0<<7)
40#define PCM1792_ATLD_ON (1<<7)
41
42/* Audio Interface Data Format */
43#define PCM1792_FMT_16_RJ (0<<4) /* 16-bit standard format, right-justified data */
44#define PCM1792_FMT_20_RJ (1<<4) /* 20-bit standard format, right-justified data */
45#define PCM1792_FMT_24_RJ (2<<4) /* 24-bit standard format, right-justified data */
46#define PCM1792_FMT_24_MSB_I2S (3<<4) /* 24-bit MSB-first, left-justified format data */
47#define PCM1792_FMT_16_I2S (4<<4) /* 16-bit I2S format data */
48#define PCM1792_FMT_24_I2S (5<<4) /* 24-bit I2S format data */
49
50/* Sampling Frequency Selection for the De-Emphasis Function */
51#define PCM1792_DMF_DISABLE (0<<2)
52#define PCM1792_DMF_48 (1<<2)
53#define PCM1792_DMF_44 (2<<2)
54#define PCM1792_DMF_32 (2<<2)
55
56/* Digital De-Emphasis Control */
57#define PCM1792_DME_OFF (0<<1)
58#define PCM1792_DME_ON (1<<1)
59
60/* Soft Mute Control */
61#define PCM1792_MUTE_OFF (0<<0)
62#define PCM1792_MUTE_ON (1<<0)
63
64
65/**
66 * Register #19
67 */
68/* Output Phase Reversal */
69#define PCM1792_REV_OFF (0<<7)
70#define PCM1792_REV_ON (1<<7)
71
72/* Attenuation Rate Select */
73#define PCM1792_ATS_DIV1 (0<<5)
74#define PCM1792_ATS_DIV2 (1<<5)
75#define PCM1792_ATS_DIV4 (2<<5)
76#define PCM1792_ATS_DIV8 (4<<5)
77
78/* DAC Operation Control */
79#define PCM1792_OPE_ON (0<<4)
80#define PCM1792_OPE_OFF (1<<4)
81
82/* Stereo DF Bypass Mode Select */
83#define PCM1792_DFMS_MONO (0<<2)
84#define PCM1792_DFMS_STERO (1<<2)
85
86/* Digital Filter Rolloff Control */
87#define PCM1792_FLT_SHARP (0<<1)
88#define PCM1792_FLT_SLOW (1<<1)
89
90/* Infinite Zero Detect Mute Control */
91#define PCM1792_INZD_OFF (0<<0)
92#define PCM1792_INZD_ON (1<<0)
93
94
95/**
96 * Register #20
97 */
98/* System Reset Control */
99#define PCM1792_SRST_NORMAL (0<<6)
100#define PCM1792_SRST_RESET (1<<6)
101
102/* DSD Interface Mode Control */
103#define PCM1792_DSD_OFF (0<<5)
104#define PCM1792_DSD_ON (1<<5)
105
106/* Digital Filter Bypass (or Through Mode) Control */
107#define PCM1792_DFTH_ENABLE (0<<4) /* Digital filter enabled */
108#define PCM1792_DFTH_BYPASS (1<<4) /* Digital filter bypassed
109 for external digital filter */
110
111/* Monaural Mode Selection */
112#define PCM1792_STEREO (0<<3)
113#define PCM1792_MONO (1<<3)
114
115/* Channel Selection for Monaural Mode */
116#define PCM1792_CHSL_L (0<<2)
117#define PCM1792_CHSL_R (1<<2)
118
119/* Delta-Sigma Oversampling Rate Selection */
120#define PCM1792_OS_64 (0<<0)
121#define PCM1792_OS_32 (1<<0)
122#define PCM1792_OS_128 (2<<0)
123
124/**
125 * Register #21
126 */
127/* DSD Zero Output Enable */
128#define PCM1792_DZ_DISABLE (0<<1)
129#define PCM1792_DZ_EVEN (1<<1) /* Even pattern detect */
130#define PCM1792_DZ_96H (2<<1) /* 96h pattern detect */
131
132/* PCM Zero Output Enable */
133#define PCM1792_PCMZ_OFF (0<<0)
134#define PCM1792_PCMZ_ON (1<<0)
135
136void audiohw_mute(void);
137void pcm1792_set_ml(const int);
138void pcm1792_set_mc(const int);
139void pcm1792_set_md(const int);
140void pcm1792_set_ml_dir(const int);
141
142#endif