diff options
Diffstat (limited to 'firmware/export')
-rw-r--r-- | firmware/export/audiohw.h | 1 | ||||
-rw-r--r-- | firmware/export/eros_qn_codec.h | 16 | ||||
-rw-r--r-- | firmware/export/es9018k2m.h | 64 |
3 files changed, 79 insertions, 2 deletions
diff --git a/firmware/export/audiohw.h b/firmware/export/audiohw.h index 3f8b48d750..067118000e 100644 --- a/firmware/export/audiohw.h +++ b/firmware/export/audiohw.h | |||
@@ -214,6 +214,7 @@ struct sound_settings_info | |||
214 | #include "pcm1792.h" | 214 | #include "pcm1792.h" |
215 | #elif defined(HAVE_EROS_QN_CODEC) | 215 | #elif defined(HAVE_EROS_QN_CODEC) |
216 | #include "eros_qn_codec.h" | 216 | #include "eros_qn_codec.h" |
217 | #include "es9018k2m.h" | ||
217 | #elif defined(HAVE_NWZ_LINUX_CODEC) | 218 | #elif defined(HAVE_NWZ_LINUX_CODEC) |
218 | #include "nwzlinux_codec.h" | 219 | #include "nwzlinux_codec.h" |
219 | #elif defined(HAVE_CS4398) | 220 | #elif defined(HAVE_CS4398) |
diff --git a/firmware/export/eros_qn_codec.h b/firmware/export/eros_qn_codec.h index bf108aa1c7..223ef06779 100644 --- a/firmware/export/eros_qn_codec.h +++ b/firmware/export/eros_qn_codec.h | |||
@@ -32,13 +32,25 @@ | |||
32 | #define PCM5102A_VOLUME_MIN -740 | 32 | #define PCM5102A_VOLUME_MIN -740 |
33 | #define PCM5102A_VOLUME_MAX -20 | 33 | #define PCM5102A_VOLUME_MAX -20 |
34 | 34 | ||
35 | /* a small DC offset prevents play/pause clicking due to the DAC auto-muting */ | 35 | /* a small DC offset prevents play/pause clicking due to the PCM5102A DAC auto-muting */ |
36 | #define PCM_DC_OFFSET_VALUE -1 | 36 | #define PCM_DC_OFFSET_VALUE -1 |
37 | 37 | ||
38 | AUDIOHW_SETTING(VOLUME, "dB", 0, 2, PCM5102A_VOLUME_MIN/10, PCM5102A_VOLUME_MAX/10, 0) | 38 | AUDIOHW_SETTING(VOLUME, "dB", 0, 2, PCM5102A_VOLUME_MIN/10, PCM5102A_VOLUME_MAX/10, 0) |
39 | 39 | ||
40 | /* flag indicating whether this is a new revision unit with the ES9018K2M DAC */ | ||
41 | extern int es9018k2m_present_flag; | ||
42 | |||
43 | /* Switch the output sink. 0 - headphones, 1 - line out */ | ||
44 | void eros_qn_switch_output(int select); | ||
45 | |||
46 | /* Record last volume setting for switching between headphones/line out */ | ||
47 | void eros_qn_set_last_vol(long int vol_l, long int vol_r); | ||
48 | |||
40 | /* this just calls audiohw_set_volume() with the last (locally) known volume, | 49 | /* this just calls audiohw_set_volume() with the last (locally) known volume, |
41 | * used for switching to/from fixed line out volume. */ | 50 | * used for switching to/from fixed line out volume. */ |
42 | void dac_set_outputs(void); | 51 | void eros_qn_set_outputs(void); |
52 | |||
53 | /* returns (global_settings.volume_limit * 10) */ | ||
54 | int eros_qn_get_volume_limit(void); | ||
43 | 55 | ||
44 | #endif | 56 | #endif |
diff --git a/firmware/export/es9018k2m.h b/firmware/export/es9018k2m.h new file mode 100644 index 0000000000..035a607030 --- /dev/null +++ b/firmware/export/es9018k2m.h | |||
@@ -0,0 +1,64 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * | ||
11 | * Copyright (c) 2023 Dana Conrad | ||
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 _ES9018K2M_H | ||
24 | #define _ES9018K2M_H | ||
25 | |||
26 | //====================================================================================== | ||
27 | // ES9018K2M support stuff | ||
28 | |||
29 | #ifndef ES9018K2M_VOLUME_MIN | ||
30 | # define ES9018K2M_VOLUME_MIN -1270 | ||
31 | #endif | ||
32 | |||
33 | #ifndef ES9018K2M_VOLUME_MAX | ||
34 | # define ES9018K2M_VOLUME_MAX 0 | ||
35 | #endif | ||
36 | |||
37 | #define ES9018K2M_REG0_SYSTEM_SETTINGS 0 | ||
38 | #define ES9018K2M_REG1_INPUT_CONFIG 1 | ||
39 | #define ES9018K2M_REG4_AUTOMUTE_TIME 4 | ||
40 | #define ES9018K2M_REG5_AUTOMUTE_LEVEL 5 | ||
41 | #define ES9018K2M_REG6_DEEMPHASIS 6 | ||
42 | #define ES9018K2M_REG7_GENERAL_SETTINGS 7 | ||
43 | #define ES9018K2M_REG8_GPIO_CONFIG 8 | ||
44 | #define ES9018K2M_REG10_MASTER_MODE_CTRL 10 | ||
45 | #define ES9018K2M_REG11_CHANNEL_MAPPING 11 | ||
46 | #define ES9018K2M_REG12_DPLL_SETTINGS 12 | ||
47 | #define ES9018K2M_REG13_THD_COMP 13 | ||
48 | #define ES9018K2M_REG14_SOFTSTART_SETTINGS 14 | ||
49 | #define ES9018K2M_REG15_VOLUME_L 15 | ||
50 | #define ES9018K2M_REG16_VOLUME_R 16 | ||
51 | #define ES9018K2M_REG21_GPIO_INPUT_SELECT 21 | ||
52 | |||
53 | /* writes volume levels to DAC over I2C */ | ||
54 | void es9018k2m_set_volume(int vol_l, int vol_r); | ||
55 | |||
56 | /* writes a single register */ | ||
57 | /* returns I2C_STATUS_OK upon success, I2C_STATUS_* errors upon error */ | ||
58 | int es9018k2m_write_reg(uint8_t reg, uint8_t val); | ||
59 | |||
60 | /* reads a single register */ | ||
61 | /* returns register value, or -1 upon error */ | ||
62 | int es9018k2m_read_reg(uint8_t reg); | ||
63 | |||
64 | #endif \ No newline at end of file | ||