summaryrefslogtreecommitdiffstats
path: root/firmware/export/pcm1792.h
blob: 917599edbf8f41f8d2c458eb9c8f0cda5fdef2c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/***************************************************************************
 *             __________               __   ___.
 *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
 *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
 *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
 *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
 *                     \/            \/     \/    \/            \/
 * $Id$
 *
 *
 * Copyright (c) 2013 Andrew Ryabinin
 *
 * 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.
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 * KIND, either express or implied.
 *
 ****************************************************************************/

#ifndef _PCM1792_H
#define _PCM1792_H

#define PCM1792_VOLUME_MIN -1270
#define PCM1792_VOLUME_MAX 0

#define AUDIOHW_CAPS (FILTER_ROLL_OFF_CAP)
AUDIOHW_SETTING(VOLUME, "dB", 0, 1, PCM1792_VOLUME_MIN/10, PCM1792_VOLUME_MAX/10, 0)
AUDIOHW_SETTING(FILTER_ROLL_OFF, "", 0, 1, 0, 1, 0)

#define PCM1792_REG(x) (((x)&0x1f)<<8)

/**
 * Register #18
 */
/* Attenuation Load Control */
#define PCM1792_ATLD_OFF        (0<<7)
#define PCM1792_ATLD_ON         (1<<7)

/* Audio Interface Data Format */
#define PCM1792_FMT_16_RJ      (0<<4) /* 16-bit standard format, right-justified data */
#define PCM1792_FMT_20_RJ      (1<<4) /* 20-bit standard format, right-justified data */
#define PCM1792_FMT_24_RJ      (2<<4) /* 24-bit standard format, right-justified data */
#define PCM1792_FMT_24_MSB_I2S (3<<4) /* 24-bit MSB-first, left-justified format data */
#define PCM1792_FMT_16_I2S     (4<<4) /* 16-bit I2S format data */
#define PCM1792_FMT_24_I2S     (5<<4) /* 24-bit I2S format data */

/* Sampling Frequency Selection for the De-Emphasis Function */
#define PCM1792_DMF_DISABLE (0<<2)
#define PCM1792_DMF_48      (1<<2)
#define PCM1792_DMF_44      (2<<2)
#define PCM1792_DMF_32      (2<<2)

/* Digital De-Emphasis Control */
#define PCM1792_DME_OFF     (0<<1)
#define PCM1792_DME_ON      (1<<1)

/* Soft Mute Control */
#define PCM1792_MUTE_OFF (0<<0)
#define PCM1792_MUTE_ON  (1<<0)


/**
 * Register #19
 */
/* Output Phase Reversal */
#define PCM1792_REV_OFF  (0<<7)
#define PCM1792_REV_ON   (1<<7)

/* Attenuation Rate Select */
#define PCM1792_ATS_DIV1   (0<<5)
#define PCM1792_ATS_DIV2   (1<<5)
#define PCM1792_ATS_DIV4   (2<<5)
#define PCM1792_ATS_DIV8   (4<<5)

/* DAC Operation Control */
#define PCM1792_OPE_ON       (0<<4)
#define PCM1792_OPE_OFF      (1<<4)

/* Stereo DF Bypass Mode Select */
#define PCM1792_DFMS_MONO   (0<<2)
#define PCM1792_DFMS_STERO  (1<<2)

/* Digital Filter Rolloff Control */
#define PCM1792_FLT_SHARP   (0<<1)
#define PCM1792_FLT_SLOW    (1<<1)

/* Infinite Zero Detect Mute Control */
#define PCM1792_INZD_OFF    (0<<0)
#define PCM1792_INZD_ON     (1<<0)


/**
 * Register #20
 */
/* System Reset Control */
#define PCM1792_SRST_NORMAL  (0<<6)
#define PCM1792_SRST_RESET   (1<<6)

/* DSD Interface Mode Control */
#define PCM1792_DSD_OFF      (0<<5)
#define PCM1792_DSD_ON       (1<<5)

/* Digital Filter Bypass (or Through Mode) Control */
#define PCM1792_DFTH_ENABLE  (0<<4) /* Digital filter enabled */
#define PCM1792_DFTH_BYPASS  (1<<4) /* Digital filter bypassed
                                       for external digital filter */

/* Monaural Mode Selection */
#define PCM1792_STEREO       (0<<3)
#define PCM1792_MONO         (1<<3)

/* Channel Selection for Monaural Mode */
#define PCM1792_CHSL_L       (0<<2)
#define PCM1792_CHSL_R       (1<<2)

/* Delta-Sigma Oversampling Rate Selection */
#define PCM1792_OS_64        (0<<0)
#define PCM1792_OS_32        (1<<0)
#define PCM1792_OS_128       (2<<0)

/**
 * Register #21
 */
/* DSD Zero Output Enable */
#define PCM1792_DZ_DISABLE   (0<<1)
#define PCM1792_DZ_EVEN      (1<<1) /* Even pattern detect */
#define PCM1792_DZ_96H       (2<<1) /* 96h pattern detect */

/* PCM Zero Output Enable */
#define PCM1792_PCMZ_OFF     (0<<0)
#define PCM1792_PCMZ_ON      (1<<0)

void audiohw_mute(void);
void pcm1792_set_ml(const int);
void pcm1792_set_mc(const int);
void pcm1792_set_md(const int);
void pcm1792_set_ml_dir(const int);

#endif