summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/SOURCES2
-rw-r--r--apps/keymaps/keymap-ypz5.c406
-rw-r--r--firmware/SOURCES12
-rw-r--r--firmware/export/config.h4
-rw-r--r--firmware/export/config/samsungypz5.h201
-rw-r--r--firmware/target/arm/imx233/power-imx233.c2
-rw-r--r--firmware/target/arm/imx233/samsung-ypz5/audio-target.h31
-rw-r--r--firmware/target/arm/imx233/samsung-ypz5/backlight-target.h28
-rw-r--r--firmware/target/arm/imx233/samsung-ypz5/backlight-ypz5.c149
-rw-r--r--firmware/target/arm/imx233/samsung-ypz5/button-target.h59
-rw-r--r--firmware/target/arm/imx233/samsung-ypz5/button-ypz5.c273
-rw-r--r--firmware/target/arm/imx233/samsung-ypz5/debug-ypz5.c29
-rw-r--r--firmware/target/arm/imx233/samsung-ypz5/fmradio-target.h31
-rw-r--r--firmware/target/arm/imx233/samsung-ypz5/ftl-target.h39
-rw-r--r--firmware/target/arm/imx233/samsung-ypz5/lcd-target.h25
-rw-r--r--firmware/target/arm/imx233/samsung-ypz5/lcd-ypz5.c294
-rw-r--r--firmware/target/arm/imx233/samsung-ypz5/powermgmt-target.h37
-rw-r--r--firmware/target/arm/imx233/samsung-ypz5/powermgmt-ypz5.c48
-rw-r--r--firmware/target/arm/imx233/touchscreen-imx233.c27
-rwxr-xr-xtools/configure21
-rw-r--r--tools/scramble.c4
21 files changed, 1721 insertions, 1 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index 3968666d98..0e7fc3efca 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -297,5 +297,7 @@ keymaps/keymap-zen.c
297keymaps/keymap-ma.c 297keymaps/keymap-ma.c
298#elif CONFIG_KEYPAD == SONY_NWZ_PAD 298#elif CONFIG_KEYPAD == SONY_NWZ_PAD
299keymaps/keymap-nwz.c 299keymaps/keymap-nwz.c
300#elif CONFIG_KEYPAD == SAMSUNG_YPZ5_PAD
301keymaps/keymap-ypz5.c
300#endif 302#endif
301 303
diff --git a/apps/keymaps/keymap-ypz5.c b/apps/keymaps/keymap-ypz5.c
new file mode 100644
index 0000000000..edeebbac3f
--- /dev/null
+++ b/apps/keymaps/keymap-ypz5.c
@@ -0,0 +1,406 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2013 Lorenzo Miori
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/* Button Code Definitions for the Creative Zen Vision target */
23/* Copied from ZVM target for now... */
24#include <stdio.h>
25#include <string.h>
26#include <stdlib.h>
27
28#include "config.h"
29#include "action.h"
30#include "button.h"
31#include "settings.h"
32
33/*
34 * The format of the list is as follows
35 * { Action Code, Button code, Prereq button code }
36 * if there's no need to check the previous button's value, use BUTTON_NONE
37 * Insert LAST_ITEM_IN_LIST at the end of each mapping
38 */
39
40/* CONTEXT_CUSTOM's used in this file...
41
42CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions)
43CONTEXT_CUSTOM|CONTEXT_SETTINGS = the direction keys for the eq/col picker screens
44 i.e where up/down is inc/dec
45 CONTEXT_SETTINGS = up/down is prev/next, l/r is inc/dec
46
47*/
48
49static const struct button_mapping button_context_standard[] = {
50 { ACTION_STD_PREV, BUTTON_UP|BUTTON_REL, BUTTON_NONE },
51 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
52 { ACTION_STD_NEXT, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE },
53 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
54
55 { ACTION_STD_PREV, BUTTON_FF|BUTTON_REL, BUTTON_NONE },
56 { ACTION_STD_PREVREPEAT, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
57 { ACTION_STD_NEXT, BUTTON_REW|BUTTON_REL, BUTTON_NONE },
58 { ACTION_STD_NEXTREPEAT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
59
60 { ACTION_STD_CANCEL, BUTTON_BACK|BUTTON_REL, BUTTON_NONE },
61
62 { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
63
64 //{ ACTION_STD_QUICKSCREEN, BUTTON_BACK|BUTTON_REPEAT, BUTTON_BACK },
65 { ACTION_STD_MENU, BUTTON_BACK|BUTTON_REPEAT, BUTTON_NONE },
66
67 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
68// { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
69
70 LAST_ITEM_IN_LIST
71}; /* button_context_standard */
72
73
74static const struct button_mapping button_context_wps[] = {
75 { ACTION_WPS_PLAY, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
76 //{ ACTION_WPS_STOP, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE },
77
78 { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
79 { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
80
81 { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
82 { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
83 { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
84 { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
85
86 { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
87 { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
88 { ACTION_WPS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
89 { ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
90
91 //{ ACTION_WPS_PITCHSCREEN, BUTTON_BACK|BUTTON_REPEAT, BUTTON_BACK },
92
93 { ACTION_WPS_QUICKSCREEN, BUTTON_BACK|BUTTON_REPEAT, BUTTON_BACK },
94 { ACTION_WPS_MENU, BUTTON_BACK|BUTTON_REL, BUTTON_BACK },
95 { ACTION_WPS_VIEW_PLAYLIST, BUTTON_POWER, BUTTON_NONE },
96 { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
97
98 { ACTION_WPS_HOTKEY, BUTTON_BACK|BUTTON_REL, BUTTON_NONE },
99 { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_BACK },
100 LAST_ITEM_IN_LIST
101}; /* button_context_wps */
102
103static const struct button_mapping button_context_list[] = {
104#ifdef HAVE_VOLUME_IN_LIST
105 { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
106 { ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
107 { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
108 { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
109#endif
110 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
111}; /* button_context_list */
112
113static const struct button_mapping button_context_tree[] = {
114 //{ ACTION_TREE_WPS, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
115 //{ ACTION_TREE_STOP, BUTTON_POWER, BUTTON_NONE },
116 //{ ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
117 //{ ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE },
118 //{ ACTION_TREE_HOTKEY, BUTTON_BACK|BUTTON_REL, BUTTON_NONE },
119
120 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
121}; /* button_context_tree */
122
123static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
124 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
125 { ACTION_STD_CANCEL, BUTTON_BACK|BUTTON_REL, BUTTON_BACK },
126 { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
127 { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
128 { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
129 { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
130 { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
131 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
132};
133
134static const struct button_mapping button_context_settings[] = {
135 { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
136 { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
137 { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
138 { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
139 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
140 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
141 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
142 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
143 { ACTION_SETTINGS_RESET, BUTTON_POWER, BUTTON_NONE },
144 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
145}; /* button_context_settings */
146
147static const struct button_mapping button_context_settings_right_is_inc[] = {
148 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
149 { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
150 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
151 { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
152 { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
153 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
154 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
155 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
156 { ACTION_SETTINGS_RESET, BUTTON_BACK, BUTTON_NONE },
157 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
158}; /* button_context_settingsgraphical */
159
160static const struct button_mapping button_context_yesno[] = {
161 { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE },
162 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
163}; /* button_context_settings_yesno */
164
165static const struct button_mapping button_context_colorchooser[] = {
166 { ACTION_STD_OK, BUTTON_BACK|BUTTON_REL, BUTTON_NONE },
167 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
168}; /* button_context_colorchooser */
169
170static const struct button_mapping button_context_eq[] = {
171 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
172 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
173}; /* button_context_eq */
174
175/** Bookmark Screen **/
176static const struct button_mapping button_context_bmark[] = {
177 { ACTION_BMS_DELETE, BUTTON_BACK, BUTTON_NONE },
178 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
179}; /* button_context_bmark */
180
181static const struct button_mapping button_context_time[] = {
182 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS),
183}; /* button_context_time */
184
185static const struct button_mapping button_context_quickscreen[] = {
186 { ACTION_QS_TOP, BUTTON_UP, BUTTON_NONE },
187 { ACTION_QS_TOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
188 { ACTION_QS_DOWN, BUTTON_DOWN, BUTTON_NONE },
189 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
190 { ACTION_QS_LEFT, BUTTON_LEFT, BUTTON_NONE },
191 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
192 { ACTION_QS_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
193 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
194 { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
195 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
196}; /* button_context_quickscreen */
197
198static const struct button_mapping button_context_pitchscreen[] = {
199
200 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
201}; /* button_context_pitchcreen */
202
203static const struct button_mapping button_context_keyboard[] = {
204 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
205 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
206 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
207 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
208 { ACTION_KBD_CURSOR_RIGHT, BUTTON_POWER, BUTTON_NONE },
209 { ACTION_KBD_CURSOR_RIGHT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE },
210 { ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE },
211 { ACTION_KBD_PAGE_FLIP, BUTTON_BACK|BUTTON_BACK, BUTTON_NONE },
212 { ACTION_KBD_DONE, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
213 { ACTION_KBD_ABORT, BUTTON_BACK|BUTTON_REL, BUTTON_BACK },
214 { ACTION_KBD_BACKSPACE, BUTTON_BACK, BUTTON_NONE },
215 { ACTION_KBD_BACKSPACE, BUTTON_BACK|BUTTON_REPEAT, BUTTON_NONE },
216 { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE },
217 { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
218 { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
219 { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
220 { ACTION_KBD_MORSE_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
221 LAST_ITEM_IN_LIST
222}; /* button_context_keyboard */
223
224/** FM Radio Screen **/
225#if CONFIG_TUNER
226static const struct button_mapping button_context_radio[] = {
227 { ACTION_FM_MENU, BUTTON_SELECT | BUTTON_REPEAT, BUTTON_SELECT },
228 { ACTION_FM_MODE, BUTTON_SELECT, BUTTON_SELECT },
229// { ACTION_FM_PRESET, BUTTON_STOP, BUTTON_NONE },
230 { ACTION_FM_PLAY, BUTTON_POWER | BUTTON_REL, BUTTON_NONE },
231 { ACTION_FM_STOP, BUTTON_POWER | BUTTON_REPEAT, BUTTON_NONE },
232 { ACTION_FM_EXIT, BUTTON_BACK, BUTTON_NONE },
233
234 //{ ACTION_SETTINGS_INC, BUTTON_VOL_UP, BUTTON_NONE },
235 //{ ACTION_SETTINGS_INCREPEAT,BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
236 //{ ACTION_SETTINGS_DEC, BUTTON_VOL_DOWN, BUTTON_NONE },
237 //{ ACTION_SETTINGS_DECREPEAT,BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
238
239 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
240}; /* button_context_radio */
241#endif
242
243#ifdef HAVE_RECORDING
244static const struct button_mapping button_context_recscreen[] = {
245
246 { ACTION_REC_PAUSE, BUTTON_SELECT, BUTTON_NONE },
247 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
248 { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
249 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
250 { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
251
252 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
253}; /* button_context_recscreen */
254#endif
255
256#ifdef USB_ENABLE_HID
257static const struct button_mapping button_context_usb_hid[] = {
258 { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_BACK|BUTTON_REL, BUTTON_BACK },
259 { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_BACK|BUTTON_REPEAT, BUTTON_BACK },
260
261 LAST_ITEM_IN_LIST
262}; /* button_context_usb_hid */
263
264static const struct button_mapping button_context_usb_hid_mode_multimedia[] = {
265
266 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
267 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
268 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP, BUTTON_NONE },
269 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
270 { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
271 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
272 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER },
273 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_REW|BUTTON_REL, BUTTON_REW },
274 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_FF|BUTTON_REL, BUTTON_FF },
275
276 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
277}; /* button_context_usb_hid_mode_multimedia */
278
279
280static const struct button_mapping button_context_usb_hid_mode_presentation[] = {
281 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
282 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER },
283 { ACTION_USB_HID_PRESENTATION_SLIDE_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
284 { ACTION_USB_HID_PRESENTATION_SLIDE_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
285 { ACTION_USB_HID_PRESENTATION_SLIDE_FIRST, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
286 { ACTION_USB_HID_PRESENTATION_SLIDE_LAST, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
287 //{ ACTION_USB_HID_PRESENTATION_SCREEN_BLACK, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_BOTTOMRIGHT },
288 //{ ACTION_USB_HID_PRESENTATION_SCREEN_WHITE, BUTTON_BOTTOMLEFT|BUTTON_REPEAT, BUTTON_BOTTOMLEFT },
289 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_UP, BUTTON_NONE },
290 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
291 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_DOWN, BUTTON_NONE },
292 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
293 { ACTION_USB_HID_PRESENTATION_MOUSE_CLICK, BUTTON_SELECT, BUTTON_SELECT },
294 { ACTION_USB_HID_PRESENTATION_MOUSE_OVER, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
295
296 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
297}; /* button_context_usb_hid_mode_presentation */
298
299static const struct button_mapping button_context_usb_hid_mode_browser[] = {
300 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_UP, BUTTON_NONE },
301 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
302 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_DOWN, BUTTON_NONE },
303 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
304 { ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_VOL_UP, BUTTON_NONE },
305 { ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
306 { ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_VOL_DOWN, BUTTON_NONE },
307 { ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
308 { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE },
309 { ACTION_USB_HID_BROWSER_TAB_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
310 { ACTION_USB_HID_BROWSER_TAB_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
311 { ACTION_USB_HID_BROWSER_TAB_CLOSE, BUTTON_BACK|BUTTON_REPEAT, BUTTON_BACK },
312 { ACTION_USB_HID_BROWSER_HISTORY_BACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
313 { ACTION_USB_HID_BROWSER_HISTORY_FORWARD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
314 { ACTION_USB_HID_BROWSER_VIEW_FULL_SCREEN, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
315
316 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
317}; /* button_context_usb_hid_mode_browser */
318
319#ifdef HAVE_USB_HID_MOUSE
320static const struct button_mapping button_context_usb_hid_mode_mouse[] = {
321 { ACTION_USB_HID_MOUSE_UP, BUTTON_UP, BUTTON_NONE },
322 { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
323 { ACTION_USB_HID_MOUSE_DOWN, BUTTON_DOWN, BUTTON_NONE },
324 { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
325 { ACTION_USB_HID_MOUSE_LEFT, BUTTON_LEFT, BUTTON_NONE },
326 { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
327 { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
328 { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
329 { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_SELECT, BUTTON_NONE },
330 { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
331 { ACTION_USB_HID_MOUSE_BUTTON_RIGHT, BUTTON_POWER, BUTTON_NONE },
332 { ACTION_USB_HID_MOUSE_BUTTON_RIGHT_REL, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
333
334 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_FF, BUTTON_NONE },
335 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
336 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_REW, BUTTON_NONE },
337 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
338
339 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
340}; /* button_context_usb_hid_mode_mouse */
341#endif
342#endif
343
344const struct button_mapping* get_context_mapping(int context)
345{
346 switch (context)
347 {
348 case CONTEXT_STD:
349 return button_context_standard;
350 case CONTEXT_WPS:
351 return button_context_wps;
352 case CONTEXT_LIST:
353 return button_context_list;
354 case CONTEXT_MAINMENU:
355 case CONTEXT_TREE:
356 return button_context_listtree_scroll_without_combo;
357 case CONTEXT_CUSTOM|CONTEXT_TREE:
358 return button_context_tree;
359#if CONFIG_TUNER
360 case CONTEXT_FM:
361 return button_context_radio;
362#endif
363 case CONTEXT_SETTINGS:
364 return button_context_settings;
365 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
366 return button_context_settings_right_is_inc;
367 case CONTEXT_SETTINGS_COLOURCHOOSER:
368 return button_context_colorchooser;
369 case CONTEXT_SETTINGS_EQ:
370 return button_context_eq;
371 case CONTEXT_SETTINGS_TIME:
372 return button_context_time;
373 case CONTEXT_YESNOSCREEN:
374 return button_context_yesno;
375 case CONTEXT_BOOKMARKSCREEN:
376 return button_context_bmark;
377 case CONTEXT_QUICKSCREEN:
378 return button_context_quickscreen;
379 case CONTEXT_PITCHSCREEN:
380 return button_context_pitchscreen;
381 case CONTEXT_KEYBOARD:
382 case CONTEXT_MORSE_INPUT:
383 return button_context_keyboard;
384#ifdef HAVE_RECORDING
385 case CONTEXT_SETTINGS_RECTRIGGER:
386 return button_context_settings_right_is_inc;
387 case CONTEXT_RECSCREEN:
388 return button_context_recscreen;
389#endif
390#ifdef USB_ENABLE_HID
391 case CONTEXT_USB_HID:
392 return button_context_usb_hid;
393 case CONTEXT_USB_HID_MODE_MULTIMEDIA:
394 return button_context_usb_hid_mode_multimedia;
395 case CONTEXT_USB_HID_MODE_PRESENTATION:
396 return button_context_usb_hid_mode_presentation;
397 case CONTEXT_USB_HID_MODE_BROWSER:
398 return button_context_usb_hid_mode_browser;
399#ifdef HAVE_USB_HID_MOUSE
400 case CONTEXT_USB_HID_MODE_MOUSE:
401 return button_context_usb_hid_mode_mouse;
402#endif
403#endif
404 }
405 return button_context_standard;
406}
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 843e5cca22..64041e448e 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -1443,6 +1443,18 @@ target/arm/imx233/sansa-fuzeplus/debug-fuzeplus.c
1443target/arm/imx233/sansa-fuzeplus/powermgmt-fuzeplus.c 1443target/arm/imx233/sansa-fuzeplus/powermgmt-fuzeplus.c
1444#endif 1444#endif
1445 1445
1446#ifdef SAMSUNG_YPZ5
1447target/arm/imx233/samsung-ypz5/backlight-ypz5.c
1448target/arm/imx233/samsung-ypz5/lcd-ypz5.c
1449target/arm/imx233/samsung-ypz5/button-ypz5.c
1450target/arm/imx233/samsung-ypz5/debug-ypz5.c
1451target/arm/imx233/samsung-ypz5/powermgmt-ypz5.c
1452target/arm/imx233/button-lradc-imx233.c
1453#ifndef BOOTLOADER
1454target/arm/imx233/fmradio-imx233.c
1455#endif
1456#endif
1457
1446#ifdef SANSA_CLIPZIP 1458#ifdef SANSA_CLIPZIP
1447target/arm/as3525/sansa-clipzip/lcd-clipzip.c 1459target/arm/as3525/sansa-clipzip/lcd-clipzip.c
1448target/arm/as3525/sansa-clipzip/button-clipzip.c 1460target/arm/as3525/sansa-clipzip/button-clipzip.c
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 3c4c72c054..23ee56fc75 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -150,6 +150,7 @@
150#define MA_PAD 56 150#define MA_PAD 56
151#define SONY_NWZ_PAD 57 151#define SONY_NWZ_PAD 57
152#define CREATIVE_ZEN_PAD 58 152#define CREATIVE_ZEN_PAD 58
153#define SAMSUNG_YPZ5_PAD 59
153 154
154/* CONFIG_REMOTE_KEYPAD */ 155/* CONFIG_REMOTE_KEYPAD */
155#define H100_REMOTE 1 156#define H100_REMOTE 1
@@ -258,6 +259,7 @@
258#define LCD_CREATIVEZENMOZAIC 56 /* as used by the Creative ZEN Mozaic (FGD0801) */ 259#define LCD_CREATIVEZENMOZAIC 56 /* as used by the Creative ZEN Mozaic (FGD0801) */
259#define LCD_ILI9342C 57 /* another type of lcd used by HiFi E.T MA9/MA8 */ 260#define LCD_ILI9342C 57 /* another type of lcd used by HiFi E.T MA9/MA8 */
260#define LCD_CREATIVEZENV 58 /* as used by the Creativr Zen V (Plus) */ 261#define LCD_CREATIVEZENV 58 /* as used by the Creativr Zen V (Plus) */
262#define LCD_SAMSUNGYPZ5 59 /* as used by Samsung YP-Z5 */
261 263
262/* LCD_PIXELFORMAT */ 264/* LCD_PIXELFORMAT */
263#define HORIZONTAL_PACKING 1 265#define HORIZONTAL_PACKING 1
@@ -546,6 +548,8 @@ Lyre prototype 1 */
546#include "config/sonynwze370.h" 548#include "config/sonynwze370.h"
547#elif defined(SONY_NWZE360) 549#elif defined(SONY_NWZE360)
548#include "config/sonynwze360.h" 550#include "config/sonynwze360.h"
551#elif defined(SAMSUNG_YPZ5)
552#include "config/samsungypz5.h"
549#else 553#else
550/* no known platform */ 554/* no known platform */
551#endif 555#endif
diff --git a/firmware/export/config/samsungypz5.h b/firmware/export/config/samsungypz5.h
new file mode 100644
index 0000000000..651ae21ba3
--- /dev/null
+++ b/firmware/export/config/samsungypz5.h
@@ -0,0 +1,201 @@
1/*
2 * This config file is for the Samsung YP-Z5
3 */
4#define IMX233_SUBTARGET 3600
5#define IMX233_PACKAGE IMX233_BGA169
6#define IMX233_PARTITIONS IMX233_FREESCALE
7
8/* For Rolo and boot loader */
9#define MODEL_NUMBER 84
10#define MODEL_NAME "Samsung YP-Z5"
11
12#define HW_SAMPR_CAPS SAMPR_CAP_ALL
13
14/* define this if you have recording possibility */
15#define HAVE_RECORDING
16
17#define REC_SAMPR_CAPS SAMPR_CAP_ALL
18
19/* Default recording levels */
20#define DEFAULT_REC_MIC_GAIN 23
21#define DEFAULT_REC_LEFT_GAIN 23
22#define DEFAULT_REC_RIGHT_GAIN 23
23
24/* Define bitmask of input sources - recordable bitmask can be defined
25 explicitly if different */
26#define HAVE_FMRADIO_IN
27#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_FMRADIO)
28
29/* define this if you have a bitmap LCD display */
30#define HAVE_LCD_BITMAP
31/* define this if you have a colour LCD */
32#define HAVE_LCD_COLOR
33
34#ifndef BOOTLOADER
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 a programmable hotkey is mapped */
44#define HAVE_HOTKEY
45
46/* define this if you have access to the quickscreen */
47#define HAVE_QUICKSCREEN
48
49/* define this if you would like tagcache to build on this target */
50#define HAVE_TAGCACHE
51
52/* define this if the target has volume keys which can be used in the lists */
53#define HAVE_VOLUME_IN_LIST
54
55/* define this if you have LCD enable function */
56//#define HAVE_LCD_ENABLE
57
58/* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE
59 should be defined as well.
60#define HAVE_LCD_SLEEP
61#define HAVE_LCD_SLEEP_SETTING
62*/
63
64/* define this if you can flip your LCD
65#define HAVE_LCD_FLIP
66*/
67
68/* define this if you can invert the colours on your LCD
69#define HAVE_LCD_INVERT
70*/
71
72/* define this if you have a real-time clock */
73#define CONFIG_RTC RTC_IMX233
74
75/* define this if you have a real-time clock with alarm facilities */
76#define HAVE_RTC_ALARM
77
78#endif /* !BOOTLOADER */
79
80/* define this if you have an i.MX23 codec */
81#define HAVE_IMX233_CODEC
82
83#define CONFIG_TUNER TEA5767
84#define CONFIG_TUNER_XTAL 32768
85
86/* There is no hardware tone control */
87#define HAVE_SW_TONE_CONTROLS
88
89#define CONFIG_KEYPAD SAMSUNG_YPZ5_PAD
90#define HAVE_TOUCHPAD_IMX233
91
92/* Define this to enable morse code input */
93#define HAVE_MORSE_INPUT
94
95/* Define this if you do software codec */
96#define CONFIG_CODEC SWCODEC
97
98/* LCD dimensions */
99#define LCD_WIDTH 128
100#define LCD_HEIGHT 160
101#define LCD_DEPTH 16 /* 65536 colours */
102#define LCD_PIXELFORMAT RGB565 /* rgb565 */
103
104/* Define this if you have a software controlled poweroff */
105#define HAVE_SW_POWEROFF
106
107/* Some devices seem to be FAT16 formatted */
108#define HAVE_FAT16SUPPORT
109
110/* The number of bytes reserved for loadable codecs */
111#define CODEC_SIZE 0
112
113/* The number of bytes reserved for loadable plugins */
114#define PLUGIN_BUFFER_SIZE 0
115
116#define AB_REPEAT_ENABLE
117
118/* Define this for LCD backlight available */
119#define HAVE_BACKLIGHT
120#define HAVE_BACKLIGHT_BRIGHTNESS
121
122/* Main LCD backlight brightness range and defaults */
123#define MIN_BRIGHTNESS_SETTING 1
124#define MAX_BRIGHTNESS_SETTING 18
125#define DEFAULT_BRIGHTNESS_SETTING 5
126
127/* Which backlight fading type? */
128#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING
129
130/* define this if you have a flash memory storage */
131//#define HAVE_FLASH_STORAGE
132
133#define CONFIG_STORAGE (STORAGE_RAMDISK)
134//#define CONFIG_NAND NAND_IMX233
135//#define NUM_DRIVES 0
136
137/* Extra threads: touchpad and rds */
138//#define TARGET_EXTRA_THREADS 2
139
140/* todo */
141#define BATTERY_CAPACITY_DEFAULT 550 /* default battery capacity */
142#define BATTERY_CAPACITY_MIN 550 /* min. capacity selectable */
143#define BATTERY_CAPACITY_MAX 550 /* max. capacity selectable */
144#define BATTERY_CAPACITY_INC 0 /* capacity increment */
145#define BATTERY_TYPES_COUNT 1 /* only one type */
146
147#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
148
149/* Charging implemented in a target-specific algorithm */
150#define CONFIG_CHARGING CHARGING_TARGET
151
152/* define this if the unit can be powered or charged via USB */
153#define HAVE_USB_POWER
154
155/* Define this if you have an IMX233*/
156#define CONFIG_CPU IMX233
157
158/* Define this if you want to use the IMX233 i2c interface */
159#define CONFIG_I2C I2C_IMX233
160
161/* define current usage levels (based on battery bench) */
162#define CURRENT_NORMAL 35
163#define CURRENT_BACKLIGHT 30
164#define CURRENT_RECORD CURRENT_NORMAL
165
166/* maximum charging current */
167#define CURRENT_MAX_CHG 200
168
169/* Define this to the CPU frequency */
170#define CPU_FREQ 454000000
171
172/* Type of LCD */
173#define CONFIG_LCD LCD_SAMSUNGYPZ5
174
175/* Offset ( in the firmware file's header ) to the file CRC and data. These are
176 only used when loading the old format rockbox.e200 file */
177#define FIRMWARE_OFFSET_FILE_CRC 0x0
178#define FIRMWARE_OFFSET_FILE_DATA 0x8
179
180/* USB On-the-go */
181#define CONFIG_USBOTG USBOTG_ARC
182
183/* enable these for the experimental usb stack */
184#define HAVE_USBSTACK
185#define USE_ROCKBOX_USB
186#define USB_VENDOR_ID 0x04e8
187#define USB_PRODUCT_ID 0x5041
188#define HAVE_USB_HID_MOUSE
189#define HAVE_BOOTLOADER_USB_MODE
190
191/* Define this if you have adjustable CPU frequency */
192//#define HAVE_ADJUSTABLE_CPU_FREQ
193
194/* Virtual LED (icon) */
195#define CONFIG_LED LED_VIRTUAL
196
197#define BOOTFILE_EXT "samsung"
198#define BOOTFILE "rockbox." BOOTFILE_EXT
199#define BOOTDIR "/.rockbox"
200
201#define INCLUDE_TIMEOUT_API
diff --git a/firmware/target/arm/imx233/power-imx233.c b/firmware/target/arm/imx233/power-imx233.c
index af333dea59..9ad8734823 100644
--- a/firmware/target/arm/imx233/power-imx233.c
+++ b/firmware/target/arm/imx233/power-imx233.c
@@ -137,6 +137,8 @@ void imx233_power_init(void)
137#endif 137#endif
138 /* enable vbusvalid detection method for the dcdc (improves efficiency) */ 138 /* enable vbusvalid detection method for the dcdc (improves efficiency) */
139 BF_SET(POWER_5VCTRL, VBUSVALID_5VDETECT); 139 BF_SET(POWER_5VCTRL, VBUSVALID_5VDETECT);
140 /* disable shutdown on 5V fail */
141 BF_CLR(POWER_5VCTRL, PWDN_5VBRNOUT);
140#ifdef USE_VBUSVALID 142#ifdef USE_VBUSVALID
141 /* make sure VBUSVALID is unlocked */ 143 /* make sure VBUSVALID is unlocked */
142 BF_CLR(POWER_DEBUG, VBUSVALIDPIOLOCK); 144 BF_CLR(POWER_DEBUG, VBUSVALIDPIOLOCK);
diff --git a/firmware/target/arm/imx233/samsung-ypz5/audio-target.h b/firmware/target/arm/imx233/samsung-ypz5/audio-target.h
new file mode 100644
index 0000000000..c0bee26e45
--- /dev/null
+++ b/firmware/target/arm/imx233/samsung-ypz5/audio-target.h
@@ -0,0 +1,31 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2013 by Lorenzo Miori
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 __audio_target__
22#define __audio_target__
23
24/* MUTE_ON toggles a transistor that in turns toggles a mosfet... */
25#define IMX233_AUDIO_HP_GATE_BANK 1
26#define IMX233_AUDIO_HP_GATE_PIN 22
27#define IMX233_AUDIO_HP_GATE_INVERTED
28
29#define IMX233_AUDIO_COUPLING_MODE ACM_CAP
30
31#endif /* __audio_target__ */
diff --git a/firmware/target/arm/imx233/samsung-ypz5/backlight-target.h b/firmware/target/arm/imx233/samsung-ypz5/backlight-target.h
new file mode 100644
index 0000000000..5fa2ed38f9
--- /dev/null
+++ b/firmware/target/arm/imx233/samsung-ypz5/backlight-target.h
@@ -0,0 +1,28 @@
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#ifndef BACKLIGHT_TARGET_H
21#define BACKLIGHT_TARGET_H
22
23bool _backlight_init(void);
24void _backlight_on(void);
25void _backlight_off(void);
26void _backlight_set_brightness(int brightness);
27
28#endif /* BACKLIGHT_TARGET_H */
diff --git a/firmware/target/arm/imx233/samsung-ypz5/backlight-ypz5.c b/firmware/target/arm/imx233/samsung-ypz5/backlight-ypz5.c
new file mode 100644
index 0000000000..27a7ecedfc
--- /dev/null
+++ b/firmware/target/arm/imx233/samsung-ypz5/backlight-ypz5.c
@@ -0,0 +1,149 @@
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
21#include "config.h"
22#include "system.h"
23#include "lcd.h"
24#include "backlight.h"
25#include "backlight-target.h"
26#include "pinctrl-imx233.h"
27
28/**
29 * AAT3151 Backlight Controller
30 */
31
32/* Timings */
33#define TIME_OFF 500
34#define TIME_LOW 50
35#define TIME_HI 50
36#define TIME_LAT 500
37
38/* Number of raising edges to select the particular register */
39#define D1_D4_CURRENT_E 17
40#define D1_D3_CURRENT_E 18
41#define D4_CURRENT_E 19
42#define MAX_CURRENT_E 20
43#define LOW_CURRENT_E 21
44
45/* The actual register address / number */
46#define D1_D4_CURRENT 1
47#define D1_D3_CURRENT 2
48#define D4_CURRENT 3
49#define MAX_CURRENT 4
50#define LOW_CURRENT 5
51
52/* Valid values for LOW_CURRENT register */
53#define MAX_CURRENT_20 1
54#define MAX_CURRENT_30 2
55#define MAX_CURRENT_15 3
56#define MAX_CURRENT_LOW_CURRENT 4
57
58static int current_level = -1;
59
60static void create_raising_edges(int num)
61{
62 while (num--)
63 {
64 /* Setting a register takes a sufficient small amount of time,
65 * in the order of 50 ns. Thus the necessary 2 delays TIME_LOW/TIME_HI
66 * are not strictly necessary */
67 imx233_pinctrl_set_gpio(3, 13, false);
68 imx233_pinctrl_set_gpio(3, 13, true);
69 }
70}
71
72static void aat3151_write(int addr, int data)
73{
74 create_raising_edges(16 + addr);
75 udelay(TIME_LAT);
76 create_raising_edges(data);
77 udelay(TIME_LAT);
78}
79
80void _backlight_set_brightness(int level)
81{
82 /* Don't try to reset backlight if not necessary
83 * Moreover this helps to avoid flickering when
84 * being in some screens like USB mode and
85 * pressing some keys / touchpad...
86 */
87 if (current_level == level) return;
88
89 /* Check for limits and adjust in case */
90 level = MIN(MAX_BRIGHTNESS_SETTING, MAX(0, level));
91
92 if (level == 0)
93 {
94 /* Set pin low for a sufficient time, puts the device into low-power consumption state
95 * In other words backlight goes off
96 */
97 imx233_pinctrl_set_gpio(3, 13, false);
98 udelay(TIME_OFF);
99 }
100 else
101 {
102 if (level > 3) {
103 /* This enables 16 levels of backlight */
104 aat3151_write(MAX_CURRENT, MAX_CURRENT_15);
105 /* Set the value according Table 1 in datasheet
106 * For MAX_CURRENT_15, the scale is from 0 mA to 15 mA in 16 steps
107 */
108 aat3151_write(D1_D3_CURRENT, 19 - level);
109 }
110 else {
111 /* This enables other 4 levels of backlight */
112 aat3151_write(MAX_CURRENT, MAX_CURRENT_LOW_CURRENT);
113 /* Set the value according Table 1 in datasheet
114 * For LOW_CURRENT, there is no "real" scale. We have scattered values.
115 * We are interested in the last 3 -> 0.5 mA; 1 mA; 2 mA
116 */
117 aat3151_write(LOW_CURRENT, 13 + level);
118 }
119 }
120 current_level = level;
121}
122
123bool _backlight_init(void)
124{
125 imx233_pinctrl_acquire(3, 13, "backlight");
126 imx233_pinctrl_set_function(3, 13, PINCTRL_FUNCTION_GPIO);
127 imx233_pinctrl_set_drive(3, 13, PINCTRL_DRIVE_4mA);
128 imx233_pinctrl_enable_gpio(3, 13, true);
129 imx233_pinctrl_set_gpio(3, 13, false);
130 return true;
131}
132
133void _backlight_on(void)
134{
135#ifdef HAVE_LCD_ENABLE
136 lcd_enable(true); /* power on lcd + visible display */
137#endif
138 /* restore the previous backlight level */
139 _backlight_set_brightness(backlight_brightness);
140}
141
142void _backlight_off(void)
143{
144 /* there is no real on/off but we can set to 0 brightness */
145 _backlight_set_brightness(0);
146#ifdef HAVE_LCD_ENABLE
147 lcd_enable(false); /* power off visible display */
148#endif
149}
diff --git a/firmware/target/arm/imx233/samsung-ypz5/button-target.h b/firmware/target/arm/imx233/samsung-ypz5/button-target.h
new file mode 100644
index 0000000000..2f94f5fb31
--- /dev/null
+++ b/firmware/target/arm/imx233/samsung-ypz5/button-target.h
@@ -0,0 +1,59 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2013 by Lorenzo Miori
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#define IMX233_BUTTON_LRADC_CHANNEL 0
28#define IMX233_BUTTON_LRADC_HOLD_DET BLH_GPIO
29#define BLH_GPIO_BANK 0
30#define BLH_GPIO_PIN 13
31
32#define IMX233_BUTTON_LRADC_CHANNEL 0
33
34/* Main unit's buttons */
35#define BUTTON_POWER 0x00000001
36#define BUTTON_VOL_UP 0x00000002
37#define BUTTON_VOL_DOWN 0x00000004
38/* Directional buttons by touchpad */
39#define BUTTON_LEFT 0x00000008
40#define BUTTON_UP 0x00000010
41#define BUTTON_RIGHT 0x00000020
42#define BUTTON_DOWN 0x00000040
43#define BUTTON_SELECT 0x00000080
44#define BUTTON_BACK 0x00000100
45#define BUTTON_REW 0x00000200
46#define BUTTON_FF 0x00000400
47
48
49#define BUTTON_MAIN (BUTTON_VOL_UP | BUTTON_VOL_DOWN | BUTTON_POWER | BUTTON_LEFT | \
50 BUTTON_UP | BUTTON_RIGHT | BUTTON_DOWN | BUTTON_SELECT | \
51 BUTTON_BACK | BUTTON_REW | BUTTON_FF)
52
53/* Software power-off */
54#define POWEROFF_BUTTON BUTTON_POWER
55#define POWEROFF_COUNT 10
56
57bool button_debug_screen(void);
58
59#endif /* _BUTTON_TARGET_H_ */
diff --git a/firmware/target/arm/imx233/samsung-ypz5/button-ypz5.c b/firmware/target/arm/imx233/samsung-ypz5/button-ypz5.c
new file mode 100644
index 0000000000..cee82e2e9f
--- /dev/null
+++ b/firmware/target/arm/imx233/samsung-ypz5/button-ypz5.c
@@ -0,0 +1,273 @@
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
21#include "system.h"
22#include "lcd.h"
23#include "string.h"
24#include "pinctrl-imx233.h"
25#include "power-imx233.h"
26#include "button-lradc-imx233.h"
27#include "button-target.h"
28
29#ifndef BOOTLOADER
30#include "touchscreen.h"
31#include "touchscreen-imx233.h"
32#include "button.h"
33#include "font.h"
34#include "action.h"
35#endif
36
37struct imx233_button_lradc_mapping_t imx233_button_lradc_mapping[] =
38{
39 {455, BUTTON_VOL_UP},
40 {900, BUTTON_VOL_DOWN},
41 {1410, BUTTON_BACK},
42 {1868, BUTTON_FF},
43 {2311, BUTTON_REW},
44 {2700, 0},
45 {3300, IMX233_BUTTON_LRADC_END},
46};
47
48#ifndef BOOTLOADER
49static int last_x = 0;
50static int last_y = 0;
51static bool touching = false;
52#endif /* BOOTLOADER */
53
54#ifndef BOOTLOADER
55
56/* Touchpad extra pin initialization
57 * Strange facts:
58 * 1. In the fully working sample I have, it seems that pins
59 * must be all set to low
60 * 2. In the other sample without LCD, it seems (by measurement) that
61 * not all the pins are set to low! Actually, I still need to see if
62 * touchpad works in this other sample.
63*/
64void touchpad_pin_setup(void)
65{
66 /* TX+ */
67 imx233_pinctrl_acquire(0, 25, "touchpad X+ power low");
68 imx233_pinctrl_set_function(0, 25, PINCTRL_FUNCTION_GPIO);
69 imx233_pinctrl_set_drive(0, 25, PINCTRL_DRIVE_4mA);
70 imx233_pinctrl_enable_gpio(0, 25, true);
71
72 /* TY+ */
73 imx233_pinctrl_acquire(0, 26, "touchpad Y+ power high");
74 imx233_pinctrl_set_function(0, 26, PINCTRL_FUNCTION_GPIO);
75 imx233_pinctrl_set_drive(0, 26, PINCTRL_DRIVE_4mA);
76 imx233_pinctrl_enable_gpio(0, 26, true);
77
78 /* TY- */
79 imx233_pinctrl_acquire(1, 21, "touchpad Y- power low");
80 imx233_pinctrl_set_function(1, 21, PINCTRL_FUNCTION_GPIO);
81 imx233_pinctrl_set_drive(1, 21, PINCTRL_DRIVE_4mA);
82 imx233_pinctrl_enable_gpio(1, 21, true);
83
84 /* TX- */
85 imx233_pinctrl_acquire(3, 15, "touchpad X- power high");
86 imx233_pinctrl_set_function(3, 15, PINCTRL_FUNCTION_GPIO);
87 imx233_pinctrl_set_drive(3, 15, PINCTRL_DRIVE_4mA);
88 imx233_pinctrl_enable_gpio(3, 15, true);
89
90}
91#endif /* BOOTLOADER */
92
93void button_init_device(void)
94{
95 imx233_button_lradc_init();
96#ifndef BOOTLOADER
97 touchpad_pin_setup();
98 /* Now that is powered up, proceed with touchpad initialization */
99 imx233_touchscreen_init();
100 imx233_touchscreen_enable(true);
101#endif /* BOOTLOADER */
102}
103
104bool button_hold(void)
105{
106 return imx233_button_lradc_hold();
107}
108
109/* X, Y, RadiusX, RadiusY */
110#define TOUCH_UP 2400, 1050, 650, 250
111#define TOUCH_DOWN 2057, 3320, 500, 350
112#define TOUCH_LEFT 3581, 2297, 300, 350
113#define TOUCH_RIGHT 1000, 2100, 400, 700
114#define TOUCH_CENTER 2682, 2167, 335, 276
115
116bool coord_in_radius(int x, int y, int cx, int cy, int rx, int ry)
117{
118 return ((x >= cx - rx && x <= cx + rx) && (y >= cy - ry && y <= cy + ry));
119}
120
121int button_read_device(void)
122{
123 int res = 0;
124
125 switch(imx233_power_read_pswitch())
126 {
127 case 1: res |= BUTTON_POWER; break;
128 case 3: res |= BUTTON_SELECT; break;
129 }
130
131#ifndef BOOTLOADER
132 touching = imx233_touchscreen_get_touch(&last_x, &last_y);
133 if(touching)
134 {
135 if (coord_in_radius(last_x, last_y, TOUCH_LEFT))
136 {
137 res |= BUTTON_LEFT;
138 }
139 else if (coord_in_radius(last_x, last_y, TOUCH_RIGHT))
140 {
141 res |= BUTTON_RIGHT;
142 }
143 else if (coord_in_radius(last_x, last_y, TOUCH_DOWN))
144 {
145 res |= BUTTON_DOWN;
146 }
147 else if (coord_in_radius(last_x, last_y, TOUCH_UP))
148 {
149 res |= BUTTON_UP;
150 }
151 }
152#endif /* BOOTLOADER */
153 return imx233_button_lradc_read(res);
154}
155
156#ifndef BOOTLOADER
157
158#define MAX_ENTRIES 100
159#define VIEWPORT_HEIGHT 100
160#define VIEWPORT_WIDTH 100
161#define MAX_X 3700
162#define MAX_Y 3700
163#define ADAPT_TO_VIEWPORT(cx, cy, rx, ry) ((float)(cx) / MAX_X) * VIEWPORT_WIDTH, \
164 ((float)(cy) / MAX_Y) * VIEWPORT_HEIGHT, \
165 ((float)(rx) / MAX_X) * VIEWPORT_WIDTH, \
166 ((float)(ry) / MAX_Y) * VIEWPORT_HEIGHT
167static void draw_calibration_rect(int cx, int cy, int rx, int ry)
168{
169 if (coord_in_radius(last_x, last_y, cx, cy, rx, ry))
170 lcd_set_drawinfo(DRMODE_SOLID, LCD_RGBPACK(0xff, 0xff, 0xff), LCD_BLACK);
171 else
172 lcd_set_drawinfo(DRMODE_SOLID, LCD_RGBPACK(0xff, 0, 0), LCD_BLACK);
173 lcd_drawrect(ADAPT_TO_VIEWPORT(cx - rx, cy - ry, 2 * rx, 2 * ry));
174}
175
176bool button_debug_screen(void)
177{
178 int last = 0;
179 struct point_t
180 {
181 int x;
182 int y;
183 };
184 struct point_t last_entries[MAX_ENTRIES];
185 struct viewport report_vp;
186
187 memset(&report_vp, 0, sizeof(report_vp));
188 report_vp.x = (LCD_WIDTH - VIEWPORT_WIDTH) / 2;
189 report_vp.y = (LCD_HEIGHT - VIEWPORT_HEIGHT) / 2;
190 report_vp.width = VIEWPORT_WIDTH;
191 report_vp.height = VIEWPORT_HEIGHT;
192
193 lcd_setfont(FONT_SYSFIXED);
194 lcd_clear_display();
195
196 while(1)
197 {
198 int button = get_action(CONTEXT_STD, HZ / 10);
199 switch(button)
200 {
201 case ACTION_STD_OK:
202 case ACTION_STD_MENU:
203 lcd_set_viewport(NULL);
204 lcd_setfont(FONT_UI);
205 lcd_clear_display();
206 return true;
207 case ACTION_STD_CANCEL:
208 lcd_set_viewport(NULL);
209 lcd_setfont(FONT_UI);
210 lcd_clear_display();
211 return false;
212 }
213
214 lcd_set_viewport(NULL);
215 lcd_putsf(0, 1, "(%d,%d) %s", last_x, last_y, touching ? "touching!" : "");
216 lcd_putsf(0, 0, "Type %s", imx233_pinctrl_get_gpio(0, 31) ? "CAP" : "REG");
217 lcd_set_viewport(&report_vp);
218 lcd_set_drawinfo(DRMODE_SOLID, LCD_RGBPACK(0, 0, 0xff), LCD_BLACK);
219 lcd_drawrect(0, 0, 100, 100);
220 float percent_x = ((float)(last_x) / MAX_X);
221 float percent_y = ((float)(last_y) / MAX_Y);
222 if (touching)
223 {
224 lcd_set_viewport(NULL);
225 if (last < MAX_ENTRIES)
226 {
227 last_entries[last].x = last_x;
228 last_entries[last].y = last_y;
229 last++;
230 lcd_putsf(0, 17, "Recording: %d captures left", MAX_ENTRIES - last);
231 }
232 else
233 {
234 int min_x = 9999;
235 int min_y = 9999;
236 int max_x = -1;
237 int max_y = -1;
238 int median_x = 0;
239 int median_y = 0;
240 for (int i = 0; i < MAX_ENTRIES; i++)
241 {
242 min_x = MIN(min_x, last_entries[i].x);
243 min_y = MIN(min_y, last_entries[i].y);
244 max_x = MAX(max_x, last_entries[i].x);
245 max_y = MAX(max_y, last_entries[i].y);
246 median_x += last_entries[i].x;
247 median_y += last_entries[i].y;
248 }
249 median_x /= MAX_ENTRIES;
250 median_y /= MAX_ENTRIES;
251 lcd_putsf(0, 17, "center(%d,%d)", median_x, median_y);
252 lcd_putsf(0, 18, "radius(%d,%d)", median_x / 2, median_y / 2);
253 }
254 lcd_set_viewport(&report_vp);
255 lcd_set_drawinfo(DRMODE_SOLID, LCD_RGBPACK(0xff, 0x8c, 0), LCD_BLACK);
256 lcd_fillrect(VIEWPORT_WIDTH * percent_x, VIEWPORT_HEIGHT * percent_y, 2, 2);
257 }
258
259 /* Draw current calibration settings */
260 lcd_set_viewport(&report_vp);
261 draw_calibration_rect(TOUCH_UP);
262 draw_calibration_rect(TOUCH_DOWN);
263 draw_calibration_rect(TOUCH_CENTER);
264 draw_calibration_rect(TOUCH_LEFT);
265 draw_calibration_rect(TOUCH_RIGHT);
266
267 lcd_update();
268 yield();
269 }
270
271 return true;
272}
273#endif
diff --git a/firmware/target/arm/imx233/samsung-ypz5/debug-ypz5.c b/firmware/target/arm/imx233/samsung-ypz5/debug-ypz5.c
new file mode 100644
index 0000000000..c125eac973
--- /dev/null
+++ b/firmware/target/arm/imx233/samsung-ypz5/debug-ypz5.c
@@ -0,0 +1,29 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2013 by Amaury Pouly
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 "system.h"
23#include "button-target.h"
24#include "lcd-target.h"
25
26bool dbg_hw_target_info(void)
27{
28 return button_debug_screen() && lcd_debug_screen();
29}
diff --git a/firmware/target/arm/imx233/samsung-ypz5/fmradio-target.h b/firmware/target/arm/imx233/samsung-ypz5/fmradio-target.h
new file mode 100644
index 0000000000..66bceb4071
--- /dev/null
+++ b/firmware/target/arm/imx233/samsung-ypz5/fmradio-target.h
@@ -0,0 +1,31 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2013 by Amaury Pouly
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 _FMRADIO_TARGET_H_
22#define _FMRADIO_TARGET_H_
23
24#define IMX233_FMRADIO_I2C FMI_HW
25
26#define IMX233_FMRADIO_POWER FMP_GPIO
27#define FMP_GPIO_BANK 0
28#define FMP_GPIO_PIN 10
29#define FMP_GPIO_DELAY (HZ / 5)
30
31#endif /* _FMRADIO_TARGET_H_ */
diff --git a/firmware/target/arm/imx233/samsung-ypz5/ftl-target.h b/firmware/target/arm/imx233/samsung-ypz5/ftl-target.h
new file mode 100644
index 0000000000..cb943e34f2
--- /dev/null
+++ b/firmware/target/arm/imx233/samsung-ypz5/ftl-target.h
@@ -0,0 +1,39 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2009 by Michael Sparmann
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#ifndef __FTL_TARGET_H__
23#define __FTL_TARGET_H__
24
25#include "config.h"
26#include "inttypes.h"
27
28#ifdef BOOTLOADER
29/* Bootloaders don't need write access */
30#define FTL_READONLY
31#endif
32
33uint32_t ftl_init(void);
34uint32_t ftl_read(uint32_t sector, uint32_t count, void* buffer);
35uint32_t ftl_write(uint32_t sector, uint32_t count, const void* buffer);
36uint32_t ftl_sync(void);
37
38
39#endif
diff --git a/firmware/target/arm/imx233/samsung-ypz5/lcd-target.h b/firmware/target/arm/imx233/samsung-ypz5/lcd-target.h
new file mode 100644
index 0000000000..9993b7d731
--- /dev/null
+++ b/firmware/target/arm/imx233/samsung-ypz5/lcd-target.h
@@ -0,0 +1,25 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (c) 2013 by Amaury Pouly
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#ifndef LCD_TARGET_H
21#define LCD_TARGET_H
22
23bool lcd_debug_screen(void);
24
25#endif /* LCD_TARGET_H */
diff --git a/firmware/target/arm/imx233/samsung-ypz5/lcd-ypz5.c b/firmware/target/arm/imx233/samsung-ypz5/lcd-ypz5.c
new file mode 100644
index 0000000000..4f7d9b88b5
--- /dev/null
+++ b/firmware/target/arm/imx233/samsung-ypz5/lcd-ypz5.c
@@ -0,0 +1,294 @@
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 <sys/types.h> /* off_t */
21#include <string.h>
22#include "cpu.h"
23#include "system.h"
24#include "backlight-target.h"
25#include "lcd.h"
26#include "lcdif-imx233.h"
27#include "clkctrl-imx233.h"
28#include "pinctrl-imx233.h"
29#include "dcp-imx233.h"
30#include "logf.h"
31#ifndef BOOTLOADER
32#include "button.h"
33#include "font.h"
34#include "action.h"
35#endif
36#include "dma-imx233.h"
37
38#include "regs/regs-lcdif.h"
39
40/**
41 * NOTE
42 * We don't know exact LCD models nor we have datasheets for them
43 * Register function are partly guessed from the values, others are guessed from other LCD
44 * drivers and others have been confirmed studying their values
45 */
46
47static enum lcd_type_t
48{
49 LCD_TYPE_ZERO = 0,
50 LCD_TYPE_ONE = 1
51} lcd_type = LCD_TYPE_ZERO;
52
53static void lcd_write_reg(uint16_t reg, uint16_t data)
54{
55 imx233_lcdif_pio_send(false, 1, &reg);
56 if(reg != 0x22)
57 imx233_lcdif_pio_send(true, 1, &data);
58}
59
60/*
61 * The two LCD types require different initialization sequences
62 */
63void lcd_init_seq(void)
64{
65 switch (lcd_type)
66 {
67 case LCD_TYPE_ZERO:
68 {
69 lcd_write_reg(0x11, 0x1f1e);
70 lcd_write_reg(0x38, 0xf0f);
71 lcd_write_reg(0x12, 0x1101);
72 lcd_write_reg(0x13, 0x808);
73 lcd_write_reg(0x14, 0x3119);
74 lcd_write_reg(0x10, 0x1a10);
75 udelay(0xc350);
76 lcd_write_reg(0x13, 0x83b);
77 udelay(0x30d40);
78 lcd_write_reg(1, 0x90c); /* Display mode */
79 lcd_write_reg(2, 0x200);
80 lcd_write_reg(3, 0x1030);
81 lcd_write_reg(7, 5);
82 lcd_write_reg(8, 0x503);
83 lcd_write_reg(11, 0);
84 lcd_write_reg(12, 0);
85 /* Gamma control */
86 lcd_write_reg(0x30, 0x606);
87 lcd_write_reg(0x31, 0x606);
88 lcd_write_reg(0x32, 0x305);
89 lcd_write_reg(0x33, 2);
90 lcd_write_reg(0x34, 0x503);
91 lcd_write_reg(0x35, 0x606);
92 lcd_write_reg(0x36, 0x606);
93 lcd_write_reg(0x37, 0x200);
94
95 lcd_write_reg(0x11, 0x1f1e);
96 lcd_write_reg(0x38, 0xf0f);
97 /* Set initial LCD limits and RAM settings */
98 lcd_write_reg(0x40, 0); //BPP ?
99 lcd_write_reg(0x42, 0x9f00);
100 lcd_write_reg(0x43, 0);
101 lcd_write_reg(0x44, 0x7f00); /* Horizontal initial refresh zone [0 - 127] */
102 lcd_write_reg(0x45, 0x9f00); /* Vertical initial refresh zone [0 - 159] */
103
104 lcd_write_reg(14, 0x13);
105 lcd_write_reg(0xa9, 0x14);
106 lcd_write_reg(0xa7, 0x30);
107 lcd_write_reg(0xa8, 0x124);
108 lcd_write_reg(0x6f, 0x1d00);
109 lcd_write_reg(0x70, 3);
110 lcd_write_reg(7, 1);
111 lcd_write_reg(0x10, 0x1a10);
112 udelay(0x9c40);
113 lcd_write_reg(7, 0x21);
114 lcd_write_reg(7, 0x23);
115 udelay(0x9c40);
116 lcd_write_reg(7, 0x37); /* Seems to be "power on" */
117 break;
118 }
119 case LCD_TYPE_ONE:
120 {
121 lcd_write_reg(0, 1);
122 udelay(0x2710);
123 lcd_write_reg(0x11, 0x171b);
124 lcd_write_reg(0x12, 0);
125 lcd_write_reg(0x13, 0x80d);
126 lcd_write_reg(0x14, 0x18);
127 lcd_write_reg(0x10, 0x1a10);
128 udelay(0xc350);
129 lcd_write_reg(0x13, 0x81d);
130 udelay(0xc350);
131 lcd_write_reg(1, 0x90c); /* Display mode */
132 lcd_write_reg(2, 0x200);
133 lcd_write_reg(3, 0x1030);
134 lcd_write_reg(7, 5);
135 lcd_write_reg(8, 0x30a);
136 lcd_write_reg(11, 4);
137 lcd_write_reg(12, 0);
138 /* Gamma control */
139 lcd_write_reg(0x30, 0x300);
140 lcd_write_reg(0x31, 0);
141 lcd_write_reg(0x32, 0);
142 lcd_write_reg(0x33, 0x404);
143 lcd_write_reg(0x34, 0x707);
144 lcd_write_reg(0x35, 0x700);
145 lcd_write_reg(0x36, 0x703);
146 lcd_write_reg(0x37, 4);
147
148 lcd_write_reg(0x38, 0);
149 /* Set initial LCD limits and RAM settings */
150 lcd_write_reg(0x40, 0);
151 lcd_write_reg(0x42, 0x9f00); /* LCD Display Start Address Register 0 */
152 lcd_write_reg(0x43, 0); /* LCD Display Start Address Register 1 */
153 lcd_write_reg(0x44, 0x7f00); /* Horizontal initial refresh zone [0 - 127] */
154 lcd_write_reg(0x45, 0x9f00); /* Vertical initial refresh zone [0 - 159] */
155
156 lcd_write_reg(7, 1);
157 udelay(0x2710);
158 lcd_write_reg(7, 0x21);
159 lcd_write_reg(7, 0x23);
160 udelay(0x2710);
161 lcd_write_reg(7, 0x1037);
162 udelay(0x2710);
163 lcd_write_reg(7, 0x35);
164 lcd_write_reg(7, 0x36);
165 lcd_write_reg(7, 0x37);
166 udelay(10000);
167 break;
168 }
169 default:
170 break;
171 }
172}
173
174static void send_update_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h)
175{
176 /* Set horizontal refresh zone */
177 lcd_write_reg(0x44, (x | (y + w - 1) << 0x8));
178 /* Set vertical refresh zone */
179 lcd_write_reg(0x45, (y | (y + h - 1) << 0x8));
180 lcd_write_reg(0x21, x | y << 8);
181 /* Set register index to 0x22 to write screen data. 0 is mock value */
182 lcd_write_reg(0x22, 0);
183}
184
185static void setup_lcd_pins(void)
186{
187 imx233_lcdif_setup_system_pins(16);
188 /* lcd_rd */
189 imx233_pinctrl_acquire(0, 9, "lcd rd");
190 imx233_pinctrl_set_function(0, 9, PINCTRL_FUNCTION_GPIO);
191 imx233_pinctrl_set_gpio(0, 9, false);
192 /*
193 * This pin is important to know the LCD type
194 * There are two types that require two different initialization sequences
195 */
196 /* lcd_tp */
197 imx233_pinctrl_acquire(3, 12, "lcd type");
198 imx233_pinctrl_set_function(3, 12, PINCTRL_FUNCTION_GPIO);
199 imx233_pinctrl_enable_gpio(3, 12, false);
200 /* Sense LCD Type */
201 lcd_type = imx233_pinctrl_get_gpio(3, 12) ? LCD_TYPE_ONE : LCD_TYPE_ZERO;
202}
203
204static void setup_parameters(void)
205{
206 imx233_lcdif_init();
207 imx233_lcdif_enable(true);
208 imx233_lcdif_set_word_length(16);
209 imx233_lcdif_set_data_swizzle(false);
210 imx233_lcdif_set_timings(2, 1, 1, 1);
211 BF_WR_V(LCDIF_CTRL, MODE86, 8080_MODE);
212
213 imx233_lcdif_reset_lcd(true);
214 udelay(50);
215 imx233_lcdif_reset_lcd(false);
216 udelay(10);
217 imx233_lcdif_reset_lcd(true);
218}
219
220void lcd_init_device(void)
221{
222 /* Setup interface pins */
223 setup_lcd_pins();
224 /* Set LCD parameters */
225 setup_parameters();
226 /* Send initialization sequence to LCD */
227 lcd_init_seq();
228}
229
230struct lcdif_cmd_t
231{
232 struct apb_dma_command_t dma;
233 uint32_t ctrl0;
234 uint32_t pad[4];
235} __attribute__((packed)) CACHEALIGN_ATTR;
236
237struct lcdif_cmd_t lcdif_dma;
238void lcd_update(void)
239{
240 unsigned size = LCD_WIDTH * LCD_HEIGHT * sizeof(fb_data);
241
242 send_update_rect(0,0,LCD_WIDTH,LCD_HEIGHT);
243 /* We can safely do the transfer in a single shot, since 160 * 128 * 2 < 65k,
244 * the maximum transfer size!
245 */
246 lcdif_dma.dma.cmd |= BF_OR3(APB_CHx_CMD, CMDWORDS(1), XFER_COUNT(size), COMMAND(2));
247 lcdif_dma.ctrl0 = HW_LCDIF_CTRL & ~BM_LCDIF_CTRL_COUNT;
248 lcdif_dma.ctrl0 |= BF_OR2(LCDIF_CTRL, COUNT(size/2), DATA_SELECT(1));
249 lcdif_dma.dma.buffer = FBADDR(0,0);
250 lcdif_dma.dma.cmd |= BM_APB_CHx_CMD_SEMAPHORE;
251
252 imx233_dma_start_command(APB_LCDIF, &lcdif_dma.dma);
253 imx233_dma_wait_completion(APB_LCDIF, HZ);
254}
255
256void lcd_update_rect(int x, int y, int w, int h)
257{
258 (void)x;
259 (void)y;
260 (void)w;
261 (void)h;
262 lcd_update();
263}
264
265#ifndef BOOTLOADER
266bool lcd_debug_screen(void)
267{
268 lcd_setfont(FONT_SYSFIXED);
269
270 while(1)
271 {
272 int button = get_action(CONTEXT_STD, HZ / 10);
273 switch(button)
274 {
275 case ACTION_STD_NEXT:
276 case ACTION_STD_PREV:
277 case ACTION_STD_OK:
278 case ACTION_STD_MENU:
279 lcd_setfont(FONT_UI);
280 return true;
281 case ACTION_STD_CANCEL:
282 lcd_setfont(FONT_UI);
283 return false;
284 }
285
286 lcd_clear_display();
287 lcd_putsf(0, 0, "LCD type: %d", lcd_type);
288 lcd_update();
289 yield();
290 }
291
292 return true;
293}
294#endif
diff --git a/firmware/target/arm/imx233/samsung-ypz5/powermgmt-target.h b/firmware/target/arm/imx233/samsung-ypz5/powermgmt-target.h
new file mode 100644
index 0000000000..5d32bc5e9c
--- /dev/null
+++ b/firmware/target/arm/imx233/samsung-ypz5/powermgmt-target.h
@@ -0,0 +1,37 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2013 by Amaury Pouly
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 POWERMGMT_TARGET_H
22#define POWERMGMT_TARGET_H
23
24#include "config.h"
25#include "powermgmt-imx233.h"
26
27#define IMX233_CHARGE_CURRENT 100
28#define IMX233_STOP_CURRENT 10
29#define IMX233_TOPOFF_TIMEOUT (30 * 60 * HZ)
30#define IMX233_CHARGING_TIMEOUT (4 * 3600 * HZ)
31#define IMX233_DIE_TEMP_HIGH 71
32#define IMX233_DIE_TEMP_LOW 56
33#define IMX233_BATT_TEMP_SENSOR 0
34#define IMX233_BATT_TEMP_HIGH 1100
35#define IMX233_BATT_TEMP_LOW 220
36
37#endif /* POWERMGMT_TARGET_H */
diff --git a/firmware/target/arm/imx233/samsung-ypz5/powermgmt-ypz5.c b/firmware/target/arm/imx233/samsung-ypz5/powermgmt-ypz5.c
new file mode 100644
index 0000000000..9d9ed7de99
--- /dev/null
+++ b/firmware/target/arm/imx233/samsung-ypz5/powermgmt-ypz5.c
@@ -0,0 +1,48 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2013 by Amaury Pouly
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 "config.h"
22#include "powermgmt-target.h"
23#include "power-imx233.h"
24
25
26const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
27{
28 3400
29};
30
31const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
32{
33 3300
34};
35
36/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
37const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
38{
39 /* Sansa Fuze+ Li Ion 600mAH figured from discharge curve */
40 { 3100, 3650, 3720, 3750, 3780, 3820, 3880, 4000, 4040, 4125, 4230 },
41};
42
43/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
44const unsigned short percent_to_volt_charge[11] =
45{
46 /* Sansa Fuze+ Li Ion 600mAH figured from charge curve */
47 3480, 3790, 3845, 3880, 3900, 3935, 4005, 4070, 4150, 4250, 4335
48};
diff --git a/firmware/target/arm/imx233/touchscreen-imx233.c b/firmware/target/arm/imx233/touchscreen-imx233.c
index c4d2f4d726..53d9d0e320 100644
--- a/firmware/target/arm/imx233/touchscreen-imx233.c
+++ b/firmware/target/arm/imx233/touchscreen-imx233.c
@@ -20,6 +20,9 @@
20 ****************************************************************************/ 20 ****************************************************************************/
21#include "touchscreen-imx233.h" 21#include "touchscreen-imx233.h"
22#include "stdlib.h" 22#include "stdlib.h"
23#ifdef SAMSUNG_YPZ5
24#include "pinctrl-imx233.h"
25#endif
23 26
24/* Description: 27/* Description:
25 * the driver basically has 2 modes: 28 * the driver basically has 2 modes:
@@ -72,6 +75,24 @@ static void touch_channel_irq(int chan)
72 process(); 75 process();
73} 76}
74 77
78#ifdef SAMSUNG_YPZ5
79/* On this target we need to manually setup pulldown pins,
80 * using specific GPIO lines
81 */
82static void pulldown_setup(bool xminus_enable, bool yminus_enable,
83 bool xplus_enable, bool yplus_enable)
84{
85 /* TX+ */
86 imx233_pinctrl_set_gpio(0, 25, xplus_enable);
87 /* TX- */
88 imx233_pinctrl_set_gpio(3, 15, xminus_enable);
89 /* TY+ */
90 imx233_pinctrl_set_gpio(0, 26, yplus_enable);
91 /* TY- */
92 imx233_pinctrl_set_gpio(1, 21, yminus_enable);
93}
94#endif
95
75static void kick_measure(bool pull_x, bool pull_y, bool detect, int src) 96static void kick_measure(bool pull_x, bool pull_y, bool detect, int src)
76{ 97{
77 if(touch_chan >= 0) 98 if(touch_chan >= 0)
@@ -84,6 +105,9 @@ static void kick_measure(bool pull_x, bool pull_y, bool detect, int src)
84 imx233_icoll_enable_interrupt(INT_SRC_LRADC_CHx(touch_chan), true); 105 imx233_icoll_enable_interrupt(INT_SRC_LRADC_CHx(touch_chan), true);
85 imx233_lradc_enable_channel_irq(touch_chan, true); 106 imx233_lradc_enable_channel_irq(touch_chan, true);
86 /* setup measurement: x- pull down and x+ pull up */ 107 /* setup measurement: x- pull down and x+ pull up */
108#ifdef SAMSUNG_YPZ5
109 pulldown_setup(pull_x, pull_y, pull_x, pull_y);
110#endif
87 imx233_lradc_setup_touch(pull_x, pull_y, pull_x, pull_y, detect); 111 imx233_lradc_setup_touch(pull_x, pull_y, pull_x, pull_y, detect);
88 imx233_lradc_enable_touch_detect_irq(false); 112 imx233_lradc_enable_touch_detect_irq(false);
89 imx233_lradc_enable_channel_irq(touch_chan, true); 113 imx233_lradc_enable_channel_irq(touch_chan, true);
@@ -102,6 +126,9 @@ static void enter_state(enum touch_state_t state)
102 switch(state) 126 switch(state)
103 { 127 {
104 case TOUCH_STATE_WAIT: 128 case TOUCH_STATE_WAIT:
129#ifdef SAMSUNG_YPZ5
130 pulldown_setup(false, false, false, false);
131#endif
105 imx233_lradc_setup_touch(false, false, false, false, true); 132 imx233_lradc_setup_touch(false, false, false, false, true);
106 imx233_lradc_enable_touch_detect_irq(true); 133 imx233_lradc_enable_touch_detect_irq(true);
107 break; 134 break;
diff --git a/tools/configure b/tools/configure
index 71bd8d6029..b33c798a3a 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1325,6 +1325,7 @@ cat <<EOF
1325 141) YH-920 170) HD200 ==Lyre project== 1325 141) YH-920 170) HD200 ==Lyre project==
1326 142) YH-925 171) HD300 130) Lyre proto 1 1326 142) YH-925 171) HD300 130) Lyre proto 1
1327 143) YP-S3 131) Mini2440 1327 143) YP-S3 131) Mini2440
1328 144) YP-Z5
1328 ==ROCKCHIP== 1329 ==ROCKCHIP==
1329 ==Application== 180) rk27xx generic ==HiFiMAN== 1330 ==Application== 180) rk27xx generic ==HiFiMAN==
1330 200) SDL 190) HM-60x 1331 200) SDL 190) HM-60x
@@ -3142,6 +3143,26 @@ fi
3142 t_model="yps3" 3143 t_model="yps3"
3143 ;; 3144 ;;
3144 3145
3146 144|samsungypz5)
3147 target_id=90
3148 modelname="samsungypz5"
3149 target="SAMSUNG_YPZ5"
3150 memory=16
3151 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
3152 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
3153 tool="$rootdir/tools/scramble -add=ypz5"
3154 output="rockbox.samsung"
3155 bootoutput="bootloader-ypz5.samsung"
3156 appextra="gui:recorder:radio"
3157 plugins=""
3158 swcodec="yes"
3159 toolset=$scramblebitmaptools
3160 t_cpu="arm"
3161 t_manufacturer="imx233"
3162 t_model="samsung-ypz5"
3163 arm926ejscc
3164 ;;
3165
3145 160|vibe500) 3166 160|vibe500)
3146 target_id=67 3167 target_id=67
3147 modelname="vibe500" 3168 modelname="vibe500"
diff --git a/tools/scramble.c b/tools/scramble.c
index ef7c41befb..ba335d2f2d 100644
--- a/tools/scramble.c
+++ b/tools/scramble.c
@@ -129,7 +129,7 @@ void usage(void)
129 "\t m2v4, fuze, c2v2, clv2, y820, y920, y925, x747,\n" 129 "\t m2v4, fuze, c2v2, clv2, y820, y920, y925, x747,\n"
130 "\t 747p, x777, nn2g, m244, cli+, fuz2, hd20, hd30,\n" 130 "\t 747p, x777, nn2g, m244, cli+, fuz2, hd20, hd30,\n"
131 "\t ip6g, rk27, clzp, zxf2, zxf3, fuz+, e370, e360,\n" 131 "\t ip6g, rk27, clzp, zxf2, zxf3, fuz+, e370, e360,\n"
132 "\t zxfi, zmoz, zen, zenv)\n"); 132 "\t zxfi, zmoz, zen, zenv, ypz5)\n");
133 printf("\nNo option results in Archos standard player/recorder format.\n"); 133 printf("\nNo option results in Archos standard player/recorder format.\n");
134 134
135 exit(1); 135 exit(1);
@@ -366,6 +366,8 @@ int main (int argc, char** argv)
366 modelnum = 82; 366 modelnum = 82;
367 else if (!strcmp(&argv[1][5], "zxf3")) /* Creative Zen X-Fi3 */ 367 else if (!strcmp(&argv[1][5], "zxf3")) /* Creative Zen X-Fi3 */
368 modelnum = 83; 368 modelnum = 83;
369 else if (!strcmp(&argv[1][5], "ypz5")) /* Samsung YP-Z5 */
370 modelnum = 84;
369 else if (!strcmp(&argv[1][5], "zenv")) /* Creative Zen V */ 371 else if (!strcmp(&argv[1][5], "zenv")) /* Creative Zen V */
370 modelnum = 85; 372 modelnum = 85;
371 else if (!strcmp(&argv[1][5], "zxfi")) /* Creative ZEN X-Fi */ 373 else if (!strcmp(&argv[1][5], "zxfi")) /* Creative ZEN X-Fi */