summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2010-09-24 22:42:06 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2010-09-24 22:42:06 +0000
commit6a9cabc4349238c6c7fddb9828b4c5f3f8099277 (patch)
tree963173fa83d757a5300e8e23d50b1f9b9b3bd69b
parent8458fade581d457de6455b95c84eb85a7a27f97d (diff)
downloadrockbox-6a9cabc4349238c6c7fddb9828b4c5f3f8099277.tar.gz
rockbox-6a9cabc4349238c6c7fddb9828b4c5f3f8099277.tar.bz2
rockbox-6a9cabc4349238c6c7fddb9828b4c5f3f8099277.zip
Implement lineout en-/disable for WM8975 and activate it for iPod nano 2G.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28159 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/audio/wm8975.c12
-rw-r--r--firmware/export/config/ipodnano2g.h3
-rw-r--r--firmware/export/wm8975.h1
-rw-r--r--firmware/target/arm/s5l8700/ipodnano2g/powermgmt-nano2g.c9
4 files changed, 25 insertions, 0 deletions
diff --git a/firmware/drivers/audio/wm8975.c b/firmware/drivers/audio/wm8975.c
index dbe39d8b62..3fcb01e728 100644
--- a/firmware/drivers/audio/wm8975.c
+++ b/firmware/drivers/audio/wm8975.c
@@ -192,6 +192,18 @@ void audiohw_set_lineout_vol(int vol_l, int vol_r)
wmcodec_write(ROUT2VOL, ROUT2VOL_RO2VU | ROUT2VOL_RO2ZC | vol_r);
}
+void audiohw_enable_lineout(bool enable)
+{
+ if (enable) {
+ /* Enable lineout */
+ wm8975_regs[PWRMGMT2] |= (PWRMGMT2_LOUT2 | PWRMGMT2_ROUT2);
+ } else {
+ /* Disable lineout */
+ wm8975_regs[PWRMGMT2] &= ~(PWRMGMT2_LOUT2 | PWRMGMT2_ROUT2);
+ }
+ wm8975_write(PWRMGMT2, wm8975_regs[PWRMGMT2]);
+}
+
void audiohw_set_bass(int value)
{
const int regvalues[] = {
diff --git a/firmware/export/config/ipodnano2g.h b/firmware/export/config/ipodnano2g.h
index a4189b35f3..898871d486 100644
--- a/firmware/export/config/ipodnano2g.h
+++ b/firmware/export/config/ipodnano2g.h
@@ -219,6 +219,9 @@
//#define IPOD_ACCESSORY_PROTOCOL
//#define HAVE_SERIAL
+/* Define this, if you can switch on/off the lineout */
+#define HAVE_LINEOUT_POWEROFF
+
#define USB_WRITE_BUFFER_SIZE (1024*64)
/* Define this if a programmable hotkey is mapped */
diff --git a/firmware/export/wm8975.h b/firmware/export/wm8975.h
index 5524d2e037..8c3cf473d6 100644
--- a/firmware/export/wm8975.h
+++ b/firmware/export/wm8975.h
@@ -32,6 +32,7 @@ extern int tenthdb2master(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_enable_lineout(bool enable);
/* Register addresses and bits */
diff --git a/firmware/target/arm/s5l8700/ipodnano2g/powermgmt-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/powermgmt-nano2g.c
index b0578a33d5..52491cf480 100644
--- a/firmware/target/arm/s5l8700/ipodnano2g/powermgmt-nano2g.c
+++ b/firmware/target/arm/s5l8700/ipodnano2g/powermgmt-nano2g.c
@@ -23,6 +23,7 @@
#include "powermgmt.h"
#include "pmu-target.h"
#include "power.h"
+#include "audiohw.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
{
@@ -77,3 +78,11 @@ void accessory_supply_set(bool enable)
}
}
#endif
+
+#ifdef HAVE_LINEOUT_POWEROFF
+void lineout_set(bool enable)
+{
+ /* Call audio hardware driver implementation */
+ audiohw_enable_lineout(enable);
+}
+#endif