/* 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) { if(machine_is_msm7x27a_U8185()|| machine_is_msm7x27a_U8661()|| machine_is_msm7x27a_C8668D() || machine_is_msm8x25_C8825D() || machine_is_msm8x25_U8825D() || machine_is_msm8x25_U8825() || machine_is_msm8x25_C8833D() || machine_is_msm8x25_U8951D() || machine_is_msm8x25_U8951() || machine_is_msm8x25_U8833D() || machine_is_msm8x25_U8833() || machine_is_msm8x25_C8813() || machine_is_msm8x25_C8812P()) { return WIFI_QUALCOMM_6005; } 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()) { 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_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; }
static int nt35560_lcd_on(struct platform_device *pdev) { int ret = 0; boolean para_debug_flag = FALSE; uint32 para_num = 0; /* open debug file and read the para */ switch(lcd_panel_fwvga) { case LCD_NT35560_TOSHIBA_FWVGA: para_debug_flag = lcd_debug_malloc_get_para( "nt35560_toshiba_fwvga_init_table", (void**)&nt35560_fwvga_init_table,¶_num); break; default: break; } /* If exist the init file ,then init lcd with it for debug */ if( (TRUE == para_debug_flag)&&(NULL != nt35560_fwvga_init_table)) { ret = process_mddi_table(nt35560_fwvga_init_table, para_num, lcd_panel_fwvga); } else { /*<DTS2011081002714 jiaoshuangwei 20110810 begin*/ if(machine_is_msm8255_u8860lp() /* < DTS2012022905490 ganfan 20120301 begin */ || machine_is_msm8255_u8860_r() /* DTS2012022905490 ganfan 20120301 end > */ /*<DTS2011091502092 liyuping 20110915 begin */ || machine_is_msm8255_u8860_51()) /* DTS2011091502092 liyuping 20110915 end> */ { /* Exit Standby Mode */ ret = process_mddi_table((struct sequence*)&nt35560_fwvga_standby_exit_tablelp, ARRAY_SIZE(nt35560_fwvga_standby_exit_tablelp), lcd_panel_fwvga); } else { /* Exit Standby Mode */ ret = process_mddi_table((struct sequence*)&nt35560_fwvga_standby_exit_table, ARRAY_SIZE(nt35560_fwvga_standby_exit_table), lcd_panel_fwvga); } /*DTS2011081002714 jiaoshuangwei 20110810 end >*/ } /* Must malloc before,then you can call free */ if((TRUE == para_debug_flag)&&(NULL != nt35560_fwvga_init_table)) { lcd_debug_free_para((void *)nt35560_fwvga_init_table); } LCD_DEBUG("%s: nt35560_lcd exit sleep mode ,on_ret=%d\n",__func__,ret); return ret; }
/* 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 nt35560_lcd_on(struct platform_device *pdev) { int ret = 0; boolean para_debug_flag = FALSE; uint32 para_num = 0; /* open debug file and read the para */ switch(lcd_panel_fwvga) { case LCD_NT35560_TOSHIBA_FWVGA: para_debug_flag = lcd_debug_malloc_get_para( "nt35560_toshiba_fwvga_init_table", (void**)&nt35560_fwvga_init_table,¶_num); break; default: break; } /* If exist the init file ,then init lcd with it for debug */ if( (TRUE == para_debug_flag)&&(NULL != nt35560_fwvga_init_table)) { ret = process_lcd_table(nt35560_fwvga_init_table, para_num, lcd_panel_fwvga); } else { if(machine_is_msm8255_u8860lp() || machine_is_msm8255_u8860_51()) { /* Exit Standby Mode */ ret = process_lcd_table((struct sequence*)&nt35560_fwvga_standby_exit_tablelp, ARRAY_SIZE(nt35560_fwvga_standby_exit_tablelp), lcd_panel_fwvga); } else { /* Exit Standby Mode */ ret = process_lcd_table((struct sequence*)&nt35560_fwvga_standby_exit_table, ARRAY_SIZE(nt35560_fwvga_standby_exit_table), lcd_panel_fwvga); } } /* Must malloc before,then you can call free */ if((TRUE == para_debug_flag)&&(NULL != nt35560_fwvga_init_table)) { lcd_debug_free_para((void *)nt35560_fwvga_init_table); } MDDI_LCD_DEBUG("%s: nt35560_lcd exit sleep mode ,on_ret=%d\n",__func__,ret); return ret; }
static int msm_pmic_led_suspend(struct platform_device *dev, pm_message_t state) { /* if phone is set in system sleep indicator mode and is sleepping,bl_pwm must be free for GPIO_24 is being controled by modem*/ #ifdef CONFIG_HUAWEI_LEDS_PMIC if( machine_is_msm8255_u8860lp() || machine_is_msm8255_u8860_r() ||machine_is_msm8255_u8860_51()) { pwm_free(bl_pwm); } #endif led_classdev_suspend(&msm_kp_bl_led); return 0; }
static int msm_pmic_led_resume(struct platform_device *dev) { /* if phone is set in system sleep indicator mode and awoke,GPIO_24 is relseased so it should be requested*/ #ifdef CONFIG_HUAWEI_LEDS_PMIC if( machine_is_msm8255_u8860lp() || machine_is_msm8255_u8860_r() ||machine_is_msm8255_u8860_51()) { led_pwm_gpio_config(); bl_pwm = pwm_request(LED_PM_GPIO25_PWM_ID, "keypad backlight"); } #endif led_classdev_resume(&msm_kp_bl_led); return 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; /*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_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 if(machine_is_msm7x27a_C8655_NAND() || (machine_is_msm7x27a_C8820() && (HW_VER_SUB_VA == get_hw_sub_board_id())) || machine_is_msm8x25_C8825D() || machine_is_msm8x25_C8950D() || machine_is_msm8x25_U8950D() || machine_is_msm8x25_U8950() || machine_is_msm8255_u8860_r() || machine_is_msm8255_u8860lp() || machine_is_msm8255_u8860_51() || machine_is_msm8x25_U8825() || machine_is_msm8x25_U8825D() || machine_is_msm8255_u8667()) { ctrl_bl_type = CTRL_BL_BY_LCD; } else { ctrl_bl_type = CTRL_BL_BY_LCD; } return ctrl_bl_type; }
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 bool pmic8xxx_detect_ghost_keys(struct pmic8xxx_kp *kp, u16 *new_state) { int row, found_first = -1; u16 check, row_state; /* * for u8860, c8860 and u8860lp, add the codes means: * when volumn-up and volumn-down keys are pressed in the sametime, * the state of kp scan matrix read from the register is wrong because of hardwared's wrong, * and it will make system think the state as ghost keys mistakenly , * so these board ids should not be check for ghost keys */ #ifdef CONFIG_HUAWEI_KERNEL if (machine_is_msm8255_u8860() || machine_is_msm8255_c8860() || machine_is_msm8255_u8860lp() || machine_is_msm8255_u8860_r() || machine_is_msm8255_u8860_51()) { return 0; } #endif check = 0; for (row = 0; row < kp->pdata->num_rows; row++) { row_state = (~new_state[row]) & ((1 << kp->pdata->num_cols) - 1); if (hweight16(row_state) > 1) { if (found_first == -1) found_first = row; if (check & row_state) { dev_dbg(kp->dev, "detected ghost key on row[%d]" " and row[%d]\n", found_first, row); return true; } } check |= row_state; } return false; }
static int msm_pmic_led_probe(struct platform_device *pdev) { int rc; rc = led_classdev_register(&pdev->dev, &msm_kp_bl_led); if (rc) { dev_err(&pdev->dev, "unable to register led class driver\n"); return rc; } #ifdef CONFIG_HUAWEI_LEDS_PMIC if( machine_is_msm8255_u8860lp() || machine_is_msm8255_u8860_r() ||machine_is_msm8255_u8860_51()) { led_pwm_gpio_config(); bl_pwm = pwm_request(LED_PM_GPIO25_PWM_ID, "keypad backlight"); } #endif msm_keypad_bl_led_set(&msm_kp_bl_led, LED_OFF); return rc; }
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; }
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; }
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; }
/*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 }
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; }
/*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; }