很多时候我们在做驱动移植的时候,大部分时间都在调试驱动文件,但从事mtk安卓手机开发时我们应该知道是什么地方在找我们的驱动并去调用起来,下面基本上是mtk平台固定的调用检测位置:
xxx项目/mediatek/kernel/drivers/video/disp_drv.c
const LCM_DRIVER *disp_drv_get_lcm_driver(const char *lcm_name)
{
LCM_DRIVER *lcm = NULL;
printk("[LCM Auto Detect], we have %d lcm drivers built in\n", lcm_count);
printk("[LCM Auto Detect], try to find driver for [%s]\n",
(lcm_name==NULL)?"unknown":lcm_name);
if(lcm_count ==1)
{
// we need to verify whether the lcm is connected
// even there is only one lcm type defined
lcm = lcm_driver_list[0];
lcm->set_util_funcs(&lcm_utils);
lcm->get_params(&s_lcm_params);
u4IndexOfLCMList = 0;
lcm_params = &s_lcm_params;
lcm_drv = lcm;
/*
disp_drv_init_ctrl_if();
disp_drv_set_driving_current(lcm_params);
disp_drv_init_io_pad(lcm_params);
if(lcm_drv->compare_id)
{
if(LCM_TYPE_DSI == lcm_params->type){
init_dsi(FALSE);
}
if(lcm_drv->compare_id() == TRUE)
{
printk("[LCM Specified] compare id success\n");
isLCMFound = TRUE;
}
else
{
printk("[LCM Specified] compare id fail\n");
printk("%s, lcm is not connected\n", __func__);
if(LCM_TYPE_DSI == lcm_params->type)
DSI_Deinit();
}
}
else
*/
{
isLCMFound = TRUE;
}
printk("[LCM Specified]\t[%s]\n", (lcm->name==NULL)?"unknown":lcm->name);
goto done;
}
else
{
int i;
for(i = 0;i < lcm_count;i++)
{
lcm_params = &s_lcm_params;
lcm = lcm_driver_list[i];
printk("[LCM Auto Detect] [%d] - [%s]\t", i, (lcm->name==NULL)?"unknown":lcm->name);
lcm->set_util_funcs(&lcm_utils);
memset((void*)lcm_params, 0, sizeof(LCM_PARAMS));
lcm->get_params(lcm_params);
disp_drv_init_ctrl_if();
disp_drv_set_driving_current(lcm_params);
disp_drv_init_io_pad(lcm_params);
if(lcm_name != NULL)
{
if(!strcmp(lcm_name,lcm->name))
{
printk("\t\t[success]\n");
isLCMFound = TRUE;
u4IndexOfLCMList = i;
lcm_drv = lcm;
goto done;
}
else
{
printk("\t\t[fail]\n");
}
}
else
{
if(LCM_TYPE_DSI == lcm_params->type){
init_dsi(FALSE);
}
if(lcm->compare_id != NULL && lcm->compare_id())
{
printk("\t\t[success]\n");
isLCMFound = TRUE;
lcm_drv = lcm;
u4IndexOfLCMList = i;
goto done;
}
else
{
if(LCM_TYPE_DSI == lcm_params->type)
DSI_Deinit();
printk("\t\t[fail]\n");
}
}
}
}
done:
return lcm_drv;
}