Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 Red Hat |
| 3 | * Author: Rob Clark <robdclark@gmail.com> |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 as published by |
| 7 | * the Free Software Foundation. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 12 | * more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License along with |
| 15 | * this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | |
| 18 | #include "msm_drv.h" |
Rob Clark | edcd60c | 2016-03-16 12:56:12 -0400 | [diff] [blame] | 19 | #include "msm_debugfs.h" |
Rob Clark | fde5de6 | 2016-03-15 15:35:08 -0400 | [diff] [blame] | 20 | #include "msm_fence.h" |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 21 | #include "msm_gpu.h" |
Rob Clark | dd2da6e | 2013-11-30 16:12:10 -0500 | [diff] [blame] | 22 | #include "msm_kms.h" |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 23 | |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 24 | static void msm_fb_output_poll_changed(struct drm_device *dev) |
| 25 | { |
| 26 | struct msm_drm_private *priv = dev->dev_private; |
| 27 | if (priv->fbdev) |
| 28 | drm_fb_helper_hotplug_event(priv->fbdev); |
| 29 | } |
| 30 | |
| 31 | static const struct drm_mode_config_funcs mode_config_funcs = { |
| 32 | .fb_create = msm_framebuffer_create, |
| 33 | .output_poll_changed = msm_fb_output_poll_changed, |
Daniel Vetter | b4274fb | 2014-11-26 17:02:18 +0100 | [diff] [blame] | 34 | .atomic_check = msm_atomic_check, |
Rob Clark | cf3a7e4 | 2014-11-08 13:21:06 -0500 | [diff] [blame] | 35 | .atomic_commit = msm_atomic_commit, |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 36 | }; |
| 37 | |
Rob Clark | 871d812 | 2013-11-16 12:56:06 -0500 | [diff] [blame] | 38 | int msm_register_mmu(struct drm_device *dev, struct msm_mmu *mmu) |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 39 | { |
| 40 | struct msm_drm_private *priv = dev->dev_private; |
Rob Clark | 871d812 | 2013-11-16 12:56:06 -0500 | [diff] [blame] | 41 | int idx = priv->num_mmus++; |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 42 | |
Rob Clark | 871d812 | 2013-11-16 12:56:06 -0500 | [diff] [blame] | 43 | if (WARN_ON(idx >= ARRAY_SIZE(priv->mmus))) |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 44 | return -EINVAL; |
| 45 | |
Rob Clark | 871d812 | 2013-11-16 12:56:06 -0500 | [diff] [blame] | 46 | priv->mmus[idx] = mmu; |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 47 | |
| 48 | return idx; |
| 49 | } |
| 50 | |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 51 | #ifdef CONFIG_DRM_MSM_REGISTER_LOGGING |
| 52 | static bool reglog = false; |
| 53 | MODULE_PARM_DESC(reglog, "Enable register read/write logging"); |
| 54 | module_param(reglog, bool, 0600); |
| 55 | #else |
| 56 | #define reglog 0 |
| 57 | #endif |
| 58 | |
Archit Taneja | a9ee34b | 2015-07-13 12:12:07 +0530 | [diff] [blame] | 59 | #ifdef CONFIG_DRM_FBDEV_EMULATION |
Rob Clark | e90dfec | 2015-01-30 17:05:41 -0500 | [diff] [blame] | 60 | static bool fbdev = true; |
| 61 | MODULE_PARM_DESC(fbdev, "Enable fbdev compat layer"); |
| 62 | module_param(fbdev, bool, 0600); |
| 63 | #endif |
| 64 | |
Rob Clark | 3a10ba8 | 2014-09-08 14:24:57 -0400 | [diff] [blame] | 65 | static char *vram = "16m"; |
Rob Clark | 4313c744 | 2016-02-03 14:02:04 -0500 | [diff] [blame] | 66 | MODULE_PARM_DESC(vram, "Configure VRAM size (for devices without IOMMU/GPUMMU)"); |
Rob Clark | 871d812 | 2013-11-16 12:56:06 -0500 | [diff] [blame] | 67 | module_param(vram, charp, 0); |
| 68 | |
Rob Clark | 060530f | 2014-03-03 14:19:12 -0500 | [diff] [blame] | 69 | /* |
| 70 | * Util/helpers: |
| 71 | */ |
| 72 | |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 73 | void __iomem *msm_ioremap(struct platform_device *pdev, const char *name, |
| 74 | const char *dbgname) |
| 75 | { |
| 76 | struct resource *res; |
| 77 | unsigned long size; |
| 78 | void __iomem *ptr; |
| 79 | |
| 80 | if (name) |
| 81 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, name); |
| 82 | else |
| 83 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 84 | |
| 85 | if (!res) { |
| 86 | dev_err(&pdev->dev, "failed to get memory resource: %s\n", name); |
| 87 | return ERR_PTR(-EINVAL); |
| 88 | } |
| 89 | |
| 90 | size = resource_size(res); |
| 91 | |
| 92 | ptr = devm_ioremap_nocache(&pdev->dev, res->start, size); |
| 93 | if (!ptr) { |
| 94 | dev_err(&pdev->dev, "failed to ioremap: %s\n", name); |
| 95 | return ERR_PTR(-ENOMEM); |
| 96 | } |
| 97 | |
| 98 | if (reglog) |
Thierry Reding | fc99f97 | 2015-04-09 16:39:51 +0200 | [diff] [blame] | 99 | printk(KERN_DEBUG "IO:region %s %p %08lx\n", dbgname, ptr, size); |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 100 | |
| 101 | return ptr; |
| 102 | } |
| 103 | |
| 104 | void msm_writel(u32 data, void __iomem *addr) |
| 105 | { |
| 106 | if (reglog) |
Thierry Reding | fc99f97 | 2015-04-09 16:39:51 +0200 | [diff] [blame] | 107 | printk(KERN_DEBUG "IO:W %p %08x\n", addr, data); |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 108 | writel(data, addr); |
| 109 | } |
| 110 | |
| 111 | u32 msm_readl(const void __iomem *addr) |
| 112 | { |
| 113 | u32 val = readl(addr); |
| 114 | if (reglog) |
Thierry Reding | fc99f97 | 2015-04-09 16:39:51 +0200 | [diff] [blame] | 115 | printk(KERN_ERR "IO:R %p %08x\n", addr, val); |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 116 | return val; |
| 117 | } |
| 118 | |
Hai Li | 78b1d47 | 2015-07-27 13:49:45 -0400 | [diff] [blame] | 119 | struct vblank_event { |
| 120 | struct list_head node; |
| 121 | int crtc_id; |
| 122 | bool enable; |
| 123 | }; |
| 124 | |
| 125 | static void vblank_ctrl_worker(struct work_struct *work) |
| 126 | { |
| 127 | struct msm_vblank_ctrl *vbl_ctrl = container_of(work, |
| 128 | struct msm_vblank_ctrl, work); |
| 129 | struct msm_drm_private *priv = container_of(vbl_ctrl, |
| 130 | struct msm_drm_private, vblank_ctrl); |
| 131 | struct msm_kms *kms = priv->kms; |
| 132 | struct vblank_event *vbl_ev, *tmp; |
| 133 | unsigned long flags; |
| 134 | |
| 135 | spin_lock_irqsave(&vbl_ctrl->lock, flags); |
| 136 | list_for_each_entry_safe(vbl_ev, tmp, &vbl_ctrl->event_list, node) { |
| 137 | list_del(&vbl_ev->node); |
| 138 | spin_unlock_irqrestore(&vbl_ctrl->lock, flags); |
| 139 | |
| 140 | if (vbl_ev->enable) |
| 141 | kms->funcs->enable_vblank(kms, |
| 142 | priv->crtcs[vbl_ev->crtc_id]); |
| 143 | else |
| 144 | kms->funcs->disable_vblank(kms, |
| 145 | priv->crtcs[vbl_ev->crtc_id]); |
| 146 | |
| 147 | kfree(vbl_ev); |
| 148 | |
| 149 | spin_lock_irqsave(&vbl_ctrl->lock, flags); |
| 150 | } |
| 151 | |
| 152 | spin_unlock_irqrestore(&vbl_ctrl->lock, flags); |
| 153 | } |
| 154 | |
| 155 | static int vblank_ctrl_queue_work(struct msm_drm_private *priv, |
| 156 | int crtc_id, bool enable) |
| 157 | { |
| 158 | struct msm_vblank_ctrl *vbl_ctrl = &priv->vblank_ctrl; |
| 159 | struct vblank_event *vbl_ev; |
| 160 | unsigned long flags; |
| 161 | |
| 162 | vbl_ev = kzalloc(sizeof(*vbl_ev), GFP_ATOMIC); |
| 163 | if (!vbl_ev) |
| 164 | return -ENOMEM; |
| 165 | |
| 166 | vbl_ev->crtc_id = crtc_id; |
| 167 | vbl_ev->enable = enable; |
| 168 | |
| 169 | spin_lock_irqsave(&vbl_ctrl->lock, flags); |
| 170 | list_add_tail(&vbl_ev->node, &vbl_ctrl->event_list); |
| 171 | spin_unlock_irqrestore(&vbl_ctrl->lock, flags); |
| 172 | |
| 173 | queue_work(priv->wq, &vbl_ctrl->work); |
| 174 | |
| 175 | return 0; |
| 176 | } |
| 177 | |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 178 | static int msm_drm_uninit(struct device *dev) |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 179 | { |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 180 | struct platform_device *pdev = to_platform_device(dev); |
| 181 | struct drm_device *ddev = platform_get_drvdata(pdev); |
| 182 | struct msm_drm_private *priv = ddev->dev_private; |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 183 | struct msm_kms *kms = priv->kms; |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 184 | struct msm_gpu *gpu = priv->gpu; |
Hai Li | 78b1d47 | 2015-07-27 13:49:45 -0400 | [diff] [blame] | 185 | struct msm_vblank_ctrl *vbl_ctrl = &priv->vblank_ctrl; |
| 186 | struct vblank_event *vbl_ev, *tmp; |
| 187 | |
| 188 | /* We must cancel and cleanup any pending vblank enable/disable |
| 189 | * work before drm_irq_uninstall() to avoid work re-enabling an |
| 190 | * irq after uninstall has disabled it. |
| 191 | */ |
| 192 | cancel_work_sync(&vbl_ctrl->work); |
| 193 | list_for_each_entry_safe(vbl_ev, tmp, &vbl_ctrl->event_list, node) { |
| 194 | list_del(&vbl_ev->node); |
| 195 | kfree(vbl_ev); |
| 196 | } |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 197 | |
Rob Clark | 6820939 | 2016-05-17 16:19:32 -0400 | [diff] [blame^] | 198 | msm_gem_shrinker_cleanup(ddev); |
| 199 | |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 200 | drm_kms_helper_poll_fini(ddev); |
Archit Taneja | 1aaa57f | 2016-02-25 11:19:45 +0530 | [diff] [blame] | 201 | |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 202 | drm_dev_unregister(ddev); |
Archit Taneja | 8208ed9 | 2016-05-02 11:05:53 +0530 | [diff] [blame] | 203 | |
Archit Taneja | 1aaa57f | 2016-02-25 11:19:45 +0530 | [diff] [blame] | 204 | #ifdef CONFIG_DRM_FBDEV_EMULATION |
| 205 | if (fbdev && priv->fbdev) |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 206 | msm_fbdev_free(ddev); |
Archit Taneja | 1aaa57f | 2016-02-25 11:19:45 +0530 | [diff] [blame] | 207 | #endif |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 208 | drm_mode_config_cleanup(ddev); |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 209 | |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 210 | pm_runtime_get_sync(dev); |
| 211 | drm_irq_uninstall(ddev); |
| 212 | pm_runtime_put_sync(dev); |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 213 | |
| 214 | flush_workqueue(priv->wq); |
| 215 | destroy_workqueue(priv->wq); |
| 216 | |
Rob Clark | ba00c3f | 2016-03-16 18:18:17 -0400 | [diff] [blame] | 217 | flush_workqueue(priv->atomic_wq); |
| 218 | destroy_workqueue(priv->atomic_wq); |
| 219 | |
Archit Taneja | cd79272 | 2016-06-15 18:04:31 +0530 | [diff] [blame] | 220 | if (kms) |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 221 | kms->funcs->destroy(kms); |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 222 | |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 223 | if (gpu) { |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 224 | mutex_lock(&ddev->struct_mutex); |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 225 | gpu->funcs->pm_suspend(gpu); |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 226 | mutex_unlock(&ddev->struct_mutex); |
Rob Clark | 774449e | 2015-05-15 09:19:36 -0400 | [diff] [blame] | 227 | gpu->funcs->destroy(gpu); |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 228 | } |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 229 | |
Rob Clark | 871d812 | 2013-11-16 12:56:06 -0500 | [diff] [blame] | 230 | if (priv->vram.paddr) { |
| 231 | DEFINE_DMA_ATTRS(attrs); |
| 232 | dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, &attrs); |
| 233 | drm_mm_takedown(&priv->vram.mm); |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 234 | dma_free_attrs(dev, priv->vram.size, NULL, |
| 235 | priv->vram.paddr, &attrs); |
Rob Clark | 871d812 | 2013-11-16 12:56:06 -0500 | [diff] [blame] | 236 | } |
| 237 | |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 238 | component_unbind_all(dev, ddev); |
Rob Clark | 060530f | 2014-03-03 14:19:12 -0500 | [diff] [blame] | 239 | |
Archit Taneja | 0a6030d | 2016-05-08 21:36:28 +0530 | [diff] [blame] | 240 | msm_mdss_destroy(ddev); |
| 241 | |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 242 | ddev->dev_private = NULL; |
| 243 | drm_dev_unref(ddev); |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 244 | |
| 245 | kfree(priv); |
| 246 | |
| 247 | return 0; |
| 248 | } |
| 249 | |
Rob Clark | 06c0dd9 | 2013-11-30 17:51:47 -0500 | [diff] [blame] | 250 | static int get_mdp_ver(struct platform_device *pdev) |
| 251 | { |
Rob Clark | 06c0dd9 | 2013-11-30 17:51:47 -0500 | [diff] [blame] | 252 | struct device *dev = &pdev->dev; |
Archit Taneja | e9fbdaf | 2015-11-18 12:15:14 +0530 | [diff] [blame] | 253 | |
| 254 | return (int) (unsigned long) of_device_get_match_data(dev); |
Rob Clark | 06c0dd9 | 2013-11-30 17:51:47 -0500 | [diff] [blame] | 255 | } |
| 256 | |
Rob Clark | 072f1f9 | 2015-03-03 15:04:25 -0500 | [diff] [blame] | 257 | #include <linux/of_address.h> |
| 258 | |
Rob Clark | 5bf9c0b | 2015-03-03 15:04:24 -0500 | [diff] [blame] | 259 | static int msm_init_vram(struct drm_device *dev) |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 260 | { |
Rob Clark | 5bf9c0b | 2015-03-03 15:04:24 -0500 | [diff] [blame] | 261 | struct msm_drm_private *priv = dev->dev_private; |
Archit Taneja | e9fbdaf | 2015-11-18 12:15:14 +0530 | [diff] [blame] | 262 | struct device_node *node; |
Rob Clark | 072f1f9 | 2015-03-03 15:04:25 -0500 | [diff] [blame] | 263 | unsigned long size = 0; |
| 264 | int ret = 0; |
| 265 | |
Rob Clark | 072f1f9 | 2015-03-03 15:04:25 -0500 | [diff] [blame] | 266 | /* In the device-tree world, we could have a 'memory-region' |
| 267 | * phandle, which gives us a link to our "vram". Allocating |
| 268 | * is all nicely abstracted behind the dma api, but we need |
| 269 | * to know the entire size to allocate it all in one go. There |
| 270 | * are two cases: |
| 271 | * 1) device with no IOMMU, in which case we need exclusive |
| 272 | * access to a VRAM carveout big enough for all gpu |
| 273 | * buffers |
| 274 | * 2) device with IOMMU, but where the bootloader puts up |
| 275 | * a splash screen. In this case, the VRAM carveout |
| 276 | * need only be large enough for fbdev fb. But we need |
| 277 | * exclusive access to the buffer to avoid the kernel |
| 278 | * using those pages for other purposes (which appears |
| 279 | * as corruption on screen before we have a chance to |
| 280 | * load and do initial modeset) |
| 281 | */ |
Rob Clark | 072f1f9 | 2015-03-03 15:04:25 -0500 | [diff] [blame] | 282 | |
| 283 | node = of_parse_phandle(dev->dev->of_node, "memory-region", 0); |
| 284 | if (node) { |
| 285 | struct resource r; |
| 286 | ret = of_address_to_resource(node, 0, &r); |
| 287 | if (ret) |
| 288 | return ret; |
| 289 | size = r.end - r.start; |
Thierry Reding | fc99f97 | 2015-04-09 16:39:51 +0200 | [diff] [blame] | 290 | DRM_INFO("using VRAM carveout: %lx@%pa\n", size, &r.start); |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 291 | |
Archit Taneja | e9fbdaf | 2015-11-18 12:15:14 +0530 | [diff] [blame] | 292 | /* if we have no IOMMU, then we need to use carveout allocator. |
| 293 | * Grab the entire CMA chunk carved out in early startup in |
| 294 | * mach-msm: |
| 295 | */ |
| 296 | } else if (!iommu_present(&platform_bus_type)) { |
Rob Clark | 072f1f9 | 2015-03-03 15:04:25 -0500 | [diff] [blame] | 297 | DRM_INFO("using %s VRAM carveout\n", vram); |
| 298 | size = memparse(vram, NULL); |
| 299 | } |
| 300 | |
| 301 | if (size) { |
Rob Clark | 871d812 | 2013-11-16 12:56:06 -0500 | [diff] [blame] | 302 | DEFINE_DMA_ATTRS(attrs); |
Rob Clark | 871d812 | 2013-11-16 12:56:06 -0500 | [diff] [blame] | 303 | void *p; |
| 304 | |
Rob Clark | 871d812 | 2013-11-16 12:56:06 -0500 | [diff] [blame] | 305 | priv->vram.size = size; |
| 306 | |
| 307 | drm_mm_init(&priv->vram.mm, 0, (size >> PAGE_SHIFT) - 1); |
| 308 | |
| 309 | dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, &attrs); |
| 310 | dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs); |
| 311 | |
| 312 | /* note that for no-kernel-mapping, the vaddr returned |
| 313 | * is bogus, but non-null if allocation succeeded: |
| 314 | */ |
| 315 | p = dma_alloc_attrs(dev->dev, size, |
Rob Clark | 543d301 | 2014-06-02 07:25:56 -0400 | [diff] [blame] | 316 | &priv->vram.paddr, GFP_KERNEL, &attrs); |
Rob Clark | 871d812 | 2013-11-16 12:56:06 -0500 | [diff] [blame] | 317 | if (!p) { |
| 318 | dev_err(dev->dev, "failed to allocate VRAM\n"); |
| 319 | priv->vram.paddr = 0; |
Rob Clark | 5bf9c0b | 2015-03-03 15:04:24 -0500 | [diff] [blame] | 320 | return -ENOMEM; |
Rob Clark | 871d812 | 2013-11-16 12:56:06 -0500 | [diff] [blame] | 321 | } |
| 322 | |
| 323 | dev_info(dev->dev, "VRAM: %08x->%08x\n", |
| 324 | (uint32_t)priv->vram.paddr, |
| 325 | (uint32_t)(priv->vram.paddr + size)); |
| 326 | } |
| 327 | |
Rob Clark | 072f1f9 | 2015-03-03 15:04:25 -0500 | [diff] [blame] | 328 | return ret; |
Rob Clark | 5bf9c0b | 2015-03-03 15:04:24 -0500 | [diff] [blame] | 329 | } |
| 330 | |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 331 | static int msm_drm_init(struct device *dev, struct drm_driver *drv) |
Rob Clark | 5bf9c0b | 2015-03-03 15:04:24 -0500 | [diff] [blame] | 332 | { |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 333 | struct platform_device *pdev = to_platform_device(dev); |
| 334 | struct drm_device *ddev; |
Rob Clark | 5bf9c0b | 2015-03-03 15:04:24 -0500 | [diff] [blame] | 335 | struct msm_drm_private *priv; |
| 336 | struct msm_kms *kms; |
| 337 | int ret; |
| 338 | |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 339 | ddev = drm_dev_alloc(drv, dev); |
| 340 | if (!ddev) { |
| 341 | dev_err(dev, "failed to allocate drm_device\n"); |
Rob Clark | 5bf9c0b | 2015-03-03 15:04:24 -0500 | [diff] [blame] | 342 | return -ENOMEM; |
| 343 | } |
| 344 | |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 345 | platform_set_drvdata(pdev, ddev); |
| 346 | ddev->platformdev = pdev; |
| 347 | |
| 348 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
| 349 | if (!priv) { |
| 350 | drm_dev_unref(ddev); |
| 351 | return -ENOMEM; |
| 352 | } |
| 353 | |
| 354 | ddev->dev_private = priv; |
Rob Clark | 6820939 | 2016-05-17 16:19:32 -0400 | [diff] [blame^] | 355 | priv->dev = ddev; |
Rob Clark | 5bf9c0b | 2015-03-03 15:04:24 -0500 | [diff] [blame] | 356 | |
Archit Taneja | 0a6030d | 2016-05-08 21:36:28 +0530 | [diff] [blame] | 357 | ret = msm_mdss_init(ddev); |
| 358 | if (ret) { |
| 359 | kfree(priv); |
| 360 | drm_dev_unref(ddev); |
| 361 | return ret; |
| 362 | } |
| 363 | |
Rob Clark | 5bf9c0b | 2015-03-03 15:04:24 -0500 | [diff] [blame] | 364 | priv->wq = alloc_ordered_workqueue("msm", 0); |
Rob Clark | ba00c3f | 2016-03-16 18:18:17 -0400 | [diff] [blame] | 365 | priv->atomic_wq = alloc_ordered_workqueue("msm:atomic", 0); |
Rob Clark | 5bf9c0b | 2015-03-03 15:04:24 -0500 | [diff] [blame] | 366 | init_waitqueue_head(&priv->pending_crtcs_event); |
| 367 | |
| 368 | INIT_LIST_HEAD(&priv->inactive_list); |
Hai Li | 78b1d47 | 2015-07-27 13:49:45 -0400 | [diff] [blame] | 369 | INIT_LIST_HEAD(&priv->vblank_ctrl.event_list); |
| 370 | INIT_WORK(&priv->vblank_ctrl.work, vblank_ctrl_worker); |
| 371 | spin_lock_init(&priv->vblank_ctrl.lock); |
Rob Clark | 5bf9c0b | 2015-03-03 15:04:24 -0500 | [diff] [blame] | 372 | |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 373 | drm_mode_config_init(ddev); |
Rob Clark | 060530f | 2014-03-03 14:19:12 -0500 | [diff] [blame] | 374 | |
| 375 | /* Bind all our sub-components: */ |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 376 | ret = component_bind_all(dev, ddev); |
| 377 | if (ret) { |
Archit Taneja | 0a6030d | 2016-05-08 21:36:28 +0530 | [diff] [blame] | 378 | msm_mdss_destroy(ddev); |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 379 | kfree(priv); |
| 380 | drm_dev_unref(ddev); |
Rob Clark | 060530f | 2014-03-03 14:19:12 -0500 | [diff] [blame] | 381 | return ret; |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 382 | } |
Rob Clark | 060530f | 2014-03-03 14:19:12 -0500 | [diff] [blame] | 383 | |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 384 | ret = msm_init_vram(ddev); |
Rob Clark | 13f1556 | 2015-05-07 15:20:13 -0400 | [diff] [blame] | 385 | if (ret) |
| 386 | goto fail; |
| 387 | |
Rob Clark | 6820939 | 2016-05-17 16:19:32 -0400 | [diff] [blame^] | 388 | msm_gem_shrinker_init(ddev); |
| 389 | |
Rob Clark | 06c0dd9 | 2013-11-30 17:51:47 -0500 | [diff] [blame] | 390 | switch (get_mdp_ver(pdev)) { |
| 391 | case 4: |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 392 | kms = mdp4_kms_init(ddev); |
Archit Taneja | 0a6030d | 2016-05-08 21:36:28 +0530 | [diff] [blame] | 393 | priv->kms = kms; |
Rob Clark | 06c0dd9 | 2013-11-30 17:51:47 -0500 | [diff] [blame] | 394 | break; |
| 395 | case 5: |
Archit Taneja | 392ae6e | 2016-06-14 18:24:54 +0530 | [diff] [blame] | 396 | kms = mdp5_kms_init(ddev); |
Rob Clark | 06c0dd9 | 2013-11-30 17:51:47 -0500 | [diff] [blame] | 397 | break; |
| 398 | default: |
| 399 | kms = ERR_PTR(-ENODEV); |
| 400 | break; |
| 401 | } |
| 402 | |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 403 | if (IS_ERR(kms)) { |
| 404 | /* |
| 405 | * NOTE: once we have GPU support, having no kms should not |
| 406 | * be considered fatal.. ideally we would still support gpu |
| 407 | * and (for example) use dmabuf/prime to share buffers with |
| 408 | * imx drm driver on iMX5 |
| 409 | */ |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 410 | dev_err(dev, "failed to load kms\n"); |
Thomas Meyer | e4826a9 | 2013-09-16 23:19:54 +0200 | [diff] [blame] | 411 | ret = PTR_ERR(kms); |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 412 | goto fail; |
| 413 | } |
| 414 | |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 415 | if (kms) { |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 416 | ret = kms->funcs->hw_init(kms); |
| 417 | if (ret) { |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 418 | dev_err(dev, "kms hw init failed: %d\n", ret); |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 419 | goto fail; |
| 420 | } |
| 421 | } |
| 422 | |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 423 | ddev->mode_config.funcs = &mode_config_funcs; |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 424 | |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 425 | ret = drm_vblank_init(ddev, priv->num_crtcs); |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 426 | if (ret < 0) { |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 427 | dev_err(dev, "failed to initialize vblank\n"); |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 428 | goto fail; |
| 429 | } |
| 430 | |
Archit Taneja | a2b3a55 | 2016-05-18 15:06:03 +0530 | [diff] [blame] | 431 | if (kms) { |
| 432 | pm_runtime_get_sync(dev); |
| 433 | ret = drm_irq_install(ddev, kms->irq); |
| 434 | pm_runtime_put_sync(dev); |
| 435 | if (ret < 0) { |
| 436 | dev_err(dev, "failed to install IRQ handler\n"); |
| 437 | goto fail; |
| 438 | } |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 439 | } |
| 440 | |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 441 | ret = drm_dev_register(ddev, 0); |
Rob Clark | a7d3c95 | 2014-05-30 14:47:38 -0400 | [diff] [blame] | 442 | if (ret) |
| 443 | goto fail; |
| 444 | |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 445 | drm_mode_config_reset(ddev); |
| 446 | |
| 447 | #ifdef CONFIG_DRM_FBDEV_EMULATION |
| 448 | if (fbdev) |
| 449 | priv->fbdev = msm_fbdev_init(ddev); |
| 450 | #endif |
| 451 | |
| 452 | ret = msm_debugfs_late_init(ddev); |
| 453 | if (ret) |
| 454 | goto fail; |
| 455 | |
| 456 | drm_kms_helper_poll_init(ddev); |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 457 | |
| 458 | return 0; |
| 459 | |
| 460 | fail: |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 461 | msm_drm_uninit(dev); |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 462 | return ret; |
| 463 | } |
| 464 | |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 465 | /* |
| 466 | * DRM operations: |
| 467 | */ |
| 468 | |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 469 | static void load_gpu(struct drm_device *dev) |
| 470 | { |
Rob Clark | a1ad352 | 2014-07-11 11:59:22 -0400 | [diff] [blame] | 471 | static DEFINE_MUTEX(init_lock); |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 472 | struct msm_drm_private *priv = dev->dev_private; |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 473 | |
Rob Clark | a1ad352 | 2014-07-11 11:59:22 -0400 | [diff] [blame] | 474 | mutex_lock(&init_lock); |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 475 | |
Rob Clark | e2550b7 | 2014-09-05 13:30:27 -0400 | [diff] [blame] | 476 | if (!priv->gpu) |
| 477 | priv->gpu = adreno_load_gpu(dev); |
Rob Clark | a1ad352 | 2014-07-11 11:59:22 -0400 | [diff] [blame] | 478 | |
Rob Clark | a1ad352 | 2014-07-11 11:59:22 -0400 | [diff] [blame] | 479 | mutex_unlock(&init_lock); |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 480 | } |
| 481 | |
| 482 | static int msm_open(struct drm_device *dev, struct drm_file *file) |
| 483 | { |
| 484 | struct msm_file_private *ctx; |
| 485 | |
| 486 | /* For now, load gpu on open.. to avoid the requirement of having |
| 487 | * firmware in the initrd. |
| 488 | */ |
| 489 | load_gpu(dev); |
| 490 | |
| 491 | ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); |
| 492 | if (!ctx) |
| 493 | return -ENOMEM; |
| 494 | |
| 495 | file->driver_priv = ctx; |
| 496 | |
| 497 | return 0; |
| 498 | } |
| 499 | |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 500 | static void msm_preclose(struct drm_device *dev, struct drm_file *file) |
| 501 | { |
| 502 | struct msm_drm_private *priv = dev->dev_private; |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 503 | struct msm_file_private *ctx = file->driver_priv; |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 504 | |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 505 | mutex_lock(&dev->struct_mutex); |
| 506 | if (ctx == priv->lastctx) |
| 507 | priv->lastctx = NULL; |
| 508 | mutex_unlock(&dev->struct_mutex); |
| 509 | |
| 510 | kfree(ctx); |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 511 | } |
| 512 | |
| 513 | static void msm_lastclose(struct drm_device *dev) |
| 514 | { |
| 515 | struct msm_drm_private *priv = dev->dev_private; |
Rob Clark | 5ea1f75 | 2014-05-30 12:29:48 -0400 | [diff] [blame] | 516 | if (priv->fbdev) |
| 517 | drm_fb_helper_restore_fbdev_mode_unlocked(priv->fbdev); |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 518 | } |
| 519 | |
Daniel Vetter | e9f0d76 | 2013-12-11 11:34:42 +0100 | [diff] [blame] | 520 | static irqreturn_t msm_irq(int irq, void *arg) |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 521 | { |
| 522 | struct drm_device *dev = arg; |
| 523 | struct msm_drm_private *priv = dev->dev_private; |
| 524 | struct msm_kms *kms = priv->kms; |
| 525 | BUG_ON(!kms); |
| 526 | return kms->funcs->irq(kms); |
| 527 | } |
| 528 | |
| 529 | static void msm_irq_preinstall(struct drm_device *dev) |
| 530 | { |
| 531 | struct msm_drm_private *priv = dev->dev_private; |
| 532 | struct msm_kms *kms = priv->kms; |
| 533 | BUG_ON(!kms); |
| 534 | kms->funcs->irq_preinstall(kms); |
| 535 | } |
| 536 | |
| 537 | static int msm_irq_postinstall(struct drm_device *dev) |
| 538 | { |
| 539 | struct msm_drm_private *priv = dev->dev_private; |
| 540 | struct msm_kms *kms = priv->kms; |
| 541 | BUG_ON(!kms); |
| 542 | return kms->funcs->irq_postinstall(kms); |
| 543 | } |
| 544 | |
| 545 | static void msm_irq_uninstall(struct drm_device *dev) |
| 546 | { |
| 547 | struct msm_drm_private *priv = dev->dev_private; |
| 548 | struct msm_kms *kms = priv->kms; |
| 549 | BUG_ON(!kms); |
| 550 | kms->funcs->irq_uninstall(kms); |
| 551 | } |
| 552 | |
Thierry Reding | 88e7271 | 2015-09-24 18:35:31 +0200 | [diff] [blame] | 553 | static int msm_enable_vblank(struct drm_device *dev, unsigned int pipe) |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 554 | { |
| 555 | struct msm_drm_private *priv = dev->dev_private; |
| 556 | struct msm_kms *kms = priv->kms; |
| 557 | if (!kms) |
| 558 | return -ENXIO; |
Thierry Reding | 88e7271 | 2015-09-24 18:35:31 +0200 | [diff] [blame] | 559 | DBG("dev=%p, crtc=%u", dev, pipe); |
| 560 | return vblank_ctrl_queue_work(priv, pipe, true); |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 561 | } |
| 562 | |
Thierry Reding | 88e7271 | 2015-09-24 18:35:31 +0200 | [diff] [blame] | 563 | static void msm_disable_vblank(struct drm_device *dev, unsigned int pipe) |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 564 | { |
| 565 | struct msm_drm_private *priv = dev->dev_private; |
| 566 | struct msm_kms *kms = priv->kms; |
| 567 | if (!kms) |
| 568 | return; |
Thierry Reding | 88e7271 | 2015-09-24 18:35:31 +0200 | [diff] [blame] | 569 | DBG("dev=%p, crtc=%u", dev, pipe); |
| 570 | vblank_ctrl_queue_work(priv, pipe, false); |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 571 | } |
| 572 | |
| 573 | /* |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 574 | * DRM ioctls: |
| 575 | */ |
| 576 | |
| 577 | static int msm_ioctl_get_param(struct drm_device *dev, void *data, |
| 578 | struct drm_file *file) |
| 579 | { |
| 580 | struct msm_drm_private *priv = dev->dev_private; |
| 581 | struct drm_msm_param *args = data; |
| 582 | struct msm_gpu *gpu; |
| 583 | |
| 584 | /* for now, we just have 3d pipe.. eventually this would need to |
| 585 | * be more clever to dispatch to appropriate gpu module: |
| 586 | */ |
| 587 | if (args->pipe != MSM_PIPE_3D0) |
| 588 | return -EINVAL; |
| 589 | |
| 590 | gpu = priv->gpu; |
| 591 | |
| 592 | if (!gpu) |
| 593 | return -ENXIO; |
| 594 | |
| 595 | return gpu->funcs->get_param(gpu, args->param, &args->value); |
| 596 | } |
| 597 | |
| 598 | static int msm_ioctl_gem_new(struct drm_device *dev, void *data, |
| 599 | struct drm_file *file) |
| 600 | { |
| 601 | struct drm_msm_gem_new *args = data; |
Rob Clark | 93ddb0d | 2014-03-03 09:42:33 -0500 | [diff] [blame] | 602 | |
| 603 | if (args->flags & ~MSM_BO_FLAGS) { |
| 604 | DRM_ERROR("invalid flags: %08x\n", args->flags); |
| 605 | return -EINVAL; |
| 606 | } |
| 607 | |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 608 | return msm_gem_new_handle(dev, file, args->size, |
| 609 | args->flags, &args->handle); |
| 610 | } |
| 611 | |
Rob Clark | 56c2da8 | 2015-05-11 11:50:03 -0400 | [diff] [blame] | 612 | static inline ktime_t to_ktime(struct drm_msm_timespec timeout) |
| 613 | { |
| 614 | return ktime_set(timeout.tv_sec, timeout.tv_nsec); |
| 615 | } |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 616 | |
| 617 | static int msm_ioctl_gem_cpu_prep(struct drm_device *dev, void *data, |
| 618 | struct drm_file *file) |
| 619 | { |
| 620 | struct drm_msm_gem_cpu_prep *args = data; |
| 621 | struct drm_gem_object *obj; |
Rob Clark | 56c2da8 | 2015-05-11 11:50:03 -0400 | [diff] [blame] | 622 | ktime_t timeout = to_ktime(args->timeout); |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 623 | int ret; |
| 624 | |
Rob Clark | 93ddb0d | 2014-03-03 09:42:33 -0500 | [diff] [blame] | 625 | if (args->op & ~MSM_PREP_FLAGS) { |
| 626 | DRM_ERROR("invalid op: %08x\n", args->op); |
| 627 | return -EINVAL; |
| 628 | } |
| 629 | |
Chris Wilson | a8ad0bd | 2016-05-09 11:04:54 +0100 | [diff] [blame] | 630 | obj = drm_gem_object_lookup(file, args->handle); |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 631 | if (!obj) |
| 632 | return -ENOENT; |
| 633 | |
Rob Clark | 56c2da8 | 2015-05-11 11:50:03 -0400 | [diff] [blame] | 634 | ret = msm_gem_cpu_prep(obj, args->op, &timeout); |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 635 | |
| 636 | drm_gem_object_unreference_unlocked(obj); |
| 637 | |
| 638 | return ret; |
| 639 | } |
| 640 | |
| 641 | static int msm_ioctl_gem_cpu_fini(struct drm_device *dev, void *data, |
| 642 | struct drm_file *file) |
| 643 | { |
| 644 | struct drm_msm_gem_cpu_fini *args = data; |
| 645 | struct drm_gem_object *obj; |
| 646 | int ret; |
| 647 | |
Chris Wilson | a8ad0bd | 2016-05-09 11:04:54 +0100 | [diff] [blame] | 648 | obj = drm_gem_object_lookup(file, args->handle); |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 649 | if (!obj) |
| 650 | return -ENOENT; |
| 651 | |
| 652 | ret = msm_gem_cpu_fini(obj); |
| 653 | |
| 654 | drm_gem_object_unreference_unlocked(obj); |
| 655 | |
| 656 | return ret; |
| 657 | } |
| 658 | |
| 659 | static int msm_ioctl_gem_info(struct drm_device *dev, void *data, |
| 660 | struct drm_file *file) |
| 661 | { |
| 662 | struct drm_msm_gem_info *args = data; |
| 663 | struct drm_gem_object *obj; |
| 664 | int ret = 0; |
| 665 | |
| 666 | if (args->pad) |
| 667 | return -EINVAL; |
| 668 | |
Chris Wilson | a8ad0bd | 2016-05-09 11:04:54 +0100 | [diff] [blame] | 669 | obj = drm_gem_object_lookup(file, args->handle); |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 670 | if (!obj) |
| 671 | return -ENOENT; |
| 672 | |
| 673 | args->offset = msm_gem_mmap_offset(obj); |
| 674 | |
| 675 | drm_gem_object_unreference_unlocked(obj); |
| 676 | |
| 677 | return ret; |
| 678 | } |
| 679 | |
| 680 | static int msm_ioctl_wait_fence(struct drm_device *dev, void *data, |
| 681 | struct drm_file *file) |
| 682 | { |
Rob Clark | ca762a8 | 2016-03-15 17:22:13 -0400 | [diff] [blame] | 683 | struct msm_drm_private *priv = dev->dev_private; |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 684 | struct drm_msm_wait_fence *args = data; |
Rob Clark | 56c2da8 | 2015-05-11 11:50:03 -0400 | [diff] [blame] | 685 | ktime_t timeout = to_ktime(args->timeout); |
Rob Clark | 93ddb0d | 2014-03-03 09:42:33 -0500 | [diff] [blame] | 686 | |
| 687 | if (args->pad) { |
| 688 | DRM_ERROR("invalid pad: %08x\n", args->pad); |
| 689 | return -EINVAL; |
| 690 | } |
| 691 | |
Rob Clark | ca762a8 | 2016-03-15 17:22:13 -0400 | [diff] [blame] | 692 | if (!priv->gpu) |
| 693 | return 0; |
| 694 | |
| 695 | return msm_wait_fence(priv->gpu->fctx, args->fence, &timeout, true); |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 696 | } |
| 697 | |
Rob Clark | 4cd33c4 | 2016-05-17 15:44:49 -0400 | [diff] [blame] | 698 | static int msm_ioctl_gem_madvise(struct drm_device *dev, void *data, |
| 699 | struct drm_file *file) |
| 700 | { |
| 701 | struct drm_msm_gem_madvise *args = data; |
| 702 | struct drm_gem_object *obj; |
| 703 | int ret; |
| 704 | |
| 705 | switch (args->madv) { |
| 706 | case MSM_MADV_DONTNEED: |
| 707 | case MSM_MADV_WILLNEED: |
| 708 | break; |
| 709 | default: |
| 710 | return -EINVAL; |
| 711 | } |
| 712 | |
| 713 | ret = mutex_lock_interruptible(&dev->struct_mutex); |
| 714 | if (ret) |
| 715 | return ret; |
| 716 | |
| 717 | obj = drm_gem_object_lookup(file, args->handle); |
| 718 | if (!obj) { |
| 719 | ret = -ENOENT; |
| 720 | goto unlock; |
| 721 | } |
| 722 | |
| 723 | ret = msm_gem_madvise(obj, args->madv); |
| 724 | if (ret >= 0) { |
| 725 | args->retained = ret; |
| 726 | ret = 0; |
| 727 | } |
| 728 | |
| 729 | drm_gem_object_unreference(obj); |
| 730 | |
| 731 | unlock: |
| 732 | mutex_unlock(&dev->struct_mutex); |
| 733 | return ret; |
| 734 | } |
| 735 | |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 736 | static const struct drm_ioctl_desc msm_ioctls[] = { |
Daniel Vetter | f8c4714 | 2015-09-08 13:56:30 +0200 | [diff] [blame] | 737 | DRM_IOCTL_DEF_DRV(MSM_GET_PARAM, msm_ioctl_get_param, DRM_AUTH|DRM_RENDER_ALLOW), |
| 738 | DRM_IOCTL_DEF_DRV(MSM_GEM_NEW, msm_ioctl_gem_new, DRM_AUTH|DRM_RENDER_ALLOW), |
| 739 | DRM_IOCTL_DEF_DRV(MSM_GEM_INFO, msm_ioctl_gem_info, DRM_AUTH|DRM_RENDER_ALLOW), |
| 740 | DRM_IOCTL_DEF_DRV(MSM_GEM_CPU_PREP, msm_ioctl_gem_cpu_prep, DRM_AUTH|DRM_RENDER_ALLOW), |
| 741 | DRM_IOCTL_DEF_DRV(MSM_GEM_CPU_FINI, msm_ioctl_gem_cpu_fini, DRM_AUTH|DRM_RENDER_ALLOW), |
| 742 | DRM_IOCTL_DEF_DRV(MSM_GEM_SUBMIT, msm_ioctl_gem_submit, DRM_AUTH|DRM_RENDER_ALLOW), |
| 743 | DRM_IOCTL_DEF_DRV(MSM_WAIT_FENCE, msm_ioctl_wait_fence, DRM_AUTH|DRM_RENDER_ALLOW), |
Rob Clark | 4cd33c4 | 2016-05-17 15:44:49 -0400 | [diff] [blame] | 744 | DRM_IOCTL_DEF_DRV(MSM_GEM_MADVISE, msm_ioctl_gem_madvise, DRM_AUTH|DRM_RENDER_ALLOW), |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 745 | }; |
| 746 | |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 747 | static const struct vm_operations_struct vm_ops = { |
| 748 | .fault = msm_gem_fault, |
| 749 | .open = drm_gem_vm_open, |
| 750 | .close = drm_gem_vm_close, |
| 751 | }; |
| 752 | |
| 753 | static const struct file_operations fops = { |
| 754 | .owner = THIS_MODULE, |
| 755 | .open = drm_open, |
| 756 | .release = drm_release, |
| 757 | .unlocked_ioctl = drm_ioctl, |
| 758 | #ifdef CONFIG_COMPAT |
| 759 | .compat_ioctl = drm_compat_ioctl, |
| 760 | #endif |
| 761 | .poll = drm_poll, |
| 762 | .read = drm_read, |
| 763 | .llseek = no_llseek, |
| 764 | .mmap = msm_gem_mmap, |
| 765 | }; |
| 766 | |
| 767 | static struct drm_driver msm_driver = { |
Rob Clark | 05b8491 | 2013-09-28 11:28:35 -0400 | [diff] [blame] | 768 | .driver_features = DRIVER_HAVE_IRQ | |
| 769 | DRIVER_GEM | |
| 770 | DRIVER_PRIME | |
Rob Clark | b4b15c8 | 2013-09-28 12:01:25 -0400 | [diff] [blame] | 771 | DRIVER_RENDER | |
Rob Clark | a5436e1 | 2015-06-04 10:12:22 -0400 | [diff] [blame] | 772 | DRIVER_ATOMIC | |
Rob Clark | 05b8491 | 2013-09-28 11:28:35 -0400 | [diff] [blame] | 773 | DRIVER_MODESET, |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 774 | .open = msm_open, |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 775 | .preclose = msm_preclose, |
| 776 | .lastclose = msm_lastclose, |
| 777 | .irq_handler = msm_irq, |
| 778 | .irq_preinstall = msm_irq_preinstall, |
| 779 | .irq_postinstall = msm_irq_postinstall, |
| 780 | .irq_uninstall = msm_irq_uninstall, |
Ville Syrjälä | b44f840 | 2015-09-30 16:46:48 +0300 | [diff] [blame] | 781 | .get_vblank_counter = drm_vblank_no_hw_counter, |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 782 | .enable_vblank = msm_enable_vblank, |
| 783 | .disable_vblank = msm_disable_vblank, |
| 784 | .gem_free_object = msm_gem_free_object, |
| 785 | .gem_vm_ops = &vm_ops, |
| 786 | .dumb_create = msm_gem_dumb_create, |
| 787 | .dumb_map_offset = msm_gem_dumb_map_offset, |
Rob Clark | 30600a9 | 2013-09-28 10:13:04 -0400 | [diff] [blame] | 788 | .dumb_destroy = drm_gem_dumb_destroy, |
Rob Clark | 05b8491 | 2013-09-28 11:28:35 -0400 | [diff] [blame] | 789 | .prime_handle_to_fd = drm_gem_prime_handle_to_fd, |
| 790 | .prime_fd_to_handle = drm_gem_prime_fd_to_handle, |
| 791 | .gem_prime_export = drm_gem_prime_export, |
| 792 | .gem_prime_import = drm_gem_prime_import, |
| 793 | .gem_prime_pin = msm_gem_prime_pin, |
| 794 | .gem_prime_unpin = msm_gem_prime_unpin, |
| 795 | .gem_prime_get_sg_table = msm_gem_prime_get_sg_table, |
| 796 | .gem_prime_import_sg_table = msm_gem_prime_import_sg_table, |
| 797 | .gem_prime_vmap = msm_gem_prime_vmap, |
| 798 | .gem_prime_vunmap = msm_gem_prime_vunmap, |
Daniel Thompson | 77a147e | 2014-11-12 11:38:14 +0000 | [diff] [blame] | 799 | .gem_prime_mmap = msm_gem_prime_mmap, |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 800 | #ifdef CONFIG_DEBUG_FS |
| 801 | .debugfs_init = msm_debugfs_init, |
| 802 | .debugfs_cleanup = msm_debugfs_cleanup, |
| 803 | #endif |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 804 | .ioctls = msm_ioctls, |
| 805 | .num_ioctls = DRM_MSM_NUM_IOCTLS, |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 806 | .fops = &fops, |
| 807 | .name = "msm", |
| 808 | .desc = "MSM Snapdragon DRM", |
| 809 | .date = "20130625", |
| 810 | .major = 1, |
| 811 | .minor = 0, |
| 812 | }; |
| 813 | |
| 814 | #ifdef CONFIG_PM_SLEEP |
| 815 | static int msm_pm_suspend(struct device *dev) |
| 816 | { |
| 817 | struct drm_device *ddev = dev_get_drvdata(dev); |
| 818 | |
| 819 | drm_kms_helper_poll_disable(ddev); |
| 820 | |
| 821 | return 0; |
| 822 | } |
| 823 | |
| 824 | static int msm_pm_resume(struct device *dev) |
| 825 | { |
| 826 | struct drm_device *ddev = dev_get_drvdata(dev); |
| 827 | |
| 828 | drm_kms_helper_poll_enable(ddev); |
| 829 | |
| 830 | return 0; |
| 831 | } |
| 832 | #endif |
| 833 | |
| 834 | static const struct dev_pm_ops msm_pm_ops = { |
| 835 | SET_SYSTEM_SLEEP_PM_OPS(msm_pm_suspend, msm_pm_resume) |
| 836 | }; |
| 837 | |
| 838 | /* |
Rob Clark | 060530f | 2014-03-03 14:19:12 -0500 | [diff] [blame] | 839 | * Componentized driver support: |
| 840 | */ |
| 841 | |
Archit Taneja | e9fbdaf | 2015-11-18 12:15:14 +0530 | [diff] [blame] | 842 | /* |
| 843 | * NOTE: duplication of the same code as exynos or imx (or probably any other). |
| 844 | * so probably some room for some helpers |
Rob Clark | 060530f | 2014-03-03 14:19:12 -0500 | [diff] [blame] | 845 | */ |
| 846 | static int compare_of(struct device *dev, void *data) |
| 847 | { |
| 848 | return dev->of_node == data; |
| 849 | } |
Rob Clark | 41e6977 | 2013-12-15 16:23:05 -0500 | [diff] [blame] | 850 | |
Archit Taneja | 812070e | 2016-05-19 10:38:39 +0530 | [diff] [blame] | 851 | /* |
| 852 | * Identify what components need to be added by parsing what remote-endpoints |
| 853 | * our MDP output ports are connected to. In the case of LVDS on MDP4, there |
| 854 | * is no external component that we need to add since LVDS is within MDP4 |
| 855 | * itself. |
| 856 | */ |
| 857 | static int add_components_mdp(struct device *mdp_dev, |
| 858 | struct component_match **matchptr) |
| 859 | { |
| 860 | struct device_node *np = mdp_dev->of_node; |
| 861 | struct device_node *ep_node; |
Archit Taneja | 54011e2 | 2016-06-06 13:45:34 +0530 | [diff] [blame] | 862 | struct device *master_dev; |
| 863 | |
| 864 | /* |
| 865 | * on MDP4 based platforms, the MDP platform device is the component |
| 866 | * master that adds other display interface components to itself. |
| 867 | * |
| 868 | * on MDP5 based platforms, the MDSS platform device is the component |
| 869 | * master that adds MDP5 and other display interface components to |
| 870 | * itself. |
| 871 | */ |
| 872 | if (of_device_is_compatible(np, "qcom,mdp4")) |
| 873 | master_dev = mdp_dev; |
| 874 | else |
| 875 | master_dev = mdp_dev->parent; |
Archit Taneja | 812070e | 2016-05-19 10:38:39 +0530 | [diff] [blame] | 876 | |
| 877 | for_each_endpoint_of_node(np, ep_node) { |
| 878 | struct device_node *intf; |
| 879 | struct of_endpoint ep; |
| 880 | int ret; |
| 881 | |
| 882 | ret = of_graph_parse_endpoint(ep_node, &ep); |
| 883 | if (ret) { |
| 884 | dev_err(mdp_dev, "unable to parse port endpoint\n"); |
| 885 | of_node_put(ep_node); |
| 886 | return ret; |
| 887 | } |
| 888 | |
| 889 | /* |
| 890 | * The LCDC/LVDS port on MDP4 is a speacial case where the |
| 891 | * remote-endpoint isn't a component that we need to add |
| 892 | */ |
| 893 | if (of_device_is_compatible(np, "qcom,mdp4") && |
| 894 | ep.port == 0) { |
| 895 | of_node_put(ep_node); |
| 896 | continue; |
| 897 | } |
| 898 | |
| 899 | /* |
| 900 | * It's okay if some of the ports don't have a remote endpoint |
| 901 | * specified. It just means that the port isn't connected to |
| 902 | * any external interface. |
| 903 | */ |
| 904 | intf = of_graph_get_remote_port_parent(ep_node); |
| 905 | if (!intf) { |
| 906 | of_node_put(ep_node); |
| 907 | continue; |
| 908 | } |
| 909 | |
Archit Taneja | 54011e2 | 2016-06-06 13:45:34 +0530 | [diff] [blame] | 910 | component_match_add(master_dev, matchptr, compare_of, intf); |
Archit Taneja | 812070e | 2016-05-19 10:38:39 +0530 | [diff] [blame] | 911 | |
| 912 | of_node_put(intf); |
| 913 | of_node_put(ep_node); |
| 914 | } |
| 915 | |
| 916 | return 0; |
| 917 | } |
| 918 | |
Archit Taneja | 54011e2 | 2016-06-06 13:45:34 +0530 | [diff] [blame] | 919 | static int compare_name_mdp(struct device *dev, void *data) |
| 920 | { |
| 921 | return (strstr(dev_name(dev), "mdp") != NULL); |
| 922 | } |
| 923 | |
Archit Taneja | 7d526fcf | 2016-05-19 10:33:57 +0530 | [diff] [blame] | 924 | static int add_display_components(struct device *dev, |
| 925 | struct component_match **matchptr) |
| 926 | { |
Archit Taneja | 54011e2 | 2016-06-06 13:45:34 +0530 | [diff] [blame] | 927 | struct device *mdp_dev; |
| 928 | int ret; |
| 929 | |
| 930 | /* |
| 931 | * MDP5 based devices don't have a flat hierarchy. There is a top level |
| 932 | * parent: MDSS, and children: MDP5, DSI, HDMI, eDP etc. Populate the |
| 933 | * children devices, find the MDP5 node, and then add the interfaces |
| 934 | * to our components list. |
| 935 | */ |
| 936 | if (of_device_is_compatible(dev->of_node, "qcom,mdss")) { |
| 937 | ret = of_platform_populate(dev->of_node, NULL, NULL, dev); |
| 938 | if (ret) { |
| 939 | dev_err(dev, "failed to populate children devices\n"); |
| 940 | return ret; |
| 941 | } |
| 942 | |
| 943 | mdp_dev = device_find_child(dev, NULL, compare_name_mdp); |
| 944 | if (!mdp_dev) { |
| 945 | dev_err(dev, "failed to find MDSS MDP node\n"); |
| 946 | of_platform_depopulate(dev); |
| 947 | return -ENODEV; |
| 948 | } |
| 949 | |
| 950 | put_device(mdp_dev); |
| 951 | |
| 952 | /* add the MDP component itself */ |
| 953 | component_match_add(dev, matchptr, compare_of, |
| 954 | mdp_dev->of_node); |
| 955 | } else { |
| 956 | /* MDP4 */ |
| 957 | mdp_dev = dev; |
| 958 | } |
| 959 | |
| 960 | ret = add_components_mdp(mdp_dev, matchptr); |
| 961 | if (ret) |
| 962 | of_platform_depopulate(dev); |
| 963 | |
| 964 | return ret; |
Archit Taneja | 7d526fcf | 2016-05-19 10:33:57 +0530 | [diff] [blame] | 965 | } |
| 966 | |
Archit Taneja | dc3ea26 | 2016-05-19 13:33:52 +0530 | [diff] [blame] | 967 | /* |
| 968 | * We don't know what's the best binding to link the gpu with the drm device. |
| 969 | * Fow now, we just hunt for all the possible gpus that we support, and add them |
| 970 | * as components. |
| 971 | */ |
| 972 | static const struct of_device_id msm_gpu_match[] = { |
| 973 | { .compatible = "qcom,adreno-3xx" }, |
| 974 | { .compatible = "qcom,kgsl-3d0" }, |
| 975 | { }, |
| 976 | }; |
| 977 | |
Archit Taneja | 7d526fcf | 2016-05-19 10:33:57 +0530 | [diff] [blame] | 978 | static int add_gpu_components(struct device *dev, |
| 979 | struct component_match **matchptr) |
| 980 | { |
Archit Taneja | dc3ea26 | 2016-05-19 13:33:52 +0530 | [diff] [blame] | 981 | struct device_node *np; |
| 982 | |
| 983 | np = of_find_matching_node(NULL, msm_gpu_match); |
| 984 | if (!np) |
| 985 | return 0; |
| 986 | |
| 987 | component_match_add(dev, matchptr, compare_of, np); |
| 988 | |
| 989 | of_node_put(np); |
| 990 | |
| 991 | return 0; |
Archit Taneja | 7d526fcf | 2016-05-19 10:33:57 +0530 | [diff] [blame] | 992 | } |
| 993 | |
Russell King | 8444828 | 2014-04-19 11:20:42 +0100 | [diff] [blame] | 994 | static int msm_drm_bind(struct device *dev) |
| 995 | { |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 996 | return msm_drm_init(dev, &msm_driver); |
Russell King | 8444828 | 2014-04-19 11:20:42 +0100 | [diff] [blame] | 997 | } |
| 998 | |
| 999 | static void msm_drm_unbind(struct device *dev) |
| 1000 | { |
Archit Taneja | 2b66987 | 2016-05-02 11:05:54 +0530 | [diff] [blame] | 1001 | msm_drm_uninit(dev); |
Russell King | 8444828 | 2014-04-19 11:20:42 +0100 | [diff] [blame] | 1002 | } |
| 1003 | |
| 1004 | static const struct component_master_ops msm_drm_ops = { |
| 1005 | .bind = msm_drm_bind, |
| 1006 | .unbind = msm_drm_unbind, |
| 1007 | }; |
| 1008 | |
| 1009 | /* |
| 1010 | * Platform driver: |
| 1011 | */ |
| 1012 | |
| 1013 | static int msm_pdev_probe(struct platform_device *pdev) |
| 1014 | { |
| 1015 | struct component_match *match = NULL; |
Archit Taneja | 7d526fcf | 2016-05-19 10:33:57 +0530 | [diff] [blame] | 1016 | int ret; |
Archit Taneja | e9fbdaf | 2015-11-18 12:15:14 +0530 | [diff] [blame] | 1017 | |
Archit Taneja | 7d526fcf | 2016-05-19 10:33:57 +0530 | [diff] [blame] | 1018 | ret = add_display_components(&pdev->dev, &match); |
| 1019 | if (ret) |
| 1020 | return ret; |
| 1021 | |
| 1022 | ret = add_gpu_components(&pdev->dev, &match); |
| 1023 | if (ret) |
| 1024 | return ret; |
Rob Clark | 060530f | 2014-03-03 14:19:12 -0500 | [diff] [blame] | 1025 | |
Rob Clark | 871d812 | 2013-11-16 12:56:06 -0500 | [diff] [blame] | 1026 | pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); |
Russell King | 8444828 | 2014-04-19 11:20:42 +0100 | [diff] [blame] | 1027 | return component_master_add_with_match(&pdev->dev, &msm_drm_ops, match); |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 1028 | } |
| 1029 | |
| 1030 | static int msm_pdev_remove(struct platform_device *pdev) |
| 1031 | { |
Rob Clark | 060530f | 2014-03-03 14:19:12 -0500 | [diff] [blame] | 1032 | component_master_del(&pdev->dev, &msm_drm_ops); |
Archit Taneja | 54011e2 | 2016-06-06 13:45:34 +0530 | [diff] [blame] | 1033 | of_platform_depopulate(&pdev->dev); |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 1034 | |
| 1035 | return 0; |
| 1036 | } |
| 1037 | |
Rob Clark | 06c0dd9 | 2013-11-30 17:51:47 -0500 | [diff] [blame] | 1038 | static const struct of_device_id dt_match[] = { |
Archit Taneja | 96a611b | 2016-05-30 17:02:00 +0530 | [diff] [blame] | 1039 | { .compatible = "qcom,mdp4", .data = (void *)4 }, /* MDP4 */ |
| 1040 | { .compatible = "qcom,mdss", .data = (void *)5 }, /* MDP5 MDSS */ |
Rob Clark | 06c0dd9 | 2013-11-30 17:51:47 -0500 | [diff] [blame] | 1041 | {} |
| 1042 | }; |
| 1043 | MODULE_DEVICE_TABLE(of, dt_match); |
| 1044 | |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 1045 | static struct platform_driver msm_platform_driver = { |
| 1046 | .probe = msm_pdev_probe, |
| 1047 | .remove = msm_pdev_remove, |
| 1048 | .driver = { |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 1049 | .name = "msm", |
Rob Clark | 06c0dd9 | 2013-11-30 17:51:47 -0500 | [diff] [blame] | 1050 | .of_match_table = dt_match, |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 1051 | .pm = &msm_pm_ops, |
| 1052 | }, |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 1053 | }; |
| 1054 | |
| 1055 | static int __init msm_drm_register(void) |
| 1056 | { |
| 1057 | DBG("init"); |
Archit Taneja | 1dd0a0b | 2016-05-30 16:36:50 +0530 | [diff] [blame] | 1058 | msm_mdp_register(); |
Hai Li | d5af49c | 2015-03-26 19:25:17 -0400 | [diff] [blame] | 1059 | msm_dsi_register(); |
Hai Li | 0045398 | 2014-12-12 14:41:17 -0500 | [diff] [blame] | 1060 | msm_edp_register(); |
Arnd Bergmann | fcda50c | 2016-02-22 22:08:35 +0100 | [diff] [blame] | 1061 | msm_hdmi_register(); |
Rob Clark | bfd28b1 | 2014-09-05 13:06:37 -0400 | [diff] [blame] | 1062 | adreno_register(); |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 1063 | return platform_driver_register(&msm_platform_driver); |
| 1064 | } |
| 1065 | |
| 1066 | static void __exit msm_drm_unregister(void) |
| 1067 | { |
| 1068 | DBG("fini"); |
| 1069 | platform_driver_unregister(&msm_platform_driver); |
Arnd Bergmann | fcda50c | 2016-02-22 22:08:35 +0100 | [diff] [blame] | 1070 | msm_hdmi_unregister(); |
Rob Clark | bfd28b1 | 2014-09-05 13:06:37 -0400 | [diff] [blame] | 1071 | adreno_unregister(); |
Hai Li | 0045398 | 2014-12-12 14:41:17 -0500 | [diff] [blame] | 1072 | msm_edp_unregister(); |
Hai Li | d5af49c | 2015-03-26 19:25:17 -0400 | [diff] [blame] | 1073 | msm_dsi_unregister(); |
Archit Taneja | 1dd0a0b | 2016-05-30 16:36:50 +0530 | [diff] [blame] | 1074 | msm_mdp_unregister(); |
Rob Clark | c8afe68 | 2013-06-26 12:44:06 -0400 | [diff] [blame] | 1075 | } |
| 1076 | |
| 1077 | module_init(msm_drm_register); |
| 1078 | module_exit(msm_drm_unregister); |
| 1079 | |
| 1080 | MODULE_AUTHOR("Rob Clark <robdclark@gmail.com"); |
| 1081 | MODULE_DESCRIPTION("MSM DRM Driver"); |
| 1082 | MODULE_LICENSE("GPL"); |