summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Everton <dan@iocaine.org>2006-08-14 10:52:05 +0000
committerDan Everton <dan@iocaine.org>2006-08-14 10:52:05 +0000
commit8030c804adf4df4a45eeecb3d93e983f58b0c9a0 (patch)
tree75496afcd5a267a5b7786882f3e3e899a778df57
parent6ffe02b27c36acf4c74f31f7fc838d2fe3222e09 (diff)
downloadrockbox-8030c804adf4df4a45eeecb3d93e983f58b0c9a0.tar.gz
rockbox-8030c804adf4df4a45eeecb3d93e983f58b0c9a0.zip
Add support for the iPod Video hardware equalizer. You can access it from Sound Settings -> Equalizer -> Hardware Equalizer. Note that the peak filters are reported not to work. Based on FS#5791 from Snyper.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10568 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/eq_menu.c419
-rw-r--r--apps/lang/english.lang70
-rw-r--r--apps/settings.c22
-rw-r--r--apps/settings.h22
-rw-r--r--docs/CREDITS1
-rw-r--r--firmware/drivers/wm8758.c25
-rw-r--r--firmware/export/wm8758.h8
7 files changed, 558 insertions, 9 deletions
diff --git a/apps/eq_menu.c b/apps/eq_menu.c
index 1712469a1d..b863e45926 100644
--- a/apps/eq_menu.c
+++ b/apps/eq_menu.c
@@ -45,6 +45,9 @@
#include "screen_access.h"
#include "keyboard.h"
#include "gui/scrollbar.h"
+#ifdef HAVE_WM8758
+#include "wm8758.h"
+#endif
/* Key definitions */
#if (CONFIG_KEYPAD == IRIVER_H100_PAD || \
@@ -272,7 +275,7 @@ static bool eq_gain_menu(void)
setting += 3;
}
- m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
+ m = menu_init( items, sizeof(items) / sizeof(*items), NULL,
NULL, NULL, NULL);
result = menu_run(m);
menu_exit(m);
@@ -290,7 +293,7 @@ static bool eq_set_band0(void)
{ ID2P(LANG_EQUALIZER_BAND_GAIN), eq_set_band0_gain },
};
- m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
+ m = menu_init( items, sizeof(items) / sizeof(*items), NULL,
NULL, NULL, NULL);
result = menu_run(m);
menu_exit(m);
@@ -308,7 +311,7 @@ static bool eq_set_band1(void)
{ ID2P(LANG_EQUALIZER_BAND_GAIN), eq_set_band1_gain },
};
- m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
+ m = menu_init( items, sizeof(items) / sizeof(*items), NULL,
NULL, NULL, NULL);
result = menu_run(m);
menu_exit(m);
@@ -326,7 +329,7 @@ static bool eq_set_band2(void)
{ ID2P(LANG_EQUALIZER_BAND_GAIN), eq_set_band2_gain },
};
- m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
+ m = menu_init( items, sizeof(items) / sizeof(*items), NULL,
NULL, NULL, NULL);
result = menu_run(m);
menu_exit(m);
@@ -344,7 +347,7 @@ static bool eq_set_band3(void)
{ ID2P(LANG_EQUALIZER_BAND_GAIN), eq_set_band3_gain },
};
- m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
+ m = menu_init( items, sizeof(items) / sizeof(*items), NULL,
NULL, NULL, NULL);
result = menu_run(m);
menu_exit(m);
@@ -362,7 +365,7 @@ static bool eq_set_band4(void)
{ ID2P(LANG_EQUALIZER_BAND_GAIN), eq_set_band4_gain },
};
- m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
+ m = menu_init( items, sizeof(items) / sizeof(*items), NULL,
NULL, NULL, NULL);
result = menu_run(m);
menu_exit(m);
@@ -390,7 +393,7 @@ static bool eq_advanced_menu(void)
items[i].desc = peak_band_label[i-1];
}
- m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
+ m = menu_init( items, sizeof(items) / sizeof(*items), NULL,
NULL, NULL, NULL);
result = menu_run(m);
menu_exit(m);
@@ -845,6 +848,403 @@ bool eq_browse_presets(void)
return rockbox_browse(EQS_DIR, SHOW_CFG);
}
+#ifdef HAVE_WM8758
+
+/* WM8758 equalizer supports -12 to +12 dB gain in 1 dB increments. */
+#define EQ_HW_GAIN_STEP 1
+#define EQ_HW_GAIN_MIN -12
+#define EQ_HW_GAIN_MAX 12
+
+static const struct opt_items BANDWIDTH_NAMES[] = {
+ { STR(LANG_EQUALIZER_HARDWARE_BANDWIDTH_NARROW) },
+ { STR(LANG_EQUALIZER_HARDWARE_BANDWIDTH_WIDE) },
+};
+
+static const int BANDWIDTH_NAMES_SIZE = sizeof(BANDWIDTH_NAMES) /
+ sizeof(*BANDWIDTH_NAMES);
+
+static void eq_hw_gain_format(char* buffer, int buffer_size, int value,
+ const char* unit)
+{
+ snprintf(buffer, buffer_size, "%d %s", value, unit);
+}
+
+static bool eq_hw_set_band0_cutoff(void)
+{
+ static const struct opt_items names[] = {
+ { (unsigned char *)"80 Hz", TALK_ID(80, UNIT_HERTZ) },
+ { (unsigned char *)"105 Hz", TALK_ID(105, UNIT_HERTZ) },
+ { (unsigned char *)"135 Hz", TALK_ID(135, UNIT_HERTZ) },
+ { (unsigned char *)"175 Hz", TALK_ID(175, UNIT_HERTZ) },
+ };
+
+ bool result = set_option(str(LANG_EQUALIZER_BANDWIDTH),
+ &global_settings.eq_hw_band0_cutoff, INT, names,
+ sizeof(names) / sizeof(*names), NULL);
+
+#ifndef SIMULATOR
+ wmcodec_set_equalizer_band(0, global_settings.eq_hw_band0_cutoff, 0,
+ global_settings.eq_hw_band0_gain);
+#endif
+
+ return result;
+}
+
+static bool eq_hw_set_band0_gain(void)
+{
+ bool result = set_int(str(LANG_EQUALIZER_BAND_GAIN), str(LANG_UNIT_DB), UNIT_DB,
+ &global_settings.eq_hw_band0_gain, NULL,
+ EQ_HW_GAIN_STEP, EQ_HW_GAIN_MIN, EQ_HW_GAIN_MAX,
+ eq_hw_gain_format);
+
+#ifndef SIMULATOR
+ wmcodec_set_equalizer_band(0, global_settings.eq_hw_band0_cutoff, 0,
+ global_settings.eq_hw_band0_gain);
+#endif
+
+ return result;
+}
+
+static bool eq_hw_set_band1_center(void)
+{
+ static const struct opt_items names[] = {
+ { (unsigned char *)"230 Hz", TALK_ID(230, UNIT_HERTZ) },
+ { (unsigned char *)"300 Hz", TALK_ID(300, UNIT_HERTZ) },
+ { (unsigned char *)"385 Hz", TALK_ID(385, UNIT_HERTZ) },
+ { (unsigned char *)"500 Hz", TALK_ID(500, UNIT_HERTZ) },
+ };
+
+ bool result = set_option(str(LANG_EQUALIZER_BAND_CENTER),
+ &global_settings.eq_hw_band1_center, INT, names,
+ sizeof(names) / sizeof(*names), NULL);
+
+#ifndef SIMULATOR
+ wmcodec_set_equalizer_band(1, global_settings.eq_hw_band1_center,
+ global_settings.eq_hw_band1_bandwidth,
+ global_settings.eq_hw_band1_gain);
+#endif
+
+ return result;
+}
+
+static bool eq_hw_set_band1_bandwidth(void)
+{
+ bool result = set_option(str(LANG_EQUALIZER_BANDWIDTH),
+ &global_settings.eq_hw_band1_bandwidth, INT, BANDWIDTH_NAMES,
+ BANDWIDTH_NAMES_SIZE, NULL);
+
+#ifndef SIMULATOR
+ wmcodec_set_equalizer_band(1, global_settings.eq_hw_band1_center,
+ global_settings.eq_hw_band1_bandwidth,
+ global_settings.eq_hw_band1_gain);
+#endif
+
+ return result;
+}
+
+static bool eq_hw_set_band1_gain(void)
+{
+ bool result = set_int(str(LANG_EQUALIZER_BAND_GAIN), str(LANG_UNIT_DB), UNIT_DB,
+ &global_settings.eq_hw_band1_gain, NULL,
+ EQ_HW_GAIN_STEP, EQ_HW_GAIN_MIN, EQ_HW_GAIN_MAX,
+ eq_hw_gain_format);
+
+#ifndef SIMULATOR
+ wmcodec_set_equalizer_band(1, global_settings.eq_hw_band1_center,
+ global_settings.eq_hw_band1_bandwidth,
+ global_settings.eq_hw_band1_gain);
+#endif
+
+ return result;
+}
+
+static bool eq_hw_set_band2_center(void)
+{
+ static const struct opt_items names[] = {
+ { (unsigned char *)"650 Hz", TALK_ID(650, UNIT_HERTZ) },
+ { (unsigned char *)"850 Hz", TALK_ID(850, UNIT_HERTZ) },
+ { (unsigned char *)"1.1 kHz", TALK_ID(1100, UNIT_HERTZ) },
+ { (unsigned char *)"1.4 kHz", TALK_ID(1400, UNIT_HERTZ) },
+ };
+
+ bool result = set_option(str(LANG_EQUALIZER_BAND_CENTER),
+ &global_settings.eq_hw_band2_center, INT, names,
+ sizeof(names) / sizeof(*names), NULL);
+
+#ifndef SIMULATOR
+ wmcodec_set_equalizer_band(2, global_settings.eq_hw_band2_center,
+ global_settings.eq_hw_band2_bandwidth,
+ global_settings.eq_hw_band2_gain);
+#endif
+
+ return result;
+}
+
+static bool eq_hw_set_band2_bandwidth(void)
+{
+ bool result = set_option(str(LANG_EQUALIZER_BANDWIDTH),
+ &global_settings.eq_hw_band2_bandwidth, INT, BANDWIDTH_NAMES,
+ BANDWIDTH_NAMES_SIZE, NULL);
+
+#ifndef SIMULATOR
+ wmcodec_set_equalizer_band(2, global_settings.eq_hw_band2_center,
+ global_settings.eq_hw_band2_bandwidth,
+ global_settings.eq_hw_band2_gain);
+#endif
+
+ return result;
+}
+
+static bool eq_hw_set_band2_gain(void)
+{
+ bool result = set_int(str(LANG_EQUALIZER_BAND_GAIN), str(LANG_UNIT_DB), UNIT_DB,
+ &global_settings.eq_hw_band2_gain, NULL,
+ EQ_HW_GAIN_STEP, EQ_HW_GAIN_MIN, EQ_HW_GAIN_MAX,
+ eq_hw_gain_format);
+
+#ifndef SIMULATOR
+ wmcodec_set_equalizer_band(2, global_settings.eq_hw_band2_center,
+ global_settings.eq_hw_band2_bandwidth,
+ global_settings.eq_hw_band2_gain);
+#endif
+
+ return result;
+}
+
+static bool eq_hw_set_band3_center(void)
+{
+ static const struct opt_items names[] = {
+ { (unsigned char *)"1.8 kHz", TALK_ID(1800, UNIT_HERTZ) },
+ { (unsigned char *)"2.4 kHz", TALK_ID(2400, UNIT_HERTZ) },
+ { (unsigned char *)"3.2 kHz", TALK_ID(3200, UNIT_HERTZ) },
+ { (unsigned char *)"4.1 kHz", TALK_ID(4100, UNIT_HERTZ) },
+ };
+
+ bool result = set_option(str(LANG_EQUALIZER_BAND_CENTER),
+ &global_settings.eq_hw_band3_center, INT, names,
+ sizeof(names) / sizeof(*names), NULL);
+
+#ifndef SIMULATOR
+ wmcodec_set_equalizer_band(3, global_settings.eq_hw_band3_center,
+ global_settings.eq_hw_band3_bandwidth,
+ global_settings.eq_hw_band3_gain);
+#endif
+
+ return result;
+}
+
+static bool eq_hw_set_band3_bandwidth(void)
+{
+ bool result = set_option(str(LANG_EQUALIZER_BANDWIDTH),
+ &global_settings.eq_hw_band3_bandwidth, INT, BANDWIDTH_NAMES,
+ BANDWIDTH_NAMES_SIZE, NULL);
+
+#ifndef SIMULATOR
+ wmcodec_set_equalizer_band(3, global_settings.eq_hw_band3_center,
+ global_settings.eq_hw_band3_bandwidth,
+ global_settings.eq_hw_band3_gain);
+#endif
+
+ return result;
+}
+
+static bool eq_hw_set_band3_gain(void)
+{
+ bool result = set_int(str(LANG_EQUALIZER_BAND_GAIN), str(LANG_UNIT_DB), UNIT_DB,
+ &global_settings.eq_hw_band3_gain, NULL,
+ EQ_HW_GAIN_STEP, EQ_HW_GAIN_MIN, EQ_HW_GAIN_MAX,
+ eq_hw_gain_format);
+
+#ifndef SIMULATOR
+ wmcodec_set_equalizer_band(3, global_settings.eq_hw_band3_center,
+ global_settings.eq_hw_band3_bandwidth,
+ global_settings.eq_hw_band3_gain);
+#endif
+
+ return result;
+}
+
+static bool eq_hw_set_band4_cutoff(void)
+{
+ static const struct opt_items names[] = {
+ { (unsigned char *)"5.3 kHz", TALK_ID(5300, UNIT_HERTZ) },
+ { (unsigned char *)"6.9 kHz", TALK_ID(6900, UNIT_HERTZ) },
+ { (unsigned char *)"9.0 kHz", TALK_ID(9000, UNIT_HERTZ) },
+ { (unsigned char *)"11.7 kHz", TALK_ID(11700, UNIT_HERTZ) },
+ };
+
+ bool result = set_option(str(LANG_EQUALIZER_BAND_CUTOFF),
+ &global_settings.eq_hw_band4_cutoff, INT, names,
+ sizeof(names) / sizeof(*names), NULL);
+
+#ifndef SIMULATOR
+ wmcodec_set_equalizer_band(4, global_settings.eq_hw_band4_cutoff, 0,
+ global_settings.eq_hw_band4_gain);
+#endif
+
+ return result;
+}
+
+static bool eq_hw_set_band4_gain(void)
+{
+ bool result = set_int(str(LANG_EQUALIZER_BAND_GAIN), str(LANG_UNIT_DB), UNIT_DB,
+ &global_settings.eq_hw_band4_gain, NULL,
+ EQ_HW_GAIN_STEP, EQ_HW_GAIN_MIN, EQ_HW_GAIN_MAX,
+ eq_hw_gain_format);
+
+#ifndef SIMULATOR
+ wmcodec_set_equalizer_band(4, global_settings.eq_hw_band4_cutoff, 0,
+ global_settings.eq_hw_band4_gain);
+#endif
+
+ return result;
+}
+
+static bool eq_hw_enabled(void)
+{
+ bool result = set_bool(str(LANG_EQUALIZER_HARDWARE_ENABLED),
+ &global_settings.eq_hw_enabled);
+
+#ifndef SIMULATOR
+ if (global_settings.eq_hw_enabled) {
+ wmcodec_set_equalizer_band(0, global_settings.eq_hw_band0_cutoff,
+ 0, global_settings.eq_hw_band0_gain);
+ wmcodec_set_equalizer_band(1, global_settings.eq_hw_band1_center,
+ global_settings.eq_hw_band1_bandwidth,
+ global_settings.eq_hw_band1_gain);
+ wmcodec_set_equalizer_band(2, global_settings.eq_hw_band2_center,
+ global_settings.eq_hw_band2_bandwidth,
+ global_settings.eq_hw_band2_gain);
+ wmcodec_set_equalizer_band(3, global_settings.eq_hw_band3_center,
+ global_settings.eq_hw_band3_bandwidth,
+ global_settings.eq_hw_band3_gain);
+ wmcodec_set_equalizer_band(4, global_settings.eq_hw_band4_cutoff,
+ 0, global_settings.eq_hw_band4_gain);
+ } else {
+ wmcodec_set_equalizer_band(0, global_settings.eq_hw_band0_cutoff, 0, 0);
+ wmcodec_set_equalizer_band(1, global_settings.eq_hw_band1_center,
+ global_settings.eq_hw_band1_bandwidth, 0);
+ wmcodec_set_equalizer_band(2, global_settings.eq_hw_band2_center,
+ global_settings.eq_hw_band2_bandwidth, 0);
+ wmcodec_set_equalizer_band(3, global_settings.eq_hw_band3_center,
+ global_settings.eq_hw_band3_bandwidth, 0);
+ wmcodec_set_equalizer_band(4, global_settings.eq_hw_band4_cutoff, 0, 0);
+ }
+#endif
+
+ return result;
+}
+
+static bool eq_hw_set_band0(void)
+{
+ int m;
+ bool result;
+ static const struct menu_item items[] = {
+ { ID2P(LANG_EQUALIZER_BAND_CUTOFF), eq_hw_set_band0_cutoff },
+ { ID2P(LANG_EQUALIZER_BAND_GAIN), eq_hw_set_band0_gain },
+ };
+
+ m = menu_init( items, sizeof(items) / sizeof(*items), NULL,
+ NULL, NULL, NULL);
+ result = menu_run(m);
+ menu_exit(m);
+
+ return result;
+}
+
+static bool eq_hw_set_band1(void)
+{
+ int m;
+ bool result;
+ static const struct menu_item items[] = {
+ { ID2P(LANG_EQUALIZER_BAND_CENTER), eq_hw_set_band1_center },
+ { ID2P(LANG_EQUALIZER_BANDWIDTH), eq_hw_set_band1_bandwidth },
+ { ID2P(LANG_EQUALIZER_BAND_GAIN), eq_hw_set_band1_gain },
+ };
+
+ m = menu_init( items, sizeof(items) / sizeof(*items), NULL,
+ NULL, NULL, NULL);
+ result = menu_run(m);
+ menu_exit(m);
+
+ return result;
+}
+
+static bool eq_hw_set_band2(void)
+{
+ int m;
+ bool result;
+ static const struct menu_item items[] = {
+ { ID2P(LANG_EQUALIZER_BAND_CENTER), eq_hw_set_band2_center },
+ { ID2P(LANG_EQUALIZER_BANDWIDTH), eq_hw_set_band2_bandwidth },
+ { ID2P(LANG_EQUALIZER_BAND_GAIN), eq_hw_set_band2_gain },
+ };
+
+ m = menu_init( items, sizeof(items) / sizeof(*items), NULL,
+ NULL, NULL, NULL);
+ result = menu_run(m);
+ menu_exit(m);
+
+ return result;
+}
+
+static bool eq_hw_set_band3(void)
+{
+ int m;
+ bool result;
+ static const struct menu_item items[] = {
+ { ID2P(LANG_EQUALIZER_BAND_CENTER), eq_hw_set_band3_center },
+ { ID2P(LANG_EQUALIZER_BANDWIDTH), eq_hw_set_band3_bandwidth },
+ { ID2P(LANG_EQUALIZER_BAND_GAIN), eq_hw_set_band3_gain },
+ };
+
+ m = menu_init( items, sizeof(items) / sizeof(*items), NULL,
+ NULL, NULL, NULL);
+ result = menu_run(m);
+ menu_exit(m);
+
+ return result;
+}
+
+static bool eq_hw_set_band4(void)
+{
+ int m;
+ bool result;
+ static const struct menu_item items[] = {
+ { ID2P(LANG_EQUALIZER_BAND_CUTOFF), eq_hw_set_band4_cutoff },
+ { ID2P(LANG_EQUALIZER_BAND_GAIN), eq_hw_set_band4_gain },
+ };
+
+ m = menu_init( items, sizeof(items) / sizeof(*items), NULL,
+ NULL, NULL, NULL);
+ result = menu_run(m);
+ menu_exit(m);
+
+ return result;
+}
+
+static bool eq_hw_menu(void)
+{
+ int m;
+ bool result;
+ static const struct menu_item items[] = {
+ { ID2P(LANG_EQUALIZER_HARDWARE_ENABLED), eq_hw_enabled },
+ { ID2P(LANG_EQUALIZER_BAND_LOW_SHELF), eq_hw_set_band0 },
+ { "Peak Filter 1", eq_hw_set_band1 },
+ { "Peak Filter 2", eq_hw_set_band2 },
+ { "Peak Filter 3", eq_hw_set_band3 },
+ { ID2P(LANG_EQUALIZER_BAND_HIGH_SHELF), eq_hw_set_band4 },
+ };
+
+ m = menu_init( items, sizeof(items) / sizeof(*items), NULL,
+ NULL, NULL, NULL);
+ result = menu_run(m);
+ menu_exit(m);
+
+ return result;
+}
+#endif
+
/* Full equalizer menu */
bool eq_menu(void)
{
@@ -856,11 +1256,14 @@ bool eq_menu(void)
{ ID2P(LANG_EQUALIZER_PRECUT), eq_precut },
{ ID2P(LANG_EQUALIZER_GAIN), eq_gain_menu },
{ ID2P(LANG_EQUALIZER_ADVANCED), eq_advanced_menu },
+#ifdef HAVE_WM8758
+ { ID2P(LANG_EQUALIZER_HARDWARE), eq_hw_menu },
+#endif
{ ID2P(LANG_EQUALIZER_SAVE), eq_save_preset },
{ ID2P(LANG_EQUALIZER_BROWSE), eq_browse_presets },
};
- m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
+ m = menu_init( items, sizeof(items) / sizeof(*items), NULL,
NULL, NULL, NULL);
result = menu_run(m);
menu_exit(m);
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 88b24ec567..b11b996570 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -9548,3 +9548,73 @@
*: ""
</voice>
</phrase>
+<phrase>
+ id: LANG_EQUALIZER_HARDWARE
+ desc: in the sound settings menu
+ user:
+ <source>
+ *: "Hardware Equalizer"
+ </source>
+ <dest>
+ *: "Hardware Equalizer"
+ </dest>
+ <voice>
+ *: "Hardware equalizer"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_EQUALIZER_HARDWARE_ENABLED
+ desc: in the equalizer settings menu
+ user:
+ <source>
+ *: "Enable Hardware EQ"
+ </source>
+ <dest>
+ *: "Enable Hardware EQ"
+ </dest>
+ <voice>
+ *: "Enable hardware equalizer"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_EQUALIZER_BANDWIDTH
+ desc: in the equalizer settings menu
+ user:
+ <source>
+ *: "Bandwidth"
+ </source>
+ <dest>
+ *: "Bandwidth"
+ </dest>
+ <voice>
+ *: "Bandwidth"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_EQUALIZER_HARDWARE_BANDWIDTH_NARROW
+ desc: in the equalizer settings menu
+ user:
+ <source>
+ *: "Narrow"
+ </source>
+ <dest>
+ *: "Narrow"
+ </dest>
+ <voice>
+ *: "Narrow"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_EQUALIZER_HARDWARE_BANDWIDTH_WIDE
+ desc: in the equalizer settings menu
+ user:
+ <source>
+ *: "Wide"
+ </source>
+ <dest>
+ *: "Wide"
+ </dest>
+ <voice>
+ *: "Wide"
+ </voice>
+</phrase>
diff --git a/apps/settings.c b/apps/settings.c
index 0901095dd6..2a232764fb 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -592,8 +592,28 @@ static const struct bit_entry hd_bits[] =
#endif
#endif /* CONFIG_BACKLIGHT */
-
+#ifdef HAVE_WM8758
+ {1, S_O(eq_hw_enabled), false, "eq hardware enabled", off_on },
+ {2, S_O(eq_hw_band0_cutoff), 1, "eq hardware band 0 cutoff", "80Hz,105Hz,135Hz,175Hz" },
+ {6|SIGNED, S_O(eq_hw_band0_gain), 12, "eq hardware band 0 gain", NULL },
+
+ {2, S_O(eq_hw_band1_center), 1, "eq hardware band 1 center", "230Hz,300Hz,385Hz,500Hz" },
+ {1, S_O(eq_hw_band1_bandwidth), 0, "eq hardware band 1 bandwidth", "narrow,wide" },
+ {6|SIGNED, S_O(eq_hw_band1_gain), 12, "eq hardware band 1 gain", NULL },
+
+ {2, S_O(eq_hw_band2_center), 1, "eq hardware band 2 center", "650Hz,850Hz,1.1kHz,1.4kHz" },
+ {1, S_O(eq_hw_band2_bandwidth), 0, "eq hardware band 2 bandwidth", "narrow,wide" },
+ {6|SIGNED, S_O(eq_hw_band2_gain), 12, "eq hardware band 2 gain", NULL },
+
+ {2, S_O(eq_hw_band3_center), 1, "eq hardware band 3 center", "1.8kHz,2.4kHz,3.2kHz,4.1kHz" },
+ {1, S_O(eq_hw_band3_bandwidth), 0, "eq hardware band 3 bandwidth", "narrow,wide" },
+ {6|SIGNED, S_O(eq_hw_band3_gain), 12, "eq hardware band 3 gain", NULL },
+
+ {2, S_O(eq_hw_band4_cutoff), 1, "eq hardware band 4 cutoff", "5.3kHz,6.9kHz,9kHz,11.7kHz" },
+ {6|SIGNED, S_O(eq_hw_band4_gain), 12, "eq hardware band 4 gain", NULL },
+#endif
+
/* If values are just added to the end, no need to bump the version. */
/* new stuff to be added at the end */
diff --git a/apps/settings.h b/apps/settings.h
index 369e1ebd6b..2d2c125721 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -542,6 +542,28 @@ struct user_settings
#ifdef HAVE_LCD_BITMAP
unsigned char kbd_file[MAX_FILENAME+1]; /* last keyboard */
#endif
+
+#ifdef HAVE_WM8758
+ bool eq_hw_enabled; /* Enable hardware equalizer */
+
+ int eq_hw_band0_cutoff;
+ int eq_hw_band0_gain;
+
+ int eq_hw_band1_center;
+ int eq_hw_band1_bandwidth;
+ int eq_hw_band1_gain;
+
+ int eq_hw_band2_center;
+ int eq_hw_band2_bandwidth;
+ int eq_hw_band2_gain;
+
+ int eq_hw_band3_center;
+ int eq_hw_band3_bandwidth;
+ int eq_hw_band3_gain;
+
+ int eq_hw_band4_cutoff;
+ int eq_hw_band4_gain;
+#endif
};
enum optiontype { INT, BOOL };
diff --git a/docs/CREDITS b/docs/CREDITS
index 4029cebe2a..b62608d6c9 100644
--- a/docs/CREDITS
+++ b/docs/CREDITS
@@ -224,3 +224,4 @@ Barry Wardell
Lars van de Klomp
Philippe Miossec
Jochen Kemnade
+Corry Lazarowitz
diff --git a/firmware/drivers/wm8758.c b/firmware/drivers/wm8758.c
index f3310f3ed6..b7894e66b7 100644
--- a/firmware/drivers/wm8758.c
+++ b/firmware/drivers/wm8758.c
@@ -272,3 +272,28 @@ void wmcodec_set_monitor(int enable) {
(void)enable;
}
+
+void wmcodec_set_equalizer_band(int band, int freq, int bw, int gain)
+{
+ unsigned int eq = 0;
+
+ /* Band 1..3 are peak filters */
+ if (band >= 1 && band <= 3) {
+ eq |= (bw << 8);
+ }
+
+ eq |= (freq << 5);
+ eq |= 12 - gain;
+
+ if (band == 0) {
+ wm8758_write(EQ0, eq);
+ } else if (band == 1) {
+ wm8758_write(EQ1, eq);
+ } else if (band == 2) {
+ wm8758_write(EQ2, eq);
+ } else if (band == 3) {
+ wm8758_write(EQ3, eq);
+ } else if (band == 4) {
+ wm8758_write(EQ4, eq);
+ }
+}
diff --git a/firmware/export/wm8758.h b/firmware/export/wm8758.h
index 13eccb9763..5630a93b1b 100644
--- a/firmware/export/wm8758.h
+++ b/firmware/export/wm8758.h
@@ -38,6 +38,8 @@ extern void wmcodec_disable_recording(void);
extern void wmcodec_set_recvol(int left, int right, int type);
extern void wmcodec_set_monitor(int enable);
+extern void wmcodec_set_equalizer_band(int band, int freq, int bw, int gain);
+
#define RESET 0x00
#define PWRMGMT1 0x01
#define PWRMGMT2 0x02
@@ -60,6 +62,12 @@ extern void wmcodec_set_monitor(int enable);
#define PLLK2 0x26
#define PLLK3 0x27
+#define EQ0 0x12
+#define EQ1 0x13
+#define EQ2 0x14
+#define EQ3 0x15
+#define EQ4 0x16
+
/* Register settings for the supported samplerates: */
#define WM8758_8000HZ 0x4d
#define WM8758_12000HZ 0x61