Tasklist
FS#12348 - [New Port] Samsung YP-R0: the first patches
| Task Type |
Patches |
| Category |
Configuration |
| Status |
Unconfirmed |
| Assigned To |
No-one |
| Player Type |
Another |
| Severity |
Low |
| Priority |
Normal |
| Reported Version |
Release 3.9 |
| Due in Version |
Undecided |
| Due Date |
Undecided |
| Percent Complete |
|
| Private |
No
|
|
Details
Hi all! As requested, I begin to attach there the patches to make RockBox running, as an application, to the Samsung YP-R0.
Maybe the things to check are:
- is the code clean? Can I continue in this way?
- Are the others platforms compiling as usual?
Then I will have the need for some hints :D
ps: for some reasons, I had to create 2 diff files. One for Rb in general, the other just for /target/hosted/ypr0...After that I will redownload entire svn appliying the patches, I hope this will solve!
General_YPR0_diff.diff
(93.2 KiB)
tools/configure | 28 ++
apps/plugins/mp3_encoder.c | 6
apps/plugins/stats.c | 3
apps/plugins/superdom.c | 8
apps/plugins/SOURCES.app_build | 6
apps/plugins/sliding_puzzle.c | 15 +
apps/plugins/flipit.c | 12 +
apps/plugins/SUBDIRS.app_build | 10
apps/plugins/chessbox/chessbox_pgn.h | 10
apps/plugins/oscilloscope.c | 17 +
apps/plugins/starfield.c | 10
apps/plugins/snake2.c | 9
apps/plugins/clix.c | 8
apps/plugins/midi/midiplay.c | 8
apps/plugins/snake.c | 8
apps/plugins/bounce.c | 8
apps/plugins/cube.c | 10
apps/plugins/minesweeper.c | 54 +++--
apps/plugins/lib/pluginlib_actions.c | 9
apps/plugins/snow.c | 3
apps/plugins/spacerocks.c | 9
apps/plugins/reversi/reversi-gui.h | 8
apps/plugins/logo.c | 7
apps/plugins/brickmania.c | 8
apps/plugins/blackjack.c | 16 +
apps/plugins/stopwatch.c | 8
apps/plugins/fractals/fractal.h | 12 +
apps/plugins/jewels.c | 10
apps/plugins/calculator.c | 102 +++++----
apps/plugins/SUBDIRS | 2
apps/plugins/rockpaint.c | 11 +
apps/plugins/pacbox/pacbox.h | 11 +
apps/plugins/fft/fft.c | 8
apps/plugins/xobox.c | 9
apps/plugins/pong.c | 32 +--
apps/plugins/text_viewer/tv_button.h | 10
apps/plugins/pegbox.c | 18 +
apps/plugins/sudoku/sudoku.h | 9
apps/plugins/zxbox/zxbox_keyb.c | 18 +
apps/plugins/zxbox/keymaps.h | 9
apps/plugins/rockblox1d.c | 4
apps/plugins/battery_bench.c | 7
apps/plugins/fireworks.c | 12 -
apps/plugins/rockblox.c | 12 +
apps/plugins/mpegplayer/mpegplayer.c | 9
apps/plugins/mpegplayer/mpeg_settings.c | 8
apps/plugins/solitaire.c | 18 +
apps/plugins/goban/goban.h | 10
apps/plugins/calendar.c | 10
apps/plugins/star.c | 17 +
apps/plugins/doom/i_video.c | 11 +
apps/plugins/imageviewer/imageviewer_button.h | 12 +
apps/plugins/vu_meter.c | 29 +-
apps/plugins/rockboy/rockboy.c | 12 +
apps/plugins/lamp.c | 6
apps/plugins/sokoban.c | 16 +
apps/plugins/chopper.c | 18 +
apps/plugins/matrix.c | 6
apps/plugins/chip8.c | 12 +
apps/plugins/chessclock.c | 10
apps/plugins/mosaique.c | 5
apps/plugins/wormlet.c | 10
apps/plugins/invadrox.c | 31 +-
apps/plugins/pdbox/pdbox.h | 17 +
apps/plugin.c | 11 +
apps/SOURCES | 2
apps/plugin.h | 10
apps/keymaps/keymap-ypr0.c | 271 ++++++++++++++++++++++++++
firmware/export/rbpaths.h | 20 +
firmware/export/config.h | 4
firmware/export/config/ypr0.h | 160 +++++++++++++++
firmware/system.c | 2
firmware/SOURCES | 28 ++
firmware/common/rbpaths.c | 41 ++-
74 files changed, 1270 insertions(+), 140 deletions(-)
Hosted_YPR0_diff.diff
(35.8 KiB)
firmware/target/hosted/ypr0/ascodec-ypr0.h | 98 ++++
firmware/target/hosted/ypr0/app/button-target.h | 37 -
firmware/target/hosted/ypr0/app/button-application.c | 77 +--
firmware/target/hosted/ypr0/pcm-sdl.c | 1
firmware/target/hosted/ypr0/button-sdl.h | 8
firmware/target/hosted/ypr0/system-sdl.c | 128 ++----
firmware/target/hosted/ypr0/backlight-target.c | 67 +++
firmware/target/hosted/ypr0/backlight-target.h | 31 +
firmware/target/hosted/ypr0/lcd-sdl.c | 2
firmware/target/hosted/ypr0/lcd-sdl.h | 4
firmware/target/hosted/ypr0/ascodec-ypr0.c | 101 ++++
firmware/target/hosted/ypr0/button-sdl.c | 391 +++----------------
12 files changed, 468 insertions(+), 477 deletions(-)
|
Loading...
Please use this ;)
I'm unhappy with the amount of copied code. Can't you use the existing files directly, like the paemo port does?
For lcd stuff, yes it's just a copy, as for kernel. With this you're right. I could simply eliminate them and "restore" original files.
With system-sdl I don't know. I guess it's more or less like buttons: we need code to manage cpu frequency, and for me that strictly a platform-defined thing, not to be put in a general one.
For the other things I will hear mgue, too. Maybe he has ideas hehe
Thanks for reviewing...
Maemo port I think.
Minor thing:
keymap-ypr0.c: 2010 Maurus Cuelenaere > 2011 Lorenzo Miori
@saratoga: yes I need to fix such things :D thanks (fixed)
And moreover I fixed all the ascodec read/write functions.
Now I need some ideas on how implement the audio control feature (volume, balance) without interfering with audio SDL<->alsa part. As I said as3543 codec functions are ready.
SDL audio must be 100% always; audio volume is controlled in the codec, audio streaming in alsa.
What are the reasons again for implementing backight and volume control via alsa (sorry if you already told me, but I forgot).
But indeed backlight isn't managed at all by the kernel (I remember you that we are on a player, no "real" OS functions, just the linux kernel inside.). So we need to manage it throug as3543.
For audio, we are a player. I cannot keep the alsa volume at 100% (hey the battery will die :D) and the use the SW volume mixer of SDL (it sucks, really...). We need quality.
Alsa driver by Samsung sucks too (no balancing, no nothing) so we need to control directly as3543 for volumes, not through alsa mixer.
Moreover: time isn't managed by the os. We have rtc device (but doing hwclock -h doesn't work, samsung app stores a time related value in /dev/stl1 1 mb nand raw partition) but still it would be better to manage it directly (to have wake up on alarm too maybe).
Headphone detection, still no clue how to implement it but it's an irq.
Battery voltages, no device for them (well there is /dev/r0Bat but I don't understand how to make it work lol). Again, as3543 rulez.
Then radio. There is a Samsung module. I need to understan ioctls codes. POssibly there is a freescale module to test, maybe it's compatbile.
We exploit RockBox as an application just for video and audio data streaming (and of course other things). But much is to be implemented ;)
I, though, can understand the desire to exploit more HW features. I think we even support the as3543 natively on some players?
SDL volume sucks, yes, it's not lossless at all. Having the HW @ max you can hear this when the song is finishing (fading out)...it's like it considers on the peaks. Difficult to explain.
And then battery consumption lol. It's consuming like a truck in this way :D
And for HW things, yes, I want and we must do it. Going under battery voltage isn't so fine (and having a battery indicator is something that's necessary on a player hehe)
Are you sure the battery consumption is much higher at higher volumes? In my experience with other Rockbox daps the volume has little to no influence on the battery.
Morover samsung didn't include the source of their modules :(
Well for the audio consume related..uhm...uhm...I always tought so, well even in the datasheet there is a picture saying 8 mW @ 102 dB - 4 mW @ 94....Bah I will see. Now I'll implement it to test. Of course I won't send another patch till we decide how to procede!
Thanks
It will fix/contain at least:
- performance optimized: SDL video part removed, used framebuffer directly instead. This mean rb will run fine on the OF kernel (solves lots of issues).
- ascodec register management it's fixed: next step is to integrate the already existing driver and make it work.
- keymaps heavily improved
- backlight improved, lcd goes to sleep to save power
Lorenzo92: What about your patch? Is it simple to help testing your patches (without risks to brick the player) ?
BUT I need to upload an updated and cleaned patch. Tomorrow or so I hope to do that, also with instructions ;)
you need to read on ABI forums for successfully compilation...
;)
it was necessary to have a decent volume without too many "low" volume levels...But since it doesn't mute completely when 0 volume, it needs some fine tuning!
A note is that samsung does the same, keeps constant DAC mixer and changes volume only. Indeed, needs testing + discussing.
Configure is changed so that it expects the toolchain in PATH, and PATHTOSDL must be set when running configure.
Note: I changed the directory to /mnt/media0/.rockbox (with dot), similar to native targets. Also the changed path handling means that gigabeat f/x/s themes from the theme site work ("/.rockbox" in the cfg is a magic for the real directory).
My alsa work is not in it, still working on it.
It also adds a nice CPU debug screen in System->Debug->View CPU stats.
I'd say this is nearly ready for SVN. I'm going to look at the keymaps before committing. After that, we need to figure out a proper installation routine and what to do about USB (switch/reboot into safe mode or implement in rockbox?)
New toolchain: http://www.alice-dsl.net/simonemartitz/rockbox/arm-ypr0-linux-gnueabi.zip (for 64bit linux)
Bump alsa buffer for less cpu usage and cpu freq stats (thanks to lorenzo)
Significantly changed keymaps.
Fixed LCD
The patch looks fine to me. Hopefully we can get it in soon.
Using the 3 scripts, {unpack,patch,pack}-firmware.sh, you can build such a patched firmware.
FFS: I'm unable to add MuonEncrypt. I tried lots of different filenames, even names of files that I can upload. Get it from http://www.alice-dsl.net/simonemartitz/rockbox/MuonEncrypt
CAUTION: Place the binary files (both!) where they belong (see the diff stat output below) to before making any attempt to patch a firmware. I could image that the usb safe mode is broken without safe_mode.raw.
This adds GPIO management possibility + the headphone sense!
So it adds to rockbox another interesting feature....
+ it has a GPIO list ("meaningful pins") updated and reviewed ;)
In attachment you can find the patch to enable (finally) the FM radio also on our YP-R0! ;)
At the moment RDS is not implemented, but I will find out how to enable it indeed.
"Basic" radio usage works perfectly, scan, tuning, etc everything the si4709 offers. Audio path switching works. It happens something that recovering audio playback from radio doesn't work anymore until a reboot: it is possibly related to ALSA crash, can we disable alsa when stopping a song?
To achieve the goal, I needed to write a new kernel module. In attachment the sources of it (need to see how to insert it in rockbox trunk...) and the binary version to do a quick test.
NOTE: to load the module, just
rmmod si470x.ko
insmod /mnt/media0/si4709.ko
Enjoy
Sorry :)
About the integration into the rockbox tree: I suggest putting the files required for build (i.e. the .c and .h plus necessary kernel headers) into utils/ypr0tools/su4700-module. Then compile it and put it into the rootfs of the patched firmware. I assume we don't need to change it anymore even for adding rds support?
But indeed to add RDS we don't need other features, maybe I need to delete the things related to the IRQ catcher. We will do this into rockbox in a thread (I've tried to copy the code from the fmradio-as3514 implementation, but the thread doesn't want to work, it crashes...not kind of thing I can manage :D)
So ok it should be fine having it into the firmware too ;)
By the way, don't forget to add the module loading lines to the startup script!
I looked at the code. I have some comments, but I would rather do that review on gerrit because it's a PITA here.
First of all, I compiled my module inserting it directly into the kernel provided with Samsung, but I'm pretty sure we can compile it with our toolchain. For example samsung did so in his "modules" (drivers) package into the opensource package. Still need to see how, but it's possible.
So the idea is to make it building when patching the firmware, am I correct? And then placing it to the modules folder, loading it by rockbox script blablabla
For the git question, yeah indeed, I tried to do that but I had problems while committing. I will retry asap, but I'm a little busy these days at university and more. So if you want, you could upload commit to git if you're willing. I won't complain if my name is not in the patch tracking :p