void spm_mcdi_LDVT_sodi(void) { clc_notice("spm_mcdi_LDVT_sodi() start.\n"); mtk_wdt_suspend(); // show image on screen ============================ spm_show_lcm_image(); // spm_direct_enable_sodi ============================ spm_direct_enable_sodi(); mcdi_task_0 = kthread_create(spm_wfi_for_sodi_test, NULL, "mcdi_task_0"); mcdi_task_1 = kthread_create(spm_wfi_for_sodi_test, NULL, "mcdi_task_1"); if(IS_ERR(mcdi_task_0) ||IS_ERR(mcdi_task_1)) { clc_notice("Unable to start kernel thread(0x%x, 0x%x)./n", (u32)IS_ERR(mcdi_task_0), (u32)IS_ERR(mcdi_task_1)); mcdi_task_0 = NULL; mcdi_task_1 = NULL; } kthread_bind(mcdi_task_0, 0); kthread_bind(mcdi_task_1, 1); wake_up_process(mcdi_task_0); wake_up_process(mcdi_task_1); clc_notice("spm_mcdi_LDVT_01() end.\n"); }
static void Golden_Setting_Compare_PMIC_LDO(void) { u16 temp_value, temp_i; // PMIC 0x13E ========================================== temp_value = gs_pmic_read(0x13E); for( temp_i=0 ; temp_i<16 ; temp_i++ ) { if( (temp_value & (0x1<<temp_i)) == (0x1<<temp_i) ) { clc_notice("PMIC %s : On.\n", pmic_6320_reg_0x13e[temp_i]); } } // PMIC 0x140 ========================================== temp_value = gs_pmic_read(0x140); for( temp_i=0 ; temp_i<16 ; temp_i++ ) { if( (temp_value & (0x1<<temp_i)) == (0x1<<temp_i) ) { clc_notice("PMIC %s : On.\n", pmic_6320_reg_0x140[temp_i]); } } }
void spm_mcdi_LDVT_mcdi(void) { clc_notice("spm_mcdi_LDVT_mcdi() start.\n"); mtk_wdt_suspend(); // spm_direct_disable_sodi ============================ spm_direct_disable_sodi(); #if 1 { u32 mcdi_error; // init GPT ================================== free_gpt(GPT4); mcdi_error = request_gpt(GPT4, GPT_ONE_SHOT, GPT_CLK_SRC_SYS, GPT_CLK_DIV_1, 0, NULL, GPT_NOAUTOEN); if(mcdi_error != 0) { clc_notice("GPT4 init failed.(0x%x)\n", mcdi_error); } } #else // init GPT ================================== //spm_write(0xf0008010, 0x2); //clear GPT1 count //spm_write(0xf0008040, 0x2); //clear GPT4 count //spm_write(0xf0008050, 0x2); //clear GPT5 count //spm_write(0xf0008000, (spm_read(0xf0008000) | 0x19)); //enable GPT1, 4, 5 IRQ #endif #if 0 smp_call_function(spm_mcdi_wfi_for_test, NULL, 0); spm_mcdi_wfi_for_test(); #else mcdi_task_0 = kthread_create(spm_wfi_for_mcdi_test, NULL, "mcdi_task_0"); mcdi_task_1 = kthread_create(spm_wfi_for_mcdi_test, NULL, "mcdi_task_1"); if(IS_ERR(mcdi_task_0)||IS_ERR(mcdi_task_1) ) { clc_notice("Unable to start kernel thread(0x%x, 0x%x)./n", (u32)IS_ERR(mcdi_task_0), (u32)IS_ERR(mcdi_task_1)); mcdi_task_0 = NULL; mcdi_task_1 = NULL; } kthread_bind(mcdi_task_0, 0); kthread_bind(mcdi_task_1, 1); wake_up_process(mcdi_task_0); wake_up_process(mcdi_task_1); #endif }
/************************************ * set SPM-MCDI stauts by sysfs interface *************************************/ static ssize_t spm_mcdi_debug_write(struct file *file, const char *buffer, unsigned long count, void *data) { int enabled = 0; if (sscanf(buffer, "%d", &enabled) == 1) { if (enabled == 0) { En_SPM_MCDI = 1; } else { clc_notice("bad argument_0!! (argument_0 = %d)\n", enabled); } } else { clc_notice("bad argument_1!! \n"); } return count; }
static int __init spm_mcdi_init(void) { struct proc_dir_entry *mt_entry = NULL; struct proc_dir_entry *mt_mcdi_dir = NULL; int mcdi_err = 0; mt_mcdi_dir = proc_mkdir("mcdi", NULL); if (!mt_mcdi_dir) { clc_notice("[%s]: mkdir /proc/mcdi failed\n", __FUNCTION__); } else { mt_entry = create_proc_entry("mcdi_debug", S_IRUGO | S_IWUSR | S_IWGRP, mt_mcdi_dir); if (mt_entry) { mt_entry->read_proc = spm_mcdi_debug_read; mt_entry->write_proc = spm_mcdi_debug_write; } } return 0; }
//extern u32 cpu_pdn_cnt; void spm_mcdi_wfi(void) { volatile u32 core_id; //u32 clc_counter; unsigned long flags; //u32 temp_address; #if 0 core_id = (u32)smp_processor_id(); if(core_id == 0) { if(MCDI_Test_Mode == 1) { //clc_notice("SPM_FC1_PWR_CON %x, cpu_pdn_cnt %d.\n",spm_read(SPM_FC1_PWR_CON),cpu_pdn_cnt); clc_notice("core_%d set wfi_sel.\n", core_id); } spm_wfi_sel(pcm_config_mcdi.wfi_sel, SPM_CORE1_WFI_SEL_SW_MASK ); spm_mcdi_poll_mask(core_id,pcm_config_mcdi.wfi_sel); if(MCDI_Test_Mode == 1) { clc_notice("core_%d mask polling done.\n", core_id); } wfi_with_sync(); // enter wfi //spm_get_wakeup_status(&pcm_config_mcdi); if(MCDI_Test_Mode == 1) clc_notice("core_%d exit wfi.\n", core_id); //if(MCDI_Test_Mode == 1) //mdelay(10); // delay 10 ms } else // Core 1 Keep original IRQ #endif { if(MCDI_Test_Mode == 1) { clc_notice("core_%d set wfi_sel.\n", core_id); } spm_wfi_sel(pcm_config_mcdi.wfi_sel, SPM_CORE0_WFI_SEL_SW_MASK ); ////clc_notice("core_%d enter wfi.\n", core_id); spm_mcdi_poll_mask(core_id,pcm_config_mcdi.wfi_sel); if(MCDI_Test_Mode == 1) { clc_notice("core_%d mask polling done.\n", core_id); } mcidle_before_wfi(1); if (!cpu_power_down(DORMANT_MODE)) { switch_to_amp(); /* do not add code here */ wfi_with_sync(); } switch_to_smp(); cpu_check_dormant_abort(); mcidle_after_wfi(1); spm_get_wakeup_status(&pcm_config_mcdi); if(MCDI_Test_Mode == 1) clc_notice("core_%d exit wfi.\n", core_id); } }
void Golden_Setting_Compare_for_Suspend(void) { u32 i, counter_6589, counter_6320; u32 MT_6589_Len, MT_6320_Len; u32 chip_version = 0; u32 *MT6320_Suspend_Golden_ptr; // check MT6320_E1 or MT6320_E2 chip_version = upmu_get_cid(); if(chip_version == PMIC6320_E1_CID_CODE) { MT_6320_Len = sizeof(MT6320_E1_Suspend_Golden) / sizeof(u32); MT6320_Suspend_Golden_ptr = (u32 *)MT6320_E1_Suspend_Golden; } else if(chip_version == PMIC6320_E2_CID_CODE) { MT_6320_Len = sizeof(MT6320_E2_Suspend_Golden) / sizeof(u32); MT6320_Suspend_Golden_ptr = (u32 *)MT6320_E2_Suspend_Golden; } else { MT_6320_Len = sizeof(MT6320_E2_Suspend_Golden) / sizeof(u32); MT6320_Suspend_Golden_ptr = (u32 *)MT6320_E2_Suspend_Golden; } MT_6589_Len = sizeof(MT6589_Suspend_Golden) / sizeof(u32); counter_6589 = 0; counter_6320 = 0; // MT6589 ====================================================================================================== for( i=0 ; i<MT_6589_Len ; i+=3 ) { if( (gs_read(MT6589_Suspend_Golden[i]) & MT6589_Suspend_Golden[i+1]) != (MT6589_Suspend_Golden[i+2] & MT6589_Suspend_Golden[i+1])) { counter_6589++; clc_notice("MT6589 Suspend register[0x%x] = 0x%x (mask : 0x%x, value : 0x%x)\n", MT6589_Suspend_Golden[i], gs_read(MT6589_Suspend_Golden[i]), MT6589_Suspend_Golden[i+1], MT6589_Suspend_Golden[i+2] ); } } if(counter_6589 == 0) { clc_notice("MT6589 Suspend golden setting : pass.\n"); } Golden_Setting_Compare_PLL(); // MT6320 ====================================================================================================== for( i=0 ; i<MT_6320_Len ; i+=3 ) { if( (gs_pmic_read(MT6320_Suspend_Golden_ptr[i]) & MT6320_Suspend_Golden_ptr[i+1]) != (MT6320_Suspend_Golden_ptr[i+2] & MT6320_Suspend_Golden_ptr[i+1])) { counter_6320++; clc_notice("MT6320 Suspend register[0x%x] = 0x%x (mask : 0x%x, value : 0x%x)\n", MT6320_Suspend_Golden_ptr[i], gs_pmic_read(MT6320_Suspend_Golden_ptr[i]), MT6320_Suspend_Golden_ptr[i+1], MT6320_Suspend_Golden_ptr[i+2] ); } } if(counter_6320 == 0) { clc_notice("MT6320 Suspend golden setting : pass.\n"); } Golden_Setting_Compare_PMIC_LDO(); // ============================================================================================================ }
static void Golden_Setting_Compare_PLL(void) { if (pll_is_on(MSDCPLL)) { clc_notice("MSDCPLL: %s\n", pll_is_on(MSDCPLL) ? "on" : "off"); } if (pll_is_on(TVDPLL)) { clc_notice("TVDPLL: %s\n", pll_is_on(TVDPLL) ? "on" : "off"); } if (pll_is_on(LVDSPLL)) { clc_notice("LVDSPLL: %s\n", pll_is_on(LVDSPLL) ? "on" : "off"); } if (pll_is_on(ISPPLL)) { clc_notice("ISPPLL: %s\n", pll_is_on(ISPPLL) ? "on" : "off"); } if (subsys_is_on(SYS_MD1)) { clc_notice("SYS_MD1: %s\n", subsys_is_on(SYS_MD1) ? "on" : "off"); } if (subsys_is_on(SYS_MD2)) { clc_notice("SYS_MD2: %s\n", subsys_is_on(SYS_MD2) ? "on" : "off"); } if (subsys_is_on(SYS_DIS)) { clc_notice("SYS_DIS: %s\n", subsys_is_on(SYS_DIS) ? "on" : "off"); } if (subsys_is_on(SYS_MFG)) { clc_notice("SYS_MFG: %s\n", subsys_is_on(SYS_MFG) ? "on" : "off"); } if (subsys_is_on(SYS_ISP)) { clc_notice("SYS_ISP: %s\n", subsys_is_on(SYS_ISP) ? "on" : "off"); } if (subsys_is_on(SYS_VEN)) { clc_notice("SYS_VEN: %s\n", subsys_is_on(SYS_VEN) ? "on" : "off"); } if (subsys_is_on(SYS_VDE)) { clc_notice("SYS_VDE: %s\n", subsys_is_on(SYS_VDE) ? "on" : "off"); } }