From ca72e87f5d7a7d965aa8af6c16d0cfba094bda32 Mon Sep 17 00:00:00 2001 From: Buschel Date: Fri, 24 Sep 2010 22:42:06 +0000 Subject: [PATCH] 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 --- firmware/drivers/audio/wm8975.c | 12 ++++++++++++ firmware/export/config/ipodnano2g.h | 3 +++ firmware/export/wm8975.h | 1 + firmware/target/arm/s5l8700/ipodnano2g/powermgmt-nano2g.c | 9 +++++++++ 4 files changed, 25 insertions(+) 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 -- 2.11.4.GIT