Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'topic-arcpgu-updates' of https://github.com/foss-for-synopsys-dwc-arc-processors/linux into drm-next

arcgpu minor updates.

* 'topic-arcpgu-updates' of https://github.com/foss-for-synopsys-dwc-arc-processors/linux:
drm: arcpgu: Allow some clock deviation in crtc->mode_valid() callback
drm: arcpgu: Fix module unload
drm: arcpgu: Fix mmap() callback
arcpgu: Simplify driver name
drm/arcpgu: Opt in debugfs

+36 -28
+4 -3
drivers/gpu/drm/arc/arcpgu_crtc.c
··· 69 69 { 70 70 struct arcpgu_drm_private *arcpgu = crtc_to_arcpgu_priv(crtc); 71 71 long rate, clk_rate = mode->clock * 1000; 72 + long diff = clk_rate / 200; /* +-0.5% allowed by HDMI spec */ 72 73 73 74 rate = clk_round_rate(arcpgu->clk, clk_rate); 74 - if (rate != clk_rate) 75 - return MODE_NOCLOCK; 75 + if ((max(rate, clk_rate) - min(rate, clk_rate) < diff) && (rate > 0)) 76 + return MODE_OK; 76 77 77 - return MODE_OK; 78 + return MODE_NOCLOCK; 78 79 } 79 80 80 81 static void arc_pgu_crtc_mode_set_nofb(struct drm_crtc *crtc)
+32 -25
drivers/gpu/drm/arc/arcpgu_drv.c
··· 48 48 drm->mode_config.funcs = &arcpgu_drm_modecfg_funcs; 49 49 } 50 50 51 - static int arcpgu_gem_mmap(struct file *filp, struct vm_area_struct *vma) 52 - { 53 - int ret; 54 - 55 - ret = drm_gem_mmap(filp, vma); 56 - if (ret) 57 - return ret; 58 - 59 - vma->vm_page_prot = pgprot_noncached(vm_get_page_prot(vma->vm_flags)); 60 - return 0; 61 - } 62 - 63 - static const struct file_operations arcpgu_drm_ops = { 64 - .owner = THIS_MODULE, 65 - .open = drm_open, 66 - .release = drm_release, 67 - .unlocked_ioctl = drm_ioctl, 68 - .compat_ioctl = drm_compat_ioctl, 69 - .poll = drm_poll, 70 - .read = drm_read, 71 - .llseek = no_llseek, 72 - .mmap = arcpgu_gem_mmap, 73 - }; 51 + DEFINE_DRM_GEM_CMA_FOPS(arcpgu_drm_ops); 74 52 75 53 static void arcpgu_lastclose(struct drm_device *drm) 76 54 { ··· 120 142 return -ENODEV; 121 143 } 122 144 123 - platform_set_drvdata(pdev, arcpgu); 145 + platform_set_drvdata(pdev, drm); 124 146 return 0; 125 147 } 126 148 ··· 138 160 return 0; 139 161 } 140 162 163 + #ifdef CONFIG_DEBUG_FS 164 + static int arcpgu_show_pxlclock(struct seq_file *m, void *arg) 165 + { 166 + struct drm_info_node *node = (struct drm_info_node *)m->private; 167 + struct drm_device *drm = node->minor->dev; 168 + struct arcpgu_drm_private *arcpgu = drm->dev_private; 169 + unsigned long clkrate = clk_get_rate(arcpgu->clk); 170 + unsigned long mode_clock = arcpgu->crtc.mode.crtc_clock * 1000; 171 + 172 + seq_printf(m, "hw : %lu\n", clkrate); 173 + seq_printf(m, "mode: %lu\n", mode_clock); 174 + return 0; 175 + } 176 + 177 + static struct drm_info_list arcpgu_debugfs_list[] = { 178 + { "clocks", arcpgu_show_pxlclock, 0 }, 179 + { "fb", drm_fb_cma_debugfs_show, 0 }, 180 + }; 181 + 182 + static int arcpgu_debugfs_init(struct drm_minor *minor) 183 + { 184 + return drm_debugfs_create_files(arcpgu_debugfs_list, 185 + ARRAY_SIZE(arcpgu_debugfs_list), minor->debugfs_root, minor); 186 + } 187 + #endif 188 + 141 189 static struct drm_driver arcpgu_drm_driver = { 142 190 .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME | 143 191 DRIVER_ATOMIC, 144 192 .lastclose = arcpgu_lastclose, 145 - .name = "drm-arcpgu", 193 + .name = "arcpgu", 146 194 .desc = "ARC PGU Controller", 147 195 .date = "20160219", 148 196 .major = 1, ··· 189 185 .gem_prime_vmap = drm_gem_cma_prime_vmap, 190 186 .gem_prime_vunmap = drm_gem_cma_prime_vunmap, 191 187 .gem_prime_mmap = drm_gem_cma_prime_mmap, 188 + #ifdef CONFIG_DEBUG_FS 189 + .debugfs_init = arcpgu_debugfs_init, 190 + #endif 192 191 }; 193 192 194 193 static int arcpgu_probe(struct platform_device *pdev)