Friday, October 9, 2009

rootfs trial

I've spent much time playing with different build systems such as buildroot, openwrt and openembedded. And here's some conclusions:

  • X-based environment (even with kdrive) such as gpe are almost unsuitable on machines with 32mb ram. Xfbdev is too fat, it eats all memory, and leaves nothing for applications.
  • opie is usable, but too old. And unsupported.
  • the only way is directfb+gtk. gtk for directfb is well supported, because debian installer is gtk-directfb based. Also there's libsdl port to directfb. Neat :)
So, we need some gtk-based DE for PDA, but unfortunately almost all of them depends on X. I'm goint to try port gpe, or something like this on gtk-directfb after I'll finish kernel-side support for rx1950.

Stay tuned ;)

Tuesday, September 29, 2009

Some stuff for rx1950

New kernel (still without sound support), bootloader (haret) and rootfs are available.
Also here you'll find repo with packages for rx1950 :)

Thursday, September 24, 2009

LCD backlight

It seems that we have no more issues with LCD and backlight management. LCD switches on/off flawlessly, so does LCD backlight :)

I've just fixed a problem with backlight not enabling after it was disabled. I've discussed PWM-problems with my friend Ordog (it's his nickname), and he suggested to play with PWM frequency; he described how it can work, and proposed some reasons why it doesn't enable in my case. I decided that backlight needs wormup to switch on properly, I've checked this hypothesis - and it works! Backlight switches on properly after short "warmup". So, thanks to Ordog!

Yesterday I've submited my patchset to the linux-arm-kernel maillist. I still have no response about rx1950-related patches, but s3c2440-udc related patch brought up small discussion. You can read it on linux-arm-kernel maillist archive if you're interested in it :)

Tuesday, September 22, 2009

LCD: no more garbage

Finaly! I find out how to disable LCD without leaving garbage on it! It's time to polish my patches and send them upstream :)

I've used haret to capture gpio values.

Here's code to disable LCD sanely:

/* GPC11-GPC15->OUTPUT */
s3c2410_gpio_cfgpin(S3C2410_GPC11, S3C2410_GPIO_OUTPUT);
s3c2410_gpio_cfgpin(S3C2410_GPC12, S3C2410_GPIO_OUTPUT);
s3c2410_gpio_cfgpin(S3C2410_GPC13, S3C2410_GPIO_OUTPUT);
s3c2410_gpio_cfgpin(S3C2410_GPC14, S3C2410_GPIO_OUTPUT);
s3c2410_gpio_cfgpin(S3C2410_GPC15, S3C2410_GPIO_OUTPUT);

/* GPC11-GPC15->1 */
s3c2410_gpio_setpin(S3C2410_GPC8, 1);
s3c2410_gpio_setpin(S3C2410_GPC9, 1);
s3c2410_gpio_setpin(S3C2410_GPC10, 1);
s3c2410_gpio_setpin(S3C2410_GPC11, 1);
s3c2410_gpio_setpin(S3C2410_GPC12, 1);
s3c2410_gpio_setpin(S3C2410_GPC13, 1);
s3c2410_gpio_setpin(S3C2410_GPC14, 1);
s3c2410_gpio_setpin(S3C2410_GPC15, 1);

/* Wait a bit here... */
mdelay(100);

/* GPD2-GPD7->OUTPUT */
s3c2410_gpio_cfgpin(S3C2410_GPD2, S3C2410_GPIO_OUTPUT);
s3c2410_gpio_cfgpin(S3C2410_GPD3, S3C2410_GPIO_OUTPUT);
s3c2410_gpio_cfgpin(S3C2410_GPD4, S3C2410_GPIO_OUTPUT);
s3c2410_gpio_cfgpin(S3C2410_GPD5, S3C2410_GPIO_OUTPUT);
s3c2410_gpio_cfgpin(S3C2410_GPD6, S3C2410_GPIO_OUTPUT);
s3c2410_gpio_cfgpin(S3C2410_GPD7, S3C2410_GPIO_OUTPUT);

/* GPD11-GPD15->OUTPUT */
s3c2410_gpio_cfgpin(S3C2410_GPD11, S3C2410_GPIO_OUTPUT);
s3c2410_gpio_cfgpin(S3C2410_GPD12, S3C2410_GPIO_OUTPUT);
s3c2410_gpio_cfgpin(S3C2410_GPD13, S3C2410_GPIO_OUTPUT);
s3c2410_gpio_cfgpin(S3C2410_GPD14, S3C2410_GPIO_OUTPUT);
s3c2410_gpio_cfgpin(S3C2410_GPD15, S3C2410_GPIO_OUTPUT);

/* GPD2-GPD7->1, GPD11-GPD15->1 */
s3c2410_gpio_setpin(S3C2410_GPD2, 1);
s3c2410_gpio_setpin(S3C2410_GPD3, 1);
s3c2410_gpio_setpin(S3C2410_GPD4, 1);
s3c2410_gpio_setpin(S3C2410_GPD5, 1);
s3c2410_gpio_setpin(S3C2410_GPD6, 1);
s3c2410_gpio_setpin(S3C2410_GPD7, 1);
s3c2410_gpio_setpin(S3C2410_GPD11, 1);
s3c2410_gpio_setpin(S3C2410_GPD12, 1);
s3c2410_gpio_setpin(S3C2410_GPD13, 1);
s3c2410_gpio_setpin(S3C2410_GPD14, 1);
s3c2410_gpio_setpin(S3C2410_GPD15, 1);

/* Wait a bit here...*/
mdelay(100);

/* GPB0->OUTPUT, GPB0->0 */
s3c2410_gpio_setpin(S3C2410_GPB0, 0);
s3c2410_gpio_cfgpin(S3C2410_GPB0, S3C2410_GPIO_OUTPUT);

/* GPC1-GPC4->OUTPUT, GPC2->0 */
s3c2410_gpio_cfgpin(S3C2410_GPC1, S3C2410_GPIO_OUTPUT);
s3c2410_gpio_cfgpin(S3C2410_GPC2, S3C2410_GPIO_OUTPUT);
s3c2410_gpio_setpin(S3C2410_GPC2, 0);
s3c2410_gpio_cfgpin(S3C2410_GPC3, S3C2410_GPIO_OUTPUT);
s3c2410_gpio_cfgpin(S3C2410_GPC4, S3C2410_GPIO_OUTPUT);

/* GPC15-GPC11->0 */
s3c2410_gpio_setpin(S3C2410_GPC11, 0);
s3c2410_gpio_setpin(S3C2410_GPC12, 0);
s3c2410_gpio_setpin(S3C2410_GPC13, 0);
s3c2410_gpio_setpin(S3C2410_GPC14, 0);
s3c2410_gpio_setpin(S3C2410_GPC15, 0);

/* GPD15-GPD11->0, GPD3->GPD8->0 */
s3c2410_gpio_setpin(S3C2410_GPD11, 0);
s3c2410_gpio_setpin(S3C2410_GPD12, 0);
s3c2410_gpio_setpin(S3C2410_GPD13, 0);
s3c2410_gpio_setpin(S3C2410_GPD14, 0);
s3c2410_gpio_setpin(S3C2410_GPD15, 0);
s3c2410_gpio_setpin(S3C2410_GPD2, 0);
s3c2410_gpio_setpin(S3C2410_GPD3, 0);
s3c2410_gpio_setpin(S3C2410_GPD4, 0);
s3c2410_gpio_setpin(S3C2410_GPD5, 0);
s3c2410_gpio_setpin(S3C2410_GPD6, 0);
s3c2410_gpio_setpin(S3C2410_GPD7, 0);

/* GPC6->0, GPC7->0, GPC5->0 */
s3c2410_gpio_setpin(S3C2410_GPC6, 0);
s3c2410_gpio_setpin(S3C2410_GPC7, 0);
s3c2410_gpio_setpin(S3C2410_GPC5, 0);

/* GPB1->OUTPUT, GPB1->0 */
s3c2410_gpio_setpin(S3C2410_GPB1, 0);
s3c2410_gpio_cfgpin(S3C2410_GPB1, S3C2410_GPIO_OUTPUT);
pwm_config(lcd_power->pwm, 0, lcd_power->period);
pwm_disable(lcd_power->pwm);

/* GPC0->0, GPC10->0 */
s3c2410_gpio_setpin(S3C2410_GPC0, 0);
s3c2410_gpio_setpin(S3C2410_GPC10, 0);

Monday, September 21, 2009

Some words about what's going on...

I've got 5 minutes of spare time, so I decided to drop couple of lines into my blog.

I've started to bring up kernel from linus' tree on rx1950. Basic functional (no battery, no touchscreen, no sound, no wifi) works. I'm going to submit patches to linux-arm-kernel soon. (About touchscreen: I hope guys from openmoko kernel-team will submit their s3c-ts driver. If they don't I'll submit my own version.)

If anyone is interested, I can share patches. BTW, I doubt that they will be usefull for someone in current state :)

Tuesday, September 15, 2009

rx1950 and upstream haret

Finally got issue with mainline haret not booting linux on rx1950 fixed. It was so trivial... Haret modified by Denis Grigoriev initializes uart, mainline haret does not. Linux can't boot on s3c24xx with uart unitialized when it uses uart for low-level messages due to bug.

Fix for kernel was submited by Juergen Beisert in August, 2009 and can be found here.

Patches for haret (with workaround and proper rx1950 detection) can be found here.

Update: I've submited patch that adds configurable kernel offset to haret maillist. It seems that mainline haret will be able to boot linux on rx1950 soon :)

2nd update: My patches were included into mainline haret. Neat :)

Saturday, July 11, 2009

LVEE'09

Last week I took part in LVEE'09. LVEE stands for Linux Vacarion/Eastern Europe and it is an international conference of developers and users of free / open source software. Conference format includes reports, workshops, and round tables.

Unfortunately I had no time to prepare my own report, so I was just a listener. Report's thematic was very wide and included:
  • embedded and mobile linux (openmoko, maemo, and some proprietary solutions, for example one from zyxel)
  • IP-telephony solutions (asterisk)
  • using opensource software in different fields, such as: medicine, business, journalism
  • virtualization technologies
After reports in evening there were so-called non-formal discussions, where participants discuss about reports, share their experience, etc. Of course, important part of conference is cooking shish kebab :)

In general, lvee'09 was great!

Here's photo report:
http://picasaweb.google.com/anarsoul/LVEE09#

Lenovo 3000 N100 and ACPI

There was a bug in BIOS of my laptop that annoyed me for long time:

In two words, after resume from hibernate (suspend to disk) fan sticks to the one state. I.e. it's always working (annoying but not dangerous), or it's always stopped (dangerous, can cause overheat) - it's state is not depend on CPU temperature.

Here's some links about it:

http://bugzilla.kernel.org/show_bug.cgi?id=10223

https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.20/+bug/114312


Zhang Rui (thanks to him!) pointed right direction: he provided customized DSDT table with extra debug output in _TMP method. I've tried it, and it showed that one of two thermal sensors shows wrong info after resume. So I wrote new _TMP method that uses only one thermal sensor.

There was one more issue in BIOS - /proc/acpi/battery/BAT1/{info,state} shows hardcoded values, and doesn't perform real query to the smart battery.

I've googled a little bit and found this:
http://hughsient.livejournal.com/5884.html

So, after all I have custom DSDT table that works fine for me :)

Here's patch for DSDT table and here's manual that describes how to apply it.
Also consult http://www.lesswatts.org/projects/acpi/overridingDSDT.php

Wednesday, May 13, 2009

Stand by :)

Sorry for not posting new posts to the blog for a long time, but I was a bit busy.

rx1950 port development is suspended for a while. I'll continue porting aproximately in July.

In July I'm going to port patches to the latest kernel (2.6.31_rcs?), fix remaining sound driver issues, and then I'll start to submit patches upstream.

Thursday, February 12, 2009

uda1380 and its power issues

Good (and some bad) news :)

Last two (or even three) weeks I was working on improving sound driver. Now it works with correct sample rate (48khz), it plays sound first time (there was issue that first aplay produced no sound, it was bug in uda1380-driver, I've fixed it and sent fix upstream, it will be merged into 2.6.30 kernel). But there's some issues with codec power management.

I managed to disable/enable codec power, but now suspend issues appeared (no sound after resume). Here's some details:

We had one big problem: we need to disable codec power when sound is not used (it saves ~20-30 mA of battery consumption), but unfortunately, after powerup/powerdown/powerup sequence CPU was not able to communicate with codec over i2c. I've fixed it in i2c-s3c2410 driver (i2c clock need to be disabled if there's no i2c transfer around). But there's major issue: after resume there's no sound. I suspect it's something about i2s clock, I'm checking... :)

Btw, I'm very close to get basic rx1950 hardware working reliable and stable :)

Patches will be available on download site, but no precompiled kernel.

Stay tuned for latest news! :)

Friday, January 23, 2009

Power and PWM issues fixed.

Finally got power issues fixed. PDA doesn't consume power in suspend anymore (at least with sound driver unloaded). The thing was in incorrect poweroff sequence (just a small typo in code) for lcd and in mmc power management. Btw, after ~8h of sleep voltage on the battery is the same as before sleep.

Also I got s3c24xx pwm driver working flawlessly on rx1950. There were several bugs in it:

  • no resume handler. So after resume timer was not configured. Results: no backlight and lcd flickering
  • wrong configuration sequence. tcmp and tcnt registers were updated before manual_update flag was set.

I've fixed these bugs and submitted patches for pwm upstream. Hope to see them in next kernel versions :)

One more thing: battery driver was improved to display proper consumption in uA. I've used WM application - BattLog (thanks to its author(s)!) - to monitor battery and at the same time captured ADC values with haret. As result I've got multiplier for current value :)

The next step - sound driver. I'm going to implement power management for it and perform some cleanup.

P.S. Downloads site moved to ftp://downloads.tuxfamily.org/linuxrx1950/

Tuesday, January 13, 2009

Power management issues

It seems that code that puts rx1950 into sleep is not clear: even in sleep mode rx1950 consumes some power. After ~8h in sleep ~20% of battery was eaten :(

I suspect one cause of this problem can be sd/mmc card power management - it was not implemented for rx1950. So I implemented rx1950 s3c2410_mmc_def_setpower function that controls sd/mmc card power. When GPJ1 == 0 card is not powered, when GPJ0 == 1 card is powered.

Some info about card-related gpios:

GPJ1 - controls card power (1 == on)
GPH8 - ro sense, (1 == rw, 0 == ro)
GPF5 - card detection

Latest patch is available here
Precompiled kernel and sound modules are available here

Monday, January 12, 2009

Points 0 and 1 completed :)

Yep, I've just finished rewriting touchscreen and battery drivers to use s3c24xx_adc driver instead using adc directly. It was relatively easy :)

No more adc_battery driver (s3c24xx_adc is not adc-class compliant, and I was too lazy to port adc-class to 2.6.28). I rewrote adc_battery to use s3c24xx_adc driver directly, and named it s3c_adc_battery :)

And with touchscreen it was much easier: just add some #includes, add adc_client field to device struct, add 2 callback implementations, add some lines about registering as adc_client, and replace some lines that start adc conversion... That's all.

Patch is available here

P.S. It seems touchscreen driver needs some filtering... I'll look what openmoko guys made to implement touchscreen filtering.

Sunday, January 4, 2009

2.6.28 on rx1950

I've spent a day porting old patches to the new kernel, and here's results:

2.6.28-04-jan-2009.tar.bz2

Almost all is working, except wifi (need to port acx100 driver to the 2.6.28 kernel) and battery driver (need to adapt it and touchscreen driver to the new s3c24xx_adc driver)

Following tasks are on going:

0. Port touchscreen driver to use s3c24xx_adc

1. Re-implement battery driver

2. Fix sound problems (incorrect sample rate, find out why it doesn't play first time).

Problems I've encountered during porting:

1. soft lockup in s3cmci driver in do_pio_write. Thanks to Yaugen Kharuzhy for fix!

2. new fancy (and buggy) gpio lib. No more gpio_to_irq, and gpio_request doesn't work for GPJ, GPGx, where x >=10

P.S. Is there any rx1950-owners who want to help me with porting? :)

Friday, January 2, 2009

Changing blog profile

So, here we go again :)

Sorry for not writing new posts since July, but I really had no topics to write about, as this blog was about rx1950 and I did nothing about rx1950. So I've decided to change blog title. Now it's just Engineer's blog :) Don't worry, I do not drop rx1950 hacking, and here's short todo list:

0. Port old patches to 2.6.28 kernel (highest priority)

1. Write sane adc driver, adapt battery and touchscreen drivers to make them use adc driver

2. Clean up sound driver

3. Make screen to switch off correctly before suspend

4. Clean up wifi driver, find out how to turn on/off wifi

5. Build custom rootfs :)

6. Other stuff (lower priority)

P.S. Happy new year to everybody ;)