From b6c12a129e22dadff4be67e5b0fe8993c888d6d8 Mon Sep 17 00:00:00 2001 From: Andree Buschmann Date: Sat, 20 Mar 2010 15:02:29 +0000 Subject: Submit FS#11065. Introduce a new system setting for en-/disabling the Line-out. For now only implemented on iPod Video. This allows to save power if the user does not use the player's Line-out. On iPod 5G the saving is ~0.5 mA. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25257 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/audio/wm8758.c | 17 +++++++++++++++++ firmware/export/config/ipodvideo.h | 3 +++ firmware/export/powermgmt.h | 3 +++ firmware/export/wm8758.h | 1 + firmware/target/arm/ipod/powermgmt-ipod-pcf.c | 9 +++++++++ 5 files changed, 33 insertions(+) (limited to 'firmware') diff --git a/firmware/drivers/audio/wm8758.c b/firmware/drivers/audio/wm8758.c index 715c921e33..40ead0cdf2 100644 --- a/firmware/drivers/audio/wm8758.c +++ b/firmware/drivers/audio/wm8758.c @@ -181,6 +181,23 @@ void audiohw_set_lineout_vol(int vol_l, int vol_r) wmcodec_write(ROUT2VOL, amp_r | ROUT2VOL_ROUT2ZC | ROUT2VOL_OUT2VU); } +void audiohw_enable_lineout(bool enable) +{ + if (enable) + { + /* include enabling of OUT2 */ + wmcodec_write(PWRMGMT3, PWRMGMT3_LOUT2EN | PWRMGMT3_ROUT2EN + | PWRMGMT3_RMIXEN | PWRMGMT3_LMIXEN + | PWRMGMT3_DACENR | PWRMGMT3_DACENL); + } + else + { + /* exclude enabling of OUT2 */ + wmcodec_write(PWRMGMT3, PWRMGMT3_RMIXEN | PWRMGMT3_LMIXEN + | PWRMGMT3_DACENR | PWRMGMT3_DACENL); + } +} + void audiohw_set_bass(int value) { eq1_reg = (eq1_reg & ~EQ_GAIN_MASK) | EQ_GAIN_VALUE(value); diff --git a/firmware/export/config/ipodvideo.h b/firmware/export/config/ipodvideo.h index a8d2220b8c..eec513320a 100644 --- a/firmware/export/config/ipodvideo.h +++ b/firmware/export/config/ipodvideo.h @@ -77,6 +77,9 @@ /* Define this if you can switch on/off the accessory power supply */ #define HAVE_ACCESSORY_SUPPLY +/* Define this, if you can switch on/off the lineout */ +#define HAVE_LINEOUT_POWEROFF + /* Define this if you have a software controlled poweroff */ #define HAVE_SW_POWEROFF diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h index 17519c5bfd..d86118cd9b 100644 --- a/firmware/export/powermgmt.h +++ b/firmware/export/powermgmt.h @@ -174,5 +174,8 @@ bool query_force_shutdown(void); #ifdef HAVE_ACCESSORY_SUPPLY void accessory_supply_set(bool); #endif +#ifdef HAVE_LINEOUT_POWEROFF +void lineout_set(bool); +#endif #endif /* _POWERMGMT_H_ */ diff --git a/firmware/export/wm8758.h b/firmware/export/wm8758.h index 9d1a938162..50cbc74e9a 100644 --- a/firmware/export/wm8758.h +++ b/firmware/export/wm8758.h @@ -34,6 +34,7 @@ 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_enable_lineout(bool enable); #define RESET 0x00 #define RESET_RESET 0x0 diff --git a/firmware/target/arm/ipod/powermgmt-ipod-pcf.c b/firmware/target/arm/ipod/powermgmt-ipod-pcf.c index 5b8f974fda..95f5380b92 100644 --- a/firmware/target/arm/ipod/powermgmt-ipod-pcf.c +++ b/firmware/target/arm/ipod/powermgmt-ipod-pcf.c @@ -25,6 +25,7 @@ #include "powermgmt.h" #include "pcf5060x.h" #include "pcf50605.h" +#include "audiohw.h" const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = { @@ -129,3 +130,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 -- cgit v1.2.3