Advertisement
Guest User

Sansa Fuze Line Out patch

a guest
Jul 2nd, 2011
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.03 KB | None | 0 0
  1. Index: firmware/export/config/sansafuzev2.h
  2. ===================================================================
  3. --- firmware/export/config/sansafuzev2.h    (revision 30118)
  4. +++ firmware/export/config/sansafuzev2.h    (working copy)
  5. @@ -209,5 +209,8 @@
  6.  
  7.  #define INCLUDE_TIMEOUT_API
  8.  
  9. +/* Define this, if you can switch on/off the lineout */
  10. +#define HAVE_LINEOUT_POWEROFF
  11. +
  12.  /* Define this if a programmable hotkey is mapped */
  13.  #define HAVE_HOTKEY
  14. Index: firmware/export/as3514.h
  15. ===================================================================
  16. --- firmware/export/as3514.h    (revision 30118)
  17. +++ firmware/export/as3514.h    (working copy)
  18. @@ -23,6 +23,7 @@
  19.  #define _AS3514_H
  20.  
  21.  #include "config.h"
  22. +#include <stdbool.h>
  23.  
  24.  extern int tenthdb2master(int db);
  25.  
  26. @@ -30,6 +31,10 @@
  27.  extern void audiohw_set_lineout_vol(int vol_l, int vol_r);
  28.  extern void audiohw_set_sampr_dividers(int fsel);
  29.  
  30. +#if defined(SANSA_FUZEV2)
  31. +extern void audiohw_enable_lineout(bool enable);
  32. +#endif
  33. +
  34.  /* Register Descriptions */
  35.  
  36.  #ifndef HAVE_AS3543
  37. Index: firmware/target/arm/as3525/power-as3525.c
  38. ===================================================================
  39. --- firmware/target/arm/as3525/power-as3525.c   (revision 30118)
  40. +++ firmware/target/arm/as3525/power-as3525.c   (working copy)
  41. @@ -73,3 +73,11 @@
  42.      return true;
  43.  }
  44.  #endif
  45. +
  46. +#ifdef HAVE_LINEOUT_POWEROFF
  47. +void lineout_set(bool enable)
  48. +{
  49. +    /* Call audio hardware driver implementation */
  50. +    audiohw_enable_lineout(enable);
  51. +}
  52. +#endif
  53. Index: firmware/drivers/audio/as3514.c
  54. ===================================================================
  55. --- firmware/drivers/audio/as3514.c (revision 30118)
  56. +++ firmware/drivers/audio/as3514.c (working copy)
  57. @@ -78,6 +78,11 @@
  58.  #endif
  59.  };
  60.  
  61. +#ifdef SANSA_FUZEV2
  62. +static int as3514_vol_l;
  63. +static int as3514_vol_r;
  64. +#endif
  65. +
  66.  /* Shadow registers */
  67.  static uint8_t as3514_regs[AS3514_NUM_AUDIO_REGS]; /* 8-bit registers */
  68.  
  69. @@ -265,6 +270,7 @@
  70.      audiohw_mute(false);
  71.  }
  72.  
  73. +
  74.  void audiohw_set_master_vol(int vol_l, int vol_r)
  75.  {
  76.      unsigned int hph_r, hph_l;
  77. @@ -275,6 +281,17 @@
  78.          return;
  79.      }
  80.  
  81. +#ifdef SANSA_FUZEV2
  82. +    as3514_vol_l = vol_l;
  83. +    as3514_vol_r = vol_r;
  84. +
  85. +    if (as3514_regs[AS3514_HPH_OUT_R] & HPH_OUT_R_LINEOUT)
  86. +    {
  87. +        /* lineout active: force to 0dB */
  88. +        vol_l = vol_r = tenthdb2master(0);
  89. +    }
  90. +#endif
  91. +
  92.      /* We combine the mixer/DAC channel volume range with the headphone volume
  93.         range - keep first stage as loud as possible */
  94.  
  95. @@ -316,6 +333,22 @@
  96.      audiohw_mute(false);
  97.  }
  98.  
  99. +#if defined(SANSA_FUZEV2)
  100. +void audiohw_enable_lineout(bool enable)
  101. +{
  102. +    if (enable)
  103. +    {
  104. +        as3514_set(AS3514_HPH_OUT_R, HPH_OUT_R_LINEOUT);
  105. +        audiohw_set_master_vol(as3514_vol_l, as3514_vol_r);
  106. +    }
  107. +    else
  108. +    {
  109. +        as3514_clear(AS3514_HPH_OUT_R, HPH_OUT_R_LINEOUT);
  110. +        audiohw_set_master_vol(as3514_vol_l, as3514_vol_r);
  111. +    }
  112. +}
  113. +#endif
  114. +
  115.  #if 0 /* unused */
  116.  void audiohw_set_lineout_vol(int vol_l, int vol_r)
  117.  {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement