summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/SOURCES18
-rw-r--r--firmware/export/config-yps3.h183
-rw-r--r--firmware/export/config.h3
-rw-r--r--firmware/target/arm/s5l8700/yps3/backlight-yps3.c78
-rw-r--r--firmware/target/arm/s5l8700/yps3/button-target.h50
-rw-r--r--firmware/target/arm/s5l8700/yps3/fmradio-i2c-yps3.c46
-rw-r--r--firmware/target/arm/s5l8700/yps3/lcd-yps3.c336
-rw-r--r--firmware/target/arm/s5l8700/yps3/power-yps3.c95
8 files changed, 809 insertions, 0 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 46c1f58cb3..b60bb29a4a 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -204,6 +204,9 @@ drivers/tuner/lv24020lp.c
204drivers/fmradio.c 204drivers/fmradio.c
205drivers/tuner/s1a0903x01.c 205drivers/tuner/s1a0903x01.c
206#endif /* (CONFIG_TUNER & S1A0903X01) */ 206#endif /* (CONFIG_TUNER & S1A0903X01) */
207#if (CONFIG_TUNER & TEA5760)
208drivers/tuner/tea5760uk.c
209#endif
207#if (CONFIG_TUNER & TEA5767) 210#if (CONFIG_TUNER & TEA5767)
208drivers/tuner/tea5767.c 211drivers/tuner/tea5767.c
209#endif /* (CONFIG_TUNER & TEA5767) */ 212#endif /* (CONFIG_TUNER & TEA5767) */
@@ -1406,3 +1409,18 @@ target/arm/samsung/yh925/lcd-as-yh925.S
1406target/arm/samsung/yh925/powermgmt-yh925.c 1409target/arm/samsung/yh925/powermgmt-yh925.c
1407#endif /* SIMULATOR */ 1410#endif /* SIMULATOR */
1408#endif /* SAMSUNG_YH925 */ 1411#endif /* SAMSUNG_YH925 */
1412
1413#ifdef SAMSUNG_YPS3
1414/* TODO: currently including all files for the bootloader DFU test program */
1415drivers/generic_i2c.c
1416drivers/mcs3080.c
1417target/arm/s5l8700/adc-s5l8700.c
1418target/arm/s5l8700/i2c-s5l8700.c
1419target/arm/s5l8700/kernel-s5l8700.c
1420target/arm/s5l8700/timer-s5l8700.c
1421target/arm/s5l8700/yps3/lcd-yps3.c
1422target/arm/s5l8700/yps3/fmradio-i2c-yps3.c
1423target/arm/s5l8700/yps3/backlight-yps3.c
1424target/arm/s5l8700/yps3/power-yps3.c
1425#endif /* SAMSUNG_YPS3 */
1426
diff --git a/firmware/export/config-yps3.h b/firmware/export/config-yps3.h
new file mode 100644
index 0000000000..2685f0228a
--- /dev/null
+++ b/firmware/export/config-yps3.h
@@ -0,0 +1,183 @@
1/*
2 * This config file is for Samsung YP-S3
3 */
4
5#define TARGET_TREE /* this target is using the target tree system */
6
7/* For Rolo and boot loader */
8#define MODEL_NUMBER 53
9
10#define MODEL_NAME "Samsumg YP-S3"
11
12/* define this if you have recording possibility */
13//#define HAVE_RECORDING
14
15/* Define bitmask of input sources - recordable bitmask can be defined
16 explicitly if different */
17#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_FMRADIO)
18
19/* define the bitmask of hardware sample rates */
20#define HW_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | SAMPR_CAP_11)
21
22/* define the bitmask of recording sample rates */
23#define REC_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | SAMPR_CAP_11)
24
25/* define this if you have a bitmap LCD display */
26#define HAVE_LCD_BITMAP
27
28/* define this if you can flip your LCD */
29//#define HAVE_LCD_FLIP
30
31/* define this if you have a colour LCD */
32#define HAVE_LCD_COLOR
33
34/* define this if you want album art for this target */
35#define HAVE_ALBUMART
36
37/* define this to enable bitmap scaling */
38#define HAVE_BMP_SCALING
39
40/* define this to enable JPEG decoding */
41#define HAVE_JPEG
42
43/* define this if you can invert the colours on your LCD */
44//#define HAVE_LCD_INVERT
45
46/* define this if you have access to the quickscreen */
47#define HAVE_QUICKSCREEN
48
49/* define this if you have access to the pitchscreen */
50#define HAVE_PITCHSCREEN
51
52/* define this if you would like tagcache to build on this target */
53#define HAVE_TAGCACHE
54
55/* define this if you have a flash memory storage */
56#define HAVE_FLASH_STORAGE
57
58#define CONFIG_STORAGE STORAGE_NAND
59
60#define CONFIG_NAND NAND_SAMSUNG
61
62/* LCD dimensions */
63#define LCD_WIDTH 176
64#define LCD_HEIGHT 220
65#define LCD_DEPTH 16 /* pseudo 262.144 colors */
66#define LCD_PIXELFORMAT RGB565 /* rgb565 */
67
68/* Define this if your LCD can be enabled/disabled */
69//#define HAVE_LCD_ENABLE
70
71/* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE
72 should be defined as well. */
73//#define HAVE_LCD_SLEEP
74
75#define CONFIG_KEYPAD MEIZU_M3_PAD
76
77//#define AB_REPEAT_ENABLE 1
78//#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
79
80/* Define this if you do software codec */
81#define CONFIG_CODEC SWCODEC
82
83/* define this if you have a real-time clock */
84#define CONFIG_RTC RTC_S35390A
85
86/* Define the type of audio codec */
87//#define HAVE_WM....
88
89/* Define this for LCD backlight available */
90#define HAVE_BACKLIGHT
91#define HAVE_BACKLIGHT_BRIGHTNESS
92
93/* Define this if you have a software controlled poweroff */
94#define HAVE_SW_POWEROFF
95
96/* The number of bytes reserved for loadable codecs */
97#define CODEC_SIZE 0x100000
98
99/* The number of bytes reserved for loadable plugins */
100#define PLUGIN_BUFFER_SIZE 0x80000
101
102/* FM Tuner */
103#define CONFIG_TUNER SI4700
104#define CONFIG_TUNER_XTAL 32768
105
106/* assume no tone controls, so we use the software ones */
107#define HAVE_SW_TONE_CONTROLS
108
109#define BATTERY_CAPACITY_DEFAULT 580 /* default battery capacity */
110#define BATTERY_CAPACITY_MIN 580 /* min. capacity selectable */
111#define BATTERY_CAPACITY_MAX 580 /* max. capacity selectable */
112#define BATTERY_CAPACITY_INC 0 /* capacity increment */
113#define BATTERY_TYPES_COUNT 1 /* only one type */
114
115/* Hardware controlled charging, software can monitor plug and charge state */
116#define CONFIG_CHARGING CHARGING_MONITOR
117
118#ifndef SIMULATOR
119
120/* Define this if your LCD can set contrast */
121//#define HAVE_LCD_CONTRAST
122
123/* We have a Samsung S5L8700 */
124#define CONFIG_CPU S5L8700
125
126/* We use the S5L8700 i2c interface */
127#define CONFIG_I2C I2C_S5L8700
128
129/* define this if the hardware can be powered off while charging */
130//#define HAVE_POWEROFF_WHILE_CHARGING
131
132/* The size of the flash ROM */
133#define FLASH_SIZE 0x400000
134
135/* Define this to the CPU frequency */
136#define CPU_FREQ 200000000
137
138/* Define this if you have ATA power-off control */
139//#define HAVE_ATA_POWER_OFF
140
141/* Virtual LED (icon) */
142#define CONFIG_LED LED_VIRTUAL
143
144/* Offset ( in the firmware file's header ) to the file CRC */
145#define FIRMWARE_OFFSET_FILE_CRC 0
146
147/* Offset ( in the firmware file's header ) to the real data */
148#define FIRMWARE_OFFSET_FILE_DATA 8
149
150/* USB */
151//#define HAVE_USBSTACK
152#define USE_ROCKBOX_USB
153#define USB_VENDOR_ID 0x04E8
154#define USB_PRODUCT_ID 0x5090
155
156/* Define this if you have adjustable CPU frequency */
157#define HAVE_ADJUSTABLE_CPU_FREQ
158
159#define BOOTFILE_EXT "yps3"
160#define BOOTFILE "rockbox." BOOTFILE_EXT
161#define BOOTDIR "/.rockbox"
162
163//#define BOOTLOADER_ENTRYPOINT 0x001F0000
164//#define FLASH_ENTRYPOINT 0x00001000
165//#define FLASH_MAGIC 0xfbfbfbf1
166
167#endif /* SIMULATOR */
168
169/* Define this for FM radio input available */
170#define HAVE_FMRADIO_IN
171
172/** Port-specific settings **/
173
174/* Main LCD contrast range and defaults */
175#define MIN_CONTRAST_SETTING 1
176#define MAX_CONTRAST_SETTING 30
177#define DEFAULT_CONTRAST_SETTING 19 /* Match boot contrast */
178
179/* Main LCD backlight brightness range and defaults */
180#define MIN_BRIGHTNESS_SETTING 0
181#define MAX_BRIGHTNESS_SETTING 15
182#define DEFAULT_BRIGHTNESS_SETTING 10
183
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 092e02f458..0082f3ab31 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -113,6 +113,7 @@
113#define LYRE_PROTO1_PAD 37 113#define LYRE_PROTO1_PAD 37
114#define SAMSUNG_YH_PAD 38 114#define SAMSUNG_YH_PAD 38
115#define ONDAVX777_PAD 39 115#define ONDAVX777_PAD 39
116#define SAMSUNG_YPS3_PAD 40
116 117
117/* CONFIG_REMOTE_KEYPAD */ 118/* CONFIG_REMOTE_KEYPAD */
118#define H100_REMOTE 1 119#define H100_REMOTE 1
@@ -381,6 +382,8 @@ Lyre prototype 1*/
381#include "config-yh920.h" 382#include "config-yh920.h"
382#elif defined(SAMSUNG_YH925) 383#elif defined(SAMSUNG_YH925)
383#include "config-yh925.h" 384#include "config-yh925.h"
385#elif defined(SAMSUNG_YPS3)
386#include "config-yps3.h"
384#else 387#else
385/* no known platform */ 388/* no known platform */
386#endif 389#endif
diff --git a/firmware/target/arm/s5l8700/yps3/backlight-yps3.c b/firmware/target/arm/s5l8700/yps3/backlight-yps3.c
new file mode 100644
index 0000000000..0a9cf3cc9a
--- /dev/null
+++ b/firmware/target/arm/s5l8700/yps3/backlight-yps3.c
@@ -0,0 +1,78 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2009 by Bertrik Sikken
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include <stdbool.h>
22
23#include "config.h"
24#include "backlight.h"
25#include "backlight-target.h"
26#include "system.h"
27
28/*
29 Backlight driver using the PWM mode of a hardware timer.
30
31 The PWM duty cycle depends exponentially on the configured brightness
32 level. This makes the brightness curve more linear to the human eye.
33 */
34
35void _backlight_set_brightness(int brightness)
36{
37 /* pwm = (sqrt(2)**x)-1, where brightness level x = 0..16 */
38 static const unsigned char logtable[] =
39 {0, 1, 2, 3, 5, 7, 10, 15, 22, 31, 44, 63, 90, 127, 180, 255};
40
41 /* set PWM width */
42 TADATA0 = 255 - logtable[brightness];
43}
44
45void _backlight_on(void)
46{
47 _backlight_set_brightness(backlight_brightness);
48}
49
50void _backlight_off(void)
51{
52 _backlight_set_brightness(MIN_BRIGHTNESS_SETTING);
53}
54
55bool _backlight_init(void)
56{
57 /* enable backlight pin as timer output */
58 PCON0 = ((PCON0 & ~(3 << 0)) | (2 << 0));
59
60 /* enable timer clock */
61 PWRCON &= ~(1 << 4);
62
63 /* configure timer */
64 TACMD = (1 << 1); /* TC_CLR */
65 TACON = (0 << 13) | /* TC_INT1_EN */
66 (0 << 12) | /* TC_INT0_EN */
67 (0 << 11) | /* TC_START */
68 (3 << 8) | /* TC_CS = PCLK / 64 */
69 (1 << 4); /* TC_MODE_SEL = PWM mode */
70 TADATA1 = 255; /* set PWM period */
71 TAPRE = 20; /* prescaler */
72 TACMD = (1 << 0); /* TC_EN */
73
74 _backlight_on();
75
76 return true;
77}
78
diff --git a/firmware/target/arm/s5l8700/yps3/button-target.h b/firmware/target/arm/s5l8700/yps3/button-target.h
new file mode 100644
index 0000000000..86e8488857
--- /dev/null
+++ b/firmware/target/arm/s5l8700/yps3/button-target.h
@@ -0,0 +1,50 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2009 by Bertrik Sikken
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef _BUTTON_TARGET_H_
22#define _BUTTON_TARGET_H_
23
24#include <stdbool.h>
25
26#define HAS_BUTTON_HOLD
27
28bool button_hold(void);
29void button_init_device(void);
30int button_read_device(void);
31
32#define BUTTON_BACK 0x00000001
33#define BUTTON_MENU 0x00000002
34#define BUTTON_UP 0x00000004
35#define BUTTON_DOWN 0x00000008
36#define BUTTON_LEFT 0x00000010
37#define BUTTON_RIGHT 0x00000020
38#define BUTTON_SELECT 0x00000040
39#define BUTTON_POWER 0x00000080
40
41#define BUTTON_MAIN (BUTTON_BACK|BUTTON_MENU|BUTTON_UP|BUTTON_DOWN|BUTTON_LEFT|\
42 BUTTON_RIGHT|BUTTON_SELECT)
43
44#define BUTTON_REMOTE 0
45
46#define POWEROFF_BUTTON BUTTON_POWER
47#define POWEROFF_COUNT 10
48
49#endif /* _BUTTON_TARGET_H_ */
50
diff --git a/firmware/target/arm/s5l8700/yps3/fmradio-i2c-yps3.c b/firmware/target/arm/s5l8700/yps3/fmradio-i2c-yps3.c
new file mode 100644
index 0000000000..29261b8265
--- /dev/null
+++ b/firmware/target/arm/s5l8700/yps3/fmradio-i2c-yps3.c
@@ -0,0 +1,46 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2009 by Bertrik Sikken
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22/*
23 FM radio i2c interface, allows the radio driver to talk to the tuner chip.
24
25 */
26
27#include "config.h"
28
29#include "i2c-s5l8700.h"
30#include "fmradio_i2c.h"
31
32void fmradio_i2c_init(void)
33{
34 /* nothing to do */
35}
36
37int fmradio_i2c_write(unsigned char address, const unsigned char* buf, int count)
38{
39 return i2c_write(address, -1, count, buf);
40}
41
42int fmradio_i2c_read(unsigned char address, unsigned char* buf, int count)
43{
44 return i2c_read(address, -1, count, buf);
45}
46
diff --git a/firmware/target/arm/s5l8700/yps3/lcd-yps3.c b/firmware/target/arm/s5l8700/yps3/lcd-yps3.c
new file mode 100644
index 0000000000..6093eb3054
--- /dev/null
+++ b/firmware/target/arm/s5l8700/yps3/lcd-yps3.c
@@ -0,0 +1,336 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2009 by Bertrik Sikken
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "config.h"
23
24#include "s5l8700.h"
25#include "lcd.h"
26
27/* LCD driver for the Samsung YP-S3
28
29 It appears that this player can contain two display types.
30 Detection of the display type is done by looking at the level of pin P0.4.
31 Currently only display "type 2" has been implemented and tested.
32
33 This driver could use DMA to do the screen updates, but currently writes
34 the data to the LCD using the processor instead.
35*/
36
37
38static int lcd_type = 0;
39
40
41static void lcd_delay(int delay)
42{
43 volatile int i;
44 for (i = 0; i < delay; i++);
45}
46
47static void lcd_reset_delay(void)
48{
49 lcd_delay(10000);
50}
51
52static void lcd_reset(void)
53{
54 LCD_CON = 0xDB8;
55 LCD_PHTIME = 0x22;
56 LCD_RST_TIME = 0x7FFF;
57
58 lcd_reset_delay();
59 LCD_DRV_RST = 0;
60 lcd_reset_delay();
61 LCD_DRV_RST = 1;
62 lcd_reset_delay();
63 LCD_DRV_RST = 0;
64 lcd_reset_delay();
65 LCD_DRV_RST = 1;
66
67 LCD_INTCON = 0;
68}
69
70static void lcd_wcmd(unsigned int cmd)
71{
72 while ((LCD_STATUS & 0x10) != 0);
73 LCD_WCMD = cmd;
74}
75
76static void lcd_wdata(unsigned int data)
77{
78 while ((LCD_STATUS & 0x10) != 0);
79 LCD_WDATA = data;
80}
81
82static void lcd_wcmd_data(unsigned int cmd, unsigned int data)
83{
84 lcd_wcmd(cmd);
85 lcd_wdata(data);
86}
87
88void lcd_init1(void)
89{
90 lcd_wcmd(0x11);
91 lcd_delay(10000);
92
93 lcd_wcmd(0xF0);
94 lcd_wdata(0x5A);
95
96 lcd_wcmd(0xC0);
97 lcd_wdata(0x05);
98 lcd_wdata(0x01);
99
100 lcd_wcmd(0xC1);
101 lcd_wdata(0x04);
102
103 lcd_wcmd(0xC5);
104 lcd_wdata(0xB0);
105
106 lcd_wcmd(0xC6);
107 lcd_wdata(0x0);
108
109 lcd_wcmd(0xB1);
110 lcd_wdata(0x02);
111 lcd_wdata(0x0E);
112 lcd_wdata(0x00);
113
114 lcd_wcmd(0xF2);
115 lcd_wdata(0x01);
116
117 lcd_wcmd(0xE0);
118 lcd_wdata(0x09);
119 lcd_wdata(0x00);
120 lcd_wdata(0x06);
121 lcd_wdata(0x2E);
122 lcd_wdata(0x2B);
123 lcd_wdata(0x0B);
124 lcd_wdata(0x1A);
125 lcd_wdata(0x02);
126 lcd_wdata(0x06);
127 lcd_wdata(0x0C);
128 lcd_wdata(0x0D);
129 lcd_wdata(0x00);
130 lcd_wdata(0x05);
131 lcd_wdata(0x02);
132 lcd_wdata(0x05);
133
134 lcd_wcmd(0xE1);
135 lcd_wdata(0x06);
136 lcd_wdata(0x23);
137 lcd_wdata(0x25);
138 lcd_wdata(0x0F);
139 lcd_wdata(0x0A);
140 lcd_wdata(0x04);
141 lcd_wdata(0x02);
142 lcd_wdata(0x1A);
143 lcd_wdata(0x05);
144 lcd_wdata(0x03);
145 lcd_wdata(0x06);
146 lcd_wdata(0x01);
147 lcd_wdata(0x0C);
148 lcd_wdata(0x0B);
149 lcd_wdata(0x05);
150 lcd_wdata(0x05);
151
152 lcd_wcmd(0x3A);
153 lcd_wdata(0x05);
154
155 lcd_wcmd(0x29);
156
157 lcd_wcmd(0x2C);
158}
159
160void lcd_init2(void)
161{
162 lcd_wcmd_data(0x00, 0x0001);
163 lcd_delay(50000);
164
165 lcd_wcmd_data(0x07, 0x0000);
166 lcd_wcmd_data(0x12, 0x0000);
167 lcd_delay(10000);
168
169 lcd_wcmd(0);
170 lcd_wcmd(0);
171 lcd_wcmd(0);
172 lcd_wcmd(0);
173
174 lcd_wcmd_data(0xA4, 0x0001);
175 lcd_delay(10000);
176
177 lcd_wcmd_data(0x70, 0x1B00);
178 lcd_wcmd_data(0x08, 0x030A);
179 lcd_wcmd_data(0x30, 0x0000);
180 lcd_wcmd_data(0x31, 0x0305);
181 lcd_wcmd_data(0x32, 0x0304);
182 lcd_wcmd_data(0x33, 0x0107);
183 lcd_wcmd_data(0x34, 0x0304);
184
185 lcd_wcmd_data(0x35, 0x0204);
186 lcd_wcmd_data(0x36, 0x0707);
187 lcd_wcmd_data(0x37, 0x0701);
188 lcd_wcmd_data(0x38, 0x1B08);
189 lcd_wcmd_data(0x39, 0x030F);
190 lcd_wcmd_data(0x3A, 0x0E0E);
191
192 lcd_wcmd_data(0x07, 0x0001);
193 lcd_delay(50000);
194
195 lcd_wcmd_data(0x18, 0x0001);
196 lcd_wcmd_data(0x10, 0x12B0);
197 lcd_wcmd_data(0x11, 0x0001);
198
199 lcd_wcmd_data(0x12, 0x0114);
200 lcd_wcmd_data(0x13, 0x8D0F);
201 lcd_wcmd_data(0x12, 0x0134);
202 lcd_delay(1000);
203 lcd_wcmd_data(0x01, 0x0100);
204 lcd_wcmd_data(0x02, 0x0700);
205 lcd_wcmd_data(0x03, 0x5030);
206
207 lcd_wcmd_data(0x04, 0x0000);
208 lcd_wcmd_data(0x09, 0x0000);
209 lcd_wcmd_data(0x0C, 0x0000);
210 lcd_wcmd_data(0x0F, 0x0000);
211
212 lcd_wcmd_data(0x14, 0x8000);
213 lcd_wcmd_data(0x20, 0x0000);
214 lcd_wcmd_data(0x21, 0x0000);
215 lcd_wcmd_data(0x71, 0x0001);
216 lcd_wcmd_data(0x7A, 0x0000);
217 lcd_wcmd_data(0x90, 0x0000);
218 lcd_wcmd_data(0x91, 0x0100);
219 lcd_wcmd_data(0x92, 0x0000);
220 lcd_wcmd_data(0x98, 0x0001);
221 lcd_wcmd_data(0x99, 0x030C);
222 lcd_wcmd_data(0x9A, 0x030C);
223
224 lcd_delay(50000);
225 lcd_wcmd_data(0x07, 0x0001);
226 lcd_delay(30000);
227 lcd_wcmd_data(0x07, 0x0021);
228
229 lcd_wcmd_data(0x12, 0x1134);
230 lcd_delay(10000);
231
232 lcd_wcmd_data(0x07, 0x0233);
233 lcd_delay(30000);
234}
235
236
237void lcd_set_window1(int x, int y, int width, int height)
238{
239 (void)x;
240 (void)width;
241
242 lcd_wcmd(0x2A);
243 lcd_wdata(0);
244 lcd_wdata(y);
245 lcd_wdata(0);
246
247 lcd_wcmd(0x2B);
248 lcd_wdata(0);
249 lcd_wdata(y + height - 1);
250 lcd_wdata(0);
251}
252
253void lcd_set_window2(int x, int y, int width, int height)
254{
255 lcd_wcmd_data(0x50, x);
256 lcd_wcmd_data(0x51, x + width - 1);
257 lcd_wcmd_data(0x52, y);
258 lcd_wcmd_data(0x53, y + height - 1);
259}
260
261
262static void lcd_set_position1(int x, int y)
263{
264 (void)x;
265 (void)y;
266}
267
268static void lcd_set_position2(int x, int y)
269{
270 lcd_wcmd_data(0x20, x);
271 lcd_wcmd_data(0x21, y);
272 lcd_wcmd(0x22);
273}
274
275void lcd_init_device(void)
276{
277 /* enable LCD clock */
278 PWRCON &= ~(1 << 18);
279
280 /* configure LCD pins */
281 PCON0 &= ~(3 << 8);
282 PCON7 = (PCON7 & ~(0x000000FF)) | 0x00000033;
283 PCON_ASRAM = 2;
284
285 lcd_reset();
286
287 /* detect LCD type on P0.4 */
288 lcd_type = (PDAT0 & (1 << 4)) ? 1 : 2;
289
290 /* initialise display */
291 if (lcd_type == 1) {
292 lcd_init1();
293 } else {
294 lcd_init2();
295 }
296}
297
298void lcd_update_rect(int x, int y, int width, int height)
299{
300 fb_data* p;
301 int h, w;
302
303 if (lcd_type == 1) {
304 /* TODO implement and test */
305 lcd_set_window1(x, y, width, height);
306 lcd_set_position1(x, y);
307
308 for (h = 0; h < height; h++) {
309 p = &lcd_framebuffer[y][0];
310 for (w = 0; w < LCD_WIDTH; w++) {
311 while (LCD_STATUS & 0x10);
312 LCD_WDATA = *p++;
313 }
314 y++;
315 }
316 }
317 else {
318 lcd_set_window2(x, y, width, height);
319 lcd_set_position2(x, y);
320
321 for (h = 0; h < height; h++) {
322 p = &lcd_framebuffer[y][x];
323 for (w = 0; w < width; w++) {
324 while (LCD_STATUS & 0x10);
325 LCD_WDATA = *p++;
326 }
327 y++;
328 }
329 }
330}
331
332void lcd_update(void)
333{
334 lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
335}
336
diff --git a/firmware/target/arm/s5l8700/yps3/power-yps3.c b/firmware/target/arm/s5l8700/yps3/power-yps3.c
new file mode 100644
index 0000000000..784a5a9629
--- /dev/null
+++ b/firmware/target/arm/s5l8700/yps3/power-yps3.c
@@ -0,0 +1,95 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright © 2009 Bertrik Sikken
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include <stdbool.h>
22#include "config.h"
23#include "s5l8700.h"
24#include "power.h"
25
26/* Power handling for the S5L8700 based Samsung YP-S3
27
28 Pins involved in with power management:
29 * P1.1: USB power detect
30 * P4.7: tuner power/enable
31 * P5.2: unknown output
32 * P5.3: unknown output, related to charging (perhaps charge current?)
33 * P5.4: charge status input (only valid if charger enabled)
34 * P5.6: charger enable
35*/
36
37void power_off(void)
38{
39 /* don't know how to do this yet */
40}
41
42void power_init(void)
43{
44 /* configure pin P1.1 as input for USB power detect */
45 PCON1 = (PCON1 & ~0x000000F0) | 0x00000000;
46
47 /* enable tuner power pin on P4.7 and turn power off */
48 PCON4 = (PCON4 & ~0xF0000000) | 0x10000000;
49 PDAT4 &= ~(1 << 7);
50
51 /* configure pins P5.2 / P5.3 / P5.6 as output, P5.4 as input */
52 PCON5 = (PCON5 & ~0x0F0FFF00) | 0x01001100;
53 PDAT5 &= ~((1 << 2) | (1 << 3) | (1 << 6));
54}
55
56#if CONFIG_CHARGING
57unsigned int power_input_status(void)
58{
59 /* check USB power on P1.1 */
60 if (PDAT1 & (1 << 1)) {
61 return POWER_INPUT_USB;
62 }
63
64 return POWER_INPUT_NONE;
65}
66
67bool charging_state(void)
68{
69 if (PDAT5 & (1 << 6)) {
70 /* charger is enabled, check if charging is busy */
71 return (PDAT5 & (1 << 4));
72 }
73 return false;
74}
75#endif /* CONFIG_CHARGING */
76
77#if CONFIG_TUNER
78bool tuner_power(bool status)
79{
80 if (status) {
81 PDAT4 |= (1 << 7);
82 }
83 else {
84 PDAT4 &= ~(1 << 7);
85 }
86 /* TODO what should we return here? */
87 return status;
88}
89
90bool tuner_powered(void)
91{
92 return (PDAT4 & (1 << 7));
93}
94#endif /* CONFIG_TUNER */
95