CONFIG_BACKLIGHT_FADING is always defined, so better ask for BACKLIGHT_NO_FADING.
[kugel-rb.git] / firmware / target / arm / tms320dm320 / mrobe-500 / backlight-mr500.c
blob413790ae00fb6a919bc145e10ae5839a528511d3
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2007 by Karl Kurbjun
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #include "config.h"
23 #include "cpu.h"
24 #include "system.h"
25 #include "backlight-target.h"
26 #include "backlight.h"
27 #include "lcd.h"
28 #include "power.h"
29 #include "spi-target.h"
30 #include "lcd-target.h"
32 static void _backlight_write_brightness(int brightness)
34 uint8_t bl_command[] = {0xa4, 0x00, brightness, 0xbb};
35 spi_block_transfer(SPI_target_BACKLIGHT, false, bl_command, 4, 0, 0);
38 void _backlight_on(void)
40 lcd_awake(); /* power on lcd + visible display */
42 #if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_NO_FADING)
43 _backlight_write_brightness(backlight_brightness);
44 #endif
47 void _backlight_off(void)
49 _backlight_write_brightness(0);
52 /* Assumes that the backlight has been initialized */
53 void _backlight_set_brightness(int brightness)
55 _backlight_write_brightness(brightness);
58 void __backlight_dim(bool dim_now)
60 _backlight_set_brightness(dim_now ?
61 DEFAULT_BRIGHTNESS_SETTING :
62 DEFAULT_DIMNESS_SETTING);
65 bool _backlight_init(void)
67 _backlight_set_brightness(backlight_brightness);
68 return true;