summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/samsungypr/ypr1/backlight-ypr1.c
diff options
context:
space:
mode:
authorLorenzo Miori <memoryS60@gmail.com>2013-09-10 22:48:34 +0200
committerThomas Martitz <kugel@rockbox.org>2014-02-05 09:56:21 +0100
commite876f4df6d240bd2e319b1e63be95a625f049a97 (patch)
treece2fe1b24650e3be7a6cd2d346d29090a5422a8c /firmware/target/hosted/samsungypr/ypr1/backlight-ypr1.c
parentb828b9d99bff2acc0e1f543f3176fd4b632cba68 (diff)
downloadrockbox-e876f4df6d240bd2e319b1e63be95a625f049a97.tar.gz
rockbox-e876f4df6d240bd2e319b1e63be95a625f049a97.zip
Samsung YP-R1 target port
This is the basic port to the new target Samsung YP-R1, which runs on a similar platform as YP-R0. Port is usable, although there are still some optimizations that have to be done. Change-Id: If83a8e386369e413581753780c159026d9e41f04
Diffstat (limited to 'firmware/target/hosted/samsungypr/ypr1/backlight-ypr1.c')
-rw-r--r--firmware/target/hosted/samsungypr/ypr1/backlight-ypr1.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/firmware/target/hosted/samsungypr/ypr1/backlight-ypr1.c b/firmware/target/hosted/samsungypr/ypr1/backlight-ypr1.c
new file mode 100644
index 0000000000..e4f0457cf9
--- /dev/null
+++ b/firmware/target/hosted/samsungypr/ypr1/backlight-ypr1.c
@@ -0,0 +1,66 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2013 by Lorenzo Miori
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20#include "config.h"
21#include "system.h"
22#include "backlight.h"
23#include "backlight-target.h"
24#include "lcd.h"
25#include "lcd-target.h"
26#include "pmu-ypr1.h"
27
28static bool backlight_on_status = true; /* Is on or off? */
29
30bool _backlight_init(void)
31{
32 /* We have nothing to do */
33 return true;
34}
35
36void _backlight_on(void)
37{
38 if (!backlight_on_status) {
39 _backlight_set_brightness(backlight_brightness);
40 }
41
42 backlight_on_status = true;
43
44}
45
46void _backlight_off(void)
47{
48 if (backlight_on_status) {
49 _backlight_set_brightness(0);
50 }
51
52 backlight_on_status = false;
53}
54
55void _backlight_set_brightness(int brightness)
56{
57 /* Just another check... */
58 if (brightness > MAX_BRIGHTNESS_SETTING) {
59 brightness = MAX_BRIGHTNESS_SETTING;
60 }
61 if (brightness < 0) {
62 brightness = MIN_BRIGHTNESS_SETTING;
63 }
64 /* Do the appropriate ioctl on the linux module */
65 pmu_ioctl(MAX8819_IOCTL_LCD_DIM_CTRL, &brightness);
66}