Exemple #1
0
__s32 Disp_lcdc_init(__u32 sel)
{
	irqreturn_t ret;

	LCD_get_sys_config(sel, &(gdisp.screen[sel].lcd_cfg));

	lcdc_clk_init(sel);
	lvds_clk_init();
	lcdc_clk_on(sel); /* ??need to be open */
	LCDC_init(sel);
	lcdc_clk_off(sel);

	if (sel == 0)
		ret = request_irq(INTC_IRQNO_LCDC0, Disp_lcdc_event_proc,
				  IRQF_DISABLED, "sunxi lcd0", (void *)sel);
	else
		ret = request_irq(INTC_IRQNO_LCDC1, Disp_lcdc_event_proc,
				  IRQF_DISABLED, "sunxi lcd1", (void *)sel);

	if (gdisp.screen[sel].lcd_cfg.lcd_used) {
		if (lcd_panel_fun[sel].cfg_panel_info)
			lcd_panel_fun[sel].cfg_panel_info(&gpanel_info[sel]);
		else
			LCD_get_panel_para(sel, &gpanel_info[sel]);

		gpanel_info[sel].tcon_index = 0;

		if (!sunxi_is_version_A() &&
		    (gpanel_info[sel].lcd_pwm_not_used == 0)) {
			__pwm_info_t pwm_info;

			pwm_info.enable = 0;
			pwm_info.active_state = 1;
			pwm_info.period_ns =
			    1000000 / gpanel_info[sel].lcd_pwm_freq;
			if (gpanel_info[sel].lcd_pwm_pol == 0)
				pwm_info.duty_ns =
				    (gdisp.screen[sel].lcd_cfg.init_bright *
				     pwm_info.period_ns) / 256;
			else
				pwm_info.duty_ns =
				    ((256 -
				      gdisp.screen[sel].lcd_cfg.init_bright) *
				     pwm_info.period_ns) / 256;

			pwm_set_para(gpanel_info[sel].lcd_pwm_ch, &pwm_info);
		}
		LCD_GPIO_init(sel);
	}

	return DIS_SUCCESS;
}
Exemple #2
0
__s32 Disp_lcdc_init(__u32 sel)
{
    LCD_get_sys_config(sel, &(gdisp.screen[sel].lcd_cfg));

    lcdc_clk_init(sel);
    lvds_clk_init();
    lcdc_clk_on(sel);	//??need to be open
    LCDC_init(sel);
    lcdc_clk_off(sel);

    if(sel == 0)
    {
        OSAL_RegISR(INTC_IRQNO_LCDC0,0,Disp_lcdc_event_proc,(void*)sel,0,0);
#ifndef __LINUX_OSAL__
        OSAL_InterruptEnable(INTC_IRQNO_LCDC0);
        LCD_get_panel_funs_0(&lcd_panel_fun[sel]);
#endif
    }
    else
    {
        OSAL_RegISR(INTC_IRQNO_LCDC1,0,Disp_lcdc_event_proc,(void*)sel,0,0);
#ifndef __LINUX_OSAL__
        OSAL_InterruptEnable(INTC_IRQNO_LCDC1);
        LCD_get_panel_funs_1(&lcd_panel_fun[sel]);
#endif
    }

    if(gdisp.screen[sel].lcd_cfg.lcd_used)
    {
        if(lcd_panel_fun[sel].cfg_panel_info)
        {
            lcd_panel_fun[sel].cfg_panel_info(&gpanel_info[sel]);
        }
        else
        {
            LCD_get_panel_para(sel, &gpanel_info[sel]);
        }
        gpanel_info[sel].tcon_index = 0;

        if((OSAL_sw_get_ic_ver() != 0xA) && (gpanel_info[sel].lcd_pwm_not_used == 0))
        {
            __pwm_info_t pwm_info;

            pwm_info.enable = 0;
            pwm_info.active_state = 1;
            pwm_info.period_ns = 1000000 / gpanel_info[sel].lcd_pwm_freq;
            if(gpanel_info[sel].lcd_pwm_pol == 0)
            {
                pwm_info.duty_ns = (192 * pwm_info.period_ns) / 256;
            }
            else
            {
                pwm_info.duty_ns = ((256 - 192) * pwm_info.period_ns) / 256;
            }
            pwm_set_para(gpanel_info[sel].lcd_pwm_ch, &pwm_info);
        }
        LCD_GPIO_init(sel);
    }

    return DIS_SUCCESS;
}