void __init apq8064_init_cam(void) { /* for SGLTE2 platform, do not configure i2c/gpiomux gsbi4 is used for * some other purpose */ if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE2) { /* OPPO 2013-07-24 liubin Modify for N1 not configure i2c start */ #ifdef CONFIG_VENDOR_EDIT if (get_pcb_version() >= PCB_VERSION_EVT_N1) { msm_gpiomux_install(apq8064_cam_common_configs_n1, ARRAY_SIZE(apq8064_cam_common_configs_n1)); } else { #endif msm_gpiomux_install(apq8064_cam_common_configs, ARRAY_SIZE(apq8064_cam_common_configs)); #ifdef CONFIG_VENDOR_EDIT } #endif /* OPPO 2013-07-24 liubin Modify end */ } if (machine_is_apq8064_cdp()) { sensor_board_info_imx074.mount_angle = 0; sensor_board_info_mt9m114.mount_angle = 0; } else if (machine_is_apq8064_liquid()) sensor_board_info_imx074.mount_angle = 180; platform_device_register(&msm_camera_server); if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE2) { /* OPPO 2013-07-24 liubin Modify for N1 not configure i2c start */ #ifdef CONFIG_VENDOR_EDIT if (get_pcb_version() >= PCB_VERSION_EVT_N1) { platform_device_register(&msm8064_device_i2c_mux_gsbi7); } else { #endif platform_device_register(&msm8960_device_i2c_mux_gsbi4); #ifdef CONFIG_VENDOR_EDIT } #endif /* OPPO 2013-07-24 liubin Modify end */ } platform_device_register(&msm8960_device_csiphy0); platform_device_register(&msm8960_device_csiphy1); platform_device_register(&msm8960_device_csid0); platform_device_register(&msm8960_device_csid1); platform_device_register(&msm8960_device_ispif); platform_device_register(&msm8960_device_vfe); platform_device_register(&msm8960_device_vpe); }
/* OPPO 2012-07-20 liuhd Add begin for reason */ static int SN3193_power(int on) { if (on) { if (get_pcb_version() <= PCB_VERSION_EVT) { //evt---lvs5 lvs5 = regulator_get(NULL, "8921_lvs5"); if (IS_ERR(lvs5)){ pr_err("%s: VREG LVS5 get failed\n", __func__); lvs5 = NULL; goto lvs5_get_failed; } if (regulator_enable(lvs5)) { pr_err("%s: VREG LVS5 enable failed\n", __func__); goto lvs5_get_failed; } } else { //dvt---l21 ldo121 = regulator_get(NULL, "8921_l21"); if (IS_ERR(ldo121)){ pr_err("%s: VREG ldo121 get failed\n", __func__); ldo121 = NULL; goto ldo121_get_failed; } if (regulator_set_voltage(ldo121, 1800000, 1800000)) { pr_err("%s: VREG ldo121 set voltage failed\n", __func__); goto ldo121_get_failed; } if (regulator_enable(ldo121)) { pr_err("%s: VREG ldo121 enable failed\n", __func__); goto ldo121_get_failed; } } }else if (!on) { if (get_pcb_version() <= PCB_VERSION_EVT) { //evt if (lvs5){ regulator_disable(lvs5); regulator_put(lvs5); } }else { //dvt if (ldo121) { regulator_disable(ldo121); regulator_put(ldo121); } } } return 0 ; ldo121_get_failed: regulator_disable(ldo121); lvs5_get_failed: regulator_put(lvs5); return -1 ; }
static int __init SN3193_dev_init(void) { int ret=0; SN3193_sled_dev_sate = kzalloc(sizeof(struct SN3193_sled), GFP_KERNEL); if (SN3193_sled_dev_sate == NULL) { ret = -ENOMEM; goto err_exit; } /*OPPO yuyi 2014-02-20 modified begin for SN3193 would not be used*/ #ifndef CONFIG_MACH_MSM8974_14001 pr_info("yanghai shineld driver init\n"); return i2c_add_driver(&SN3193_driver); #else if(get_pcb_version() < HW_VERSION__20) { pr_info("SN3193 shineld driver init\n"); return i2c_add_driver(&SN3193_driver); } else { pr_info("SN3193 13097 forbiden shineld driver init\n"); return -1; }; #endif /*OPPO yuyi 2014-02-20 modified end for SN3193 would not be used*/ err_exit: return ret; }
static void lcm_suspend(void) { #ifdef TEMP_VER_CHECK #if defined(BUILD_LK) #else if ( first_check == 0 ) { g_PCBver = get_pcb_version(); LCM_PRINT("[LCD-KERNEL]board_version =%d\n",g_PCBver); first_check = 1; } #endif #endif /* TEMP_VER_CHECK */ init_lcm_registers_sleep(); SET_RESET_PIN(0); MDELAY(20); //dsv low ldo_p5m5_dsv_5v5_off(); MDELAY(10); //VCI/IOVCC off ldo_1v8io_off(); //ldo_ext_3v0_off(); LCM_PRINT("[LCD] lcm_suspend \n"); }
int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio) { size_t len = strlen(dev_name(host->parent)) + 4; struct mmc_cd_gpio *cd; int irq = gpio_to_irq(gpio); int ret; if (irq < 0) return irq; cd = kmalloc(sizeof(*cd) + len, GFP_KERNEL); if (!cd) return -ENOMEM; snprintf(cd->label, len, "%s cd", dev_name(host->parent)); ret = gpio_request_one(gpio, GPIOF_DIR_IN, cd->label); if (ret < 0) goto egpioreq; cd->gpio = gpio; host->hotplug.irq = irq; host->hotplug.handler_priv = cd; ret = mmc_cd_get_status(host); if (ret < 0) goto eirqreq; cd->status = ret; ret = request_threaded_irq(irq, NULL, mmc_cd_gpio_irqt, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, cd->label, host); if (ret < 0) goto eirqreq; #if (defined(CONFIG_OPPO_MSM_14021) || defined(CONFIG_OPPO_MSM_14024)) //[email protected], 2014/09/24, Add for wakeup the phone when insert or pull out the micro sd card #if 0 if (get_pcb_version() >= HW_VERSION__32) { ret = enable_irq_wake(irq); if(ret < 0) { printk(KERN_ERR "%s, enable_irq_wake %d\n", __func__, ret); } } #endif #endif /* VENDOR_EDIT */ return 0; eirqreq: gpio_free(gpio); egpioreq: kfree(cd); return ret; }
static int __init msm_led_cci_add_driver(void) { CDBG("called\n"); if (get_pcb_version() >= HW_VERSION__20) { pr_err("It Find7S"); return -ENODEV; } else { pr_err("It Find7"); return platform_driver_probe(&msm_led_cci_driver, msm_led_cci_probe); } }
static void __init oppo_config_display(void) { int rc; rc = gpio_request(DISP_ESD_GPIO, "disp_esd"); if (rc) { pr_err("%s: request DISP_ESD GPIO failed, rc: %d", __func__, rc); return; } rc = gpio_tlmm_config(GPIO_CFG(DISP_ESD_GPIO, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), GPIO_CFG_ENABLE); if (rc) { pr_err("%s: unable to configure DISP_ESD GPIO, rc: %d", __func__, rc); gpio_free(DISP_ESD_GPIO); return; } rc = gpio_direction_input(DISP_ESD_GPIO); if (rc) { pr_err("%s: set direction for DISP_ESD GPIO failed, rc: %d", __func__, rc); gpio_free(DISP_ESD_GPIO); return; } if (get_pcb_version() >= HW_VERSION__20) { rc = gpio_request(DISP_LCD_UNK_GPIO, "lcd_unk"); if (rc) { pr_err("%s: request DISP_UNK GPIO failed, rc: %d", __func__, rc); return; } rc = gpio_direction_output(DISP_LCD_UNK_GPIO, 0); if (rc) { pr_err("%s: set direction for DISP_LCD_UNK GPIO failed, rc: %d", __func__, rc); gpio_free(DISP_LCD_UNK_GPIO); return; } } }
static int __init mipi_orise_lcd_init(void) { mipi_dsi_buf_alloc(&orise_tx_buf, DSI_BUF_SIZE); mipi_dsi_buf_alloc(&orise_rx_buf, DSI_BUF_SIZE); printk("huyu----%s: --\n", __func__); if(get_pcb_version() < 20 ) { printk("huyu----%s: lcd is 720p!--\n", __func__); return platform_driver_register(&this_driver); } return 0; }
static void lcm_init(void) { #if defined(BUILD_LK) #ifdef TEMP_VER_CHECK g_PCBver = get_pcb_version(); LCM_PRINT("[LCD] pcb_version =%d\n",g_PCBver); #endif /* TEMP_VER_CHECK */ ldo_p5m5_dsv_5v5_off(); SET_RESET_PIN(0); MDELAY(50); #endif //SET_RESET_PIN(0); //TP_VCI 3.0v on ldo_3v0_on(); MDELAY(200); ldo_1v8io_on(); MDELAY(200); ldo_p5m5_dsv_5v5_on(); MDELAY(20); SET_RESET_PIN(1); MDELAY(20); SET_RESET_PIN(0); MDELAY(2); SET_RESET_PIN(1); MDELAY(20); init_lcm_registers(); //SET EXTC ~ sleep out register MDELAY(80); // init_lcm_registers_added(); //Display On need_set_lcm_addr = 1; LCM_PRINT("[SEOSCTEST] lcm_init \n"); LCM_PRINT("[LCD] lcm_init \n"); }
/* initialize chip */ static int lm3630_chip_init(struct lm3630_chip_data *pchip) { int ret; unsigned int reg_val; struct lm3630_platform_data *pdata = pchip->pdata; #ifdef VENDOR_EDIT /* [email protected], 2015/03/26 Add for low brightness filcker */ ret = regmap_update_bits(pchip->regmap, FILTER_STR, 0x03, 0x03); #endif /*CONFIG_VENDOR_EDIT*/ /*pwm control */ reg_val = ((pdata->pwm_active & 0x01) << 2) | (pdata->pwm_ctrl & 0x03); ret = regmap_update_bits(pchip->regmap, REG_CONFIG, 0x07, reg_val); if (ret < 0) goto out; /* For normal mode, enable pwm control by [email protected], 2013/12/20 */ //if (get_pcb_version() < HW_VERSION__20) { /* For Find7 */ if (get_boot_mode() == MSM_BOOT_MODE__NORMAL) { ret = regmap_update_bits(pchip->regmap, REG_CONFIG, 0x01, 0x01); if (ret < 0) goto out; } //} #ifdef CONGIF_OPPO_CMCC_OPTR reg_val = 0x12; /* For 13077 CMCC */ if ((get_pcb_version() >= 20)&&(get_pcb_version() < 30)) {/*liuyan add for N3*/ reg_val = 0x0F; /* For 13097 cmcctest */ } else { reg_val = 0x12; /* For 13077 cmcc test */ } #else if ((get_pcb_version() >= 20)&&(get_pcb_version() < 30)) {/*liuyan add for N3*/ reg_val = 0x12; /* For 13097 low power version */ } else { reg_val = 0x16; /* For 13077 pvt panel */ } #endif regmap_write(pchip->regmap, REG_MAXCU_A, reg_val); regmap_write(pchip->regmap, REG_MAXCU_B, reg_val); /* bank control */ reg_val = ((pdata->bank_b_ctrl & 0x01) << 1) | (pdata->bank_a_ctrl & 0x07)|0x18;//linear ret = regmap_update_bits(pchip->regmap, REG_CTRL, 0x1F, reg_val); if (ret < 0) goto out; ret = regmap_update_bits(pchip->regmap, REG_CTRL, 0x80, 0x00); if (ret < 0) goto out; printk("%s: bl_initvalue=%d\n", __func__,pdata->init_brt_led1); #ifdef VENDOR_EDIT /* OPPO Goushengjun,2015-5-21 add for close BL when utomatic reboot */ if(get_lcd_closebl_flag()) { if (pdata->bank_a_ctrl != BANK_A_CTRL_DISABLE) { ret = regmap_write(pchip->regmap, REG_BRT_A,0); if (ret < 0) goto out; } if (pdata->bank_b_ctrl != BANK_B_CTRL_DISABLE) { ret = regmap_write(pchip->regmap, REG_BRT_B,0); if (ret < 0) goto out; } }else { /* set initial brightness */ if (pdata->bank_a_ctrl != BANK_A_CTRL_DISABLE) { printk("%s: bl_initvalue=%d,222\n", __func__,pdata->init_brt_led1); if (ret < 0) goto out; } if (pdata->bank_b_ctrl != BANK_B_CTRL_DISABLE) { ret = regmap_write(pchip->regmap, REG_BRT_B, pdata->init_brt_led2); if (ret < 0) goto out; } ret = regmap_write(pchip->regmap, REG_BRT_A, pdata->init_brt_led1); ret = regmap_write(pchip->regmap, REG_BRT_A, pdata->init_brt_led1); return ret; } #endif /* OPPO Goushengjun add end*/ out: dev_err(pchip->dev, "i2c failed to access register\n"); return ret; }
void __init apq8064_init_gpiomux(void) { int rc; int platform_version = socinfo_get_platform_version(); rc = msm_gpiomux_init(NR_GPIO_IRQS); if (rc) { pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc); return; } msm_gpiomux_install(wcnss_5wire_interface, ARRAY_SIZE(wcnss_5wire_interface)); if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) { #ifndef CONFIG_MACH_APQ8064_FIND5 msm_gpiomux_install(mpq8064_gsbi5_i2c_configs, ARRAY_SIZE(mpq8064_gsbi5_i2c_configs)); #endif #ifdef CONFIG_MSM_VCAP msm_gpiomux_install(vcap_configs, ARRAY_SIZE(vcap_configs)); #endif #ifndef CONFIG_MACH_APQ8064_FIND5 msm_gpiomux_install(sx150x_int_configs, ARRAY_SIZE(sx150x_int_configs)); #endif } else { #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE) msm_gpiomux_install(apq8064_ethernet_configs, ARRAY_SIZE(apq8064_ethernet_configs)); #endif msm_gpiomux_install(apq8064_gsbi_configs, ARRAY_SIZE(apq8064_gsbi_configs)); #ifdef CONFIG_MACH_APQ8064_FIND5 if (get_pcb_version() >= PCB_VERSION_DVT) { msm_gpiomux_install(apq8064_gsbi7_i2c_config, ARRAY_SIZE(apq8064_gsbi7_i2c_config)); } #endif } msm_gpiomux_install(apq8064_slimbus_config, ARRAY_SIZE(apq8064_slimbus_config)); msm_gpiomux_install(apq8064_audio_codec_configs, ARRAY_SIZE(apq8064_audio_codec_configs)); if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) { msm_gpiomux_install(mpq8064_spkr_i2s_config, ARRAY_SIZE(mpq8064_spkr_i2s_config)); } pr_debug("%s(): audio-auxpcm: Include GPIO configs" " as audio is not the primary user" " for these GPIO Pins\n", __func__); if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) msm_gpiomux_install(mpq8064_mi2s_configs, ARRAY_SIZE(mpq8064_mi2s_configs)); msm_gpiomux_install(apq8064_ext_regulator_configs, ARRAY_SIZE(apq8064_ext_regulator_configs)); #ifdef CONFIG_MACH_APQ8064_FIND5 msm_gpiomux_install(apq8064_backlight_enable, ARRAY_SIZE(apq8064_backlight_enable)); #endif if (machine_is_apq8064_mtp()) { if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_DSDA2) { msm_gpiomux_install(amdm_configs, ARRAY_SIZE(amdm_configs)); msm_gpiomux_install(bmdm_configs, ARRAY_SIZE(bmdm_configs)); } else if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE2) { msm_gpiomux_install(mdm_configs, ARRAY_SIZE(mdm_configs)); msm_gpiomux_install(sglte2_qsc_configs, ARRAY_SIZE(sglte2_qsc_configs)); /* GSBI4 UART GPIOs for Primary IPC */ msm_gpiomux_install(apq8064_uartdm_gsbi4_configs, ARRAY_SIZE(apq8064_uartdm_gsbi4_configs)); } else if (SOCINFO_VERSION_MINOR(platform_version) == 1) { msm_gpiomux_install(mdm_i2s_configs, ARRAY_SIZE(mdm_i2s_configs)); } else { msm_gpiomux_install(mdm_configs, ARRAY_SIZE(mdm_configs)); } } if (machine_is_apq8064_mtp()) { if (SOCINFO_VERSION_MINOR(platform_version) == 1) { msm_gpiomux_install(cyts_gpio_alt_config, ARRAY_SIZE(cyts_gpio_alt_config)); } else { msm_gpiomux_install(cyts_gpio_configs, ARRAY_SIZE(cyts_gpio_configs)); } } #ifdef CONFIG_USB_EHCI_MSM_HSIC if (machine_is_apq8064_mtp()) msm_gpiomux_install(apq8064_hsic_configs, ARRAY_SIZE(apq8064_hsic_configs)); #endif if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid()) msm_gpiomux_install(apq8064_mxt_configs, ARRAY_SIZE(apq8064_mxt_configs)); msm_gpiomux_install(apq8064_hdmi_configs, ARRAY_SIZE(apq8064_hdmi_configs)); /* OPPO 2012-11-14 DuYuanHua Add to config GPIO_72 as input pin for sim card detection */ #ifdef OPPO_FEATURE_UIM_CARD_HOTSWAP msm_gpiomux_install(apq8064_uim_card_detection_configs, ARRAY_SIZE(apq8064_uim_card_detection_configs)); #endif /* OPPO 2012-11-14 DuYuanHua Add End*/ if (machine_is_mpq8064_cdp()) msm_gpiomux_install(mpq8064_ir_configs, ARRAY_SIZE(mpq8064_ir_configs)); #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT msm_gpiomux_install(apq8064_sdc2_configs, ARRAY_SIZE(apq8064_sdc2_configs)); #endif #ifdef CONFIG_MMC_MSM_SDC4_SUPPORT msm_gpiomux_install(apq8064_sdc4_configs, ARRAY_SIZE(apq8064_sdc4_configs)); #endif msm_gpiomux_install(apq8064_sdc3_configs, ARRAY_SIZE(apq8064_sdc3_configs)); if (machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) msm_gpiomux_install(mpq8064_uartdm_configs, ARRAY_SIZE(mpq8064_uartdm_configs)); }
/** * dwc3_otg_sm_work - workqueue function. * * @w: Pointer to the dwc3 otg workqueue * * NOTE: After any change in phy->state, * we must reschdule the state machine. */ static void dwc3_otg_sm_work(struct work_struct *w) { struct dwc3_otg *dotg = container_of(w, struct dwc3_otg, sm_work.work); struct usb_phy *phy = dotg->otg.phy; struct dwc3_charger *charger = dotg->charger; bool work = 0; int ret = 0; unsigned long delay = 0; pm_runtime_resume(phy->dev); dev_dbg(phy->dev, "%s state\n", otg_state_string(phy->state)); /* Check OTG state */ switch (phy->state) { case OTG_STATE_UNDEFINED: dwc3_otg_init_sm(dotg); if (!dotg->psy) { dotg->psy = power_supply_get_by_name("usb"); if (!dotg->psy) dev_err(phy->dev, "couldn't get usb power supply\n"); } /* Switch to A or B-Device according to ID / BSV */ if (!test_bit(ID, &dotg->inputs)) { dev_dbg(phy->dev, "!id\n"); phy->state = OTG_STATE_A_IDLE; work = 1; } else if (test_bit(B_SESS_VLD, &dotg->inputs)) { dev_dbg(phy->dev, "b_sess_vld\n"); phy->state = OTG_STATE_B_IDLE; work = 1; } else { phy->state = OTG_STATE_B_IDLE; dev_dbg(phy->dev, "No device, trying to suspend\n"); pm_runtime_put_sync(phy->dev); } break; case OTG_STATE_B_IDLE: if (!test_bit(ID, &dotg->inputs)) { dev_dbg(phy->dev, "!id\n"); phy->state = OTG_STATE_A_IDLE; work = 1; dotg->charger_retry_count = 0; if (charger) { if (charger->chg_type == DWC3_INVALID_CHARGER) charger->start_detection(dotg->charger, false); else charger->chg_type = DWC3_INVALID_CHARGER; } } else if (test_bit(B_SESS_VLD, &dotg->inputs)) { dev_dbg(phy->dev, "b_sess_vld\n"); if (charger) { /* Has charger been detected? If no detect it */ switch (charger->chg_type) { case DWC3_DCP_CHARGER: case DWC3_PROPRIETARY_CHARGER: dev_dbg(phy->dev, "lpm, DCP charger\n"); dwc3_otg_set_power(phy, DWC3_IDEV_CHG_MAX); pm_runtime_put_sync(phy->dev); break; case DWC3_CDP_CHARGER: dwc3_otg_set_power(phy, DWC3_IDEV_CHG_MAX); dwc3_otg_start_peripheral(&dotg->otg, 1); phy->state = OTG_STATE_B_PERIPHERAL; work = 1; break; case DWC3_SDP_CHARGER: dwc3_otg_start_peripheral(&dotg->otg, 1); phy->state = OTG_STATE_B_PERIPHERAL; work = 1; /* OPPO 2013-10-05 wangjc Add begin for support non-standard charger, HW_VERSION__12 is dvt */ #ifdef CONFIG_MACH_MSM8974_14001 #if defined(CONFIG_OPPO_DEVICE_FIND7) || defined(CONFIG_OPPO_DEVICE_FIND7WX) if(get_pcb_version() < HW_VERSION__12) { cancel_delayed_work_sync(&dotg->non_standard_charger_work); non_standard = true; schedule_delayed_work(&dotg->non_standard_charger_work, round_jiffies_relative(msecs_to_jiffies (5000))); } else { /* [email protected], 2014/01/23 Add for notify usb online earlier */ power_supply_set_online(dotg->psy, true); power_supply_changed(dotg->psy); } #else power_supply_set_online(dotg->psy, true); power_supply_changed(dotg->psy); #endif #endif /* OPPO 2013-10-05 wangjc Add end */ break; case DWC3_FLOATED_CHARGER: /* OPPO 2013-10-05 wangjc Modify begin for support non-standard charger */ #ifndef CONFIG_MACH_MSM8974_14001 if (dotg->charger_retry_count < max_chgr_retry_count) dotg->charger_retry_count++; /* * In case of floating charger, if * retry count equal to max retry count * notify PMIC about floating charger * and put Hw in low power mode. Else * perform charger detection again by * calling start_detection() with false * and then with true argument. */ if (dotg->charger_retry_count == max_chgr_retry_count) { dwc3_otg_set_power(phy, 0); pm_runtime_put_sync(phy->dev); break; } charger->start_detection(dotg->charger, false); #else dev_dbg(phy->dev, "lpm, FLOATED charger\n"); dwc3_otg_set_power(phy, DWC3_IDEV_CHG_FLOATED); pm_runtime_put_sync(phy->dev); break; #endif /* OPPO 2013-10-05 wangjc Modify end */ default: dev_dbg(phy->dev, "chg_det started\n"); /* OPPO 2013-11-18 wangjc Modify begin for detect charger type later */ #ifndef CONFIG_MACH_MSM8974_14001 charger->start_detection(charger, true); #else /* [email protected], 2014/02/24 Add for solve usb reboot problem */ cancel_delayed_work_sync(&dotg->detect_work); /* [email protected], 2014/03/25 Add for solve usb reboot problem,bug 422328 */ if (charger) charger->start_detection(dotg->charger, false); dotg->charger_retry_count = 0; dwc3_otg_set_power(phy, 0); queue_delayed_work(system_nrt_wq, &dotg->detect_work, msecs_to_jiffies(600)); #endif /* OPPO 2013-11-18 wangjc Modify end */ break; } } else { /* no charger registered, start peripheral */ if (dwc3_otg_start_peripheral(&dotg->otg, 1)) { /* * Probably set_peripheral not called * yet. We will re-try as soon as it * will be called */ dev_err(phy->dev, "enter lpm as\n" "unable to start B-device\n"); phy->state = OTG_STATE_UNDEFINED; pm_runtime_put_sync(phy->dev); return; } } } else { /* OPPO 2013-12-01 wangjc Add begin for for non standard charger detect, HW_VERSION__12 is dvt */ #ifdef CONFIG_MACH_MSM8974_14001 //#ifdef CONFIG_OPPO_DEVICE_FIND7 #if defined(CONFIG_OPPO_DEVICE_FIND7) || defined(CONFIG_OPPO_DEVICE_FIND7WX) if(get_pcb_version() < HW_VERSION__12) { cancel_delayed_work_sync(&dotg->non_standard_charger_work); } #endif #endif /* OPPO 2013-12-01 wangjc Add end */ #ifdef CONFIG_MACH_MSM8974_14001 /* [email protected], 2014/01/06 Add for solve usb reboot problem */ cancel_delayed_work_sync(&dotg->detect_work); #endif /*CONFIG_MACH_MSM8974_14001*/ if (charger) charger->start_detection(dotg->charger, false); dotg->charger_retry_count = 0; dwc3_otg_set_power(phy, 0); dev_dbg(phy->dev, "No device, trying to suspend\n"); pm_runtime_put_sync(phy->dev); } break; case OTG_STATE_B_PERIPHERAL: if (!test_bit(B_SESS_VLD, &dotg->inputs) || !test_bit(ID, &dotg->inputs)) { dev_dbg(phy->dev, "!id || !bsv\n"); dwc3_otg_start_peripheral(&dotg->otg, 0); phy->state = OTG_STATE_B_IDLE; if (charger) charger->chg_type = DWC3_INVALID_CHARGER; work = 1; } break; case OTG_STATE_A_IDLE: /* Switch to A-Device*/ if (test_bit(ID, &dotg->inputs)) { dev_dbg(phy->dev, "id\n"); phy->state = OTG_STATE_B_IDLE; dotg->vbus_retry_count = 0; work = 1; } else { phy->state = OTG_STATE_A_HOST; ret = dwc3_otg_start_host(&dotg->otg, 1); if ((ret == -EPROBE_DEFER) && dotg->vbus_retry_count < 3) { /* * Get regulator failed as regulator driver is * not up yet. Will try to start host after 1sec */ phy->state = OTG_STATE_A_IDLE; dev_dbg(phy->dev, "Unable to get vbus regulator. Retrying...\n"); delay = VBUS_REG_CHECK_DELAY; work = 1; dotg->vbus_retry_count++; } else if (ret) { /* * Probably set_host was not called yet. * We will re-try as soon as it will be called */ dev_dbg(phy->dev, "enter lpm as\n" "unable to start A-device\n"); phy->state = OTG_STATE_A_IDLE; pm_runtime_put_sync(phy->dev); return; } } break; case OTG_STATE_A_HOST: if (test_bit(ID, &dotg->inputs)) { dev_dbg(phy->dev, "id\n"); dwc3_otg_start_host(&dotg->otg, 0); phy->state = OTG_STATE_B_IDLE; dotg->vbus_retry_count = 0; work = 1; } break; default: dev_err(phy->dev, "%s: invalid otg-state\n", __func__); } if (work) queue_delayed_work(system_nrt_wq, &dotg->sm_work, delay); }
static int dwc3_otg_set_power(struct usb_phy *phy, unsigned mA) { static int power_supply_type; struct dwc3_otg *dotg = container_of(phy->otg, struct dwc3_otg, otg); if (!dotg->psy || !dotg->charger) { dev_err(phy->dev, "no usb power supply/charger registered\n"); return 0; } if (dotg->charger->charging_disabled) return 0; if (dotg->charger->chg_type == DWC3_SDP_CHARGER) power_supply_type = POWER_SUPPLY_TYPE_USB; else if (dotg->charger->chg_type == DWC3_CDP_CHARGER) { #ifdef CONFIG_MACH_MSM8974_14001 /* [email protected], 2015/03/20, Modify for some usb3.0 port detected as USB_CDP ,can not show charge icon when charge */ power_supply_type = POWER_SUPPLY_TYPE_USB; #else power_supply_type = POWER_SUPPLY_TYPE_USB_CDP; #endif /*CONFIG_MACH_MSM8974_14001*/ } else if (dotg->charger->chg_type == DWC3_DCP_CHARGER || dotg->charger->chg_type == DWC3_PROPRIETARY_CHARGER || dotg->charger->chg_type == DWC3_FLOATED_CHARGER) power_supply_type = POWER_SUPPLY_TYPE_USB_DCP; else power_supply_type = POWER_SUPPLY_TYPE_BATTERY; power_supply_set_supply_type(dotg->psy, power_supply_type); if (dotg->charger->chg_type == DWC3_CDP_CHARGER) mA = DWC3_IDEV_CHG_MAX; /* OPPO 2013-11-05 wangjc Add begin for enable non standard charging */ #ifdef CONFIG_MACH_MSM8974_14001 if (dotg->charger->chg_type == DWC3_FLOATED_CHARGER) mA = DWC3_IDEV_CHG_FLOATED; #endif /* OPPO 2013-11-05 wangjc Add end */ if (dotg->charger->max_power == mA) return 0; dev_info(phy->dev, "Avail curr from USB = %u\n", mA); if (dotg->charger->max_power <= 2 && mA > 2) { /* Enable charging */ if (power_supply_set_online(dotg->psy, true)) goto psy_error; #ifdef CONFIG_MACH_MSM8974_14001 /* [email protected], 2014/06/06 Add for slove it show usb icon when plug in charger */ if(power_supply_type != POWER_SUPPLY_TYPE_USB) { power_supply_set_online(dotg->psy, false); } #endif /*CONFIG_MACH_MSM8974_14001*/ if (power_supply_set_current_limit(dotg->psy, 1000*mA)) goto psy_error; } else if (dotg->charger->max_power > 0 && (mA == 0 || mA == 2)) { /* Disable charging */ /* OPPO 2013-11-20 wangjc Add begin for don't set online to false when usb is still plug in */ #ifdef CONFIG_MACH_MSM8974_14001 if(power_supply_type != POWER_SUPPLY_TYPE_USB) { if (power_supply_set_online(dotg->psy, false)) goto psy_error; /* Set max current limit */ if (power_supply_set_current_limit(dotg->psy, 0)) goto psy_error; } #endif /* OPPO 2013-11-20 wangjc Add end */ } power_supply_changed(dotg->psy); /* OPPO 2013-12-01 wangjc Add begin for non standard charger detect, HW_VERSION__12 is dvt */ #ifdef CONFIG_MACH_MSM8974_14001 #if defined(CONFIG_OPPO_DEVICE_FIND7) || defined(CONFIG_OPPO_DEVICE_FIND7WX) if(get_pcb_version() < HW_VERSION__12) { if(mA == 500) { non_standard = false; } } #endif #endif /* OPPO 2013-12-01 wangjc Add end */ dotg->charger->max_power = mA; return 0; psy_error: dev_dbg(phy->dev, "power supply error when setting property\n"); return -ENXIO; }
/** * dwc3_otg_init - Initializes otg related registers * @dwc: Pointer to out controller context structure * * Returns 0 on success otherwise negative errno. */ int dwc3_otg_init(struct dwc3 *dwc) { u32 reg; int ret = 0; struct dwc3_otg *dotg; dev_dbg(dwc->dev, "dwc3_otg_init\n"); /* * GHWPARAMS6[10] bit is SRPSupport. * This bit also reflects DWC_USB3_EN_OTG */ reg = dwc3_readl(dwc->regs, DWC3_GHWPARAMS6); if (!(reg & DWC3_GHWPARAMS6_SRP_SUPPORT)) { /* * No OTG support in the HW core. * We return 0 to indicate no error, since this is acceptable * situation, just continue probe the dwc3 driver without otg. */ dev_dbg(dwc->dev, "dwc3_otg address space is not supported\n"); return 0; } /* Allocate and init otg instance */ dotg = kzalloc(sizeof(struct dwc3_otg), GFP_KERNEL); if (!dotg) { dev_err(dwc->dev, "unable to allocate dwc3_otg\n"); return -ENOMEM; } /* DWC3 has separate IRQ line for OTG events (ID/BSV etc.) */ dotg->irq = platform_get_irq_byname(to_platform_device(dwc->dev), "otg_irq"); if (dotg->irq < 0) { dev_err(dwc->dev, "%s: missing OTG IRQ\n", __func__); ret = -ENODEV; goto err1; } dotg->regs = dwc->regs; dotg->otg.set_peripheral = dwc3_otg_set_peripheral; dotg->otg.set_host = dwc3_otg_set_host; /* This reference is used by dwc3 modules for checking otg existance */ dwc->dotg = dotg; dotg->otg.phy = kzalloc(sizeof(struct usb_phy), GFP_KERNEL); if (!dotg->otg.phy) { dev_err(dwc->dev, "unable to allocate dwc3_otg.phy\n"); ret = -ENOMEM; goto err1; } dotg->dwc = dwc; dotg->otg.phy->otg = &dotg->otg; dotg->otg.phy->dev = dwc->dev; dotg->otg.phy->set_power = dwc3_otg_set_power; dotg->otg.phy->set_suspend = dwc3_otg_set_suspend; dotg->otg.phy->set_phy_autosuspend = dwc3_otg_set_autosuspend; ret = usb_set_transceiver(dotg->otg.phy); if (ret) { dev_err(dotg->otg.phy->dev, "%s: failed to set transceiver, already exists\n", __func__); goto err2; } dotg->otg.phy->state = OTG_STATE_UNDEFINED; init_completion(&dotg->dwc3_xcvr_vbus_init); INIT_DELAYED_WORK(&dotg->sm_work, dwc3_otg_sm_work); /* OPPO 2013-10-05 wangjc Add begin for support non-standard charger, HW_VERSION__12 is dvt */ #ifdef CONFIG_MACH_MSM8974_14001 #if defined(CONFIG_OPPO_DEVICE_FIND7) || defined(CONFIG_OPPO_DEVICE_FIND7WX) if(get_pcb_version() < HW_VERSION__12) { INIT_DELAYED_WORK(&dotg->non_standard_charger_work, non_standard_charger_detect_work); } #endif #endif /* OPPO 2013-10-05 wangjc Add end */ /* OPPO 2013-11-21 wangjc Add begin for delay charger detect */ #ifdef CONFIG_MACH_MSM8974_14001 INIT_DELAYED_WORK(&dotg->detect_work, dwc3_otg_detect_work); #endif /* OPPO 2013-11-21 wangjc Add end */ ret = request_irq(dotg->irq, dwc3_otg_interrupt, IRQF_SHARED, "dwc3_otg", dotg); if (ret) { dev_err(dotg->otg.phy->dev, "failed to request irq #%d --> %d\n", dotg->irq, ret); goto err3; } pm_runtime_get(dwc->dev); return 0; err3: /* OPPO 2013-11-21 wangjc Add begin for delay charger detect */ #ifdef CONFIG_MACH_MSM8974_14001 cancel_delayed_work_sync(&dotg->detect_work); #endif /* OPPO 2013-11-21 wangjc Add end */ cancel_delayed_work_sync(&dotg->sm_work); usb_set_transceiver(NULL); err2: kfree(dotg->otg.phy); err1: dwc->dotg = NULL; kfree(dotg); return ret; }
static ssize_t pcb_version_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { return sprintf(buf, "%d\n", get_pcb_version()); }
int mipi_dsi_off(struct platform_device *pdev) #endif /* OPPO 2013-02-04 zhengzk Modify end */ { int ret = 0; struct msm_fb_data_type *mfd; struct msm_panel_info *pinfo; pr_debug("%s+:\n", __func__); mfd = platform_get_drvdata(pdev); pinfo = &mfd->panel_info; if (mdp_rev >= MDP_REV_41) mutex_lock(&mfd->dma->ov_mutex); else down(&mfd->dma->mutex); if (mfd->panel_info.type == MIPI_CMD_PANEL) { /*OPPO 2013-10-11 zhzhyon Add for reason*/ #ifdef PANEL_SRE if(get_pcb_version() >= PCB_VERSION_EVT_N1) { mutex_lock(&sre_mutex); } #endif /*OPPO 2013-10-11 zhzhyon Add end*/ mipi_dsi_prepare_ahb_clocks(); mipi_dsi_ahb_ctrl(1); mipi_dsi_clk_enable(); /*OPPO 2013-10-11 zhzhyon Add for reason*/ #ifdef PANEL_SRE if(get_pcb_version() >= PCB_VERSION_EVT_N1) { mutex_unlock(&sre_mutex); } #endif /*OPPO 2013-10-11 zhzhyon Add end*/ /* make sure dsi_cmd_mdp is idle */ mipi_dsi_cmd_mdp_busy(); } /* * Desctiption: change to DSI_CMD_MODE since it needed to * tx DCS dsiplay off comamnd to panel */ mipi_dsi_op_mode_config(DSI_CMD_MODE); if (mfd->panel_info.type == MIPI_CMD_PANEL) { if (pinfo->lcd.vsync_enable) { if (pinfo->lcd.hw_vsync_mode && vsync_gpio >= 0) { if (MDP_REV_303 != mdp_rev) gpio_free(vsync_gpio); } mipi_dsi_set_tear_off(mfd); } } ret = panel_next_off(pdev); spin_lock_bh(&dsi_clk_lock); mipi_dsi_clk_disable(); /* disbale dsi engine */ MIPI_OUTP(MIPI_DSI_BASE + 0x0000, 0); mipi_dsi_phy_ctrl(0); mipi_dsi_ahb_ctrl(0); spin_unlock_bh(&dsi_clk_lock); mipi_dsi_unprepare_clocks(); mipi_dsi_unprepare_ahb_clocks(); if (mipi_dsi_pdata && mipi_dsi_pdata->dsi_power_save) mipi_dsi_pdata->dsi_power_save(0); if (mdp_rev >= MDP_REV_41) mutex_unlock(&mfd->dma->ov_mutex); else up(&mfd->dma->mutex); pr_debug("%s-:\n", __func__); return ret; }
void __init apq8064_init_gpiomux(void) { int rc; rc = msm_gpiomux_init(NR_GPIO_IRQS); if (rc) { pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc); return; } msm_gpiomux_install(wcnss_5wire_interface, ARRAY_SIZE(wcnss_5wire_interface)); if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) { /* OPPO 2012-08-29 chenzj Delete begin for del unused code */ #if 0 msm_gpiomux_install(mpq8064_gsbi5_i2c_configs, ARRAY_SIZE(mpq8064_gsbi5_i2c_configs)); #endif /* OPPO 2012-08-29 chenzj Delete end */ #ifdef CONFIG_MSM_VCAP msm_gpiomux_install(vcap_configs, ARRAY_SIZE(vcap_configs)); #endif //OPPO 2012-12-18 huyu del for lcd 5V_enable for dvt #ifndef CONFIG_VENDOR_EDIT msm_gpiomux_install(sx150x_int_configs, ARRAY_SIZE(sx150x_int_configs)); #endif //OPPO 2012-12-18 huyu del for lcd 5V_enable for dvt } else { #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE) msm_gpiomux_install(apq8064_ethernet_configs, ARRAY_SIZE(apq8064_ethernet_configs)); #endif msm_gpiomux_install(apq8064_gsbi_configs, ARRAY_SIZE(apq8064_gsbi_configs)); /* OPPO 2012-12-14 yxq added begin for s5k6a3yx's I2C */ if (get_pcb_version() >= 30) { msm_gpiomux_install(apq8064_gsbi7_i2c_config, ARRAY_SIZE(apq8064_gsbi7_i2c_config)); } /* OPPO 2012-12-14 yxq added end */ } msm_gpiomux_install(apq8064_slimbus_config, ARRAY_SIZE(apq8064_slimbus_config)); msm_gpiomux_install(apq8064_audio_codec_configs, ARRAY_SIZE(apq8064_audio_codec_configs)); if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) { msm_gpiomux_install(mpq8064_spkr_i2s_config, ARRAY_SIZE(mpq8064_spkr_i2s_config)); } pr_debug("%s(): audio-auxpcm: Include GPIO configs" " as audio is not the primary user" " for these GPIO Pins\n", __func__); if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) msm_gpiomux_install(mpq8064_mi2s_configs, ARRAY_SIZE(mpq8064_mi2s_configs)); msm_gpiomux_install(apq8064_ext_regulator_configs, ARRAY_SIZE(apq8064_ext_regulator_configs)); //OPPO 2012-11-2 huyu add for lcd backlight enabl #ifdef CONFIG_VENDOR_EDIT msm_gpiomux_install(apq8064_backlight_enable, ARRAY_SIZE(apq8064_backlight_enable)); #endif //OPPO 2012-11-2 huyu add for lcd backlight enabl if (machine_is_apq8064_mtp()) msm_gpiomux_install(mdm_configs, ARRAY_SIZE(mdm_configs)); #ifdef CONFIG_USB_EHCI_MSM_HSIC if (machine_is_apq8064_mtp()) msm_gpiomux_install(cyts_gpio_configs, ARRAY_SIZE(cyts_gpio_configs)); if (machine_is_apq8064_mtp()) msm_gpiomux_install(apq8064_hsic_configs, ARRAY_SIZE(apq8064_hsic_configs)); #endif if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid()) msm_gpiomux_install(apq8064_mxt_configs, ARRAY_SIZE(apq8064_mxt_configs)); msm_gpiomux_install(apq8064_hdmi_configs, ARRAY_SIZE(apq8064_hdmi_configs)); /* OPPO 2012-11-14 DuYuanHua Add to config GPIO_72 as input pin for sim card detection */ #ifdef OPPO_FEATURE_UIM_CARD_HOTSWAP msm_gpiomux_install(apq8064_uim_card_detection_configs, ARRAY_SIZE(apq8064_uim_card_detection_configs)); #endif /* OPPO 2012-11-14 DuYuanHua Add End*/ if (machine_is_mpq8064_cdp()) msm_gpiomux_install(mpq8064_ir_configs, ARRAY_SIZE(mpq8064_ir_configs)); #ifdef CONFIG_MMC_MSM_SDC2_SUPPORT msm_gpiomux_install(apq8064_sdc2_configs, ARRAY_SIZE(apq8064_sdc2_configs)); #endif #ifdef CONFIG_MMC_MSM_SDC4_SUPPORT msm_gpiomux_install(apq8064_sdc4_configs, ARRAY_SIZE(apq8064_sdc4_configs)); #endif msm_gpiomux_install(apq8064_sdc3_configs, ARRAY_SIZE(apq8064_sdc3_configs)); }
static int mipi_dsi_panel_power(int on) { static struct regulator *reg_lvs7, *reg_l2, *reg_l11, *reg_l22, *reg_ext_3p3v; static int gpio36, gpio25, gpio26, mpp3; int rc; pr_debug("%s: on=%d\n", __func__, on); if (!dsi_power_on) { reg_lvs7 = regulator_get(&msm_mipi_dsi1_device.dev, "dsi1_vddio"); if (IS_ERR_OR_NULL(reg_lvs7)) { pr_err("could not get 8921_lvs7, rc = %ld\n", PTR_ERR(reg_lvs7)); return -ENODEV; } reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev, "dsi1_pll_vdda"); if (IS_ERR_OR_NULL(reg_l2)) { pr_err("could not get 8921_l2, rc = %ld\n", PTR_ERR(reg_l2)); return -ENODEV; } rc = regulator_set_voltage(reg_l2, 1200000, 1200000); if (rc) { pr_err("set_voltage l2 failed, rc=%d\n", rc); return -EINVAL; } reg_l11 = regulator_get(&msm_mipi_dsi1_device.dev, "dsi1_avdd"); if (IS_ERR(reg_l11)) { pr_err("could not get 8921_l11, rc = %ld\n", PTR_ERR(reg_l11)); return -ENODEV; } rc = regulator_set_voltage(reg_l11, 3100000, 3100000); if (rc) { pr_err("set_voltage l11 failed, rc=%d\n", rc); return -EINVAL; } reg_l22 = regulator_get(NULL, "8921_l22"); if (IS_ERR(reg_l22)) { pr_err("could not get 8921_l22, rc = %ld\n", PTR_ERR(reg_l22)); return -ENODEV; } if (get_pcb_version() >= PCB_VERSION_EVT) { rc = regulator_set_voltage(reg_l22, 1800000, 1800000); if (rc) { pr_err("set_voltage l22 failed, rc=%d\n", rc); return -EINVAL; } } else if (get_pcb_version() < PCB_VERSION_EVT) { rc = regulator_set_voltage(reg_l22, 2200000, 2200000); if (rc) { pr_err("set_voltage l22 failed, rc=%d\n", rc); return -EINVAL; } } if (machine_is_apq8064_liquid()) { reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev, "dsi1_vccs_3p3v"); if (IS_ERR_OR_NULL(reg_ext_3p3v)) { pr_err("could not get reg_ext_3p3v, rc = %ld\n", PTR_ERR(reg_ext_3p3v)); reg_ext_3p3v = NULL; return -ENODEV; } mpp3 = PM8921_MPP_PM_TO_SYS(3); rc = gpio_request(mpp3, "backlight_en"); if (rc) { pr_err("request mpp3 failed, rc=%d\n", rc); return -ENODEV; } } gpio25 = PM8921_GPIO_PM_TO_SYS(25); rc = gpio_request(gpio25, "disp_rst_n"); if (rc) { pr_err("request gpio 25 failed, rc=%d\n", rc); return -ENODEV; } gpio26 = PM8921_GPIO_PM_TO_SYS(26); rc = gpio_request(gpio26, "pwm_backlight_ctrl"); if (rc) { pr_err("request gpio 26 failed, rc=%d\n", rc); return -ENODEV; } gpio36 = PM8921_GPIO_PM_TO_SYS(36); /* lcd1_pwr_en_n */ rc = gpio_request(gpio36, "lcd1_pwr_en_n"); if (rc) { pr_err("request gpio 36 failed, rc=%d\n", rc); return -ENODEV; } if (get_pcb_version() >= PCB_VERSION_DVT) { rc = gpio_request(LCD_5V_EN_DVT, "lcd_5v_en"); } else { rc = gpio_request(LCD_5V_EN, "lcd_5v_en"); } if (rc) { pr_err("request gpio 86 failed, rc=%d\n", rc); return -ENODEV; } dsi_power_on = true; } if (on) { rc = regulator_enable(reg_lvs7); if (rc) { pr_err("enable lvs7 failed, rc=%d\n", rc); return -ENODEV; } rc = regulator_enable(reg_l22); if (rc) { pr_err("enable l22 failed, rc=%d\n", rc); return -ENODEV; } mdelay(10); if (get_pcb_version() >= PCB_VERSION_DVT) { rc = gpio_direction_output(LCD_5V_EN_DVT, 1); } else { rc = gpio_direction_output(LCD_5V_EN, 1); } if (rc) { pr_err("%s: unable to enable LCD_5V_EN!!!!!!!!!!!!\n", __func__); return -ENODEV; } gpio_set_value_cansleep(gpio36, 0); gpio_set_value_cansleep(gpio25, 1); rc = regulator_set_optimum_mode(reg_l11, 110000); if (rc < 0) { pr_err("set_optimum_mode l11 failed, rc=%d\n", rc); return -EINVAL; } rc = regulator_enable(reg_l11); if (rc) { pr_err("enable l11 failed, rc=%d\n", rc); return -ENODEV; } rc = regulator_set_optimum_mode(reg_l2, 100000); if (rc < 0) { pr_err("set_optimum_mode l2 failed, rc=%d\n", rc); return -EINVAL; } rc = regulator_enable(reg_l2); if (rc) { pr_err("enable l2 failed, rc=%d\n", rc); return -ENODEV; } if (machine_is_apq8064_liquid()) { rc = regulator_enable(reg_ext_3p3v); if (rc) { pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc); return -ENODEV; } gpio_set_value_cansleep(mpp3, 1); } if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) gpio_set_value_cansleep(gpio26, 1); } else { if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) gpio_set_value_cansleep(gpio26, 0); gpio_set_value_cansleep(gpio25, 0); gpio_set_value_cansleep(gpio36, 1); if (machine_is_apq8064_liquid()) { gpio_set_value_cansleep(mpp3, 0); rc = regulator_disable(reg_ext_3p3v); if (rc) { pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc); return -ENODEV; } } if (get_pcb_version() >= PCB_VERSION_DVT) { rc = gpio_direction_output(LCD_5V_EN_DVT, 0); } else { rc = gpio_direction_output(LCD_5V_EN, 0); } if (rc) { pr_err("%s: unable to enable LCD_5V_EN!!!!!!!!!!!!\n", __func__); return -ENODEV; } mdelay(10); rc = regulator_disable(reg_l22); if (rc) { pr_err("disable reg_l22 failed, rc=%d\n", rc); return -ENODEV; } rc = regulator_disable(reg_l11); if (rc) { pr_err("disable reg_l1 failed, rc=%d\n", rc); return -ENODEV; } rc = regulator_disable(reg_lvs7); if (rc) { pr_err("disable reg_lvs7 failed, rc=%d\n", rc); return -ENODEV; } rc = regulator_disable(reg_l2); if (rc) { pr_err("disable reg_l2 failed, rc=%d\n", rc); return -ENODEV; } } return 0; }
/* update and get brightness */ int lm3630_bank_a_update_status(u32 bl_level) { int ret; struct lm3630_chip_data *pchip = lm3630_pchip; pr_debug("%s: bl=%d\n", __func__,bl_level); #ifdef VENDOR_EDIT /* Xiaori.Yuan@Mobile Phone Software Dept.Driver, 2014/04/28 Add for add log for 14001 black screen */ if(pre_brightness == 0) {pr_err("%s set brightness : %d \n",__func__,bl_level);} pre_brightness=bl_level; #endif /*VENDOR_EDIT*/ if(!pchip){ dev_err(pchip->dev, "lm3630_bank_a_update_status pchip is null\n"); return -ENOMEM; } if (!pchip->regmap || !lm3630_pchip->regmap) { pr_err("%s YXQ pchip->regmap is NULL.\n", __func__); return bl_level; } /* brightness 0 means disable */ if (!bl_level) { ret = regmap_write(lm3630_pchip->regmap, REG_BRT_A, 0); ret = regmap_update_bits(pchip->regmap, REG_CTRL, 0x80, 0x80); if (ret < 0) goto out; return bl_level; } /* pwm control */ //bl_level=255; /* i2c control */ ret = regmap_update_bits(pchip->regmap, REG_CTRL, 0x80, 0x00); if (ret < 0) goto out; mdelay(1); #ifndef VENDOR_EDIT /* Xiaori.Yuan@Mobile Phone Software Dept.Driver, 2014/04/24 Modify for backlight flick when disable pwm */ ret = regmap_write(pchip->regmap, REG_BRT_A, bl_level); #else /*VENDOR_EDIT*/ if(bl_level>20) { ret = regmap_write(pchip->regmap, REG_BRT_A, bl_level); } else if((get_pcb_version() < 20)||(get_pcb_version() >=30))/*liuyan add 30 for N3*/ { ret = regmap_write(pchip->regmap, REG_BRT_A, 2+(bl_level-1)*7/18); } else { ret = regmap_write(pchip->regmap, REG_BRT_A, 2+(bl_level-1)*9/18); } #endif /*VENDOR_EDIT*/ if (ret < 0) goto out; #ifdef VENDOR_EDIT /* Xiaori.Yuan@Mobile Phone Software Dept.Driver, 2014/03/10 Add for flicker in low backlight */ backlight_level = bl_level; if(bl_level <= 0x14 && pwm_flag==true){ set_backlight_pwm(0); }else if(bl_level > 0x14 && pwm_flag==false && cabc_mode >0){ set_backlight_pwm(1); } #endif /*VENDOR_EDIT*/ return bl_level; out: dev_err(pchip->dev, "i2c failed to access REG_CTRL\n"); return bl_level; }