summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/export/audiohw.h44
-rw-r--r--firmware/export/wm8758.h4
-rw-r--r--firmware/export/wm8985.h4
-rw-r--r--firmware/sound.c12
4 files changed, 49 insertions, 15 deletions
diff --git a/firmware/export/audiohw.h b/firmware/export/audiohw.h
index 4c9271e03e..5842ff7d3b 100644
--- a/firmware/export/audiohw.h
+++ b/firmware/export/audiohw.h
@@ -24,11 +24,13 @@
#include <stdbool.h>
/* define some audiohw caps */
-#define TREBLE_CAP (1 << 0)
-#define BASS_CAP (1 << 1)
-#define BALANCE_CAP (1 << 2)
-#define CLIPPING_CAP (1 << 3)
-#define PRESCALER_CAP (1 << 4)
+#define TREBLE_CAP (1 << 0)
+#define BASS_CAP (1 << 1)
+#define BALANCE_CAP (1 << 2)
+#define CLIPPING_CAP (1 << 3)
+#define PRESCALER_CAP (1 << 4)
+#define BASS_CUTOFF_CAP (1 << 5)
+#define TREBLE_CUTOFF_CAP (1 << 6)
#ifdef HAVE_UDA1380
#include "uda1380.h"
@@ -77,6 +79,14 @@
#if (AUDIOHW_CAPS & PRESCALER_CAP)
#define AUDIOHW_HAVE_PRESCALER
#endif
+
+#if (AUDIOHW_CAPS & BASS_CUTOFF_CAP)
+#define AUDIOHW_HAVE_BASS_CUTOFF
+#endif
+
+#if (AUDIOHW_CAPS & TREBLE_CUTOFF_CAP)
+#define AUDIOHW_HAVE_TREBLE_CUTOFF
+#endif
#endif /* AUDIOHW_CAPS */
enum {
@@ -103,8 +113,10 @@ enum {
SOUND_RIGHT_GAIN,
SOUND_MIC_GAIN,
#endif
-#if defined(HAVE_WM8758) || defined(HAVE_WM8985)
+#if defined(AUDIOHW_HAVE_BASS_CUTOFF)
SOUND_BASS_CUTOFF,
+#endif
+#if defined(AUDIOHW_HAVE_TREBLE_CUTOFF)
SOUND_TREBLE_CUTOFF,
#endif
};
@@ -221,6 +233,26 @@ void audiohw_set_treble(int val);
void audiohw_set_bass(int val);
#endif
+#ifdef AUDIOHW_HAVE_BASS_CUTOFF
+/**
+ * Set new bass cut off value.
+ * @param val to set.
+ * NOTE: AUDIOHW_CAPS need to contain
+ * BASS_CUTOFF_CAP
+ */
+void audiohw_set_bass_cutoff(int val);
+#endif
+
+#ifdef AUDIOHW_HAVE_TREBLE_CUTOFF
+/**
+ * Set new treble cut off value.
+ * @param val to set.
+ * NOTE: AUDIOHW_CAPS need to contain
+ * TREBLE_CUTOFF_CAP
+ */
+void audiohw_set_treble_cutoff(int val);
+#endif
+
#ifdef HAVE_RECORDING
/**
diff --git a/firmware/export/wm8758.h b/firmware/export/wm8758.h
index 5e37e203d5..6c1987c3e8 100644
--- a/firmware/export/wm8758.h
+++ b/firmware/export/wm8758.h
@@ -24,7 +24,7 @@
#define VOLUME_MIN -570
#define VOLUME_MAX 60
-#define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP)
+#define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | BASS_CUTOFF_CAP | TREBLE_CUTOFF_CAP)
extern int tenthdb2master(int db);
extern int tenthdb2mixer(int db);
@@ -32,8 +32,6 @@ extern int tenthdb2mixer(int db);
extern void audiohw_set_master_vol(int vol_l, int vol_r);
extern void audiohw_set_lineout_vol(int vol_l, int vol_r);
extern void audiohw_set_mixer_vol(int channel1, int channel2);
-extern void audiohw_set_bass_cutoff(int value);
-extern void audiohw_set_treble_cutoff(int value);
extern void audiohw_set_nsorder(int order);
extern void audiohw_set_sample_rate(int sampling_control);
diff --git a/firmware/export/wm8985.h b/firmware/export/wm8985.h
index 8696e3dd6f..f59bc771bd 100644
--- a/firmware/export/wm8985.h
+++ b/firmware/export/wm8985.h
@@ -24,7 +24,7 @@
#define VOLUME_MIN -570
#define VOLUME_MAX 60
-#define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP)
+#define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | BASS_CUTOFF_CAP | TREBLE_CUTOFF_CAP)
extern int tenthdb2master(int db);
extern int tenthdb2mixer(int db);
@@ -32,8 +32,6 @@ extern int tenthdb2mixer(int db);
extern void audiohw_set_master_vol(int vol_l, int vol_r);
extern void audiohw_set_lineout_vol(int vol_l, int vol_r);
extern void audiohw_set_mixer_vol(int channel1, int channel2);
-extern void audiohw_set_bass_cutoff(int value);
-extern void audiohw_set_treble_cutoff(int value);
extern void audiohw_set_nsorder(int order);
extern void audiohw_set_sample_rate(int sampling_control);
diff --git a/firmware/sound.c b/firmware/sound.c
index 5c6a821d48..bd2a9612c9 100644
--- a/firmware/sound.c
+++ b/firmware/sound.c
@@ -70,8 +70,10 @@ const struct sound_settings_info audiohw_settings[] = {
[SOUND_RIGHT_GAIN] = {"dB", 1, 1,-128, 96, 0},
[SOUND_MIC_GAIN] = {"dB", 1, 1,-128, 108, 16},
#endif
-#if defined(HAVE_WM8758)
+#if defined(AUDIOHW_HAVE_BASS_CUTOFF)
[SOUND_BASS_CUTOFF] = {"", 0, 1, 1, 4, 1},
+#endif
+#if defined(AUDIOHW_HAVE_TREBLE_CUTOFF)
[SOUND_TREBLE_CUTOFF] = {"", 0, 1, 1, 4, 1},
#endif
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
@@ -146,11 +148,13 @@ sound_set_type* sound_get_fn(int setting)
result = sound_set_stereo_width;
break;
-#ifdef HAVE_WM8758
+#if defined(AUDIOHW_HAVE_BASS_CUTOFF)
case SOUND_BASS_CUTOFF:
result = sound_set_bass_cutoff;
break;
+#endif
+#if defined(AUDIOHW_HAVE_TREBLE_CUTOFF)
case SOUND_TREBLE_CUTOFF:
result = sound_set_treble_cutoff;
break;
@@ -410,7 +414,7 @@ void sound_set_stereo_width(int value)
#endif
}
-#if defined(HAVE_WM8758) || defined(HAVE_WM8985)
+#if defined(AUDIOHW_HAVE_BASS_CUTOFF)
void sound_set_bass_cutoff(int value)
{
if(!audio_is_initialized)
@@ -418,7 +422,9 @@ void sound_set_bass_cutoff(int value)
audiohw_set_bass_cutoff(value);
}
+#endif
+#if defined(AUDIOHW_HAVE_TREBLE_CUTOFF)
void sound_set_treble_cutoff(int value)
{
if(!audio_is_initialized)