/* 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;
	/*control backlight by MSM pwm*/
	/* C8668D uses PM pwm. */
	if (machine_is_msm7x27a_U8815() 
		|| machine_is_msm7x27a_U8655_EMMC()
		|| machine_is_msm7x27a_U8185() 
		|| machine_is_msm7x27a_U8655()
		|| machine_is_msm7x27a_M660()
		|| machine_is_msm7x27a_H867G()
		|| machine_is_msm7x27a_H868C()
		|| 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() 
		)
	{
		ctrl_bl_type = CTRL_BL_BY_MSM;
	}
	/*control backlight by LCD output pwm*/
	else
	{
		ctrl_bl_type = CTRL_BL_BY_LCD;
	}
    return ctrl_bl_type;
}
/*===========================================================================


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_hw_wifi_device_model
 *  DEPENDENCIES 
 *      get wifi device model.
 *      affect app_info.
 *  RETURN VALUE
 *      wifi device model:WIFI_QUALCOMM_6005 or WIFI_BROADCOM_4329 ro WIFI_BROADCOM_4330
 */
hw_wifi_device_model get_hw_wifi_device_model(void)
{
  /*< DTS2012042703826 lixin 20120427 begin */
  if(machine_is_msm7x27a_U8185()|| machine_is_msm7x27a_U8661()|| machine_is_msm7x27a_C8668D()
     || (machine_is_msm7x27a_U8815() && (HW_VER_SUB_VC == get_hw_sub_board_id())))
  {
      return WIFI_QUALCOMM_6005;
  }
  /* DTS2012042703826 lixin 20120427 end >*/
  else if(machine_is_msm8255_u8860() 
		|| machine_is_msm8255_c8860() 
		|| machine_is_msm8255_u8860lp()
        || machine_is_msm8255_u8860_r()
		|| machine_is_msm8255_u8860_92()
/* < DTS2012050801712 xiedayong 20120508 begin */
/* add msm8255_u8800_pro proudct,it uses BCM4329 chip */
        || machine_is_msm8255_u8860_51()
        || machine_is_msm8255_u8800_pro())
/* DTS2012050801712 xiedayong 20120508 end > */
  {
      return WIFI_BROADCOM_4329;
  }
  else
  {
      return WIFI_BROADCOM_4330;
  }
}
/*===========================================================================


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;
}
/*
 *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;
}
/* 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;
}
Esempio n. 8
0
static int tvenc_on(struct platform_device *pdev)
{
	int ret = 0;

#ifndef CONFIG_MSM_BUS_SCALING
	struct msm_fb_data_type *mfd = platform_get_drvdata(pdev);
#endif

#ifdef CONFIG_MSM_BUS_SCALING
	if (tvenc_bus_scale_handle > 0)
		msm_bus_scale_client_update_request(tvenc_bus_scale_handle,
							1);
#else
	if (mfd->ebi1_clk)
		clk_enable(mfd->ebi1_clk);
#endif
	mdp4_extn_disp = 1;
	if (tvenc_pdata && tvenc_pdata->pm_vid_en)
		ret = tvenc_pdata->pm_vid_en(1);
	if (ret) {
		pr_err("%s: pm_vid_en(on) failed! %d\n",
		__func__, ret);
		return ret;
	}

	ret = tvenc_set_clock(CLOCK_ON);
	if (ret) {
		pr_err("%s: tvenc_set_clock(CLOCK_ON) failed! %d\n",
		__func__, ret);
		tvenc_pdata->pm_vid_en(0);
		goto error;
	}
/* Enable TV_OUT ctl */
#ifdef CONFIG_HUAWEI_KERNEL
/* U8800 have tv_out function,only */
	if(machine_is_msm7x30_u8800() || machine_is_msm7x30_u8800_51() || machine_is_msm8255_u8800_pro()) 
	{
		gpio_tlmm_config(GPIO_CFG(33, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),GPIO_CFG_ENABLE);
		gpio_set_value(33, 1);
	}
#endif

	ret = panel_next_on(pdev);
	if (ret) {
		pr_err("%s: tvout_on failed! %d\n",
		__func__, ret);
		tvenc_set_clock(CLOCK_OFF);
		tvenc_pdata->pm_vid_en(0);
	}

error:
	return ret;

}
Esempio n. 9
0
static int tvenc_off(struct platform_device *pdev)
{
	int ret = 0;

	struct msm_fb_data_type *mfd;

	mfd = platform_get_drvdata(pdev);

	ret = panel_next_off(pdev);
	if (ret)
		pr_err("%s: tvout_off failed! %d\n",
		__func__, ret);

	tvenc_set_clock(CLOCK_OFF);

	if (tvenc_pdata && tvenc_pdata->pm_vid_en)
		ret = tvenc_pdata->pm_vid_en(0);
#ifdef CONFIG_MSM_BUS_SCALING
	if (tvenc_bus_scale_handle > 0)
		msm_bus_scale_client_update_request(tvenc_bus_scale_handle,
							0);
#else
	if (mfd->ebi1_clk)
		clk_disable(mfd->ebi1_clk);
#endif

	if (ret)
		pr_err("%s: pm_vid_en(off) failed! %d\n",
		__func__, ret);
	mdp4_extn_disp = 0;
#ifdef CONFIG_HUAWEI_KERNEL
    /* U8800-51 has no TV-OUT so remove it, GPIO33 of U8800-51 is used for HAC(Hearing Aid) */
	/* U8800 and U8800-51 have tv_out function only */
	if(machine_is_msm7x30_u8800() || machine_is_msm8255_u8800_pro()) 
	{
		/* if tvout cable plug in, don't change the switch */
		if (!tv_cable_connected)
		{
			gpio_tlmm_config(GPIO_CFG(33, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),GPIO_CFG_ENABLE);
			gpio_set_value(33, 0);    
		}
	}
	
#endif
	return ret;
}
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;
    }
}
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;
}
Esempio n. 12
0
int backlight_pwm_gpio_config(void)
{
    int rc;
	struct pm8058_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())
	{
        rc = pm8058_gpio_config( 24, &backlight_drv);
    }
    else if(machine_is_msm7x30_u8820()) 
    {
    	rc = pm8058_gpio_config( 25, &backlight_drv);
    }
	else
	{
    	rc = -1;
	}
	
    if (rc) 
	{
		pr_err("%s LCD backlight GPIO config failed\n", __func__);
		return rc;
	}
    return 0;
}
#ifndef CONFIG_HUAWEI_LEDS_PMIC
void touchkey_setbacklight(int level)
{
    if(machine_is_msm7x30_u8800() || machine_is_msm7x30_u8800_51() || machine_is_msm8255_u8800_pro()) 
	{
		pmic_set_led_intensity(LED_KEYPAD, level);
	}

    if(machine_is_msm7x30_u8820())
    {   
		/*if the machine is U8820 use the mpp6 for touchkey backlight*/
        pmic_set_mpp6_led_intensity(level);
    }

}
#endif
void pwm_set_backlight (struct msm_fb_data_type * mfd)
{
	int bl_level = mfd->bl_level;
	/*config PM GPIO25 as PWM and request PWM*/
	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())
		{
			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) 
	{
		/* keep duty 10% < level < 90% */
		if (bl_level)
		{
			bl_level = ((bl_level * PWM_LEVEL_ADJUST) / PWM_LEVEL + ADD_VALUE); 
			if (bl_level < BL_MIN_LEVEL)
			{
				bl_level = BL_MIN_LEVEL;
			}
		}
		pwm_config(bl_pwm, PWM_DUTY_LEVEL*bl_level/NSEC_PER_USEC, PWM_PERIOD/NSEC_PER_USEC);
		pwm_enable(bl_pwm);
	}
#ifndef CONFIG_HUAWEI_LEDS_PMIC
	touchkey_setbacklight(!!bl_level);
#endif

}
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;
}
Esempio n. 14
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
}
/*  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;
}
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;
}
Esempio n. 17
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;
}
Esempio n. 18
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;
}