Exemplo n.º 1
0
avfs_device_driver hdmi_init(avfs_device_major_number major, avfs_device_minor_number minor, void *arg)
{
    avfs_status_code status;     
    status = avfs_io_register_name(
        DRIVER_NAME,
        major,
        (avfs_device_minor_number) 0
    );   
    HDMI_DEBUG();
    memset(&hdmitx_device, 0, sizeof(hdmitx_dev_t));
    strcpy(lvideo_info.name, "");
    hdmitx_device.vic_count=0;
    if((init_flag&INIT_FLAG_POWERDOWN)&&(hpdmode==2)){
        hdmitx_device.mux_hpd_if_pin_high_flag=0;
    }
    else{
        hdmitx_device.mux_hpd_if_pin_high_flag=1;
    }
    hdmitx_device.audio_param_update_flag=0;
    tv_tv_enc_post_fun = hdmi_tv_enc_post_func;

   	hdmitx_device.taskstack = (OS_STK*) AVMem_malloc(HDMI_OP_STK_SIZE_IN_BYTE);
    AVTaskCreate(hdmi_task_handle, (void *)(&hdmitx_device), &hdmitx_device.taskstack[HDMI_OP_STK_SIZE - 1], HDMI_OP_TASK_PRI, &hdmitx_device.task_id); 
#if OS_TASK_STACKCHK_EN > 0
   	AVTaskSetStackSize(hdmitx_device.task_id, HDMI_OP_STK_SIZE * sizeof(OS_STK));
#endif
    return AVFS_SUCCESSFUL;
}
Exemplo n.º 2
0
static int  __init amhdmitx_init(void)
{
    HDMI_DEBUG();
    if(init_flag&INIT_FLAG_NOT_LOAD)
        return 0;
        
    printk("amhdmitx_init\n");
    if(hdmi_log_buf_size>0){
        hdmi_log_buf=kmalloc(hdmi_log_buf_size, GFP_KERNEL);
        if(hdmi_log_buf==NULL){
            hdmi_log_buf_size=0;
        }
    }
	  amhdmi_tx_device = platform_device_alloc(DEVICE_NAME,0);
    if (!amhdmi_tx_device) {
        pr_error("failed to alloc amhdmi_tx_device\n");
        return -ENOMEM;
    }
    
    if(platform_device_add(amhdmi_tx_device)){
        platform_device_put(amhdmi_tx_device);
        pr_error("failed to add amhdmi_tx_device\n");
        return -ENODEV;
    }
    if (platform_driver_register(&amhdmitx_driver)) {
        pr_error("failed to register amhdmitx module\n");
        
        platform_device_del(amhdmi_tx_device);
        platform_device_put(amhdmi_tx_device);
        return -ENODEV;
    }
    return 0;
}
Exemplo n.º 3
0
static int amhdmitx_probe(struct platform_device *pdev)
{
    int r;
    HDMI_DEBUG();
    pr_dbg("amhdmitx_probe\n");
    r = alloc_chrdev_region(&hdmitx_id, 0, HDMI_TX_COUNT, DEVICE_NAME);
    if (r < 0) {
        pr_error("Can't register major for amhdmitx device\n");
        return r;
    }
    hdmitx_class = class_create(THIS_MODULE, DEVICE_NAME);
    if (IS_ERR(hdmitx_class))
    {
        unregister_chrdev_region(hdmitx_id, HDMI_TX_COUNT);
        return -1;
        //return PTR_ERR(aoe_class);
    }
    hdmitx_device.unplug_powerdown=0;
    hdmitx_device.vic_count=0;
    if((init_flag&INIT_FLAG_POWERDOWN)&&(hpdmode==2)){
        hdmitx_device.mux_hpd_if_pin_high_flag=0;
    }
    else{
        hdmitx_device.mux_hpd_if_pin_high_flag=1;
    }
    hdmitx_device.audio_param_update_flag=0;
    cdev_init(&(hdmitx_device.cdev), &amhdmitx_fops);
    hdmitx_device.cdev.owner = THIS_MODULE;
    cdev_add(&(hdmitx_device.cdev), hdmitx_id, HDMI_TX_COUNT);

    //hdmitx_dev = device_create(hdmitx_class, NULL, hdmitx_id, "amhdmitx%d", 0);
    hdmitx_dev = device_create(hdmitx_class, NULL, hdmitx_id, NULL, "amhdmitx%d", 0); //kernel>=2.6.27 

    device_create_file(hdmitx_dev, &dev_attr_disp_mode);
    device_create_file(hdmitx_dev, &dev_attr_aud_mode);
    device_create_file(hdmitx_dev, &dev_attr_edid);
    device_create_file(hdmitx_dev, &dev_attr_config);
    device_create_file(hdmitx_dev, &dev_attr_debug);
    device_create_file(hdmitx_dev, &dev_attr_disp_cap);
    device_create_file(hdmitx_dev, &dev_attr_log);
    
    if (hdmitx_dev == NULL) {
        pr_error("device_create create error\n");
        class_destroy(hdmitx_class);
        r = -EEXIST;
        return r;
    }
    vout_register_client(&hdmitx_notifier_nb_v);
#ifndef DISABLE_AUDIO
    aout_register_client(&hdmitx_notifier_nb_a);
#endif
    hdmitx_device.task = kthread_run(hdmi_task_handle, &hdmitx_device, "kthread_hdmi");

    return r;
}
static int it660x_hdmirx_probe(struct platform_device *pdev)
{
    int r;
    HDMI_DEBUG();
    pr_dbg("it660x_hdmirx_probe\n");

    //it660xin_init();



    r = alloc_chrdev_region(&hdmirx_id, 0, HDMI_RX_COUNT, DEVICE_NAME);
    if (r < 0) {
        pr_error("Can't register major for it660x_hdmirx device\n");
        return r;
    }
    hdmirx_class = class_create(THIS_MODULE, DEVICE_NAME);
    if (IS_ERR(hdmirx_class))
    {
        unregister_chrdev_region(hdmirx_id, HDMI_RX_COUNT);
        return -1;
        //return PTR_ERR(aoe_class);
    }

    cdev_init(&(hdmirx_device.cdev), &it660x_hdmirx_fops);
    hdmirx_device.cdev.owner = THIS_MODULE;
    cdev_add(&(hdmirx_device.cdev), hdmirx_id, HDMI_RX_COUNT);

    //hdmirx_dev = device_create(hdmirx_class, NULL, hdmirx_id, "it660x_hdmirx%d", 0);
    hdmirx_dev = device_create(hdmirx_class, NULL, hdmirx_id, NULL, "it660x_hdmirx%d", 0); //kernel>=2.6.27 
    device_create_file(hdmirx_dev, &dev_attr_enable);
    device_create_file(hdmirx_dev, &dev_attr_poweron);
    device_create_file(hdmirx_dev, &dev_attr_debug);
    
    if (hdmirx_dev == NULL) {
        pr_error("device_create create error\n");
        class_destroy(hdmirx_class);
        r = -EEXIST;
        return r;
    }
    hdmirx_device.task = kthread_run(hdmi_task_handle, &hdmirx_device, "kthread_hdmi");
    
	if (r < 0){
		printk(KERN_ERR "hdmirx: register switch dev failed\n");
		return r;
	}    

    return r;
}
Exemplo n.º 5
0
static int 
#else
static void
#endif
hdmi_task_handle(void *data) 
{
    extern void hdmitx_edid_ram_buffer_clear(hdmitx_dev_t*);
    hdmitx_dev_t* hdmitx_device = (hdmitx_dev_t*)data;
    hdmitx_init_parameters(&hdmitx_device->hdmi_info);

    HDMITX_M1B_Init(hdmitx_device);

    //When init hdmi, clear the hdmitx module edid ram and edid buffer.
    hdmitx_edid_ram_buffer_clear(hdmitx_device);

    hdmitx_device->HWOp.SetupIRQ(hdmitx_device);

    if(hdmitx_device->HWOp.Cntl){
        if(init_flag&INIT_FLAG_VDACOFF){
            hdmitx_device->HWOp.Cntl(hdmitx_device, HDMITX_HWCMD_VDAC_OFF, 0);    
        }
        if(init_powermode&0x80){
            hdmitx_device->HWOp.Cntl(hdmitx_device, HDMITX_HWCMD_POWERMODE_SWITCH, init_powermode&0x1f);    
        }
    }
    if(init_flag&INIT_FLAG_POWERDOWN){
        hdmitx_device->HWOp.SetDispMode(NULL); //power down
        hdmitx_device->unplug_powerdown=1;
        if(hdmitx_device->HWOp.Cntl){
            hdmitx_device->HWOp.Cntl(hdmitx_device, HDMITX_HWCMD_TURNOFF_HDMIHW, (hpdmode!=0)?1:0);    
        }
    }
    else{
        if(hdmitx_device->HWOp.Cntl){
            hdmitx_device->HWOp.Cntl(hdmitx_device, HDMITX_HWCMD_MUX_HPD, 0);    
        }
    }
    
    HDMI_DEBUG();

    while (hdmitx_device->hpd_event != 0xff)
    {
        if((hdmitx_device->vic_count == 0)&&(hdmitx_device->mux_hpd_if_pin_high_flag)){
            if(hdmitx_device->HWOp.Cntl){
                hdmitx_device->HWOp.Cntl(hdmitx_device, HDMITX_HWCMD_MUX_HPD_IF_PIN_HIGH, 0);
            }
        }
        
        if((!hdmi_audio_off_flag)&&(hdmitx_device->audio_param_update_flag)&&
            ((hdmitx_device->cur_VIC != HDMI_Unkown)||(hdmitx_device->force_audio_flag))){
            hdmitx_set_audio(hdmitx_device, &(hdmitx_device->cur_audio_param));
            hdmitx_device->audio_param_update_flag = 0;
            hdmi_print(1, "HDMI: set audio param\n");
        }

        if (hdmitx_device->hpd_event == 1)
        {
            if(hdmitx_device->HWOp.GetEDIDData(hdmitx_device)){
                hdmi_print(1,"HDMI: EDID Ready\n");
                hdmitx_edid_clear(hdmitx_device);
                hdmitx_edid_parse(hdmitx_device);
                cec_node_init(hdmitx_device);
                set_disp_mode_auto();
				
				switch_set_state(&sdev, 1);
                hdmitx_device->hpd_event = 0;
            }  
            hdmitx_device->hpd_state = 1;  
        }
        else if(hdmitx_device->hpd_event == 2)
        {
            //When unplug hdmi, clear the hdmitx module edid ram and edid buffer.
            hdmitx_edid_ram_buffer_clear(hdmitx_device);
            hdmitx_edid_clear(hdmitx_device);
            cec_node_uninit(hdmitx_device);

            if(hdmitx_device->unplug_powerdown){
                hdmitx_set_display(hdmitx_device, HDMI_Unkown);
                if(hdmitx_device->HWOp.Cntl){
                    hdmitx_device->HWOp.Cntl(hdmitx_device, HDMITX_HWCMD_TURNOFF_HDMIHW, (hpdmode!=0)?1:0);    
                }
            }
            hdmitx_device->cur_VIC = HDMI_Unkown;
            hdmi_authenticated = -1;
			switch_set_state(&sdev, 0);
            hdmitx_device->hpd_event = 0;
            hdmitx_device->hpd_state = 0;
        }    
        else{
        }  
        /* authentication process */
#ifdef CONFIG_AML_HDMI_TX_HDCP
        if(hdmitx_device->cur_VIC != HDMI_Unkown){
            if(hdmitx_device->auth_process_timer>0){
                hdmitx_device->auth_process_timer--;
            }
            else{
                hdmi_authenticated = hdmitx_device->HWOp.Cntl(hdmitx_device, HDMITX_GET_AUTHENTICATE_STATE, NULL);
                if(auth_output_auto_off){
                    if(hdmi_authenticated){
                        hdmitx_device->HWOp.Cntl(hdmitx_device, HDMITX_OUTPUT_ENABLE, 1);
                    }
                    else{
                        hdmitx_device->HWOp.Cntl(hdmitx_device, HDMITX_OUTPUT_ENABLE, 0);
                    }
                }
                else{
                    hdmitx_device->HWOp.Cntl(hdmitx_device, HDMITX_OUTPUT_ENABLE, hdmi_output_on);
                }
            }
        }
#endif
        /**/    
        HDMI_PROCESS_DELAY;            
    }
#ifndef AVOS
    return 0;
#endif    

}
Exemplo n.º 6
0
static  int __init hdmitx_boot_para_setup(char *s)
{
    char separator[]={' ',',',';',0x0};
    char *token;
    unsigned token_len, token_offset, offset=0;
    int size=strlen(s);
    HDMI_DEBUG();
    do{
        token=next_token_ex(separator, s, size, offset, &token_len, &token_offset);
        if(token){
            if((token_len==3) && (strncmp(token, "off", token_len)==0)){
                init_flag|=INIT_FLAG_NOT_LOAD;
            }
            else if((token_len==7) && (strncmp(token, "vdacoff", token_len)==0)){
                init_flag|=INIT_FLAG_VDACOFF;
            }
            else if((token_len==16) && (strncmp(token, "unplug_powerdown", token_len)==0)){
                init_flag|=INIT_FLAG_POWERDOWN;
            }
            else if(strncmp(token, "pllmode1",  8)==0){
                    /* use external xtal as source of hdmi pll */
                hdmi_pll_mode = 1;
            }
            else if((token_len==7)&& (strncmp(token, "hpdmode", token_len)==0)){
                hpdmode = simple_strtoul(token+7,NULL,10);   
            }
            else if((token_len==3)&&(strncmp(token, "rgb", 3)==0)){
                hdmitx_output_rgb();    
            }
            else if(strncmp(token, "audpara", 7)==0){
                int tmp;
                tmp = simple_strtoul(token+7,NULL,10);
                hdmi_set_audio_para(tmp);
                printk("hdmi: set hdmi aud_para %d\n", tmp);
            }
            else if(strncmp(token, "bufsize", 7)==0){
                int tmp;
                tmp = simple_strtoul(token+7,NULL,10);
                if(tmp>=1024){
                    hdmi_log_buf_size=0;
                    hdmi_log_rd_pos=0;   
                    hdmi_log_wr_pos=0;   
                    hdmi_log_buf_size=tmp;
                    printk("hdmi: set log buffer size %d\n", tmp);
                }            
            }
            else if(strncmp(token, "powermode", 9)==0){
                int tmp;
                tmp = simple_strtoul(token+9,NULL,10);
                init_powermode=tmp|0x80;
                printk("hdmi: set init powermode %d\n", tmp);                
            }
            else if(strncmp(token, "audiooff", 8)==0){
                hdmi_audio_off_flag = 1;
                printk("hdmi: set no audio output\n");
            }
            else if(strncmp(token, "prbs", 4)==0){
                hdmi_prbs_mode = simple_strtoul(token+4,NULL,16);
                printk("hdmi, set prbs mode as %x always\n", hdmi_prbs_mode);    
            }
            else if(strncmp(token, "480p_clk", 8)==0){
                hdmi_480p_force_clk = simple_strtoul(token+8,NULL,10);
                printk("hdmi, set 480p mode clock as %dMHz always\n", hdmi_480p_force_clk);    
            }
            else if(strncmp(token, "true", 4)==0){
                init_flag |= INIT_FLAG_CEC_FUNC;
                printk("hdmi: enable cec function\n");    
            }
            
        }    
        offset=token_offset;
    }while(token);
    return 0;
}
Exemplo n.º 7
0
static int 
#else
static void
#endif
hdmi_task_handle(void *data) 
{
    extern void hdmitx_edid_ram_buffer_clear(hdmitx_dev_t*);
    hdmitx_dev_t* hdmitx_device = (hdmitx_dev_t*)data;

    hdmitx_init_parameters(&hdmitx_device->hdmi_info);

    HDMITX_M1B_Init(hdmitx_device);

    //When init hdmi, clear the hdmitx module edid ram and edid buffer.
    hdmitx_edid_ram_buffer_clear(hdmitx_device);

    hdmitx_device->HWOp.SetupIRQ(hdmitx_device);

    if(hdmitx_device->HWOp.Cntl){
        if(init_flag&INIT_FLAG_VDACOFF){
            hdmitx_device->HWOp.Cntl(hdmitx_device, HDMITX_HWCMD_VDAC_OFF, 0);    
        }
        if(init_powermode&0x80){
            hdmitx_device->HWOp.Cntl(hdmitx_device, HDMITX_HWCMD_POWERMODE_SWITCH, init_powermode&0x1f);    
        }
    }
    if(init_flag&INIT_FLAG_POWERDOWN){
        hdmitx_device->HWOp.SetDispMode(NULL); //power down
        hdmitx_device->unplug_powerdown=1;
        if(hdmitx_device->HWOp.Cntl){
            hdmitx_device->HWOp.Cntl(hdmitx_device, HDMITX_HWCMD_TURNOFF_HDMIHW, (hpdmode!=0)?1:0);    
        }
    }
    else{
        if(hdmitx_device->HWOp.Cntl){
            hdmitx_device->HWOp.Cntl(hdmitx_device, HDMITX_HWCMD_MUX_HPD, 0);    
        }
    }
    
    HDMI_DEBUG();

    while (hdmitx_device->hpd_event != 0xff)
    {
        if((hdmitx_device->vic_count == 0)&&(hdmitx_device->mux_hpd_if_pin_high_flag)){
            if(hdmitx_device->HWOp.Cntl){
                hdmitx_device->HWOp.Cntl(hdmitx_device, HDMITX_HWCMD_MUX_HPD_IF_PIN_HIGH, 0);
            }
        }
        
        if((!hdmi_audio_off_flag)&&(hdmitx_device->audio_param_update_flag)&&(hdmitx_device->cur_VIC != HDMI_Unkown)){
            hdmitx_set_audio(hdmitx_device, &(hdmitx_device->cur_audio_param));
            hdmitx_device->audio_param_update_flag = 0;
            hdmi_print(1, "HDMI: set audio param\n");
        }

        if (hdmitx_device->hpd_event == 1)
        {
            if(hdmitx_device->HWOp.GetEDIDData(hdmitx_device)){
                hdmitx_edid_clear(hdmitx_device);
                hdmitx_edid_parse(hdmitx_device);
                set_disp_mode_auto();

                hdmitx_device->hpd_event = 0;
            }    
        }
        else if(hdmitx_device->hpd_event == 2)
        {
            //When unplug hdmi, clear the hdmitx module edid ram and edid buffer.
            hdmitx_edid_ram_buffer_clear(hdmitx_device);
            hdmitx_edid_clear(hdmitx_device);

            if(hdmitx_device->unplug_powerdown){
                hdmitx_set_display(hdmitx_device, HDMI_Unkown);
                if(hdmitx_device->HWOp.Cntl){
                    hdmitx_device->HWOp.Cntl(hdmitx_device, HDMITX_HWCMD_TURNOFF_HDMIHW, (hpdmode!=0)?1:0);    
                }
            }
            hdmitx_device->cur_VIC = HDMI_Unkown;

            hdmitx_device->hpd_event = 0;
        }    
        else{
        }            
#ifdef AVOS
        AVTimeDly(500);
#else
        msleep(500);
#endif        
    }
#ifndef AVOS
    return 0;
#endif    

}