MTK HDMI 流程
一、HDMI初始化
1. kernel-3.18/drivers/misc/mediatek/ext_disp/mtk_extd_mgr.c
1 static int __init mtk_extd_mgr_init(void) 2 { 3 int i = 0; 4 int ret = 0; 5 /* struct notifier_block notifier;*/ 6 7 EXT_MGR_FUNC(); 8 9 extd_driver[DEV_MHL] = EXTD_HDMI_Driver(); 10 extd_driver[DEV_EINK] = EXTD_EPD_Driver(); 11 extd_factory_driver[DEV_MHL] = EXTD_Factory_HDMI_Driver(); 12 13 for (i = DEV_MHL; i < DEV_MAX_NUM - 1; i++) { 14 if (extd_driver[i]->init) 15 extd_driver[i]->init(); 16 } 17 18 if (platform_driver_register(&external_display_driver)) {//注册external_display_driver驱动程序 19 EXT_MGR_ERR("failed to register mtkfb driver\n"); 20 return -1; 21 } 22 23 notifier.notifier_call = fb_notifier_callback; 24 ret = fb_register_client(¬ifier); 25 if (ret) 26 EXT_MGR_ERR("unable to register fb callback!\n"); 27 28 #ifdef CONFIG_HAS_EARLYSUSPEND 29 register_early_suspend(&extd_early_suspend_handler); 30 #endif 31 return 0; 32 }
2. kernel-3.18/drivers/misc/mediatek/ext_disp/extd_hdmi.c
1 int hdmi_init(void) 2 { 3 int ret = 0; 4 5 HDMI_ERR(" start\n"); 6 /* for support hdmi hotplug, inform AP the event */ 7 hdmi_switch_data.name = "hdmi"; 8 hdmi_switch_data.index = 0; 9 hdmi_switch_data.state = HDMI_STATE_NO_DEVICE; 10 ret = switch_dev_register(&hdmi_switch_data); 11 12 if (ret) 13 HDMI_ERR("[hdmi][HDMI]switch_dev_register failed, returned:%d!\n", ret); 14 15 hdmires_switch_data.name = "res_hdmi"; 16 hdmires_switch_data.index = 0; 17 hdmires_switch_data.state = 0; 18 ret = switch_dev_register(&hdmires_switch_data); 19 20 if (ret) 21 HDMI_ERR("[hdmi][HDMI]switch_dev_register failed, returned:%d!\n", ret); 22 HDMI_ERR(" done\n"); 23 return 0; 24 }
3. kernel-3.18/drivers/misc/mediatek/ext_disp/mtk_extd_mgr.c
1 static int mtk_extd_mgr_probe(struct platform_device *pdev) 2 { 3 int ret = 0; 4 int i = 0; 5 struct class_device *class_dev = NULL; 6 7 EXT_MGR_FUNC(); 8 9 /* Allocate device number for hdmi driver */ 10 ret = alloc_chrdev_region(&extd_devno, 0, 1, EXTD_DEVNAME); 11 12 if (ret) { 13 EXT_MGR_LOG("alloc_chrdev_region fail\n"); 14 return -1; 15 } 16 17 /* For character driver register to system, device number binded to file operations */ 18 extd_cdev = cdev_alloc(); 19 extd_cdev->owner = THIS_MODULE; 20 extd_cdev->ops = &external_display_fops; 21 ret = cdev_add(extd_cdev, extd_devno, 1); 22 23 /* For device number binded to device name(hdmitx), one class is corresponeded to one node */ 24 extd_class = class_create(THIS_MODULE, EXTD_DEVNAME); 25 /* mknod /dev/hdmitx */ 26 class_dev = (struct class_device *)device_create(extd_class, NULL, extd_devno, NULL, EXTD_DEVNAME); 27 ext_dev_context = (struct device *)&(pdev->dev); 28 29 for (i = DEV_MHL; i < DEV_MAX_NUM - 1; i++) { 30 if (extd_driver[i]->post_init != 0) 31 extd_driver[i]->post_init(); 32 } 33 34 EXT_MGR_LOG("[%s] out\n", __func__); 35 return 0; 36 }