diff options
author | Dana Conrad <dconrad@fastmail.com> | 2023-11-21 19:28:51 -0600 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2024-01-02 06:51:07 -0500 |
commit | a3fe07ff128e521051aee8bc91add071724d6538 (patch) | |
tree | 9e3eb34908a4571f85686877085d9f5b200d1c2a /firmware/export/eros_qn_codec.h | |
parent | 161c861153f67c2436affc11860ed932a0d21c30 (diff) | |
download | rockbox-a3fe07ff128e521051aee8bc91add071724d6538.tar.gz rockbox-a3fe07ff128e521051aee8bc91add071724d6538.zip |
ErosQ New Revision HW volume
Add HW volume control via ES9018K2M, and reorganize
eros_qn_codec.c/.h, audiohw-erosqnative.c.
This automatically detects the presence of the new DAC and
uses its hardware volume scaling. If not present, use same
SWVOL we have been using so far.
Add debug menu readout of SWVOL/I2C result.
Break out es9018k2m stuff into its own file so that
maybe it can be useful to other ports.
Note that we may need to get smarter about detecting the DAC
type if/when another model emerges.
Change-Id: I586a1cf7f150dd6b4e221157859825952840af56
Diffstat (limited to 'firmware/export/eros_qn_codec.h')
-rw-r--r-- | firmware/export/eros_qn_codec.h | 16 |
1 files changed, 14 insertions, 2 deletions
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 |