arcpgu: Fixes and improvements
Subsystems (2)
cover arcpgu: Fixes and improvements
Hi all,
Two fixes and an improvement for arcpgu. I've sent this patches in separate but I've now collected them all to ease the review.
Best regards,
Jose Miguel Abreu
Jose Abreu (3):
drm: arcpgu: Fix mmap() callback
drm: arcpgu: Fix module unload
drm: arcpgu: Allow some clock deviation in crtc->mode_valid() callback
drivers/gpu/drm/arc/arcpgu_crtc.c | 7 ++++--- drivers/gpu/drm/arc/arcpgu_drv.c | 26 ++------------------------ 2 files changed, 6 insertions(+), 27 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/3 drm: arcpgu: Fix mmap() callback
Now that ARC properly supports DMA mmap() we can use the standard CMA helper to map dumb buffers. This makes ARC PGU works with standard DRM consumer applications like, for example, mpv/mplayer via DRM. While at it, use the DEFINE_DRM_GEM_CMA_FOPS() helper.
This fixes the use of dumb buffers.
--- drivers/gpu/drm/arc/arcpgu_drv.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-)
drivers/gpu/drm/arc/arcpgu_drv.c +1 -23
@@ -48,29 +48,7 @@ static void arcpgu_setup_mode_config(struct drm_device *drm) drm->mode_config.funcs = &arcpgu_drm_modecfg_funcs; } -static int arcpgu_gem_mmap (struct file *filp,struct vm_area_struct *vma) -{ -int ret; - - ret =drm_gem_mmap (filp, vma); -if (ret) -return ret; - - vma->vm_page_prot =pgprot_noncached (vm_get_page_prot (vma->vm_flags)); -return 0 ; -} - -static const struct file_operations arcpgu_drm_ops = { - .owner =THIS_MODULE , - .open = drm_open, - .release = drm_release, - .unlocked_ioctl = drm_ioctl, - .compat_ioctl = drm_compat_ioctl, - .poll = drm_poll, - .read = drm_read, - .llseek = no_llseek, - .mmap = arcpgu_gem_mmap, -}; +DEFINE_DRM_GEM_CMA_FOPS (arcpgu_drm_ops);static void arcpgu_lastclose (struct drm_device *drm) {
Signature · 1 line
1.9.1
PATCH 2/3 drm: arcpgu: Fix module unload
In reply to Jose AbreuAt module unload we are expecting a struct drm_device but at probing we are not setting it right. Fix this and correct the arcpgu module unload.
--- drivers/gpu/drm/arc/arcpgu_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/arc/arcpgu_drv.c +1 -1
@@ -120,7 +120,7 @@ static int arcpgu_load(struct drm_device *drm)return -ENODEV ; } -platform_set_drvdata (pdev, arcpgu); +platform_set_drvdata (pdev, drm);return 0 ; }
Signature · 1 line
1.9.1
PATCH 3/3 drm: arcpgu: Allow some clock deviation in crtc->mode_valid() callback
In reply to Jose AbreuCurrently we expect that clock driver produces the exact same value as we are requiring. There can, and will, be some deviation however so we need to take that into account instead of just rejecting the mode.
According to the HDMI spec we have a max of +-0.5% for the pixel clock frequency deviation. Lets take that into an advantage and use it to calculate how much deviation we can support.
--- drivers/gpu/drm/arc/arcpgu_crtc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/arc/arcpgu_crtc.c +4 -3
@@ -69,12 +69,13 @@ static enum drm_mode_status arc_pgu_crtc_mode_valid(struct drm_crtc *crtc, {struct arcpgu_drm_private *arcpgu =crtc_to_arcpgu_priv (crtc);long rate, clk_rate = mode->clock *1000 ; +long diff = clk_rate /200 ;/* +-0.5% allowed by HDMI spec */ rate =clk_round_rate (arcpgu->clk, clk_rate); -if (rate != clk_rate) -return MODE_NOCLOCK ; +if ((max (rate, clk_rate) -min (rate, clk_rate) < diff) && (rate >0 )) +return MODE_OK ; -return MODE_OK ; +return MODE_NOCLOCK ; }static void arc_pgu_crtc_mode_set_nofb (struct drm_crtc *crtc)
Signature · 1 line
1.9.1