Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: firmware/export/config/sansafuzev2.h
- ===================================================================
- --- firmware/export/config/sansafuzev2.h (revision 30118)
- +++ firmware/export/config/sansafuzev2.h (working copy)
- @@ -209,5 +209,8 @@
- #define INCLUDE_TIMEOUT_API
- +/* Define this, if you can switch on/off the lineout */
- +#define HAVE_LINEOUT_POWEROFF
- +
- /* Define this if a programmable hotkey is mapped */
- #define HAVE_HOTKEY
- Index: firmware/export/as3514.h
- ===================================================================
- --- firmware/export/as3514.h (revision 30118)
- +++ firmware/export/as3514.h (working copy)
- @@ -23,6 +23,7 @@
- #define _AS3514_H
- #include "config.h"
- +#include <stdbool.h>
- extern int tenthdb2master(int db);
- @@ -30,6 +31,10 @@
- extern void audiohw_set_lineout_vol(int vol_l, int vol_r);
- extern void audiohw_set_sampr_dividers(int fsel);
- +#if defined(SANSA_FUZEV2)
- +extern void audiohw_enable_lineout(bool enable);
- +#endif
- +
- /* Register Descriptions */
- #ifndef HAVE_AS3543
- Index: firmware/target/arm/as3525/power-as3525.c
- ===================================================================
- --- firmware/target/arm/as3525/power-as3525.c (revision 30118)
- +++ firmware/target/arm/as3525/power-as3525.c (working copy)
- @@ -73,3 +73,11 @@
- return true;
- }
- #endif
- +
- +#ifdef HAVE_LINEOUT_POWEROFF
- +void lineout_set(bool enable)
- +{
- + /* Call audio hardware driver implementation */
- + audiohw_enable_lineout(enable);
- +}
- +#endif
- Index: firmware/drivers/audio/as3514.c
- ===================================================================
- --- firmware/drivers/audio/as3514.c (revision 30118)
- +++ firmware/drivers/audio/as3514.c (working copy)
- @@ -78,6 +78,11 @@
- #endif
- };
- +#ifdef SANSA_FUZEV2
- +static int as3514_vol_l;
- +static int as3514_vol_r;
- +#endif
- +
- /* Shadow registers */
- static uint8_t as3514_regs[AS3514_NUM_AUDIO_REGS]; /* 8-bit registers */
- @@ -265,6 +270,7 @@
- audiohw_mute(false);
- }
- +
- void audiohw_set_master_vol(int vol_l, int vol_r)
- {
- unsigned int hph_r, hph_l;
- @@ -275,6 +281,17 @@
- return;
- }
- +#ifdef SANSA_FUZEV2
- + as3514_vol_l = vol_l;
- + as3514_vol_r = vol_r;
- +
- + if (as3514_regs[AS3514_HPH_OUT_R] & HPH_OUT_R_LINEOUT)
- + {
- + /* lineout active: force to 0dB */
- + vol_l = vol_r = tenthdb2master(0);
- + }
- +#endif
- +
- /* We combine the mixer/DAC channel volume range with the headphone volume
- range - keep first stage as loud as possible */
- @@ -316,6 +333,22 @@
- audiohw_mute(false);
- }
- +#if defined(SANSA_FUZEV2)
- +void audiohw_enable_lineout(bool enable)
- +{
- + if (enable)
- + {
- + as3514_set(AS3514_HPH_OUT_R, HPH_OUT_R_LINEOUT);
- + audiohw_set_master_vol(as3514_vol_l, as3514_vol_r);
- + }
- + else
- + {
- + as3514_clear(AS3514_HPH_OUT_R, HPH_OUT_R_LINEOUT);
- + audiohw_set_master_vol(as3514_vol_l, as3514_vol_r);
- + }
- +}
- +#endif
- +
- #if 0 /* unused */
- void audiohw_set_lineout_vol(int vol_l, int vol_r)
- {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement