unsigned *target_atag_devinfo_data(unsigned *ptr)
{
int i = 0;
*ptr++ = tag_size(tag_devinfo_data);
*ptr++ = ATAG_DEVINFO_DATA;
for (i=0;i<ATAG_DEVINFO_DATA_SIZE;i++){
*ptr++ = get_devinfo_with_index(i);
}
*ptr++ = ATAG_DEVINFO_DATA_SIZE;
printf("SSSS:0x%x\n", get_devinfo_with_index(3));
printf("SSSS:0x%x\n", get_devinfo_with_index(4));
printf("SSSS:0x%x\n", get_devinfo_with_index(5));
printf("SSSS:0x%x\n", get_devinfo_with_index(10));
return ptr;
}
https://github.com/TeamYogaBlade2/android_kernel_lenovo_b8000-new/blob/b40d442dd1fdd2f9a6eca77077adb871374487d4/mediatek/platform/mt6589/lk/atags.c#L139-L153
static int __init parse_tag_devinfo_data_fixup(const struct tag *tags)
{
int i=0;
int size = tags->u.devinfo_data.devinfo_data_size;
for (i=0;i<size;i++){
g_devinfo_data[i] = tags->u.devinfo_data.devinfo_data[i];
}
/* print chip id for debugging purpose */
printk("tag_devinfo_data_rid, indx[%d]:0x%x\n", 12,g_devinfo_data[12]);
printk("tag_devinfo_data size:%d\n", size);
g_devinfo_data_size = size;
return 0;
}
https://github.com/TeamYogaBlade2/android_kernel_lenovo_b8000-new/blob/b40d442dd1fdd2f9a6eca77077adb871374487d4/mediatek/platform/mt6589/kernel/core/mt_devs.c#L1104-L1117
/**************************************************************************
* GET devinfo info with index
**************************************************************************/
u32 get_devinfo_with_index(u32 index)
{
int size = (sizeof(g_devinfo_data)/sizeof(u32));
if ((index >= 0) && (index < size)){
return g_devinfo_data[index];
}else{
printk("devinfo data index out of range:%d\n", index);
printk("devinfo data size:%d\n", size);
return SBCHK_BASE_INDEX_OUT_OF_RANGE;
}
}
https://github.com/TeamYogaBlade2/android_kernel_lenovo_b8000-new/blob/b40d442dd1fdd2f9a6eca77077adb871374487d4/mediatek/platform/mt6589/kernel/core/sbchk_base.c#L348-L361
u32 PTP_get_ptp_level(void)
{
#if defined (CONFIG_MTK_FORCE_CPU_89T)
return 3; // 1.5GHz
#else
u32 ptp_level_temp;
ptp_level_temp = get_devinfo_with_index(3) & 0x7;
if( ptp_level_temp == 0 ) // free mode
{
return ((get_devinfo_with_index(10) >> 4) & 0x7);
}
else if( ptp_level_temp == 1 ) // 1.5GHz
{
return 3;
}
else if( ptp_level_temp == 2 ) // 1.4GHz
{
return 2;
}
else if( ptp_level_temp == 3 ) // 1.3GHz
{
return 1;
}
else if( ptp_level_temp == 4 ) // 1.2GHz
{
return 0;
}
else if( ptp_level_temp == 5 ) // 1.1GHz
{
return 8;
}
else if( ptp_level_temp == 6 ) // 1.0GHz
{
return 9;
}
else // 1.0GHz
{
return 10;
}
#endif
}
https://github.com/TeamYogaBlade2/android_kernel_lenovo_b8000-new/blob/b40d442dd1fdd2f9a6eca77077adb871374487d4/mediatek/platform/mt6589/kernel/core/mt_ptp.c#L1086-L1128
/***************************
* Operate Point Definition
****************************/
#define OP(khz, volt) \
{ \
.cpufreq_khz = khz, \
.cpufreq_volt = volt, \
}
struct mt_cpu_freq_info
{
unsigned int cpufreq_khz;
unsigned int cpufreq_volt;
};
struct mt_cpu_power_info
{
unsigned int cpufreq_khz;
unsigned int cpufreq_ncpu;
unsigned int cpufreq_power;
};
/***************************
* MT6589 E1 DVFS Table
****************************/
static struct mt_cpu_freq_info mt6589_freqs_e1[] = {
OP(DVFS_F1, DVFS_V1),
OP(DVFS_F2, DVFS_V2),
OP(DVFS_F3, DVFS_V3),
OP(DVFS_F4, DVFS_V4),
};
static struct mt_cpu_freq_info mt6589_freqs_e1_0[] = {
OP(DVFS_F0_0, DVFS_V0),
OP(DVFS_F1, DVFS_V1),
OP(DVFS_F2, DVFS_V2),
OP(DVFS_F3, DVFS_V3),
OP(DVFS_F4, DVFS_V4),
};
static struct mt_cpu_freq_info mt6589_freqs_e1_1[] = {
OP(DVFS_F0_1, DVFS_V0),
OP(DVFS_F1, DVFS_V1),
OP(DVFS_F2, DVFS_V2),
OP(DVFS_F3, DVFS_V3),
OP(DVFS_F4, DVFS_V4),
};
static struct mt_cpu_freq_info mt6589_freqs_e1_2[] = {
OP(DVFS_F0_2, DVFS_V0),
OP(DVFS_F1, DVFS_V1),
OP(DVFS_F2, DVFS_V2),
OP(DVFS_F3, DVFS_V3),
OP(DVFS_F4, DVFS_V4),
};
static struct mt_cpu_freq_info mt6589_freqs_e1_3[] = {
OP(DVFS_F0_3, DVFS_V0),
OP(DVFS_F1, DVFS_V1),
OP(DVFS_F2, DVFS_V2),
OP(DVFS_F3, DVFS_V3),
OP(DVFS_F4, DVFS_V4),
};
static struct mt_cpu_freq_info mt6589_freqs_e1_4[] = {
OP(DVFS_F0_4, DVFS_V0),
OP(DVFS_F1, DVFS_V1),
OP(DVFS_F2, DVFS_V2),
OP(DVFS_F3, DVFS_V3),
OP(DVFS_F4, DVFS_V4),
};
static struct mt_cpu_freq_info mt6589_freqs_e1_5[] = {
OP(DVFS_F2, DVFS_V1),
OP(DVFS_F3, DVFS_V3),
OP(DVFS_F4, DVFS_V4),
};
https://github.com/TeamYogaBlade2/android_kernel_lenovo_b8000-new/blob/b40d442dd1fdd2f9a6eca77077adb871374487d4/mediatek/platform/mt6589/kernel/core/mt_cpufreq.c#L139-L220
https://github.com/TeamYogaBlade2/android_kernel_lenovo_b8000-new/blob/b40d442dd1fdd2f9a6eca77077adb871374487d4/mediatek/platform/mt6589/lk/atags.c#L139-L153
https://github.com/TeamYogaBlade2/android_kernel_lenovo_b8000-new/blob/b40d442dd1fdd2f9a6eca77077adb871374487d4/mediatek/platform/mt6589/kernel/core/mt_devs.c#L1104-L1117
https://github.com/TeamYogaBlade2/android_kernel_lenovo_b8000-new/blob/b40d442dd1fdd2f9a6eca77077adb871374487d4/mediatek/platform/mt6589/kernel/core/sbchk_base.c#L348-L361
https://github.com/TeamYogaBlade2/android_kernel_lenovo_b8000-new/blob/b40d442dd1fdd2f9a6eca77077adb871374487d4/mediatek/platform/mt6589/kernel/core/mt_ptp.c#L1086-L1128
https://github.com/TeamYogaBlade2/android_kernel_lenovo_b8000-new/blob/b40d442dd1fdd2f9a6eca77077adb871374487d4/mediatek/platform/mt6589/kernel/core/mt_cpufreq.c#L139-L220