Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

nwze370: improve lcd & backlight

Added lcd inversion
Fix issue where backlight would turn on before first frame rendered
Fix issue where backlight would shortly appear at 100% before PWM is
ready during fade in
Turn off backlight before booting/RoLo/shutdown to avoid it being
enabled on next boot
Fix issue where fade in isn't smooth because brightness levels below 13 were
basically equalivent to off, by removing these brightness levels

Change-Id: I868eae2cbeea52c6af7d09c886958ff46167fe26

authored by

nift4 and committed by
William Wilgus
b1511738 9722cad4

+47 -15
+2 -2
firmware/export/config/sonynwze360.h
··· 108 108 109 109 /* Main LCD backlight brightness range and defaults */ 110 110 #define MIN_BRIGHTNESS_SETTING 0 111 - #define MAX_BRIGHTNESS_SETTING 100 112 - #define DEFAULT_BRIGHTNESS_SETTING 50 111 + #define MAX_BRIGHTNESS_SETTING 88 112 + #define DEFAULT_BRIGHTNESS_SETTING 44 113 113 114 114 /* Which backlight fading type? */ 115 115 #define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING
+9 -7
firmware/export/config/sonynwze370.h
··· 22 22 /* define this if you have a colour LCD */ 23 23 #define HAVE_LCD_COLOR 24 24 25 + /* define this if you have LCD enable function */ 26 + #define HAVE_LCD_ENABLE 27 + 28 + /* Define this if the LCD can shut down */ 29 + #define HAVE_LCD_SHUTDOWN 30 + 25 31 #ifndef BOOTLOADER 26 32 #define HAVE_ALBUMART 27 33 ··· 42 48 /* define this if you would like tagcache to build on this target */ 43 49 #define HAVE_TAGCACHE 44 50 45 - /* define this if you have LCD enable function */ 46 - #define HAVE_LCD_ENABLE 47 - 48 51 /* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE 49 52 should be defined as well. 50 53 #define HAVE_LCD_SLEEP ··· 55 58 #define HAVE_LCD_FLIP 56 59 */ 57 60 58 - /* define this if you can invert the colours on your LCD 61 + /* define this if you can invert the colours on your LCD */ 59 62 #define HAVE_LCD_INVERT 60 - */ 61 63 62 64 /* define this if you have a real-time clock */ 63 65 #define CONFIG_RTC RTC_IMX233 ··· 108 110 109 111 /* Main LCD backlight brightness range and defaults */ 110 112 #define MIN_BRIGHTNESS_SETTING 0 111 - #define MAX_BRIGHTNESS_SETTING 100 112 - #define DEFAULT_BRIGHTNESS_SETTING 50 113 + #define MAX_BRIGHTNESS_SETTING 88 114 + #define DEFAULT_BRIGHTNESS_SETTING 44 113 115 114 116 /* Which backlight fading type? */ 115 117 #define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING
+2 -2
firmware/rolo.c
··· 64 64 #include "ascodec.h" 65 65 #endif 66 66 67 - #if defined(FIIO_M3K) 67 + #if defined(FIIO_M3K) || defined(SONY_NWZE370) 68 68 #include "backlight-target.h" 69 69 #endif 70 70 ··· 318 318 lcd_remote_update(); 319 319 #endif 320 320 321 - #if defined(FIIO_M3K) 321 + #if defined(FIIO_M3K) || defined(SONY_NWZE370) 322 322 /* Avoids the LCD backlight ramping down & up weirdly */ 323 323 backlight_hw_off(); 324 324 #endif
+12 -4
firmware/target/arm/imx233/sony-nwz/backlight-nwz.c
··· 26 26 #include "backlight-target.h" 27 27 #include "pwm-imx233.h" 28 28 #include "pinctrl-imx233.h" 29 + #include "kernel.h" 30 + 31 + static int last_brightness; 29 32 30 33 void backlight_hw_brightness(int brightness) 31 34 { 32 35 bool en = brightness > 0; 33 - imx233_pwm_setup_simple(2, 24000, 100 - brightness); 36 + /* brightness has extreme dip above 88% duty cycle, limit range to [87%, 0%] */ 37 + if (en) 38 + imx233_pwm_setup_simple(2, 24000, 88 - brightness); 34 39 imx233_pwm_enable(2, en); 40 + if (last_brightness == 0 && en) 41 + sleep(HZ / 25); /* make sure PWM settings are applied */ 42 + last_brightness = brightness; 35 43 imx233_pinctrl_set_gpio(0, 10, en); 36 44 } 37 45 ··· 40 48 imx233_pinctrl_acquire(0, 10, "backlight_enable"); 41 49 imx233_pinctrl_set_function(0, 10, PINCTRL_FUNCTION_GPIO); 42 50 imx233_pinctrl_enable_gpio(0, 10, true); 43 - imx233_pinctrl_set_gpio(0, 10, true); 44 - backlight_hw_brightness(DEFAULT_BRIGHTNESS_SETTING); 45 - return true; 51 + backlight_hw_brightness(0); 52 + return false; 46 53 } 47 54 48 55 void backlight_hw_on(void) ··· 50 57 #ifdef HAVE_LCD_ENABLE 51 58 lcd_enable(true); /* power on lcd + visible display */ 52 59 #endif 60 + sleep(HZ / 10); /* make sure screen is not white anymore */ 53 61 /* don't do anything special, the core will set the brightness */ 54 62 } 55 63
+22
firmware/target/arm/imx233/sony-nwz/lcd-nwze370.c
··· 31 31 32 32 #ifdef HAVE_LCD_ENABLE 33 33 static bool lcd_on; 34 + #ifdef HAVE_LCD_INVERT 35 + static bool lcd_inverted; 36 + #endif 34 37 #endif 35 38 36 39 static void lcd_write_reg(uint8_t reg, void *data, int data_len) ··· 120 123 if(enable) 121 124 { 122 125 lcd_write_reg(0x11, NULL, 0); 126 + #ifdef HAVE_LCD_INVERT 127 + lcd_set_invert_display(lcd_inverted); 128 + #endif 123 129 lcd_write_reg(0x29, NULL, 0); 124 130 } 125 131 else ··· 143 149 imx233_lcdif_enable(false); 144 150 else 145 151 send_event(LCD_EVENT_ACTIVATION, NULL); 152 + } 153 + #endif 154 + 155 + #ifdef HAVE_LCD_SHUTDOWN 156 + void lcd_shutdown(void) { 157 + backlight_hw_off(); 158 + } 159 + #endif 160 + 161 + #ifdef HAVE_LCD_INVERT 162 + void lcd_set_invert_display(bool yesno) 163 + { 164 + lcd_write_reg(yesno ? 0x21 : 0x20, NULL, 0); 165 + #ifdef HAVE_LCD_ENABLE 166 + lcd_inverted = yesno; 167 + #endif 146 168 } 147 169 #endif 148 170