int mdp4_dtv_on(struct platform_device *pdev) { struct msm_fb_data_type *mfd; int ret = 0; int cndx = 0; struct vsycn_ctrl *vctrl; vctrl = &vsync_ctrl_db[cndx]; mfd = (struct msm_fb_data_type *)platform_get_drvdata(pdev); if (!mfd) return -ENODEV; if (mfd->key != MFD_KEY) return -EINVAL; vctrl->dev = mfd->fbi->dev; mdp_footswitch_ctrl(TRUE); mdp_clk_ctrl(1); mdp4_overlay_panel_mode(MDP4_MIXER1, MDP4_PANEL_DTV); if (vctrl->base_pipe == NULL) { if (mdp4_overlay_dtv_set(mfd, NULL)) { pr_warn("%s: dtv_pipe is NULL, dtv_set failed\n", __func__); return -EINVAL; } } ret = panel_next_on(pdev); if (ret != 0) pr_warn("%s: panel_next_on failed", __func__); atomic_set(&vctrl->suspend, 0); if (!vctrl->sysfs_created) { ret = sysfs_create_group(&vctrl->dev->kobj, &vsync_fs_attr_group); if (ret) { pr_err("%s: sysfs group creation failed, ret=%d\n", __func__, ret); return ret; } kobject_uevent(&vctrl->dev->kobj, KOBJ_ADD); pr_debug("%s: kobject_uevent(KOBJ_ADD)\n", __func__); vctrl->sysfs_created = 1; } pr_info("%s:\n", __func__); return ret; }
int mdp4_dtv_off(struct platform_device *pdev) { struct msm_fb_data_type *mfd; int ret = 0; int cndx = 0; struct vsycn_ctrl *vctrl; struct mdp4_overlay_pipe *pipe; mfd = (struct msm_fb_data_type *)platform_get_drvdata(pdev); vctrl = &vsync_ctrl_db[cndx]; atomic_set(&vctrl->suspend, 1); if (vctrl->vsync_irq_enabled) { while (vctrl->wait_vsync_cnt) msleep(20); } complete_all(&vctrl->vsync_comp); vctrl->wait_vsync_cnt = 0; pipe = vctrl->base_pipe; if (pipe != NULL) { mdp4_dtv_stop(mfd); mdp4_overlay_unset_mixer(pipe->mixer_num); if (hdmi_prim_display && mfd->ref_cnt == 0) { if (pipe->pipe_type == OVERLAY_TYPE_BF) mdp4_overlay_borderfill_stage_down(pipe); vctrl->base_pipe = NULL; } else { mdp4_mixer_stage_down(pipe, 1); mdp4_overlay_pipe_free(pipe); vctrl->base_pipe = NULL; msleep(20); } } mdp4_overlay_panel_mode_unset(MDP4_MIXER1, MDP4_PANEL_DTV); ret = panel_next_off(pdev); #if 0 mdp_footswitch_ctrl(FALSE); #endif mdp_clk_ctrl(0); dtv_pipe_ready = 0; pr_info("%s:\n", __func__); return ret; }
int mdp4_dtv_off(struct platform_device *pdev) { struct msm_fb_data_type *mfd; int ret = 0; int cndx = 0; struct vsycn_ctrl *vctrl; struct mdp4_overlay_pipe *pipe; mfd = (struct msm_fb_data_type *)platform_get_drvdata(pdev); vctrl = &vsync_ctrl_db[cndx]; atomic_set(&vctrl->suspend, 1); atomic_set(&vctrl->vsync_resume, 0); if (vctrl->vsync_irq_enabled) { while (vctrl->wait_vsync_cnt) msleep(20); /* >= 17 ms */ } complete_all(&vctrl->vsync_comp); pipe = vctrl->base_pipe; if (pipe != NULL) { mdp4_dtv_stop(mfd); /* sanity check, free pipes besides base layer */ mdp4_overlay_unset_mixer(pipe->mixer_num); if (hdmi_prim_display && mfd->ref_cnt == 0) { /* adb stop */ if (pipe->pipe_type == OVERLAY_TYPE_BF) mdp4_overlay_borderfill_stage_down(pipe); /* base pipe may change after borderfill_stage_down */ pipe = vctrl->base_pipe; mdp4_mixer_stage_down(pipe, 1); mdp4_overlay_pipe_free(pipe); /* pipe == rgb2 */ vctrl->base_pipe = NULL; } else { mdp4_mixer_stage_down(pipe, 1); mdp4_overlay_pipe_free(pipe); vctrl->base_pipe = NULL; } } mdp4_overlay_panel_mode_unset(MDP4_MIXER1, MDP4_PANEL_DTV); ret = panel_next_off(pdev); mdp_footswitch_ctrl(FALSE); /* Mdp clock disable */ mdp_clk_ctrl(0); pr_info("%s:\n", __func__); return ret; }
static int dtv_on(struct platform_device *pdev) { int ret = 0; struct msm_fb_data_type *mfd; unsigned long panel_pixclock_freq , pm_qos_rate; mfd = platform_get_drvdata(pdev); panel_pixclock_freq = mfd->fbi->var.pixclock; if (panel_pixclock_freq > 58000000) /* pm_qos_rate should be in Khz */ pm_qos_rate = panel_pixclock_freq / 1000 ; else pm_qos_rate = 58000; mdp_footswitch_ctrl(TRUE); mdp4_extn_disp = 1; #ifdef CONFIG_MSM_BUS_SCALING if (dtv_bus_scale_handle > 0) msm_bus_scale_client_update_request(dtv_bus_scale_handle, 1); #else if (ebi1_clk) { clk_set_rate(ebi1_clk, pm_qos_rate * 1000); clk_enable(ebi1_clk); } #endif mfd = platform_get_drvdata(pdev); ret = clk_set_rate(tv_src_clk, mfd->fbi->var.pixclock); if (ret) { pr_info("%s: clk_set_rate(%d) failed\n", __func__, mfd->fbi->var.pixclock); if (mfd->fbi->var.pixclock == 27030000) mfd->fbi->var.pixclock = 27000000; ret = clk_set_rate(tv_src_clk, mfd->fbi->var.pixclock); } pr_info("%s: tv_src_clk=%dkHz, pm_qos_rate=%ldkHz, [%d]\n", __func__, mfd->fbi->var.pixclock/1000, pm_qos_rate, ret); clk_enable(hdmi_clk); clk_reset(hdmi_clk, CLK_RESET_ASSERT); udelay(20); clk_reset(hdmi_clk, CLK_RESET_DEASSERT); if (mdp_tv_clk) clk_enable(mdp_tv_clk); if (dtv_pdata && dtv_pdata->lcdc_power_save) dtv_pdata->lcdc_power_save(1); if (dtv_pdata && dtv_pdata->lcdc_gpio_config) ret = dtv_pdata->lcdc_gpio_config(1); ret = panel_next_on(pdev); return ret; }
int mdp4_dtv_on(struct platform_device *pdev) { struct msm_fb_data_type *mfd; int ret = 0; int cndx = 0; struct vsycn_ctrl *vctrl; vctrl = &vsync_ctrl_db[cndx]; mfd = (struct msm_fb_data_type *)platform_get_drvdata(pdev); if (!mfd) return -ENODEV; if (mfd->key != MFD_KEY) return -EINVAL; mutex_lock(&mfd->dma->ov_mutex); vctrl->dev = mfd->fbi->dev; vctrl->vsync_irq_enabled = 0; #if 0 mdp_footswitch_ctrl(TRUE); #endif mdp_clk_ctrl(1); mdp4_overlay_panel_mode(MDP4_MIXER1, MDP4_PANEL_DTV); if (vctrl->base_pipe == NULL) { if (mdp4_overlay_dtv_set(mfd, NULL)) { pr_warn("%s: dtv_pipe is NULL, dtv_set failed\n", __func__); mutex_unlock(&mfd->dma->ov_mutex); mdp_clk_ctrl(0); return -EINVAL; } } ret = panel_next_on(pdev); if (ret != 0) pr_warn("%s: panel_next_on failed", __func__); atomic_set(&vctrl->suspend, 0); mutex_unlock(&mfd->dma->ov_mutex); pr_info("%s:\n", __func__); return ret; }
int mdp4_dtv_on(struct platform_device *pdev) { struct msm_fb_data_type *mfd; int ret = 0; int cndx = 0; struct vsycn_ctrl *vctrl; vctrl = &vsync_ctrl_db[cndx]; mfd = (struct msm_fb_data_type *)platform_get_drvdata(pdev); if (!mfd) return -ENODEV; if (mfd->key != MFD_KEY) return -EINVAL; vctrl->dev = mfd->fbi->dev; #if defined(CONFIG_VIDEO_MHL_V1) || defined(CONFIG_VIDEO_MHL_V2) || \ defined(CONFIG_VIDEO_MHL_TAB_V2) if (!hdmi_msm_state->hpd_on_offline) { pr_info("hdmi_online is not\n"); return -ENODEV; } #endif mdp_footswitch_ctrl(TRUE); /* Mdp clock enable */ mdp_clk_ctrl(1); mdp4_overlay_panel_mode(MDP4_MIXER1, MDP4_PANEL_DTV); /* Allocate dtv_pipe at dtv_on*/ if (vctrl->base_pipe == NULL) { if (mdp4_overlay_dtv_set(mfd, NULL)) { pr_warn("%s: dtv_pipe is NULL, dtv_set failed\n", __func__); return -EINVAL; } } ret = panel_next_on(pdev); if (ret != 0) pr_warn("%s: panel_next_on failed", __func__); atomic_set(&vctrl->suspend, 0); pr_info("%s:\n", __func__); return ret; }
int mdp4_dtv_off(struct platform_device *pdev) { struct msm_fb_data_type *mfd; int ret = 0; mfd = (struct msm_fb_data_type *)platform_get_drvdata(pdev); if (dtv_pipe != NULL) { mdp4_dtv_stop(mfd); mdp4_mixer_stage_down(dtv_pipe); mdp4_overlay_pipe_free(dtv_pipe); mdp4_iommu_unmap(dtv_pipe); dtv_pipe = NULL; msleep(20); } mdp4_overlay_panel_mode_unset(MDP4_MIXER1, MDP4_PANEL_DTV); ret = panel_next_off(pdev); mdp_footswitch_ctrl(FALSE); dev_info(&pdev->dev, "mdp4_overlay_dtv: off"); return ret; }
int mdp4_dtv_off(struct platform_device *pdev) { struct msm_fb_data_type *mfd; int ret = 0; int cndx = 0; int undx; struct vsycn_ctrl *vctrl; struct mdp4_overlay_pipe *pipe; struct vsync_update *vp; int mixer = 0; mfd = (struct msm_fb_data_type *)platform_get_drvdata(pdev); mutex_lock(&mfd->dma->ov_mutex); vctrl = &vsync_ctrl_db[cndx]; mdp4_dtv_wait4vsync(cndx); mdp4_unmap_sec_resource(mfd); wake_up_interruptible_all(&vctrl->wait_queue); pipe = vctrl->base_pipe; if (pipe != NULL) { mixer = pipe->mixer_num; /* sanity check, free pipes besides base layer */ mdp4_overlay_unset_mixer(mixer); if (hdmi_prim_display && mfd->ref_cnt == 0) { /* adb stop */ if (pipe->pipe_type == OVERLAY_TYPE_BF) mdp4_overlay_borderfill_stage_down(pipe); /* pipe == rgb2 */ vctrl->base_pipe = NULL; } else { mdp4_mixer_stage_down(pipe, 1); mdp4_overlay_pipe_free(pipe, 1); vctrl->base_pipe = NULL; } } mdp4_dtv_tg_off(vctrl); atomic_set(&vctrl->suspend, 1); mdp4_overlay_panel_mode_unset(MDP4_MIXER1, MDP4_PANEL_DTV); undx = vctrl->update_ndx; vp = &vctrl->vlist[undx]; if (vp->update_cnt) { /* * pipe's iommu will be freed at next overlay play * and iommu_drop statistic will be increased by one */ pr_warn("%s: update_cnt=%d\n", __func__, vp->update_cnt); mdp4_dtv_pipe_clean(vp); } ret = panel_next_off(pdev); mdp_footswitch_ctrl(FALSE); /* * clean up ion freelist * there need two stage to empty ion free list * therefore need call unmap freelist twice */ mdp4_overlay_iommu_unmap_freelist(mixer); mdp4_overlay_iommu_unmap_freelist(mixer); /* Mdp clock disable */ mdp_clk_ctrl(0); mutex_unlock(&mfd->dma->ov_mutex); pr_info("%s:\n", __func__); return ret; }
int mdp4_dtv_off(struct platform_device *pdev) { struct msm_fb_data_type *mfd; int ret = 0; int cndx = 0; int undx; struct vsycn_ctrl *vctrl; struct mdp4_overlay_pipe *pipe; struct vsync_update *vp; mfd = (struct msm_fb_data_type *)platform_get_drvdata(pdev); vctrl = &vsync_ctrl_db[cndx]; atomic_set(&vctrl->suspend, 1); atomic_set(&vctrl->vsync_resume, 0); //QCT_PATCH_S /* wait for one vsycn time to make sure * previous stage_commit had been kicked in */ msleep(20); /* >= 17 ms */ //QCT_PATCH_E if (vctrl->wait_vsync_cnt) { complete_all(&vctrl->vsync_comp); vctrl->wait_vsync_cnt = 0; } pipe = vctrl->base_pipe; if (pipe != NULL) { mdp4_dtv_stop(mfd); /* sanity check, free pipes besides base layer */ mdp4_overlay_unset_mixer(pipe->mixer_num); if (hdmi_prim_display && mfd->ref_cnt == 0) { /* adb stop */ if (pipe->pipe_type == OVERLAY_TYPE_BF) mdp4_overlay_borderfill_stage_down(pipe); /* base pipe may change after borderfill_stage_down */ pipe = vctrl->base_pipe; mdp4_mixer_stage_down(pipe, 1); mdp4_overlay_pipe_free(pipe, 1); /* pipe == rgb2 */ vctrl->base_pipe = NULL; } else { mdp4_mixer_stage_down(pipe, 1); mdp4_overlay_pipe_free(pipe, 1); vctrl->base_pipe = NULL; } } mdp4_overlay_panel_mode_unset(MDP4_MIXER1, MDP4_PANEL_DTV); undx = vctrl->update_ndx; vp = &vctrl->vlist[undx]; if (vp->update_cnt) { /* * pipe's iommu will be freed at next overlay play * and iommu_drop statistic will be increased by one */ vp->update_cnt = 0; /* empty queue */ } ret = panel_next_off(pdev); mdp_footswitch_ctrl(FALSE); /* Mdp clock disable */ mdp_clk_ctrl(0); pr_info("%s:\n", __func__); return ret; }
int mdp4_dtv_off(struct platform_device *pdev) { struct msm_fb_data_type *mfd; int ret = 0; int cndx = 0; int undx; struct vsycn_ctrl *vctrl; struct mdp4_overlay_pipe *pipe; struct vsync_update *vp; #if defined(CONFIG_VIDEO_MHL_V1) || defined(CONFIG_VIDEO_MHL_V2) || \ defined(CONFIG_VIDEO_MHL_TAB_V2) if (hdmi_msm_state->hpd_on_offline) { pr_info("hpd_offline is not\n"); return -ENODEV; } #endif mfd = (struct msm_fb_data_type *)platform_get_drvdata(pdev); vctrl = &vsync_ctrl_db[cndx]; atomic_set(&vctrl->suspend, 1); atomic_set(&vctrl->vsync_resume, 0); if (vctrl->vsync_irq_enabled) { while (vctrl->wait_vsync_cnt) msleep(20); /* >= 17 ms */ } complete_all(&vctrl->vsync_comp); pipe = vctrl->base_pipe; if (pipe != NULL) { mdp4_dtv_stop(mfd); /* sanity check, free pipes besides base layer */ mdp4_overlay_unset_mixer(pipe->mixer_num); if (hdmi_prim_display && mfd->ref_cnt == 0) { /* adb stop */ if (pipe->pipe_type == OVERLAY_TYPE_BF) mdp4_overlay_borderfill_stage_down(pipe); /* base pipe may change after borderfill_stage_down */ pipe = vctrl->base_pipe; mdp4_mixer_stage_down(pipe, 1); mdp4_overlay_pipe_free(pipe); /* pipe == rgb2 */ vctrl->base_pipe = NULL; } else { mdp4_mixer_stage_down(pipe, 1); mdp4_overlay_pipe_free(pipe); vctrl->base_pipe = NULL; } } mdp4_overlay_panel_mode_unset(MDP4_MIXER1, MDP4_PANEL_DTV); undx = vctrl->update_ndx; vp = &vctrl->vlist[undx]; if (vp->update_cnt) { /* * pipe's iommu will be freed at next overlay play * and iommu_drop statistic will be increased by one */ vp->update_cnt = 0; /* empty queue */ } undx = vctrl->update_ndx; vp = &vctrl->vlist[undx]; if (vp->update_cnt) { /* * pipe's iommu will be freed at next overlay play * and iommu_drop statistic will be increased by one */ vp->update_cnt = 0; /* empty queue */ } ret = panel_next_off(pdev); mdp_footswitch_ctrl(FALSE); /* Mdp clock disable */ mdp_clk_ctrl(0); pr_info("%s:\n", __func__); return ret; }
int mdp4_dtv_off(struct platform_device *pdev) { struct msm_fb_data_type *mfd; int ret = 0; int cndx = 0; int undx; struct vsycn_ctrl *vctrl; struct mdp4_overlay_pipe *pipe; struct vsync_update *vp; int mixer = 0; mfd = (struct msm_fb_data_type *)platform_get_drvdata(pdev); mutex_lock(&mfd->dma->ov_mutex); vctrl = &vsync_ctrl_db[cndx]; mdp4_dtv_wait4vsync(cndx); atomic_set(&vctrl->vsync_resume, 0); complete_all(&vctrl->vsync_comp); vctrl->wait_vsync_cnt = 0; pipe = vctrl->base_pipe; if (pipe != NULL) { mixer = pipe->mixer_num; mdp4_overlay_unset_mixer(mixer); if (hdmi_prim_display && mfd->ref_cnt == 0) { if (pipe->pipe_type == OVERLAY_TYPE_BF) mdp4_overlay_borderfill_stage_down(pipe); vctrl->base_pipe = NULL; } else { mdp4_mixer_stage_down(pipe, 1); mdp4_overlay_pipe_free(pipe, 1); vctrl->base_pipe = NULL; } } mdp4_dtv_tg_off(vctrl); atomic_set(&vctrl->suspend, 1); mdp4_overlay_panel_mode_unset(MDP4_MIXER1, MDP4_PANEL_DTV); undx = vctrl->update_ndx; vp = &vctrl->vlist[undx]; if (vp->update_cnt) { pr_warn("%s: update_cnt=%d\n", __func__, vp->update_cnt); mdp4_dtv_pipe_clean(vp); } ret = panel_next_off(pdev); #if 0 mdp_footswitch_ctrl(FALSE); #endif mdp4_overlay_iommu_unmap_freelist(mixer); mdp4_overlay_iommu_unmap_freelist(mixer); mdp_clk_ctrl(0); mutex_unlock(&mfd->dma->ov_mutex); pr_info("%s:\n", __func__); return ret; }