Index: apps/plugin.c
===================================================================
RCS file: /cvsroot/rockbox/apps/plugin.c,v
retrieving revision 1.185
diff -u -r1.185 plugin.c
--- apps/plugin.c	26 Sep 2006 19:25:52 -0000	1.185
+++ apps/plugin.c	8 Oct 2006 12:45:09 -0000
@@ -472,6 +472,9 @@
     wheel_status,
     wheel_send_events,
 #endif
+#if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
+    backlight_dim,
+#endif
 };
 
 int plugin_load(const char* plugin, void* parameter)
Index: apps/plugin.h
===================================================================
RCS file: /cvsroot/rockbox/apps/plugin.h,v
retrieving revision 1.195
diff -u -r1.195 plugin.h
--- apps/plugin.h	26 Sep 2006 19:25:52 -0000	1.195
+++ apps/plugin.h	8 Oct 2006 12:45:10 -0000
@@ -552,6 +552,10 @@
     int (*wheel_status)(void);
     void (*wheel_send_events)(bool send);
 #endif
+
+#if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
+    void (*backlight_dim)(int value);
+#endif
 };
 
 /* plugin header */
Index: apps/plugins/vu_meter.c
===================================================================
RCS file: /cvsroot/rockbox/apps/plugins/vu_meter.c,v
retrieving revision 1.24
diff -u -r1.24 vu_meter.c
--- apps/plugins/vu_meter.c	3 Aug 2006 20:17:21 -0000	1.24
+++ apps/plugins/vu_meter.c	8 Oct 2006 12:45:11 -0000
@@ -521,6 +521,7 @@
 
 void analog_meter(void) {
 
+    int brightness;
 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
     int left_peak = rb->mas_codec_readreg(0xC);
     int right_peak = rb->mas_codec_readreg(0xD);
@@ -548,6 +549,16 @@
     left_needle_top_y = y_values[left_needle_top_x];
     right_needle_top_y = y_values[right_needle_top_x-half_width];
 
+    /* Backlight dimming */
+    if (left_needle_top_x > right_needle_top_x-half_width)
+        brightness = left_needle_top_x;
+    else
+        brightness = right_needle_top_x-half_width;
+#if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
+    rb->backlight_dim(brightness * 100 / half_width);
+#endif
+
+
     /* Needles */
     rb->lcd_drawline(quarter_width, LCD_HEIGHT-1, left_needle_top_x, left_needle_top_y);
     rb->lcd_drawline((quarter_width+half_width), LCD_HEIGHT-1, right_needle_top_x, right_needle_top_y);
Index: firmware/backlight.c
===================================================================
RCS file: /cvsroot/rockbox/firmware/backlight.c,v
retrieving revision 1.104
diff -u -r1.104 backlight.c
--- firmware/backlight.c	5 Oct 2006 10:58:50 -0000	1.104
+++ firmware/backlight.c	8 Oct 2006 12:45:13 -0000
@@ -263,7 +263,7 @@
     backlight_switch();
 }
 
-static void backlight_dim(int value)
+void backlight_dim(int value)
 {
     /* protect from extraneous calls with the same target value */
     if (value == bl_dim_target)
Index: firmware/export/backlight.h
===================================================================
RCS file: /cvsroot/rockbox/firmware/export/backlight.h,v
retrieving revision 1.19
diff -u -r1.19 backlight.h
--- firmware/export/backlight.h	10 Sep 2006 02:00:35 -0000	1.19
+++ firmware/export/backlight.h	8 Oct 2006 12:45:13 -0000
@@ -39,6 +39,7 @@
 #ifdef HAVE_BACKLIGHT_PWM_FADING
 void backlight_set_fade_in(int index);
 void backlight_set_fade_out(int index);
+void backlight_dim(int value);
 #endif
 
 void backlight_set_timeout_plugged(int index);
