Example #1
0
void run_rtc_test(void)
{
    hal_initialize();

    gfx_init();
    backlight_init();
    backlight_set_brightness(90);
    tty_enable_view(bTrue);

    rtc_initialize();
    rtc_set(&setupTime);

#ifdef TEST_FOREVER
    for(;;)
#endif
    {
        tty_enable_view(bFalse);
        tty_reset();
        rtc_now(&nowTime);
        rtc_format_time(&nowTime, RTC_FMT_DATE | RTC_FMT_TIME | RTC_FMT_SECONDS | RTC_FMT_WEEK, tty_outchar);
        tty_enable_view(bTrue);

        delay_ms(200);
    }
} 
Example #2
0
void run_printf_test( void )
{
    uint16_t uval = 0;
    int16_t ival = 0;

    hal_initialize();

    gfx_init();
    backlight_init();
    backlight_set_brightness(90);
    tty_enable_view(bTrue);

#ifdef TEST_FOREVER
    for(;;)
#endif
    {
        tiny_sprintf(buffer, "test: %u, %d, %x, %B", ival, ival, ival, ival);

        tiny_printf("uint: %u, int: %d, hex: %x or %X, bhex: %b or %B, escape: %%\n",
                uval, ival, uval, uval, uval, uval);

        tiny_printf("string test %d: %s (OK)\n", uval, buffer);

        uval++;
        ival = ival > 0 ? -uval : uval;

        delay_ms(500);
    }
}
Example #3
0
void run_touch_test( void )
{
    uint16_t ret = 0;

    hal_initialize();

    gfx_init();
    backlight_init();
    backlight_set_brightness(90);
    tty_enable_view(bTrue);

    tty_output_delayed("TOUCH test! Initialization... \n", 1000);

    ret = touch_initialize();
    guard(ret);

    touch_set_event_handler(touchEventFunc);

#ifdef TEST_FOREVER
    for(;;)
#endif
    {
        //tty_enable_view(False);
        //tty_reset();

        ret = touch_process();
        guard(ret);

        //tty_enable_view(True);
        delay_ms(100);
    }
}
void turn_panel_on()
{
	if(!panel_has_enabled) {
		backlight_enable(1);
		backlight_set_brightness(0x3f);
		panel_has_enabled = 1;
	}
}
Example #5
0
static int simple_panel_disable(struct simple_panel *panel)
{
	if (panel->backlight)
		backlight_set_brightness(panel->backlight, 0);

	if (gpio_is_valid(panel->enable_gpio))
		gpio_direction_output(panel->enable_gpio,
			!panel->enable_active_high);

	return 0;
}
Example #6
0
static int simple_panel_set_backlight(struct udevice *dev, int percent)
{
	struct simple_panel_priv *priv = dev_get_priv(dev);
	int ret;

	debug("%s: start, backlight = '%s'\n", __func__, priv->backlight->name);
	dm_gpio_set_value(&priv->enable, 1);
	ret = backlight_set_brightness(priv->backlight, percent);
	debug("%s: done, ret = %d\n", __func__, ret);
	if (ret)
		return ret;

	return 0;
}
Example #7
0
static void
set_backlight(struct udev_device *drm_device, int connector_id, int blight)
{
	int connector_type;
	long max_brightness, brightness, actual_brightness;
	struct backlight *backlight;
	long new_blight;

	connector_type = get_drm_connector_type(drm_device, connector_id);
	if (connector_type < 0)
		return;

	backlight = backlight_init(drm_device, connector_type);
	if (!backlight) {
		printf("backlight adjust failed\n");
		return;
	}

	max_brightness = backlight_get_max_brightness(backlight);
	printf("Max backlight: %ld\n", max_brightness);

	brightness = backlight_get_brightness(backlight);
	printf("Cached backlight: %ld\n", brightness);

	actual_brightness = backlight_get_actual_brightness(backlight);
	printf("Hardware backlight: %ld\n", actual_brightness);

	printf("normalized current brightness: %d\n",
	       get_normalized_backlight(backlight));

	/* denormalized value */
	new_blight = (blight * max_brightness) / 255;

	backlight_set_brightness(backlight, new_blight);
	printf("Setting brightness to: %ld (norm: %d)\n", new_blight, blight);

	backlight_destroy(backlight);
}
void show_image(ppz_images image_name)
{
	int fallback = 1;
	enum omap_dispc_format fmt = OMAP_XRGB888_FMT;

	if(panel_has_enabled) {
		panel_enable(0);
		backlight_enable(0);
	}

	switch (image_name) {
		case boot:
			fmt = OMAP_RGB565_FMT;
			display_rle(_binary_boot_rle_start, (uint16_t *) FB, panel.xres, panel.yres);
			break;
		case lowbatt_charge:
			fmt = OMAP_RGB565_FMT;
			display_rle(_binary_lowbatt_charge_rle_start, (uint16_t *) FB, panel.xres, panel.yres);
			break;
		case connect_charge:
			display_mmc_gzip_ppm(1, 5, "connect_charge.ppz", (uint32_t *) FB, panel.xres, panel.yres);
			break;
		case cooldown:
			display_mmc_gzip_ppm(1, 5, "cooldown.ppz", (uint32_t *) FB, panel.xres, panel.yres);
			break;
		default:
			return -1;
	}


	panel_enable(1);
	display_init(&panel, (void *) FB, fmt);

	backlight_enable(1);
	backlight_set_brightness(0x3f);
	panel_has_enabled = 1;
}
Example #9
0
void settings_apply(bool read_disk)
{
    
    char buf[64];
#if CONFIG_CODEC == SWCODEC
    int i;
#endif
    sound_settings_apply();

#ifdef HAVE_DISK_STORAGE
    audio_set_buffer_margin(global_settings.buffer_margin);
#endif

#ifdef HAVE_LCD_CONTRAST
    lcd_set_contrast(global_settings.contrast);
#endif
    lcd_scroll_speed(global_settings.scroll_speed);
#ifdef HAVE_REMOTE_LCD
    lcd_remote_set_contrast(global_settings.remote_contrast);
    lcd_remote_set_invert_display(global_settings.remote_invert);

#ifdef HAVE_LCD_FLIP
    lcd_remote_set_flip(global_settings.remote_flip_display);
#endif

    lcd_remote_scroll_speed(global_settings.remote_scroll_speed);
    lcd_remote_scroll_step(global_settings.remote_scroll_step);
    lcd_remote_scroll_delay(global_settings.remote_scroll_delay);
    lcd_remote_bidir_scroll(global_settings.remote_bidir_limit);
#ifdef HAVE_REMOTE_LCD_TICKING
    lcd_remote_emireduce(global_settings.remote_reduce_ticking);
#endif
    remote_backlight_set_timeout(global_settings.remote_backlight_timeout);
#if CONFIG_CHARGING
    remote_backlight_set_timeout_plugged(global_settings.remote_backlight_timeout_plugged);
#endif
#ifdef HAS_REMOTE_BUTTON_HOLD
    remote_backlight_set_on_button_hold(global_settings.remote_backlight_on_button_hold);
#endif
#endif /* HAVE_REMOTE_LCD */
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
    backlight_set_brightness(global_settings.brightness);
#endif
#ifdef HAVE_BACKLIGHT
    backlight_set_timeout(global_settings.backlight_timeout);
#if CONFIG_CHARGING
    backlight_set_timeout_plugged(global_settings.backlight_timeout_plugged);
#endif
#if    defined(HAVE_BACKLIGHT_FADING_INT_SETTING) \
    || defined(HAVE_BACKLIGHT_FADING_BOOL_SETTING)
    backlight_set_fade_in(global_settings.backlight_fade_in);
    backlight_set_fade_out(global_settings.backlight_fade_out);
#endif
#endif
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
    buttonlight_set_brightness(global_settings.buttonlight_brightness);
#endif
#ifdef HAVE_BUTTON_LIGHT
    buttonlight_set_timeout(global_settings.buttonlight_timeout);
#endif
#ifdef HAVE_DISK_STORAGE
    storage_spindown(global_settings.disk_spindown);
#endif
#if (CONFIG_CODEC == MAS3507D) && !defined(SIMULATOR)
    dac_line_in(global_settings.line_in);
#endif
    set_poweroff_timeout(global_settings.poweroff);

    set_battery_capacity(global_settings.battery_capacity);
#if BATTERY_TYPES_COUNT > 1
    set_battery_type(global_settings.battery_type);
#endif

#ifdef HAVE_LCD_BITMAP
#ifdef HAVE_LCD_INVERT
    lcd_set_invert_display(global_settings.invert);
#endif
#ifdef HAVE_LCD_FLIP
    lcd_set_flip(global_settings.flip_display);
    button_set_flip(global_settings.flip_display);
#endif
    lcd_update(); /* refresh after flipping the screen */
    settings_apply_pm_range();
    peak_meter_init_times(
        global_settings.peak_meter_release, global_settings.peak_meter_hold,
        global_settings.peak_meter_clip_hold);
#endif

#ifdef HAVE_SPEAKER
    audiohw_enable_speaker(global_settings.speaker_enabled);
#endif

    if (read_disk)
    {
#ifdef HAVE_LCD_BITMAP
        /* fonts need to be loaded before the WPS */
        if ( global_settings.font_file[0]) {
            snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt",
                     global_settings.font_file);
            if (font_load(NULL, buf) < 0)
                font_reset(NULL);
        }
        else
            font_reset(NULL);
#ifdef HAVE_REMOTE_LCD        
        if ( global_settings.remote_font_file[0]) {
            snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt",
                     global_settings.remote_font_file);
            if (font_load_remoteui(buf) < 0)
                font_load_remoteui(NULL);
        }
        else
            font_load_remoteui(NULL);
#endif
        if ( global_settings.kbd_file[0]) {
            snprintf(buf, sizeof buf, ROCKBOX_DIR "/%s.kbd",
                     global_settings.kbd_file);
            load_kbd(buf);
        }
        else
            load_kbd(NULL);
#endif

        if ( global_settings.lang_file[0]) {
            snprintf(buf, sizeof buf, LANG_DIR "/%s.lng",
                     global_settings.lang_file);
            lang_core_load(buf);
            talk_init(); /* use voice of same language */
        }

        /* reload wpses */
        settings_apply_skins();

        /* load the icon set */
        icons_init();

#ifdef HAVE_LCD_COLOR
        if (global_settings.colors_file[0])
            read_color_theme_file();
#endif
    }

#ifdef HAVE_LCD_COLOR
    screens[SCREEN_MAIN].set_foreground(global_settings.fg_color);
    screens[SCREEN_MAIN].set_background(global_settings.bg_color);
    screens[SCREEN_MAIN].set_selector_start(global_settings.lss_color);
    screens[SCREEN_MAIN].set_selector_end(global_settings.lse_color);
    screens[SCREEN_MAIN].set_selector_text(global_settings.lst_color);
#endif

#ifdef HAVE_LCD_BITMAP
    lcd_scroll_step(global_settings.scroll_step);
    gui_list_screen_scroll_step(global_settings.screen_scroll_step);
    gui_list_screen_scroll_out_of_view(global_settings.offset_out_of_view);
#else
    lcd_jump_scroll(global_settings.jump_scroll);
    lcd_jump_scroll_delay(global_settings.jump_scroll_delay);
#endif
    lcd_bidir_scroll(global_settings.bidir_limit);
    lcd_scroll_delay(global_settings.scroll_delay);


    set_codepage(global_settings.default_codepage);

#if CONFIG_CODEC == SWCODEC
#ifdef HAVE_CROSSFADE
    audio_set_crossfade(global_settings.crossfade);
#endif
    dsp_set_replaygain();
    dsp_set_crossfeed(global_settings.crossfeed);
    dsp_set_crossfeed_direct_gain(global_settings.crossfeed_direct_gain);
    dsp_set_crossfeed_cross_params(global_settings.crossfeed_cross_gain,
                                   global_settings.crossfeed_hf_attenuation,
                                   global_settings.crossfeed_hf_cutoff);

    /* Configure software equalizer, hardware eq is handled in audio_init() */
    dsp_set_eq(global_settings.eq_enabled);
    dsp_set_eq_precut(global_settings.eq_precut);
    for(i = 0; i < 5; i++) {
        dsp_set_eq_coefs(i);
    }

    dsp_dither_enable(global_settings.dithering_enabled);
    dsp_timestretch_enable(global_settings.timestretch_enabled);
    dsp_set_compressor(global_settings.compressor_threshold,
                       global_settings.compressor_makeup_gain,
                       global_settings.compressor_ratio,
                       global_settings.compressor_knee,
                       global_settings.compressor_release_time);
#endif

#ifdef HAVE_SPDIF_POWER
    spdif_power_enable(global_settings.spdif_enable);
#endif

#ifdef HAVE_BACKLIGHT
    set_backlight_filter_keypress(global_settings.bl_filter_first_keypress);
#ifdef HAVE_REMOTE_LCD
    set_remote_backlight_filter_keypress(global_settings.remote_bl_filter_first_keypress);
#endif
#ifdef HAS_BUTTON_HOLD
    backlight_set_on_button_hold(global_settings.backlight_on_button_hold);
#endif
#ifdef HAVE_LCD_SLEEP_SETTING
    lcd_set_sleep_after_backlight_off(global_settings.lcd_sleep_after_backlight_off);
#endif
#endif /* HAVE_BACKLIGHT */

#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
    touchpad_set_sensitivity(global_settings.touchpad_sensitivity);
#endif

#ifdef HAVE_USB_CHARGING_ENABLE
    usb_charging_enable(global_settings.usb_charging);
#endif

#ifdef HAVE_TOUCHSCREEN
    touchscreen_set_mode(global_settings.touch_mode);
    memcpy(&calibration_parameters, &global_settings.ts_calibration_data, sizeof(struct touchscreen_parameter));
#endif

    /* This should stay last */
#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
    enc_global_settings_apply();
#endif
#ifdef HAVE_LCD_BITMAP
    /* already called with THEME_STATUSBAR in settings_apply_skins() */
    viewportmanager_theme_changed(THEME_UI_VIEWPORT|THEME_LANGUAGE);
#endif
}
Example #10
0
void set_brightness(uint16_t br)
{
    backlight_set_brightness(br);
    HAL_GFX_DisplayPower(br ? 1 : 0);
}
int board_late_init(void)
{
	int bootmode = set_boot_mode();
	int display_painted =0; /* boot */
	enum omap_dispc_format fmt = OMAP_XRGB888_FMT;
	enum coolcharger_ppz_t coolcharger_ppz = get_coolcharger_ppz();

	if(coolcharger_ppz == COOLCHARGER_SHUTDOWN_NOACTION)
		return 0;
	else if(coolcharger_ppz == COOLCHARGER_INITONLY) {
		if(!panel_has_enabled) {
			fmt = OMAP_RGB565_FMT;
			memset((void *) FB, 0, (panel.xres * 2 * panel.yres));
			display_init(&panel, (void *) FB, fmt);
		}
		return 0;
	}


	switch(bootmode) {
	case EMMC_ANDROID:
		switch(coolcharger_ppz) {
		case COOLCHARGER_DISABLE:
			display_painted = 1;
			break;
		case COOLCHARGER_SHUTDOWN_COOLDOWN:
		case COOLCHARGER_SHUTDOWN_WARMUP:
			//if we have the warm up image, we can use it.
			disable_panel_backlight();
			display_mmc_gzip_ppm(1, 5, "cooldown.ppz", (uint32_t *) FB, panel.xres, panel.yres);
			break;
		}

		break;
	case EMMC_RECOVERY:
		if(boot_cooldown_charger_mode()) {
			disable_panel_backlight();
			switch(coolcharger_ppz) {
			case COOLCHARGER_COOLDOWN_MODE:
				display_mmc_gzip_ppm(1, 5, "cooldown.ppz", (uint32_t *) FB, panel.xres, panel.yres);
				break;
			case COOLCHARGER_CHARGER_MODE:
				fmt = OMAP_RGB565_FMT;
				display_rle(_binary_lowbatt_charge_rle_start, (uint16_t *) FB, panel.xres, panel.yres);
				break;
			}
		}
		else {
			if (!panel_has_enabled) /* recovery image is same as boot */
				show_image(boot);

			display_painted = 1;
		}
		break;
	case SD_UIMAGE:
	case SD_BOOTIMG:
	case USB_BOOTIMG:
	default:
		/* if we use PIC SD card to reflash and the SoC < BOOT_ANDROID
		 * the show_image will not be called. */
		if(!panel_has_enabled)
			show_image(boot);

		display_painted = 1;
		break;
	}

    if (display_painted == 0) {
	    panel_enable(1);
	    display_init(&panel, (void *) FB, fmt);

	    backlight_enable(1);
	    backlight_set_brightness(0x3f);
	    panel_has_enabled = 1;

	    if(coolcharger_ppz == COOLCHARGER_SHUTDOWN_COOLDOWN ||
	       coolcharger_ppz == COOLCHARGER_SHUTDOWN_WARMUP)
		    udelay(3000000);
	}

	return bootmode;
}
Example #12
0
void settings_apply(bool read_disk)
{
#ifdef HAVE_LCD_BITMAP
    int rc;
#endif
    CHART(">set_codepage");
    set_codepage(global_settings.default_codepage);
    CHART("<set_codepage");

    sound_settings_apply();

#ifdef HAVE_DISK_STORAGE
    audio_set_buffer_margin(global_settings.buffer_margin);
#endif

#ifdef HAVE_LCD_CONTRAST
    lcd_set_contrast(global_settings.contrast);
#endif
    lcd_scroll_speed(global_settings.scroll_speed);
#ifdef HAVE_REMOTE_LCD
    lcd_remote_set_contrast(global_settings.remote_contrast);
    lcd_remote_set_invert_display(global_settings.remote_invert);

#ifdef HAVE_LCD_FLIP
    lcd_remote_set_flip(global_settings.remote_flip_display);
#endif

    lcd_remote_scroll_speed(global_settings.remote_scroll_speed);
    lcd_remote_scroll_step(global_settings.remote_scroll_step);
    lcd_remote_scroll_delay(global_settings.remote_scroll_delay);
    lcd_remote_bidir_scroll(global_settings.remote_bidir_limit);
#ifdef HAVE_REMOTE_LCD_TICKING
    lcd_remote_emireduce(global_settings.remote_reduce_ticking);
#endif
    remote_backlight_set_timeout(global_settings.remote_backlight_timeout);
#if CONFIG_CHARGING
    remote_backlight_set_timeout_plugged(global_settings.remote_backlight_timeout_plugged);
#endif
#ifdef HAS_REMOTE_BUTTON_HOLD
    remote_backlight_set_on_button_hold(global_settings.remote_backlight_on_button_hold);
#endif
#endif /* HAVE_REMOTE_LCD */
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
    backlight_set_brightness(global_settings.brightness);
#endif
#ifdef HAVE_BACKLIGHT
    backlight_set_timeout(global_settings.backlight_timeout);
#if CONFIG_CHARGING
    backlight_set_timeout_plugged(global_settings.backlight_timeout_plugged);
#endif
#if    defined(HAVE_BACKLIGHT_FADING_INT_SETTING) \
    || defined(HAVE_BACKLIGHT_FADING_BOOL_SETTING)
    backlight_set_fade_in(global_settings.backlight_fade_in);
    backlight_set_fade_out(global_settings.backlight_fade_out);
#endif
#endif
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
    buttonlight_set_brightness(global_settings.buttonlight_brightness);
#endif
#ifdef HAVE_BUTTON_LIGHT
    buttonlight_set_timeout(global_settings.buttonlight_timeout);
#endif
#ifdef HAVE_DISK_STORAGE
    storage_spindown(global_settings.disk_spindown);
#endif
#if (CONFIG_CODEC == MAS3507D) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
    dac_line_in(global_settings.line_in);
#endif
    set_poweroff_timeout(global_settings.poweroff);
    if (global_settings.sleeptimer_on_startup)
        set_sleeptimer_duration(global_settings.sleeptimer_duration);
    set_keypress_restarts_sleep_timer(
        global_settings.keypress_restarts_sleeptimer);

#if defined(BATTERY_CAPACITY_INC) && BATTERY_CAPACITY_INC > 0
    /* only call if it's really exchangable */
    set_battery_capacity(global_settings.battery_capacity);
#endif

#if BATTERY_TYPES_COUNT > 1
    set_battery_type(global_settings.battery_type);
#endif

#ifdef HAVE_LCD_BITMAP
#ifdef HAVE_LCD_INVERT
    lcd_set_invert_display(global_settings.invert);
#endif
#ifdef HAVE_LCD_FLIP
    lcd_set_flip(global_settings.flip_display);
    button_set_flip(global_settings.flip_display);
#endif
    lcd_update(); /* refresh after flipping the screen */
    settings_apply_pm_range();
    peak_meter_init_times(
        global_settings.peak_meter_release, global_settings.peak_meter_hold,
        global_settings.peak_meter_clip_hold);
#endif

#ifdef HAVE_SPEAKER
    audiohw_enable_speaker(global_settings.speaker_enabled);
#endif

    if (read_disk)
    {
        char buf[MAX_PATH];
#ifdef HAVE_LCD_BITMAP
        /* fonts need to be loaded before the WPS */
        if (global_settings.font_file[0]
            && global_settings.font_file[0] != '-') {
            int font_ui = screens[SCREEN_MAIN].getuifont();
            const char* loaded_font = font_filename(font_ui);
            
            snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt",
                     global_settings.font_file);
            if (!loaded_font || strcmp(loaded_font, buf))
            {
                CHART2(">font_load ", global_settings.font_file);
                if (font_ui >= 0)
                    font_unload(font_ui);
                rc = font_load_ex(buf, 0, global_settings.glyphs_to_cache);
                CHART2("<font_load ", global_settings.font_file);
                screens[SCREEN_MAIN].setuifont(rc);
                screens[SCREEN_MAIN].setfont(rc);
            }
        }
#ifdef HAVE_REMOTE_LCD        
        if ( global_settings.remote_font_file[0]
            && global_settings.remote_font_file[0] != '-') {
            int font_ui = screens[SCREEN_REMOTE].getuifont();
            const char* loaded_font = font_filename(font_ui);
            snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt",
                     global_settings.remote_font_file);
            if (!loaded_font || strcmp(loaded_font, buf))
            {
                CHART2(">font_load_remoteui ", global_settings.remote_font_file);
                if (font_ui >= 0)
                    font_unload(font_ui);
                rc = font_load(buf);
                CHART2("<font_load_remoteui ", global_settings.remote_font_file);
                screens[SCREEN_REMOTE].setuifont(rc);
                screens[SCREEN_REMOTE].setfont(rc);
            }
        }
#endif
        if ( global_settings.kbd_file[0]
             && global_settings.kbd_file[0] != '-') {
            snprintf(buf, sizeof buf, ROCKBOX_DIR "/%s.kbd",
                     global_settings.kbd_file);
            CHART(">load_kbd");
            load_kbd(buf);
            CHART("<load_kbd");
        }
        else
            load_kbd(NULL);
#endif /* HAVE_LCD_BITMAP */
        if ( global_settings.lang_file[0]) {
            snprintf(buf, sizeof buf, LANG_DIR "/%s.lng",
                     global_settings.lang_file);
            CHART(">lang_core_load");
            lang_core_load(buf);
            CHART("<lang_core_load");
        }
        CHART(">talk_init");
        talk_init(); /* use voice of same language */
        CHART("<talk_init");

        /* load the icon set */
        CHART(">icons_init");
        icons_init();
        CHART("<icons_init");

#ifdef HAVE_LCD_COLOR
        if (global_settings.colors_file[0]
            && global_settings.colors_file[0] != '-')
        {
            CHART(">read_color_theme_file");
            read_color_theme_file();
            CHART("<read_color_theme_file");
        }
#endif
    }
#ifdef HAVE_LCD_COLOR
    screens[SCREEN_MAIN].set_foreground(global_settings.fg_color);
    screens[SCREEN_MAIN].set_background(global_settings.bg_color);
#endif

#ifdef HAVE_LCD_BITMAP
    lcd_scroll_step(global_settings.scroll_step);
    gui_list_screen_scroll_step(global_settings.screen_scroll_step);
    gui_list_screen_scroll_out_of_view(global_settings.offset_out_of_view);
#endif
    lcd_bidir_scroll(global_settings.bidir_limit);
    lcd_scroll_delay(global_settings.scroll_delay);


#ifdef HAVE_PLAY_FREQ
    settings_apply_play_freq(global_settings.play_frequency, false);
#endif
#if CONFIG_CODEC == SWCODEC
#ifdef HAVE_CROSSFADE
    audio_set_crossfade(global_settings.crossfade);
#endif
    replaygain_update();
    dsp_set_crossfeed_type(global_settings.crossfeed);
    dsp_set_crossfeed_direct_gain(global_settings.crossfeed_direct_gain);
    dsp_set_crossfeed_cross_params(global_settings.crossfeed_cross_gain,
                                   global_settings.crossfeed_hf_attenuation,
                                   global_settings.crossfeed_hf_cutoff);

    /* Configure software equalizer, hardware eq is handled in audio_init() */
    dsp_eq_enable(global_settings.eq_enabled);
    dsp_set_eq_precut(global_settings.eq_precut);
    for(int i = 0; i < EQ_NUM_BANDS; i++) {
        dsp_set_eq_coefs(i, &global_settings.eq_band_settings[i]);
    }

    dsp_dither_enable(global_settings.dithering_enabled);
#ifdef HAVE_PITCHCONTROL
    dsp_timestretch_enable(global_settings.timestretch_enabled);
#endif
    dsp_set_compressor(&global_settings.compressor_settings);
#endif

#ifdef HAVE_SPDIF_POWER
    spdif_power_enable(global_settings.spdif_enable);
#endif

#ifdef HAVE_BACKLIGHT
    set_backlight_filter_keypress(global_settings.bl_filter_first_keypress);
#ifdef HAVE_REMOTE_LCD
    set_remote_backlight_filter_keypress(global_settings.remote_bl_filter_first_keypress);
#endif
#ifdef HAS_BUTTON_HOLD
    backlight_set_on_button_hold(global_settings.backlight_on_button_hold);
#endif
#ifdef HAVE_LCD_SLEEP_SETTING
    lcd_set_sleep_after_backlight_off(global_settings.lcd_sleep_after_backlight_off);
#endif
#endif /* HAVE_BACKLIGHT */

#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
    touchpad_set_sensitivity(global_settings.touchpad_sensitivity);
#endif

#ifdef HAVE_TOUCHPAD_DEADZONE
    touchpad_set_deadzone(global_settings.touchpad_deadzone);
#endif

#ifdef HAVE_USB_CHARGING_ENABLE
    usb_charging_enable(global_settings.usb_charging);
#endif

#ifdef HAVE_TOUCHSCREEN
    touchscreen_set_mode(global_settings.touch_mode);
    memcpy(&calibration_parameters, &global_settings.ts_calibration_data, sizeof(struct touchscreen_parameter));
#endif

    /* This should stay last */
#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
    enc_global_settings_apply();
#endif
#ifdef HAVE_LCD_BITMAP
    /* already called with THEME_STATUSBAR in settings_apply_skins() */
    CHART(">viewportmanager_theme_changed");
    viewportmanager_theme_changed(THEME_UI_VIEWPORT|THEME_LANGUAGE|THEME_BUTTONBAR);
    CHART("<viewportmanager_theme_changed");
#endif
}