__s32 Hdmi_init(void) { #ifdef CONFIG_SND_SUNXI_SOC_HDMIAUDIO __audio_hdmi_func audio_func; #endif __disp_hdmi_func disp_func; hdmi_used = 0; b_hdmi_suspend = 0; #ifdef CONFIG_SND_SUNXI_SOC_HDMIAUDIO audio_func.hdmi_audio_enable = Hdmi_Audio_Enable; audio_func.hdmi_set_audio_para = Hdmi_Set_Audio_Para; audio_set_hdmi_func(&audio_func); #endif disp_func.hdmi_open = Hdmi_open; disp_func.hdmi_close = Hdmi_close; disp_func.hdmi_set_mode = Hdmi_set_display_mode; disp_func.hdmi_mode_support = Hdmi_mode_support; disp_func.hdmi_get_HPD_status = Hdmi_get_HPD_status; disp_func.hdmi_set_pll = Hdmi_set_pll; disp_func.hdmi_dvi_enable= Hdmi_dvi_enable; disp_func.hdmi_dvi_support= Hdmi_dvi_support; disp_func.hdmi_get_input_csc = Hdmi_get_input_csc; disp_func.hdmi_suspend = Hdmi_suspend; disp_func.hdmi_early_suspend = Hdmi_early_suspend; disp_func.hdmi_resume = Hdmi_resume; disp_func.hdmi_late_resume = Hdmi_late_resume; /* if hdmi not used,this interface will return -1 */ if(!disp_set_hdmi_func(&disp_func)) { hdmi_used = 1; } if(hdmi_used) { run_sem = kmalloc(sizeof(struct semaphore),GFP_KERNEL | __GFP_ZERO); sema_init((struct semaphore*)run_sem,0); HDMI_task = kthread_create(Hdmi_run_thread, (void*)0, "hdmi proc"); if(IS_ERR(HDMI_task)) { __s32 err = 0; __wrn("Unable to start kernel thread %s.\n","hdmi proc"); err = PTR_ERR(HDMI_task); HDMI_task = NULL; return err; } wake_up_process(HDMI_task); Hdmi_set_reg_base((__u32)ghdmi.base_hdmi); Hdmi_hal_init(); INIT_WORK(&ghdmi.hpd_work, hdmi_report_hpd_work); #ifdef CONFIG_SWITCH switch_dev_register(&hdmi_switch_dev); #endif } return 0; }
__s32 Hdmi_init(void) { __audio_hdmi_func audio_func; __disp_hdmi_func disp_func; run_sem = kmalloc(sizeof(struct semaphore),GFP_KERNEL | __GFP_ZERO); sema_init((struct semaphore*)run_sem,0); HDMI_task = kthread_create(Hdmi_run_thread, (void*)0, "hdmi proc"); if(IS_ERR(HDMI_task)) { __s32 err = 0; __wrn("Unable to start kernel thread %s.\n","hdmi proc"); err = PTR_ERR(HDMI_task); HDMI_task = NULL; return err; } wake_up_process(HDMI_task); Hdmi_set_reg_base((__u32)ghdmi.base_hdmi); Hdmi_hal_init(); audio_func.hdmi_audio_enable = Hdmi_Audio_Enable; audio_func.hdmi_set_audio_para = Hdmi_Set_Audio_Para; audio_set_hdmi_func(&audio_func); disp_func.Hdmi_open = Hdmi_open; disp_func.Hdmi_close = Hdmi_close; disp_func.hdmi_set_mode = Hdmi_set_display_mode; disp_func.hdmi_mode_support = Hdmi_mode_support; disp_func.hdmi_get_HPD_status = Hdmi_get_HPD_status; disp_func.hdmi_set_pll = Hdmi_set_pll; disp_set_hdmi_func(&disp_func); return 0; }
__s32 Hdmi_init(struct platform_device *dev) { __audio_hdmi_func audio_func; __disp_hdmi_func disp_func; int err = 0; if (init_hdmi_obj()) { pr_warning("hdmi: init kobject failed\n"); return -1; } run_sem = kmalloc(sizeof(struct semaphore), GFP_KERNEL | __GFP_ZERO); sema_init((struct semaphore *)run_sem, 0); hdmi_base = (void __iomem *) ghdmi.base_hdmi; hdmi_core_initial(); err = hdmi_i2c_sunxi_probe(dev); if (err) return err; audio_info.channel_num = 2; #if 0 { /* for audio test */ hdmi_audio_t audio_para; audio_para.ch0_en = 1; audio_para.sample_rate = 44100; Hdmi_hal_set_audio_para(&audio_para); Hdmi_hal_audio_enable(0, 1); } #endif /* Run main task once, should give EDID information directly */ hdmi_main_task_loop(); HDMI_task = kthread_create(Hdmi_run_thread, (void *)0, "hdmi proc"); if (IS_ERR(HDMI_task)) { __s32 err = 0; __wrn("Unable to start kernel thread %s.\n", "hdmi proc"); err = PTR_ERR(HDMI_task); HDMI_task = NULL; return err; } /* Launch main task loop */ wake_up_process(HDMI_task); audio_func.hdmi_audio_enable = Hdmi_Audio_Enable; audio_func.hdmi_set_audio_para = Hdmi_Set_Audio_Para; #if defined CONFIG_SND_SUNXI_SOC_HDMIAUDIO || \ (defined CONFIG_SND_SUNXI_SOC_HDMIAUDIO_MODULE && \ defined CONFIG_FB_SUNXI_HDMI_MODULE) audio_set_hdmi_func(&audio_func); #endif disp_func.hdmi_wait_edid = hdmi_wait_edid; disp_func.Hdmi_open = Hdmi_open; disp_func.Hdmi_close = Hdmi_close; disp_func.hdmi_set_mode = Hdmi_set_display_mode; disp_func.hdmi_set_videomode = Hdmi_set_display_videomode; disp_func.hdmi_mode_support = Hdmi_mode_support; disp_func.hdmi_get_video_timing = hdmi_get_video_timing; disp_func.hdmi_get_HPD_status = Hdmi_get_HPD_status; disp_func.hdmi_set_pll = Hdmi_set_pll; disp_set_hdmi_func(&disp_func); return 0; }