summaryrefslogtreecommitdiffstats
path: root/firmware/export/df1704.h
blob: 81848d8c6fe107cf51eb47e2a9b77a4724978a73 (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
/***************************************************************************
 *             __________               __   ___.
 *   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 _DF1704_H
#define _DF1704_H

#define DF1704_VOLUME_MIN -1270
#define DF1704_VOLUME_MAX 0

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

#define DF1704_MODE(x) (((x)&0x03)<<9)

/**
 * MODE0 register settings
 */
/* Left channel attenuation data load control */
#define DF1704_LDL_ON    (1<<8)
#define DF1704_LDL_OFF   (0<<8)

/**
 * MODE1 register settings
 */
/* Right channel attenuation data load control */
#define DF1704_LDR_ON    (1<<8)
#define DF1704_LDR_OFF   (0<<8)

/**
 * MODE2 register settings
 */
#define DF1704_MUTE_ON   (0<<0)
#define DF1704_MUTE_OFF  (1<<0)
/* Digital De-Emphasis */
#define DF1704_DEM_ON    (1<<1)
#define DF1704_DEM_OFF   (0<<1)
/* Input data format & word lengths */
#define DF1704_IW_16_I2S (0<<3)
#define DF1704_IW_24_I2S (1<<3)

#define DF1704_IW_16_RJ  (0<<3)
#define DF1704_IW_20_RJ  (1<<3)
#define DF1704_IW_24_RJ  (2<<3)
#define DF1704_IW_24_LJ  (3<<3)
/* Output data format & word lengths */
#define DF1704_OW_16     (0<<5)
#define DF1704_OW_18     (1<<5)
#define DF1704_OW_20     (2<<5)
#define DF1704_OW_24     (3<<5)

/**
 * MODE3 register settings
 */
#define DF1704_I2S_OFF   (0<<0)
#define DF1704_I2S_ON    (1<<0)
#define DF1704_LRP_L     (0<<1)
#define DF1704_LRP_H     (1<<1)
#define DF1704_ATC_ON    (1<<2)
#define DF1704_ATC_OFF   (0<<2)
#define DF1704_SRO_SHARP (0<<3)
#define DF1704_SRO_SLOW  (1<<3)
/* CLKO output frequency selection */
#define DF1704_CKO_FULL  (0<<5)
#define DF1704_CKO_HALF  (1<<5)
/* Sampling freq selection for the De-Emphasis */
#define DF1704_SF_44     (0<<6)
#define DF1704_SF_32     (3<<6)
#define DF1704_SF_48     (2<<6)

void audiohw_mute(void);
void df1704_set_ml(const int);
void df1704_set_mc(const int);
void df1704_set_md(const int);
void df1704_set_ml_dir(const int);
#endif