Ejemplo n.º 1
0
/*===========================================================================


FUNCTION     get_compass_gs_position

DESCRIPTION
  This function probe which G-sensor & Campass status type should be used

DEPENDENCIES
  
RETURN VALUE
  None

SIDE EFFECTS
  None
===========================================================================*/
compass_gs_position_type  get_compass_gs_position(void)
{
	compass_gs_position_type compass_gs_position=COMPASS_TOP_GS_TOP;
	/* modify compass and gs position by board id */
    //move C8820\25D define from TOP to BOTTOM
	if (machine_is_msm7x27a_surf() 
	 || machine_is_msm7x27a_ffa() 
	 || machine_is_msm7x27a_umts() 
	 || machine_is_msm7x27a_cdma()
	 || machine_is_msm7x27a_U8815()) 
	{
		compass_gs_position=COMPASS_TOP_GS_TOP;
	}
	/*< DTS2012022006500 yangbo 20120220 begin */
	/*version A and version B has compass, since version C don't have compass*/
	else if(machine_is_msm7x27a_C8820() && (HW_VER_SUB_VC <= get_hw_sub_board_id()))
	{
		compass_gs_position=COMPASS_NONE_GS_BOTTOM;
	}
	/* DTS2012022006500 yangbo 20120220 end > */
	/* add U8655_EMMC, use the u8655 configuration */
	else if (machine_is_msm7x27a_U8655() 
		  || machine_is_msm7x27a_U8655_EMMC()  
		  || machine_is_msm7x27a_C8655_NAND()  
		  || machine_is_msm7x27a_M660()  
		  || machine_is_msm7x27a_U8661()    
		  || machine_is_msm7x27a_C8820()   
		  || machine_is_msm7x27a_C8825D()
		  || machine_is_msm7x30_u8800()
		  || machine_is_msm7x30_u8820() 
		  || machine_is_msm7x30_u8800_51()
		  || machine_is_msm8255_u8800_pro()
		  || machine_is_msm8255_u8860() 
		  || machine_is_msm8255_c8860() 
		  || machine_is_msm8255_u8860lp()
          /* < DTS2012022905490 ganfan 20120301 begin */
          || machine_is_msm8255_u8860_r()
          /* DTS2012022905490 ganfan 20120301 end > */
		  || machine_is_msm8255_u8860_92()            
		  || machine_is_msm8255_u8860_51())
	{
		compass_gs_position=COMPASS_BOTTOM_GS_BOTTOM;
	}
	else if (machine_is_msm7x27a_U8185())	
	{
		compass_gs_position=COMPASS_NONE_GS_TOP;
	}
	else if(machine_is_msm8255_u8680() 
	     || machine_is_msm8255_u8730())
	{
	    compass_gs_position=COMPASS_TOP_GS_TOP;
	}
	/*< DTS2012022300887 fengwei 20120224 begin */
    else if (machine_is_msm7x27a_C8668D() )	
	{
		compass_gs_position = COMPASS_BOTTOM_GS_TOP;
	}
	/* DTS2012022300887 fengwei 20120224 end >*/
	return compass_gs_position;
}
/*===========================================================================


FUNCTION     get_compass_gs_position

DESCRIPTION
  This function probe which G-sensor & Campass status type should be used

DEPENDENCIES
  
RETURN VALUE
  None

SIDE EFFECTS
  None
===========================================================================*/
compass_gs_position_type  get_compass_gs_position(void)
{
	compass_gs_position_type compass_gs_position=COMPASS_TOP_GS_TOP;
	/* modify compass and gs position by board id */
    //move C8820\25D define from TOP to BOTTOM
    if (machine_is_msm7x27a_surf() 
        || machine_is_msm7x27a_ffa() 
        || machine_is_msm7x27a_U8815()
        || machine_is_msm8x25_C8950D()
        || (machine_is_msm8x25_U8950() && (HW_VER_SUB_VB <= get_hw_sub_board_id()))
        || machine_is_msm8x25_U8950D()
        )
	{
		compass_gs_position=COMPASS_TOP_GS_TOP;
	}
	/*version A and version B has compass, since version C don't have compass*/
	else if(machine_is_msm7x27a_C8820() && (HW_VER_SUB_VC <= get_hw_sub_board_id()))
	{
		compass_gs_position=COMPASS_NONE_GS_BOTTOM;
	}
	/* add U8655_EMMC, use the u8655 configuration */
	else if (machine_is_msm7x27a_U8655() 
		  || machine_is_msm7x27a_U8655_EMMC()  
		  || machine_is_msm7x27a_C8655_NAND()  
		  || machine_is_msm7x27a_M660()  
		  || machine_is_msm7x27a_U8661()    
		  || machine_is_msm7x27a_C8820()   
		  || machine_is_msm8x25_C8825D()
		  || machine_is_msm7x30_u8800()
		  || machine_is_msm7x30_u8820() 
		  || machine_is_msm7x30_u8800_51()
		  || machine_is_msm8255_u8800_pro()
		  || machine_is_msm8255_u8860() 
		  || machine_is_msm8255_c8860()
		  || machine_is_msm8x25_U8825()
          || machine_is_msm8x25_U8825D()
		  || (machine_is_msm8x25_U8950() && (HW_VER_SUB_VA == get_hw_sub_board_id()))
		  || machine_is_msm8255_u8860lp()
          || machine_is_msm8255_u8860_r()
		  || machine_is_msm8255_u8860_92()            
		  || machine_is_msm8255_u8860_51())
	{
		compass_gs_position=COMPASS_BOTTOM_GS_BOTTOM;
	}
	else if (machine_is_msm7x27a_U8185())	
	{
		compass_gs_position=COMPASS_NONE_GS_TOP;
	}
	else if(machine_is_msm8255_u8680() 
	     || machine_is_msm8255_u8730())
	{
	    compass_gs_position=COMPASS_TOP_GS_TOP;
	}
    else if (machine_is_msm7x27a_C8668D() )	
	{
		compass_gs_position = COMPASS_BOTTOM_GS_TOP;
	}
	return compass_gs_position;
}
Ejemplo n.º 3
0
/*
 *brief: get lcd panel resolution
 */
lcd_type get_hw_lcd_resolution_type(void)
{
    lcd_type lcd_resolution = LCD_IS_HVGA;

/*< DTS2012020306500 lijianzhao 20120204 begin */
/* add 8x55 paltform products */
	if ( machine_is_msm7x27a_U8815() 
		|| machine_is_msm7x27a_C8820()
		|| machine_is_msm7x27a_C8825D()
		|| machine_is_msm7x30_u8800()
		|| machine_is_msm7x30_u8820() 
		|| machine_is_msm7x30_u8800_51() 
		|| machine_is_msm8255_u8800_pro()
		|| machine_is_msm8255_u8680()
		|| machine_is_msm8255_u8730())
	{
		lcd_resolution = LCD_IS_WVGA;
	}
	else if (machine_is_msm8255_u8860() 
		|| machine_is_msm8255_c8860() 
		|| machine_is_msm8255_u8860lp()
        /* < DTS2012022905490 ganfan 20120301 begin */
        || machine_is_msm8255_u8860_r()
        /* DTS2012022905490 ganfan 20120301 end > */
		|| machine_is_msm8255_u8860_92()
		|| machine_is_msm8255_u8860_51())
	{
		lcd_resolution = LCD_IS_FWVGA;
	}
/* DTS2012020306500 lijianzhao 20120204 end >*/
/*< DTS2012021602342 zhongjinrong 20120224 begin */
/*< DTS2012021007223 lijianzhao 20120211 begin */
	/*< DTS2012022300887 fengwei 20120224 begin */
	/* C8668D uses HVGA. */
	else if ( machine_is_msm7x27a_M660() 
		|| machine_is_msm7x27a_U8655()	
		|| machine_is_msm7x27a_U8655_EMMC()
		|| machine_is_msm7x27a_C8655_NAND()
		|| machine_is_msm8255_u8667()
		|| machine_is_msm7x27a_U8661()
		|| machine_is_msm7x27a_C8668D())
	/* DTS2012022300887 fengwei 20120224 end >*/
/* DTS2012021007223 lijianzhao 20120211 end >*/
/* DTS2012021602342 zhongjinrong 20120224 end >*/
	{
		lcd_resolution = LCD_IS_HVGA;
	}
	else if (machine_is_msm7x27a_U8185())
	{
		lcd_resolution = LCD_IS_QVGA;
	}
	else
	{
		lcd_resolution = LCD_IS_HVGA;
	}

    return lcd_resolution;
}
/*
 *brief: get lcd panel resolution
 */
lcd_type get_hw_lcd_resolution_type(void)
{
    lcd_type lcd_resolution = LCD_IS_HVGA;

/* add 8x55 paltform products */
    /*delete some lines for changing the lcd resolution of C8950D/U8950*/
    if ( machine_is_msm7x27a_U8815() 
        || machine_is_msm8x25_U8825()
        || machine_is_msm8x25_U8825D()
        || machine_is_msm7x27a_C8820()
        || machine_is_msm8x25_C8825D()
        || machine_is_msm7x30_u8800()
        || machine_is_msm7x30_u8820() 
        || machine_is_msm7x30_u8800_51() 
        || machine_is_msm8255_u8800_pro()
        || machine_is_msm8255_u8680()
        || machine_is_msm8255_u8730())
	{
		lcd_resolution = LCD_IS_WVGA;
	}
	else if (machine_is_msm8x25_C8950D()
		|| machine_is_msm8x25_U8950()
		|| machine_is_msm8x25_U8950D())
	{
		lcd_resolution = LCD_IS_QHD;
	}
	else if (machine_is_msm8255_u8860() 
		|| machine_is_msm8255_c8860() 
		|| machine_is_msm8255_u8860lp()
        || machine_is_msm8255_u8860_r()
		|| machine_is_msm8255_u8860_92()
		|| machine_is_msm8255_u8860_51())
	{
		lcd_resolution = LCD_IS_FWVGA;
	}
	/* C8668D uses HVGA. */
	else if ( machine_is_msm7x27a_M660() 
		|| machine_is_msm7x27a_U8655()	
		|| machine_is_msm7x27a_U8655_EMMC()
		|| machine_is_msm7x27a_C8655_NAND()
		|| machine_is_msm8255_u8667()
		|| machine_is_msm7x27a_U8661()
		|| machine_is_msm7x27a_C8668D())
	{
		lcd_resolution = LCD_IS_HVGA;
	}
	else if (machine_is_msm7x27a_U8185())
	{
		lcd_resolution = LCD_IS_QVGA;
	}
	else
	{
		lcd_resolution = LCD_IS_HVGA;
	}

    return lcd_resolution;
}
Ejemplo n.º 5
0
static long hw_camera_led_ioctl(struct file *filep ,unsigned int cmd, unsigned long arg)
{
    int ret = 0;
    unsigned int camera_led_state;

    CDBG("function %s enterence\n", __func__);
    switch (cmd)
    {
    case CAMERA_LED_GET:

        camera_led_state = atomic_read(&camera_led_flag);
        if (copy_to_user((void __user *)arg, &camera_led_state, sizeof(camera_led_state)))
        {
            pr_err("function copy_to_user fail");
            ret = -EFAULT;
        }

        break;
    case CAMERA_LED_SET:
        if (copy_from_user(&camera_led_state, (void __user *)arg, sizeof(camera_led_state)))
        {
            pr_err("function copy_from_user fail");
            ret = -EFAULT;
        }
        else
        {
            /* U8680 and U8730 use tps61310 flash driver IC, so set led with tps61310 function */
#ifdef CONFIG_ARCH_MSM7X27A
			ret = tps61310_set_flash(camera_led_state);
#else
            if (machine_is_msm8255_u8680() 
               || machine_is_msm8255_u8730()
               //|| machine_is_msm8255_u8867z()
				)
            {
                tps61310_set_flash(camera_led_state);
            }
            else
            {
                ret = msm_camera_flash_set_led_state(&hw_camera_led_data, camera_led_state);
            }
#endif

            if (!ret)
            {
                atomic_set(&camera_led_flag, camera_led_state);
            }
        }

        break;
    default:
        pr_err("hw_camera_led_ioctl:error ioctl cmd");
        ret = -EINVAL;
    }

    return ret;
}
Ejemplo n.º 6
0
/* C8820VC uses PM pwm. */
hw_lcd_ctrl_bl_type get_hw_lcd_ctrl_bl_type(void)
{
    hw_lcd_ctrl_bl_type ctrl_bl_type = CTRL_BL_BY_UNKNOW;
	/*< DTS2012021602342 zhongjinrong 20120224 begin */
	/*control backlight by MSM pwm*/
	/*< DTS2012022300887 fengwei 20120224 begin */
	/* C8668D uses PM pwm. */
	if (machine_is_msm7x27a_umts() 
		|| machine_is_msm7x27a_cdma()
		|| machine_is_msm7x27a_U8815() 
		|| machine_is_msm7x27a_U8655_EMMC()
		|| machine_is_msm7x27a_U8185() 
		|| machine_is_msm7x27a_U8655()
		|| machine_is_msm7x27a_M660()
		|| machine_is_msm7x30_u8800()
		|| machine_is_msm7x30_u8820() 
		|| machine_is_msm7x30_u8800_51() 
		|| machine_is_msm8255_u8800_pro()
		|| machine_is_msm8255_u8860() 
		|| machine_is_msm8255_c8860()
		|| machine_is_msm8255_u8860_92()
		|| (machine_is_msm7x27a_C8820() && (HW_VER_SUB_VC <= get_hw_sub_board_id()))
		||machine_is_msm7x27a_U8661()
		|| machine_is_msm7x27a_C8668D() 
		)
	/* DTS2012022300887 fengwei 20120224 end >*/
		/* DTS2012021602342 zhongjinrong 20120224 end >*/
	{
		ctrl_bl_type = CTRL_BL_BY_MSM;
	}
	/*control backlight by LCD output pwm*/
/*< DTS2012021007223 lijianzhao 20120211 begin */
	else if(machine_is_msm7x27a_C8655_NAND()
		|| (machine_is_msm7x27a_C8820() && (HW_VER_SUB_VA == get_hw_sub_board_id()))
		|| machine_is_msm7x27a_C8825D()
        /* < DTS2012022905490 ganfan 20120301 begin */
        || machine_is_msm8255_u8860_r()
        /* DTS2012022905490 ganfan 20120301 end > */
		|| machine_is_msm8255_u8860lp()
		|| machine_is_msm8255_u8860_51()
		/*< DTS2012042605475 zhongjinrong 20120426 begin  */
		|| machine_is_msm8255_u8667()
     	|| machine_is_msm8255_u8680()
	 	|| machine_is_msm8255_u8730())
		/* DTS2012042605475 zhongjinrong 20120426 end >*/
/* DTS2012021007223 lijianzhao 20120211 end >*/
	{
		ctrl_bl_type = CTRL_BL_BY_LCD;
	}
	else
	{
		ctrl_bl_type = CTRL_BL_BY_LCD;
	}
    return ctrl_bl_type;
}
static int rsp61408_lcd_on(struct platform_device *pdev)
{
	boolean para_debug_flag = FALSE;
    uint32 para_num = 0;
	int ret = 0;
	switch(lcd_panel_wvga)
	{
		case MDDI_RSP61408_BYD_WVGA:
		case MDDI_RSP61408_CHIMEI_WVGA:
			para_debug_flag = lcd_debug_malloc_get_para( "rsp61408_wvga_init_table", 
	    		(void**)&rsp61408_wvga_init_table,&para_num);
			break;
		default:
			break;
	}
    if( (TRUE == para_debug_flag)&&(NULL != rsp61408_wvga_init_table))
    {
		ret = process_mddi_table(rsp61408_wvga_init_table, para_num, lcd_panel_wvga);
    }
    else
    {
		/*reset the direction register to resolve the problem of revert. */
		/* Exit Standby Mode */
		if(machine_is_msm8255_u8730())
		{
			ret = process_mddi_table((struct sequence*)&reverse_rsp61408_wvga_exit_table, 
					ARRAY_SIZE(reverse_rsp61408_wvga_exit_table), lcd_panel_wvga);
		}
		else
		{
		ret = process_mddi_table((struct sequence*)&rsp61408_wvga_standby_exit_table, 
			ARRAY_SIZE(rsp61408_wvga_standby_exit_table), lcd_panel_wvga);
		}
    }
       
	if((TRUE == para_debug_flag)&&(NULL != rsp61408_wvga_init_table))
	{
		lcd_debug_free_para((void *)rsp61408_wvga_init_table);
	}
	
    LCD_DEBUG("%s: rsp61408_lcd exit sleep mode ,on_ret=%d\n",__func__,ret);
	
	return ret;
}
Ejemplo n.º 8
0
void __ref msm_snddev_init_timpani(void)
{
#ifndef CONFIG_HUAWEI_KERNEL
	platform_add_devices(snd_devices_ffa,
			ARRAY_SIZE(snd_devices_ffa));
#ifdef CONFIG_DEBUG_FS
	debugfs_hsed_config = debugfs_create_file("msm_hsed_config",
				S_IFREG | S_IWUGO, NULL,
		(void *) "msm_hsed_config", &snddev_hsed_config_debug_fops);
	if (!debugfs_hsed_config)
		pr_err("failed to create msm_head_config debug fs entry\n");
#endif
#else  //#ifndef CONFIG_HUAWEI_KERNEL
    if (machine_is_msm7x30_ffa() || machine_is_msm8x55_ffa() ||
    		machine_is_msm8x55_svlte_ffa()) {
    		platform_add_devices(snd_devices_ffa,
		ARRAY_SIZE(snd_devices_ffa));
#ifdef CONFIG_DEBUG_FS
        debugfs_hsed_config = debugfs_create_file("msm_hsed_config",
        			S_IFREG | S_IWUGO, NULL,
    	(void *) "msm_hsed_config", &snddev_hsed_config_debug_fops);
        if (!debugfs_hsed_config)
        	pr_err("failed to create msm_head_config debug fs entry\n");	
#endif        
    }else if( machine_is_msm8255_u8860() 
	        || machine_is_msm8255_u8860lp() 
            || machine_is_msm8255_u8860_92()
            || machine_is_msm8255_u8680()
            || machine_is_msm8255_u8860_51()
			|| machine_is_msm8255_u8730())
    {
        platform_add_devices(snd_devices_u8860, ARRAY_SIZE(snd_devices_u8860));
    }else if (machine_is_msm8255_c8860())
    {
        platform_add_devices(snd_devices_c8860, arraysize_c8860);
    }
    else
    {
        platform_add_devices(snd_devices_u8860, ARRAY_SIZE(snd_devices_u8860));
    }
#endif  //#ifndef CONFIG_HUAWEI_KERNEL

}
static int get_current_machine()
{
    if( (machine_is_msm8255_u8800_pro())
		|| (machine_is_msm8255_u8860()) 
		|| (machine_is_msm8255_c8860()) 
		|| (machine_is_msm8255_u8860lp())
        /* < DTS2012022905490 ganfan 20120301 begin */
        || machine_is_msm8255_u8860_r()
        /* DTS2012022905490 ganfan 20120301 end > */
		|| (machine_is_msm8255_u8860_92())            
		|| (machine_is_msm8255_u8860_51())
		|| (machine_is_msm8255_u8680()) 
	    || (machine_is_msm8255_u8730()))
    {
        OEMINFO_RPC_DEBUG("8x55 oeminfo. \n");
        return HW_MACHINE_8X55;
    }
    else
    {
        OEMINFO_RPC_DEBUG("27a25a oeminfo. \n");
        return HW_MACHINE_7X2725A;
    }
}
lcd_panel_type get_lcd_panel_type(void)
{
	lcd_panel_type hw_lcd_panel = LCD_NONE;

	if ( machine_is_msm7x30_u8800()
		|| machine_is_msm7x30_u8820() 
		|| machine_is_msm7x30_u8800_51() 
		|| machine_is_msm8255_u8800_pro())
	{
		switch (lcd_id)
		{
			case LCD_HW_ID0:  
				hw_lcd_panel = LCD_NT35582_BYD_WVGA;
				break;
			case LCD_HW_ID1:  
				hw_lcd_panel = LCD_NT35582_TRULY_WVGA;
				break;
			case LCD_HW_ID2:  
				hw_lcd_panel = LCD_NT35510_ALPHA_SI_WVGA;
				break;
			case LCD_HW_ID3:  
				hw_lcd_panel = LCD_NT35510_ALPHA_SI_WVGA_TYPE2;
				break;
			default : 
				hw_lcd_panel = LCD_NT35510_ALPHA_SI_WVGA;
				break;					  
		}
	}
	else if (machine_is_msm8255_u8860() 
		|| machine_is_msm8255_c8860() 
		|| machine_is_msm8255_u8860lp()
        || machine_is_msm8255_u8860_r()
		|| machine_is_msm8255_u8860_92()
		|| machine_is_msm8255_u8860_51())
	{
		switch (lcd_id)
		{
			case LCD_HW_ID0:
				hw_lcd_panel = LCD_NT35560_TOSHIBA_FWVGA;
				break;
			default : 
				hw_lcd_panel = LCD_NT35560_TOSHIBA_FWVGA;
				break;					  
		}
	}
	else if( machine_is_msm8255_u8680()
		|| machine_is_msm8255_u8730())

	{
		switch (lcd_id)
		{
			case LCD_HW_ID0:
				hw_lcd_panel = MDDI_RSP61408_CHIMEI_WVGA;
				break;
			case LCD_HW_ID1:
				hw_lcd_panel = MDDI_HX8369A_TIANMA_WVGA;
				break;
			case LCD_HW_ID2:
				hw_lcd_panel = MDDI_RSP61408_BYD_WVGA;
				break;
			default : 
				hw_lcd_panel = MDDI_RSP61408_CHIMEI_WVGA;
				break;
		}
	}
	else if( machine_is_msm8255_u8667())
	{
		switch (lcd_id)
		{
			case LCD_HW_ID0:
				hw_lcd_panel = MDDI_HX8357C_CHIMEI_HVGA;
				break;
			case LCD_HW_ID2:
				hw_lcd_panel = MDDI_HX8357C_CHIMEI_IPS_HVGA;
				break;
			case LCD_HW_ID3:
				hw_lcd_panel = MDDI_HX8357C_TIANMA_HVGA;
				break;
			default:
				hw_lcd_panel = MDDI_HX8357C_CHIMEI_HVGA;
				break;		
		}
	}
    /*delete some lines for changing the lcd panel type of C8950D/U8950D*/
    else if( machine_is_msm7x27a_U8815() 
        || machine_is_msm7x27a_C8820()
        || machine_is_msm8x25_U8825()
        || machine_is_msm8x25_U8825D()
        || machine_is_msm8x25_C8825D()
        )
	{
		switch (lcd_id)
		{
			case LCD_HW_ID0:
				hw_lcd_panel = MIPI_RSP61408_CHIMEI_WVGA;
				break;
			case LCD_HW_ID1:
				hw_lcd_panel = MIPI_HX8369A_TIANMA_WVGA;
				break;
			case LCD_HW_ID2:
				hw_lcd_panel = MIPI_RSP61408_BYD_WVGA;
				break;
			case LCD_HW_ID3:
				hw_lcd_panel = MIPI_RSP61408_TRULY_WVGA;
				break;
			default:
				/*no mipi LCD lead to block, so default lcd RGB */
				hw_lcd_panel = MIPI_RSP61408_CHIMEI_WVGA;
				break;
		}
	}
	else if (machine_is_msm8x25_C8950D()
		|| machine_is_msm8x25_U8950()
		|| machine_is_msm8x25_U8950D())  
	{
		switch (lcd_id)
		{
			case LCD_HW_ID3:
				hw_lcd_panel = MIPI_NT35516_TIANMA_QHD;
				break;
			default: 
				hw_lcd_panel = MIPI_NT35516_TIANMA_QHD;
				break;
		}
	}
	else if( machine_is_msm7x27a_U8655() 
		|| machine_is_msm7x27a_U8655_EMMC() 
		|| machine_is_msm7x27a_C8655_NAND()
		|| machine_is_msm7x27a_U8661()
		|| machine_is_msm7x27a_C8668D())
	{
		switch (lcd_id)
		{
			case LCD_HW_ID0:
				hw_lcd_panel = MIPI_HX8357C_CHIMEI_HVGA;
				break;
			case LCD_HW_ID1:
			    hw_lcd_panel = MIPI_HX8357C_TIANMA_IPS_HVGA;
				break;
			case LCD_HW_ID2:
				hw_lcd_panel = MIPI_HX8357C_CHIMEI_IPS_HVGA;
				break;
			case LCD_HW_ID3:
				hw_lcd_panel = MIPI_HX8357C_TIANMA_HVGA;
				break;
			default: 
				/*no mipi LCD lead to block, so default lcd RGB */
				hw_lcd_panel = LCD_HX8357B_TIANMA_HVGA;
				break;
		}
	}
	else if( machine_is_msm7x27a_U8185())
	{
		switch(lcd_id)
		{
			case LCD_HW_ID0:
				hw_lcd_panel = LCD_HX8347D_TRULY_QVGA;
				break;
			case LCD_HW_ID2:
				hw_lcd_panel = LCD_HX8347G_TIANMA_QVGA;
				break;
			case LCD_HW_ID3:
				hw_lcd_panel = LCD_HX8347D_CHIMEI_QVGA;
				break;
			default:
				hw_lcd_panel = LCD_HX8347G_TIANMA_QVGA;
				break;
		}
	}
	else if(machine_is_msm7x27a_M660())
	{
		switch(lcd_id)
		{
			case LCD_HW_ID0:
				hw_lcd_panel = LCD_HX8357C_TIANMA_HVGA;
				break;
			case LCD_HW_ID1:
				hw_lcd_panel = LCD_HX8357B_TIANMA_HVGA;
				break;
			default:
				hw_lcd_panel = LCD_HX8357C_TIANMA_HVGA;
				break;
		}
	}
	else
	{
		hw_lcd_panel = LCD_HX8357B_TIANMA_HVGA;
	}
	return hw_lcd_panel;
}
/*  FUNCTION  get_hw_lcd_interface_type
 *  DEPENDENCIES 
 *      get lcd interface type
 *      affect nfc.
 *  RETURN VALUE
 *      lcd interface type:LCD_IS_MIPI or LCD_IS_RGB
 */
hw_lcd_interface_type get_hw_lcd_interface_type(void)
{
	hw_lcd_interface_type lcd_interface_type;
	lcd_panel_type  hw_lcd_panel = LCD_NONE;
	
	hw_lcd_panel = get_lcd_panel_type();	

	if (machine_is_msm7x30_u8800())
	{
		lcd_interface_type = LCD_IS_MDDI_TYPE1;
	}	
	/* U8820 board version A is MMDI type1, so config it type1 
	 * Version B and other is MDDI type2, so config it according to LCD
	 */
	else if(machine_is_msm7x30_u8820())
	{
		if(HW_VER_SUB_VA == get_hw_sub_board_id())
		{
			lcd_interface_type = LCD_IS_MDDI_TYPE1;
		}
		else
		{
			switch(hw_lcd_panel)
			{
				case LCD_NT35582_BYD_WVGA:
				case LCD_NT35582_TRULY_WVGA:
					lcd_interface_type = LCD_IS_MDDI_TYPE1;
					break;
				case LCD_NT35510_ALPHA_SI_WVGA:
					lcd_interface_type = LCD_IS_MDDI_TYPE1;
					break;
				case LCD_NT35510_ALPHA_SI_WVGA_TYPE2:
					lcd_interface_type = LCD_IS_MDDI_TYPE2;
					break;
				default:
					lcd_interface_type = LCD_IS_MDDI_TYPE1;
					break;
			}
		}
	}
	else if (machine_is_msm7x30_u8800_51() 
		|| machine_is_msm8255_u8800_pro())
	{
		switch(hw_lcd_panel)
		{
			case LCD_NT35582_BYD_WVGA:
			case LCD_NT35582_TRULY_WVGA:
				lcd_interface_type = LCD_IS_MDDI_TYPE1;
				break;
			case LCD_NT35510_ALPHA_SI_WVGA:
				lcd_interface_type = LCD_IS_MDDI_TYPE1;
				break;
			case LCD_NT35510_ALPHA_SI_WVGA_TYPE2:
				lcd_interface_type = LCD_IS_MDDI_TYPE2;
				break;
			default:
				lcd_interface_type = LCD_IS_MDDI_TYPE1;
				break;
		}
	}
    else if (machine_is_msm8255_u8860() 
		|| machine_is_msm8255_c8860() 
		|| machine_is_msm8255_u8860lp()
        || machine_is_msm8255_u8860_r()
		|| machine_is_msm8255_u8860_92()
		|| machine_is_msm8255_u8680()
		|| machine_is_msm8255_u8860_51()
		|| machine_is_msm8255_u8730())
	{
		lcd_interface_type = LCD_IS_MDDI_TYPE2;
	}

	else if (machine_is_msm8255_u8667())
	{
		lcd_interface_type = LCD_IS_MDDI_TYPE1;
	}
	else if(machine_is_msm7x27a_U8185()
		||machine_is_msm7x27a_M660())
	{
		lcd_interface_type = LCD_IS_RGB;
	}
	else
	{
		lcd_interface_type = LCD_IS_MIPI_CMD;
	}
	return lcd_interface_type;
}
static int pmic8xxx_kp_read_matrix(struct pmic8xxx_kp *kp, u16 *new_state,
					 u16 *old_state)
{
	int rc, read_rows;
	u8 scan_val;
#ifdef CONFIG_HUAWEI_KERNEL
	int i=0;
#endif

	if (kp->pdata->num_rows < PM8XXX_MIN_ROWS)
		read_rows = PM8XXX_MIN_ROWS;
	else
		read_rows = kp->pdata->num_rows;

	pmic8xxx_chk_sync_read(kp);

	if (old_state) {
		rc = pmic8xxx_kp_read_data(kp, old_state, KEYP_OLD_DATA,
						read_rows);
		if (rc < 0) {
			dev_err(kp->dev,
				"Error reading KEYP_OLD_DATA, rc=%d\n", rc);
			return rc;
		}
/*it is reslove the problem of ghost , becuse the six column  just one key */ 
#ifdef CONFIG_HUAWEI_KERNEL
		if(machine_is_msm8255_u8730())
		{
			if(~old_state[0] &(1<<(kp->pdata->num_cols-1)))
			{
				for(i=1;i< kp->pdata->num_rows;i++)
				{
					old_state[i]  |= 1<<(kp->pdata->num_cols-1);
				}
			}
		}
#endif
	}

	rc = pmic8xxx_kp_read_data(kp, new_state, KEYP_RECENT_DATA,
					 read_rows);
	if (rc < 0) {
		dev_err(kp->dev,
			"Error reading KEYP_RECENT_DATA, rc=%d\n", rc);
		return rc;
	}
/*it is reslove the problem of ghost , becuse the six column  just one key */ 
#ifdef CONFIG_HUAWEI_KERNEL
		if(machine_is_msm8255_u8730())
		{
			if(~new_state[0] &(1<<(kp->pdata->num_cols-1)))
			{
				for(i=1;i< kp->pdata->num_rows-1;i++)
				{
					new_state[i] |= 1<<(kp->pdata->num_cols-1);
				}
			}
		}

#endif
	/* 4 * 32KHz clocks */
	udelay((4 * DIV_ROUND_UP(USEC_PER_SEC, KEYP_CLOCK_FREQ)) + 1);

	rc = pmic8xxx_kp_read_u8(kp, &scan_val, KEYP_SCAN);
	if (rc < 0) {
		dev_err(kp->dev, "Error reading KEYP_SCAN reg, rc=%d\n", rc);
		return rc;
	}

	scan_val &= 0xFE;
	rc = pmic8xxx_kp_write_u8(kp, scan_val, KEYP_SCAN);
	if (rc < 0)
		dev_err(kp->dev, "Error writing KEYP_SCAN reg, rc=%d\n", rc);

	return rc;
}
int backlight_pwm_gpio_config(void)
{
    int rc;
	struct pm_gpio backlight_drv = 
	{
		.direction      = PM_GPIO_DIR_OUT,
		.output_buffer  = PM_GPIO_OUT_BUF_CMOS,
		.output_value   = 0,
		.pull           = PM_GPIO_PULL_NO,
		.vin_sel        = 0,
		.out_strength   = PM_GPIO_STRENGTH_HIGH,
		.function       = PM_GPIO_FUNC_2,
		.inv_int_pol 	= 1,
	};
	/* U8800 use PM_GPIO25 as backlight's PWM,but U8820 use PM_GPIO26 */
/* < DTS2011102401822 liwei 20111024 begin */
    if(machine_is_msm7x30_u8800() 
		|| machine_is_msm7x30_u8800_51() 
		|| machine_is_msm8255_u8800_pro() 
		|| machine_is_msm8255_u8860() 
		|| machine_is_msm8255_c8860() 
		|| machine_is_msm8255_u8860lp()
        /* < DTS2012022905490 ganfan 20120301 begin */
        || machine_is_msm8255_u8860_r()
        /* DTS2012022905490 ganfan 20120301 end > */
		|| machine_is_msm8255_u8860_92()
		|| machine_is_msm8255_u8680()
		|| machine_is_msm8255_u8667()
		|| machine_is_msm8255_u8860_51()
		|| machine_is_msm8255_u8730())
/* DTS2011102401822 liwei 20111024 end > */
    /*< DTS2012051704510 houming 20120517 begin */
    /* renew config the gpio value */
	{
        rc = pm8xxx_gpio_config( PM8058_GPIO_PM_TO_SYS(24), &backlight_drv);
    }
    else if(machine_is_msm7x30_u8820()) 
    {
    	rc = pm8xxx_gpio_config( PM8058_GPIO_PM_TO_SYS(25), &backlight_drv);
    }
	/* DTS2012051704510 houming 20120517 end >*/
	else
	{
    	rc = -1;
	}
	
    if (rc) 
	{
		pr_err("%s LCD backlight GPIO config failed\n", __func__);
		return rc;
	}
    return 0;
}
/* use the mmp pin like three-leds */
/*< DTS2012012101194 lijianzhao 20120121 begin */
void msm_backlight_set(int level)
{
    static uint8 last_level = 0;
	static boolean first_set_bl = TRUE;
	/*< DTS2012042605475 zhongjinrong 20120426 begin  */
	/*< DTS2012032101654 liweiwu 20120321 begin */
	/* keep duty 10% < level < 100% */
	/* DTS2012032101654 liweiwu 20120321 end >*/
	/* DTS2012042605475 zhongjinrong 20120426 end >*/
/*< DTS2012021602342 zhongjinrong 20120224 begin */
#ifdef CONFIG_ARCH_MSM7X27A
/* DTS2012021602342 zhongjinrong 20120224 end >*/
	if(level)
	{
		level = ((level * PWM_LEVEL_ADJUST_LPG) / PWM_LEVEL ); 
		if (level < BL_MIN_LEVEL_LPG)        
		{    
			level = BL_MIN_LEVEL_LPG;      
		}
	}
    if (last_level == level)
    {
        return ;
    }
    last_level = level;
	pmapp_disp_backlight_set_brightness(last_level);
#endif

#ifdef CONFIG_ARCH_MSM7X30
	if(TRUE == first_set_bl)
	{
		backlight_pwm_gpio_config();
		/* U8800 use PM_GPIO25 as backlight's PWM,but U8820 use PM_GPIO26 */
/* < DTS2011102401822 liwei 20111024 begin */
		if(machine_is_msm7x30_u8800() 
			|| machine_is_msm7x30_u8800_51() 
			|| machine_is_msm8255_u8800_pro()
			|| machine_is_msm8255_u8860() 
			|| machine_is_msm8255_c8860()
			|| machine_is_msm8255_u8860lp()
            /* < DTS2012022905490 ganfan 20120301 begin */
            || machine_is_msm8255_u8860_r()
            /* DTS2012022905490 ganfan 20120301 end > */
			|| machine_is_msm8255_u8860_92()
			|| machine_is_msm8255_u8680()
			|| machine_is_msm8255_u8667()
			|| machine_is_msm8255_u8860_51()
			|| machine_is_msm8255_u8730())
/* DTS2011102401822 liwei 20111024 end > */

		{
			bl_pwm = pwm_request(PM_GPIO25_PWM_ID, "backlight");
		}
		else if(machine_is_msm7x30_u8820())
		{
			bl_pwm = pwm_request(PM_GPIO26_PWM_ID, "backlight");
		}
		else
		{
			bl_pwm = NULL;
		}

		if (NULL == bl_pwm || IS_ERR(bl_pwm)) 
		{
			pr_err("%s: pwm_request() failed\n", __func__);
			bl_pwm = NULL;
		}
		first_set_bl = FALSE;
	}
	if (bl_pwm)
	{
		if(level)
		{
			level = ((level * PWM_LEVEL_ADJUST) / PWM_LEVEL + ADD_VALUE); 
			if (level < BL_MIN_LEVEL)
			{
				level = BL_MIN_LEVEL;
			}
		}	
	    if (last_level == level)
	    {
	        return ;
	    }
	    last_level = level;
		pwm_config(bl_pwm, PWM_DUTY_LEVEL*level/NSEC_PER_USEC, PWM_PERIOD/NSEC_PER_USEC);
		pwm_enable(bl_pwm);
	}
#endif
}
/* DTS2012012101194 lijianzhao 20120121 end >*/

void cabc_backlight_set(struct msm_fb_data_type * mfd)
{	     
	struct msm_fb_panel_data *pdata = NULL;   
	uint32 bl_level = mfd->bl_level;
	/*< DTS2012042605475 zhongjinrong 20120426 begin  */
	/*< DTS2012032101654 liweiwu 20120321 begin  */
		/* keep duty 10% < level < 100% */
	/* DTS2012032101654 liweiwu 20120321 end >*/
	if (bl_level)    
   	{   
   	/*< DTS2012032101654 liweiwu 20120321 begin  */
	/****delete one line codes for backlight*****/
	/* DTS2012032101654 liweiwu 20120321 end >*/
	/* DTS2012042605475 zhongjinrong 20120426 end >*/
		if (bl_level < BL_MIN_LEVEL)        
		{    
			bl_level = BL_MIN_LEVEL;      
		}  
	}
	/* backlight ctrl by LCD-self, like as CABC */  
	/*< DTS2012012101194 lijianzhao 20120121 begin */
	pdata = (struct msm_fb_panel_data *)mfd->pdev->dev.platform_data;  
	if ((pdata) && (pdata->set_cabc_brightness))   
   	{       
		pdata->set_cabc_brightness(mfd,bl_level);
	}
	/* DTS2012012101194 lijianzhao 20120121 end >*/

}

/*< DTS2012022408079 zhongjinrong 20120306 begin */
void pwm_set_backlight(struct msm_fb_data_type *mfd)
{
	lcd_panel_type lcd_panel_wvga = LCD_NONE;
	/*< DTS2011122704239 liuyuntao 20111229 begin */
	/*When all the device are resume that can turn the light*/
	if(atomic_read(&suspend_flag)) 
	{
		mfd_local = mfd;
		backlight_set = TRUE;
		return;
	}
	/* DTS2011122704239 liuyuntao 20111229 end >*/
/*< DTS2012021601331 duanfei 20120216 begin */
/*< DTS2012021602342 zhongjinrong 20120224 begin */
#ifdef CONFIG_ARCH_MSM7X27A
/* DTS2012021602342 zhongjinrong 20120224 end >*/
	
	
	lcd_panel_wvga = get_lcd_panel_type();
	/* <DTS2012022501992 liguosheng 20120229 begin */
	if ((MIPI_RSP61408_CHIMEI_WVGA == lcd_panel_wvga ) 
		|| (MIPI_RSP61408_BYD_WVGA == lcd_panel_wvga )
		|| (MIPI_RSP61408_TRULY_WVGA == lcd_panel_wvga )
		|| (MIPI_HX8369A_TIANMA_WVGA == lcd_panel_wvga ))
	{
		/* keep duty is 75% of the quondam duty */
		mfd->bl_level = mfd->bl_level * 75 / 100;
	}
	/* DTS2012022501992 liguosheng 20120229 end> */
#endif
/* DTS2012021601331 duanfei 20120216 end >*/
	if (get_hw_lcd_ctrl_bl_type() == CTRL_BL_BY_MSM)
	{
		msm_backlight_set(mfd->bl_level);
 	}   
	else    
 	{
		cabc_backlight_set(mfd);  
 	}
	return;
}
Ejemplo n.º 14
0
/*hasGyro is a flag to note if has gyro,c8860e has gyro but M886 doesn't*/
static int get_sensors_list(void)
{
	/* < DTS2012020902104 zhangmin 20120209 begin */
	/*add 7x30's list*/
	int sensors_list = G_SENSOR + L_SENSOR + P_SENSOR + M_SENSOR;
	int hasgyro = 0;
//	hasgyro = hasGyro;
	/*< DTS2012022006500 yangbo 20120220 begin */
	if(machine_is_msm8255_u8860()
	|| machine_is_msm8255_u8860_92()
	|| machine_is_msm8255_u8860_51()
	/* < DTS2012022905490 ganfan 20120301 begin */
	|| machine_is_msm8255_u8860_r()
	/* DTS2012022905490 ganfan 20120301 end > */
	|| machine_is_msm8255_u8860lp()
	||(machine_is_msm8255_c8860() && hasgyro ))
	{
		sensors_list = G_SENSOR + L_SENSOR + P_SENSOR + M_SENSOR + GY_SENSOR;
		printk("####This device has gyro\n");
	}
	
	/*version A and version B has compass, since version C don't have compass*/
	else if( (  machine_is_msm7x27a_C8820() && (HW_VER_SUB_VC <= get_hw_sub_board_id()) )
		||  machine_is_msm7x27a_U8661())
	{
		sensors_list = G_SENSOR + L_SENSOR + P_SENSOR;
	}
	/*< DTS2012022300887 fengwei 20120224 begin */
	else if (machine_is_msm7x27a_U8655()
	||  machine_is_msm7x27a_U8655_EMMC()
	||  machine_is_msm7x27a_C8655_NAND()
	||  machine_is_msm7x27a_M660()
	|| 	machine_is_msm7x27a_U8815()	
	|| 	machine_is_msm7x27a_C8820()	
	|| 	machine_is_msm7x27a_C8825D()
	||  machine_is_msm7x27a_C8668D()
	|| 	machine_is_msm7x30_u8800()	
	|| 	machine_is_msm7x30_u8820()	
	|| 	machine_is_msm7x30_u8800_51()
	|| 	machine_is_msm8255_u8800_pro()
	||	machine_is_msm8255_c8860()
	||	machine_is_msm8255_u8667()
	||	machine_is_msm8255_u8680()
	||	machine_is_msm8255_u8730())
	/* DTS2012022300887 fengwei 20120224 end >*/
	{
		sensors_list = G_SENSOR + L_SENSOR + P_SENSOR + M_SENSOR;
		printk("####This device doesn't own gyro\n");
	}
	/* move this else if to above for avoid C8820 without compass can not run in */
	/* DTS2012022006500 yangbo 20120220 end > */
	else if(machine_is_msm7x27a_U8185())
	{
		sensors_list = G_SENSOR;
	}
	else
	{
		sensors_list = G_SENSOR + L_SENSOR + P_SENSOR + M_SENSOR;
	}
	/* DTS2012020902104 zhangmin 20120209 end > */
	return sensors_list;
}
int backlight_pwm_gpio_config(void)
{
    int rc;
	struct pm_gpio backlight_drv = 
	{
		.direction      = PM_GPIO_DIR_OUT,
		.output_buffer  = PM_GPIO_OUT_BUF_CMOS,
		.output_value   = 0,
		.pull           = PM_GPIO_PULL_NO,
		.vin_sel        = 0,
		.out_strength   = PM_GPIO_STRENGTH_HIGH,
		.function       = PM_GPIO_FUNC_2,
		.inv_int_pol 	= 1,
	};
	/* U8800 use PM_GPIO25 as backlight's PWM,but U8820 use PM_GPIO26 */
    if(machine_is_msm7x30_u8800() 
		|| machine_is_msm7x30_u8800_51() 
		|| machine_is_msm8255_u8800_pro() 
		|| machine_is_msm8255_u8860() 
		|| machine_is_msm8255_c8860() 
		|| machine_is_msm8255_u8860lp()
        || machine_is_msm8255_u8860_r()
		|| machine_is_msm8255_u8860_92()
		|| machine_is_msm8255_u8680()
		|| machine_is_msm8255_u8667()
		|| machine_is_msm8255_u8860_51()
		|| machine_is_msm8255_u8730())
	{
        rc = pm8xxx_gpio_config( 24, &backlight_drv);
    }
    else if(machine_is_msm7x30_u8820()) 
    {
    	rc = pm8xxx_gpio_config( 25, &backlight_drv);
    }
	else
	{
    	rc = -1;
	}
	
    if (rc) 
	{
		pr_err("%s LCD backlight GPIO config failed\n", __func__);
		return rc;
	}
    return 0;
}
/* use the mmp pin like three-leds */
void msm_backlight_set(int level)
{
    static uint8 last_level = 0;
/*fix bug in new base-line 1025*/
#ifdef CONFIG_ARCH_MSM7X30
	static boolean first_set_bl = TRUE;
	static struct pwm_device *bl_pwm;
#endif	//CONFIG_ARCH_MSM7X30
	/* keep duty 10% < level < 100% */
#ifdef CONFIG_ARCH_MSM7X27A
	if(level)
	{
#ifdef CONFIG_HUAWEI_OLD_BACKLIGHT
		level = ((level * PWM_LEVEL_ADJUST_LPG) / PWM_LEVEL );
		if (level < BL_MIN_LEVEL_LPG)
		{
			level = BL_MIN_LEVEL_LPG;
		}
#else
		if (level < BL_MIN_LEVEL)        
		{    
			level = BL_MIN_LEVEL;      
		}
#endif
	}
    if (last_level == level)
    {
        return ;
    }
    last_level = level;
	pmapp_disp_backlight_set_brightness(last_level);
#endif

#ifdef CONFIG_ARCH_MSM7X30
	if(TRUE == first_set_bl)
	{
		backlight_pwm_gpio_config();
		/* U8800 use PM_GPIO25 as backlight's PWM,but U8820 use PM_GPIO26 */
		if(machine_is_msm7x30_u8800() 
			|| machine_is_msm7x30_u8800_51() 
			|| machine_is_msm8255_u8800_pro()
			|| machine_is_msm8255_u8860() 
			|| machine_is_msm8255_c8860()
			|| machine_is_msm8255_u8860lp()
            || machine_is_msm8255_u8860_r()
			|| machine_is_msm8255_u8860_92()
			|| machine_is_msm8255_u8680()
			|| machine_is_msm8255_u8667()
			|| machine_is_msm8255_u8860_51()
			|| machine_is_msm8255_u8730())

		{
			bl_pwm = pwm_request(PM_GPIO25_PWM_ID, "backlight");
		}
		else if(machine_is_msm7x30_u8820())
		{
			bl_pwm = pwm_request(PM_GPIO26_PWM_ID, "backlight");
		}
		else
		{
			bl_pwm = NULL;
		}

		if (NULL == bl_pwm || IS_ERR(bl_pwm)) 
		{
			pr_err("%s: pwm_request() failed\n", __func__);
			bl_pwm = NULL;
		}
		first_set_bl = FALSE;
	}
	if (bl_pwm)
	{
		if(level)
		{
			level = ((level * PWM_LEVEL_ADJUST) / PWM_LEVEL + ADD_VALUE); 
			if (level < BL_MIN_LEVEL)
			{
				level = BL_MIN_LEVEL;
			}
		}	
	    if (last_level == level)
	    {
	        return ;
	    }
	    last_level = level;
		pwm_config(bl_pwm, PWM_DUTY_LEVEL*level/NSEC_PER_USEC, PWM_PERIOD/NSEC_PER_USEC);
		pwm_enable(bl_pwm);
	}
#endif
}

void cabc_backlight_set(struct msm_fb_data_type * mfd)
{	     
	struct msm_fb_panel_data *pdata = NULL;   
	uint32 bl_level = mfd->bl_level;
		/* keep duty 10% < level < 100% */
	if (bl_level)    
   	{   
	/****delete one line codes for backlight*****/
		if (bl_level < BL_MIN_LEVEL)        
		{    
			bl_level = BL_MIN_LEVEL;      
		}  
	}
	/* backlight ctrl by LCD-self, like as CABC */  
	pdata = (struct msm_fb_panel_data *)mfd->pdev->dev.platform_data;  
	if ((pdata) && (pdata->set_cabc_brightness))   
   	{       
		pdata->set_cabc_brightness(mfd,bl_level);
	}

}

void pwm_set_backlight(struct msm_fb_data_type *mfd)
{
#ifdef CONFIG_HUAWEI_OLD_BACKLIGHT
	lcd_panel_type lcd_panel_wvga = LCD_NONE;
#endif
	/*When all the device are resume that can turn the light*/
	if(atomic_read(&suspend_flag)) 
	{
		mfd_local = mfd;
		backlight_set = TRUE;
		return;
	}
#ifdef CONFIG_HUAWEI_OLD_BACKLIGHT
	lcd_panel_wvga = get_lcd_panel_type();
	if ((MIPI_CMD_RSP61408_CHIMEI_WVGA == lcd_panel_wvga )
		|| (MIPI_CMD_RSP61408_BYD_WVGA == lcd_panel_wvga )
		|| (MIPI_CMD_RSP61408_TRULY_WVGA == lcd_panel_wvga )
		|| (MIPI_CMD_HX8369A_TIANMA_WVGA == lcd_panel_wvga ))
	{
		/* keep duty is 75% of the quondam duty */
		mfd->bl_level = mfd->bl_level * 75 / 100;
	}
#endif
	if (get_hw_lcd_ctrl_bl_type() == CTRL_BL_BY_MSM)
	{
		msm_backlight_set(mfd->bl_level);
 	}   
	else    
 	{
		cabc_backlight_set(mfd);  
 	}
	return;
}
Ejemplo n.º 16
0
lcd_panel_type get_lcd_panel_type(void)
{
	lcd_panel_type hw_lcd_panel = LCD_NONE;

	if ( machine_is_msm7x30_u8800()
		|| machine_is_msm7x30_u8820() 
		|| machine_is_msm7x30_u8800_51() 
		|| machine_is_msm8255_u8800_pro())
	{
		switch (lcd_id)
		{
			case LCD_HW_ID0:  
				hw_lcd_panel = LCD_NT35582_BYD_WVGA;
				break;
			case LCD_HW_ID1:  
				hw_lcd_panel = LCD_NT35582_TRULY_WVGA;
				break;
			case LCD_HW_ID2:  
				hw_lcd_panel = LCD_NT35510_ALPHA_SI_WVGA;
				break;
			case LCD_HW_ID3:  
				hw_lcd_panel = LCD_NT35510_ALPHA_SI_WVGA_TYPE2;
				break;
			default : 
				hw_lcd_panel = LCD_NT35510_ALPHA_SI_WVGA;
				break;					  
		}
	}
	else if (machine_is_msm8255_u8860() 
		|| machine_is_msm8255_c8860() 
		|| machine_is_msm8255_u8860lp()
        /* < DTS2012022905490 ganfan 20120301 begin */
        || machine_is_msm8255_u8860_r()
        /* DTS2012022905490 ganfan 20120301 end > */
		|| machine_is_msm8255_u8860_92()
		|| machine_is_msm8255_u8860_51())
	{
		switch (lcd_id)
		{
			case LCD_HW_ID0:
				hw_lcd_panel = LCD_NT35560_TOSHIBA_FWVGA;
				break;
			default : 
				hw_lcd_panel = LCD_NT35560_TOSHIBA_FWVGA;
				break;					  
		}
	}
	else if( machine_is_msm8255_u8680()
		|| machine_is_msm8255_u8730())

	{
/*< DTS2012021007223 lijianzhao 20120211 begin */
/*< DTS2012021602342 zhongjinrong 20120224 begin */
		switch (lcd_id)
		{
			case LCD_HW_ID0:
				hw_lcd_panel = MDDI_RSP61408_CHIMEI_WVGA;
				break;
			case LCD_HW_ID1:
				hw_lcd_panel = MDDI_HX8369A_TIANMA_WVGA;
				break;
			case LCD_HW_ID2:
				hw_lcd_panel = MDDI_RSP61408_BYD_WVGA;
				break;
			/*< DTS2012042605475 zhongjinrong 20120426 begin  */
			/* <DTS2012030102766 sunkai 20120301 begin */
            case LCD_HW_ID3:
                hw_lcd_panel = MDDI_RSP61408_TRULY_WVGA;
                break;
			/* DTS2012030102766 sunkai 20120301 end> */
			/* DTS2012042605475 zhongjinrong 20120426 end >*/
			default : 
				hw_lcd_panel = MDDI_RSP61408_CHIMEI_WVGA;
				break;
		}
/* DTS2012021602342 zhongjinrong 20120224 end >*/
	}
	else if( machine_is_msm8255_u8667())
	{
		switch (lcd_id)
		{
			case LCD_HW_ID0:
				hw_lcd_panel = MDDI_HX8357C_CHIMEI_HVGA;
				break;
			/*< DTS2012042605475 zhongjinrong 20120426 begin  */
			/*< DTS2012022401352 qitongliang 20120224 begin */
			case LCD_HW_ID1:
				hw_lcd_panel = MDDI_HX8357C_TIANMA_IPS_HVGA;
				break;
			/* DTS2012022401352 qitongliang 20120224 end >*/
			/* DTS2012042605475 zhongjinrong 20120426 end >*/

			case LCD_HW_ID2:
				hw_lcd_panel = MDDI_HX8357C_CHIMEI_IPS_HVGA;
				break;
			case LCD_HW_ID3:
				hw_lcd_panel = MDDI_HX8357C_TIANMA_HVGA;
				break;
			default:
				hw_lcd_panel = MDDI_HX8357C_CHIMEI_HVGA;
				break;		
		}
	}
/* DTS2012021007223 lijianzhao 20120211 end >*/
	else if( machine_is_msm7x27a_umts()
		|| machine_is_msm7x27a_cdma())
	{
		switch (lcd_id)
		{
			case LCD_HW_ID0:
				hw_lcd_panel = MIPI_NT35560_TOSHIBA_FWVGA;
				break;
			case LCD_HW_ID1:
				hw_lcd_panel = LCD_HX8357B_TIANMA_HVGA;
				break;
			default:
				/*no mipi LCD lead to block, so default lcd RGB */
				hw_lcd_panel = LCD_HX8357B_TIANMA_HVGA;
				break;
		}

	}
	else if( machine_is_msm7x27a_U8815() 
		|| machine_is_msm7x27a_C8820()
		|| machine_is_msm7x27a_C8825D() )

	{
		switch (lcd_id)
		{
			case LCD_HW_ID0:
				hw_lcd_panel = MIPI_RSP61408_CHIMEI_WVGA;
				break;
			case LCD_HW_ID1:
				hw_lcd_panel = MIPI_HX8369A_TIANMA_WVGA;
				break;
			case LCD_HW_ID2:
				hw_lcd_panel = MIPI_RSP61408_BYD_WVGA;
				break;
			/* <DTS2012022501992 liguosheng 20120229 begin */
			case LCD_HW_ID3:
				hw_lcd_panel = MIPI_RSP61408_TRULY_WVGA;
				break;
			/* DTS2012022501992 liguosheng 20120229 end> */
			default:
				/*no mipi LCD lead to block, so default lcd RGB */
				hw_lcd_panel = LCD_HX8357B_TIANMA_HVGA;
				break;
		}
	}

	/*< DTS2012022300887 fengwei 20120224 begin */
	else if( machine_is_msm7x27a_U8655() 
		|| machine_is_msm7x27a_U8655_EMMC() 
		|| machine_is_msm7x27a_C8655_NAND()
		|| machine_is_msm7x27a_U8661()
		|| machine_is_msm7x27a_C8668D())
	/* DTS2012022300887 fengwei 20120224 end >*/
	{
		switch (lcd_id)
		{
			case LCD_HW_ID0:
				hw_lcd_panel = MIPI_HX8357C_CHIMEI_HVGA;
				break;
			/* <DTS2012022501992 liguosheng 20120229 begin */
			case LCD_HW_ID1:
			    hw_lcd_panel = MIPI_HX8357C_TIANMA_IPS_HVGA;
				break;
			/* DTS2012022501992 liguosheng 20120229 end> */
			case LCD_HW_ID2:
				hw_lcd_panel = MIPI_HX8357C_CHIMEI_IPS_HVGA;
				break;
			case LCD_HW_ID3:
				hw_lcd_panel = MIPI_HX8357C_TIANMA_HVGA;
				break;
			default: 
				/*no mipi LCD lead to block, so default lcd RGB */
				hw_lcd_panel = LCD_HX8357B_TIANMA_HVGA;
				break;
		}
	}
	else if( machine_is_msm7x27a_U8185())
	{
		switch(lcd_id)
		{
			case LCD_HW_ID0:
				hw_lcd_panel = LCD_HX8347D_TRULY_QVGA;
				break;
			case LCD_HW_ID2:
				hw_lcd_panel = LCD_HX8347G_TIANMA_QVGA;
				break;
			case LCD_HW_ID3:
				hw_lcd_panel = LCD_HX8347D_CHIMEI_QVGA;
				break;
			default:
				hw_lcd_panel = LCD_HX8347G_TIANMA_QVGA;
				break;
		}
	}
	else if(machine_is_msm7x27a_M660())
	{
		switch(lcd_id)
		{
			case LCD_HW_ID0:
				hw_lcd_panel = LCD_HX8357C_TIANMA_HVGA;
				break;
			case LCD_HW_ID1:
				hw_lcd_panel = LCD_HX8357B_TIANMA_HVGA;
				break;
			default:
				hw_lcd_panel = LCD_HX8357C_TIANMA_HVGA;
				break;
		}
	}
	else
	{
		hw_lcd_panel = LCD_HX8357B_TIANMA_HVGA;
	}
	return hw_lcd_panel;
}
Ejemplo n.º 17
0
/*configure GPIO 25 Of PIMIC as PWM to driver LED*/
int led_pwm_gpio_config(void)
{
    int rc;
    struct pm_gpio backlight_drv = 
    {
        .direction      = PM_GPIO_DIR_OUT,
        .output_buffer  = PM_GPIO_OUT_BUF_CMOS,
        .output_value   = 0,
        .pull           = PM_GPIO_PULL_NO,
        .vin_sel        = 0,
        .out_strength   = PM_GPIO_STRENGTH_HIGH,
        .function       = PM_GPIO_FUNC_2,
        .inv_int_pol 	= 1,
    };
    if(machine_is_msm8255_u8860lp()
    || machine_is_msm8255_u8860_r()
	 ||machine_is_msm8255_u8860_51())
    {
        rc = pm8xxx_gpio_config( 24, &backlight_drv);
    }
    else
    {
        rc = -1;
    }
	
    if (rc) 
    {
        pr_err("%s LED backlight GPIO config failed\n", __func__);
        return rc;
    }
    return 0;
}
#endif

static void msm_keypad_bl_led_set(struct led_classdev *led_cdev,
	enum led_brightness value)
{
#ifdef CONFIG_HUAWEI_LEDS_PMIC
    int ret = 0;
/* 7x27a platform use mpp7 as keypad backlight */
	#ifdef CONFIG_ARCH_MSM7X27A
	    if(machine_is_msm7x27a_C8820())
	    {
	        ret = pmic_secure_mpp_config_i_sink(PM_MPP_7, PM_MPP__I_SINK__LEVEL_5mA, \
	            (!!value) ? PM_MPP__I_SINK__SWITCH_ENA : PM_MPP__I_SINK__SWITCH_DIS);
	    }
	    else
	    {
	        /* use pwm to control the brightness of keypad backlight*/
	        /* make sure the led is drived by pwm when */
	        /* the system sleep indicator switch is on */
	        pmapp_button_backlight_init();

	        ret = pmapp_button_backlight_set_brightness(value);
	    }
	#else
	    if(machine_is_msm7x30_u8800() || machine_is_msm7x30_u8800_51() || machine_is_msm8255_u8800_pro() ) 
	    {
	      ret = pmic_set_led_intensity(LED_KEYPAD, !( ! value));
	    }
	    else if( machine_is_msm8255_u8860lp()	
        || machine_is_msm8255_u8860_r()
		       ||machine_is_msm8255_u8860_51())
	    {
	        pwm_config(bl_pwm, LED_PWM_DUTY_LEVEL*value/NSEC_PER_USEC, LED_PWM_PERIOD/NSEC_PER_USEC);
	        pwm_enable(bl_pwm);
	    }
	    else if(machine_is_msm7x30_u8820()
		    || (machine_is_msm8255_u8730()))
	    {   
	      ret = pmic_set_mpp6_led_intensity(!( ! value));
	    }
		/*< when the value between 0 and 255,set the key brightness is LED_BRIGHRNESS_LEVEL or set the brightness is 0 */
		else if( machine_is_msm8255_u8860() 
		      || machine_is_msm8255_c8860() 
			  || machine_is_msm8255_u8860_92())
		{
	       if(LED_BRIGHTNESS_OFF >= value || LED_PWM_LEVEL < value )
	       {
		   	   ret = pmic_set_keyled_intensity(LED_KEYPAD,LED_BRIGHTNESS_OFF  );
	       }
		   else 
		   {
		   	   ret = pmic_set_keyled_intensity(LED_KEYPAD, LED_BRIGHTNESS_LEVEL);
		   }
		}
    else if(machine_is_msm8255_u8680())
    {   
	    /* Set keypad led brightness level 12 for U8680 */
        if(LED_BRIGHTNESS_OFF >= value || LED_PWM_LEVEL < value)
        {
            ret = pmic_set_keyled_intensity(LED_KEYPAD,LED_BRIGHTNESS_OFF);
        }
        else 
        {
            ret = pmic_set_keyled_intensity(LED_KEYPAD, LED_BRIGHTNESS_LEVEL_U8680);
        }	
    }
    else if(machine_is_msm8255_u8667())
    {   
        /* Set keypad led brightness level 16 for U8667 */
        if(LED_BRIGHTNESS_OFF >= value || LED_PWM_LEVEL < value)
        {
            ret = pmic_set_keyled_intensity(LED_KEYPAD, LED_BRIGHTNESS_OFF);
        }
        else 
        {
            ret = pmic_set_keyled_intensity(LED_KEYPAD, LED_BRIGHTNESS_LEVEL_U8667);
        }	
    }
	#endif
    if (ret)
		dev_err(led_cdev->dev, "can't set keypad backlight\n");
#else
	int ret;

	ret = pmic_set_led_intensity(LED_KEYPAD, value / MAX_KEYPAD_BL_LEVEL);
	if (ret)
		dev_err(led_cdev->dev, "can't set keypad backlight\n");
#endif
}