* 'exynos-drm-fixes' of git://git.infradead.org/users/kmpark/linux-samsung: drm/exynos: fixed exynos broken ioctl drm/exynos: fix to pointer manager member of struct exynos_drm_subdrv drm/exynos: fix struct for operation callback functions to driver name drm/exynos: use define instead of default_win member in struct mixer_context drm/exynos: rename s/HDMI_OVERLAY_NUMBER/MIXER_WIN_NR drm/exynos: remove unused codes in hdmi and mixer drm/exynos: remove unnecessary type conversion of hdmi and mixer drm/exynos: add format list of plane drm/exynos: fixed duplicated page allocation bug. drm/exynos: fixed page align and code clean.
Unified · Split
| @@ -34,14 +34,14 @@ · 33 unmodified lines | ||
| 34 | 34 | static int lowlevel_buffer_allocate(struct drm_device *dev, |
| 35 | 35 | unsigned int flags, struct exynos_drm_gem_buf *buf) |
| 36 | 36 | { |
| 37 | − dma_addr_t start_addr, end_addr; | |
| 37 | + dma_addr_t start_addr; | |
| 38 | 38 | unsigned int npages, page_size, i = 0; |
| 39 | 39 | struct scatterlist *sgl; |
| 40 | 40 | int ret = 0; |
| 41 | 41 | |
| 42 | 42 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 43 | 43 | |
| 44 | − if (flags & EXYNOS_BO_NONCONTIG) { | |
| 44 | + if (IS_NONCONTIG_BUFFER(flags)) { | |
| 45 | 45 | DRM_DEBUG_KMS("not support allocation type.\n"); |
| 46 | 46 | return -EINVAL; |
| 47 | 47 | } |
| @@ -52,13 +52,13 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, · 4 unmodified lines | ||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | if (buf->size >= SZ_1M) { |
| 55 | − npages = (buf->size >> SECTION_SHIFT) + 1; | |
| 55 | + npages = buf->size >> SECTION_SHIFT; | |
| 56 | 56 | page_size = SECTION_SIZE; |
| 57 | 57 | } else if (buf->size >= SZ_64K) { |
| 58 | − npages = (buf->size >> 16) + 1; | |
| 58 | + npages = buf->size >> 16; | |
| 59 | 59 | page_size = SZ_64K; |
| 60 | 60 | } else { |
| 61 | − npages = (buf->size >> PAGE_SHIFT) + 1; | |
| 61 | + npages = buf->size >> PAGE_SHIFT; | |
| 62 | 62 | page_size = PAGE_SIZE; |
| 63 | 63 | } |
| 64 | 64 | |
| @@ -76,26 +76,13 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, · 11 unmodified lines | ||
| 76 | 76 | return -ENOMEM; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | − buf->kvaddr = dma_alloc_writecombine(dev->dev, buf->size, | |
| 80 | − &buf->dma_addr, GFP_KERNEL); | |
| 81 | − if (!buf->kvaddr) { | |
| 82 | − DRM_ERROR("failed to allocate buffer.\n"); | |
| 83 | − ret = -ENOMEM; | |
| 84 | − goto err1; | |
| 85 | − } | |
| 86 | − | |
| 87 | − start_addr = buf->dma_addr; | |
| 88 | − end_addr = buf->dma_addr + buf->size; | |
| 89 | − | |
| 90 | − buf->pages = kzalloc(sizeof(struct page) * npages, GFP_KERNEL); | |
| 91 | − if (!buf->pages) { | |
| 92 | − DRM_ERROR("failed to allocate pages.\n"); | |
| 93 | − ret = -ENOMEM; | |
| 94 | − goto err2; | |
| 95 | − } | |
| 96 | − | |
| 97 | − start_addr = buf->dma_addr; | |
| 98 | − end_addr = buf->dma_addr + buf->size; | |
| 79 | + buf->kvaddr = dma_alloc_writecombine(dev->dev, buf->size, | |
| 80 | + &buf->dma_addr, GFP_KERNEL); | |
| 81 | + if (!buf->kvaddr) { | |
| 82 | + DRM_ERROR("failed to allocate buffer.\n"); | |
| 83 | + ret = -ENOMEM; | |
| 84 | + goto err1; | |
| 85 | + } | |
| 99 | 86 | |
| 100 | 87 | buf->pages = kzalloc(sizeof(struct page) * npages, GFP_KERNEL); |
| 101 | 88 | if (!buf->pages) { |
| @@ -105,23 +92,17 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, · 3 unmodified lines | ||
| 105 | 92 | } |
| 106 | 93 | |
| 107 | 94 | sgl = buf->sgt->sgl; |
| 95 | + start_addr = buf->dma_addr; | |
| 108 | 96 | |
| 109 | 97 | while (i < npages) { |
| 110 | 98 | buf->pages[i] = phys_to_page(start_addr); |
| 111 | 99 | sg_set_page(sgl, buf->pages[i], page_size, 0); |
| 112 | 100 | sg_dma_address(sgl) = start_addr; |
| 113 | 101 | start_addr += page_size; |
| 114 | − if (end_addr - start_addr < page_size) | |
| 115 | − break; | |
| 116 | 102 | sgl = sg_next(sgl); |
| 117 | 103 | i++; |
| 118 | 104 | } |
| 119 | 105 | |
| 120 | − buf->pages[i] = phys_to_page(start_addr); | |
| 121 | − | |
| 122 | − sgl = sg_next(sgl); | |
| 123 | − sg_set_page(sgl, buf->pages[i+1], end_addr - start_addr, 0); | |
| 124 | − | |
| 125 | 106 | DRM_DEBUG_KMS("vaddr(0x%lx), dma_addr(0x%lx), size(0x%lx)\n", |
| 126 | 107 | (unsigned long)buf->kvaddr, |
| 127 | 108 | (unsigned long)buf->dma_addr, |
| @@ -150,7 +131,7 @@ static void lowlevel_buffer_deallocate(struct drm_device *dev, · 22 unmodified lines | ||
| 150 | 131 | * non-continuous memory would be released by exynos |
| 151 | 132 | * gem framework. |
| 152 | 133 | */ |
| 153 | − if (flags & EXYNOS_BO_NONCONTIG) { | |
| 134 | + if (IS_NONCONTIG_BUFFER(flags)) { | |
| 154 | 135 | DRM_DEBUG_KMS("not support allocation type.\n"); |
| 155 | 136 | return; |
| 156 | 137 | } |
| @@ -54,16 +54,18 @@ static int exynos_drm_subdrv_probe(struct drm_device *dev, · 53 unmodified lines | ||
| 54 | 54 | * |
| 55 | 55 | * P.S. note that this driver is considered for modularization. |
| 56 | 56 | */ |
| 57 | − ret = subdrv->probe(dev, subdrv->manager.dev); | |
| 57 | + ret = subdrv->probe(dev, subdrv->dev); | |
| 58 | 58 | if (ret) |
| 59 | 59 | return ret; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | − if (subdrv->is_local) | |
| 62 | + if (!subdrv->manager) | |
| 63 | 63 | return 0; |
| 64 | 64 | |
| 65 | + subdrv->manager->dev = subdrv->dev; | |
| 66 | + | |
| 65 | 67 | /* create and initialize a encoder for this sub driver. */ |
| 66 | − encoder = exynos_drm_encoder_create(dev, &subdrv->manager, | |
| 68 | + encoder = exynos_drm_encoder_create(dev, subdrv->manager, | |
| 67 | 69 | (1 << MAX_CRTC) - 1); |
| 68 | 70 | if (!encoder) { |
| 69 | 71 | DRM_ERROR("failed to create encoder\n"); |
| @@ -186,7 +188,7 @@ int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file) · 116 unmodified lines | ||
| 186 | 188 | |
| 187 | 189 | list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { |
| 188 | 190 | if (subdrv->open) { |
| 189 | − ret = subdrv->open(dev, subdrv->manager.dev, file); | |
| 191 | + ret = subdrv->open(dev, subdrv->dev, file); | |
| 190 | 192 | if (ret) |
| 191 | 193 | goto err; |
| 192 | 194 | } |
| @@ -197,7 +199,7 @@ int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file) · 4 unmodified lines | ||
| 197 | 199 | err: |
| 198 | 200 | list_for_each_entry_reverse(subdrv, &subdrv->list, list) { |
| 199 | 201 | if (subdrv->close) |
| 200 | − subdrv->close(dev, subdrv->manager.dev, file); | |
| 202 | + subdrv->close(dev, subdrv->dev, file); | |
| 201 | 203 | } |
| 202 | 204 | return ret; |
| 203 | 205 | } |
| @@ -209,7 +211,7 @@ void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file) · 5 unmodified lines | ||
| 209 | 211 | |
| 210 | 212 | list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { |
| 211 | 213 | if (subdrv->close) |
| 212 | − subdrv->close(dev, subdrv->manager.dev, file); | |
| 214 | + subdrv->close(dev, subdrv->dev, file); | |
| 213 | 215 | } |
| 214 | 216 | } |
| 215 | 217 | EXPORT_SYMBOL_GPL(exynos_drm_subdrv_close); |
| @@ -225,24 +225,25 @@ struct exynos_drm_private { · 224 unmodified lines | ||
| 225 | 225 | * Exynos drm sub driver structure. |
| 226 | 226 | * |
| 227 | 227 | * @list: sub driver has its own list object to register to exynos drm driver. |
| 228 | + * @dev: pointer to device object for subdrv device driver. | |
| 228 | 229 | * @drm_dev: pointer to drm_device and this pointer would be set |
| 229 | 230 | * when sub driver calls exynos_drm_subdrv_register(). |
| 230 | − * @is_local: appear encoder and connector disrelated device. | |
| 231 | + * @manager: subdrv has its own manager to control a hardware appropriately | |
| 232 | + * and we can access a hardware drawing on this manager. | |
| 231 | 233 | * @probe: this callback would be called by exynos drm driver after |
| 232 | 234 | * subdrv is registered to it. |
| 233 | 235 | * @remove: this callback is used to release resources created |
| 234 | 236 | * by probe callback. |
| 235 | 237 | * @open: this would be called with drm device file open. |
| 236 | 238 | * @close: this would be called with drm device file close. |
| 237 | − * @manager: subdrv has its own manager to control a hardware appropriately | |
| 238 | − * and we can access a hardware drawing on this manager. | |
| 239 | 239 | * @encoder: encoder object owned by this sub driver. |
| 240 | 240 | * @connector: connector object owned by this sub driver. |
| 241 | 241 | */ |
| 242 | 242 | struct exynos_drm_subdrv { |
| 243 | 243 | struct list_head list; |
| 244 | + struct device *dev; | |
| 244 | 245 | struct drm_device *drm_dev; |
| 245 | − bool is_local; | |
| 246 | + struct exynos_drm_manager *manager; | |
| 246 | 247 | |
| 247 | 248 | int (*probe)(struct drm_device *drm_dev, struct device *dev); |
| 248 | 249 | void (*remove)(struct drm_device *dev); |
| @@ -251,7 +252,6 @@ struct exynos_drm_subdrv { · 2 unmodified lines | ||
| 251 | 252 | void (*close)(struct drm_device *drm_dev, struct device *dev, |
| 252 | 253 | struct drm_file *file); |
| 253 | 254 | |
| 254 | − struct exynos_drm_manager manager; | |
| 255 | 255 | struct drm_encoder *encoder; |
| 256 | 256 | struct drm_connector *connector; |
| 257 | 257 | }; |
| @@ -172,7 +172,7 @@ static void fimd_dpms(struct device *subdrv_dev, int mode) · 171 unmodified lines | ||
| 172 | 172 | static void fimd_apply(struct device *subdrv_dev) |
| 173 | 173 | { |
| 174 | 174 | struct fimd_context *ctx = get_fimd_context(subdrv_dev); |
| 175 | − struct exynos_drm_manager *mgr = &ctx->subdrv.manager; | |
| 175 | + struct exynos_drm_manager *mgr = ctx->subdrv.manager; | |
| 176 | 176 | struct exynos_drm_manager_ops *mgr_ops = mgr->ops; |
| 177 | 177 | struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops; |
| 178 | 178 | struct fimd_win_data *win_data; |
| @@ -577,6 +577,13 @@ static struct exynos_drm_overlay_ops fimd_overlay_ops = { · 398 unmodified lines | ||
| 577 | 577 | .disable = fimd_win_disable, |
| 578 | 578 | }; |
| 579 | 579 | |
| 580 | +static struct exynos_drm_manager fimd_manager = { | |
| 581 | + .pipe = -1, | |
| 582 | + .ops = &fimd_manager_ops, | |
| 583 | + .overlay_ops = &fimd_overlay_ops, | |
| 584 | + .display_ops = &fimd_display_ops, | |
| 585 | +}; | |
| 586 | + | |
| 580 | 587 | static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc) |
| 581 | 588 | { |
| 582 | 589 | struct exynos_drm_private *dev_priv = drm_dev->dev_private; |
| @@ -628,7 +635,7 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id) · 45 unmodified lines | ||
| 628 | 635 | struct fimd_context *ctx = (struct fimd_context *)dev_id; |
| 629 | 636 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
| 630 | 637 | struct drm_device *drm_dev = subdrv->drm_dev; |
| 631 | − struct exynos_drm_manager *manager = &subdrv->manager; | |
| 638 | + struct exynos_drm_manager *manager = subdrv->manager; | |
| 632 | 639 | u32 val; |
| 633 | 640 | |
| 634 | 641 | val = readl(ctx->regs + VIDINTCON1); |
| @@ -744,7 +751,7 @@ static void fimd_clear_win(struct fimd_context *ctx, int win) · 109 unmodified lines | ||
| 744 | 751 | static int fimd_power_on(struct fimd_context *ctx, bool enable) |
| 745 | 752 | { |
| 746 | 753 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
| 747 | − struct device *dev = subdrv->manager.dev; | |
| 754 | + struct device *dev = subdrv->dev; | |
| 748 | 755 | |
| 749 | 756 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 750 | 757 | |
| @@ -867,13 +874,10 @@ static int __devinit fimd_probe(struct platform_device *pdev) · 116 unmodified lines | ||
| 867 | 874 | |
| 868 | 875 | subdrv = &ctx->subdrv; |
| 869 | 876 | |
| 877 | + subdrv->dev = dev; | |
| 878 | + subdrv->manager = &fimd_manager; | |
| 870 | 879 | subdrv->probe = fimd_subdrv_probe; |
| 871 | 880 | subdrv->remove = fimd_subdrv_remove; |
| 872 | − subdrv->manager.pipe = -1; | |
| 873 | − subdrv->manager.ops = &fimd_manager_ops; | |
| 874 | − subdrv->manager.overlay_ops = &fimd_overlay_ops; | |
| 875 | − subdrv->manager.display_ops = &fimd_display_ops; | |
| 876 | − subdrv->manager.dev = dev; | |
| 877 | 881 | |
| 878 | 882 | mutex_init(&ctx->lock); |
| 879 | 883 | |
| @@ -56,9 +56,28 @@ static unsigned int convert_to_vm_err_msg(int msg) · 55 unmodified lines | ||
| 56 | 56 | return out_msg; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | −static unsigned int mask_gem_flags(unsigned int flags) | |
| 59 | +static int check_gem_flags(unsigned int flags) | |
| 60 | 60 | { |
| 61 | − return flags &= EXYNOS_BO_NONCONTIG; | |
| 61 | + if (flags & ~(EXYNOS_BO_MASK)) { | |
| 62 | + DRM_ERROR("invalid flags.\n"); | |
| 63 | + return -EINVAL; | |
| 64 | + } | |
| 65 | + | |
| 66 | + return 0; | |
| 67 | +} | |
| 68 | + | |
| 69 | +static unsigned long roundup_gem_size(unsigned long size, unsigned int flags) | |
| 70 | +{ | |
| 71 | + if (!IS_NONCONTIG_BUFFER(flags)) { | |
| 72 | + if (size >= SZ_1M) | |
| 73 | + return roundup(size, SECTION_SIZE); | |
| 74 | + else if (size >= SZ_64K) | |
| 75 | + return roundup(size, SZ_64K); | |
| 76 | + else | |
| 77 | + goto out; | |
| 78 | + } | |
| 79 | +out: | |
| 80 | + return roundup(size, PAGE_SIZE); | |
| 62 | 81 | } |
| 63 | 82 | |
| 64 | 83 | static struct page **exynos_gem_get_pages(struct drm_gem_object *obj, |
| @@ -319,10 +338,17 @@ struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_device *dev, · 254 unmodified lines | ||
| 319 | 338 | struct exynos_drm_gem_buf *buf; |
| 320 | 339 | int ret; |
| 321 | 340 | |
| 322 | − size = roundup(size, PAGE_SIZE); | |
| 323 | − DRM_DEBUG_KMS("%s: size = 0x%lx\n", __FILE__, size); | |
| 341 | + if (!size) { | |
| 342 | + DRM_ERROR("invalid size.\n"); | |
| 343 | + return ERR_PTR(-EINVAL); | |
| 344 | + } | |
| 324 | 345 | |
| 325 | − flags = mask_gem_flags(flags); | |
| 346 | + size = roundup_gem_size(size, flags); | |
| 347 | + DRM_DEBUG_KMS("%s\n", __FILE__); | |
| 348 | + | |
| 349 | + ret = check_gem_flags(flags); | |
| 350 | + if (ret) | |
| 351 | + return ERR_PTR(ret); | |
| 326 | 352 | |
| 327 | 353 | buf = exynos_drm_init_buf(dev, size); |
| 328 | 354 | if (!buf) |
| @@ -331,7 +357,7 @@ struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_device *dev, · 2 unmodified lines | ||
| 331 | 357 | exynos_gem_obj = exynos_drm_gem_init(dev, size); |
| 332 | 358 | if (!exynos_gem_obj) { |
| 333 | 359 | ret = -ENOMEM; |
| 334 | − goto err; | |
| 360 | + goto err_fini_buf; | |
| 335 | 361 | } |
| 336 | 362 | |
| 337 | 363 | exynos_gem_obj->buffer = buf; |
| @@ -347,18 +373,19 @@ struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_device *dev, · 9 unmodified lines | ||
| 347 | 373 | ret = exynos_drm_gem_get_pages(&exynos_gem_obj->base); |
| 348 | 374 | if (ret < 0) { |
| 349 | 375 | drm_gem_object_release(&exynos_gem_obj->base); |
| 350 | − goto err; | |
| 376 | + goto err_fini_buf; | |
| 351 | 377 | } |
| 352 | 378 | } else { |
| 353 | 379 | ret = exynos_drm_alloc_buf(dev, buf, flags); |
| 354 | 380 | if (ret < 0) { |
| 355 | 381 | drm_gem_object_release(&exynos_gem_obj->base); |
| 356 | − goto err; | |
| 382 | + goto err_fini_buf; | |
| 357 | 383 | } |
| 358 | 384 | } |
| 359 | 385 | |
| 360 | 386 | return exynos_gem_obj; |
| 361 | −err: | |
| 387 | + | |
| 388 | +err_fini_buf: | |
| 362 | 389 | exynos_drm_fini_buf(dev, buf); |
| 363 | 390 | return ERR_PTR(ret); |
| 364 | 391 | } |
| @@ -29,6 +29,8 @@ · 28 unmodified lines | ||
| 29 | 29 | #define to_exynos_gem_obj(x) container_of(x,\ |
| 30 | 30 | struct exynos_drm_gem_obj, base) |
| 31 | 31 | |
| 32 | +#define IS_NONCONTIG_BUFFER(f) (f & EXYNOS_BO_NONCONTIG) | |
| 33 | + | |
| 32 | 34 | /* |
| 33 | 35 | * exynos drm gem buffer structure. |
| 34 | 36 | * |
| @@ -30,9 +30,8 @@ · 29 unmodified lines | ||
| 30 | 30 | struct drm_hdmi_context, subdrv); |
| 31 | 31 | |
| 32 | 32 | /* these callback points shoud be set by specific drivers. */ |
| 33 | −static struct exynos_hdmi_display_ops *hdmi_display_ops; | |
| 34 | −static struct exynos_hdmi_manager_ops *hdmi_manager_ops; | |
| 35 | −static struct exynos_hdmi_overlay_ops *hdmi_overlay_ops; | |
| 33 | +static struct exynos_hdmi_ops *hdmi_ops; | |
| 34 | +static struct exynos_mixer_ops *mixer_ops; | |
| 36 | 35 | |
| 37 | 36 | struct drm_hdmi_context { |
| 38 | 37 | struct exynos_drm_subdrv subdrv; |
| @@ -40,31 +39,20 @@ struct drm_hdmi_context { · 1 unmodified line | ||
| 40 | 39 | struct exynos_drm_hdmi_context *mixer_ctx; |
| 41 | 40 | }; |
| 42 | 41 | |
| 43 | −void exynos_drm_display_ops_register(struct exynos_hdmi_display_ops | |
| 44 | − *display_ops) | |
| 42 | +void exynos_hdmi_ops_register(struct exynos_hdmi_ops *ops) | |
| 45 | 43 | { |
| 46 | 44 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 47 | 45 | |
| 48 | − if (display_ops) | |
| 49 | − hdmi_display_ops = display_ops; | |
| 46 | + if (ops) | |
| 47 | + hdmi_ops = ops; | |
| 50 | 48 | } |
| 51 | 49 | |
| 52 | −void exynos_drm_manager_ops_register(struct exynos_hdmi_manager_ops | |
| 53 | − *manager_ops) | |
| 50 | +void exynos_mixer_ops_register(struct exynos_mixer_ops *ops) | |
| 54 | 51 | { |
| 55 | 52 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 56 | 53 | |
| 57 | − if (manager_ops) | |
| 58 | − hdmi_manager_ops = manager_ops; | |
| 59 | −} | |
| 60 | − | |
| 61 | −void exynos_drm_overlay_ops_register(struct exynos_hdmi_overlay_ops | |
| 62 | − *overlay_ops) | |
| 63 | −{ | |
| 64 | − DRM_DEBUG_KMS("%s\n", __FILE__); | |
| 65 | − | |
| 66 | − if (overlay_ops) | |
| 67 | − hdmi_overlay_ops = overlay_ops; | |
| 54 | + if (ops) | |
| 55 | + mixer_ops = ops; | |
| 68 | 56 | } |
| 69 | 57 | |
| 70 | 58 | static bool drm_hdmi_is_connected(struct device *dev) |
| @@ -73,8 +61,8 @@ static bool drm_hdmi_is_connected(struct device *dev) · 2 unmodified lines | ||
| 73 | 61 | |
| 74 | 62 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 75 | 63 | |
| 76 | − if (hdmi_display_ops && hdmi_display_ops->is_connected) | |
| 77 | − return hdmi_display_ops->is_connected(ctx->hdmi_ctx->ctx); | |
| 64 | + if (hdmi_ops && hdmi_ops->is_connected) | |
| 65 | + return hdmi_ops->is_connected(ctx->hdmi_ctx->ctx); | |
| 78 | 66 | |
| 79 | 67 | return false; |
| 80 | 68 | } |
| @@ -86,9 +74,9 @@ static int drm_hdmi_get_edid(struct device *dev, · 5 unmodified lines | ||
| 86 | 74 | |
| 87 | 75 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 88 | 76 | |
| 89 | − if (hdmi_display_ops && hdmi_display_ops->get_edid) | |
| 90 | − return hdmi_display_ops->get_edid(ctx->hdmi_ctx->ctx, | |
| 91 | − connector, edid, len); | |
| 77 | + if (hdmi_ops && hdmi_ops->get_edid) | |
| 78 | + return hdmi_ops->get_edid(ctx->hdmi_ctx->ctx, connector, edid, | |
| 79 | + len); | |
| 92 | 80 | |
| 93 | 81 | return 0; |
| 94 | 82 | } |
| @@ -99,9 +87,8 @@ static int drm_hdmi_check_timing(struct device *dev, void *timing) · 4 unmodified lines | ||
| 99 | 87 | |
| 100 | 88 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 101 | 89 | |
| 102 | − if (hdmi_display_ops && hdmi_display_ops->check_timing) | |
| 103 | − return hdmi_display_ops->check_timing(ctx->hdmi_ctx->ctx, | |
| 104 | − timing); | |
| 90 | + if (hdmi_ops && hdmi_ops->check_timing) | |
| 91 | + return hdmi_ops->check_timing(ctx->hdmi_ctx->ctx, timing); | |
| 105 | 92 | |
| 106 | 93 | return 0; |
| 107 | 94 | } |
| @@ -112,8 +99,8 @@ static int drm_hdmi_power_on(struct device *dev, int mode) · 4 unmodified lines | ||
| 112 | 99 | |
| 113 | 100 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 114 | 101 | |
| 115 | − if (hdmi_display_ops && hdmi_display_ops->power_on) | |
| 116 | − return hdmi_display_ops->power_on(ctx->hdmi_ctx->ctx, mode); | |
| 102 | + if (hdmi_ops && hdmi_ops->power_on) | |
| 103 | + return hdmi_ops->power_on(ctx->hdmi_ctx->ctx, mode); | |
| 117 | 104 | |
| 118 | 105 | return 0; |
| 119 | 106 | } |
| @@ -130,13 +117,13 @@ static int drm_hdmi_enable_vblank(struct device *subdrv_dev) · 10 unmodified lines | ||
| 130 | 117 | { |
| 131 | 118 | struct drm_hdmi_context *ctx = to_context(subdrv_dev); |
| 132 | 119 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
| 133 | − struct exynos_drm_manager *manager = &subdrv->manager; | |
| 120 | + struct exynos_drm_manager *manager = subdrv->manager; | |
| 134 | 121 | |
| 135 | 122 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 136 | 123 | |
| 137 | − if (hdmi_overlay_ops && hdmi_overlay_ops->enable_vblank) | |
| 138 | − return hdmi_overlay_ops->enable_vblank(ctx->mixer_ctx->ctx, | |
| 139 | − manager->pipe); | |
| 124 | + if (mixer_ops && mixer_ops->enable_vblank) | |
| 125 | + return mixer_ops->enable_vblank(ctx->mixer_ctx->ctx, | |
| 126 | + manager->pipe); | |
| 140 | 127 | |
| 141 | 128 | return 0; |
| 142 | 129 | } |
| @@ -147,8 +134,8 @@ static void drm_hdmi_disable_vblank(struct device *subdrv_dev) · 4 unmodified lines | ||
| 147 | 134 | |
| 148 | 135 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 149 | 136 | |
| 150 | − if (hdmi_overlay_ops && hdmi_overlay_ops->disable_vblank) | |
| 151 | − return hdmi_overlay_ops->disable_vblank(ctx->mixer_ctx->ctx); | |
| 137 | + if (mixer_ops && mixer_ops->disable_vblank) | |
| 138 | + return mixer_ops->disable_vblank(ctx->mixer_ctx->ctx); | |
| 152 | 139 | } |
| 153 | 140 | |
| 154 | 141 | static void drm_hdmi_mode_fixup(struct device *subdrv_dev, |
| @@ -160,9 +147,9 @@ static void drm_hdmi_mode_fixup(struct device *subdrv_dev, · 5 unmodified lines | ||
| 160 | 147 | |
| 161 | 148 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 162 | 149 | |
| 163 | − if (hdmi_manager_ops && hdmi_manager_ops->mode_fixup) | |
| 164 | − hdmi_manager_ops->mode_fixup(ctx->hdmi_ctx->ctx, connector, | |
| 165 | − mode, adjusted_mode); | |
| 150 | + if (hdmi_ops && hdmi_ops->mode_fixup) | |
| 151 | + hdmi_ops->mode_fixup(ctx->hdmi_ctx->ctx, connector, mode, | |
| 152 | + adjusted_mode); | |
| 166 | 153 | } |
| 167 | 154 | |
| 168 | 155 | static void drm_hdmi_mode_set(struct device *subdrv_dev, void *mode) |
| @@ -171,8 +158,8 @@ static void drm_hdmi_mode_set(struct device *subdrv_dev, void *mode) · 2 unmodified lines | ||
| 171 | 158 | |
| 172 | 159 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 173 | 160 | |
| 174 | − if (hdmi_manager_ops && hdmi_manager_ops->mode_set) | |
| 175 | − hdmi_manager_ops->mode_set(ctx->hdmi_ctx->ctx, mode); | |
| 161 | + if (hdmi_ops && hdmi_ops->mode_set) | |
| 162 | + hdmi_ops->mode_set(ctx->hdmi_ctx->ctx, mode); | |
| 176 | 163 | } |
| 177 | 164 | |
| 178 | 165 | static void drm_hdmi_get_max_resol(struct device *subdrv_dev, |
| @@ -182,9 +169,8 @@ static void drm_hdmi_get_max_resol(struct device *subdrv_dev, · 3 unmodified lines | ||
| 182 | 169 | |
| 183 | 170 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 184 | 171 | |
| 185 | − if (hdmi_manager_ops && hdmi_manager_ops->get_max_resol) | |
| 186 | − hdmi_manager_ops->get_max_resol(ctx->hdmi_ctx->ctx, width, | |
| 187 | − height); | |
| 172 | + if (hdmi_ops && hdmi_ops->get_max_resol) | |
| 173 | + hdmi_ops->get_max_resol(ctx->hdmi_ctx->ctx, width, height); | |
| 188 | 174 | } |
| 189 | 175 | |
| 190 | 176 | static void drm_hdmi_commit(struct device *subdrv_dev) |
| @@ -193,8 +179,8 @@ static void drm_hdmi_commit(struct device *subdrv_dev) · 2 unmodified lines | ||
| 193 | 179 | |
| 194 | 180 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 195 | 181 | |
| 196 | − if (hdmi_manager_ops && hdmi_manager_ops->commit) | |
| 197 | − hdmi_manager_ops->commit(ctx->hdmi_ctx->ctx); | |
| 182 | + if (hdmi_ops && hdmi_ops->commit) | |
| 183 | + hdmi_ops->commit(ctx->hdmi_ctx->ctx); | |
| 198 | 184 | } |
| 199 | 185 | |
| 200 | 186 | static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) |
| @@ -209,8 +195,8 @@ static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) · 8 unmodified lines | ||
| 209 | 195 | case DRM_MODE_DPMS_STANDBY: |
| 210 | 196 | case DRM_MODE_DPMS_SUSPEND: |
| 211 | 197 | case DRM_MODE_DPMS_OFF: |
| 212 | − if (hdmi_manager_ops && hdmi_manager_ops->disable) | |
| 213 | − hdmi_manager_ops->disable(ctx->hdmi_ctx->ctx); | |
| 198 | + if (hdmi_ops && hdmi_ops->disable) | |
| 199 | + hdmi_ops->disable(ctx->hdmi_ctx->ctx); | |
| 214 | 200 | break; |
| 215 | 201 | default: |
| 216 | 202 | DRM_DEBUG_KMS("unkown dps mode: %d\n", mode); |
| @@ -235,8 +221,8 @@ static void drm_mixer_mode_set(struct device *subdrv_dev, · 18 unmodified lines | ||
| 235 | 221 | |
| 236 | 222 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 237 | 223 | |
| 238 | − if (hdmi_overlay_ops && hdmi_overlay_ops->win_mode_set) | |
| 239 | − hdmi_overlay_ops->win_mode_set(ctx->mixer_ctx->ctx, overlay); | |
| 224 | + if (mixer_ops && mixer_ops->win_mode_set) | |
| 225 | + mixer_ops->win_mode_set(ctx->mixer_ctx->ctx, overlay); | |
| 240 | 226 | } |
| 241 | 227 | |
| 242 | 228 | static void drm_mixer_commit(struct device *subdrv_dev, int zpos) |
| @@ -245,8 +231,8 @@ static void drm_mixer_commit(struct device *subdrv_dev, int zpos) · 2 unmodified lines | ||
| 245 | 231 | |
| 246 | 232 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 247 | 233 | |
| 248 | − if (hdmi_overlay_ops && hdmi_overlay_ops->win_commit) | |
| 249 | − hdmi_overlay_ops->win_commit(ctx->mixer_ctx->ctx, zpos); | |
| 234 | + if (mixer_ops && mixer_ops->win_commit) | |
| 235 | + mixer_ops->win_commit(ctx->mixer_ctx->ctx, zpos); | |
| 250 | 236 | } |
| 251 | 237 | |
| 252 | 238 | static void drm_mixer_disable(struct device *subdrv_dev, int zpos) |
| @@ -255,8 +241,8 @@ static void drm_mixer_disable(struct device *subdrv_dev, int zpos) · 2 unmodified lines | ||
| 255 | 241 | |
| 256 | 242 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 257 | 243 | |
| 258 | − if (hdmi_overlay_ops && hdmi_overlay_ops->win_disable) | |
| 259 | − hdmi_overlay_ops->win_disable(ctx->mixer_ctx->ctx, zpos); | |
| 244 | + if (mixer_ops && mixer_ops->win_disable) | |
| 245 | + mixer_ops->win_disable(ctx->mixer_ctx->ctx, zpos); | |
| 260 | 246 | } |
| 261 | 247 | |
| 262 | 248 | static struct exynos_drm_overlay_ops drm_hdmi_overlay_ops = { |
| @@ -265,6 +251,12 @@ static struct exynos_drm_overlay_ops drm_hdmi_overlay_ops = { · 2 unmodified lines | ||
| 265 | 251 | .disable = drm_mixer_disable, |
| 266 | 252 | }; |
| 267 | 253 | |
| 254 | +static struct exynos_drm_manager hdmi_manager = { | |
| 255 | + .pipe = -1, | |
| 256 | + .ops = &drm_hdmi_manager_ops, | |
| 257 | + .overlay_ops = &drm_hdmi_overlay_ops, | |
| 258 | + .display_ops = &drm_hdmi_display_ops, | |
| 259 | +}; | |
| 268 | 260 | |
| 269 | 261 | static int hdmi_subdrv_probe(struct drm_device *drm_dev, |
| 270 | 262 | struct device *dev) |
| @@ -332,12 +324,9 @@ static int __devinit exynos_drm_hdmi_probe(struct platform_device *pdev) · 61 unmodified lines | ||
| 332 | 324 | |
| 333 | 325 | subdrv = &ctx->subdrv; |
| 334 | 326 | |
| 327 | + subdrv->dev = dev; | |
| 328 | + subdrv->manager = &hdmi_manager; | |
| 335 | 329 | subdrv->probe = hdmi_subdrv_probe; |
| 336 | − subdrv->manager.pipe = -1; | |
| 337 | − subdrv->manager.ops = &drm_hdmi_manager_ops; | |
| 338 | − subdrv->manager.overlay_ops = &drm_hdmi_overlay_ops; | |
| 339 | − subdrv->manager.display_ops = &drm_hdmi_display_ops; | |
| 340 | − subdrv->manager.dev = dev; | |
| 341 | 330 | |
| 342 | 331 | platform_set_drvdata(pdev, subdrv); |
| 343 | 332 | |
| @@ -38,15 +38,15 @@ struct exynos_drm_hdmi_context { · 37 unmodified lines | ||
| 38 | 38 | void *ctx; |
| 39 | 39 | }; |
| 40 | 40 | |
| 41 | −struct exynos_hdmi_display_ops { | |
| 41 | +struct exynos_hdmi_ops { | |
| 42 | + /* display */ | |
| 42 | 43 | bool (*is_connected)(void *ctx); |
| 43 | 44 | int (*get_edid)(void *ctx, struct drm_connector *connector, |
| 44 | 45 | u8 *edid, int len); |
| 45 | 46 | int (*check_timing)(void *ctx, void *timing); |
| 46 | 47 | int (*power_on)(void *ctx, int mode); |
| 47 | −}; | |
| 48 | 48 | |
| 49 | −struct exynos_hdmi_manager_ops { | |
| 49 | + /* manager */ | |
| 50 | 50 | void (*mode_fixup)(void *ctx, struct drm_connector *connector, |
| 51 | 51 | struct drm_display_mode *mode, |
| 52 | 52 | struct drm_display_mode *adjusted_mode); |
| @@ -57,22 +57,17 @@ struct exynos_hdmi_manager_ops { · 4 unmodified lines | ||
| 57 | 57 | void (*disable)(void *ctx); |
| 58 | 58 | }; |
| 59 | 59 | |
| 60 | −struct exynos_hdmi_overlay_ops { | |
| 60 | +struct exynos_mixer_ops { | |
| 61 | + /* manager */ | |
| 61 | 62 | int (*enable_vblank)(void *ctx, int pipe); |
| 62 | 63 | void (*disable_vblank)(void *ctx); |
| 64 | + | |
| 65 | + /* overlay */ | |
| 63 | 66 | void (*win_mode_set)(void *ctx, struct exynos_drm_overlay *overlay); |
| 64 | 67 | void (*win_commit)(void *ctx, int zpos); |
| 65 | 68 | void (*win_disable)(void *ctx, int zpos); |
| 66 | 69 | }; |
| 67 | 70 | |
| 68 | −extern struct platform_driver hdmi_driver; | |
| 69 | −extern struct platform_driver mixer_driver; | |
| 70 | − | |
| 71 | −void exynos_drm_display_ops_register(struct exynos_hdmi_display_ops | |
| 72 | − *display_ops); | |
| 73 | −void exynos_drm_manager_ops_register(struct exynos_hdmi_manager_ops | |
| 74 | − *manager_ops); | |
| 75 | −void exynos_drm_overlay_ops_register(struct exynos_hdmi_overlay_ops | |
| 76 | − *overlay_ops); | |
| 77 | − | |
| 71 | +void exynos_hdmi_ops_register(struct exynos_hdmi_ops *ops); | |
| 72 | +void exynos_mixer_ops_register(struct exynos_mixer_ops *ops); | |
| 78 | 73 | #endif |
| @@ -24,6 +24,10 @@ struct exynos_plane { · 23 unmodified lines | ||
| 24 | 24 | |
| 25 | 25 | static const uint32_t formats[] = { |
| 26 | 26 | DRM_FORMAT_XRGB8888, |
| 27 | + DRM_FORMAT_ARGB8888, | |
| 28 | + DRM_FORMAT_NV12, | |
| 29 | + DRM_FORMAT_NV12M, | |
| 30 | + DRM_FORMAT_NV12MT, | |
| 27 | 31 | }; |
| 28 | 32 | |
| 29 | 33 | static int |
| @@ -199,7 +199,7 @@ static void vidi_dpms(struct device *subdrv_dev, int mode) · 198 unmodified lines | ||
| 199 | 199 | static void vidi_apply(struct device *subdrv_dev) |
| 200 | 200 | { |
| 201 | 201 | struct vidi_context *ctx = get_vidi_context(subdrv_dev); |
| 202 | − struct exynos_drm_manager *mgr = &ctx->subdrv.manager; | |
| 202 | + struct exynos_drm_manager *mgr = ctx->subdrv.manager; | |
| 203 | 203 | struct exynos_drm_manager_ops *mgr_ops = mgr->ops; |
| 204 | 204 | struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops; |
| 205 | 205 | struct vidi_win_data *win_data; |
| @@ -374,6 +374,13 @@ static struct exynos_drm_overlay_ops vidi_overlay_ops = { · 168 unmodified lines | ||
| 374 | 374 | .disable = vidi_win_disable, |
| 375 | 375 | }; |
| 376 | 376 | |
| 377 | +static struct exynos_drm_manager vidi_manager = { | |
| 378 | + .pipe = -1, | |
| 379 | + .ops = &vidi_manager_ops, | |
| 380 | + .overlay_ops = &vidi_overlay_ops, | |
| 381 | + .display_ops = &vidi_display_ops, | |
| 382 | +}; | |
| 383 | + | |
| 377 | 384 | static void vidi_finish_pageflip(struct drm_device *drm_dev, int crtc) |
| 378 | 385 | { |
| 379 | 386 | struct exynos_drm_private *dev_priv = drm_dev->dev_private; |
| @@ -425,7 +432,7 @@ static void vidi_fake_vblank_handler(struct work_struct *work) · 45 unmodified lines | ||
| 425 | 432 | struct vidi_context *ctx = container_of(work, struct vidi_context, |
| 426 | 433 | work); |
| 427 | 434 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
| 428 | − struct exynos_drm_manager *manager = &subdrv->manager; | |
| 435 | + struct exynos_drm_manager *manager = subdrv->manager; | |
| 429 | 436 | |
| 430 | 437 | if (manager->pipe < 0) |
| 431 | 438 | return; |
| @@ -471,7 +478,7 @@ static void vidi_subdrv_remove(struct drm_device *drm_dev) · 39 unmodified lines | ||
| 471 | 478 | static int vidi_power_on(struct vidi_context *ctx, bool enable) |
| 472 | 479 | { |
| 473 | 480 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
| 474 | − struct device *dev = subdrv->manager.dev; | |
| 481 | + struct device *dev = subdrv->dev; | |
| 475 | 482 | |
| 476 | 483 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 477 | 484 | |
| @@ -611,13 +618,10 @@ static int __devinit vidi_probe(struct platform_device *pdev) · 133 unmodified lines | ||
| 611 | 618 | ctx->raw_edid = (struct edid *)fake_edid_info; |
| 612 | 619 | |
| 613 | 620 | subdrv = &ctx->subdrv; |
| 621 | + subdrv->dev = dev; | |
| 622 | + subdrv->manager = &vidi_manager; | |
| 614 | 623 | subdrv->probe = vidi_subdrv_probe; |
| 615 | 624 | subdrv->remove = vidi_subdrv_remove; |
| 616 | − subdrv->manager.pipe = -1; | |
| 617 | − subdrv->manager.ops = &vidi_manager_ops; | |
| 618 | − subdrv->manager.overlay_ops = &vidi_overlay_ops; | |
| 619 | − subdrv->manager.display_ops = &vidi_display_ops; | |
| 620 | − subdrv->manager.dev = dev; | |
| 621 | 625 | |
| 622 | 626 | mutex_init(&ctx->lock); |
| 623 | 627 | |
| @@ -40,7 +40,6 @@ · 39 unmodified lines | ||
| 40 | 40 | |
| 41 | 41 | #include "exynos_hdmi.h" |
| 42 | 42 | |
| 43 | −#define HDMI_OVERLAY_NUMBER 3 | |
| 44 | 43 | #define MAX_WIDTH 1920 |
| 45 | 44 | #define MAX_HEIGHT 1080 |
| 46 | 45 | #define get_hdmi_context(dev) platform_get_drvdata(to_platform_device(dev)) |
| @@ -1194,7 +1193,7 @@ static int hdmi_conf_index(struct hdmi_context *hdata, · 1147 unmodified lines | ||
| 1194 | 1193 | |
| 1195 | 1194 | static bool hdmi_is_connected(void *ctx) |
| 1196 | 1195 | { |
| 1197 | − struct hdmi_context *hdata = (struct hdmi_context *)ctx; | |
| 1196 | + struct hdmi_context *hdata = ctx; | |
| 1198 | 1197 | u32 val = hdmi_reg_read(hdata, HDMI_HPD_STATUS); |
| 1199 | 1198 | |
| 1200 | 1199 | if (val) |
| @@ -1207,7 +1206,7 @@ static int hdmi_get_edid(void *ctx, struct drm_connector *connector, · 6 unmodified lines | ||
| 1207 | 1206 | u8 *edid, int len) |
| 1208 | 1207 | { |
| 1209 | 1208 | struct edid *raw_edid; |
| 1210 | − struct hdmi_context *hdata = (struct hdmi_context *)ctx; | |
| 1209 | + struct hdmi_context *hdata = ctx; | |
| 1211 | 1210 | |
| 1212 | 1211 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
| 1213 | 1212 | |
| @@ -1275,7 +1274,7 @@ static int hdmi_v14_check_timing(struct fb_videomode *check_timing) · 61 unmodified lines | ||
| 1275 | 1274 | |
| 1276 | 1275 | static int hdmi_check_timing(void *ctx, void *timing) |
| 1277 | 1276 | { |
| 1278 | − struct hdmi_context *hdata = (struct hdmi_context *)ctx; | |
| 1277 | + struct hdmi_context *hdata = ctx; | |
| 1279 | 1278 | struct fb_videomode *check_timing = timing; |
| 1280 | 1279 | |
| 1281 | 1280 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
| @@ -1312,13 +1311,6 @@ static int hdmi_display_power_on(void *ctx, int mode) · 30 unmodified lines | ||
| 1312 | 1311 | return 0; |
| 1313 | 1312 | } |
| 1314 | 1313 | |
| 1315 | −static struct exynos_hdmi_display_ops display_ops = { | |
| 1316 | − .is_connected = hdmi_is_connected, | |
| 1317 | − .get_edid = hdmi_get_edid, | |
| 1318 | − .check_timing = hdmi_check_timing, | |
| 1319 | − .power_on = hdmi_display_power_on, | |
| 1320 | −}; | |
| 1321 | − | |
| 1322 | 1314 | static void hdmi_set_acr(u32 freq, u8 *acr) |
| 1323 | 1315 | { |
| 1324 | 1316 | u32 n, cts; |
| @@ -1914,7 +1906,7 @@ static void hdmi_mode_fixup(void *ctx, struct drm_connector *connector, · 589 unmodified lines | ||
| 1914 | 1906 | struct drm_display_mode *adjusted_mode) |
| 1915 | 1907 | { |
| 1916 | 1908 | struct drm_display_mode *m; |
| 1917 | − struct hdmi_context *hdata = (struct hdmi_context *)ctx; | |
| 1909 | + struct hdmi_context *hdata = ctx; | |
| 1918 | 1910 | int index; |
| 1919 | 1911 | |
| 1920 | 1912 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
| @@ -1951,7 +1943,7 @@ static void hdmi_mode_fixup(void *ctx, struct drm_connector *connector, · 30 unmodified lines | ||
| 1951 | 1943 | |
| 1952 | 1944 | static void hdmi_mode_set(void *ctx, void *mode) |
| 1953 | 1945 | { |
| 1954 | − struct hdmi_context *hdata = (struct hdmi_context *)ctx; | |
| 1946 | + struct hdmi_context *hdata = ctx; | |
| 1955 | 1947 | int conf_idx; |
| 1956 | 1948 | |
| 1957 | 1949 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
| @@ -1974,7 +1966,7 @@ static void hdmi_get_max_resol(void *ctx, unsigned int *width, · 16 unmodified lines | ||
| 1974 | 1966 | |
| 1975 | 1967 | static void hdmi_commit(void *ctx) |
| 1976 | 1968 | { |
| 1977 | − struct hdmi_context *hdata = (struct hdmi_context *)ctx; | |
| 1969 | + struct hdmi_context *hdata = ctx; | |
| 1978 | 1970 | |
| 1979 | 1971 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
| 1980 | 1972 | |
| @@ -1985,7 +1977,7 @@ static void hdmi_commit(void *ctx) · 4 unmodified lines | ||
| 1985 | 1977 | |
| 1986 | 1978 | static void hdmi_disable(void *ctx) |
| 1987 | 1979 | { |
| 1988 | − struct hdmi_context *hdata = (struct hdmi_context *)ctx; | |
| 1980 | + struct hdmi_context *hdata = ctx; | |
| 1989 | 1981 | |
| 1990 | 1982 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
| 1991 | 1983 | |
| @@ -1996,7 +1988,14 @@ static void hdmi_disable(void *ctx) · 4 unmodified lines | ||
| 1996 | 1988 | } |
| 1997 | 1989 | } |
| 1998 | 1990 | |
| 1999 | −static struct exynos_hdmi_manager_ops manager_ops = { | |
| 1991 | +static struct exynos_hdmi_ops hdmi_ops = { | |
| 1992 | + /* display */ | |
| 1993 | + .is_connected = hdmi_is_connected, | |
| 1994 | + .get_edid = hdmi_get_edid, | |
| 1995 | + .check_timing = hdmi_check_timing, | |
| 1996 | + .power_on = hdmi_display_power_on, | |
| 1997 | + | |
| 1998 | + /* manager */ | |
| 2000 | 1999 | .mode_fixup = hdmi_mode_fixup, |
| 2001 | 2000 | .mode_set = hdmi_mode_set, |
| 2002 | 2001 | .get_max_resol = hdmi_get_max_resol, |
| @@ -2020,7 +2019,7 @@ static void hdmi_hotplug_func(struct work_struct *work) · 17 unmodified lines | ||
| 2020 | 2019 | static irqreturn_t hdmi_irq_handler(int irq, void *arg) |
| 2021 | 2020 | { |
| 2022 | 2021 | struct exynos_drm_hdmi_context *ctx = arg; |
| 2023 | − struct hdmi_context *hdata = (struct hdmi_context *)ctx->ctx; | |
| 2022 | + struct hdmi_context *hdata = ctx->ctx; | |
| 2024 | 2023 | u32 intc_flag; |
| 2025 | 2024 | |
| 2026 | 2025 | intc_flag = hdmi_reg_read(hdata, HDMI_INTC_FLAG); |
| @@ -2173,7 +2172,7 @@ static int hdmi_runtime_suspend(struct device *dev) · 146 unmodified lines | ||
| 2173 | 2172 | |
| 2174 | 2173 | DRM_DEBUG_KMS("%s\n", __func__); |
| 2175 | 2174 | |
| 2176 | − hdmi_resource_poweroff((struct hdmi_context *)ctx->ctx); | |
| 2175 | + hdmi_resource_poweroff(ctx->ctx); | |
| 2177 | 2176 | |
| 2178 | 2177 | return 0; |
| 2179 | 2178 | } |
| @@ -2184,7 +2183,7 @@ static int hdmi_runtime_resume(struct device *dev) · 4 unmodified lines | ||
| 2184 | 2183 | |
| 2185 | 2184 | DRM_DEBUG_KMS("%s\n", __func__); |
| 2186 | 2185 | |
| 2187 | − hdmi_resource_poweron((struct hdmi_context *)ctx->ctx); | |
| 2186 | + hdmi_resource_poweron(ctx->ctx); | |
| 2188 | 2187 | |
| 2189 | 2188 | return 0; |
| 2190 | 2189 | } |
| @@ -2322,8 +2321,7 @@ static int __devinit hdmi_probe(struct platform_device *pdev) · 131 unmodified lines | ||
| 2322 | 2321 | hdata->irq = res->start; |
| 2323 | 2322 | |
| 2324 | 2323 | /* register specific callbacks to common hdmi. */ |
| 2325 | − exynos_drm_display_ops_register(&display_ops); | |
| 2326 | − exynos_drm_manager_ops_register(&manager_ops); | |
| 2324 | + exynos_hdmi_ops_register(&hdmi_ops); | |
| 2327 | 2325 | |
| 2328 | 2326 | hdmi_resource_poweron(hdata); |
| 2329 | 2327 | |
| @@ -2351,7 +2349,7 @@ err_data: · 21 unmodified lines | ||
| 2351 | 2349 | static int __devexit hdmi_remove(struct platform_device *pdev) |
| 2352 | 2350 | { |
| 2353 | 2351 | struct exynos_drm_hdmi_context *ctx = platform_get_drvdata(pdev); |
| 2354 | − struct hdmi_context *hdata = (struct hdmi_context *)ctx->ctx; | |
| 2352 | + struct hdmi_context *hdata = ctx->ctx; | |
| 2355 | 2353 | |
| 2356 | 2354 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
| 2357 | 2355 | |
| @@ -37,7 +37,8 @@ · 36 unmodified lines | ||
| 37 | 37 | #include "exynos_drm_drv.h" |
| 38 | 38 | #include "exynos_drm_hdmi.h" |
| 39 | 39 | |
| 40 | −#define HDMI_OVERLAY_NUMBER 3 | |
| 40 | +#define MIXER_WIN_NR 3 | |
| 41 | +#define MIXER_DEFAULT_WIN 0 | |
| 41 | 42 | |
| 42 | 43 | #define get_mixer_context(dev) platform_get_drvdata(to_platform_device(dev)) |
| 43 | 44 | |
| @@ -75,16 +76,12 @@ struct mixer_resources { · 31 unmodified lines | ||
| 75 | 76 | }; |
| 76 | 77 | |
| 77 | 78 | struct mixer_context { |
| 78 | − struct fb_videomode *default_timing; | |
| 79 | − unsigned int default_win; | |
| 80 | − unsigned int default_bpp; | |
| 81 | 79 | unsigned int irq; |
| 82 | 80 | int pipe; |
| 83 | 81 | bool interlace; |
| 84 | − bool vp_enabled; | |
| 85 | 82 | |
| 86 | 83 | struct mixer_resources mixer_res; |
| 87 | − struct hdmi_win_data win_data[HDMI_OVERLAY_NUMBER]; | |
| 84 | + struct hdmi_win_data win_data[MIXER_WIN_NR]; | |
| 88 | 85 | }; |
| 89 | 86 | |
| 90 | 87 | static const u8 filter_y_horiz_tap8[] = { |
| @@ -643,9 +640,9 @@ static void mixer_win_mode_set(void *ctx, · 552 unmodified lines | ||
| 643 | 640 | |
| 644 | 641 | win = overlay->zpos; |
| 645 | 642 | if (win == DEFAULT_ZPOS) |
| 646 | − win = mixer_ctx->default_win; | |
| 643 | + win = MIXER_DEFAULT_WIN; | |
| 647 | 644 | |
| 648 | − if (win < 0 || win > HDMI_OVERLAY_NUMBER) { | |
| 645 | + if (win < 0 || win > MIXER_WIN_NR) { | |
| 649 | 646 | DRM_ERROR("overlay plane[%d] is wrong\n", win); |
| 650 | 647 | return; |
| 651 | 648 | } |
| @@ -683,9 +680,9 @@ static void mixer_win_commit(void *ctx, int zpos) · 31 unmodified lines | ||
| 683 | 680 | DRM_DEBUG_KMS("[%d] %s, win: %d\n", __LINE__, __func__, win); |
| 684 | 681 | |
| 685 | 682 | if (win == DEFAULT_ZPOS) |
| 686 | − win = mixer_ctx->default_win; | |
| 683 | + win = MIXER_DEFAULT_WIN; | |
| 687 | 684 | |
| 688 | − if (win < 0 || win > HDMI_OVERLAY_NUMBER) { | |
| 685 | + if (win < 0 || win > MIXER_WIN_NR) { | |
| 689 | 686 | DRM_ERROR("overlay plane[%d] is wrong\n", win); |
| 690 | 687 | return; |
| 691 | 688 | } |
| @@ -706,9 +703,9 @@ static void mixer_win_disable(void *ctx, int zpos) · 14 unmodified lines | ||
| 706 | 703 | DRM_DEBUG_KMS("[%d] %s, win: %d\n", __LINE__, __func__, win); |
| 707 | 704 | |
| 708 | 705 | if (win == DEFAULT_ZPOS) |
| 709 | − win = mixer_ctx->default_win; | |
| 706 | + win = MIXER_DEFAULT_WIN; | |
| 710 | 707 | |
| 711 | − if (win < 0 || win > HDMI_OVERLAY_NUMBER) { | |
| 708 | + if (win < 0 || win > MIXER_WIN_NR) { | |
| 712 | 709 | DRM_ERROR("overlay plane[%d] is wrong\n", win); |
| 713 | 710 | return; |
| 714 | 711 | } |
| @@ -722,9 +719,12 @@ static void mixer_win_disable(void *ctx, int zpos) · 7 unmodified lines | ||
| 722 | 719 | spin_unlock_irqrestore(&res->reg_slock, flags); |
| 723 | 720 | } |
| 724 | 721 | |
| 725 | −static struct exynos_hdmi_overlay_ops overlay_ops = { | |
| 722 | +static struct exynos_mixer_ops mixer_ops = { | |
| 723 | + /* manager */ | |
| 726 | 724 | .enable_vblank = mixer_enable_vblank, |
| 727 | 725 | .disable_vblank = mixer_disable_vblank, |
| 726 | + | |
| 727 | + /* overlay */ | |
| 728 | 728 | .win_mode_set = mixer_win_mode_set, |
| 729 | 729 | .win_commit = mixer_win_commit, |
| 730 | 730 | .win_disable = mixer_win_disable, |
| @@ -771,8 +771,7 @@ static void mixer_finish_pageflip(struct drm_device *drm_dev, int crtc) · 40 unmodified lines | ||
| 771 | 771 | static irqreturn_t mixer_irq_handler(int irq, void *arg) |
| 772 | 772 | { |
| 773 | 773 | struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg; |
| 774 | − struct mixer_context *ctx = | |
| 775 | − (struct mixer_context *)drm_hdmi_ctx->ctx; | |
| 774 | + struct mixer_context *ctx = drm_hdmi_ctx->ctx; | |
| 776 | 775 | struct mixer_resources *res = &ctx->mixer_res; |
| 777 | 776 | u32 val, val_base; |
| 778 | 777 | |
| @@ -902,7 +901,7 @@ static int mixer_runtime_resume(struct device *dev) · 123 unmodified lines | ||
| 902 | 901 | |
| 903 | 902 | DRM_DEBUG_KMS("resume - start\n"); |
| 904 | 903 | |
| 905 | − mixer_resource_poweron((struct mixer_context *)ctx->ctx); | |
| 904 | + mixer_resource_poweron(ctx->ctx); | |
| 906 | 905 | |
| 907 | 906 | return 0; |
| 908 | 907 | } |
| @@ -913,7 +912,7 @@ static int mixer_runtime_suspend(struct device *dev) · 4 unmodified lines | ||
| 913 | 912 | |
| 914 | 913 | DRM_DEBUG_KMS("suspend - start\n"); |
| 915 | 914 | |
| 916 | − mixer_resource_poweroff((struct mixer_context *)ctx->ctx); | |
| 915 | + mixer_resource_poweroff(ctx->ctx); | |
| 917 | 916 | |
| 918 | 917 | return 0; |
| 919 | 918 | } |
| @@ -926,8 +925,7 @@ static const struct dev_pm_ops mixer_pm_ops = { · 6 unmodified lines | ||
| 926 | 925 | static int __devinit mixer_resources_init(struct exynos_drm_hdmi_context *ctx, |
| 927 | 926 | struct platform_device *pdev) |
| 928 | 927 | { |
| 929 | − struct mixer_context *mixer_ctx = | |
| 930 | − (struct mixer_context *)ctx->ctx; | |
| 928 | + struct mixer_context *mixer_ctx = ctx->ctx; | |
| 931 | 929 | struct device *dev = &pdev->dev; |
| 932 | 930 | struct mixer_resources *mixer_res = &mixer_ctx->mixer_res; |
| 933 | 931 | struct resource *res; |
| @@ -1076,7 +1074,7 @@ static int __devinit mixer_probe(struct platform_device *pdev) · 142 unmodified lines | ||
| 1076 | 1074 | goto fail; |
| 1077 | 1075 | |
| 1078 | 1076 | /* register specific callback point to common hdmi. */ |
| 1079 | − exynos_drm_overlay_ops_register(&overlay_ops); | |
| 1077 | + exynos_mixer_ops_register(&mixer_ops); | |
| 1080 | 1078 | |
| 1081 | 1079 | mixer_resource_poweron(ctx); |
| 1082 | 1080 | |
| @@ -1093,7 +1091,7 @@ static int mixer_remove(struct platform_device *pdev) · 10 unmodified lines | ||
| 1093 | 1091 | struct device *dev = &pdev->dev; |
| 1094 | 1092 | struct exynos_drm_hdmi_context *drm_hdmi_ctx = |
| 1095 | 1093 | platform_get_drvdata(pdev); |
| 1096 | − struct mixer_context *ctx = (struct mixer_context *)drm_hdmi_ctx->ctx; | |
| 1094 | + struct mixer_context *ctx = drm_hdmi_ctx->ctx; | |
| 1097 | 1095 | |
| 1098 | 1096 | dev_info(dev, "remove successful\n"); |
| 1099 | 1097 | |
| @@ -85,7 +85,7 @@ struct drm_exynos_gem_mmap { · 84 unmodified lines | ||
| 85 | 85 | struct drm_exynos_vidi_connection { |
| 86 | 86 | unsigned int connection; |
| 87 | 87 | unsigned int extensions; |
| 88 | − uint64_t *edid; | |
| 88 | + uint64_t edid; | |
| 89 | 89 | }; |
| 90 | 90 | |
| 91 | 91 | struct drm_exynos_plane_set_zpos { |
| @@ -96,7 +96,8 @@ struct drm_exynos_plane_set_zpos { · 4 unmodified lines | ||
| 96 | 96 | /* memory type definitions. */ |
| 97 | 97 | enum e_drm_exynos_gem_mem_type { |
| 98 | 98 | /* Physically Non-Continuous memory. */ |
| 99 | − EXYNOS_BO_NONCONTIG = 1 << 0 | |
| 99 | + EXYNOS_BO_NONCONTIG = 1 << 0, | |
| 100 | + EXYNOS_BO_MASK = EXYNOS_BO_NONCONTIG | |
| 100 | 101 | }; |
| 101 | 102 | |
| 102 | 103 | #define DRM_EXYNOS_GEM_CREATE 0x00 |