static void pm8917_gpio_set_backlight(int bl_level) { int gpio24 = PM8917_GPIO_PM_TO_SYS(24); if (bl_level > 0) gpio_set_value_cansleep(gpio24, 1); else gpio_set_value_cansleep(gpio24, 0); }
static int mipi_dsi_cdp_panel_power(int on) { static struct regulator *reg_l8, *reg_l23, *reg_l2; /* Control backlight GPIO (24) directly when using PM8917 */ #ifndef CONFIG_FB_MSM_MIPI_WARPLTE_OTM_VIDEO_WVGA_PT_PANEL int gpio24 = PM8917_GPIO_PM_TO_SYS(24); #endif int rc; printk("lizhiye, %s: state : %d, dsi_power_on = %d\n", __func__, on, dsi_power_on); if (!dsi_power_on) { reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev, "dsi_vdc"); if (IS_ERR(reg_l8)) { pr_err("could not get 8038_l8, rc = %ld\n", PTR_ERR(reg_l8)); return -ENODEV; } reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev, "dsi_vddio"); if (IS_ERR(reg_l23)) { pr_err("could not get 8038_l23, rc = %ld\n", PTR_ERR(reg_l23)); return -ENODEV; } reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev, "dsi_vdda"); if (IS_ERR(reg_l2)) { pr_err("could not get 8038_l2, rc = %ld\n", PTR_ERR(reg_l2)); return -ENODEV; } rc = regulator_set_voltage(reg_l8, 2800000, 3000000); if (rc) { pr_err("set_voltage l8 failed, rc=%d\n", rc); return -EINVAL; } rc = regulator_set_voltage(reg_l23, 1800000, 1800000); if (rc) { pr_err("set_voltage l23 failed, rc=%d\n", rc); return -EINVAL; } rc = regulator_set_voltage(reg_l2, 1200000, 1200000); if (rc) { pr_err("set_voltage l2 failed, rc=%d\n", rc); return -EINVAL; } rc = gpio_request(DISP_RST_GPIO, "disp_rst_n"); if (rc) { pr_err("request gpio DISP_RST_GPIO failed, rc=%d\n", rc); gpio_free(DISP_RST_GPIO); return -ENODEV; } #ifdef CONFIG_FB_MSM_MIPI_WARPLTE_OTM_VIDEO_WVGA_PT_PANEL rc = gpio_request(DISP_BACKLIGHT_GPIO, "disp_rst_n"); if (rc) { pr_err("lizhiye, request gpio DISP_BACKLIGHT_GPIO failed, rc=%d\n", rc); gpio_free(DISP_BACKLIGHT_GPIO); return -ENODEV; } #endif rc = gpio_request(DISP_3D_2D_MODE, "disp_3d_2d"); if (rc) { pr_err("request gpio DISP_3D_2D_MODE failed, rc=%d\n", rc); gpio_free(DISP_3D_2D_MODE); return -ENODEV; } rc = gpio_direction_output(DISP_3D_2D_MODE, 0); if (rc) { pr_err("gpio_direction_output failed for %d gpio rc=%d\n", DISP_3D_2D_MODE, rc); return -ENODEV; } #ifndef CONFIG_FB_MSM_MIPI_WARPLTE_OTM_VIDEO_WVGA_PT_PANEL if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) { rc = gpio_request(gpio24, "disp_bl"); if (rc) { pr_err("request for gpio 24 failed, rc=%d\n", rc); return -ENODEV; } gpio_set_value_cansleep(gpio24, 0); novatek_pdata.gpio_set_backlight = pm8917_gpio_set_backlight; } #endif dsi_power_on = true; } if (on) { rc = regulator_set_optimum_mode(reg_l8, 100000); if (rc < 0) { pr_err("set_optimum_mode l8 failed, rc=%d\n", rc); return -EINVAL; } rc = regulator_set_optimum_mode(reg_l23, 100000); if (rc < 0) { pr_err("set_optimum_mode l23 failed, rc=%d\n", rc); return -EINVAL; } 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_l8); if (rc) { pr_err("enable l8 failed, rc=%d\n", rc); return -ENODEV; } rc = regulator_enable(reg_l23); if (rc) { pr_err("enable l8 failed, rc=%d\n", rc); return -ENODEV; } rc = regulator_enable(reg_l2); if (rc) { pr_err("enable l2 failed, rc=%d\n", rc); return -ENODEV; } usleep(10000); #if 0 gpio_set_value(DISP_RST_GPIO, 1); usleep(10); gpio_set_value(DISP_RST_GPIO, 0); usleep(20); gpio_set_value(DISP_RST_GPIO, 1); #endif gpio_set_value(DISP_3D_2D_MODE, 1); usleep(20); #ifndef CONFIG_FB_MSM_MIPI_WARPLTE_OTM_VIDEO_WVGA_PT_PANEL if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) gpio_set_value_cansleep(gpio24, 1); #endif } else { gpio_set_value(DISP_RST_GPIO, 0); rc = regulator_disable(reg_l2); if (rc) { pr_err("disable reg_l2 failed, rc=%d\n", rc); return -ENODEV; } rc = regulator_disable(reg_l8); if (rc) { pr_err("disable reg_l8 failed, rc=%d\n", rc); return -ENODEV; } rc = regulator_disable(reg_l23); if (rc) { pr_err("disable reg_l23 failed, rc=%d\n", rc); return -ENODEV; } rc = regulator_set_optimum_mode(reg_l8, 100); if (rc < 0) { pr_err("set_optimum_mode l8 failed, rc=%d\n", rc); return -EINVAL; } rc = regulator_set_optimum_mode(reg_l23, 100); if (rc < 0) { pr_err("set_optimum_mode l23 failed, rc=%d\n", rc); return -EINVAL; } rc = regulator_set_optimum_mode(reg_l2, 100); if (rc < 0) { pr_err("set_optimum_mode l2 failed, rc=%d\n", rc); return -EINVAL; } gpio_set_value(DISP_3D_2D_MODE, 0); usleep(20); #ifndef CONFIG_FB_MSM_MIPI_WARPLTE_OTM_VIDEO_WVGA_PT_PANEL if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) gpio_set_value_cansleep(gpio24, 0); #endif } return 0; }
static int mipi_dsi_cdp_panel_power(int on) { static struct regulator *reg_l8, *reg_l23, *reg_l2; /* Control backlight GPIO (24) directly when using PM8917 */ int gpio24 = PM8917_GPIO_PM_TO_SYS(24); int rc; pr_debug("%s: state : %d\n", __func__, on); if (!dsi_power_on) { reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev, "dsi_vdc"); if (IS_ERR(reg_l8)) { pr_err("could not get 8038_l8, rc = %ld\n", PTR_ERR(reg_l8)); return -ENODEV; } reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev, "dsi_vddio"); if (IS_ERR(reg_l23)) { pr_err("could not get 8038_l23, rc = %ld\n", PTR_ERR(reg_l23)); return -ENODEV; } reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev, "dsi_vdda"); if (IS_ERR(reg_l2)) { pr_err("could not get 8038_l2, rc = %ld\n", PTR_ERR(reg_l2)); return -ENODEV; } rc = regulator_set_voltage(reg_l8, 2800000, 3000000); if (rc) { pr_err("set_voltage l8 failed, rc=%d\n", rc); return -EINVAL; } rc = regulator_set_voltage(reg_l23, 1800000, 1800000); if (rc) { pr_err("set_voltage l23 failed, rc=%d\n", rc); return -EINVAL; } rc = regulator_set_voltage(reg_l2, 1200000, 1200000); if (rc) { pr_err("set_voltage l2 failed, rc=%d\n", rc); return -EINVAL; } rc = gpio_request(DISP_RST_GPIO, "disp_rst_n"); if (rc) { pr_err("request gpio DISP_RST_GPIO failed, rc=%d\n", rc); gpio_free(DISP_RST_GPIO); return -ENODEV; } if (machine_is_msm8930_evt()) { rc = gpio_direction_output(DISP_RST_GPIO, 1); if (rc) { pr_err("gpio_direction_output failed for %d gpio rc=%d\n", DISP_RST_GPIO, rc); return -ENODEV; } } if (!machine_is_msm8930_evt()) { rc = gpio_request(DISP_3D_2D_MODE, "disp_3d_2d"); if (rc) { pr_err("request gpio DISP_3D_2D_MODE failed, rc=%d\n", rc); gpio_free(DISP_3D_2D_MODE); return -ENODEV; } rc = gpio_direction_output(DISP_3D_2D_MODE, 0); if (rc) { pr_err("gpio_direction_output failed for %d gpio rc=%d\n", DISP_3D_2D_MODE, rc); return -ENODEV; } } if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) { rc = gpio_request(gpio24, "disp_bl"); if (rc) { pr_err("request for gpio 24 failed, rc=%d\n", rc); return -ENODEV; } gpio_set_value_cansleep(gpio24, 0); novatek_pdata.gpio_set_backlight = pm8917_gpio_set_backlight; } dsi_power_on = true; } if (on) { rc = regulator_set_optimum_mode(reg_l8, 100000); if (rc < 0) { pr_err("set_optimum_mode l8 failed, rc=%d\n", rc); return -EINVAL; } rc = regulator_set_optimum_mode(reg_l23, 100000); if (rc < 0) { pr_err("set_optimum_mode l23 failed, rc=%d\n", rc); return -EINVAL; } 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_l8); if (rc) { pr_err("enable l8 failed, rc=%d\n", rc); return -ENODEV; } rc = regulator_enable(reg_l23); if (rc) { pr_err("enable l8 failed, rc=%d\n", rc); return -ENODEV; } rc = regulator_enable(reg_l2); if (rc) { pr_err("enable l2 failed, rc=%d\n", rc); return -ENODEV; } usleep(10000); gpio_set_value(DISP_RST_GPIO, 1); usleep(10); gpio_set_value(DISP_RST_GPIO, 0); usleep(20); gpio_set_value(DISP_RST_GPIO, 1); if (!machine_is_msm8930_evt()) gpio_set_value(DISP_3D_2D_MODE, 1); usleep(20); } else { gpio_set_value(DISP_RST_GPIO, 0); rc = regulator_disable(reg_l2); if (rc) { pr_err("disable reg_l2 failed, rc=%d\n", rc); return -ENODEV; } rc = regulator_disable(reg_l8); if (rc) { pr_err("disable reg_l8 failed, rc=%d\n", rc); return -ENODEV; } rc = regulator_disable(reg_l23); if (rc) { pr_err("disable reg_l23 failed, rc=%d\n", rc); return -ENODEV; } rc = regulator_set_optimum_mode(reg_l8, 100); if (rc < 0) { pr_err("set_optimum_mode l8 failed, rc=%d\n", rc); return -EINVAL; } rc = regulator_set_optimum_mode(reg_l23, 100); if (rc < 0) { pr_err("set_optimum_mode l23 failed, rc=%d\n", rc); return -EINVAL; } rc = regulator_set_optimum_mode(reg_l2, 100); if (rc < 0) { pr_err("set_optimum_mode l2 failed, rc=%d\n", rc); return -EINVAL; } if (!machine_is_msm8930_evt()) gpio_set_value(DISP_3D_2D_MODE, 0); usleep(20); } return 0; }