[Q] Trying to understand kernel_galaxyace / arch / arm / mach-msm / acpuclock.c

Search This thread
S

-SGA-

Guest
I am new to Kernels and want to understand how OC'ing is done so I can make one for my device. I am looking here:https://github.com/ilarrain/kernel_galaxyace/blob/gingerbread/arch/arm/mach-msm/acpuclock.c and want to understand why the frequencies listed in the table are not available. I think it has something to do with this but could be completely wrong, could someone steer me in the right direction?

Code:
#ifdef CONFIG_CPU_FREQ_MSM
static struct cpufreq_frequency_table freq_table[20];

static void __init cpufreq_table_init(void)
{
	unsigned int i;
	unsigned int freq_cnt = 0;

	/* Construct the freq_table table from acpu_freq_tbl since the
	 * freq_table values need to match frequencies specified in
	 * acpu_freq_tbl and acpu_freq_tbl needs to be fixed up during init.
	 */
	for (i = 0; acpu_freq_tbl[i].a11clk_khz != 0
			&& freq_cnt < ARRAY_SIZE(freq_table)-1; i++) {
		if (acpu_freq_tbl[i].use_for_scaling) {
			freq_table[freq_cnt].index = freq_cnt;
			freq_table[freq_cnt].frequency
				= acpu_freq_tbl[i].a11clk_khz;
			freq_cnt++;
		}
	}

	/* freq_table not big enough to store all usable freqs. */
	BUG_ON(acpu_freq_tbl[i].a11clk_khz != 0);

	freq_table[freq_cnt].index = freq_cnt;
	freq_table[freq_cnt].frequency = CPUFREQ_TABLE_END;

	pr_info("%d scaling frequencies supported.\n", freq_cnt);
}
#endif
 
S

-SGA-

Guest
Okay i was wrong about that

// Perform overclocking if requested
457 if(hunt_s->a11clk_khz>787200) {
458 // Change the speed of PLL2
459 writel(hunt_s->a11clk_khz/19200, PLLn_L_VAL(2));
460 udelay(50);

The constraint is here... now to find out what exactly it means...
 
S

-SGA-

Guest
Specifically this....

(hunt_s->a11clk_khz>787200)
 
Last edited:

mdfzhi

Senior Member
Jun 15, 2011
4,146
3,856
i'm not good at C++, but here goes.

1- it means raise the ahb bus clock whenever cpu clock is passing 787200khz (787mhz)

2- frequency that is listed not always enable by default, eg
Code:
{ [B]0[/B], 120000, ACPU_PLL_0, 4, 7, 60000, 1, 3, 61440 },
{ [B]1[/B], 122880, ACPU_PLL_1, 1, 1, 61440, 1, 3, 61440 },

0 means its disable
1 means its enable
 
S

-SGA-

Guest
I would hit thanks twice if i could!

Sent from my GT-S5830 using xda premium
 
S

-SGA-

Guest
I think ill try cross compiling something tonight...

Sent from my GT-S5830 using xda premium
 
S

-SGA-

Guest
Lol. It's a rabbit hole that keeps getting deeper and deeper.

Sent from my GT-S5830 using xda premium
 
S

-SGA-

Guest
After spending a lot of time looking at the CM7 oc kernel and the samsung source code, I wanted to merge some of the features I think are comparable or interesting. I've got the code I want in place using codebench for Arm11, but now have been trying to understand how to make that into a boot.img. I gave up after working on it all night. After reading about using adb to extract the ramdisk from the phone and merging them ect. Can you guys suggest anything?

Sent from my GT-S5830 using xda premium
 

ketut.kumajaya

Recognized Developer
Apr 28, 2011
4,935
14,138
Bekasi
After spending a lot of time looking at the CM7 oc kernel and the samsung source code, I wanted to merge some of the features I think are comparable or interesting. I've got the code I want in place using codebench for Arm11, but now have been trying to understand how to make that into a boot.img. I gave up after working on it all night. After reading about using adb to extract the ramdisk from the phone and merging them ect. Can you guys suggest anything?

Sent from my GT-S5830 using xda premium

http://xdaforums.com/search.php?searchid=6840206
 

mdfzhi

Senior Member
Jun 15, 2011
4,146
3,856
After spending a lot of time looking at the CM7 oc kernel and the samsung source code, I wanted to merge some of the features I think are comparable or interesting. I've got the code I want in place using codebench for Arm11, but now have been trying to understand how to make that into a boot.img. I gave up after working on it all night. After reading about using adb to extract the ramdisk from the phone and merging them ect. Can you guys suggest anything?

Sent from my GT-S5830 using xda premium

u dont need to touch adb to extract ramdisk.
just extract it from stock kernel. read this thread
http://xdaforums.com/showthread.php?t=1173427
 

ketut.kumajaya

Recognized Developer
Apr 28, 2011
4,935
14,138
Bekasi

madman

Senior Member
Apr 21, 2011
1,658
466
Planet Earth
OnePlus 5
OnePlus 6
when i tried ramdisk of stock the things were not working...
things which i did was unpack stock boot.img and replace my build zImage and repack... do i need to do something extra too?
and also while compiling refering .cpio file in makemenu
 
Last edited:

mdfzhi

Senior Member
Jun 15, 2011
4,146
3,856
when i tried ramdisk of stock the things were not working...
things which i did was unpack stock boot.img and replace my build zImage and repack... do i need to do something extra too?

check module local version and make sure it match with kernel local version in defconfig.
also stock ramdisk doesnt enable init.d by default, so u might have problem if flashing onto rom that need init.d script support.
 

madman

Senior Member
Apr 21, 2011
1,658
466
Planet Earth
OnePlus 5
OnePlus 6
check module local version and make sure it match with kernel local version in defconfig.
also stock ramdisk doesnt enable init.d by default, so u might have problem if flashing onto rom that need init.d script support.
i made local version changes as you said in historical post too...
and about init.d support i was flashing it on stock so that shouldn't have that problem :(
 

mdfzhi

Senior Member
Jun 15, 2011
4,146
3,856
i made local version changes as you said in historical post too...
and about init.d support i was flashing it on stock so that shouldn't have that problem :(

if its stock rom with stock rfs filesystem u shouldnt have problem. wierd that u had problem :confused:

in general this is what need to be done.
1- unpack stock kernel ramdisk
2- cd into module dir in unpacked ramdisk dir, check its local version
3- modify kernel defconfig so its local version matches module local version
4- compile kernel
5- repack output zimage with earlier unpacked ramdisk.

if this should be flash into fresh stock rom with stock rfs filesystem, it should boot.
 

madman

Senior Member
Apr 21, 2011
1,658
466
Planet Earth
OnePlus 5
OnePlus 6
almost tried it 5-6 times with no boot :(
progress stops at samsung galaxy ace..
will give it another try later.. even if stock kernel boots i can make further modifications to kernel as i am more interested towards kernel programming rather than rom or app making stuff