Advertisement
Guest User

Sansa. FS(2111+11304+9305)

a guest
Jul 2nd, 2011
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 15.77 KB | None | 0 0
  1. Index: apps/action.c
  2. ===================================================================
  3. --- apps/action.c   (revision 30109)
  4. +++ apps/action.c   (working copy)
  5. @@ -149,6 +149,38 @@
  6.              CONTEXT_STD :
  7.              items[i].action_code;
  8.  }
  9. +
  10. +static bool backlight_on_action(int action)
  11. +{
  12. +    /* no backlight on volume change and pause/play */
  13. +    return (action != ACTION_WPS_VOLUP)
  14. +        && (action != ACTION_WPS_VOLDOWN)
  15. +        && (action != ACTION_WPS_SKIPNEXT)
  16. +        && (action != ACTION_WPS_SKIPPREV)
  17. +        && (action != ACTION_WPS_PLAY);
  18. +}
  19. +
  20. +static bool backlight_on_keypress_oracle(int btn)
  21. +{
  22. +    /* check whether the button would fire an action */
  23. +    /* If yes, check whether that action should turn on the backlight */
  24. +    /* Keep this function fast! It's called from the button ticktask */
  25. +    /* or the scrollwheel interrupt handler! */
  26. +
  27. +    const struct button_mapping *items = NULL;
  28. +    int i = 0;
  29. +
  30. +    if (!global_settings.backlight_on_volume_change)
  31. +    {
  32. +        items = get_context_mapping(CONTEXT_WPS);
  33. +        /* also check action for button release */
  34. +        return backlight_on_action(do_button_check(items, btn, BUTTON_NONE, &i))
  35. +            && backlight_on_action(do_button_check(items, btn | BUTTON_REL, btn, &i));
  36. +    }
  37. +    else
  38. +        return true;
  39. +}
  40. +
  41.  /*
  42.   * int get_action_worker(int context, struct button_mapping *user_mappings,
  43.     int timeout)
  44. @@ -176,6 +208,16 @@
  45.      
  46.      send_event(GUI_EVENT_ACTIONUPDATE, NULL);
  47.  
  48. +    /* In CONTEXT_WPS or CONTEXT_FM we may want to keep the backlight off
  49. +    /* on certain actions. */
  50. +    /* Thus, a callback function is used to check if it should turn on. */
  51. +    /* See also button.c */
  52. +    if (   (context & ~ALLOW_SOFTLOCK) == CONTEXT_WPS
  53. +        || (context & ~ALLOW_SOFTLOCK) == CONTEXT_FM )
  54. +        set_backlight_on_keypress_oracle(backlight_on_keypress_oracle);
  55. +    else
  56. +        set_backlight_on_keypress_oracle(NULL);
  57. +
  58.      if (timeout == TIMEOUT_NOBLOCK)
  59.          button = button_get(false);
  60.      else if  (timeout == TIMEOUT_BLOCK)
  61. Index: apps/lang/deutsch.lang
  62. ===================================================================
  63. --- apps/lang/deutsch.lang  (revision 30109)
  64. +++ apps/lang/deutsch.lang  (working copy)
  65. @@ -2595,6 +2595,20 @@
  66.    </voice>
  67.  </phrase>
  68.  <phrase>
  69. +  id: LANG_BACKLIGHT_ON_VOLUME_CHANGE
  70. +  desc: Backlight on volume change and on pause/play
  71. +  user: core
  72. +  <source>
  73. +    *: "Backlight On Volume Change"
  74. +  </source>
  75. +  <dest>
  76. +    *: "Beleuchtung bei Änderung der Lautstärke"
  77. +  </dest>
  78. +  <voice>
  79. +    *: "Beleuchtung bei Änderung der Lautstärke"
  80. +  </voice>
  81. +</phrase>
  82. +<phrase>
  83.    id: LANG_LCD_SLEEP_AFTER_BACKLIGHT_OFF
  84.    desc: In display settings, time to switch LCD chip into power saving state
  85.    user: core
  86. Index: apps/lang/russian.lang
  87. ===================================================================
  88. --- apps/lang/russian.lang  (revision 30109)
  89. +++ apps/lang/russian.lang  (working copy)
  90. @@ -7617,6 +7617,20 @@
  91.    </voice>
  92.  </phrase>
  93.  <phrase>
  94. +  id: LANG_BACKLIGHT_ON_VOLUME_CHANGE
  95. +  desc: Backlight on volume change and on pause/play
  96. +  user: core
  97. +  <source>
  98. +    *: "Backlight on Volume Change"
  99. +  </source>
  100. +  <dest>
  101. +    *: "Подсветка при изменении Громкости"
  102. +  </dest>
  103. +  <voice>
  104. +    *: "Подсветка при изменении Громкости"
  105. +  </voice>
  106. +</phrase>
  107. +<phrase>
  108.    id: LANG_LCD_SLEEP_AFTER_BACKLIGHT_OFF
  109.    desc: In display settings, time to switch LCD chip into power saving state
  110.    user: core
  111. Index: apps/lang/english.lang
  112. ===================================================================
  113. --- apps/lang/english.lang  (revision 30109)
  114. +++ apps/lang/english.lang  (working copy)
  115. @@ -2678,6 +2678,20 @@
  116.    </voice>
  117.  </phrase>
  118.  <phrase>
  119. +  id: LANG_BACKLIGHT_ON_VOLUME_CHANGE
  120. +  desc: Backlight on volume change and on pause/play
  121. +  user: core
  122. +  <source>
  123. +    *: "Backlight on Volume Change"
  124. +  </source>
  125. +  <dest>
  126. +    *: "Backlight on Volume Change"
  127. +  </dest>
  128. +  <voice>
  129. +    *: "Backlight on Volume Change"
  130. +  </voice>
  131. +</phrase>
  132. +<phrase>
  133.    id: LANG_LCD_SLEEP_AFTER_BACKLIGHT_OFF
  134.    desc: In display settings, time to switch LCD chip into power saving state
  135.    user: core
  136. Index: apps/settings.h
  137. ===================================================================
  138. --- apps/settings.h (revision 30109)
  139. +++ apps/settings.h (working copy)
  140. @@ -674,6 +674,8 @@
  141.                                 then according to timeout_values[] */
  142.      bool caption_backlight; /* turn on backlight at end and start of track */
  143.      bool bl_filter_first_keypress;   /* filter first keypress when dark? */
  144. +    bool backlight_on_volume_change; /* turn on the backlight on volume change
  145. +                                        and on pause/play? */
  146.  #if CONFIG_CHARGING
  147.      int backlight_timeout_plugged;
  148.  #endif
  149. Index: apps/menus/display_menu.c
  150. ===================================================================
  151. --- apps/menus/display_menu.c   (revision 30109)
  152. +++ apps/menus/display_menu.c   (working copy)
  153. @@ -101,6 +101,9 @@
  154.  MENUITEM_SETTING(bl_filter_first_keypress,
  155.                      &global_settings.bl_filter_first_keypress,
  156.                      filterfirstkeypress_callback);
  157. +MENUITEM_SETTING(backlight_on_volume_change,
  158. +                    &global_settings.backlight_on_volume_change,
  159. +                    NULL);
  160.  #ifdef HAVE_LCD_SLEEP_SETTING
  161.  MENUITEM_SETTING(lcd_sleep_after_backlight_off,
  162.                  &global_settings.lcd_sleep_after_backlight_off, NULL);
  163. @@ -138,6 +141,7 @@
  164.              ,&backlight_fade_in, &backlight_fade_out
  165.  #endif
  166.              ,&bl_filter_first_keypress
  167. +            ,&backlight_on_volume_change
  168.  # ifdef HAVE_LCD_SLEEP_SETTING
  169.              ,&lcd_sleep_after_backlight_off
  170.  # endif
  171. Index: apps/settings_list.c
  172. ===================================================================
  173. --- apps/settings_list.c    (revision 30109)
  174. +++ apps/settings_list.c    (working copy)
  175. @@ -853,6 +853,9 @@
  176.      OFFON_SETTING(0, bl_filter_first_keypress,
  177.                    LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS, false,
  178.                    "backlight filters first keypress", NULL),
  179. +    OFFON_SETTING(0, backlight_on_volume_change,
  180. +                  LANG_BACKLIGHT_ON_VOLUME_CHANGE, true,
  181. +                  "backlight on volume change", NULL),
  182.  #ifdef HAVE_REMOTE_LCD
  183.      OFFON_SETTING(0, remote_bl_filter_first_keypress,
  184.                    LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS, false,
  185. Index: firmware/export/button.h
  186. ===================================================================
  187. --- firmware/export/button.h    (revision 30109)
  188. +++ firmware/export/button.h    (working copy)
  189. @@ -46,6 +46,23 @@
  190.  #endif
  191.  #ifdef HAVE_BACKLIGHT
  192.  void set_backlight_filter_keypress(bool value);
  193. +
  194. +/* Callback function to tell whether the backlight should be turned on
  195. + * when a key is pressed. Called just after a key press.
  196. + *
  197. + * @param btn The button that was pressed
  198. + *
  199. + * Returns true iff the backlight should be turned on on key press.
  200. + */
  201. +typedef bool (*backlight_on_keypress_oracle_func)(int btn);
  202. +
  203. +/* Sets the new 'oracle' to tell whether the backlight should be turned
  204. + * on when a key is pressed. Passing NULL as parameter will turn on the BL
  205. + * on every key press.
  206. + */
  207. +void set_backlight_on_keypress_oracle(backlight_on_keypress_oracle_func func);
  208. +void backlight_on_by_button(int btn);
  209. +
  210.  #ifdef HAVE_REMOTE_LCD
  211.  void set_remote_backlight_filter_keypress(bool value);
  212.  #endif
  213. Index: firmware/export/as3514.h
  214. ===================================================================
  215. --- firmware/export/as3514.h    (revision 30109)
  216. +++ firmware/export/as3514.h    (working copy)
  217. @@ -300,6 +300,10 @@
  218.  
  219.  /* AUDIOSET2 (15h) */
  220.  #ifdef HAVE_AS3543
  221. +#define AUDIOSET2_BIAS_on      (0x0 << 7)
  222. +#define AUDIOSET2_BIAS_off      (0x1 << 7)
  223. +#define AUDIOSET2_SUM_off      (0x1 << 6)
  224. +#define AUDIOSET2_AGC_off       (0x1 << 5)
  225.  #define AUDIOSET2_HPH_QUALITY_LOW_POWER (0x0 << 4)
  226.  #define AUDIOSET2_HPH_QUALITY_HIGH      (0x1 << 4)
  227.  #else
  228. Index: firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
  229. ===================================================================
  230. --- firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c (revision 30109)
  231. +++ firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c (working copy)
  232. @@ -160,7 +160,7 @@
  233.                     (wheel_delta << 24) | wheel_velocity*360/WHEELCLICKS_PER_ROTATION);
  234.              /* message posted - reset delta and poke backlight on*/
  235.              wheel_delta = 1;
  236. -            backlight_on();
  237. +            backlight_on_by_button(btn);
  238.              buttonlight_on();
  239.          }
  240.          else
  241. Index: firmware/target/arm/ipod/button-clickwheel.c
  242. ===================================================================
  243. --- firmware/target/arm/ipod/button-clickwheel.c    (revision 30109)
  244. +++ firmware/target/arm/ipod/button-clickwheel.c    (working copy)
  245. @@ -137,8 +137,7 @@
  246.                  new_wheel_value = (status >> 16) & 0x7f;
  247.                  whl = new_wheel_value;
  248.                  
  249. -                /* switch on backlight (again), reset power-off timer */
  250. -                backlight_on();
  251. +                /* reset power-off timer */
  252.                  reset_poweroff_timer();
  253.                  
  254.                  /* Check whether the scrollwheel was untouched by accident or by will. */
  255. @@ -181,6 +180,9 @@
  256.  
  257.                      if (wheel_keycode != BUTTON_NONE)
  258.                      {
  259. +                        /* switch on backlight (again) */
  260. +                        backlight_on_by_button(wheel_keycode);
  261. +
  262.                          long v = (usec - last_wheel_usec) & 0x7fffffff;
  263.                          
  264.                          /* undo signedness */
  265. Index: firmware/target/arm/ipod/button-1g-3g.c
  266. ===================================================================
  267. --- firmware/target/arm/ipod/button-1g-3g.c (revision 30109)
  268. +++ firmware/target/arm/ipod/button-1g-3g.c (working copy)
  269. @@ -95,13 +95,6 @@
  270.          count = 0;
  271.      }
  272.  
  273. -    /* poke backlight every 1/4s of activity */
  274. -    if (TIME_AFTER(current_tick, next_backlight_on)) {
  275. -        backlight_on();
  276. -        reset_poweroff_timer();
  277. -        next_backlight_on = current_tick + HZ/4;
  278. -    }
  279. -
  280.      /* has wheel travelled far enough? */
  281.      if (++count < WHEEL_BASE_SENSITIVITY) {
  282.          return;
  283. @@ -126,6 +119,13 @@
  284.  
  285.      /* have a keycode */
  286.  
  287. +    /* poke backlight every 1/4s of activity */
  288. +    if (TIME_AFTER(current_tick, next_backlight_on)) {
  289. +        backlight_on_by_button(wheel_keycode);
  290. +        reset_poweroff_timer();
  291. +        next_backlight_on = current_tick + HZ/4;
  292. +    }
  293. +
  294.      usec = USEC_TIMER;
  295.      v = usec - last_wheel_usec;
  296.  
  297. Index: firmware/target/arm/ipod/button-mini1g.c
  298. ===================================================================
  299. --- firmware/target/arm/ipod/button-mini1g.c    (revision 30109)
  300. +++ firmware/target/arm/ipod/button-mini1g.c    (working copy)
  301. @@ -91,13 +91,6 @@
  302.          return;
  303.      }
  304.  
  305. -   /* poke backlight every 1/4s of activity */
  306. -    if (TIME_AFTER(current_tick, next_backlight_on)) {
  307. -        backlight_on();
  308. -        reset_poweroff_timer();
  309. -        next_backlight_on = current_tick + HZ/4;
  310. -    }
  311. -
  312.      if (++count < WHEEL_BASE_SENSITIVITY)
  313.          return;
  314.  
  315. @@ -118,6 +111,13 @@
  316.  
  317.      /* have a keycode */
  318.  
  319. +   /* poke backlight every 1/4s of activity */
  320. +    if (TIME_AFTER(current_tick, next_backlight_on)) {
  321. +        backlight_on_by_button(wheel_keycode);
  322. +        reset_poweroff_timer();
  323. +        next_backlight_on = current_tick + HZ/4;
  324. +    }
  325. +
  326.      usec = USEC_TIMER;
  327.      v = usec - last_wheel_usec;
  328.  
  329. Index: firmware/target/arm/sandisk/sansa-e200/button-e200.c
  330. ===================================================================
  331. --- firmware/target/arm/sandisk/sansa-e200/button-e200.c    (revision 30109)
  332. +++ firmware/target/arm/sandisk/sansa-e200/button-e200.c    (working copy)
  333. @@ -170,7 +170,7 @@
  334.          /* Poke backlight to turn it on or maintain it no more often
  335.           * than every 1/4 second */
  336.          next_backlight_on = current_tick + HZ/4;
  337. -        backlight_on();
  338. +        backlight_on_by_button(keycode);
  339.  #ifdef HAVE_BUTTON_LIGHT
  340.          buttonlight_on();
  341.  #endif
  342. Index: firmware/drivers/button.c
  343. ===================================================================
  344. --- firmware/drivers/button.c   (revision 30109)
  345. +++ firmware/drivers/button.c   (working copy)
  346. @@ -41,6 +41,7 @@
  347.  #ifdef HAVE_REMOTE_LCD
  348.  #include "lcd-remote.h"
  349.  #endif
  350. +#include "debug.h"
  351.  
  352.  struct event_queue button_queue SHAREDBSS_ATTR;
  353.  
  354. @@ -52,6 +53,7 @@
  355.  #endif
  356.  #ifdef HAVE_BACKLIGHT
  357.  static bool filter_first_keypress;
  358. +static backlight_on_keypress_oracle_func backlight_on_keypress_oracle = NULL;
  359.  #ifdef HAVE_REMOTE_LCD
  360.  static bool remote_filter_first_keypress;
  361.  #endif
  362. @@ -138,6 +140,28 @@
  363.      return ret;
  364.  }
  365.  
  366. +void backlight_on_by_button(int btn)
  367. +{
  368. +    bool bl_on;
  369. +    if ((backlight_on_keypress_oracle != NULL) && (!is_backlight_on(true)))
  370. +    {
  371. +        bl_on = (*backlight_on_keypress_oracle)(btn);
  372. +        DEBUGF("BL oracle (%d) returned: %d\n", btn, bl_on);
  373. +    }
  374. +    else
  375. +    {
  376. +        bl_on = true;
  377. +        DEBUGF("BL callback is NULL -> bl ON\n");
  378. +    }
  379. +    if (bl_on)
  380. +    {
  381. +        backlight_on();
  382. +#ifdef HAVE_BUTTON_LIGHT
  383. +        buttonlight_on();
  384. +#endif
  385. +    }
  386. +}
  387. +
  388.  static void button_tick(void)
  389.  {
  390.      static int count = 0;
  391. @@ -308,10 +332,13 @@
  392.                              skip_remote_release = true;
  393.                      }
  394.                      else
  395. -#endif
  396. -                        if (!filter_first_keypress || is_backlight_on(false)
  397. +#endif /* HAVE_REMOTE_LCD */
  398. +                        if (!filter_first_keypress
  399. +                            || is_backlight_on(false)
  400. +                            || ((backlight_on_keypress_oracle != NULL)
  401. +                                && !(*backlight_on_keypress_oracle)(btn))
  402.  #if BUTTON_REMOTE
  403. -                                || (btn & BUTTON_REMOTE)
  404. +                            || (btn & BUTTON_REMOTE)
  405.  #endif
  406.                             )
  407.                              button_try_post(btn, data);
  408. @@ -327,12 +354,7 @@
  409.                      remote_backlight_on();
  410.                  else
  411.  #endif
  412. -                {
  413. -                    backlight_on();
  414. -#ifdef HAVE_BUTTON_LIGHT
  415. -                    buttonlight_on();
  416. -#endif
  417. -                }
  418. +                    backlight_on_by_button(btn);
  419.  
  420.                  reset_poweroff_timer();
  421.              }
  422. @@ -447,6 +469,7 @@
  423.  #endif
  424.  #ifdef HAVE_BACKLIGHT
  425.      filter_first_keypress = false;
  426. +    set_backlight_on_keypress_oracle(NULL);
  427.  #ifdef HAVE_REMOTE_LCD
  428.      remote_filter_first_keypress = false;
  429.  #endif    
  430. @@ -558,6 +581,12 @@
  431.  {
  432.      filter_first_keypress = value;
  433.  }
  434. +
  435. +void set_backlight_on_keypress_oracle(backlight_on_keypress_oracle_func new_value)
  436. +{
  437. +    backlight_on_keypress_oracle = new_value;
  438. +}
  439. +
  440.  #ifdef HAVE_REMOTE_LCD
  441.  void set_remote_backlight_filter_keypress(bool value)
  442.  {
  443. Index: firmware/drivers/audio/as3514.c
  444. ===================================================================
  445. --- firmware/drivers/audio/as3514.c (revision 30109)
  446. +++ firmware/drivers/audio/as3514.c (working copy)
  447. @@ -151,9 +151,9 @@
  448.  #ifdef HAVE_AS3543
  449.  
  450.      as3514_write(AS3514_AUDIOSET1, AUDIOSET1_DAC_on | AUDIOSET1_DAC_GAIN_on);
  451. -    as3514_write(AS3514_AUDIOSET2, AUDIOSET2_HPH_QUALITY_LOW_POWER);
  452. +    as3514_write(AS3514_AUDIOSET2, AUDIOSET2_AGC_off | AUDIOSET2_HPH_QUALITY_HIGH);
  453.      /* common ground on, delay playback unmuting when inserting headphones */
  454. -    as3514_write(AS3514_AUDIOSET3, AUDIOSET3_HPCM_on | AUDIOSET3_HP_LONGSTART);
  455. +    as3514_write(AS3514_AUDIOSET3, AUDIOSET3_HPCM_on | AUDIOSET3_HP_LONGSTART | AUDIOSET3_HP_BIAS_150);
  456.  
  457.      as3514_write(AS3543_DAC_IF, AS3543_DAC_INT_PLL);
  458.      /* Select Line 2 for FM radio */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement