From: Huang Jiachai Date: Tue, 23 Aug 2016 03:11:46 +0000 (+0800) Subject: video: rockchip: fb: add function for vop pwm config done X-Git-Tag: firefly_0821_release~1684 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f4f1e0ae856fe60a7d662b5a36c871ea41c3cf19;p=firefly-linux-kernel-4.4.55.git video: rockchip: fb: add function for vop pwm config done Change-Id: I80350293c644fc0db1f613b3de14e34b7f3bc0f2 Signed-off-by: Huang Jiachai --- diff --git a/drivers/video/rockchip/rk_fb.c b/drivers/video/rockchip/rk_fb.c index a66afcbec547..e047ea223047 100644 --- a/drivers/video/rockchip/rk_fb.c +++ b/drivers/video/rockchip/rk_fb.c @@ -644,6 +644,34 @@ char *get_format_string(enum data_format format, char *fmt) return fmt; } +int rk_fb_set_vop_pwm(void) +{ + int i = 0; + struct rk_fb *inf = NULL; + struct rk_lcdc_driver *dev_drv = NULL; + + if (likely(fb_pdev)) + inf = platform_get_drvdata(fb_pdev); + else + return -1; + + for (i = 0; i < inf->num_lcdc; i++) { + if (inf->lcdc_dev_drv[i]->cabc_mode == 1) { + dev_drv = inf->lcdc_dev_drv[i]; + break; + } + } + + if (!dev_drv) + return -1; + + mutex_lock(&dev_drv->win_config); + dev_drv->ops->cfg_done(dev_drv); + mutex_unlock(&dev_drv->win_config); + + return 0; +} + /* * this is for hdmi * name: lcdc device name ,lcdc0 , lcdc1 @@ -1899,16 +1927,15 @@ static void rk_fb_update_reg(struct rk_lcdc_driver *dev_drv, } } + mutex_lock(&dev_drv->win_config); for (i = 0; i < dev_drv->lcdc_win_num; i++) { win = dev_drv->win[i]; win_data = rk_fb_get_win_data(regs, i); if (win_data) { - mutex_lock(&dev_drv->win_config); rk_fb_update_win(dev_drv, win, win_data); win->state = 1; dev_drv->ops->set_par(dev_drv, i); dev_drv->ops->pan_display(dev_drv, i); - mutex_unlock(&dev_drv->win_config); } else { win->z_order = -1; win->state = 0; @@ -1940,6 +1967,7 @@ static void rk_fb_update_reg(struct rk_lcdc_driver *dev_drv, dev_drv->ops->cfg_done(dev_drv); else sw_sync_timeline_inc(dev_drv->timeline, 1); + mutex_unlock(&dev_drv->win_config); do { timestamp = dev_drv->vsync_info.timestamp; diff --git a/include/linux/rk_fb.h b/include/linux/rk_fb.h index 60952abc9165..302330efb29a 100755 --- a/include/linux/rk_fb.h +++ b/include/linux/rk_fb.h @@ -800,6 +800,7 @@ extern int rk_fb_register(struct rk_lcdc_driver *dev_drv, extern int rk_fb_unregister(struct rk_lcdc_driver *dev_drv); extern struct rk_lcdc_driver *rk_get_lcdc_drv(char *name); extern int rk_fb_get_extern_screen(struct rk_screen *screen); +extern int rk_fb_set_vop_pwm(void); extern int rk_fb_get_prmry_screen( struct rk_screen *screen); extern int rk_fb_set_prmry_screen(struct rk_screen *screen); extern u32 rk_fb_get_prmry_screen_pixclock(void);