A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

3 new ports: Samsung YH-820, YH-920, and YH-925. Mostly functional. Audio working on 820 & 925 (untested on the 920). No battery readings. No recording. No plugins. Keymap needs work.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21083 a1c6a512-1295-4272-9138-f99709370657

+5028 -26
+2
apps/SOURCES
··· 230 230 keymaps/keymap-ondavx747.c 231 231 #elif CONFIG_KEYPAD == ONDAVX767_PAD 232 232 keymaps/keymap-ondavx767.c 233 + #elif CONFIG_KEYPAD == SAMSUNG_YH_PAD 234 + keymaps/keymap-yh8xx_yh9xx.c 233 235 #endif
+3
apps/debug_menu.c
··· 1032 1032 (CONFIG_KEYPAD == PHILIPS_HDD1630_PAD) 1033 1033 # define DEBUG_CANCEL BUTTON_POWER 1034 1034 1035 + #elif (CONFIG_KEYPAD == SAMSUNG_YH_PAD) 1036 + # define DEBUG_CANCEL BUTTON_PLAY 1037 + 1035 1038 #endif /* key definitions */ 1036 1039 1037 1040 /* Test code!!! */
+356
apps/keymaps/keymap-yh8xx_yh9xx.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id: keymap-h1x0_h3x0.c 17847 2008-06-28 18:10:04Z bagder $ 9 + * 10 + * Copyright (C) 2006 Jonathan Gordon 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 iriver h100/h300 target */ 23 + #include <stdio.h> 24 + #include <string.h> 25 + #include <stdlib.h> 26 + 27 + #include "config.h" 28 + #include "action.h" 29 + #include "button.h" 30 + #include "settings.h" 31 + 32 + /* 33 + * The format of the list is as follows 34 + * { Action Code, Button code, Prereq button code } 35 + * if there's no need to check the previous button's value, use BUTTON_NONE 36 + * Insert LAST_ITEM_IN_LIST at the end of each mapping 37 + */ 38 + 39 + /* CONTEXT_CUSTOM's used in this file... 40 + 41 + CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions) 42 + CONTEXT_CUSTOM|CONTEXT_SETTINGS = the direction keys for the eq/col picker screens 43 + i.e where up/down is inc/dec 44 + CONTEXT_SETTINGS = up/down is prev/next, l/r is inc/dec 45 + 46 + */ 47 + 48 + 49 + static const struct button_mapping button_context_standard[] = { 50 + { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE }, 51 + { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE }, 52 + 53 + { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE }, 54 + { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, 55 + { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE }, 56 + { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, 57 + 58 + { ACTION_STD_MENU, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT }, 59 + { ACTION_STD_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT }, 60 + { ACTION_STD_QUICKSCREEN, BUTTON_PLAY|BUTTON_LEFT, BUTTON_PLAY }, 61 + 62 + { ACTION_STD_REC, BUTTON_REC|BUTTON_REPEAT, BUTTON_NONE }, 63 + 64 + LAST_ITEM_IN_LIST 65 + }; /* button_context_standard */ 66 + 67 + static const struct button_mapping button_context_wps[] = { 68 + { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, 69 + { ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, 70 + 71 + { ACTION_WPS_SKIPNEXT, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD }, 72 + { ACTION_WPS_SEEKFWD, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE }, 73 + { ACTION_WPS_STOPSEEK, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD|BUTTON_REPEAT }, 74 + 75 + { ACTION_WPS_SKIPPREV, BUTTON_REW|BUTTON_REL, BUTTON_REW }, 76 + { ACTION_WPS_SEEKBACK, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE }, 77 + { ACTION_WPS_STOPSEEK, BUTTON_REW|BUTTON_REL, BUTTON_REW|BUTTON_REPEAT }, 78 + 79 + { ACTION_WPS_ABSETB_NEXTDIR,BUTTON_PLAY|BUTTON_RIGHT, BUTTON_PLAY }, 80 + { ACTION_WPS_ABSETA_PREVDIR,BUTTON_PLAY|BUTTON_LEFT, BUTTON_PLAY }, 81 + { ACTION_WPS_ABRESET, BUTTON_PLAY|BUTTON_UP, BUTTON_PLAY }, 82 + 83 + { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, 84 + { ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE }, 85 + { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, 86 + { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE }, 87 + 88 + { ACTION_WPS_BROWSE, BUTTON_LEFT, BUTTON_NONE }, 89 + { ACTION_WPS_ID3SCREEN, BUTTON_RIGHT, BUTTON_NONE }, 90 + { ACTION_WPS_PITCHSCREEN, BUTTON_PLAY|BUTTON_RIGHT, BUTTON_PLAY }, 91 + 92 + /* these match context_standard */ 93 + { ACTION_WPS_MENU, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT }, 94 + { ACTION_WPS_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT }, 95 + { ACTION_WPS_QUICKSCREEN, BUTTON_PLAY|BUTTON_LEFT, BUTTON_PLAY }, 96 + 97 + { ACTION_WPS_REC, BUTTON_REC|BUTTON_REPEAT, BUTTON_NONE }, 98 + 99 + LAST_ITEM_IN_LIST 100 + }; /* button_context_wps */ 101 + 102 + static const struct button_mapping button_context_list[] = { 103 + #ifdef SAMSUNG_YH820 104 + { ACTION_LISTTREE_PGUP, BUTTON_REC|BUTTON_UP, BUTTON_REC }, 105 + { ACTION_LISTTREE_PGDOWN, BUTTON_REC|BUTTON_DOWN, BUTTON_REC }, 106 + #else 107 + { ACTION_LISTTREE_PGUP, BUTTON_FFWD, BUTTON_NONE }, 108 + { ACTION_LISTTREE_PGDOWN, BUTTON_REW, BUTTON_NONE }, 109 + #endif 110 + 111 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) 112 + }; /* button_context_list */ 113 + 114 + static const struct button_mapping button_context_tree[] = { 115 + { ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, 116 + { ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, 117 + 118 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST) 119 + }; /* button_context_tree */ 120 + 121 + static const struct button_mapping button_context_listtree_scroll_with_combo[] = { 122 + { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, 123 + 124 + { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT, BUTTON_REC }, 125 + { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT,BUTTON_NONE }, 126 + 127 + { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT, BUTTON_REC }, 128 + { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE }, 129 + 130 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE) 131 + }; 132 + 133 + static const struct button_mapping button_context_listtree_scroll_without_combo[] = { 134 + { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE }, 135 + { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, 136 + { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT }, 137 + 138 + { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, 139 + { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT }, 140 + 141 + { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE }, 142 + { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, 143 + 144 + { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, 145 + { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT }, 146 + 147 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE) 148 + }; 149 + 150 + static const struct button_mapping button_context_settings[] = { 151 + { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE }, 152 + { ACTION_SETTINGS_INCREPEAT,BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, 153 + 154 + { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE }, 155 + { ACTION_SETTINGS_DECREPEAT,BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, 156 + 157 + { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE }, 158 + { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, 159 + 160 + { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE }, 161 + { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, 162 + 163 + { ACTION_SETTINGS_RESET, BUTTON_PLAY, BUTTON_NONE }, 164 + 165 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) 166 + }; /* button_context_settings */ 167 + 168 + static const struct button_mapping button_context_settings_right_is_inc[] = { 169 + { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE }, 170 + { ACTION_SETTINGS_INCREPEAT,BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, 171 + 172 + { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE }, 173 + { ACTION_SETTINGS_DECREPEAT,BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, 174 + 175 + { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE }, 176 + { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, 177 + 178 + { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE }, 179 + { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, 180 + 181 + { ACTION_SETTINGS_RESET, BUTTON_PLAY, BUTTON_NONE }, 182 + 183 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) 184 + }; /* button_context_settingsgraphical */ 185 + 186 + static const struct button_mapping button_context_yesno[] = { 187 + { ACTION_YESNO_ACCEPT, BUTTON_RIGHT|BUTTON_REL, BUTTON_PLAY }, 188 + 189 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) 190 + }; /* button_context_settings_yesno */ 191 + 192 + static const struct button_mapping button_context_colorchooser[] = { 193 + { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, 194 + 195 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS) 196 + }; /* button_context_settings_colorchooser */ 197 + 198 + static const struct button_mapping button_context_eq[] = { 199 + { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, 200 + 201 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS) 202 + }; /* button_context_settings_context_eq */ 203 + 204 + static const struct button_mapping button_context_bmark[] = { 205 + { ACTION_BMS_DELETE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, 206 + 207 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST) 208 + }; /* button_context_settings_bmark */ 209 + 210 + static const struct button_mapping button_context_time[] = { 211 + { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, 212 + { ACTION_STD_CANCEL, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, 213 + 214 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS) 215 + }; /* button_context_settings_bmark */ 216 + 217 + static const struct button_mapping button_context_quickscreen[] = { 218 + { ACTION_QS_DOWNINV, BUTTON_UP, BUTTON_NONE }, 219 + { ACTION_QS_DOWNINV, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, 220 + 221 + { ACTION_QS_DOWN, BUTTON_DOWN, BUTTON_NONE }, 222 + { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, 223 + 224 + { ACTION_QS_LEFT, BUTTON_LEFT, BUTTON_NONE }, 225 + { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, 226 + 227 + { ACTION_QS_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, 228 + { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, 229 + 230 + { ACTION_STD_CANCEL, BUTTON_PLAY, BUTTON_NONE }, 231 + 232 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) 233 + }; /* button_context_quickscreen */ 234 + 235 + static const struct button_mapping button_context_pitchscreen[] = { 236 + { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE }, 237 + { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, 238 + 239 + { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE }, 240 + { ACTION_PS_DEC_BIG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, 241 + 242 + { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE }, 243 + { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE }, 244 + 245 + { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, 246 + { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE }, 247 + 248 + { ACTION_PS_TOGGLE_MODE, BUTTON_FFWD, BUTTON_NONE }, 249 + { ACTION_PS_RESET, BUTTON_REW, BUTTON_NONE }, 250 + { ACTION_PS_EXIT, BUTTON_PLAY, BUTTON_NONE }, 251 + 252 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) 253 + }; /* button_context_pitchcreen */ 254 + 255 + static const struct button_mapping button_context_recscreen[] = { 256 + { ACTION_REC_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_NONE }, 257 + #ifdef SAMSUNG_YH820 258 + /* the yh-820 has a rec button */ 259 + { ACTION_REC_NEWFILE, BUTTON_REC, BUTTON_NONE }, 260 + #else 261 + /* the yh-920 & yh-925 have a rec switch */ 262 + { ACTION_REC_NEWFILE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE }, 263 + #endif 264 + 265 + { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE }, 266 + { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, 267 + 268 + { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE }, 269 + { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, 270 + 271 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) 272 + }; /* button_context_recscreen */ 273 + 274 + static const struct button_mapping button_context_keyboard[] = { 275 + { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE }, 276 + { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, 277 + 278 + { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE }, 279 + { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, 280 + 281 + { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE }, 282 + { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, 283 + 284 + { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, 285 + { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, 286 + 287 + { ACTION_KBD_CURSOR_LEFT, BUTTON_REW, BUTTON_NONE }, 288 + { ACTION_KBD_CURSOR_LEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE }, 289 + 290 + { ACTION_KBD_CURSOR_RIGHT, BUTTON_FFWD, BUTTON_NONE }, 291 + { ACTION_KBD_CURSOR_RIGHT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE }, 292 + 293 + { ACTION_KBD_BACKSPACE, BUTTON_LEFT|BUTTON_REW, BUTTON_NONE }, 294 + { ACTION_KBD_BACKSPACE, BUTTON_LEFT|BUTTON_REW|BUTTON_REPEAT,BUTTON_NONE }, 295 + 296 + { ACTION_KBD_SELECT, BUTTON_PLAY, BUTTON_NONE }, 297 + { ACTION_KBD_PAGE_FLIP, BUTTON_PLAY|BUTTON_RIGHT, BUTTON_NONE }, 298 + 299 + { ACTION_KBD_DONE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, 300 + { ACTION_KBD_ABORT, BUTTON_PLAY|BUTTON_LEFT, BUTTON_PLAY }, 301 + 302 + { ACTION_KBD_MORSE_INPUT, BUTTON_PLAY|BUTTON_FFWD, BUTTON_NONE }, 303 + { ACTION_KBD_MORSE_SELECT, BUTTON_PLAY|BUTTON_REL, BUTTON_NONE }, 304 + 305 + LAST_ITEM_IN_LIST 306 + }; /* button_context_keyboard */ 307 + 308 + const struct button_mapping* get_context_mapping(int context) 309 + { 310 + switch (context) 311 + { 312 + case CONTEXT_STD: 313 + return button_context_standard; 314 + case CONTEXT_WPS: 315 + return button_context_wps; 316 + 317 + case CONTEXT_LIST: 318 + return button_context_list; 319 + case CONTEXT_TREE: 320 + case CONTEXT_MAINMENU: 321 + if (global_settings.hold_lr_for_scroll_in_list) 322 + return button_context_listtree_scroll_without_combo; 323 + else 324 + return button_context_listtree_scroll_with_combo; 325 + case CONTEXT_CUSTOM|CONTEXT_TREE: 326 + return button_context_tree; 327 + 328 + case CONTEXT_SETTINGS: 329 + return button_context_settings; 330 + case CONTEXT_CUSTOM|CONTEXT_SETTINGS: 331 + case CONTEXT_SETTINGS_RECTRIGGER: 332 + return button_context_settings_right_is_inc; 333 + 334 + case CONTEXT_SETTINGS_COLOURCHOOSER: 335 + return button_context_colorchooser; 336 + case CONTEXT_SETTINGS_EQ: 337 + return button_context_eq; 338 + 339 + case CONTEXT_SETTINGS_TIME: 340 + return button_context_time; 341 + 342 + case CONTEXT_YESNOSCREEN: 343 + return button_context_yesno; 344 + case CONTEXT_BOOKMARKSCREEN: 345 + return button_context_bmark; 346 + case CONTEXT_QUICKSCREEN: 347 + return button_context_quickscreen; 348 + case CONTEXT_PITCHSCREEN: 349 + return button_context_pitchscreen; 350 + case CONTEXT_RECSCREEN: 351 + return button_context_recscreen; 352 + case CONTEXT_KEYBOARD: 353 + return button_context_keyboard; 354 + } 355 + return button_context_standard; 356 + }
+2 -1
bootloader/SOURCES
··· 10 10 #elif defined(IRIVER_H10) || defined(IRIVER_H10_5GB) || \ 11 11 defined(SANSA_E200) || defined(SANSA_C200) || \ 12 12 defined(MROBE_100) || defined(PHILIPS_SA9200) || \ 13 - defined(PHILIPS_HDD1630) 13 + defined(PHILIPS_HDD1630) || defined(SAMSUNG_YH820) || \ 14 + defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925) 14 15 #ifdef E200R_INSTALLER 15 16 main-e200r-installer.c 16 17 #elif defined(C240_ERASE)
+3
bootloader/main-pp.c
··· 70 70 #elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD 71 71 #define BOOTLOADER_BOOT_OF BUTTON_MENU 72 72 73 + #elif CONFIG_KEYPAD == SAMSUNG_YH_PAD 74 + #define BOOTLOADER_BOOT_OF BUTTON_LEFT 75 + 73 76 #endif 74 77 75 78 /* Maximum allowed firmware image size. 10MB is more than enough */
+52
firmware/SOURCES
··· 250 250 drivers/audio/tlv320.c 251 251 #elif defined(HAVE_MAS35XX) 252 252 drivers/audio/mas35xx.c 253 + #elif defined(HAVE_AK4537) 254 + drivers/audio/ak4537.c 253 255 #endif /* defined(HAVE_*) */ 254 256 #endif /* !defined(SIMULATOR) && !defined(BOOTLOADER) */ 255 257 ··· 1282 1284 target/arm/at91sam/lyre_proto1/timer-lyre_proto1.c 1283 1285 #endif 1284 1286 #endif /* SIMULATOR */ 1287 + 1288 + #ifdef SAMSUNG_YH820 1289 + #ifndef SIMULATOR 1290 + target/arm/ata-as-arm.S 1291 + target/arm/ata-pp5020.c 1292 + target/arm/adc-pp5020.c 1293 + target/arm/i2s-pp.c 1294 + target/arm/usb-fw-pp502x.c 1295 + target/arm/samsung/akcodec-yh82x_yh92x.c 1296 + target/arm/samsung/button-yh82x_yh92x.c 1297 + target/arm/samsung/power-yh82x_yh92x.c 1298 + target/arm/samsung/yh820/backlight-yh820.c 1299 + target/arm/samsung/yh820/lcd-yh820.c 1300 + target/arm/samsung/yh820/lcd-as-yh820.S 1301 + target/arm/samsung/yh820/powermgmt-yh820.c 1302 + #endif /* SIMULATOR */ 1303 + #endif /* SAMSUNG_YH820 */ 1304 + 1305 + #ifdef SAMSUNG_YH920 1306 + #ifndef SIMULATOR 1307 + target/arm/ata-as-arm.S 1308 + target/arm/ata-pp5020.c 1309 + target/arm/adc-pp5020.c 1310 + target/arm/i2s-pp.c 1311 + target/arm/usb-fw-pp502x.c 1312 + target/arm/samsung/akcodec-yh82x_yh92x.c 1313 + target/arm/samsung/button-yh82x_yh92x.c 1314 + target/arm/samsung/power-yh82x_yh92x.c 1315 + target/arm/samsung/yh920/backlight-yh920.c 1316 + target/arm/samsung/yh920/lcd-yh920.c 1317 + target/arm/samsung/yh920/powermgmt-yh920.c 1318 + #endif /* SIMULATOR */ 1319 + #endif /* SAMSUNG_YH920 */ 1320 + 1321 + #ifdef SAMSUNG_YH925 1322 + #ifndef SIMULATOR 1323 + target/arm/ata-as-arm.S 1324 + target/arm/ata-pp5020.c 1325 + target/arm/adc-pp5020.c 1326 + target/arm/i2s-pp.c 1327 + target/arm/usb-fw-pp502x.c 1328 + target/arm/samsung/akcodec-yh82x_yh92x.c 1329 + target/arm/samsung/button-yh82x_yh92x.c 1330 + target/arm/samsung/power-yh82x_yh92x.c 1331 + target/arm/samsung/yh925/backlight-yh925.c 1332 + target/arm/samsung/yh925/lcd-yh925.c 1333 + target/arm/samsung/yh925/lcd-as-yh925.S 1334 + target/arm/samsung/yh925/powermgmt-yh925.c 1335 + #endif /* SIMULATOR */ 1336 + #endif /* SAMSUNG_YH925 */
+280
firmware/drivers/audio/ak4537.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (c) 2009 Mark Arigo 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 "system.h" 23 + #include "string.h" 24 + 25 + // #define LOGF_ENABLE 26 + #include "logf.h" 27 + 28 + #include "pcm_sampr.h" 29 + #include "audio.h" 30 + #include "akcodec.h" 31 + #include "audiohw.h" 32 + #include "sound.h" 33 + 34 + const struct sound_settings_info audiohw_settings[] = { 35 + [SOUND_VOLUME] = {"dB", 0, 1,-127, 0, -25}, 36 + /* HAVE_SW_TONE_CONTROLS */ 37 + [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0}, 38 + [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0}, 39 + [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, 40 + [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, 41 + [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100}, 42 + #if defined(HAVE_RECORDING) 43 + [SOUND_LEFT_GAIN] = {"dB", 1, 1, 0, 31, 23}, 44 + [SOUND_RIGHT_GAIN] = {"dB", 1, 1, 0, 31, 23}, 45 + [SOUND_MIC_GAIN] = {"dB", 1, 1, 0, 1, 0}, 46 + #endif 47 + }; 48 + 49 + static unsigned char akc_regs[AKC_NUM_REGS]; 50 + 51 + static void akc_write(int reg, unsigned val) 52 + { 53 + if ((unsigned)reg >= AKC_NUM_REGS) 54 + return; 55 + 56 + akc_regs[reg] = (unsigned char)val; 57 + akcodec_write(reg, val); 58 + } 59 + 60 + static void akc_set(int reg, unsigned bits) 61 + { 62 + akc_write(reg, akc_regs[reg] | bits); 63 + } 64 + 65 + static void akc_clear(int reg, unsigned bits) 66 + { 67 + akc_write(reg, akc_regs[reg] & ~bits); 68 + } 69 + 70 + static void akc_write_masked(int reg, unsigned bits, unsigned mask) 71 + { 72 + akc_write(reg, (akc_regs[reg] & ~mask) | (bits & mask)); 73 + } 74 + 75 + #if 0 76 + static void codec_set_active(int active) 77 + { 78 + (void)active; 79 + } 80 + #endif 81 + 82 + /* convert tenth of dB volume (-1270..0) to master volume register value */ 83 + int tenthdb2master(int db) 84 + { 85 + if (db < VOLUME_MIN) 86 + return 0xff; /* mute */ 87 + else if (db >= VOLUME_MAX) 88 + return 0x00; 89 + else 90 + return ((-db)/5); 91 + } 92 + 93 + int sound_val2phys(int setting, int value) 94 + { 95 + int result; 96 + 97 + switch(setting) 98 + { 99 + #ifdef HAVE_RECORDING 100 + case SOUND_LEFT_GAIN: 101 + case SOUND_RIGHT_GAIN: 102 + result = (value - 23) * 15; /* fix */ 103 + break; 104 + case SOUND_MIC_GAIN: 105 + result = value * 200; /* fix */ 106 + break; 107 + #endif 108 + default: 109 + result = value; 110 + break; 111 + } 112 + 113 + return result; 114 + } 115 + 116 + void audiohw_mute(bool mute) 117 + { 118 + if (mute) 119 + { 120 + akc_set(AK4537_DAC, SMUTE); 121 + udelay(200000); 122 + } 123 + else 124 + { 125 + udelay(200000); 126 + akc_clear(AK4537_DAC, SMUTE); 127 + } 128 + } 129 + 130 + void audiohw_preinit(void) 131 + { 132 + int i; 133 + for (i = 0; i < AKC_NUM_REGS; i++) 134 + akc_regs[i] = akcodec_read(i); 135 + 136 + /* POWER UP SEQUENCE (from the datasheet) */ 137 + /* Note: the delay length is what the OF uses, although the datasheet 138 + suggests they can be shorter */ 139 + 140 + /* power up VCOM */ 141 + akc_set(AK4537_PM1, PMVCM); 142 + udelay(100000); 143 + 144 + /* setup AK4537_SIGSEL1 */ 145 + akc_set(AK4537_SIGSEL1, ALCS | MOUT2); 146 + udelay(100000); 147 + 148 + /* setup AK4537_SIGSEL2 */ 149 + akc_write_masked(AK4537_SIGSEL2, DAHS, (DAHS | HPL | HPR)); 150 + udelay(100000); 151 + 152 + /* setup AK4537_MODE1 */ 153 + akc_write_masked(AK4537_MODE1, DIF_I2S | BICK_32FS | MCKI_PLL_12000KHZ, 154 + (DIF_MASK | BICK_MASK | MCKI_MASK)); 155 + udelay(100000); 156 + 157 + /* CLOCK SETUP - X'tal used in PLL mode (master mode) */ 158 + 159 + /* release the pull-down of the XTI pin and power-up the X'tal osc */ 160 + akc_write_masked(AK4537_PM2, PMXTL, (MCLKPD | PMXTL)); 161 + udelay(100000); 162 + 163 + /* power-up the PLL */ 164 + akc_set(AK4537_PM2, PMPLL); 165 + udelay(100000); 166 + 167 + /* enable MCKO output and setup MCKO output freq */ 168 + akc_set(AK4537_MODE1, MCKO_EN); 169 + udelay(100000); 170 + 171 + /* ENABLE HEADPHONE AMP OUTPUT */ 172 + 173 + /* setup the sampling freq if PLL mode is used */ 174 + akc_write_masked(AK4537_MODE2, AKC_PLL_44100HZ, FS_MASK); 175 + 176 + /* setup the low freq boost level */ 177 + akc_write_masked(AK4537_DAC, BST_OFF, BST_MASK); 178 + 179 + /* setup the digital volume */ 180 + akc_write(AK4537_ATTL, 0x10); 181 + akc_write(AK4537_ATTR, 0x10); 182 + 183 + /* power up the DAC */ 184 + akc_set(AK4537_PM2, PMDAC); 185 + udelay(100000); 186 + 187 + /* power up the headphone amp */ 188 + akc_clear(AK4537_SIGSEL2, HPL | HPR); 189 + udelay(100000); 190 + 191 + /* power up the common voltage of headphone amp */ 192 + akc_set(AK4537_PM2, PMHPL | PMHPR); 193 + udelay(100000); 194 + } 195 + 196 + void audiohw_postinit(void) 197 + { 198 + /* nothing */ 199 + } 200 + 201 + void audiohw_close(void) 202 + { 203 + /* POWER DOWN SEQUENCE (from the datasheet) */ 204 + 205 + /* mute */ 206 + akc_write(AK4537_ATTL, 0xff); 207 + akc_write(AK4537_ATTR, 0xff); 208 + akc_set(AK4537_DAC, SMUTE); 209 + udelay(100000); 210 + 211 + /* power down the common voltage of headphone amp */ 212 + akc_clear(AK4537_PM2, PMHPL | PMHPR); 213 + 214 + /* power down the DAC */ 215 + akc_clear(AK4537_PM2, PMDAC); 216 + 217 + /* power down the headphone amp */ 218 + akc_set(AK4537_SIGSEL2, HPL | HPR); 219 + 220 + /* disable MCKO */ 221 + akc_clear(AK4537_MODE1, MCKO_EN); 222 + 223 + /* power down X'tal and PLL, pull down the XTI pin */ 224 + akc_write_masked(AK4537_PM2, MCLKPD, (MCLKPD | PMXTL | PMPLL)); 225 + 226 + /* power down VCOM */ 227 + akc_clear(AK4537_PM1, PMVCM); 228 + udelay(100000); 229 + 230 + akcodec_close(); /* target-specific */ 231 + } 232 + 233 + void audiohw_set_master_vol(int vol_l, int vol_r) 234 + { 235 + akc_write(AK4537_ATTL, vol_l & 0xff); 236 + akc_write(AK4537_ATTR, vol_r & 0xff); 237 + } 238 + 239 + void audiohw_set_frequency(int fsel) 240 + { 241 + static const unsigned char srctrl_table[HW_NUM_FREQ] = 242 + { 243 + HW_HAVE_8_([HW_FREQ_8] = AKC_PLL_8000HZ, ) 244 + HW_HAVE_11_([HW_FREQ_11] = AKC_PLL_11025HZ,) 245 + HW_HAVE_16_([HW_FREQ_16] = AKC_PLL_16000HZ,) 246 + HW_HAVE_22_([HW_FREQ_22] = AKC_PLL_22050HZ,) 247 + HW_HAVE_24_([HW_FREQ_24] = AKC_PLL_24000HZ,) 248 + HW_HAVE_32_([HW_FREQ_32] = AKC_PLL_32000HZ,) 249 + HW_HAVE_44_([HW_FREQ_44] = AKC_PLL_44100HZ,) 250 + HW_HAVE_48_([HW_FREQ_48] = AKC_PLL_48000HZ,) 251 + }; 252 + 253 + if ((unsigned)fsel >= HW_NUM_FREQ) 254 + fsel = HW_FREQ_DEFAULT; 255 + 256 + akc_write_masked(AK4537_MODE2, srctrl_table[fsel], FS_MASK); 257 + } 258 + 259 + #if defined(HAVE_RECORDING) 260 + void audiohw_enable_recording(bool source_mic) 261 + { 262 + (void)source_mic; 263 + } 264 + 265 + void audiohw_disable_recording(void) 266 + { 267 + } 268 + 269 + void audiohw_set_recvol(int left, int right, int type) 270 + { 271 + (void)left; 272 + (void)right; 273 + (void)type; 274 + } 275 + 276 + void audiohw_set_monitor(bool enable) 277 + { 278 + (void)enable; 279 + } 280 + #endif /* HAVE_RECORDING */
+193
firmware/export/ak4537.h
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2009 by Mark Arigo 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 _AK4537_H 23 + #define _AK4537_H 24 + 25 + /* Volume goes from -127.0 ... 0 dB in 0.5 dB increments */ 26 + #define VOLUME_MIN -1270 27 + #define VOLUME_MAX 0 28 + 29 + extern int tenthdb2master(int db); 30 + 31 + extern void audiohw_set_master_vol(int vol_l, int vol_r); 32 + 33 + #define AKC_NUM_REGS 0x11 34 + 35 + /* Common register bits */ 36 + 37 + /* Power Management 1 */ 38 + #define AK4537_PM1 0x00 39 + #define PMADL (1 << 0) 40 + #define PMMICL (1 << 1) 41 + #define PMIPGL (1 << 2) 42 + #define PMMO (1 << 3) 43 + #define PMLO (1 << 4) 44 + #define PMBPM (1 << 5) 45 + #define PMBPS (1 << 6) 46 + #define PMVCM (1 << 7) 47 + 48 + /* Power Management 2 */ 49 + #define AK4537_PM2 0x01 50 + #define PMDAC (1 << 0) 51 + #define PMHPR (1 << 1) 52 + #define PMHPL (1 << 2) 53 + #define PMSPK (1 << 3) 54 + #define SPKG (1 << 4) 55 + #define PMPLL (1 << 5) 56 + #define PMXTL (1 << 6) 57 + #define MCLKPD (1 << 7) 58 + 59 + /* Signal Select 1 */ 60 + #define AK4537_SIGSEL1 0x02 61 + #define MOUT2 (1 << 0) 62 + #define ALCS (1 << 1) 63 + #define BPMSP (1 << 2) 64 + #define BPSSP (1 << 3) 65 + #define MICM (1 << 4) 66 + #define DAMO (1 << 5) 67 + #define PSMO (1 << 6) 68 + #define MOGN (1 << 7) 69 + 70 + /* Signal Select 2 */ 71 + #define AK4537_SIGSEL2 0x03 72 + #define HPR (1 << 0) 73 + #define HPL (1 << 1) 74 + #define BPMHP (1 << 2) 75 + #define BPSHP (1 << 3) 76 + #define MICL (1 << 4) 77 + #define PSLO (1 << 6) 78 + #define DAHS (1 << 7) 79 + 80 + /* Mode Control 1 */ 81 + #define AK4537_MODE1 0x04 82 + #define DIF_MASK (3 << 0) 83 + #define BICK_MASK (1 << 2) 84 + #define MCKO_EN (1 << 3) 85 + #define MCKO_MASK (3 << 4) 86 + #define MCKI_MASK (3 << 6) 87 + 88 + /* Mode Control 2 */ 89 + #define AK4537_MODE2 0x05 90 + #define SPPS (1 << 0) 91 + #define LOOP (1 << 1) 92 + #define HPM (1 << 2) 93 + #define FS_MASK (7 << 5) 94 + 95 + /* DAC Control */ 96 + #define AK4537_DAC 0x06 97 + #define DEM_MASK (3 << 0) 98 + #define BST_MASK (3 << 2) 99 + #define DATTC (1 << 4) 100 + #define SMUTE (1 << 5) 101 + #define TM_MASK (3 << 6) 102 + 103 + /* MIC Control */ 104 + #define AK4537_MIC 0x07 105 + #define MGAIN (1 << 0) 106 + #define MSEL (1 << 1) 107 + #define MICAD (1 << 2) 108 + #define MPWRI (1 << 3) 109 + #define MPWRE (1 << 4) 110 + #define IPGAC (1 << 5) 111 + 112 + /* Timer Select */ 113 + #define AK4537_TIMER 0x08 114 + #define LTM_MASK (3 << 0) 115 + #define WTM_MASK (3 << 2) 116 + #define ZTM_MASK (3 << 4) 117 + #define ZTM1 (1 << 5) 118 + #define ROTM (1 << 6) 119 + 120 + /* ALC Mode Control 1 */ 121 + #define AK4537_ALC1 0x09 122 + #define LMTH (1 << 0) 123 + #define RATT (1 << 1) 124 + #define LMAT_MASK (3 << 2) 125 + #define ZELM (1 << 4) 126 + #define ALC1 (1 << 5) 127 + #define ALC2 (1 << 6) 128 + 129 + /* ALC Mode Control 2 */ 130 + #define AK4537_ALC2 0x0a 131 + 132 + /* Lch Input PGA Control */ 133 + #define AK4537_IPGAL 0x0b 134 + 135 + /* Lch Digital ATT Control */ 136 + #define AK4537_ATTL 0x0c 137 + 138 + /* Rch Digital ATT Control */ 139 + #define AK4537_ATTR 0x0d 140 + 141 + /* Volume Control */ 142 + #define AK4537_VOLUME 0x0e 143 + #define ATTS_MASK (7 << 4) 144 + #define ATTRM (1 << 7) 145 + 146 + /* Rch Input PGA Control */ 147 + #define AK4537_IPGAR 0x0f 148 + 149 + /* Power Management 3 */ 150 + #define AK4537_PM3 0x10 151 + #define PMADR (1 << 0) 152 + #define PMMICR (1 << 1) 153 + #define PMIPGR (1 << 2) 154 + #define INR (1 << 3) 155 + #define INL (1 << 4) 156 + 157 + /* Sampling frequency (PLL mode) */ 158 + #define AKC_PLL_8000HZ (7 << 5) 159 + #define AKC_PLL_11025HZ (2 << 5) 160 + #define AKC_PLL_16000HZ (6 << 5) 161 + #define AKC_PLL_22050HZ (1 << 5) 162 + #define AKC_PLL_24000HZ (5 << 5) 163 + #define AKC_PLL_32000HZ (4 << 5) 164 + #define AKC_PLL_44100HZ (0 << 5) 165 + #define AKC_PLL_48000HZ (3 << 5) 166 + 167 + /* MCKI input frequency (PLL mode) */ 168 + #define MCKI_PLL_12288KHZ (0 << 6) 169 + #define MCKI_PLL_11289KHZ (1 << 6) 170 + #define MCKI_PLL_12000KHZ (2 << 6) 171 + 172 + /* MCKO frequency (PLL mode, MCKO bit = 1) */ 173 + #define MCKO_PLL_256FS (0 << 4) 174 + #define MCKO_PLL_128FS (1 << 4) 175 + #define MCKO_PLL_64FS (2 << 4) 176 + #define MCKO_PLL_32FS (3 << 4) 177 + 178 + /* BICK frequency */ 179 + #define BICK_64FS (0 << 2) 180 + #define BICK_32FS (1 << 2) 181 + 182 + /* Audio interface format */ 183 + #define DIF_MSB_LSB (0 << 0) 184 + #define DIF_MSB_MSB (1 << 0) 185 + #define DIF_I2S (2 << 0) 186 + 187 + /* Low frequency boost control */ 188 + #define BST_OFF (0 << 2) 189 + #define BST_MIN (1 << 2) 190 + #define BST_MID (2 << 2) 191 + #define BST_MAX (3 << 2) 192 + 193 + #endif /* _AK4537_H */
+29
firmware/export/akcodec.h
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2006 by Marcoen Hirschberg 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 _AKCODEC_H 23 + #define _AKCODEC_H 24 + 25 + int akcodec_read(int reg); 26 + void akcodec_write(int reg, int data); 27 + void akcodec_close(void); 28 + 29 + #endif
+2
firmware/export/audiohw.h
··· 59 59 #include "tsc2100.h" 60 60 #elif defined(HAVE_JZ4740_CODEC) 61 61 #include "jz4740-codec.h" 62 + #elif defined(HAVE_AK4537) 63 + #include "ak4537.h" 62 64 #endif 63 65 64 66 /* convert caps into defines */
+187
firmware/export/config-yh820.h
··· 1 + /* 2 + * This config file is for the Samsung YH-820 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 57 9 + #define MODEL_NAME "Samsung YH-820" 10 + 11 + /* define this if you have recording possibility */ 12 + /* todo #define HAVE_RECORDING */ 13 + 14 + /* Define bitmask of input sources - recordable bitmask can be defined 15 + explicitly if different */ 16 + #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN ) 17 + 18 + /* define the bitmask of hardware sample rates */ 19 + #define HW_SAMPR_CAPS (SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \ 20 + SAMPR_CAP_24 | SAMPR_CAP_22 | SAMPR_CAP_16 | \ 21 + SAMPR_CAP_11 | SAMPR_CAP_8) 22 + 23 + /* define the bitmask of recording sample rates */ 24 + #define REC_SAMPR_CAPS (SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \ 25 + SAMPR_CAP_24 | SAMPR_CAP_22 | SAMPR_CAP_16 | \ 26 + SAMPR_CAP_11 | SAMPR_CAP_8) 27 + 28 + /* Type of LCD */ 29 + #define CONFIG_LCD LCD_S6B33B2 30 + 31 + /* LCD dimensions */ 32 + #define LCD_WIDTH 128 33 + #define LCD_HEIGHT 96 34 + #define LCD_DEPTH 16 /* 65536 colours */ 35 + #define LCD_PIXELFORMAT RGB565 36 + 37 + #ifndef BOOTLOADER 38 + /* Define this if your LCD can be enabled/disabled */ 39 + #define HAVE_LCD_ENABLE 40 + 41 + /* Define this if your LCD can be put to sleep. 42 + HAVE_LCD_ENABLE should be defined as well. */ 43 + /* todo #define HAVE_LCD_SLEEP*/ 44 + /* todo #define HAVE_LCD_SLEEP_SETTING */ 45 + #endif /* !BOOTLOADER */ 46 + 47 + /* Define this for LCD backlight available */ 48 + #define HAVE_BACKLIGHT 49 + 50 + /* Define this if your LCD can set contrast */ 51 + #define HAVE_LCD_CONTRAST 52 + 53 + #define MIN_CONTRAST_SETTING 0 54 + #define MAX_CONTRAST_SETTING 255 55 + #define DEFAULT_CONTRAST_SETTING 137 56 + 57 + /* define this if you can flip your LCD */ 58 + /* #define HAVE_LCD_FLIP */ 59 + 60 + /* define this if you can invert the colours on your LCD */ 61 + /* todo #define HAVE_LCD_INVERT */ 62 + 63 + /* put the lcd frame buffer in IRAM */ 64 + /* #define IRAM_LCDFRAMEBUFFER IDATA_ATTR */ 65 + 66 + /* define this if you have a bitmap LCD display */ 67 + #define HAVE_LCD_BITMAP 68 + 69 + /* define this if you have a colour LCD */ 70 + #define HAVE_LCD_COLOR 71 + 72 + /* define this if you want album art for this target */ 73 + #define HAVE_ALBUMART 74 + 75 + /* define this if you have access to the quickscreen */ 76 + #define HAVE_QUICKSCREEN 77 + 78 + /* define this if you have access to the pitchscreen */ 79 + #define HAVE_PITCHSCREEN 80 + 81 + /* define this if you would like tagcache to build on this target */ 82 + #define HAVE_TAGCACHE 83 + 84 + #define CONFIG_KEYPAD SAMSUNG_YH_PAD 85 + 86 + /* Define this if you do software codec */ 87 + #define CONFIG_CODEC SWCODEC 88 + 89 + /* define this if you have a real-time clock */ 90 + /* todo verify rtc (or none) */ 91 + /* #ifndef BOOTLOADER */ 92 + #if 0 93 + #define CONFIG_RTC RTC_E8564 94 + #define HAVE_RTC_ALARM 95 + #endif 96 + 97 + /* define this if you have a disk storage, i.e. something 98 + that needs spinups and can cause skips when shaked */ 99 + #define HAVE_DISK_STORAGE 100 + 101 + /* define this if you use an ATA controller */ 102 + #define CONFIG_STORAGE STORAGE_ATA 103 + 104 + /* We're able to shut off power to the HDD */ 105 + #ifndef SIMULATOR 106 + /* todo #define HAVE_ATA_POWER_OFF */ 107 + #endif 108 + 109 + /* Define this if you have a software controlled poweroff */ 110 + #define HAVE_SW_POWEROFF 111 + 112 + /* The number of bytes reserved for loadable codecs */ 113 + #define CODEC_SIZE 0x100000 114 + 115 + /* The number of bytes reserved for loadable plugins */ 116 + #define PLUGIN_BUFFER_SIZE 0x80000 117 + 118 + /* Define this if you have the AK4537 audio codec */ 119 + #define HAVE_AK4537 120 + 121 + /* AK4537 has no tone controls, so we use the software ones */ 122 + #define HAVE_SW_TONE_CONTROLS 123 + 124 + #define AB_REPEAT_ENABLE 1 125 + 126 + #define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity */ 127 + #define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */ 128 + #define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ 129 + #define BATTERY_CAPACITY_INC 50 /* capacity increment */ 130 + #define BATTERY_TYPES_COUNT 1 /* only one type */ 131 + 132 + /* Hardware controlled charging */ 133 + #define CONFIG_CHARGING CHARGING_SIMPLE 134 + 135 + /* define this if the unit can be powered or charged via USB */ 136 + #define HAVE_USB_POWER 137 + 138 + #ifndef SIMULATOR 139 + 140 + /* Define this if you have a PortalPlayer PP5020 */ 141 + #define CONFIG_CPU PP5020 142 + 143 + /* Define this if you want to use the PP5020 i2c interface */ 144 + #define CONFIG_I2C I2C_PP5020 145 + 146 + /* define this if the hardware can be powered off while charging */ 147 + #define HAVE_POWEROFF_WHILE_CHARGING 148 + 149 + /* The start address index for ROM builds */ 150 + #define ROM_START 0x00000000 151 + 152 + /* The size of the flash ROM */ 153 + #define FLASH_SIZE 0x100000 154 + 155 + /* Define this to the CPU frequency */ 156 + #define CPU_FREQ 75000000 157 + 158 + /* USB On-the-go */ 159 + #define CONFIG_USBOTG USBOTG_ARC 160 + 161 + /* enable these for the experimental usb stack */ 162 + #define HAVE_USBSTACK 163 + #define USE_ROCKBOX_USB 164 + /* todo - check */ 165 + #define USB_VENDOR_ID 0x04e8 166 + #define USB_PRODUCT_ID 0x5023 167 + 168 + /* Virtual LED (icon) */ 169 + #define CONFIG_LED LED_VIRTUAL 170 + 171 + /* Define this if you have adjustable CPU frequency */ 172 + #define HAVE_ADJUSTABLE_CPU_FREQ 173 + 174 + #define MI4_FORMAT 175 + #define BOOTFILE_EXT "mi4" 176 + #define BOOTFILE "rockbox." BOOTFILE_EXT 177 + #define BOOTDIR "/.rockbox" 178 + 179 + /* Offset ( in the firmware file's header ) to the file CRC */ 180 + #define FIRMWARE_OFFSET_FILE_CRC 0x00 181 + 182 + /* Offset ( in the firmware file's header ) to the real data */ 183 + #define FIRMWARE_OFFSET_FILE_DATA 0x00 184 + 185 + #define ICODE_ATTR_TREMOR_NOT_MDCT 186 + 187 + #endif /* !SIMULATOR */
+193
firmware/export/config-yh920.h
··· 1 + /* 2 + * This config file is for the Samsung YH-920 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 58 9 + #define MODEL_NAME "Samsung YH-920" 10 + 11 + /* define this if you have recording possibility */ 12 + /* todo #define HAVE_RECORDING */ 13 + 14 + /* Define bitmask of input sources - recordable bitmask can be defined 15 + explicitly if different */ 16 + #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN ) 17 + 18 + /* define the bitmask of hardware sample rates */ 19 + #define HW_SAMPR_CAPS (SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \ 20 + SAMPR_CAP_24 | SAMPR_CAP_22 | SAMPR_CAP_16 | \ 21 + SAMPR_CAP_11 | SAMPR_CAP_8) 22 + 23 + /* define the bitmask of recording sample rates */ 24 + #define REC_SAMPR_CAPS (SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \ 25 + SAMPR_CAP_24 | SAMPR_CAP_22 | SAMPR_CAP_16 | \ 26 + SAMPR_CAP_11 | SAMPR_CAP_8) 27 + 28 + /* Type of LCD */ 29 + #define CONFIG_LCD LCD_S1D15E06 30 + 31 + /* LCD dimensions */ 32 + #define LCD_WIDTH 160 33 + #define LCD_HEIGHT 128 34 + #define LCD_DEPTH 2 35 + #define LCD_PIXELFORMAT VERTICAL_PACKING 36 + 37 + /* Display colours, for screenshots and sim (0xRRGGBB) */ 38 + #define LCD_DARKCOLOR 0x000000 39 + #define LCD_BRIGHTCOLOR 0x5a915a 40 + #define LCD_BL_DARKCOLOR 0x000000 41 + #define LCD_BL_BRIGHTCOLOR 0xadd8e6 42 + 43 + /* todo */ 44 + /* #ifndef BOOTLOADER */ 45 + #if 0 46 + /* Define this if your LCD can be enabled/disabled */ 47 + #define HAVE_LCD_ENABLE 48 + 49 + /* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE 50 + * should be defined as well. 51 + * We can currently put the lcd to sleep but it won't wake up properly */ 52 + #define HAVE_LCD_SLEEP 53 + #define HAVE_LCD_SLEEP_SETTING 54 + #endif 55 + 56 + /* Define this for LCD backlight available */ 57 + #define HAVE_BACKLIGHT 58 + 59 + /* Define this if your LCD can set contrast */ 60 + /* todo #define HAVE_LCD_CONTRAST */ 61 + 62 + #define MIN_CONTRAST_SETTING 0 63 + #define MAX_CONTRAST_SETTING 30 64 + #define DEFAULT_CONTRAST_SETTING 14 /* Match boot contrast */ 65 + 66 + /* define this if you can flip your LCD */ 67 + /* todo #define HAVE_LCD_FLIP */ 68 + 69 + /* define this if you can invert the colours on your LCD */ 70 + /* todo #define HAVE_LCD_INVERT */ 71 + 72 + /* put the lcd frame buffer in IRAM */ 73 + /* #define IRAM_LCDFRAMEBUFFER IDATA_ATTR */ 74 + 75 + /* define this if you have a bitmap LCD display */ 76 + #define HAVE_LCD_BITMAP 77 + 78 + /* define this if you want album art for this target */ 79 + #define HAVE_ALBUMART 80 + 81 + /* define this if you have access to the quickscreen */ 82 + #define HAVE_QUICKSCREEN 83 + 84 + /* define this if you have access to the pitchscreen */ 85 + #define HAVE_PITCHSCREEN 86 + 87 + /* define this if you would like tagcache to build on this target */ 88 + #define HAVE_TAGCACHE 89 + 90 + #define CONFIG_KEYPAD SAMSUNG_YH_PAD 91 + 92 + /* Define this if you do software codec */ 93 + #define CONFIG_CODEC SWCODEC 94 + 95 + /* define this if you have a real-time clock */ 96 + /* todo verify rtc (or none) */ 97 + /* #ifndef BOOTLOADER */ 98 + #if 0 99 + #define CONFIG_RTC RTC_E8564 100 + #define HAVE_RTC_ALARM 101 + #endif 102 + 103 + /* define this if you have a disk storage, i.e. something 104 + that needs spinups and can cause skips when shaked */ 105 + #define HAVE_DISK_STORAGE 106 + 107 + /* define this if you use an ATA controller */ 108 + #define CONFIG_STORAGE STORAGE_ATA 109 + 110 + /* We're able to shut off power to the HDD */ 111 + #ifndef SIMULATOR 112 + /* todo #define HAVE_ATA_POWER_OFF */ 113 + #endif 114 + 115 + /* Define this if you have a software controlled poweroff */ 116 + #define HAVE_SW_POWEROFF 117 + 118 + /* The number of bytes reserved for loadable codecs */ 119 + #define CODEC_SIZE 0x100000 120 + 121 + /* The number of bytes reserved for loadable plugins */ 122 + #define PLUGIN_BUFFER_SIZE 0x80000 123 + 124 + /* Define this if you have the AK4537 audio codec */ 125 + #define HAVE_AK4537 126 + 127 + /* AK4537 has no tone controls, so we use the software ones */ 128 + #define HAVE_SW_TONE_CONTROLS 129 + 130 + #define AB_REPEAT_ENABLE 1 131 + 132 + #define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity */ 133 + #define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */ 134 + #define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ 135 + #define BATTERY_CAPACITY_INC 50 /* capacity increment */ 136 + #define BATTERY_TYPES_COUNT 1 /* only one type */ 137 + 138 + /* Hardware controlled charging */ 139 + #define CONFIG_CHARGING CHARGING_SIMPLE 140 + 141 + /* define this if the unit can be powered or charged via USB */ 142 + #define HAVE_USB_POWER 143 + 144 + #ifndef SIMULATOR 145 + 146 + /* Define this if you have a PortalPlayer PP5020 */ 147 + #define CONFIG_CPU PP5020 148 + 149 + /* Define this if you want to use the PP5020 i2c interface */ 150 + #define CONFIG_I2C I2C_PP5020 151 + 152 + /* define this if the hardware can be powered off while charging */ 153 + #define HAVE_POWEROFF_WHILE_CHARGING 154 + 155 + /* The start address index for ROM builds */ 156 + #define ROM_START 0x00000000 157 + 158 + /* The size of the flash ROM */ 159 + #define FLASH_SIZE 0x100000 160 + 161 + /* Define this to the CPU frequency */ 162 + #define CPU_FREQ 75000000 163 + 164 + /* USB On-the-go */ 165 + #define CONFIG_USBOTG USBOTG_ARC 166 + 167 + /* enable these for the experimental usb stack */ 168 + #define HAVE_USBSTACK 169 + #define USE_ROCKBOX_USB 170 + /* todo - check */ 171 + #define USB_VENDOR_ID 0x04e8 172 + #define USB_PRODUCT_ID 0x5022 173 + 174 + /* Virtual LED (icon) */ 175 + #define CONFIG_LED LED_VIRTUAL 176 + 177 + /* Define this if you have adjustable CPU frequency */ 178 + #define HAVE_ADJUSTABLE_CPU_FREQ 179 + 180 + #define MI4_FORMAT 181 + #define BOOTFILE_EXT "mi4" 182 + #define BOOTFILE "rockbox." BOOTFILE_EXT 183 + #define BOOTDIR "/.rockbox" 184 + 185 + /* Offset ( in the firmware file's header ) to the file CRC */ 186 + #define FIRMWARE_OFFSET_FILE_CRC 0x00 187 + 188 + /* Offset ( in the firmware file's header ) to the real data */ 189 + #define FIRMWARE_OFFSET_FILE_DATA 0x00 190 + 191 + #define ICODE_ATTR_TREMOR_NOT_MDCT 192 + 193 + #endif /* !SIMULATOR */
+190
firmware/export/config-yh925.h
··· 1 + /* 2 + * This config file is for the Samsung YH-925 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 59 9 + #define MODEL_NAME "Samsung YH-925" 10 + 11 + /* define this if you have recording possibility */ 12 + /* todo #define HAVE_RECORDING */ 13 + 14 + /* Define bitmask of input sources - recordable bitmask can be defined 15 + explicitly if different */ 16 + #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN ) 17 + 18 + /* define the bitmask of hardware sample rates */ 19 + #define HW_SAMPR_CAPS (SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \ 20 + SAMPR_CAP_24 | SAMPR_CAP_22 | SAMPR_CAP_16 | \ 21 + SAMPR_CAP_11 | SAMPR_CAP_8) 22 + 23 + /* define the bitmask of recording sample rates */ 24 + #define REC_SAMPR_CAPS (SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \ 25 + SAMPR_CAP_24 | SAMPR_CAP_22 | SAMPR_CAP_16 | \ 26 + SAMPR_CAP_11 | SAMPR_CAP_8) 27 + 28 + /* Type of LCD */ 29 + #define CONFIG_LCD LCD_YH925 30 + 31 + /* LCD dimensions */ 32 + #define LCD_WIDTH 160 33 + #define LCD_HEIGHT 128 34 + #define LCD_DEPTH 16 /* 65536 colours */ 35 + #define LCD_PIXELFORMAT RGB565 36 + 37 + /* todo */ 38 + /* #ifndef BOOTLOADER */ 39 + #if 0 40 + /* Define this if your LCD can be enabled/disabled */ 41 + #define HAVE_LCD_ENABLE 42 + 43 + /* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE 44 + * should be defined as well. 45 + * We can currently put the lcd to sleep but it won't wake up properly */ 46 + #define HAVE_LCD_SLEEP 47 + #define HAVE_LCD_SLEEP_SETTING 48 + #endif 49 + 50 + /* Define this for LCD backlight available */ 51 + #define HAVE_BACKLIGHT 52 + 53 + /* Define this if your LCD can set contrast */ 54 + /* todo #define HAVE_LCD_CONTRAST */ 55 + 56 + #define MIN_CONTRAST_SETTING 0 57 + #define MAX_CONTRAST_SETTING 30 58 + #define DEFAULT_CONTRAST_SETTING 14 /* Match boot contrast */ 59 + 60 + /* define this if you can flip your LCD */ 61 + /* todo #define HAVE_LCD_FLIP */ 62 + 63 + /* define this if you can invert the colours on your LCD */ 64 + /* todo #define HAVE_LCD_INVERT */ 65 + 66 + /* put the lcd frame buffer in IRAM */ 67 + /* #define IRAM_LCDFRAMEBUFFER IDATA_ATTR */ 68 + 69 + /* define this if you have a bitmap LCD display */ 70 + #define HAVE_LCD_BITMAP 71 + 72 + /* define this if you have a colour LCD */ 73 + #define HAVE_LCD_COLOR 74 + 75 + /* define this if you want album art for this target */ 76 + #define HAVE_ALBUMART 77 + 78 + /* define this if you have access to the quickscreen */ 79 + #define HAVE_QUICKSCREEN 80 + 81 + /* define this if you have access to the pitchscreen */ 82 + #define HAVE_PITCHSCREEN 83 + 84 + /* define this if you would like tagcache to build on this target */ 85 + #define HAVE_TAGCACHE 86 + 87 + #define CONFIG_KEYPAD SAMSUNG_YH_PAD 88 + 89 + /* Define this if you do software codec */ 90 + #define CONFIG_CODEC SWCODEC 91 + 92 + /* define this if you have a real-time clock */ 93 + /* todo verify rtc (or none) */ 94 + /* #ifndef BOOTLOADER */ 95 + #if 0 96 + #define CONFIG_RTC RTC_E8564 97 + #define HAVE_RTC_ALARM 98 + #endif 99 + 100 + /* define this if you have a disk storage, i.e. something 101 + that needs spinups and can cause skips when shaked */ 102 + #define HAVE_DISK_STORAGE 103 + 104 + /* define this if you use an ATA controller */ 105 + #define CONFIG_STORAGE STORAGE_ATA 106 + 107 + /* We're able to shut off power to the HDD */ 108 + #ifndef SIMULATOR 109 + /* todo #define HAVE_ATA_POWER_OFF */ 110 + #endif 111 + 112 + /* Define this if you have a software controlled poweroff */ 113 + #define HAVE_SW_POWEROFF 114 + 115 + /* The number of bytes reserved for loadable codecs */ 116 + #define CODEC_SIZE 0x100000 117 + 118 + /* The number of bytes reserved for loadable plugins */ 119 + #define PLUGIN_BUFFER_SIZE 0x80000 120 + 121 + /* Define this if you have the AK4537 audio codec */ 122 + #define HAVE_AK4537 123 + 124 + /* AK4537 has no tone controls, so we use the software ones */ 125 + #define HAVE_SW_TONE_CONTROLS 126 + 127 + #define AB_REPEAT_ENABLE 1 128 + 129 + #define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity */ 130 + #define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */ 131 + #define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */ 132 + #define BATTERY_CAPACITY_INC 50 /* capacity increment */ 133 + #define BATTERY_TYPES_COUNT 1 /* only one type */ 134 + 135 + /* Hardware controlled charging */ 136 + #define CONFIG_CHARGING CHARGING_SIMPLE 137 + 138 + /* define this if the unit can be powered or charged via USB */ 139 + #define HAVE_USB_POWER 140 + 141 + #ifndef SIMULATOR 142 + 143 + /* Define this if you have a PortalPlayer PP5020 */ 144 + #define CONFIG_CPU PP5020 145 + 146 + /* Define this if you want to use the PP5020 i2c interface */ 147 + #define CONFIG_I2C I2C_PP5020 148 + 149 + /* define this if the hardware can be powered off while charging */ 150 + #define HAVE_POWEROFF_WHILE_CHARGING 151 + 152 + /* The start address index for ROM builds */ 153 + #define ROM_START 0x00000000 154 + 155 + /* The size of the flash ROM */ 156 + #define FLASH_SIZE 0x100000 157 + 158 + /* Define this to the CPU frequency */ 159 + #define CPU_FREQ 75000000 160 + 161 + /* USB On-the-go */ 162 + #define CONFIG_USBOTG USBOTG_ARC 163 + 164 + /* enable these for the experimental usb stack */ 165 + #define HAVE_USBSTACK 166 + #define USE_ROCKBOX_USB 167 + /* todo - check */ 168 + #define USB_VENDOR_ID 0x04e8 169 + #define USB_PRODUCT_ID 0x5024 170 + 171 + /* Virtual LED (icon) */ 172 + #define CONFIG_LED LED_VIRTUAL 173 + 174 + /* Define this if you have adjustable CPU frequency */ 175 + #define HAVE_ADJUSTABLE_CPU_FREQ 176 + 177 + #define MI4_FORMAT 178 + #define BOOTFILE_EXT "mi4" 179 + #define BOOTFILE "rockbox." BOOTFILE_EXT 180 + #define BOOTDIR "/.rockbox" 181 + 182 + /* Offset ( in the firmware file's header ) to the file CRC */ 183 + #define FIRMWARE_OFFSET_FILE_CRC 0x00 184 + 185 + /* Offset ( in the firmware file's header ) to the real data */ 186 + #define FIRMWARE_OFFSET_FILE_DATA 0x00 187 + 188 + #define ICODE_ATTR_TREMOR_NOT_MDCT 189 + 190 + #endif /* !SIMULATOR */
+9 -1
firmware/export/config.h
··· 109 109 #define SANSA_CLIP_PAD 35 110 110 #define SANSA_FUZE_PAD 36 111 111 #define LYRE_PROTO1_PAD 37 112 + #define SAMSUNG_YH_PAD 38 112 113 113 114 /* CONFIG_REMOTE_KEYPAD */ 114 115 #define H100_REMOTE 1 ··· 185 186 #define LCD_SSD1303 31 /* as used by the Sansa Clip */ 186 187 #define LCD_FUZE 32 /* as used by the Sansa Fuze */ 187 188 #define LCD_LYRE_PROTO1 33 /* as used by the Lyre */ 188 - 189 + #define LCD_YH925 34 /* as used by Samsung YH-925 (similar to the H10 20GB) */ 190 + 189 191 /* LCD_PIXELFORMAT */ 190 192 #define HORIZONTAL_PACKING 1 191 193 #define VERTICAL_PACKING 2 ··· 364 366 #include "config-c200v2.h" 365 367 #elif defined(LYRE_PROTO1) 366 368 #include "config-lyre_proto1.h" 369 + #elif defined(SAMSUNG_YH820) 370 + #include "config-yh820.h" 371 + #elif defined(SAMSUNG_YH920) 372 + #include "config-yh920.h" 373 + #elif defined(SAMSUNG_YH925) 374 + #include "config-yh925.h" 367 375 #else 368 376 /* no known platform */ 369 377 #endif
+3
firmware/export/usb.h
··· 84 84 #elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD 85 85 #define USBPOWER_BUTTON BUTTON_PLAYLIST 86 86 #define USBPOWER_BTN_IGNORE BUTTON_POWER 87 + #elif CONFIG_KEYPAD == SAMSUNG_YH_PAD 88 + #define USBPOWER_BUTTON BUTTON_RIGHT 89 + #define USBPOWER_BTN_IGNORE BUTTON_LEFT 87 90 #endif 88 91 #endif /* HAVE_USB_POWER */ 89 92
+4 -3
firmware/sound.c
··· 254 254 dac_volume(tenthdb2reg(l), tenthdb2reg(r), false); 255 255 #elif defined(HAVE_UDA1380) || defined(HAVE_WM8975) || defined(HAVE_WM8758) \ 256 256 || defined(HAVE_WM8711) || defined(HAVE_WM8721) || defined(HAVE_WM8731) \ 257 - || defined(HAVE_WM8751) || defined(HAVE_AS3514) || defined(HAVE_TSC2100) 257 + || defined(HAVE_WM8751) || defined(HAVE_AS3514) || defined(HAVE_TSC2100) \ 258 + || defined(HAVE_AK4537) 258 259 audiohw_set_master_vol(tenthdb2master(l), tenthdb2master(r)); 259 260 #if defined(HAVE_WM8975) || defined(HAVE_WM8758) \ 260 261 || (defined(HAVE_WM8751) && !defined(MROBE_100)) || defined(HAVE_WM8985) ··· 584 585 #if (!defined(HAVE_AS3514) && !defined(HAVE_WM8975) \ 585 586 && !defined(HAVE_WM8758) && !defined(HAVE_TSC2100) \ 586 587 && !defined (HAVE_WM8711) && !defined (HAVE_WM8721) \ 587 - && !defined (HAVE_WM8731) && !defined (HAVE_WM8978)) \ 588 - || defined(SIMULATOR) 588 + && !defined (HAVE_WM8731) && !defined (HAVE_WM8978) \ 589 + && !defined(HAVE_AK4537)) || defined(SIMULATOR) 589 590 int sound_val2phys(int setting, int value) 590 591 { 591 592 #if CONFIG_CODEC == MAS3587F
+4
firmware/target/arm/ata-pp5020.c
··· 45 45 46 46 void ata_device_init() 47 47 { 48 + #ifdef SAMSUNG_YH920 49 + CPU_INT_DIS = (1<<IDE_IRQ); 50 + #endif 51 + 48 52 /* From ipod-ide.c:ipod_ide_register() */ 49 53 IDE0_CFG |= (1<<5); 50 54 #ifdef IPOD_NANO
+2 -1
firmware/target/arm/i2c-pp.c
··· 269 269 270 270 #if CONFIG_I2C == I2C_PP5020 271 271 outl(0x0, 0x600060a4); 272 - #if defined(PHILIPS_HDD1630) 272 + #if defined(PHILIPS_HDD1630) || defined(SAMSUNG_YH820) || \ 273 + defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925) 273 274 outl(inl(0x600060a4) | 0x20, 0x600060a4); 274 275 outl(inl(0x7000c020) | 0x3, 0x7000c020); 275 276 outl(0x55, 0x7000c02c);
+36
firmware/target/arm/samsung/adc-target.h
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2006 by Barry Wardell 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 _ADC_TARGET_H_ 22 + #define _ADC_TARGET_H_ 23 + 24 + #define NUM_ADC_CHANNELS 2 25 + 26 + #define ADC_CHANNEL_0 0 27 + #define ADC_CHANNEL_1 1 28 + #define ADC_CHANNEL_2 2 29 + #define ADC_CHANNEL_3 3 30 + 31 + #define ADC_UNREG_POWER ADC_BATTERY /* For compatibility */ 32 + 33 + /* Force a scan now */ 34 + unsigned short adc_scan(int channel); 35 + 36 + #endif
+102
firmware/target/arm/samsung/akcodec-yh82x_yh92x.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (c) 2009 Mark Arigo 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 "audiohw.h" 24 + #include "i2c-pp.h" 25 + #include "i2s.h" 26 + #include "akcodec.h" 27 + 28 + // #define LOGF_ENABLE 29 + #include "logf.h" 30 + 31 + #define I2C_AUDIO_ADDRESS 0x10 32 + 33 + /* 34 + * Initialise the PP I2C and I2S. 35 + */ 36 + void audiohw_init(void) 37 + { 38 + unsigned long tmp; 39 + 40 + logf("audiohw_init"); 41 + 42 + /* I2S device enable */ 43 + DEV_EN |= (DEV_I2S | DEV_EXTCLOCKS); 44 + 45 + /* I2S device reset */ 46 + DEV_RS |= DEV_I2S; 47 + asm volatile ("nop\n"); 48 + DEV_RS &= ~DEV_I2S; 49 + 50 + DEV_INIT1 &= ~0x3000000; 51 + 52 + tmp = DEV_INIT1; 53 + DEV_INIT1 = tmp; 54 + 55 + DEV_INIT2 &= ~0x100; 56 + 57 + /* reset the I2S controller into known state */ 58 + i2s_reset(); 59 + 60 + /* this gpio pin maybe powers the codec chip */ 61 + GPIOB_ENABLE |= 0x01; 62 + GPIOB_OUTPUT_EN |= 0x01; 63 + GPIOB_OUTPUT_VAL |= 0x01; 64 + 65 + GPIOL_ENABLE |= 0x20; 66 + GPIOL_OUTPUT_VAL &= ~0x20; 67 + GPIOL_OUTPUT_EN |= 0x20; 68 + 69 + GPO32_VAL |= 0x00000020; 70 + GPO32_ENABLE |= 0x00000020; 71 + 72 + GPIOF_ENABLE |= 0x80; 73 + GPIOF_OUTPUT_VAL |= 0x80; 74 + GPIOF_OUTPUT_EN |= 0x80; 75 + 76 + audiohw_preinit(); 77 + 78 + GPIOL_ENABLE |= 0x20; 79 + GPIOL_OUTPUT_VAL |= 0x20; 80 + GPIOL_OUTPUT_EN |= 0x20; 81 + } 82 + 83 + void akcodec_close(void) 84 + { 85 + GPIOF_ENABLE |= 0x80; 86 + GPIOF_OUTPUT_VAL &= ~0x80; 87 + GPIOF_OUTPUT_EN |= 0x80; 88 + 89 + GPIOB_ENABLE |= 0x01; 90 + GPIOB_OUTPUT_EN |= 0x01; 91 + GPIOB_OUTPUT_VAL |= 0x01; 92 + } 93 + 94 + void akcodec_write(int reg, int data) 95 + { 96 + pp_i2c_send(I2C_AUDIO_ADDRESS, reg, data); 97 + } 98 + 99 + int akcodec_read(int reg) 100 + { 101 + return i2c_readbyte(I2C_AUDIO_ADDRESS, reg); 102 + }
+198
firmware/target/arm/samsung/app.lds
··· 1 + #include "config.h" 2 + 3 + ENTRY(start) 4 + 5 + OUTPUT_FORMAT(elf32-littlearm) 6 + OUTPUT_ARCH(arm) 7 + STARTUP(target/arm/crt0-pp.o) 8 + 9 + #define PLUGINSIZE PLUGIN_BUFFER_SIZE 10 + #define CODECSIZE CODEC_SIZE 11 + 12 + #ifdef DEBUG 13 + #define STUBOFFSET 0x10000 14 + #else 15 + #define STUBOFFSET 0 16 + #endif 17 + 18 + #define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGINSIZE - STUBOFFSET - CODECSIZE 19 + 20 + #define DRAMORIG 0x00000000 + STUBOFFSET 21 + #define IRAMORIG 0x40000000 22 + #define IRAMSIZE 0xc000 23 + 24 + #ifdef CPU_PP502x 25 + #define NOCACHE_BASE 0x10000000 26 + #else 27 + #define NOCACHE_BASE 0x28000000 28 + #endif 29 + 30 + #define CACHEALIGN_SIZE 16 31 + 32 + /* End of the audio buffer, where the codec buffer starts */ 33 + #define ENDAUDIOADDR (DRAMORIG + DRAMSIZE) 34 + 35 + /* Where the codec buffer ends, and the plugin buffer starts */ 36 + #define ENDADDR (ENDAUDIOADDR + CODECSIZE) 37 + 38 + MEMORY 39 + { 40 + DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE 41 + IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE 42 + } 43 + 44 + SECTIONS 45 + { 46 + .text : 47 + { 48 + loadaddress = .; 49 + _loadaddress = .; 50 + . = ALIGN(0x200); 51 + *(.init.text) 52 + *(.text*) 53 + *(.glue_7) 54 + *(.glue_7t) 55 + . = ALIGN(0x4); 56 + } > DRAM 57 + 58 + .rodata : 59 + { 60 + *(.rodata) /* problems without this, dunno why */ 61 + *(.rodata*) 62 + *(.rodata.str1.1) 63 + *(.rodata.str1.4) 64 + . = ALIGN(0x4); 65 + 66 + /* Pseudo-allocate the copies of the data sections */ 67 + _datacopy = .; 68 + } > DRAM 69 + 70 + /* TRICK ALERT! For RAM execution, we put the .data section at the 71 + same load address as the copy. Thus, we don't waste extra RAM 72 + when we don't actually need the copy. */ 73 + .data : AT ( _datacopy ) 74 + { 75 + _datastart = .; 76 + *(.data*) 77 + . = ALIGN(0x4); 78 + _dataend = .; 79 + } > DRAM 80 + 81 + #if NOCACHE_BASE != 0 82 + /* .ncdata section is placed at uncached physical alias address and is 83 + * loaded at the proper cached virtual address - no copying is 84 + * performed in the init code */ 85 + .ncdata . + NOCACHE_BASE : 86 + { 87 + . = ALIGN(CACHEALIGN_SIZE); 88 + *(.ncdata*) 89 + . = ALIGN(CACHEALIGN_SIZE); 90 + } AT> DRAM 91 + #endif 92 + 93 + /DISCARD/ : 94 + { 95 + *(.eh_frame) 96 + } 97 + 98 + .vectors 0x0 : 99 + { 100 + _vectorsstart = .; 101 + *(.vectors); 102 + _vectorsend = .; 103 + } AT> DRAM 104 + 105 + _vectorscopy = LOADADDR(.vectors); 106 + _noloaddram = LOADADDR(.vectors); 107 + 108 + .ibss IRAMORIG (NOLOAD) : 109 + { 110 + _iedata = .; 111 + *(.qharray) 112 + *(.ibss) 113 + . = ALIGN(0x4); 114 + _iend = .; 115 + } > IRAM 116 + 117 + .iram _iend : 118 + { 119 + _iramstart = .; 120 + *(.icode) 121 + *(.irodata) 122 + *(.idata) 123 + . = ALIGN(0x4); 124 + _iramend = .; 125 + } > IRAM AT> DRAM 126 + 127 + _iramcopy = LOADADDR(.iram); 128 + 129 + .idle_stacks (NOLOAD) : 130 + { 131 + *(.idle_stacks) 132 + #if NUM_CORES > 1 133 + cpu_idlestackbegin = .; 134 + . += IDLE_STACK_SIZE; 135 + cpu_idlestackend = .; 136 + #endif 137 + cop_idlestackbegin = .; 138 + . += IDLE_STACK_SIZE; 139 + cop_idlestackend = .; 140 + } > IRAM 141 + 142 + .stack (NOLOAD) : 143 + { 144 + *(.stack) 145 + stackbegin = .; 146 + . += 0x2000; 147 + stackend = .; 148 + } > IRAM 149 + 150 + /* .bss and .ncbss are treated as a single section to use one init loop to 151 + * zero it - note "_edata" and "_end" */ 152 + .bss _noloaddram (NOLOAD) : 153 + { 154 + _edata = .; 155 + *(.bss*) 156 + *(COMMON) 157 + . = ALIGN(0x4); 158 + } > DRAM 159 + 160 + #if NOCACHE_BASE != 0 161 + .ncbss . + NOCACHE_BASE (NOLOAD): 162 + { 163 + . = ALIGN(CACHEALIGN_SIZE); 164 + *(.ncbss*) 165 + . = ALIGN(CACHEALIGN_SIZE); 166 + } AT> DRAM 167 + #endif 168 + 169 + /* This will be aligned by preceding alignments */ 170 + .endaddr . - NOCACHE_BASE (NOLOAD) : 171 + { 172 + _end = .; 173 + } > DRAM 174 + 175 + .audiobuf (NOLOAD) : 176 + { 177 + _audiobuffer = .; 178 + audiobuffer = .; 179 + } > DRAM 180 + 181 + .audiobufend ENDAUDIOADDR (NOLOAD) : 182 + { 183 + audiobufend = .; 184 + _audiobufend = .; 185 + } > DRAM 186 + 187 + .codec ENDAUDIOADDR (NOLOAD) : 188 + { 189 + codecbuf = .; 190 + _codecbuf = .; 191 + } 192 + 193 + .plugin ENDADDR (NOLOAD) : 194 + { 195 + _pluginbuf = .; 196 + pluginbuf = .; 197 + } 198 + }
+28
firmware/target/arm/samsung/backlight-target.h
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2006 by Barry Wardell 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 BACKLIGHT_TARGET_H 22 + #define BACKLIGHT_TARGET_H 23 + 24 + #define _backlight_init() true 25 + void _backlight_on(void); 26 + void _backlight_off(void); 27 + 28 + #endif
+64
firmware/target/arm/samsung/boot.lds
··· 1 + #include "config.h" 2 + 3 + ENTRY(start) 4 + OUTPUT_FORMAT(elf32-littlearm) 5 + OUTPUT_ARCH(arm) 6 + STARTUP(target/arm/crt0-pp-bl.o) 7 + 8 + #define DRAMSIZE (MEMORYSIZE * 0x100000) 9 + 10 + #define DRAMORIG 0x10000000 11 + #define IRAMORIG 0x40000000 12 + #define IRAMSIZE 0x18000 13 + #define FLASHORIG 0x001f0000 14 + #define FLASHSIZE 2M 15 + 16 + MEMORY 17 + { 18 + DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE 19 + IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE 20 + } 21 + 22 + SECTIONS 23 + { 24 + . = IRAMORIG; 25 + 26 + .text : { 27 + *(.init.text) 28 + *(.text*) 29 + *(.glue_7) 30 + *(.glue_7t) 31 + } > IRAM 32 + 33 + .data : { 34 + *(.icode) 35 + *(.irodata) 36 + *(.idata) 37 + *(.data*) 38 + *(.ncdata*) 39 + *(.rodata*) 40 + _dataend = . ; 41 + } > IRAM 42 + 43 + .stack : { 44 + *(.stack) 45 + _stackbegin = .; 46 + stackbegin = .; 47 + . += 0x2000; 48 + _stackend = .; 49 + stackend = .; 50 + } > IRAM 51 + 52 + /* The bss section is too large for IRAM - we just move it 16MB into the 53 + DRAM */ 54 + 55 + . = DRAMORIG; 56 + .bss . + (16*1024*1024) : { 57 + _edata = .; 58 + *(.bss*); 59 + *(.ibss); 60 + *(COMMON) 61 + *(.ncbss*); 62 + _end = .; 63 + } > DRAM 64 + }
+55
firmware/target/arm/samsung/button-target.h
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2009 by Mark Arigo 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 _BUTTON_TARGET_H_ 23 + #define _BUTTON_TARGET_H_ 24 + 25 + #include <stdbool.h> 26 + #include "config.h" 27 + 28 + #define HAS_BUTTON_HOLD 29 + 30 + bool button_hold(void); 31 + void button_init_device(void); 32 + int button_read_device(void); 33 + 34 + /* Button codes for Samsung YH-820, 920, 925 */ 35 + 36 + /* Main unit's buttons */ 37 + /* Left = Menu, Right = Sel */ 38 + #define BUTTON_LEFT 0x00000001 39 + #define BUTTON_RIGHT 0x00000002 40 + #define BUTTON_UP 0x00000004 41 + #define BUTTON_DOWN 0x00000008 42 + #define BUTTON_PLAY 0x00000010 43 + #define BUTTON_REW 0x00000020 44 + #define BUTTON_FFWD 0x00000040 45 + #define BUTTON_REC 0x00000080 46 + 47 + #define BUTTON_MAIN 0x000000ff 48 + 49 + /* No Remote control */ 50 + #define BUTTON_REMOTE 0 51 + 52 + #define POWEROFF_BUTTON BUTTON_PLAY 53 + #define POWEROFF_COUNT 15 54 + 55 + #endif /* _BUTTON_TARGET_H_ */
+72
firmware/target/arm/samsung/button-yh82x_yh92x.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2009 by Mark Arigo 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.h" 24 + #include "backlight.h" 25 + 26 + void button_init_device(void) 27 + { 28 + /* TODO...for now, hardware initialisation is done by the OF bootloader */ 29 + } 30 + 31 + bool button_hold(void) 32 + { 33 + return (~GPIOA_INPUT_VAL & 0x1); 34 + } 35 + 36 + /* 37 + * Get button pressed from hardware 38 + */ 39 + int button_read_device(void) 40 + { 41 + int btn = BUTTON_NONE; 42 + static bool hold_button = false; 43 + bool hold_button_old; 44 + 45 + /* Hold */ 46 + hold_button_old = hold_button; 47 + hold_button = button_hold(); 48 + 49 + #ifndef BOOTLOADER 50 + if (hold_button != hold_button_old) 51 + backlight_hold_changed(hold_button); 52 + #endif 53 + 54 + /* device buttons */ 55 + if (!hold_button) 56 + { 57 + if (~GPIOA_INPUT_VAL & 0x04) btn |= BUTTON_LEFT; 58 + if (~GPIOA_INPUT_VAL & 0x20) btn |= BUTTON_RIGHT; 59 + if (~GPIOA_INPUT_VAL & 0x10) btn |= BUTTON_UP; 60 + if (~GPIOA_INPUT_VAL & 0x08) btn |= BUTTON_DOWN; 61 + if (~GPIOA_INPUT_VAL & 0x02) btn |= BUTTON_FFWD; 62 + if (~GPIOA_INPUT_VAL & 0x80) btn |= BUTTON_REW; 63 + if (~GPIOA_INPUT_VAL & 0x40) btn |= BUTTON_REC; 64 + #if defined(SAMSUNG_YH820) 65 + if ( GPIOB_INPUT_VAL & 0x80) btn |= BUTTON_PLAY; 66 + #elif defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925) 67 + if ( GPIOD_INPUT_VAL & 0x04) btn |= BUTTON_PLAY; 68 + #endif 69 + } 70 + 71 + return btn; 72 + }
+77
firmware/target/arm/samsung/power-yh82x_yh92x.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2009 by Mark Arigo 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 + /* Created from power.c using some iPod code, and some custom stuff based on 23 + GPIO analysis 24 + */ 25 + 26 + #include "config.h" 27 + #include "cpu.h" 28 + #include <stdbool.h> 29 + #include "adc.h" 30 + #include "kernel.h" 31 + #include "system.h" 32 + #include "power.h" 33 + #include "logf.h" 34 + #include "usb.h" 35 + 36 + void power_init(void) 37 + { 38 + } 39 + 40 + unsigned int power_input_status(void) 41 + { 42 + unsigned int status = POWER_INPUT_NONE; 43 + 44 + if (GPIOL_INPUT_VAL & 0x80) 45 + status = POWER_INPUT_MAIN_CHARGER; 46 + 47 + if (GPIOD_INPUT_VAL & 0x10) 48 + status |= POWER_INPUT_USB_CHARGER; 49 + 50 + return status; 51 + } 52 + 53 + void ide_power_enable(bool on) 54 + { 55 + (void)on; 56 + /* We do nothing */ 57 + } 58 + 59 + 60 + bool ide_powered(void) 61 + { 62 + /* pretend we are always powered - we don't turn it off */ 63 + return true; 64 + } 65 + 66 + void power_off(void) 67 + { 68 + /* Disable interrupts on this core */ 69 + disable_interrupt(IRQ_FIQ_STATUS); 70 + 71 + /* Mask them on both cores */ 72 + CPU_INT_DIS = -1; 73 + COP_INT_DIS = -1; 74 + 75 + while (1) 76 + DEV_RS = -1; 77 + }
+47
firmware/target/arm/samsung/yh820/backlight-yh820.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2006 by Barry Wardell 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 "cpu.h" 23 + #include "system.h" 24 + #include "backlight.h" 25 + #include "lcd.h" 26 + 27 + void _backlight_on(void) 28 + { 29 + #ifdef HAVE_LCD_SLEEP 30 + backlight_lcd_sleep_countdown(false); /* stop counter */ 31 + #endif 32 + #ifdef HAVE_LCD_ENABLE 33 + lcd_enable(true); /* power on lcd + visible display */ 34 + #endif 35 + GPIO_SET_BITWISE(GPIOB_OUTPUT_VAL, 0x2); 36 + } 37 + 38 + void _backlight_off(void) 39 + { 40 + GPIO_CLEAR_BITWISE(GPIOB_OUTPUT_VAL, 0x2); 41 + #ifdef HAVE_LCD_ENABLE 42 + lcd_enable(false); /* power off visible display */ 43 + #endif 44 + #ifdef HAVE_LCD_SLEEP 45 + backlight_lcd_sleep_countdown(true); /* start countdown */ 46 + #endif 47 + }
+551
firmware/target/arm/samsung/yh820/lcd-as-yh820.S
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2007 by Jens Arnold 11 + * Heavily based on lcd-as-memframe.c by Michael Sevakis 12 + * 13 + * This program is free software; you can redistribute it and/or 14 + * modify it under the terms of the GNU General Public License 15 + * as published by the Free Software Foundation; either version 2 16 + * of the License, or (at your option) any later version. 17 + * 18 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 19 + * KIND, either express or implied. 20 + * 21 + ****************************************************************************/ 22 + 23 + #include "config.h" 24 + #include "cpu.h" 25 + 26 + /**************************************************************************** 27 + * void lcd_write_yuv_420_lines(unsigned char const * const src[3], 28 + * int width, 29 + * int stride); 30 + * 31 + * |R| |1.000000 -0.000001 1.402000| |Y'| 32 + * |G| = |1.000000 -0.334136 -0.714136| |Pb| 33 + * |B| |1.000000 1.772000 0.000000| |Pr| 34 + * Scaled, normalized, rounded and tweaked to yield RGB 565: 35 + * |R| |74 0 101| |Y' - 16| >> 9 36 + * |G| = |74 -24 -51| |Cb - 128| >> 8 37 + * |B| |74 128 0| |Cr - 128| >> 9 38 + * 39 + * Write four RGB565 pixels in the following order on each loop: 40 + * 1 3 + > down 41 + * 2 4 \/ left 42 + */ 43 + .section .icode, "ax", %progbits 44 + .align 2 45 + .global lcd_write_yuv420_lines 46 + .type lcd_write_yuv420_lines, %function 47 + lcd_write_yuv420_lines: 48 + @ r0 = yuv_src 49 + @ r1 = width 50 + @ r2 = stride 51 + stmfd sp!, { r4-r12 } @ save non-scratch 52 + ldmia r0, { r4, r5, r6 } @ r4 = yuv_src[0] = Y'_p 53 + @ r5 = yuv_src[1] = Cb_p 54 + @ r6 = yuv_src[2] = Cr_p 55 + @ r0 = scratch 56 + sub r2, r2, #1 @ 57 + mov r3, #0x70000000 @ 58 + orr r3, r3, #0x3000 @ r3 = LCD1_BASE 59 + 10: @ loop line @ 60 + ldrb r7, [r4], #1 @ r7 = *Y'_p++; 61 + ldrb r8, [r5], #1 @ r8 = *Cb_p++; 62 + ldrb r9, [r6], #1 @ r9 = *Cr_p++; 63 + @ 64 + sub r7, r7, #16 @ r7 = Y = (Y' - 16)*74 65 + add r12, r7, r7, asl #2 @ actually (Y' - 16)*37 and shift right 66 + add r7, r12, r7, asl #5 @ by one less when adding - same for all 67 + @ 68 + sub r8, r8, #128 @ Cb -= 128 69 + sub r9, r9, #128 @ Cr -= 128 70 + @ 71 + add r10, r9, r9, asl #1 @ r10 = Cr*51 + Cb*24 72 + add r10, r10, r10, asl #4 @ 73 + add r10, r10, r8, asl #3 @ 74 + add r10, r10, r8, asl #4 @ 75 + @ 76 + add r11, r9, r9, asl #2 @ r9 = Cr*101 77 + add r11, r11, r9, asl #5 @ 78 + add r9, r11, r9, asl #6 @ 79 + @ 80 + add r8, r8, #2 @ r8 = bu = (Cb*128 + 128) >> 8 81 + mov r8, r8, asr #2 @ 82 + add r9, r9, #256 @ r9 = rv = (r9 + 256) >> 9 83 + mov r9, r9, asr #9 @ 84 + rsb r10, r10, #128 @ r10 = guv = (-r10 + 128) >> 8 85 + mov r10, r10, asr #8 @ 86 + @ compute R, G, and B 87 + add r0, r8, r7, asr #8 @ r0 = b = (Y >> 9) + bu 88 + add r11, r9, r7, asr #8 @ r11 = r = (Y >> 9) + rv 89 + add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv 90 + @ 91 + orr r12, r0, r11 @ check if clamping is needed... 92 + orr r12, r12, r7, asr #1 @ ...at all 93 + cmp r12, #31 @ 94 + bls 15f @ no clamp @ 95 + cmp r0, #31 @ clamp b 96 + mvnhi r0, r0, asr #31 @ 97 + andhi r0, r0, #31 @ 98 + cmp r11, #31 @ clamp r 99 + mvnhi r11, r11, asr #31 @ 100 + andhi r11, r11, #31 @ 101 + cmp r7, #63 @ clamp g 102 + mvnhi r7, r7, asr #31 @ 103 + andhi r7, r7, #63 @ 104 + 15: @ no clamp @ 105 + @ 106 + ldrb r12, [r4, r2] @ r12 = Y' = *(Y'_p + stride) 107 + @ 108 + mov r11, r11, lsl #3 @ 109 + orr r11, r11, r7, lsr #3 @ r11 = (r << 3) | (g >> 3) 110 + orr r0, r0, r7, lsl #5 @ r0 = (g << 5) | b 111 + 1: @ busy @ 112 + ldr r7, [r3] @ r7 = LCD1_BASE 113 + tst r7, #LCD1_BUSY_MASK @ bridge busy? 114 + bne 1b @ 115 + str r11, [r3, #0x10] @ send MSB 116 + 1: @busy @ 117 + ldr r7, [r3] @ r7 = LCD1_BASE 118 + tst r7, #LCD1_BUSY_MASK @ bridge busy? 119 + bne 1b @ 120 + str r0, [r3, #0x10] @ send LSB 121 + @ 122 + sub r7, r12, #16 @ r7 = Y = (Y' - 16)*74 123 + add r12, r7, r7, asl #2 @ 124 + add r7, r12, r7, asl #5 @ 125 + @ compute R, G, and B 126 + add r0, r8, r7, asr #8 @ r0 = b = (Y >> 9) + bu 127 + add r11, r9, r7, asr #8 @ r11 = r = (Y >> 9) + rv 128 + add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv 129 + @ 130 + orr r12, r0, r11 @ check if clamping is needed... 131 + orr r12, r12, r7, asr #1 @ ...at all 132 + cmp r12, #31 @ 133 + bls 15f @ no clamp @ 134 + cmp r0, #31 @ clamp b 135 + mvnhi r0, r0, asr #31 @ 136 + andhi r0, r0, #31 @ 137 + cmp r11, #31 @ clamp r 138 + mvnhi r11, r11, asr #31 @ 139 + andhi r11, r11, #31 @ 140 + cmp r7, #63 @ clamp g 141 + mvnhi r7, r7, asr #31 @ 142 + andhi r7, r7, #63 @ 143 + 15: @ no clamp @ 144 + @ 145 + ldrb r12, [r4], #1 @ r12 = Y' = *(Y'_p++) 146 + @ 147 + mov r11, r11, lsl #3 @ 148 + orr r11, r11, r7, lsr #3 @ r11 = (r << 3) | (g >> 3) 149 + orr r0, r0, r7, lsl #5 @ r0 = (g << 5) | b 150 + 1: @ busy @ 151 + ldr r7, [r3] @ r7 = LCD1_BASE 152 + tst r7, #LCD1_BUSY_MASK @ bridge busy? 153 + bne 1b @ 154 + str r11, [r3, #0x10] @ send MSB 155 + 1: @ busy @ 156 + ldr r7, [r3] @ r7 = LCD1_BASE 157 + tst r7, #LCD1_BUSY_MASK @ bridge busy? 158 + bne 1b @ 159 + str r0, [r3, #0x10] @ send LSB 160 + @ 161 + sub r7, r12, #16 @ r7 = Y = (Y' - 16)*74 162 + add r12, r7, r7, asl #2 @ 163 + add r7, r12, r7, asl #5 @ 164 + @ compute R, G, and B 165 + add r0, r8, r7, asr #8 @ r0 = b = (Y >> 9) + bu 166 + add r11, r9, r7, asr #8 @ r11 = r = (Y >> 9) + rv 167 + add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv 168 + @ 169 + orr r12, r0, r11 @ check if clamping is needed... 170 + orr r12, r12, r7, asr #1 @ ...at all 171 + cmp r12, #31 @ 172 + bls 15f @ no clamp @ 173 + cmp r0, #31 @ clamp b 174 + mvnhi r0, r0, asr #31 @ 175 + andhi r0, r0, #31 @ 176 + cmp r11, #31 @ clamp r 177 + mvnhi r11, r11, asr #31 @ 178 + andhi r11, r11, #31 @ 179 + cmp r7, #63 @ clamp g 180 + mvnhi r7, r7, asr #31 @ 181 + andhi r7, r7, #63 @ 182 + 15: @ no clamp @ 183 + @ 184 + ldrb r12, [r4, r2] @ r12 = Y' = *(Y'_p + stride) 185 + @ 186 + @ 187 + mov r11, r11, lsl #3 @ 188 + orr r11, r11, r7, lsr #3 @ r11 = (r << 3) | (g >> 3) 189 + orr r0, r0, r7, lsl #5 @ r0 = (g << 5) | b 190 + 1: @ busy @ 191 + ldr r7, [r3] @ r7 = LCD1_BASE 192 + tst r7, #LCD1_BUSY_MASK @ bridge busy? 193 + bne 1b @ 194 + str r11, [r3, #0x10] @ send MSB 195 + 1: @ busy @ 196 + ldr r7, [r3] @ r7 = LCD1_BASE 197 + tst r7, #LCD1_BUSY_MASK @ bridge busy? 198 + bne 1b @ 199 + str r0, [r3, #0x10] @ send LSB 200 + @ 201 + sub r7, r12, #16 @ r7 = Y = (Y' - 16)*74 202 + add r12, r7, r7, asl #2 @ 203 + add r7, r12, r7, asl #5 @ 204 + @ compute R, G, and B 205 + add r0, r8, r7, asr #8 @ r0 = b = (Y >> 9) + bu 206 + add r11, r9, r7, asr #8 @ r11 = r = (Y >> 9) + rv 207 + add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv 208 + @ 209 + orr r12, r0, r11 @ check if clamping is needed... 210 + orr r12, r12, r7, asr #1 @ ...at all 211 + cmp r12, #31 @ 212 + bls 15f @ no clamp @ 213 + cmp r0, #31 @ clamp b 214 + mvnhi r0, r0, asr #31 @ 215 + andhi r0, r0, #31 @ 216 + cmp r11, #31 @ clamp r 217 + mvnhi r11, r11, asr #31 @ 218 + andhi r11, r11, #31 @ 219 + cmp r7, #63 @ clamp g 220 + mvnhi r7, r7, asr #31 @ 221 + andhi r7, r7, #63 @ 222 + 15: @ no clamp @ 223 + @ 224 + mov r11, r11, lsl #3 @ 225 + orr r11, r11, r7, lsr #3 @ r11 = (r << 3) | (g >> 3) 226 + orr r0, r0, r7, lsl #5 @ r0 = (g << 5) | b 227 + 1: @ busy @ 228 + ldr r7, [r3] @ r7 = LCD1_BASE 229 + tst r7, #LCD1_BUSY_MASK @ bridge busy? 230 + bne 1b @ 231 + str r11, [r3, #0x10] @ send MSB 232 + 1: @ busy @ 233 + ldr r7, [r3] @ r7 = LCD1_BASE 234 + tst r7, #LCD1_BUSY_MASK @ bridge busy? 235 + bne 1b @ 236 + str r0, [r3, #0x10] @ send LSB 237 + @ 238 + subs r1, r1, #2 @ subtract block from width 239 + bgt 10b @ loop line @ 240 + @ 241 + ldmfd sp!, { r4-r12 } @ restore registers and return 242 + bx lr @ 243 + .ltorg @ dump constant pool 244 + .size lcd_write_yuv420_lines, .-lcd_write_yuv420_lines 245 + 246 + /**************************************************************************** 247 + * void lcd_write_yuv_420_lines_odither(unsigned char const * const src[3], 248 + * int width, 249 + * int stride, 250 + * int x_screen, 251 + * int y_screen); 252 + * 253 + * |R| |1.000000 -0.000001 1.402000| |Y'| 254 + * |G| = |1.000000 -0.334136 -0.714136| |Pb| 255 + * |B| |1.000000 1.772000 0.000000| |Pr| 256 + * Red scaled at twice g & b but at same precision to place it in correct 257 + * bit position after multiply and leave instruction count lower. 258 + * |R| |258 0 408| |Y' - 16| 259 + * |G| = |149 -49 -104| |Cb - 128| 260 + * |B| |149 258 0| |Cr - 128| 261 + * 262 + * Write four RGB565 pixels in the following order on each loop: 263 + * 1 3 + > down 264 + * 2 4 \/ left 265 + * 266 + * Kernel pattern (raw|rotated|use order): 267 + * 5 3 4 2 2 6 3 7 row0 row2 > down 268 + * 1 7 0 6 | 4 0 5 1 | 2 4 6 0 3 5 7 1 col0 left 269 + * 4 2 5 3 | 3 7 2 6 | 3 5 7 1 2 4 6 0 col2 \/ 270 + * 0 6 1 7 5 1 4 0 271 + */ 272 + .section .icode, "ax", %progbits 273 + .align 2 274 + .global lcd_write_yuv420_lines_odither 275 + .type lcd_write_yuv420_lines_odither, %function 276 + lcd_write_yuv420_lines_odither: 277 + @ r0 = yuv_src 278 + @ r1 = width 279 + @ r2 = stride 280 + @ r3 = x_screen 281 + @ [sp] = y_screen 282 + stmfd sp!, { r4-r12, lr } @ save non-scratch 283 + ldmia r0, { r4, r5, r6 } @ r4 = yuv_src[0] = Y'_p 284 + @ r5 = yuv_src[1] = Cb_p 285 + @ r6 = yuv_src[2] = Cr_p 286 + @ 287 + sub r2, r2, #1 @ 288 + ldr r14, [sp, #40] @ Line up pattern and kernel quadrant 289 + eor r14, r14, r3 @ 290 + and r14, r14, #0x2 @ 291 + mov r14, r14, lsl #6 @ 0x00 or 0x80 292 + mov r3, #0x70000000 @ 293 + orr r3, r3, #0x3000 @ r3 = LCD1_BASE 294 + 10: @ loop line @ 295 + @ 296 + ldrb r7, [r4], #1 @ r7 = *Y'_p++; 297 + ldrb r8, [r5], #1 @ r8 = *Cb_p++; 298 + ldrb r9, [r6], #1 @ r9 = *Cr_p++; 299 + @ 300 + eor r14, r14, #0x80 @ flip pattern quadrant 301 + @ 302 + sub r7, r7, #16 @ r7 = Y = (Y' - 16)*149 303 + add r12, r7, r7, asl #2 @ 304 + add r12, r12, r12, asl #4 @ 305 + add r7, r12, r7, asl #6 @ 306 + @ 307 + sub r8, r8, #128 @ Cb -= 128 308 + sub r9, r9, #128 @ Cr -= 128 309 + @ 310 + add r10, r8, r8, asl #4 @ r10 = guv = Cr*104 + Cb*49 311 + add r10, r10, r8, asl #5 @ 312 + add r10, r10, r9, asl #3 @ 313 + add r10, r10, r9, asl #5 @ 314 + add r10, r10, r9, asl #6 @ 315 + @ 316 + mov r8, r8, asl #1 @ r8 = bu = Cb*258 317 + add r8, r8, r8, asl #7 @ 318 + @ 319 + add r9, r9, r9, asl #1 @ r9 = rv = Cr*408 320 + add r9, r9, r9, asl #4 @ 321 + mov r9, r9, asl #3 @ 322 + @ 323 + @ compute R, G, and B 324 + add r0, r8, r7 @ r0 = b' = Y + bu 325 + add r11, r9, r7, asl #1 @ r11 = r' = Y*2 + rv 326 + rsb r7, r10, r7 @ r7 = g' = Y + guv 327 + @ 328 + @ r8 = bu, r9 = rv, r10 = guv 329 + @ 330 + sub r12, r0, r0, lsr #5 @ r0 = 31/32*b + b/256 331 + add r0, r12, r0, lsr #8 @ 332 + @ 333 + sub r12, r11, r11, lsr #5 @ r11 = 31/32*r + r/256 334 + add r11, r12, r11, lsr #8 @ 335 + @ 336 + sub r12, r7, r7, lsr #6 @ r7 = 63/64*g + g/256 337 + add r7, r12, r7, lsr #8 @ 338 + @ 339 + add r12, r14, #0x100 @ 340 + @ 341 + add r0, r0, r12 @ b = r0 + delta 342 + add r11, r11, r12, lsl #1 @ r = r11 + delta*2 343 + add r7, r7, r12, lsr #1 @ g = r7 + delta/2 344 + @ 345 + orr r12, r0, r11, asr #1 @ check if clamping is needed... 346 + orr r12, r12, r7 @ ...at all 347 + movs r12, r12, asr #15 @ 348 + beq 15f @ no clamp @ 349 + movs r12, r0, asr #15 @ clamp b 350 + mvnne r0, r12, lsr #15 @ 351 + andne r0, r0, #0x7c00 @ mask b only if clamped 352 + movs r12, r11, asr #16 @ clamp r 353 + mvnne r11, r12, lsr #16 @ 354 + movs r12, r7, asr #15 @ clamp g 355 + mvnne r7, r12, lsr #15 @ 356 + 15: @ no clamp @ 357 + @ 358 + ldrb r12, [r4, r2] @ r12 = Y' = *(Y'_p + stride) 359 + @ 360 + 361 + and r11, r11, #0xf800 @ pack pixel 362 + mov r11, r11, lsr #8 363 + and r7, r7, #0x7e00 364 + orr r11, r11, r7, lsr #12 365 + mov r7, r7, lsr#4 366 + orr r0, r7, r0, lsr #10 367 + 1: @ busy @ 368 + ldr r7, [r3] @ r7 = LCD1_BASE 369 + tst r7, #LCD1_BUSY_MASK @ bridge busy? 370 + bne 1b @ 371 + str r11, [r3, #0x10] @ send MSB 372 + 1: @ busy @ 373 + ldr r7, [r3] @ r7 = LCD1_BASE 374 + tst r7, #LCD1_BUSY_MASK @ bridge busy? 375 + bne 1b @ 376 + str r0, [r3, #0x10] @ send LSB 377 + @ 378 + sub r7, r12, #16 @ r7 = Y = (Y' - 16)*149 379 + add r12, r7, r7, asl #2 @ 380 + add r12, r12, r12, asl #4 @ 381 + add r7, r12, r7, asl #6 @ 382 + @ compute R, G, and B 383 + add r0, r8, r7 @ r0 = b' = Y + bu 384 + add r11, r9, r7, asl #1 @ r11 = r' = Y*2 + rv 385 + rsb r7, r10, r7 @ r7 = g' = Y + guv 386 + @ 387 + sub r12, r0, r0, lsr #5 @ r0 = 31/32*b' + b'/256 388 + add r0, r12, r0, lsr #8 @ 389 + @ 390 + sub r12, r11, r11, lsr #5 @ r11 = 31/32*r' + r'/256 391 + add r11, r12, r11, lsr #8 @ 392 + @ 393 + sub r12, r7, r7, lsr #6 @ r7 = 63/64*g' + g'/256 394 + add r7, r12, r7, lsr #8 @ 395 + @ 396 + add r12, r14, #0x200 @ 397 + @ 398 + add r0, r0, r12 @ b = r0 + delta 399 + add r11, r11, r12, lsl #1 @ r = r11 + delta*2 400 + add r7, r7, r12, lsr #1 @ g = r7 + delta/2 401 + @ 402 + orr r12, r0, r11, asr #1 @ check if clamping is needed... 403 + orr r12, r12, r7 @ ...at all 404 + movs r12, r12, asr #15 @ 405 + beq 15f @ no clamp @ 406 + movs r12, r0, asr #15 @ clamp b 407 + mvnne r0, r12, lsr #15 @ 408 + andne r0, r0, #0x7c00 @ mask b only if clamped 409 + movs r12, r11, asr #16 @ clamp r 410 + mvnne r11, r12, lsr #16 @ 411 + movs r12, r7, asr #15 @ clamp g 412 + mvnne r7, r12, lsr #15 @ 413 + 15: @ no clamp @ 414 + @ 415 + ldrb r12, [r4], #1 @ r12 = Y' = *(Y'_p++) 416 + 417 + and r11, r11, #0xf800 @ pack pixel 418 + mov r11, r11, lsr #8 419 + and r7, r7, #0x7e00 420 + orr r11, r11, r7, lsr #12 421 + mov r7, r7, lsr#4 422 + orr r0, r7, r0, lsr #10 423 + 1: @ busy @ 424 + ldr r7, [r3] @ r7 = LCD1_BASE 425 + tst r7, #LCD1_BUSY_MASK @ bridge busy? 426 + bne 1b @ 427 + str r11, [r3, #0x10] @ send MSB 428 + 1: @ busy @ 429 + ldr r7, [r3] @ r7 = LCD1_BASE 430 + tst r7, #LCD1_BUSY_MASK @ bridge busy? 431 + bne 1b @ 432 + str r0, [r3, #0x10] @ send LSB 433 + 434 + sub r7, r12, #16 @ r7 = Y = (Y' - 16)*149 435 + add r12, r7, r7, asl #2 @ 436 + add r12, r12, r12, asl #4 @ 437 + add r7, r12, r7, asl #6 @ 438 + @ compute R, G, and B 439 + add r0, r8, r7 @ r0 = b' = Y + bu 440 + add r11, r9, r7, asl #1 @ r11 = r' = Y*2 + rv 441 + rsb r7, r10, r7 @ r7 = g' = Y + guv 442 + @ 443 + @ r8 = bu, r9 = rv, r10 = guv 444 + @ 445 + sub r12, r0, r0, lsr #5 @ r0 = 31/32*b' + b'/256 446 + add r0, r12, r0, lsr #8 @ 447 + @ 448 + sub r12, r11, r11, lsr #5 @ r11 = 31/32*r' + r'/256 449 + add r11, r12, r11, lsr #8 @ 450 + @ 451 + sub r12, r7, r7, lsr #6 @ r7 = 63/64*g' + g'/256 452 + add r7, r12, r7, lsr #8 @ 453 + @ 454 + add r12, r14, #0x300 @ 455 + @ 456 + add r0, r0, r12 @ b = r0 + delta 457 + add r11, r11, r12, lsl #1 @ r = r11 + delta*2 458 + add r7, r7, r12, lsr #1 @ g = r7 + delta/2 459 + @ 460 + orr r12, r0, r11, asr #1 @ check if clamping is needed... 461 + orr r12, r12, r7 @ ...at all 462 + movs r12, r12, asr #15 @ 463 + beq 15f @ no clamp @ 464 + movs r12, r0, asr #15 @ clamp b 465 + mvnne r0, r12, lsr #15 @ 466 + andne r0, r0, #0x7c00 @ mask b only if clamped 467 + movs r12, r11, asr #16 @ clamp r 468 + mvnne r11, r12, lsr #16 @ 469 + movs r12, r7, asr #15 @ clamp g 470 + mvnne r7, r12, lsr #15 @ 471 + 15: @ no clamp @ 472 + @ 473 + ldrb r12, [r4, r2] @ r12 = Y' = *(Y'_p + stride) 474 + 475 + and r11, r11, #0xf800 @ pack pixel 476 + mov r11, r11, lsr #8 477 + and r7, r7, #0x7e00 478 + orr r11, r11, r7, lsr #12 479 + mov r7, r7, lsr#4 480 + orr r0, r7, r0, lsr #10 481 + 1: @ busy @ 482 + ldr r7, [r3] @ r7 = LCD1_BASE 483 + tst r7, #LCD1_BUSY_MASK @ bridge busy? 484 + bne 1b @ 485 + str r11, [r3, #0x10] @ send MSB 486 + 1: @ busy @ 487 + ldr r7, [r3] @ r7 = LCD1_BASE 488 + tst r7, #LCD1_BUSY_MASK @ bridge busy? 489 + bne 1b @ 490 + str r0, [r3, #0x10] @ send LSB 491 + 492 + sub r7, r12, #16 @ r7 = Y = (Y' - 16)*149 493 + add r12, r7, r7, asl #2 @ 494 + add r12, r12, r12, asl #4 @ 495 + add r7, r12, r7, asl #6 @ 496 + @ compute R, G, and B 497 + add r0, r8, r7 @ r0 = b' = Y + bu 498 + add r11, r9, r7, asl #1 @ r11 = r' = Y*2 + rv 499 + rsb r7, r10, r7 @ r7 = g' = Y + guv 500 + @ 501 + sub r12, r0, r0, lsr #5 @ r0 = 31/32*b + b/256 502 + add r0, r12, r0, lsr #8 @ 503 + @ 504 + sub r12, r11, r11, lsr #5 @ r11 = 31/32*r + r/256 505 + add r11, r12, r11, lsr #8 @ 506 + @ 507 + sub r12, r7, r7, lsr #6 @ r7 = 63/64*g + g/256 508 + add r7, r12, r7, lsr #8 @ 509 + @ 510 + @ This element is zero - use r14 @ 511 + @ 512 + add r0, r0, r14 @ b = r0 + delta 513 + add r11, r11, r14, lsl #1 @ r = r11 + delta*2 514 + add r7, r7, r14, lsr #1 @ g = r7 + delta/2 515 + @ 516 + orr r12, r0, r11, asr #1 @ check if clamping is needed... 517 + orr r12, r12, r7 @ ...at all 518 + movs r12, r12, asr #15 @ 519 + beq 15f @ no clamp @ 520 + movs r12, r0, asr #15 @ clamp b 521 + mvnne r0, r12, lsr #15 @ 522 + andne r0, r0, #0x7c00 @ mask b only if clamped 523 + movs r12, r11, asr #16 @ clamp r 524 + mvnne r11, r12, lsr #16 @ 525 + movs r12, r7, asr #15 @ clamp g 526 + mvnne r7, r12, lsr #15 @ 527 + 15: @ no clamp @ 528 + 529 + and r11, r11, #0xf800 @ pack pixel 530 + mov r11, r11, lsr #8 531 + and r7, r7, #0x7e00 532 + orr r11, r11, r7, lsr #12 533 + mov r7, r7, lsr#4 534 + orr r0, r7, r0, lsr #10 535 + 1: @ busy @ 536 + ldr r7, [r3] @ r7 = LCD1_BASE 537 + tst r7, #LCD1_BUSY_MASK @ bridge busy? 538 + bne 1b @ 539 + str r11, [r3, #0x10] @ send MSB 540 + 1: @ busy @ 541 + ldr r7, [r3] @ r7 = LCD1_BASE 542 + tst r7, #LCD1_BUSY_MASK @ bridge busy? 543 + bne 1b @ 544 + str r0, [r3, #0x10] @ send LSB 545 + 546 + subs r1, r1, #2 @ subtract block from width 547 + bgt 10b @ loop line @ 548 + @ 549 + ldmfd sp!, { r4-r12, pc } @ restore registers and return 550 + .ltorg @ dump constant pool 551 + .size lcd_write_yuv420_lines_odither, .-lcd_write_yuv420_lines_odither
+375
firmware/target/arm/samsung/yh820/lcd-yh820.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2007 by Mark Arigo 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 "cpu.h" 23 + #include "lcd.h" 24 + #include "kernel.h" 25 + #include "system.h" 26 + 27 + /* Display status */ 28 + static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0; 29 + 30 + #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 31 + static bool is_lcd_enabled = true; 32 + #endif 33 + 34 + /* NOTE: the LCD is rotated 90 degrees */ 35 + 36 + /* LCD command set for Samsung S6B33B2 */ 37 + 38 + #define R_NOP 0x00 39 + #define R_OSCILLATION_MODE 0x02 40 + #define R_DRIVER_OUTPUT_MODE 0x10 41 + #define R_DCDC_SET 0x20 42 + #define R_BIAS_SET 0x22 43 + #define R_DCDC_CLOCK_DIV 0x24 44 + #define R_DCDC_AMP_ONOFF 0x26 45 + #define R_TEMP_COMPENSATION 0x28 46 + #define R_CONTRAST_CONTROL1 0x2a 47 + #define R_CONTRAST_CONTROL2 0x2b 48 + #define R_STANDBY_OFF 0x2c 49 + #define R_STANDBY_ON 0x2d 50 + #define R_DDRAM_BURST_OFF 0x2e 51 + #define R_DDRAM_BURST_ON 0x2f 52 + #define R_ADDRESSING_MODE 0x30 53 + #define R_ROW_VECTOR_MODE 0x32 54 + #define R_N_LINE_INVERSION 0x34 55 + #define R_FRAME_FREQ_CONTROL 0x36 56 + #define R_RED_PALETTE 0x38 57 + #define R_GREEN_PALETTE 0x3a 58 + #define R_BLUE_PALETTE 0x3c 59 + #define R_ENTRY_MODE 0x40 60 + #define R_X_ADDR_AREA 0x42 61 + #define R_Y_ADDR_AREA 0x43 62 + #define R_RAM_SKIP_AREA 0x45 63 + #define R_DISPLAY_OFF 0x50 64 + #define R_DISPLAY_ON 0x51 65 + #define R_SPEC_DISPLAY_PATTERN 0x53 66 + #define R_PARTIAL_DISPLAY_MODE 0x55 67 + #define R_PARTIAL_START_LINE 0x56 68 + #define R_PARTIAL_END_LINE 0x57 69 + #define R_AREA_SCROLL_MODE 0x59 70 + #define R_SCROLL_START_LINE 0x5a 71 + #define R_DATA_FORMAT_SELECT 0x60 72 + 73 + 74 + /* wait for LCD */ 75 + static inline void lcd_wait_write(void) 76 + { 77 + while (LCD1_CONTROL & LCD1_BUSY_MASK); 78 + } 79 + 80 + /* send LCD data */ 81 + static void lcd_send_data(unsigned data) 82 + { 83 + lcd_wait_write(); 84 + LCD1_DATA = data >> 8; 85 + lcd_wait_write(); 86 + LCD1_DATA = data & 0xff; 87 + } 88 + 89 + /* send LCD command */ 90 + static void lcd_send_command(unsigned cmd) 91 + { 92 + lcd_wait_write(); 93 + LCD1_CMD = cmd; 94 + } 95 + 96 + /* LCD init */ 97 + void lcd_init_device(void) 98 + { 99 + #if 0 100 + /* This is the init sequence from the yh820 OF bootloader */ 101 + unsigned long tmp; 102 + 103 + DEV_INIT1 &= ~0x3000; 104 + tmp = DEV_INIT1; 105 + DEV_INIT1 = tmp; 106 + DEV_INIT2 &= ~0x400; 107 + 108 + LCD1_CONTROL &= ~0x4; 109 + udelay(15); 110 + LCD1_CONTROL |= 0x4; 111 + 112 + LCD1_CONTROL = 0x680; 113 + LCD1_CONTROL = 0x684; 114 + 115 + LCD1_CONTROL |= 0x1; 116 + udelay(200); 117 + 118 + lcd_send_command(R_STANDBY_OFF); 119 + udelay(100000); 120 + 121 + lcd_send_command(R_DISPLAY_OFF); 122 + udelay(10000); 123 + 124 + lcd_send_command(R_OSCILLATION_MODE); 125 + lcd_send_command(0x01); 126 + udelay(30000); 127 + 128 + lcd_send_command(R_DCDC_SET); 129 + lcd_send_command(0x01); 130 + udelay(30000); 131 + 132 + lcd_send_command(R_DCDC_AMP_ONOFF); 133 + lcd_send_command(0x01); 134 + udelay(30000); 135 + 136 + lcd_send_command(R_DCDC_AMP_ONOFF); 137 + lcd_send_command(0x09); 138 + udelay(30000); 139 + 140 + lcd_send_command(R_DCDC_AMP_ONOFF); 141 + lcd_send_command(0x0b); 142 + udelay(30000); 143 + 144 + lcd_send_command(R_DCDC_AMP_ONOFF); 145 + lcd_send_command(0x0f); 146 + udelay(30000); 147 + 148 + lcd_send_command(R_DCDC_CLOCK_DIV); 149 + lcd_send_command(0x03); 150 + udelay(10000); 151 + 152 + lcd_send_command(R_CONTRAST_CONTROL1); 153 + lcd_send_command(0x89); 154 + udelay(10000); 155 + 156 + lcd_send_command(R_TEMP_COMPENSATION); 157 + lcd_send_command(0x01); 158 + udelay(10000); 159 + 160 + lcd_send_command(R_ADDRESSING_MODE); 161 + lcd_send_command(0x19); 162 + udelay(10000); 163 + 164 + lcd_send_command(R_ROW_VECTOR_MODE); 165 + lcd_send_command(0x00); 166 + udelay(10000); 167 + 168 + lcd_send_command(R_N_LINE_INVERSION); 169 + lcd_send_command(0x8b); 170 + udelay(10000); 171 + 172 + lcd_send_command(R_ENTRY_MODE); 173 + lcd_send_command(0x01); 174 + 175 + lcd_send_command(R_DRIVER_OUTPUT_MODE); 176 + lcd_send_command(0x34); 177 + udelay(10000); 178 + 179 + lcd_send_command(R_X_ADDR_AREA); /* vertical dimensions */ 180 + lcd_send_command(0x00); /* y1 */ 181 + lcd_send_command(LCD_HEIGHT - 1); /* y2 */ 182 + 183 + lcd_send_command(R_Y_ADDR_AREA); /* horizontal dimensions */ 184 + lcd_send_command(0x04); /* x1 + 4 */ 185 + lcd_send_command(LCD_WIDTH - 1 + 4); /* x2 + 4 */ 186 + udelay(100); 187 + 188 + lcd_send_command(R_BIAS_SET); 189 + lcd_send_command(0x01); 190 + 191 + lcd_send_command(R_DDRAM_BURST_OFF); 192 + udelay(100); 193 + 194 + lcd_send_command(R_DISPLAY_ON); 195 + udelay(30000); 196 + #endif 197 + } 198 + 199 + /*** hardware configuration ***/ 200 + int lcd_default_contrast(void) 201 + { 202 + return DEFAULT_CONTRAST_SETTING; 203 + } 204 + 205 + void lcd_set_contrast(int val) 206 + { 207 + lcd_send_command(R_CONTRAST_CONTROL1); 208 + lcd_send_command(val); 209 + } 210 + 211 + void lcd_set_invert_display(bool yesno) 212 + { 213 + /* TODO: Implement lcd_set_invert_display() */ 214 + (void)yesno; 215 + } 216 + 217 + #if defined(HAVE_LCD_ENABLE) 218 + void lcd_enable(bool yesno) 219 + { 220 + if (yesno == is_lcd_enabled) 221 + return; 222 + 223 + if ((is_lcd_enabled = yesno)) 224 + { 225 + lcd_send_command(R_STANDBY_OFF); 226 + lcd_send_command(R_DISPLAY_ON); 227 + lcd_activation_call_hook(); 228 + } 229 + else 230 + { 231 + lcd_send_command(R_STANDBY_ON); 232 + } 233 + } 234 + #endif 235 + 236 + #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 237 + bool lcd_active(void) 238 + { 239 + return is_lcd_enabled; 240 + } 241 + #endif 242 + 243 + #ifdef HAVE_LCD_FLIP 244 + /* turn the display upside down (call lcd_update() afterwards) */ 245 + /* Note: since the lcd is rotated, this will flip horiz instead of vert */ 246 + void lcd_set_flip(bool yesno) 247 + { 248 + lcd_send_command(R_DRIVER_OUTPUT_MODE); 249 + lcd_send_command(yesno ? 0x30 : 0x34); 250 + } 251 + #endif 252 + 253 + 254 + /*** update functions ***/ 255 + 256 + void lcd_yuv_set_options(unsigned options) 257 + { 258 + lcd_yuv_options = options; 259 + } 260 + 261 + /* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */ 262 + extern void lcd_write_yuv420_lines(unsigned char const * const src[3], 263 + int width, 264 + int stride); 265 + extern void lcd_write_yuv420_lines_odither(unsigned char const * const src[3], 266 + int width, 267 + int stride, 268 + int x_screen, /* To align dither pattern */ 269 + int y_screen); 270 + /* Performance function to blit a YUV bitmap directly to the LCD */ 271 + void lcd_blit_yuv(unsigned char * const src[3], 272 + int src_x, int src_y, int stride, 273 + int x, int y, int width, int height) 274 + { 275 + unsigned char const * yuv_src[3]; 276 + off_t z; 277 + 278 + /* Sorry, but width and height must be >= 2 or else */ 279 + width &= ~1; 280 + height >>= 1; 281 + 282 + z = stride*src_y; 283 + yuv_src[0] = src[0] + z + src_x; 284 + yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1); 285 + yuv_src[2] = src[2] + (yuv_src[1] - src[1]); 286 + 287 + lcd_send_command(R_ENTRY_MODE); 288 + lcd_send_command(0x03); 289 + 290 + lcd_send_command(R_Y_ADDR_AREA); 291 + lcd_send_command(x + 4); 292 + lcd_send_command(x + width - 1 + 4); 293 + 294 + if (lcd_yuv_options & LCD_YUV_DITHER) 295 + { 296 + do 297 + { 298 + lcd_send_command(R_X_ADDR_AREA); 299 + lcd_send_command(y); 300 + lcd_send_command(y + 1); 301 + 302 + lcd_write_yuv420_lines_odither(yuv_src, width, stride, x, y); 303 + yuv_src[0] += stride << 1; /* Skip down two luma lines */ 304 + yuv_src[1] += stride >> 1; /* Skip down one chroma line */ 305 + yuv_src[2] += stride >> 1; 306 + y += 2; 307 + } 308 + while (--height > 0); 309 + } 310 + else 311 + { 312 + do 313 + { 314 + lcd_send_command(R_X_ADDR_AREA); 315 + lcd_send_command(y); 316 + lcd_send_command(y + 1); 317 + 318 + lcd_write_yuv420_lines(yuv_src, width, stride); 319 + yuv_src[0] += stride << 1; /* Skip down two luma lines */ 320 + yuv_src[1] += stride >> 1; /* Skip down one chroma line */ 321 + yuv_src[2] += stride >> 1; 322 + y += 2; 323 + } 324 + while (--height > 0); 325 + } 326 + } 327 + 328 + /* Update the display. 329 + This must be called after all other LCD functions that change the display. */ 330 + void lcd_update(void) 331 + { 332 + lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT); 333 + } 334 + 335 + /* Update a fraction of the display. */ 336 + void lcd_update_rect(int x, int y, int width, int height) 337 + { 338 + const fb_data *addr; 339 + 340 + if (x + width >= LCD_WIDTH) 341 + width = LCD_WIDTH - x; 342 + if (y + height >= LCD_HEIGHT) 343 + height = LCD_HEIGHT - y; 344 + 345 + if ((width <= 0) || (height <= 0)) 346 + return; /* Nothing left to do. */ 347 + 348 + addr = &lcd_framebuffer[y][x]; 349 + 350 + if (width <= 1) { 351 + lcd_send_command(R_ENTRY_MODE); /* The X end address must be larger */ 352 + lcd_send_command(0x03); /* that the X start address, so we */ 353 + lcd_send_command(R_Y_ADDR_AREA); /* switch to vertical mode for */ 354 + lcd_send_command(x + 4); /* single column updates and set */ 355 + lcd_send_command(x + 1 + 4); /* the window width to 2 */ 356 + } else { 357 + lcd_send_command(R_ENTRY_MODE); 358 + lcd_send_command(0x01); 359 + lcd_send_command(R_Y_ADDR_AREA); 360 + lcd_send_command(x + 4); 361 + lcd_send_command(x + width - 1 + 4); 362 + } 363 + 364 + lcd_send_command(R_X_ADDR_AREA); 365 + lcd_send_command(y); 366 + lcd_send_command(y + height - 1); 367 + 368 + do { 369 + int w = width; 370 + do { 371 + lcd_send_data(*addr++); 372 + } while (--w > 0); 373 + addr += LCD_WIDTH - width; 374 + } while (--height > 0); 375 + }
+59
firmware/target/arm/samsung/yh820/powermgmt-yh820.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese 11 + * Revisions copyright (C) 2005 by Gerald Van Baren 12 + * 13 + * This program is free software; you can redistribute it and/or 14 + * modify it under the terms of the GNU General Public License 15 + * as published by the Free Software Foundation; either version 2 16 + * of the License, or (at your option) any later version. 17 + * 18 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 19 + * KIND, either express or implied. 20 + * 21 + ****************************************************************************/ 22 + 23 + #include "config.h" 24 + #include "adc.h" 25 + #include "powermgmt.h" 26 + 27 + /* TODO: Not yet calibrated */ 28 + 29 + const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = 30 + { 31 + 3695 32 + }; 33 + 34 + const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = 35 + { 36 + 3627 37 + }; 38 + 39 + /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ 40 + const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = 41 + { 42 + { 3695, 3714, 3772, 3791, 3811, 3850, 3908, 3985, 4024, 4111, 4198 } 43 + }; 44 + 45 + /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ 46 + const unsigned short percent_to_volt_charge[11] = 47 + { 48 + 3850, 3888, 3927, 3966, 4024, 4063, 4111, 4150, 4198, 4237, 4286 49 + }; 50 + 51 + #define BATTERY_SCALE_FACTOR 4650 52 + /* full-scale ADC readout (2^10) in millivolt */ 53 + 54 + /* Returns battery voltage from ADC [millivolts] */ 55 + unsigned int battery_adc_voltage(void) 56 + { 57 + /* return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; */ 58 + return 4100; 59 + }
+47
firmware/target/arm/samsung/yh920/backlight-yh920.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2006 by Barry Wardell 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 "cpu.h" 23 + #include "system.h" 24 + #include "backlight.h" 25 + #include "lcd.h" 26 + 27 + void _backlight_on(void) 28 + { 29 + #ifdef HAVE_LCD_SLEEP 30 + backlight_lcd_sleep_countdown(false); /* stop counter */ 31 + #endif 32 + #ifdef HAVE_LCD_ENABLE 33 + lcd_enable(true); /* power on lcd + visible display */ 34 + #endif 35 + GPIO_SET_BITWISE(GPIOB_OUTPUT_VAL, 0x2); 36 + } 37 + 38 + void _backlight_off(void) 39 + { 40 + GPIO_CLEAR_BITWISE(GPIOB_OUTPUT_VAL, 0x2); 41 + #ifdef HAVE_LCD_ENABLE 42 + lcd_enable(false); /* power off visible display */ 43 + #endif 44 + #ifdef HAVE_LCD_SLEEP 45 + backlight_lcd_sleep_countdown(true); /* start countdown */ 46 + #endif 47 + }
+294
firmware/target/arm/samsung/yh920/lcd-yh920.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2004 by Linus Nielsen Feltzing 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 + 23 + #include "system.h" 24 + #include "kernel.h" 25 + #include "lcd.h" 26 + 27 + /*** definitions ***/ 28 + 29 + /* LCD command codes */ 30 + #define LCD_CNTL_POWER_CONTROL 0x25 31 + #define LCD_CNTL_VOLTAGE_SELECT 0x2b 32 + #define LCD_CNTL_LINE_INVERT_DRIVE 0x36 33 + #define LCD_CNTL_GRAY_SCALE_PATTERN 0x39 34 + #define LCD_CNTL_TEMP_GRADIENT_SELECT 0x4e 35 + #define LCD_CNTL_OSC_FREQUENCY 0x5f 36 + #define LCD_CNTL_ON_OFF 0xae 37 + #define LCD_CNTL_OSC_ON_OFF 0xaa 38 + #define LCD_CNTL_OFF_MODE 0xbe 39 + #define LCD_CNTL_REVERSE 0xa6 40 + #define LCD_CNTL_ALL_LIGHTING 0xa4 41 + #define LCD_CNTL_COMMON_OUTPUT_STATUS 0xc4 42 + #define LCD_CNTL_COLUMN_ADDRESS_DIR 0xa0 43 + #define LCD_CNTL_NLINE_ON_OFF 0xe4 44 + #define LCD_CNTL_DISPLAY_MODE 0x66 45 + #define LCD_CNTL_DUTY_SET 0x6d 46 + #define LCD_CNTL_ELECTRONIC_VOLUME 0x81 47 + #define LCD_CNTL_DATA_INPUT_DIR 0x84 48 + #define LCD_CNTL_DISPLAY_START_LINE 0x8a 49 + #define LCD_CNTL_AREA_SCROLL 0x10 50 + 51 + #define LCD_CNTL_PAGE 0xb1 52 + #define LCD_CNTL_COLUMN 0x13 53 + #define LCD_CNTL_DATA_WRITE 0x1d 54 + 55 + /* lcd commands */ 56 + static void lcd_send_data(unsigned byte) 57 + { 58 + while (LCD1_CONTROL & LCD1_BUSY_MASK); /* wait for LCD */ 59 + LCD1_DATA = byte; 60 + } 61 + 62 + static void lcd_send_cmd(unsigned byte) 63 + { 64 + while (LCD1_CONTROL & LCD1_BUSY_MASK); /* wait for LCD */ 65 + LCD1_CMD = byte; 66 + } 67 + 68 + static void lcd_write_reg(unsigned cmd, unsigned data) 69 + { 70 + lcd_send_cmd(cmd); 71 + lcd_send_data(data); 72 + } 73 + 74 + static void lcd_write_reg_ex(unsigned cmd, unsigned data0, unsigned data1) 75 + { 76 + lcd_send_cmd(cmd); 77 + lcd_send_data(data0); 78 + lcd_send_data(data1); 79 + } 80 + 81 + /*** hardware configuration ***/ 82 + int lcd_default_contrast(void) 83 + { 84 + return DEFAULT_CONTRAST_SETTING; 85 + } 86 + 87 + void lcd_set_contrast(int val) 88 + { 89 + /* Keep val in acceptable hw range */ 90 + if (val < 0) 91 + val = 0; 92 + else if (val > 127) 93 + val = 127; 94 + 95 + lcd_write_reg_ex(LCD_CNTL_ELECTRONIC_VOLUME, val, -1); 96 + } 97 + 98 + void lcd_set_invert_display(bool yesno) 99 + { 100 + lcd_send_cmd(LCD_CNTL_REVERSE | (yesno?1:0)); 101 + } 102 + 103 + /* turn the display upside down (call lcd_update() afterwards) */ 104 + void lcd_set_flip(bool yesno) 105 + { 106 + if (yesno) 107 + { 108 + lcd_send_cmd(LCD_CNTL_COLUMN_ADDRESS_DIR | 1); 109 + lcd_send_cmd(LCD_CNTL_COMMON_OUTPUT_STATUS | 0); 110 + lcd_write_reg_ex(LCD_CNTL_DUTY_SET, 0x20, 0); 111 + } 112 + else 113 + { 114 + lcd_send_cmd(LCD_CNTL_COLUMN_ADDRESS_DIR | 0); 115 + lcd_send_cmd(LCD_CNTL_COMMON_OUTPUT_STATUS | 1); 116 + lcd_write_reg_ex(LCD_CNTL_DUTY_SET, 0x20, 1); 117 + } 118 + } 119 + 120 + void lcd_init_device(void) 121 + { 122 + #if 0 123 + /* This is the init sequence from the yh820 OF bootloader */ 124 + unsigned long tmp; 125 + 126 + DEV_INIT2 |= 0x400; 127 + 128 + DEV_INIT1 &= ~0x3000; 129 + tmp = DEV_INIT1; 130 + DEV_INIT1 = tmp; 131 + DEV_INIT2 &= ~0x400; 132 + 133 + LCD1_CONTROL &= ~0x4; 134 + udelay(15); 135 + LCD1_CONTROL |= 0x4; 136 + 137 + LCD1_CONTROL = 0x680; 138 + LCD1_CONTROL = 0x684; 139 + 140 + LCD1_CONTROL |= 0x1; 141 + 142 + lcd_send_cmd(LCD_CNTL_RESET); 143 + lcd_send_cmd(LCD_CNTL_DISCHARGE_ON_OFF | 0); 144 + lcd_send_cmd(LCD_CNTL_ON_OFF | 0); /* LCD OFF */ 145 + lcd_send_cmd(LCD_CNTL_COLUMN_ADDRESS_DIR | 0); /* Normal */ 146 + lcd_send_cmd(LCD_CNTL_COMMON_OUTPUT_STATUS | 0); /* Normal */ 147 + lcd_send_cmd(LCD_CNTL_REVERSE | 0); /* Reverse OFF */ 148 + lcd_send_cmd(LCD_CNTL_ALL_LIGHTING | 0); /* Normal */ 149 + lcd_write_reg_ex(LCD_CNTL_DUTY_SET, 0x1f, 0x00); 150 + lcd_send_cmd(LCD_CNTL_OFF_MODE | 1); /* OFF -> VCC on drivers */ 151 + lcd_write_reg(LCD_CNTL_VOLTAGE_SELECT, 0x03); 152 + lcd_write_reg(LCD_CNTL_ELECTRONIC_VOLUME, 0x40); 153 + lcd_write_reg(LCD_CNTL_TEMP_GRADIENT_SELECT, 0x00); 154 + lcd_write_reg(LCD_CNTL_LINE_INVERT_DRIVE, 0x1f); 155 + lcd_send_cmd(LCD_CNTL_NLINE_ON_OFF | 1); /* N-line ON */ 156 + lcd_write_reg(LCD_CNTL_OSC_FREQUENCY, 0x00); 157 + lcd_send_cmd(LCD_CNTL_OSC_ON_OFF | 1); /* Oscillator ON */ 158 + lcd_write_reg(LCD_CNTL_STEPUP_CK_FREQ, 0x03); 159 + lcd_write_reg(LCD_CNTL_POWER_CONTROL, 0x1c); 160 + lcd_write_reg(LCD_CNTL_POWER_CONTROL, 0x1e); 161 + lcd_write_reg(LCD_CNTL_DISPLAY_START_LINE, 0x00); 162 + lcd_send_cmd(LCD_CNTL_DATA_INPUT_DIR | 0); /* Column mode */ 163 + lcd_send_cmd(LCD_CNTL_DISPLAY_MODE, 0); /* Greyscale mode */ 164 + lcd_write_reg(LCD_CNTL_GRAY_SCALE_PATTERN, 0x52); 165 + lcd_send_cmd(LCD_CNTL_PARTIAL_DISPLAY_ON_OFF | 0); 166 + lcd_write_reg(LCD_CNTL_POWER_CONTROL, 0x1f); 167 + lcd_send_cmd(LCD_CNTL_ON_OFF | 1); /* LCD ON */ 168 + #endif 169 + } 170 + 171 + /*** update functions ***/ 172 + 173 + /* Performance function that works with an external buffer 174 + note that by and bheight are in 8-pixel units! */ 175 + void lcd_blit_mono(const unsigned char *data, int x, int by, int width, 176 + int bheight, int stride) 177 + { 178 + (void)data; 179 + (void)x; 180 + (void)by; 181 + (void)width; 182 + (void)bheight; 183 + (void)stride; 184 + 185 + #if 0 186 + /* This is from the h100 lcd code, perhaps we can adapt */ 187 + const unsigned char *src, *src_end; 188 + unsigned char *dst_u, *dst_l; 189 + static unsigned char upper[LCD_WIDTH] IBSS_ATTR; 190 + static unsigned char lower[LCD_WIDTH] IBSS_ATTR; 191 + unsigned int byte; 192 + 193 + by *= 2; 194 + 195 + while (bheight--) 196 + { 197 + src = data; 198 + src_end = data + width; 199 + dst_u = upper; 200 + dst_l = lower; 201 + do 202 + { 203 + byte = *src++; 204 + *dst_u++ = lcd_dibits[byte & 0x0F]; 205 + byte >>= 4; 206 + *dst_l++ = lcd_dibits[byte & 0x0F]; 207 + } 208 + while (src < src_end); 209 + 210 + lcd_write_reg_ex(LCD_CNTL_PAGE, by++, -1); 211 + lcd_write_reg_ex(LCD_CNTL_COLUMN, x, -1); 212 + lcd_send_cmd(LCD_CNTL_DATA_WRITE); 213 + lcd_write_data(upper, width); 214 + 215 + lcd_write_reg_ex(LCD_CNTL_PAGE, by++, -1); 216 + lcd_write_reg_ex(LCD_CNTL_COLUMN, x, -1); 217 + lcd_send_cmd(LCD_CNTL_DATA_WRITE); 218 + lcd_write_data(lower, width); 219 + 220 + data += stride; 221 + } 222 + #endif 223 + } 224 + 225 + /* Helper function for lcd_grey_phase_blit(). */ 226 + /* void lcd_grey_data(unsigned char *values, unsigned char *phases, int count); */ 227 + 228 + /* Performance function that works with an external buffer 229 + note that by and bheight are in 4-pixel units! */ 230 + void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases, 231 + int x, int by, int width, int bheight, int stride) 232 + { 233 + (void)values; 234 + (void)phases; 235 + (void)x; 236 + (void)by; 237 + (void)width; 238 + (void)bheight; 239 + (void)stride; 240 + 241 + #if 0 242 + /* This is from the h100 lcd code, perhaps we can adapt */ 243 + stride <<= 2; /* 4 pixels per block */ 244 + while (bheight--) 245 + { 246 + lcd_write_reg_ex(LCD_CNTL_PAGE, by++, -1); 247 + lcd_write_reg_ex(LCD_CNTL_COLUMN, x, -1); 248 + lcd_send_cmd(LCD_CNTL_DATA_WRITE); 249 + lcd_grey_data(values, phases, width); 250 + values += stride; 251 + phases += stride; 252 + } 253 + #endif 254 + } 255 + 256 + /* Update a fraction of the display. */ 257 + /* void lcd_update_rect(int, int, int, int) ICODE_ATTR; */ 258 + void lcd_update_rect(int x0, int y, int width, int height) 259 + { 260 + const fb_data *addr; 261 + int ymax; 262 + int x = x0; 263 + 264 + /* The Y coordinates have to work on even 8 pixel rows */ 265 + ymax = (y + height-1) >> 2; 266 + y >>= 2; 267 + 268 + if(x + width > LCD_WIDTH) 269 + width = LCD_WIDTH - x; 270 + if (width <= 0) 271 + return; /* nothing left to do, 0 is harmful to lcd_write_data() */ 272 + if(ymax >= LCD_FBHEIGHT) 273 + ymax = LCD_FBHEIGHT-1; 274 + 275 + /* Copy specified rectange bitmap to hardware */ 276 + for (; y <= ymax; y++) 277 + { 278 + lcd_write_reg(LCD_CNTL_PAGE, y); 279 + lcd_write_reg(LCD_CNTL_COLUMN, x0); 280 + 281 + addr = &lcd_framebuffer[y][x0]; 282 + 283 + lcd_send_cmd(LCD_CNTL_DATA_WRITE); 284 + for (x = x0; x < width; x++) 285 + lcd_send_data(*addr++); 286 + } 287 + } 288 + 289 + /* Update the display. 290 + This must be called after all other LCD functions that change the display. */ 291 + void lcd_update(void) 292 + { 293 + lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT); 294 + }
+59
firmware/target/arm/samsung/yh920/powermgmt-yh920.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese 11 + * Revisions copyright (C) 2005 by Gerald Van Baren 12 + * 13 + * This program is free software; you can redistribute it and/or 14 + * modify it under the terms of the GNU General Public License 15 + * as published by the Free Software Foundation; either version 2 16 + * of the License, or (at your option) any later version. 17 + * 18 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 19 + * KIND, either express or implied. 20 + * 21 + ****************************************************************************/ 22 + 23 + #include "config.h" 24 + #include "adc.h" 25 + #include "powermgmt.h" 26 + 27 + /* TODO: Not yet calibrated */ 28 + 29 + const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = 30 + { 31 + 3733 32 + }; 33 + 34 + const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = 35 + { 36 + 3627 37 + }; 38 + 39 + /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ 40 + const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = 41 + { 42 + { 3733, 3772, 3821, 3840, 3869, 3917, 3985, 4034, 4072, 4140, 4198 } 43 + }; 44 + 45 + /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ 46 + const unsigned short percent_to_volt_charge[11] = 47 + { 48 + 3956, 3995, 4024, 4043, 4063, 4082, 4111, 4140, 4179, 4218, 4266 49 + }; 50 + 51 + #define BATTERY_SCALE_FACTOR 4650 52 + /* full-scale ADC readout (2^10) in millivolt */ 53 + 54 + /* Returns battery voltage from ADC [millivolts] */ 55 + unsigned int battery_adc_voltage(void) 56 + { 57 + /* return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; */ 58 + return 4100; 59 + }
+47
firmware/target/arm/samsung/yh925/backlight-yh925.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2006 by Barry Wardell 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 "cpu.h" 23 + #include "system.h" 24 + #include "backlight.h" 25 + #include "lcd.h" 26 + 27 + void _backlight_on(void) 28 + { 29 + #ifdef HAVE_LCD_SLEEP 30 + backlight_lcd_sleep_countdown(false); /* stop counter */ 31 + #endif 32 + #ifdef HAVE_LCD_ENABLE 33 + lcd_enable(true); /* power on lcd + visible display */ 34 + #endif 35 + GPIO_SET_BITWISE(GPIOF_OUTPUT_VAL, 0x1); 36 + } 37 + 38 + void _backlight_off(void) 39 + { 40 + GPIO_CLEAR_BITWISE(GPIOF_OUTPUT_VAL, 0x1); 41 + #ifdef HAVE_LCD_ENABLE 42 + lcd_enable(false); /* power off visible display */ 43 + #endif 44 + #ifdef HAVE_LCD_SLEEP 45 + backlight_lcd_sleep_countdown(true); /* start countdown */ 46 + #endif 47 + }
+538
firmware/target/arm/samsung/yh925/lcd-as-yh925.S
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2007-2008 by Michael Sevakis 11 + * 12 + * H10 20GB LCD assembly routines 13 + * 14 + * This program is free software; you can redistribute it and/or 15 + * modify it under the terms of the GNU General Public License 16 + * as published by the Free Software Foundation; either version 2 17 + * of the License, or (at your option) any later version. 18 + * 19 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 20 + * KIND, either express or implied. 21 + * 22 + ****************************************************************************/ 23 + 24 + #include "config.h" 25 + #include "cpu.h" 26 + 27 + /**************************************************************************** 28 + * void lcd_write_yuv_420_lines(unsigned char const * const src[3], 29 + * int width, 30 + * int stride); 31 + * 32 + * |R| |1.000000 -0.000001 1.402000| |Y'| 33 + * |G| = |1.000000 -0.334136 -0.714136| |Pb| 34 + * |B| |1.000000 1.772000 0.000000| |Pr| 35 + * Scaled, normalized, rounded and tweaked to yield RGB 565: 36 + * |R| |74 0 101| |Y' - 16| >> 9 37 + * |G| = |74 -24 -51| |Cb - 128| >> 8 38 + * |B| |74 128 0| |Cr - 128| >> 9 39 + * 40 + * Write four RGB565 pixels in the following order on each loop: 41 + * 1 3 + > down 42 + * 2 4 \/ left 43 + */ 44 + .section .icode, "ax", %progbits 45 + .align 2 46 + .global lcd_write_yuv420_lines 47 + .type lcd_write_yuv420_lines, %function 48 + lcd_write_yuv420_lines: 49 + @ r0 = yuv_src 50 + @ r1 = width 51 + @ r2 = stride 52 + stmfd sp!, { r4-r12, lr } @ save non-scratch 53 + ldmia r0, { r4, r5, r6 } @ r4 = yuv_src[0] = Y'_p 54 + @ r5 = yuv_src[1] = Cb_p 55 + @ r6 = yuv_src[2] = Cr_p 56 + @ 57 + mov r0, #0x7000000c @ r0 = &LCD2_PORT = 0x70008a0c 58 + add r0, r0, #0x8a00 @ 59 + mov r14, #LCD2_DATA_MASK @ 60 + @ 61 + sub r2, r2, #1 @ Adjust stride because of increment 62 + 10: @ loop line @ 63 + ldrb r7, [r4], #1 @ r7 = *Y'_p++; 64 + ldrb r8, [r5], #1 @ r8 = *Cb_p++; 65 + ldrb r9, [r6], #1 @ r9 = *Cr_p++; 66 + @ 67 + sub r7, r7, #16 @ r7 = Y = (Y' - 16)*74 68 + add r12, r7, r7, asl #2 @ actually (Y' - 16)*37 and shift right 69 + add r7, r12, r7, asl #5 @ by one less when adding - same for all 70 + @ 71 + sub r8, r8, #128 @ Cb -= 128 72 + sub r9, r9, #128 @ Cr -= 128 73 + @ 74 + add r10, r9, r9, asl #1 @ r10 = Cr*51 + Cb*24 75 + add r10, r10, r10, asl #4 @ 76 + add r10, r10, r8, asl #3 @ 77 + add r10, r10, r8, asl #4 @ 78 + @ 79 + add r11, r9, r9, asl #2 @ r9 = Cr*101 80 + add r11, r11, r9, asl #5 @ 81 + add r9, r11, r9, asl #6 @ 82 + @ 83 + add r8, r8, #2 @ r8 = bu = (Cb*128 + 128) >> 8 84 + mov r8, r8, asr #2 @ 85 + add r9, r9, #256 @ r9 = rv = (r8 + 256) >> 9 86 + mov r9, r9, asr #9 @ 87 + rsb r10, r10, #128 @ r10 = guv = (-r9 + 128) >> 8 88 + mov r10, r10, asr #8 @ 89 + @ compute R, G, and B 90 + add r3, r8, r7, asr #8 @ r3 = b = (Y >> 9) + bu 91 + add r11, r9, r7, asr #8 @ r11 = r = (Y >> 9) + rv 92 + add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv 93 + @ 94 + orr r12, r3, r11 @ check if clamping is needed... 95 + orr r12, r12, r7, asr #1 @ ...at all 96 + cmp r12, #31 @ 97 + bls 15f @ no clamp @ 98 + cmp r3, #31 @ clamp b 99 + mvnhi r3, r3, asr #31 @ 100 + andhi r3, r3, #31 @ 101 + cmp r11, #31 @ clamp r 102 + mvnhi r11, r11, asr #31 @ 103 + andhi r11, r11, #31 @ 104 + cmp r7, #63 @ clamp g 105 + mvnhi r7, r7, asr #31 @ 106 + andhi r7, r7, #63 @ 107 + 15: @ no clamp @ 108 + @ 109 + ldrb r12, [r4, r2] @ r12 = Y' = *(Y'_p + stride) 110 + @ 111 + orr r3, r3, r11, lsl #11 @ r3 = b | (r << 11) 112 + orr r3, r3, r7, lsl #5 @ r3 |= (g << 5) 113 + @ 114 + orr r7, r14, r3, lsr #8 @ store pixel 115 + orr r11, r14, r3 @ 116 + 20: @ 117 + ldr r3, [r0] @ 118 + tst r3, #LCD2_BUSY_MASK @ 119 + bne 20b @ 120 + str r7, [r0] @ 121 + str r11, [r0] @ 122 + @ 123 + sub r7, r12, #16 @ r7 = Y = (Y' - 16)*74 124 + add r12, r7, r7, asl #2 @ 125 + add r7, r12, r7, asl #5 @ 126 + @ compute R, G, and B 127 + add r3, r8, r7, asr #8 @ r3 = b = (Y >> 9) + bu 128 + add r11, r9, r7, asr #8 @ r11 = r = (Y >> 9) + rv 129 + add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv 130 + @ 131 + orr r12, r3, r11 @ check if clamping is needed... 132 + orr r12, r12, r7, asr #1 @ ...at all 133 + cmp r12, #31 @ 134 + bls 15f @ no clamp @ 135 + cmp r3, #31 @ clamp b 136 + mvnhi r3, r3, asr #31 @ 137 + andhi r3, r3, #31 @ 138 + cmp r11, #31 @ clamp r 139 + mvnhi r11, r11, asr #31 @ 140 + andhi r11, r11, #31 @ 141 + cmp r7, #63 @ clamp g 142 + mvnhi r7, r7, asr #31 @ 143 + andhi r7, r7, #63 @ 144 + 15: @ no clamp @ 145 + @ 146 + ldrb r12, [r4], #1 @ r12 = Y' = *(Y'_p++) 147 + @ 148 + orr r3, r3, r11, lsl #11 @ r3 = b | (r << 11) 149 + orr r3, r3, r7, lsl #5 @ r3 |= (g << 5) 150 + @ 151 + orr r7, r14, r3, lsr #8 @ store pixel 152 + orr r11, r14, r3 @ 153 + 20: @ 154 + ldr r3, [r0] @ 155 + tst r3, #LCD2_BUSY_MASK @ 156 + bne 20b @ 157 + str r7, [r0] @ 158 + str r11, [r0] @ 159 + @ 160 + sub r7, r12, #16 @ r7 = Y = (Y' - 16)*74 161 + add r12, r7, r7, asl #2 @ 162 + add r7, r12, r7, asl #5 @ 163 + @ compute R, G, and B 164 + add r3, r8, r7, asr #8 @ r3 = b = (Y >> 9) + bu 165 + add r11, r9, r7, asr #8 @ r11 = r = (Y >> 9) + rv 166 + add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv 167 + @ 168 + orr r12, r3, r11 @ check if clamping is needed... 169 + orr r12, r12, r7, asr #1 @ ...at all 170 + cmp r12, #31 @ 171 + bls 15f @ no clamp @ 172 + cmp r3, #31 @ clamp b 173 + mvnhi r3, r3, asr #31 @ 174 + andhi r3, r3, #31 @ 175 + cmp r11, #31 @ clamp r 176 + mvnhi r11, r11, asr #31 @ 177 + andhi r11, r11, #31 @ 178 + cmp r7, #63 @ clamp g 179 + mvnhi r7, r7, asr #31 @ 180 + andhi r7, r7, #63 @ 181 + 15: @ no clamp @ 182 + @ 183 + ldrb r12, [r4, r2] @ r12 = Y' = *(Y'_p + stride) 184 + @ 185 + orr r3, r3, r7, lsl #5 @ r3 = b | (g << 5) 186 + orr r3, r3, r11, lsl #11 @ r3 |= (r << 11) 187 + @ 188 + orr r7, r14, r3, lsr #8 @ store pixel 189 + orr r11, r14, r3 @ 190 + 20: @ 191 + ldr r3, [r0] @ 192 + tst r3, #LCD2_BUSY_MASK @ 193 + bne 20b @ 194 + str r7, [r0] @ 195 + str r11, [r0] @ 196 + @ 197 + sub r7, r12, #16 @ r7 = Y = (Y' - 16)*74 198 + add r12, r7, r7, asl #2 @ 199 + add r7, r12, r7, asl #5 @ 200 + @ compute R, G, and B 201 + add r3, r8, r7, asr #8 @ r3 = b = (Y >> 9) + bu 202 + add r11, r9, r7, asr #8 @ r11 = r = (Y >> 9) + rv 203 + add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv 204 + @ 205 + orr r12, r3, r11 @ check if clamping is needed... 206 + orr r12, r12, r7, asr #1 @ ...at all 207 + cmp r12, #31 @ 208 + bls 15f @ no clamp @ 209 + cmp r3, #31 @ clamp b 210 + mvnhi r3, r3, asr #31 @ 211 + andhi r3, r3, #31 @ 212 + cmp r11, #31 @ clamp r 213 + mvnhi r11, r11, asr #31 @ 214 + andhi r11, r11, #31 @ 215 + cmp r7, #63 @ clamp g 216 + mvnhi r7, r7, asr #31 @ 217 + andhi r7, r7, #63 @ 218 + 15: @ no clamp @ 219 + @ 220 + orr r3, r3, r11, lsl #11 @ r3 = b | (r << 11) 221 + orr r3, r3, r7, lsl #5 @ r3 |= (g << 5) 222 + @ 223 + orr r7, r14, r3, lsr #8 @ store pixel 224 + orr r11, r14, r3 @ 225 + 20: @ 226 + ldr r3, [r0] @ 227 + tst r3, #LCD2_BUSY_MASK @ 228 + bne 20b @ 229 + str r7, [r0] @ 230 + str r11, [r0] @ 231 + @ 232 + subs r1, r1, #2 @ subtract block from width 233 + bgt 10b @ loop line @ 234 + @ 235 + ldmfd sp!, { r4-r12, pc } @ restore registers and return 236 + .ltorg @ dump constant pool 237 + .size lcd_write_yuv420_lines, .-lcd_write_yuv420_lines 238 + 239 + 240 + /**************************************************************************** 241 + * void lcd_write_yuv_420_lines_odither(unsigned char const * const src[3], 242 + * int width, 243 + * int stride, 244 + * int x_screen, 245 + * int y_screen); 246 + * 247 + * |R| |1.000000 -0.000001 1.402000| |Y'| 248 + * |G| = |1.000000 -0.334136 -0.714136| |Pb| 249 + * |B| |1.000000 1.772000 0.000000| |Pr| 250 + * Red scaled at twice g & b but at same precision to place it in correct 251 + * bit position after multiply and leave instruction count lower. 252 + * |R| |258 0 408| |Y' - 16| 253 + * |G| = |149 -49 -104| |Cb - 128| 254 + * |B| |149 258 0| |Cr - 128| 255 + * 256 + * Write four RGB565 pixels in the following order on each loop: 257 + * 1 3 + > down 258 + * 2 4 \/ left 259 + * 260 + * Kernel pattern (raw|use order): 261 + * 5 3 4 2 row0 row2 > down 262 + * 1 7 0 6 | 5 1 3 7 4 0 2 6 col0 left 263 + * 4 2 5 3 | 4 0 2 6 5 1 3 7 col2 \/ 264 + * 0 6 1 7 265 + */ 266 + .section .icode, "ax", %progbits 267 + .align 2 268 + .global lcd_write_yuv420_lines_odither 269 + .type lcd_write_yuv420_lines_odither, %function 270 + lcd_write_yuv420_lines_odither: 271 + @ r0 = yuv_src 272 + @ r1 = width 273 + @ r2 = stride 274 + @ r3 = x_screen 275 + @ [sp] = y_screen 276 + stmfd sp!, { r4-r12, lr } @ save non-scratch 277 + ldmia r0, { r4, r5, r6 } @ r4 = yuv_src[0] = Y'_p 278 + @ r5 = yuv_src[1] = Cb_p 279 + @ r6 = yuv_src[2] = Cr_p 280 + @ 281 + ldr r0, [sp, #40] @ Line up pattern and kernel quadrant 282 + eor r14, r3, r0 @ 283 + and r14, r14, #0x2 @ 284 + mov r14, r14, lsl #6 @ 0x00 or 0x80 285 + @ 286 + mov r0, #0x7000000c @ r0 = &LCD2_PORT = 0x70008a0c 287 + add r0, r0, #0x8a00 @ 288 + @ 289 + sub r2, r2, #1 @ Adjust stride because of increment 290 + 10: @ loop line @ 291 + @ 292 + ldrb r7, [r4], #1 @ r7 = *Y'_p++; 293 + ldrb r8, [r5], #1 @ r8 = *Cb_p++; 294 + ldrb r9, [r6], #1 @ r9 = *Cr_p++; 295 + @ 296 + eor r14, r14, #0x80 @ flip pattern quadrant 297 + @ 298 + sub r7, r7, #16 @ r7 = Y = (Y' - 16)*149 299 + add r12, r7, r7, asl #2 @ 300 + add r12, r12, r12, asl #4 @ 301 + add r7, r12, r7, asl #6 @ 302 + @ 303 + sub r8, r8, #128 @ Cb -= 128 304 + sub r9, r9, #128 @ Cr -= 128 305 + @ 306 + add r10, r8, r8, asl #4 @ r10 = guv = Cr*104 + Cb*49 307 + add r10, r10, r8, asl #5 @ 308 + add r10, r10, r9, asl #3 @ 309 + add r10, r10, r9, asl #5 @ 310 + add r10, r10, r9, asl #6 @ 311 + @ 312 + mov r8, r8, asl #1 @ r8 = bu = Cb*258 313 + add r8, r8, r8, asl #7 @ 314 + @ 315 + add r9, r9, r9, asl #1 @ r9 = rv = Cr*408 316 + add r9, r9, r9, asl #4 @ 317 + mov r9, r9, asl #3 @ 318 + @ 319 + @ compute R, G, and B 320 + add r3, r8, r7 @ r3 = b' = Y + bu 321 + add r11, r9, r7, asl #1 @ r11 = r' = Y*2 + rv 322 + rsb r7, r10, r7 @ r7 = g' = Y + guv 323 + @ 324 + @ r8 = bu, r9 = rv, r10 = guv 325 + @ 326 + sub r12, r3, r3, lsr #5 @ r3 = 31/32*b + b/256 327 + add r3, r12, r3, lsr #8 @ 328 + @ 329 + sub r12, r11, r11, lsr #5 @ r11 = 31/32*r + r/256 330 + add r11, r12, r11, lsr #8 @ 331 + @ 332 + sub r12, r7, r7, lsr #6 @ r7 = 63/64*g + g/256 333 + add r7, r12, r7, lsr #8 @ 334 + @ 335 + add r12, r14, #0x200 @ 336 + @ 337 + add r3, r3, r12 @ b = r3 + delta 338 + add r11, r11, r12, lsl #1 @ r = r11 + delta*2 339 + add r7, r7, r12, lsr #1 @ g = r7 + delta/2 340 + @ 341 + orr r12, r3, r11, asr #1 @ check if clamping is needed... 342 + orr r12, r12, r7 @ ...at all 343 + movs r12, r12, asr #15 @ 344 + beq 15f @ no clamp @ 345 + movs r12, r3, asr #15 @ clamp b 346 + mvnne r3, r12, lsr #15 @ 347 + andne r3, r3, #0x7c00 @ mask b only if clamped 348 + movs r12, r11, asr #16 @ clamp r 349 + mvnne r11, r12, lsr #16 @ 350 + movs r12, r7, asr #15 @ clamp g 351 + mvnne r7, r12, lsr #15 @ 352 + 15: @ no clamp @ 353 + @ 354 + ldrb r12, [r4, r2] @ r12 = Y' = *(Y'_p + stride) 355 + @ 356 + and r11, r11, #0xf800 @ pack pixel 357 + and r7, r7, #0x7e00 @ r3 = pixel = (r & 0xf800) | 358 + orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) | 359 + orr r3, r11, r3, lsr #10 @ (b >> 10) 360 + @ 361 + mov r11, #LCD2_DATA_MASK @ store pixel 362 + orr r7, r11, r3, lsr #8 @ 363 + orr r11, r11, r3 @ 364 + 20: @ 365 + ldr r3, [r0] @ 366 + tst r3, #LCD2_BUSY_MASK @ 367 + bne 20b @ 368 + str r7, [r0] @ 369 + str r11, [r0] @ 370 + @ 371 + sub r7, r12, #16 @ r7 = Y = (Y' - 16)*149 372 + add r12, r7, r7, asl #2 @ 373 + add r12, r12, r12, asl #4 @ 374 + add r7, r12, r7, asl #6 @ 375 + @ compute R, G, and B 376 + add r3, r8, r7 @ r3 = b' = Y + bu 377 + add r11, r9, r7, asl #1 @ r11 = r' = Y*2 + rv 378 + rsb r7, r10, r7 @ r7 = g' = Y + guv 379 + @ 380 + sub r12, r3, r3, lsr #5 @ r3 = 31/32*b' + b'/256 381 + add r3, r12, r3, lsr #8 @ 382 + @ 383 + sub r12, r11, r11, lsr #5 @ r11 = 31/32*r' + r'/256 384 + add r11, r12, r11, lsr #8 @ 385 + @ 386 + sub r12, r7, r7, lsr #6 @ r7 = 63/64*g' + g'/256 387 + add r7, r12, r7, lsr #8 @ 388 + @ 389 + @ This element is zero - use r14 @ 390 + @ 391 + add r3, r3, r14 @ b = r3 + delta 392 + add r11, r11, r14, lsl #1 @ r = r11 + delta*2 393 + add r7, r7, r14, lsr #1 @ g = r7 + delta/2 394 + @ 395 + orr r12, r3, r11, asr #1 @ check if clamping is needed... 396 + orr r12, r12, r7 @ ...at all 397 + movs r12, r12, asr #15 @ 398 + beq 15f @ no clamp @ 399 + movs r12, r3, asr #15 @ clamp b 400 + mvnne r3, r12, lsr #15 @ 401 + andne r3, r3, #0x7c00 @ mask b only if clamped 402 + movs r12, r11, asr #16 @ clamp r 403 + mvnne r11, r12, lsr #16 @ 404 + movs r12, r7, asr #15 @ clamp g 405 + mvnne r7, r12, lsr #15 @ 406 + 15: @ no clamp @ 407 + @ 408 + ldrb r12, [r4], #1 @ r12 = Y' = *(Y'_p++) 409 + @ 410 + and r11, r11, #0xf800 @ pack pixel 411 + and r7, r7, #0x7e00 @ r3 = pixel = (r & 0xf800) | 412 + orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) | 413 + orr r3, r11, r3, lsr #10 @ (b >> 10) 414 + @ 415 + mov r11, #LCD2_DATA_MASK @ store pixel 416 + orr r7, r11, r3, lsr #8 @ 417 + orr r11, r11, r3 @ 418 + 20: @ 419 + ldr r3, [r0] @ 420 + tst r3, #LCD2_BUSY_MASK @ 421 + bne 20b @ 422 + str r7, [r0] @ 423 + str r11, [r0] @ 424 + @ 425 + sub r7, r12, #16 @ r7 = Y = (Y' - 16)*149 426 + add r12, r7, r7, asl #2 @ 427 + add r12, r12, r12, asl #4 @ 428 + add r7, r12, r7, asl #6 @ 429 + @ compute R, G, and B 430 + add r3, r8, r7 @ r3 = b' = Y + bu 431 + add r11, r9, r7, asl #1 @ r11 = r' = Y*2 + rv 432 + rsb r7, r10, r7 @ r7 = g' = Y + guv 433 + @ 434 + @ r8 = bu, r9 = rv, r10 = guv 435 + @ 436 + sub r12, r3, r3, lsr #5 @ r3 = 31/32*b' + b'/256 437 + add r3, r12, r3, lsr #8 @ 438 + @ 439 + sub r12, r11, r11, lsr #5 @ r11 = 31/32*r' + r'/256 440 + add r11, r12, r11, lsr #8 @ 441 + @ 442 + sub r12, r7, r7, lsr #6 @ r7 = 63/64*g' + g'/256 443 + add r7, r12, r7, lsr #8 @ 444 + @ 445 + add r12, r14, #0x100 @ 446 + @ 447 + add r3, r3, r12 @ b = r3 + delta 448 + add r11, r11, r12, lsl #1 @ r = r11 + delta*2 449 + add r7, r7, r12, lsr #1 @ g = r7 + delta/2 450 + @ 451 + orr r12, r3, r11, asr #1 @ check if clamping is needed... 452 + orr r12, r12, r7 @ ...at all 453 + movs r12, r12, asr #15 @ 454 + beq 15f @ no clamp @ 455 + movs r12, r3, asr #15 @ clamp b 456 + mvnne r3, r12, lsr #15 @ 457 + andne r3, r3, #0x7c00 @ mask b only if clamped 458 + movs r12, r11, asr #16 @ clamp r 459 + mvnne r11, r12, lsr #16 @ 460 + movs r12, r7, asr #15 @ clamp g 461 + mvnne r7, r12, lsr #15 @ 462 + 15: @ no clamp @ 463 + @ 464 + ldrb r12, [r4, r2] @ r12 = Y' = *(Y'_p + stride) 465 + @ 466 + and r11, r11, #0xf800 @ pack pixel 467 + and r7, r7, #0x7e00 @ r3 = pixel = (r & 0xf800) | 468 + orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) | 469 + orr r3, r11, r3, lsr #10 @ (b >> 10) 470 + @ 471 + mov r11, #LCD2_DATA_MASK @ store pixel 472 + orr r7, r11, r3, lsr #8 @ 473 + orr r11, r11, r3 @ 474 + 20: @ 475 + ldr r3, [r0] @ 476 + tst r3, #LCD2_BUSY_MASK @ 477 + bne 20b @ 478 + str r7, [r0] @ 479 + str r11, [r0] @ 480 + @ 481 + sub r7, r12, #16 @ r7 = Y = (Y' - 16)*149 482 + add r12, r7, r7, asl #2 @ 483 + add r12, r12, r12, asl #4 @ 484 + add r7, r12, r7, asl #6 @ 485 + @ compute R, G, and B 486 + add r3, r8, r7 @ r3 = b' = Y + bu 487 + add r11, r9, r7, asl #1 @ r11 = r' = Y*2 + rv 488 + rsb r7, r10, r7 @ r7 = g' = Y + guv 489 + @ 490 + sub r12, r3, r3, lsr #5 @ r3 = 31/32*b + b/256 491 + add r3, r12, r3, lsr #8 @ 492 + @ 493 + sub r12, r11, r11, lsr #5 @ r11 = 31/32*r + r/256 494 + add r11, r12, r11, lsr #8 @ 495 + @ 496 + sub r12, r7, r7, lsr #6 @ r7 = 63/64*g + g/256 497 + add r7, r12, r7, lsr #8 @ 498 + @ 499 + add r12, r14, #0x300 @ 500 + @ 501 + add r3, r3, r12 @ b = r3 + delta 502 + add r11, r11, r12, lsl #1 @ r = r11 + delta*2 503 + add r7, r7, r12, lsr #1 @ g = r7 + delta/2 504 + @ 505 + orr r12, r3, r11, asr #1 @ check if clamping is needed... 506 + orr r12, r12, r7 @ ...at all 507 + movs r12, r12, asr #15 @ 508 + beq 15f @ no clamp @ 509 + movs r12, r3, asr #15 @ clamp b 510 + mvnne r3, r12, lsr #15 @ 511 + andne r3, r3, #0x7c00 @ mask b only if clamped 512 + movs r12, r11, asr #16 @ clamp r 513 + mvnne r11, r12, lsr #16 @ 514 + movs r12, r7, asr #15 @ clamp g 515 + mvnne r7, r12, lsr #15 @ 516 + 15: @ no clamp @ 517 + @ 518 + and r11, r11, #0xf800 @ pack pixel 519 + and r7, r7, #0x7e00 @ r3 = pixel = (r & 0xf800) | 520 + orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) | 521 + orr r3, r11, r3, lsr #10 @ (b >> 10) 522 + @ 523 + mov r11, #LCD2_DATA_MASK @ store pixel 524 + orr r7, r11, r3, lsr #8 @ 525 + orr r11, r11, r3 @ 526 + 20: @ 527 + ldr r3, [r0] @ 528 + tst r3, #LCD2_BUSY_MASK @ 529 + bne 20b @ 530 + str r7, [r0] @ 531 + str r11, [r0] @ 532 + @ 533 + subs r1, r1, #2 @ subtract block from width 534 + bgt 10b @ loop line @ 535 + @ 536 + ldmfd sp!, { r4-r12, pc } @ restore registers and return 537 + .ltorg @ dump constant pool 538 + .size lcd_write_yuv420_lines_odither, .-lcd_write_yuv420_lines_odither
+638
firmware/target/arm/samsung/yh925/lcd-yh925.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2006 by Barry Wardell 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 "cpu.h" 23 + #include "lcd.h" 24 + #include "kernel.h" 25 + #include "system.h" 26 + 27 + /** Initialized in lcd_init_device() **/ 28 + /* Is the power turned on? */ 29 + static bool power_on; 30 + /* Is the display turned on? */ 31 + static bool display_on; 32 + /* Amount of vertical offset. Used for flip offset correction/detection. */ 33 + static int y_offset; 34 + /* Reverse flag. Must be remembered when display is turned off. */ 35 + static unsigned short disp_control_rev; 36 + /* Contrast setting << 8 */ 37 + static int lcd_contrast; 38 + 39 + static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0; 40 + 41 + /* Forward declarations */ 42 + #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 43 + static void lcd_display_off(void); 44 + #endif 45 + 46 + /* register defines for the Renesas HD66773R */ 47 + #define R_START_OSC 0x00 48 + #define R_DEVICE_CODE_READ 0x00 49 + #define R_DRV_OUTPUT_CONTROL 0x01 50 + #define R_DRV_AC_CONTROL 0x02 51 + #define R_POWER_CONTROL1 0x03 52 + #define R_POWER_CONTROL2 0x04 53 + #define R_ENTRY_MODE 0x05 54 + #define R_COMPARE_REG 0x06 55 + #define R_DISP_CONTROL 0x07 56 + #define R_FRAME_CYCLE_CONTROL 0x0b 57 + #define R_POWER_CONTROL3 0x0c 58 + #define R_POWER_CONTROL4 0x0d 59 + #define R_POWER_CONTROL5 0x0e 60 + #define R_GATE_SCAN_START_POS 0x0f 61 + #define R_VERT_SCROLL_CONTROL 0x11 62 + #define R_1ST_SCR_DRV_POS 0x14 63 + #define R_2ND_SCR_DRV_POS 0x15 64 + #define R_HORIZ_RAM_ADDR_POS 0x16 65 + #define R_VERT_RAM_ADDR_POS 0x17 66 + #define R_RAM_WRITE_DATA_MASK 0x20 67 + #define R_RAM_ADDR_SET 0x21 68 + #define R_WRITE_DATA_2_GRAM 0x22 69 + #define R_RAM_READ_DATA 0x22 70 + #define R_GAMMA_FINE_ADJ_POS1 0x30 71 + #define R_GAMMA_FINE_ADJ_POS2 0x31 72 + #define R_GAMMA_FINE_ADJ_POS3 0x32 73 + #define R_GAMMA_GRAD_ADJ_POS 0x33 74 + #define R_GAMMA_FINE_ADJ_NEG1 0x34 75 + #define R_GAMMA_FINE_ADJ_NEG2 0x35 76 + #define R_GAMMA_FINE_ADJ_NEG3 0x36 77 + #define R_GAMMA_GRAD_ADJ_NEG 0x37 78 + #define R_GAMMA_AMP_ADJ_POS 0x3a 79 + #define R_GAMMA_AMP_ADJ_NEG 0x3b 80 + 81 + static inline void lcd_wait_write(void) 82 + { 83 + while (LCD2_PORT & LCD2_BUSY_MASK); 84 + } 85 + 86 + /* Send command */ 87 + static inline void lcd_send_cmd(unsigned cmd) 88 + { 89 + lcd_wait_write(); 90 + LCD2_PORT = LCD2_CMD_MASK; /* Send MSB first (should always be 0) */ 91 + lcd_wait_write(); 92 + LCD2_PORT = LCD2_CMD_MASK | cmd; 93 + } 94 + 95 + /* Send 16-bit data */ 96 + static inline void lcd_send_data(unsigned data) 97 + { 98 + lcd_wait_write(); 99 + LCD2_PORT = (data >> 8) | LCD2_DATA_MASK; /* Send MSB first */ 100 + lcd_wait_write(); 101 + LCD2_PORT = (data & 0xff) | LCD2_DATA_MASK; 102 + } 103 + 104 + /* Send 16-bit data byte-swapped. Only needed until we can use block transfer. */ 105 + static inline void lcd_send_data_swapped(unsigned v) 106 + { 107 + lcd_wait_write(); 108 + LCD2_PORT = LCD2_DATA_MASK | (v & 0xff); /* Send LSB first */ 109 + LCD2_PORT = LCD2_DATA_MASK | (v >> 8); 110 + } 111 + 112 + /* Write value to register */ 113 + static void lcd_write_reg(int reg, int val) 114 + { 115 + lcd_send_cmd(reg); 116 + lcd_send_data(val); 117 + } 118 + 119 + /*** hardware configuration ***/ 120 + 121 + int lcd_default_contrast(void) 122 + { 123 + return DEFAULT_CONTRAST_SETTING; 124 + } 125 + 126 + void lcd_set_contrast(int val) 127 + { 128 + /* Clamp val in range 0-14, 16-30 */ 129 + if (val < 1) 130 + val = 0; 131 + else if (val <= 15) 132 + --val; 133 + else if (val > 30) 134 + val = 30; 135 + 136 + lcd_contrast = val << 8; 137 + 138 + if (!power_on) 139 + return; 140 + 141 + /* VCOMG=1, VDV4-0=xxxxx, VCM4-0=11000 */ 142 + lcd_write_reg(R_POWER_CONTROL5, 0x2018 | lcd_contrast); 143 + } 144 + 145 + void lcd_set_invert_display(bool yesno) 146 + { 147 + if (yesno == (disp_control_rev == 0x0000)) 148 + return; 149 + 150 + disp_control_rev = yesno ? 0x0000 : 0x0004; 151 + 152 + if (!display_on) 153 + return; 154 + 155 + /* PT1-0=00, VLE2-1=00, SPT=0, GON=1, DTE=1, REV=x, D1-0=11 */ 156 + lcd_write_reg(R_DISP_CONTROL, 0x0033 | disp_control_rev); 157 + } 158 + 159 + 160 + /* turn the display upside down (call lcd_update() afterwards) */ 161 + void lcd_set_flip(bool yesno) 162 + { 163 + /* NOT MODIFIED FOR THE YH-925 */ 164 + 165 + if (yesno == (y_offset != 0)) 166 + return; 167 + 168 + /* The LCD controller is 132x160 while the LCD itself is 128x160, so we need 169 + * to shift the origin by 4 when we flip the LCD */ 170 + y_offset = yesno ? 4 : 0; 171 + 172 + if (!power_on) 173 + return; 174 + 175 + /* SCN4-0=000x0 (G1/G160) */ 176 + lcd_write_reg(R_GATE_SCAN_START_POS, yesno ? 0x0002 : 0x0000); 177 + /* SM=0, GS=x, SS=x, NL4-0=10011 (G1-G160) */ 178 + lcd_write_reg(R_DRV_OUTPUT_CONTROL, yesno ? 0x0213 : 0x0113); 179 + } 180 + 181 + /* LCD init */ 182 + void lcd_init_device(void) 183 + { 184 + #if 0 185 + /* This is the OF LCD init */ 186 + int i; 187 + 188 + DEV_EN2 |= 0x2000; 189 + DEV_INIT1 |= 0xfc000000; 190 + CLCD_CLOCK_SRC &= ~0xf; 191 + DEV_INIT2 &= ~0x400; 192 + 193 + GPIOF_ENABLE |= 0x4; 194 + GPIOF_OUTPUT_EN |= 0x4; 195 + GPIOF_OUTPUT_VAL &= ~0x4; 196 + udelay(300000); 197 + GPIOF_OUTPUT_VAL |= 0x4; 198 + 199 + outl(0x220, 0x70008a00); 200 + outl(0x1f00, 0x70008a04); 201 + LCD2_BLOCK_CTRL = 0x10008080; 202 + LCD2_BLOCK_CONFIG = 0xf00000; 203 + udelay(100000); 204 + 205 + for (i = 0; i < 8; i++) 206 + { 207 + lcd_send_data(0); 208 + udelay(1); 209 + } 210 + 211 + lcd_write_reg(R_START_OSC, 0x0001); 212 + udelay(20000); 213 + lcd_write_reg(R_DRV_OUTPUT_CONTROL, 0x0315); 214 + lcd_write_reg(R_DRV_AC_CONTROL, 0x0700); 215 + lcd_write_reg(R_ENTRY_MODE, 0x1028); 216 + lcd_write_reg(R_COMPARE_REG, 0x0000); 217 + lcd_write_reg(R_FRAME_CYCLE_CONTROL, 0x4008); 218 + lcd_write_reg(R_RAM_ADDR_SET, 0x0000); 219 + lcd_write_reg(R_GAMMA_FINE_ADJ_POS1, 0x0700); 220 + lcd_write_reg(R_GAMMA_FINE_ADJ_POS2, 0x0000); 221 + lcd_write_reg(R_GAMMA_FINE_ADJ_POS3, 0x0000); 222 + lcd_write_reg(R_GAMMA_GRAD_ADJ_POS, 0x0100); 223 + lcd_write_reg(R_GAMMA_FINE_ADJ_NEG1, 0x0707); 224 + lcd_write_reg(R_GAMMA_FINE_ADJ_NEG2, 0x0007); 225 + lcd_write_reg(R_GAMMA_FINE_ADJ_NEG3, 0x0700); 226 + lcd_write_reg(R_GAMMA_GRAD_ADJ_NEG, 0x0001); 227 + lcd_write_reg(R_GATE_SCAN_START_POS, 0x0000); 228 + lcd_write_reg(R_VERT_SCROLL_CONTROL, 0x0000); 229 + lcd_write_reg(R_1ST_SCR_DRV_POS, 0xaf10); 230 + lcd_write_reg(R_2ND_SCR_DRV_POS, 0x0000); 231 + lcd_write_reg(R_HORIZ_RAM_ADDR_POS, 0x7f00); /* ((LCD_HEIGHT - 1) << 8 | 0 */ 232 + lcd_write_reg(R_VERT_RAM_ADDR_POS, 0xaf10); /* ((LCD_WIDTH + 16 - 1) << 8) | 16 */ 233 + lcd_write_reg(R_GAMMA_AMP_ADJ_POS, 0x1600); 234 + lcd_write_reg(R_GAMMA_AMP_ADJ_NEG, 0x0006); 235 + lcd_write_reg(R_DISP_CONTROL, 0x0104); 236 + lcd_write_reg(R_POWER_CONTROL4, 0x0100); 237 + lcd_write_reg(R_POWER_CONTROL5, 0x0d18); 238 + lcd_write_reg(R_POWER_CONTROL3, 0x0000); 239 + udelay(50000); 240 + lcd_write_reg(R_POWER_CONTROL1, 0x0008); 241 + lcd_write_reg(R_POWER_CONTROL3, 0x0000); 242 + lcd_write_reg(R_POWER_CONTROL2, 0x0000); 243 + udelay(50000); 244 + lcd_write_reg(R_POWER_CONTROL5, 0x2d18); 245 + lcd_write_reg(R_POWER_CONTROL3, 0x0000); 246 + udelay(50000); 247 + lcd_write_reg(R_POWER_CONTROL4, 0x0110); 248 + //~ lcd_clear_display(); 249 + lcd_write_reg(R_DISP_CONTROL, 0x0105); 250 + udelay(20000); 251 + lcd_write_reg(R_DISP_CONTROL, 0x0125); 252 + lcd_write_reg(R_DISP_CONTROL, 0x0127); 253 + udelay(20000); 254 + lcd_write_reg(R_DISP_CONTROL, 0x0137); 255 + lcd_send_cmd(R_WRITE_DATA_2_GRAM); 256 + 257 + GPIOF_ENABLE |= 0x02; 258 + GPIOF_OUTPUT_EN |= 0x02; 259 + GPIOF_OUTPUT_VAL |= 0x02; 260 + #endif 261 + 262 + #ifndef BOOTLOADER 263 + /* The OF won't boot if this is done in the bootloader - ideally we should 264 + tweak the lcd controller speed settings but this will do for now */ 265 + CLCD_CLOCK_SRC |= 0xc0000000; /* Set LCD interface clock to PLL */ 266 + #endif 267 + 268 + /* only these bits are needed from the OF init */ 269 + lcd_write_reg(R_DRV_OUTPUT_CONTROL, 0x0215); 270 + lcd_write_reg(R_ENTRY_MODE, 0x1028); 271 + 272 + power_on = true; 273 + display_on = true; 274 + y_offset = 0; 275 + disp_control_rev = 0x0004; 276 + lcd_contrast = DEFAULT_CONTRAST_SETTING << 8; 277 + } 278 + 279 + /* THE SLEEP AND POWER FUNCTIONS HAVE NOT BEEN MODIFIED FOR THE YH-925 */ 280 + 281 + #ifdef HAVE_LCD_SLEEP 282 + static void lcd_power_on(void) 283 + { 284 + /* Be sure standby bit is clear. */ 285 + /* BT2-0=000, DC2-0=000, AP2-0=000, SLP=0, STB=0 */ 286 + lcd_write_reg(R_POWER_CONTROL1, 0x0000); 287 + 288 + /** Power ON Sequence **/ 289 + /* Per datasheet Rev.1.10, Jun.21.2003, p. 99 */ 290 + 291 + lcd_write_reg(R_START_OSC, 0x0001); /* Start Oscillation */ 292 + /* 10ms or more for oscillation circuit to stabilize */ 293 + sleep(HZ/50); 294 + /* Instruction (1) for power setting; VC2-0, VRH3-0, CAD, 295 + VRL3-0, VCM4-0, VDV4-0 */ 296 + /* VC2-0=001 */ 297 + lcd_write_reg(R_POWER_CONTROL3, 0x0001); 298 + /* VRL3-0=0100, PON=0, VRH3-0=0001 */ 299 + lcd_write_reg(R_POWER_CONTROL4, 0x0401); 300 + /* CAD=1 */ 301 + lcd_write_reg(R_POWER_CONTROL2, 0x8000); 302 + /* VCOMG=0, VDV4-0=xxxxx (19), VCM4-0=11000 */ 303 + lcd_write_reg(R_POWER_CONTROL5, 0x0018 | lcd_contrast); 304 + /* Instruction (2) for power setting; BT2-0, DC2-0, AP2-0 */ 305 + /* BT2-0=000, DC2-0=001, AP2-0=011, SLP=0, STB=0 */ 306 + lcd_write_reg(R_POWER_CONTROL1, 0x002c); 307 + /* Instruction (3) for power setting; VCOMG = "1" */ 308 + /* VCOMG=1, VDV4-0=xxxxx (19), VCM4-0=11000 */ 309 + lcd_write_reg(R_POWER_CONTROL5, 0x2018 | lcd_contrast); 310 + 311 + /* 40ms or more; time for step-up circuits 1,2 to stabilize */ 312 + sleep(HZ/25); 313 + 314 + /* Instruction (4) for power setting; PON = "1" */ 315 + /* VRL3-0=0100, PON=1, VRH3-0=0001 */ 316 + lcd_write_reg(R_POWER_CONTROL4, 0x0411); 317 + 318 + /* 40ms or more; time for step-up circuit 4 to stabilize */ 319 + sleep(HZ/25); 320 + 321 + /* Instructions for other mode settings (in register order). */ 322 + /* SM=0, GS=x, SS=0, NL4-0=10011 (G1-G160)*/ 323 + lcd_write_reg(R_DRV_OUTPUT_CONTROL, y_offset ? 0x0013 : 0x0113); /* different to X5 */ 324 + /* FLD1-0=01 (1 field), B/C=1, EOR=1 (C-pat), NW5-0=000000 (1 row) */ 325 + lcd_write_reg(R_DRV_AC_CONTROL, 0x0700); 326 + /* DIT=0, BGR=1, HWM=0, I/D1-0=10, AM=1, LG2-0=000 */ 327 + lcd_write_reg(R_ENTRY_MODE, 0x1028); /* different to X5 */ 328 + /* CP15-0=0000000000000000 */ 329 + lcd_write_reg(R_COMPARE_REG, 0x0000); 330 + /* NO1-0=01, SDT1-0=00, EQ1-0=00, DIV1-0=00, RTN3-00000 */ 331 + lcd_write_reg(R_FRAME_CYCLE_CONTROL, 0x4000); 332 + /* SCN4-0=000x0 (G1/G160) */ 333 + /* lcd_write_reg(R_GATE_SCAN_START_POS, y_offset ? 0x0000 : 0x0002); */ 334 + /* VL7-0=0x00 */ 335 + lcd_write_reg(R_VERT_SCROLL_CONTROL, 0x0000); 336 + /* SE17-10(End)=0x9f (159), SS17-10(Start)=0x00 */ 337 + lcd_write_reg(R_1ST_SCR_DRV_POS, 0x9f00); 338 + /* SE27-20(End)=0x5c (92), SS27-20(Start)=0x00 */ 339 + lcd_write_reg(R_2ND_SCR_DRV_POS, 0x5c00); 340 + /* HEA7-0=7f, HSA7-0=00 */ 341 + lcd_write_reg(R_HORIZ_RAM_ADDR_POS, 0x7f00); 342 + /* PKP12-10=0x0, PKP02-00=0x0 */ 343 + lcd_write_reg(R_GAMMA_FINE_ADJ_POS1, 0x0003); 344 + /* PKP32-30=0x4, PKP22-20=0x0 */ 345 + lcd_write_reg(R_GAMMA_FINE_ADJ_POS2, 0x0400); 346 + /* PKP52-50=0x4, PKP42-40=0x7 */ 347 + lcd_write_reg(R_GAMMA_FINE_ADJ_POS3, 0x0407); 348 + /* PRP12-10=0x3, PRP02-00=0x5 */ 349 + lcd_write_reg(R_GAMMA_GRAD_ADJ_POS, 0x0305); 350 + /* PKN12-10=0x0, PKN02-00=0x3 */ 351 + lcd_write_reg(R_GAMMA_FINE_ADJ_NEG1, 0x0003); 352 + /* PKN32-30=0x7, PKN22-20=0x4 */ 353 + lcd_write_reg(R_GAMMA_FINE_ADJ_NEG2, 0x0704); 354 + /* PKN52-50=0x4, PRN42-40=0x7 */ 355 + lcd_write_reg(R_GAMMA_FINE_ADJ_NEG3, 0x0407); 356 + /* PRN12-10=0x5, PRN02-00=0x3 */ 357 + lcd_write_reg(R_GAMMA_GRAD_ADJ_NEG, 0x0503); 358 + /* VRP14-10=0x14, VRP03-00=0x09 */ 359 + lcd_write_reg(R_GAMMA_AMP_ADJ_POS, 0x1409); 360 + /* VRN14-00=0x06, VRN03-00=0x02 */ 361 + lcd_write_reg(R_GAMMA_AMP_ADJ_NEG, 0x0602); 362 + 363 + /* 100ms or more; time for step-up circuits to stabilize */ 364 + sleep(HZ/10); 365 + 366 + power_on = true; 367 + } 368 + 369 + static void lcd_power_off(void) 370 + { 371 + /* Display must be off first */ 372 + if (display_on) 373 + lcd_display_off(); 374 + 375 + power_on = false; 376 + 377 + /** Power OFF sequence **/ 378 + /* Per datasheet Rev.1.10, Jun.21.2003, p. 99 */ 379 + 380 + /* Step-up1 halt setting bit */ 381 + /* BT2-0=110, DC2-0=001, AP2-0=011, SLP=0, STB=0 */ 382 + lcd_write_reg(R_POWER_CONTROL1, 0x062c); 383 + /* Step-up3,4 halt setting bit */ 384 + /* VRL3-0=0100, PON=0, VRH3-0=0001 */ 385 + lcd_write_reg(R_POWER_CONTROL4, 0x0401); 386 + /* VCOMG=0, VDV4-0=10011, VCM4-0=11000 */ 387 + lcd_write_reg(R_POWER_CONTROL5, 0x0018 | lcd_contrast); 388 + 389 + /* Wait 100ms or more */ 390 + sleep(HZ/10); 391 + 392 + /* Step-up2,amp halt setting bit */ 393 + /* BT2-0=000, DC2-0=000, AP2-0=000, SLP=0, STB=0 */ 394 + lcd_write_reg(R_POWER_CONTROL1, 0x0000); 395 + } 396 + 397 + void lcd_sleep(void) 398 + { 399 + if (power_on) 400 + lcd_power_off(); 401 + 402 + /* Set standby mode */ 403 + /* BT2-0=000, DC2-0=000, AP2-0=000, SLP=0, STB=1 */ 404 + lcd_write_reg(R_POWER_CONTROL1, 0x0001); 405 + } 406 + #endif 407 + 408 + #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 409 + static void lcd_display_off(void) 410 + { 411 + display_on = false; 412 + 413 + /** Display OFF sequence **/ 414 + /* Per datasheet Rev.1.10, Jun.21.2003, p. 97 */ 415 + 416 + /* EQ1-0=00 already */ 417 + 418 + /* PT1-0=00, VLE2-1=00, SPT=0, GON=1, DTE=1, REV=x, D1-0=10 */ 419 + lcd_write_reg(R_DISP_CONTROL, 0x0032 | disp_control_rev); 420 + 421 + sleep(HZ/25); /* Wait 2 frames or more */ 422 + 423 + /* PT1-0=00, VLE2-1=00, SPT=0, GON=1, DTE=0, REV=x, D1-0=10 */ 424 + lcd_write_reg(R_DISP_CONTROL, 0x0022 | disp_control_rev); 425 + 426 + sleep(HZ/25); /* Wait 2 frames or more */ 427 + 428 + /* PT1-0=00, VLE2-1=00, SPT=0, GON=0, DTE=0, REV=0, D1-0=00 */ 429 + lcd_write_reg(R_DISP_CONTROL, 0x0000); 430 + } 431 + #endif 432 + 433 + #if defined(HAVE_LCD_ENABLE) 434 + static void lcd_display_on(void) 435 + { 436 + /* Be sure power is on first */ 437 + if (!power_on) 438 + lcd_power_on(); 439 + 440 + /** Display ON Sequence **/ 441 + /* Per datasheet Rev.1.10, Jun.21.2003, p. 97 */ 442 + 443 + /* PT1-0=00, VLE2-1=00, SPT=0, GON=0, DTE=0, REV=0, D1-0=01 */ 444 + lcd_write_reg(R_DISP_CONTROL, 0x0001); 445 + 446 + sleep(HZ/25); /* Wait 2 frames or more */ 447 + 448 + /* PT1-0=00, VLE2-1=00, SPT=0, GON=1, DTE=0, REV=x, D1-0=01 */ 449 + lcd_write_reg(R_DISP_CONTROL, 0x0021 | disp_control_rev); 450 + /* PT1-0=00, VLE2-1=00, SPT=0, GON=1, DTE=0, REV=x, D1-0=11 */ 451 + lcd_write_reg(R_DISP_CONTROL, 0x0023 | disp_control_rev); 452 + 453 + sleep(HZ/25); /* Wait 2 frames or more */ 454 + 455 + /* PT1-0=00, VLE2-1=00, SPT=0, GON=1, DTE=1, REV=x, D1-0=11 */ 456 + lcd_write_reg(R_DISP_CONTROL, 0x0033 | disp_control_rev); 457 + 458 + display_on = true; 459 + } 460 + 461 + void lcd_enable(bool on) 462 + { 463 + if (on == display_on) 464 + return; 465 + 466 + if (on) 467 + { 468 + lcd_display_on(); 469 + /* Probably out of sync and we don't wanna pepper the code with 470 + lcd_update() calls for this. */ 471 + lcd_update(); 472 + lcd_activation_call_hook(); 473 + } 474 + else 475 + { 476 + lcd_display_off(); 477 + } 478 + } 479 + #endif 480 + 481 + #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 482 + bool lcd_active(void) 483 + { 484 + return display_on; 485 + } 486 + #endif 487 + 488 + /*** update functions ***/ 489 + 490 + void lcd_yuv_set_options(unsigned options) 491 + { 492 + lcd_yuv_options = options; 493 + } 494 + 495 + /* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */ 496 + extern void lcd_write_yuv420_lines(unsigned char const * const src[3], 497 + int width, 498 + int stride); 499 + extern void lcd_write_yuv420_lines_odither(unsigned char const * const src[3], 500 + int width, 501 + int stride, 502 + int x_screen, /* To align dither pattern */ 503 + int y_screen); 504 + 505 + /* Performance function to blit a YUV bitmap directly to the LCD */ 506 + void lcd_blit_yuv(unsigned char * const src[3], 507 + int src_x, int src_y, int stride, 508 + int x, int y, int width, int height) 509 + { 510 + const unsigned char *yuv_src[3]; 511 + const unsigned char *ysrc_max; 512 + int y0; 513 + int options; 514 + 515 + /* NOT MODIFIED FOR THE YH-925 */ 516 + 517 + if (!display_on) 518 + return; 519 + 520 + width &= ~1; 521 + height &= ~1; 522 + 523 + /* calculate the drawing region */ 524 + 525 + /* The 20GB LCD is actually 128x160 but rotated 90 degrees so the origin 526 + * is actually the bottom left and horizontal and vertical are swapped. 527 + * Rockbox expects the origin to be the top left so we need to use 528 + * 127 - y instead of just y */ 529 + 530 + /* max vert << 8 | start vert */ 531 + lcd_write_reg(R_VERT_RAM_ADDR_POS, ((x + width - 1) << 8) | x); 532 + 533 + y0 = LCD_HEIGHT - 1 - y + y_offset; 534 + 535 + /* DIT=0, BGR=1, HWM=0, I/D1-0=10, AM=0, LG2-0=000 */ 536 + lcd_write_reg(R_ENTRY_MODE, 0x1020); 537 + 538 + yuv_src[0] = src[0] + src_y * stride + src_x; 539 + yuv_src[1] = src[1] + (src_y * stride >> 2) + (src_x >> 1); 540 + yuv_src[2] = src[2] + (yuv_src[1] - src[1]); 541 + ysrc_max = yuv_src[0] + height * stride; 542 + 543 + options = lcd_yuv_options; 544 + 545 + do 546 + { 547 + /* max horiz << 8 | start horiz */ 548 + lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (y0 << 8) | (y0 - 1)); 549 + 550 + /* position cursor (set AD0-AD15) */ 551 + /* start vert << 8 | start horiz */ 552 + lcd_write_reg(R_RAM_ADDR_SET, (x << 8) | y0); 553 + 554 + /* start drawing */ 555 + lcd_send_cmd(R_WRITE_DATA_2_GRAM); 556 + 557 + if (options & LCD_YUV_DITHER) 558 + { 559 + lcd_write_yuv420_lines_odither(yuv_src, width, stride, 560 + x, y); 561 + y -= 2; 562 + } 563 + else 564 + { 565 + lcd_write_yuv420_lines(yuv_src, width, stride); 566 + } 567 + 568 + y0 -= 2; 569 + yuv_src[0] += stride << 1; 570 + yuv_src[1] += stride >> 1; 571 + yuv_src[2] += stride >> 1; 572 + } 573 + while (yuv_src[0] < ysrc_max); 574 + 575 + /* DIT=0, BGR=1, HWM=0, I/D1-0=10, AM=1, LG2-0=000 */ 576 + lcd_write_reg(R_ENTRY_MODE, 0x1028); 577 + } 578 + 579 + 580 + /* Update a fraction of the display. */ 581 + void lcd_update_rect(int x0, int y0, int width, int height) 582 + { 583 + int x1, y1; 584 + int lcd_x0, lcd_x1, lcd_y0, lcd_y1; 585 + unsigned short *addr; 586 + 587 + if (!display_on) 588 + return; 589 + 590 + /* calculate the drawing region */ 591 + y1 = (y0 + height) - 1; /* max vert */ 592 + x1 = (x0 + width) - 1; /* max horiz */ 593 + 594 + if(x1 >= LCD_WIDTH) 595 + x1 = LCD_WIDTH - 1; 596 + if (x1 <= 0) 597 + return; /* nothing left to do, 0 is harmful to lcd_write_data() */ 598 + if(y1 >= LCD_HEIGHT) 599 + y1 = LCD_HEIGHT-1; 600 + 601 + /* The LCD is actually 128x160 rotated 90 degrees */ 602 + lcd_x0 = (LCD_HEIGHT - 1) - y1 + 4; 603 + lcd_x1 = (LCD_HEIGHT - 1) - y0 + 4; 604 + lcd_y0 = x0 + 16; 605 + lcd_y1 = x1 + 16; 606 + 607 + /* set the drawing window */ 608 + lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (lcd_x1 << 8) | lcd_x0); 609 + lcd_write_reg(R_VERT_RAM_ADDR_POS, (lcd_y1 << 8) | lcd_y0); 610 + 611 + /* set the starting position */ 612 + lcd_write_reg(R_RAM_ADDR_SET, (lcd_y0 << 8) | lcd_x1); 613 + 614 + /* start drawing */ 615 + lcd_send_cmd(R_WRITE_DATA_2_GRAM); 616 + 617 + addr = (unsigned short*)&lcd_framebuffer[y0][x0]; 618 + 619 + int c, r; 620 + 621 + /* for each row */ 622 + for (r = 0; r < height; r++) { 623 + /* for each column */ 624 + for (c = 0; c < width; c++) { 625 + /* output 1 pixel */ 626 + lcd_send_data(*addr++); 627 + } 628 + 629 + addr += (LCD_WIDTH - width); 630 + } 631 + } 632 + 633 + /* Update the display. 634 + This must be called after all other LCD functions that change the display. */ 635 + void lcd_update(void) 636 + { 637 + lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT); 638 + }
+59
firmware/target/arm/samsung/yh925/powermgmt-yh925.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese 11 + * Revisions copyright (C) 2005 by Gerald Van Baren 12 + * 13 + * This program is free software; you can redistribute it and/or 14 + * modify it under the terms of the GNU General Public License 15 + * as published by the Free Software Foundation; either version 2 16 + * of the License, or (at your option) any later version. 17 + * 18 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 19 + * KIND, either express or implied. 20 + * 21 + ****************************************************************************/ 22 + 23 + #include "config.h" 24 + #include "adc.h" 25 + #include "powermgmt.h" 26 + 27 + /* TODO: Not yet calibrated */ 28 + 29 + const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = 30 + { 31 + 3733 32 + }; 33 + 34 + const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = 35 + { 36 + 3627 37 + }; 38 + 39 + /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ 40 + const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = 41 + { 42 + { 3733, 3772, 3821, 3840, 3869, 3917, 3985, 4034, 4072, 4140, 4198 } 43 + }; 44 + 45 + /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ 46 + const unsigned short percent_to_volt_charge[11] = 47 + { 48 + 3956, 3995, 4024, 4043, 4063, 4082, 4111, 4140, 4179, 4218, 4266 49 + }; 50 + 51 + #define BATTERY_SCALE_FACTOR 4650 52 + /* full-scale ADC readout (2^10) in millivolt */ 53 + 54 + /* Returns battery voltage from ADC [millivolts] */ 55 + unsigned int battery_adc_voltage(void) 56 + { 57 + /* return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; */ 58 + return 4100; 59 + }
+6
firmware/target/arm/system-pp502x.c
··· 141 141 usb_insert_int(); 142 142 } 143 143 /* end PHILIPS_HDD1630 */ 144 + #elif defined(SAMSUNG_YH820) || defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925) 145 + else if (CPU_HI_INT_STAT & GPIO0_MASK) { 146 + if (GPIOD_INT_STAT & 0x10) 147 + usb_insert_int(); 148 + } 149 + /* end SAMSUNG_YHxxx */ 144 150 #endif 145 151 #ifdef IPOD_ACCESSORY_PROTOCOL 146 152 else if (CPU_HI_INT_STAT & SER0_MASK) {
+7
firmware/target/arm/usb-fw-pp502x.c
··· 75 75 #define USB_GPIO GPIOE 76 76 #define USB_GPIO_MASK 0x04 77 77 #define USB_GPIO_VAL 0x04 78 + 79 + #elif defined(SAMSUNG_YH820) || defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925) 80 + /* GPIO D bit 4 is usb detect */ 81 + #define USB_GPIO GPIOD 82 + #define USB_GPIO_MASK 0x10 83 + #define USB_GPIO_VAL 0x10 84 + 78 85 #else 79 86 #error No USB GPIO config specified 80 87 #endif
+93 -19
tools/configure
··· 736 736 5) Ondio FM 15) H10 5/6Gb 25) Mini 1G 737 737 6) AV300 26) Mini 2G 738 738 ==Toshiba== 27) 1G, 2G 739 - 40) Gigabeat F 740 - ==Cowon/iAudio== 41) Gigabeat S ==SanDisk== 741 - 30) X5/X5V/X5L 50) Sansa e200 742 - 31) M5/M5L ==Tatung== 51) Sansa e200R 743 - 32) 7 60) Elio TPJ-1022 52) Sansa c200 744 - 33) D2 53) Sansa m200 745 - 34) M3/M3L ==Olympus== 54) Sansa c100 746 - 70) M:Robe 500 55) Sansa Clip 747 - ==Creative== 71) M:Robe 100 56) Sansa e200v2 748 - 90) Zen Vision:M 30GB 57) Sansa m200v4 749 - 91) Zen Vision:M 60GB ==Philips== 58) Sansa Fuze 750 - 92) Zen Vision 100) GoGear SA9200 59) Sansa c200v2 751 - 101) GoGear HDD1630/ 752 - HDD1830 ==Logik== 753 - ==Onda== 80) DAX 1GB MP3/DAB 754 - 120) VX747 ==Meizu== 755 - 121) VX767 110) M6SL ==Lyre project== 756 - 122) VX747+ 111) M6SP 130) Lyre proto 1 757 - 112) M3 739 + ==Cowon/iAudio== 40) Gigabeat F 740 + 30) X5/X5V/X5L 41) Gigabeat S ==SanDisk== 741 + 31) M5/M5L 50) Sansa e200 742 + 32) 7 ==Tatung== 51) Sansa e200R 743 + 33) D2 60) Elio TPJ-1022 52) Sansa c200 744 + 34) M3/M3L 53) Sansa m200 745 + ==Olympus== 54) Sansa c100 746 + ==Creative== 70) M:Robe 500 55) Sansa Clip 747 + 90) Zen Vision:M 30GB 71) M:Robe 100 56) Sansa e200v2 748 + 91) Zen Vision:M 60GB 57) Sansa m200v4 749 + 92) Zen Vision ==Philips== 58) Sansa Fuze 750 + 100) GoGear SA9200 59) Sansa c200v2 751 + ==Onda== 101) GoGear HDD1630/ 752 + 120) VX747 HDD1830 ==Logik== 753 + 121) VX767 80) DAX 1GB MP3/DAB 754 + 122) VX747+ ==Meizu== 755 + 110) M6SL ==Lyre project== 756 + ==Samsung== 111) M6SP 130) Lyre proto 1 757 + 140) YH-820 112) M3 758 + 141) YH-920 759 + 142) YH-925 758 760 EOF 759 761 760 762 buildfor=`input`; ··· 2046 2048 t_cpu="arm" 2047 2049 t_manufacturer="at91sam" 2048 2050 t_model="lyre_proto1" 2051 + ;; 2052 + 2053 + 140|yh_820) 2054 + target_id=57 2055 + modelname="yh_820" 2056 + target="-DSAMSUNG_YH820" 2057 + memory=32 # always 2058 + arm7tdmicc 2059 + tool="$rootdir/tools/scramble -mi4v2 -model=y820 -type=RBOS" 2060 + bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" 2061 + bmp2rb_native="$rootdir/tools/bmp2rb -f 4" 2062 + output="rockbox.mi4" 2063 + appextra="recorder:gui" 2064 + plugins="" 2065 + swcodec="yes" 2066 + boottool="$rootdir/tools/scramble -mi4v2 -model=y820 -type=RBBL" 2067 + bootoutput="FW_YH820.mi4" 2068 + # toolset is the tools within the tools directory that we build for 2069 + # this particular target. 2070 + toolset=$scramblebitmaptools 2071 + # architecture, manufacturer and model for the target-tree build 2072 + t_cpu="arm" 2073 + t_manufacturer="samsung" 2074 + t_model="yh820" 2075 + ;; 2076 + 2077 + 141|yh_920) 2078 + target_id=58 2079 + modelname="yh_920" 2080 + target="-DSAMSUNG_YH920" 2081 + memory=32 # always 2082 + arm7tdmicc 2083 + tool="$rootdir/tools/scramble -mi4v2 -model=y920 -type=RBOS" 2084 + bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" 2085 + bmp2rb_native="$rootdir/tools/bmp2rb -f 2" 2086 + output="rockbox.mi4" 2087 + appextra="recorder:gui" 2088 + plugins="" 2089 + swcodec="yes" 2090 + boottool="$rootdir/tools/scramble -mi4v2 -model=y920 -type=RBBL" 2091 + bootoutput="PP5020.mi4" 2092 + # toolset is the tools within the tools directory that we build for 2093 + # this particular target. 2094 + toolset=$scramblebitmaptools 2095 + # architecture, manufacturer and model for the target-tree build 2096 + t_cpu="arm" 2097 + t_manufacturer="samsung" 2098 + t_model="yh920" 2099 + ;; 2100 + 2101 + 142|yh_925) 2102 + target_id=59 2103 + modelname="yh_925" 2104 + target="-DSAMSUNG_YH925" 2105 + memory=32 # always 2106 + arm7tdmicc 2107 + tool="$rootdir/tools/scramble -mi4v2 -model=y925 -type=RBOS" 2108 + bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" 2109 + bmp2rb_native="$rootdir/tools/bmp2rb -f 4" 2110 + output="rockbox.mi4" 2111 + appextra="recorder:gui" 2112 + plugins="" 2113 + swcodec="yes" 2114 + boottool="$rootdir/tools/scramble -mi4v2 -model=y925 -type=RBBL" 2115 + bootoutput="FW_YH925.mi4" 2116 + # toolset is the tools within the tools directory that we build for 2117 + # this particular target. 2118 + toolset=$scramblebitmaptools 2119 + # architecture, manufacturer and model for the target-tree build 2120 + t_cpu="arm" 2121 + t_manufacturer="samsung" 2122 + t_model="yh925" 2049 2123 ;; 2050 2124 2051 2125 *)
+8 -1
tools/scramble.c
··· 122 122 "\t (X values: h100, h120, h140, h300, ipco, nano, ipvd, mn2g\n" 123 123 "\t ip3g, ip4g, mini, iax5, iam5, iam3, h10, h10_5gb,\n" 124 124 "\t tpj2, c200, e200, giga, gigs, m100, m500, d2,\n"); 125 - printf("\t 9200, 1630, ldax, m200, clip, e2v2, m2v4, fuze)\n"); 125 + printf("\t 9200, 1630, ldax, m200, clip, e2v2, m2v4, fuze,\n" 126 + "\t y820, y920, y925)\n"); 126 127 printf("\nNo option results in Archos standard player/recorder format.\n"); 127 128 128 129 exit(1); ··· 297 298 modelnum = 44; 298 299 else if (!strcmp(&argv[1][5], "x747")) 299 300 modelnum = 45; 301 + else if (!strcmp(&argv[1][5], "y820")) /* Samsung YH-820 */ 302 + modelnum = 57; 303 + else if (!strcmp(&argv[1][5], "y920")) /* Samsung YH-920 */ 304 + modelnum = 58; 305 + else if (!strcmp(&argv[1][5], "y925")) /* Samsung YH-925 */ 306 + modelnum = 59; 300 307 else { 301 308 fprintf(stderr, "unsupported model: %s\n", &argv[1][5]); 302 309 return 2;
uisimulator/sdl/UI-yh_820.bmp

This is a binary file and will not be displayed.

uisimulator/sdl/UI-yh_920.bmp

This is a binary file and will not be displayed.

uisimulator/sdl/UI-yh_925.bmp

This is a binary file and will not be displayed.

+36
uisimulator/sdl/button.c
··· 1101 1101 case SDLK_KP_ENTER: 1102 1102 new_btn = BUTTON_MENU; 1103 1103 break; 1104 + #elif CONFIG_KEYPAD == SAMSUNG_YH_PAD 1105 + case SDLK_KP4: 1106 + case SDLK_LEFT: 1107 + new_btn = BUTTON_LEFT; 1108 + break; 1109 + case SDLK_KP6: 1110 + case SDLK_RIGHT: 1111 + new_btn = BUTTON_RIGHT; 1112 + break; 1113 + case SDLK_KP8: 1114 + case SDLK_UP: 1115 + new_btn = BUTTON_UP; 1116 + break; 1117 + case SDLK_KP2: 1118 + case SDLK_DOWN: 1119 + new_btn = BUTTON_DOWN; 1120 + break; 1121 + case SDLK_KP5: 1122 + case SDLK_KP_ENTER: 1123 + new_btn = BUTTON_PLAY; 1124 + break; 1125 + case SDLK_KP9: 1126 + case SDLK_PAGEUP: 1127 + new_btn = BUTTON_FFWD; 1128 + break; 1129 + #ifdef SAMSUNG_YH820 1130 + case SDLK_KP7: 1131 + #else 1132 + case SDLK_KP3: 1133 + #endif 1134 + case SDLK_PAGEDOWN: 1135 + new_btn = BUTTON_REW; 1136 + break; 1137 + case SDLK_KP_PLUS: 1138 + new_btn = BUTTON_REC; 1139 + break; 1104 1140 #else 1105 1141 #error No keymap defined! 1106 1142 #endif /* CONFIG_KEYPAD */
+18
uisimulator/sdl/uisdl.h
··· 302 302 #define UI_LCD_POSX 45 /* x position of lcd */ 303 303 #define UI_LCD_POSY 90 /* y position of lcd */ 304 304 305 + #elif defined(SAMSUNG_YH820) 306 + #define UI_TITLE "Samsung YH-820" 307 + #define UI_WIDTH 368 /* width of GUI window */ 308 + #define UI_HEIGHT 428 /* height of GUI window */ 309 + #define UI_LCD_POSX 120 /* x position of lcd */ 310 + #define UI_LCD_POSY 75 /* y position of lcd */ 311 + 312 + #elif defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925) 313 + #ifdef SAMSUNG_YH920 314 + #define UI_TITLE "Samsung YH-920" 315 + #else 316 + #define UI_TITLE "Samsung YH-925" 317 + #endif 318 + #define UI_WIDTH 408 /* width of GUI window */ 319 + #define UI_HEIGHT 454 /* height of GUI window */ 320 + #define UI_LCD_POSX 124 /* x position of lcd */ 321 + #define UI_LCD_POSY 42 /* y position of lcd */ 322 + 305 323 #else 306 324 #error no UI defines 307 325 #endif