Fix for clock speed issue

JetKernel testing releases will be posted here by the DevTeam. This forum is open for feedback from test users.
Forum rules
Dev Team members can post testing releases here. Please give a link to the source base that was used for a release or post patches / changelogs along with your binary packages.

Registered users can reply with their test feedback. Please only post test feedback here. For general (e.g. install related questions) please use the support Q&A section.

Fix for clock speed issue

Postby KB_JetDroid » Tue Mar 01, 2011 9:59 pm

Hi All,

I have found a solution for clock running at double speed.
Thanks to MadRocker for poitning out that the clock issue (running at double speed) disappears if we set the CpuFreq Governor to performance (i.e. constantly at 800 MHz).

I checked the cpu frequency scaler code in JetKernel and found the issue after observing the clock SFRs (CLK_DIV0).

The clock runs at proper speed until the cpu frequency scaling starts. When the cpu frequency starts changing, all the timers start running at double speed. The reason for this I found in the following code:

Code: Select all
arch/arm/plat-s3c64xx/clock.c

/* ARMCLK, HCLKX2, APLL, PDIV, ARM_DIV, HCLKX2_DIV */
static const u32 s3c_cpu_clk_tab_800MHz[][6] = {
   {800*MHZ,  266 *MHZ, 400, 3, 0, 2},
   {400*MHZ,  266 *MHZ, 400, 3, 1, 2},
   {266*MHZ,  266 *MHZ, 400, 3, 2, 2},
   {133*MHZ,  266 *MHZ, 400, 3, 5, 2},
#ifdef USE_DVFS_AL1_LEVEL
   {133*MHZ,  133 *MHZ, 400, 1, 5, 5},
#endif /* USE_DVFS_AL1_LEVEL */
   { 66*MHZ,  133 *MHZ, 400, 1, 11, 5},
};

In the above code, the PDIV value (column 4) doubles the PCLK value (clock used the run all peripherals including timers) once cpu frequency scaling activates. This causes the issue in clock speed.

I changed PDIV value in the above code as below which resolved the issue:

Code: Select all
arch/arm/plat-s3c64xx/clock.c

/* ARMCLK, HCLKX2, APLL, PDIV, ARM_DIV, HCLKX2_DIV */
static const u32 s3c_cpu_clk_tab_800MHz[][6] = {
   {800*MHZ,  266 *MHZ, 400, 7, 0, 2},
   {400*MHZ,  266 *MHZ, 400, 7, 1, 2},
   {266*MHZ,  266 *MHZ, 400, 7, 2, 2},
   {133*MHZ,  266 *MHZ, 400, 7, 5, 2},
#ifdef USE_DVFS_AL1_LEVEL
   {133*MHZ,  133 *MHZ, 400, 3, 5, 5},
#endif /* USE_DVFS_AL1_LEVEL */
   { 66*MHZ,  133 *MHZ, 400, 3, 11, 5},
};

I think the above code has been taken from InstinctQ, for which it works fine. So there is still chance that the actual issue might be somewhere else and the above solution is just a workaround. I'm looking into it, meanwhile if anyone has any idea please let me know.

I have attached my kernel image below. Please untar the file and replace the zImage.

The clock speed and frequency scaling works fine with the above binary.
Please test it and let me know if there is any issue with the clock or cpu frequency.

I am still using the old eclair platform :oops: so not sure if the above kernel image will work with other platform versions.

@sploutch: Can you please try the above binary or the source code changes with froyo?

- KB
You do not have the required permissions to view the files attached to this post.
KB_JetDroid
Dev Team
Dev Team
 
Posts: 82
Joined: Sun Nov 14, 2010 12:18 pm

Advertisement

       

Re: Fix for clock speed issue

Postby Dopi » Tue Mar 01, 2011 10:42 pm

Hi KB,

great you fond a solution to this issue :D I will test it tomorrow.

Cheers,
Dopi
Ad banners support the JetDroid forum. Please consider clicking them once in a while.
User avatar
Dopi
Dev Team
Dev Team
 
Posts: 926
Joined: Sun Aug 22, 2010 9:47 pm

Re: Fix for clock speed issue

Postby Qnoiz » Wed Mar 02, 2011 12:06 am

Tested,working great !!! ;)
Correct time after reboot and accurate clock speed !!!
Awesome job KB,
Keep it up m8...!


Cheers,
Qnoiz
User avatar
Qnoiz
Junior member
Junior member
 
Posts: 46
Joined: Thu Dec 23, 2010 1:08 am
Location: Greece Athens

Re: Fix for clock speed issue

Postby KB_JetDroid » Wed Mar 02, 2011 12:07 pm

Qnoiz wrote:Tested,working great !!! ;)
Correct time after reboot and accurate clock speed !!!
Awesome job KB,
Keep it up m8...!


Cheers,
Qnoiz


Thanks for the feedback Qnoiz.

One thing I have observed is after this fix the vibrator produces low power vibrations. This fix might have changed the duty cycle of PWM. Has anyone observed the same?

- KB
KB_JetDroid
Dev Team
Dev Team
 
Posts: 82
Joined: Sun Nov 14, 2010 12:18 pm

Re: Fix for clock speed issue

Postby Jose_Paramore » Wed Mar 02, 2011 2:53 pm

Ok, works great ;), but I don't have wifi with this... I think it's time to create a fully JetDroid release with all the new features ;)
KB - Yes, it's true! The vibrator is low... :S
Cheers,
Jose
Come on JétDroid team!!! ;D
User avatar
Jose_Paramore
Forum Moderator
Forum Moderator
 
Posts: 312
Joined: Thu Oct 21, 2010 3:44 pm
Location: Spain

Re: Fix for clock speed issue

Postby skuke » Wed Mar 02, 2011 6:42 pm

tested and works great, time updated with wifi aswell, great work :D
skuke
Freshman
 
Posts: 19
Joined: Thu Feb 03, 2011 6:40 pm

Re: Fix for clock speed issue

Postby Jose_Paramore » Wed Mar 02, 2011 7:40 pm

Only a thing... when I use the music player (although we cannot listen to music :( ) I think that music runs a bit slow...
Come on JétDroid team!!! ;D
User avatar
Jose_Paramore
Forum Moderator
Forum Moderator
 
Posts: 312
Joined: Thu Oct 21, 2010 3:44 pm
Location: Spain

Re: Fix for clock speed issue

Postby Jose_Paramore » Wed Mar 02, 2011 7:41 pm

skuke wrote:tested and works great, time updated with wifi aswell, great work :D

Well... maybe is because of our JétDroid platforms... I'm using the last platform with 3D acceleration
Come on JétDroid team!!! ;D
User avatar
Jose_Paramore
Forum Moderator
Forum Moderator
 
Posts: 312
Joined: Thu Oct 21, 2010 3:44 pm
Location: Spain

Re: Fix for clock speed issue

Postby skuke » Wed Mar 02, 2011 7:54 pm

i havent got the 3d acceleration i have the latest kernal, i havent been able to test th vibration, how can i do this?
skuke
Freshman
 
Posts: 19
Joined: Thu Feb 03, 2011 6:40 pm

Re: Fix for clock speed issue

Postby shishirs » Thu Mar 03, 2011 2:52 pm

Jose_Paramore wrote: I think it's time to create a fully JetDroid release with all the new features ;)
Jose


I second the idea. Please can someone put up a release for different platforms with all the fixes together.

Many Thanks,
Shis
shishirs
Freshman
 
Posts: 7
Joined: Thu Feb 10, 2011 10:25 pm

Next

Return to JetKernel Testing

Who is online

Users browsing this forum: No registered users and 1 guest

  • Advertisement
cron