diff --git a/drivers/video/msm/mdp.c b/drivers/video/msm/mdp.c index 66820e4b6391..1eb15411f561 100644 --- a/drivers/video/msm/mdp.c +++ b/drivers/video/msm/mdp.c @@ -2462,7 +2462,6 @@ static int mdp_probe(struct platform_device *pdev) /* link to the latest pdev */ mfd->pdev = msm_fb_dev; mfd->mdp_rev = mdp_rev; - mfd->vsync_init = NULL; if (mdp_pdata) { if (mdp_pdata->cont_splash_enabled) { @@ -2591,7 +2590,7 @@ static int mdp_probe(struct platform_device *pdev) case MIPI_VIDEO_PANEL: #ifndef CONFIG_FB_MSM_MDP303 mipi = &mfd->panel_info.mipi; - mfd->vsync_init = mdp4_dsi_vsync_init; + mdp4_dsi_vsync_init(0); mfd->hw_refresh = TRUE; mfd->dma_fnc = mdp4_dsi_video_overlay; mfd->lut_update = mdp_lut_update_lcdc; @@ -2635,7 +2634,7 @@ static int mdp_probe(struct platform_device *pdev) #ifndef CONFIG_FB_MSM_MDP303 mfd->dma_fnc = mdp4_dsi_cmd_overlay; mipi = &mfd->panel_info.mipi; - mfd->vsync_init = mdp4_dsi_rdptr_init; + mdp4_dsi_rdptr_init(0); if (mfd->panel_info.pdest == DISPLAY_1) { if_no = PRIMARY_INTF_SEL; mfd->dma = &dma2_data; @@ -2671,7 +2670,7 @@ static int mdp_probe(struct platform_device *pdev) #ifdef CONFIG_FB_MSM_DTV case DTV_PANEL: - mfd->vsync_init = mdp4_dtv_vsync_init; + mdp4_dtv_vsync_init(0); pdata->on = mdp4_dtv_on; pdata->off = mdp4_dtv_off; mfd->hw_refresh = TRUE; @@ -2710,7 +2709,7 @@ static int mdp_probe(struct platform_device *pdev) #endif #ifdef CONFIG_FB_MSM_MDP40 - mfd->vsync_init = mdp4_lcdc_vsync_init; + mdp4_lcdc_vsync_init(0); if (mfd->panel.type == HDMI_PANEL) { mfd->dma = &dma_e_data; mdp4_display_intf_sel(EXTERNAL_INTF_SEL, LCDC_RGB_INTF); @@ -2816,8 +2815,6 @@ static int mdp_probe(struct platform_device *pdev) pdev_list[pdev_list_cnt++] = pdev; mdp4_extn_disp = 0; - if (mfd->vsync_init != NULL) - mfd->vsync_init(0, mfd); return 0; mdp_probe_err: diff --git a/drivers/video/msm/mdp4.h b/drivers/video/msm/mdp4.h index 7c92b53bb1b5..fc6c6bb3b852 100644 --- a/drivers/video/msm/mdp4.h +++ b/drivers/video/msm/mdp4.h @@ -573,10 +573,10 @@ int mdp4_dsi_cmd_pipe_commit(int cndx, int wait); int mdp4_lcdc_pipe_commit(int cndx, int wait); int mdp4_dtv_pipe_commit(int cndx, int wait); int mdp4_dsi_cmd_update_cnt(int cndx); -void mdp4_dsi_rdptr_init(int cndx, struct msm_fb_data_type *mfd); -void mdp4_dsi_vsync_init(int cndx, struct msm_fb_data_type *mfd); -void mdp4_lcdc_vsync_init(int cndx, struct msm_fb_data_type *mfd); -void mdp4_dtv_vsync_init(int cndx, struct msm_fb_data_type *mfd); +void mdp4_dsi_rdptr_init(int cndx); +void mdp4_dsi_vsync_init(int cndx); +void mdp4_lcdc_vsync_init(int cndx); +void mdp4_dtv_vsync_init(int cndx); void mdp4_overlay_dsi_state_set(int state); int mdp4_overlay_dsi_state_get(void); void mdp4_overlay_rgb_setup(struct mdp4_overlay_pipe *pipe); diff --git a/drivers/video/msm/mdp4_overlay_dsi_cmd.c b/drivers/video/msm/mdp4_overlay_dsi_cmd.c index f4d3ec0df061..e24000255b43 100644 --- a/drivers/video/msm/mdp4_overlay_dsi_cmd.c +++ b/drivers/video/msm/mdp4_overlay_dsi_cmd.c @@ -685,19 +685,9 @@ static ssize_t vsync_show_event(struct device *dev, return ret; } -static DEVICE_ATTR(vsync_event, S_IRUGO, vsync_show_event, NULL); -static struct attribute *vsync_fs_attrs[] = { - &dev_attr_vsync_event.attr, - NULL, -}; -static struct attribute_group vsync_fs_attr_group = { - .attrs = vsync_fs_attrs, -}; - -void mdp4_dsi_rdptr_init(int cndx, struct msm_fb_data_type *mfd) +void mdp4_dsi_rdptr_init(int cndx) { struct vsycn_ctrl *vctrl; - int ret; if (cndx >= MAX_CONTROLLER) { pr_err("%s: out or range: cndx=%d\n", __func__, cndx); @@ -708,8 +698,6 @@ void mdp4_dsi_rdptr_init(int cndx, struct msm_fb_data_type *mfd) if (vctrl->inited) return; - vctrl->mfd = mfd; - vctrl->dev = mfd->fbi->dev; vctrl->inited = 1; vctrl->update_ndx = 0; mutex_init(&vctrl->update_lock); @@ -717,22 +705,8 @@ void mdp4_dsi_rdptr_init(int cndx, struct msm_fb_data_type *mfd) init_completion(&vctrl->dmap_comp); init_completion(&vctrl->vsync_comp); spin_lock_init(&vctrl->spin_lock); - atomic_set(&vctrl->suspend, 1); + atomic_set(&vctrl->vsync_resume, 1); INIT_WORK(&vctrl->clk_work, clk_ctrl_work); - 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; - } - - kobject_uevent(&vctrl->dev->kobj, KOBJ_ADD); - pr_debug("%s: kobject_uevent(KOBJ_ADD)\n", __func__); - vctrl->sysfs_created = 1; - } - } void mdp4_primary_rdptr(void) @@ -1000,6 +974,14 @@ void mdp4_dsi_cmd_overlay_blt(struct msm_fb_data_type *mfd, mdp4_dsi_cmd_do_blt(mfd, req->enable); } +static DEVICE_ATTR(vsync_event, S_IRUGO, vsync_show_event, NULL); +static struct attribute *vsync_fs_attrs[] = { + &dev_attr_vsync_event.attr, + NULL, +}; +static struct attribute_group vsync_fs_attr_group = { + .attrs = vsync_fs_attrs, +}; int mdp4_dsi_cmd_on(struct platform_device *pdev) { int ret = 0; @@ -1040,6 +1022,20 @@ int mdp4_dsi_cmd_on(struct platform_device *pdev) pr_debug("%s-:\n", __func__); + 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; + } + return ret; } diff --git a/drivers/video/msm/mdp4_overlay_dsi_video.c b/drivers/video/msm/mdp4_overlay_dsi_video.c index 4371bfe5cddf..8ee5152deb2f 100644 --- a/drivers/video/msm/mdp4_overlay_dsi_video.c +++ b/drivers/video/msm/mdp4_overlay_dsi_video.c @@ -411,20 +411,9 @@ static ssize_t vsync_show_event(struct device *dev, return ret; } -static DEVICE_ATTR(vsync_event, S_IRUGO, vsync_show_event, NULL); - -static struct attribute *vsync_fs_attrs[] = { - &dev_attr_vsync_event.attr, - NULL, -}; -static struct attribute_group vsync_fs_attr_group = { - .attrs = vsync_fs_attrs, -}; - -void mdp4_dsi_vsync_init(int cndx, struct msm_fb_data_type *mfd) +void mdp4_dsi_vsync_init(int cndx) { struct vsycn_ctrl *vctrl; - int ret; if (cndx >= MAX_CONTROLLER) { pr_err("%s: out or range: cndx=%d\n", __func__, cndx); @@ -437,31 +426,15 @@ void mdp4_dsi_vsync_init(int cndx, struct msm_fb_data_type *mfd) if (vctrl->inited) return; - vctrl->mfd = mfd; - vctrl->dev = mfd->fbi->dev; vctrl->inited = 1; vctrl->update_ndx = 0; mutex_init(&vctrl->update_lock); init_completion(&vctrl->vsync_comp); init_completion(&vctrl->dmap_comp); init_completion(&vctrl->ov_comp); - atomic_set(&vctrl->suspend, 1); + atomic_set(&vctrl->suspend, 0); atomic_set(&vctrl->vsync_resume, 1); spin_lock_init(&vctrl->spin_lock); - - 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; - } - - kobject_uevent(&vctrl->dev->kobj, KOBJ_ADD); - pr_debug("%s: kobject_uevent(KOBJ_ADD)\n", __func__); - vctrl->sysfs_created = 1; - } } void mdp4_dsi_video_base_swap(int cndx, struct mdp4_overlay_pipe *pipe) @@ -477,6 +450,16 @@ void mdp4_dsi_video_base_swap(int cndx, struct mdp4_overlay_pipe *pipe) vctrl->base_pipe = pipe; } +static DEVICE_ATTR(vsync_event, S_IRUGO, vsync_show_event, NULL); + +static struct attribute *vsync_fs_attrs[] = { + &dev_attr_vsync_event.attr, + NULL, +}; + +static struct attribute_group vsync_fs_attr_group = { + .attrs = vsync_fs_attrs, +}; int mdp4_dsi_video_on(struct platform_device *pdev) { int dsi_width; @@ -694,6 +677,20 @@ int mdp4_dsi_video_on(struct platform_device *pdev) mdp_histogram_ctrl_all(TRUE); mdp4_overlay_dsi_video_start(); + 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; + } + return ret; } diff --git a/drivers/video/msm/mdp4_overlay_dtv.c b/drivers/video/msm/mdp4_overlay_dtv.c index 9e718c6791a3..3f061e918f27 100644 --- a/drivers/video/msm/mdp4_overlay_dtv.c +++ b/drivers/video/msm/mdp4_overlay_dtv.c @@ -353,20 +353,9 @@ static ssize_t vsync_show_event(struct device *dev, buf[strlen(buf) + 1] = '\0'; return ret; } - -static DEVICE_ATTR(vsync_event, S_IRUGO, vsync_show_event, NULL); -static struct attribute *vsync_fs_attrs[] = { - &dev_attr_vsync_event.attr, - NULL, -}; -static struct attribute_group vsync_fs_attr_group = { - .attrs = vsync_fs_attrs, -}; - -void mdp4_dtv_vsync_init(int cndx, struct msm_fb_data_type *mfd) +void mdp4_dtv_vsync_init(int cndx) { struct vsycn_ctrl *vctrl; - int ret; if (cndx >= MAX_CONTROLLER) { pr_err("%s: out or range: cndx=%d\n", __func__, cndx); @@ -379,29 +368,15 @@ void mdp4_dtv_vsync_init(int cndx, struct msm_fb_data_type *mfd) if (vctrl->inited) return; - vctrl->dev = mfd->fbi->dev; vctrl->inited = 1; vctrl->update_ndx = 0; mutex_init(&vctrl->update_lock); init_completion(&vctrl->vsync_comp); init_completion(&vctrl->ov_comp); init_completion(&vctrl->dmae_comp); - atomic_set(&vctrl->suspend, 1); + atomic_set(&vctrl->suspend, 0); atomic_set(&vctrl->vsync_resume, 1); spin_lock_init(&vctrl->spin_lock); - 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; - } - - kobject_uevent(&vctrl->dev->kobj, KOBJ_ADD); - pr_debug("%s: kobject_uevent(KOBJ_ADD)\n", __func__); - vctrl->sysfs_created = 1; - } } static int mdp4_dtv_start(struct msm_fb_data_type *mfd) @@ -562,6 +537,15 @@ static int mdp4_dtv_stop(struct msm_fb_data_type *mfd) return 0; } +static DEVICE_ATTR(vsync_event, S_IRUGO, vsync_show_event, NULL); +static struct attribute *vsync_fs_attrs[] = { + &dev_attr_vsync_event.attr, + NULL, +}; +static struct attribute_group vsync_fs_attr_group = { + .attrs = vsync_fs_attrs, +}; + int mdp4_dtv_on(struct platform_device *pdev) { struct msm_fb_data_type *mfd; @@ -602,6 +586,19 @@ int mdp4_dtv_on(struct platform_device *pdev) 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; diff --git a/drivers/video/msm/mdp4_overlay_lcdc.c b/drivers/video/msm/mdp4_overlay_lcdc.c index 6b4299024c5b..ccd107b7861d 100644 --- a/drivers/video/msm/mdp4_overlay_lcdc.c +++ b/drivers/video/msm/mdp4_overlay_lcdc.c @@ -396,19 +396,9 @@ static ssize_t vsync_show_event(struct device *dev, return ret; } -static DEVICE_ATTR(vsync_event, S_IRUGO, vsync_show_event, NULL); -static struct attribute *vsync_fs_attrs[] = { - &dev_attr_vsync_event.attr, - NULL, -}; -static struct attribute_group vsync_fs_attr_group = { - .attrs = vsync_fs_attrs, -}; - -void mdp4_lcdc_vsync_init(int cndx, struct msm_fb_data_type *mfd) +void mdp4_lcdc_vsync_init(int cndx) { struct vsycn_ctrl *vctrl; - int ret; if (cndx >= MAX_CONTROLLER) { pr_err("%s: out or range: cndx=%d\n", __func__, cndx); @@ -421,30 +411,15 @@ void mdp4_lcdc_vsync_init(int cndx, struct msm_fb_data_type *mfd) if (vctrl->inited) return; - vctrl->mfd = mfd; - vctrl->dev = mfd->fbi->dev; vctrl->inited = 1; vctrl->update_ndx = 0; mutex_init(&vctrl->update_lock); init_completion(&vctrl->vsync_comp); init_completion(&vctrl->dmap_comp); init_completion(&vctrl->ov_comp); - atomic_set(&vctrl->suspend, 1); + atomic_set(&vctrl->suspend, 0); atomic_set(&vctrl->vsync_resume, 1); spin_lock_init(&vctrl->spin_lock); - 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; - } - - kobject_uevent(&vctrl->dev->kobj, KOBJ_ADD); - pr_debug("%s: kobject_uevent(KOBJ_ADD)\n", __func__); - vctrl->sysfs_created = 1; - } } void mdp4_lcdc_base_swap(int cndx, struct mdp4_overlay_pipe *pipe) @@ -460,6 +435,15 @@ void mdp4_lcdc_base_swap(int cndx, struct mdp4_overlay_pipe *pipe) vctrl->base_pipe = pipe; } +static DEVICE_ATTR(vsync_event, S_IRUGO, vsync_show_event, NULL); +static struct attribute *vsync_fs_attrs[] = { + &dev_attr_vsync_event.attr, + NULL, +}; +static struct attribute_group vsync_fs_attr_group = { + .attrs = vsync_fs_attrs, +}; + int mdp4_lcdc_on(struct platform_device *pdev) { int lcdc_width; @@ -674,6 +658,20 @@ int mdp4_lcdc_on(struct platform_device *pdev) mdp_histogram_ctrl_all(TRUE); + 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; + } + return ret; } diff --git a/drivers/video/msm/msm_fb.h b/drivers/video/msm/msm_fb.h index b8c732150e40..b9641b2f0c8c 100644 --- a/drivers/video/msm/msm_fb.h +++ b/drivers/video/msm/msm_fb.h @@ -137,7 +137,6 @@ struct msm_fb_data_type { int (*start_histogram) (struct mdp_histogram_start_req *req); int (*stop_histogram) (struct fb_info *info, uint32_t block); void (*vsync_ctrl) (int enable); - void (*vsync_init) (int cndx, struct msm_fb_data_type *mfd); void *cursor_buf; void *cursor_buf_phys;