Skip to content

Commit

Permalink
Merge tag 'exynos-drm-next-for-v5.8' of git://git.kernel.org/pub/scm/…
Browse files Browse the repository at this point in the history
…linux/kernel/git/daeinki/drm-exynos into drm-next

Check imported buffer mapping in generic way
- This patch reworks exynos_drm_gem_prime_import_sg_table function,
  which checks if the imported buffer has been mapped as contiguous
  or not in generic way, and flag a exynos gem buffer type properly
  according to the mapped way.

Fixups
- Drop a reference count to in_bridge_node correctly.
- Enable the runtime power management correctly.
  . The runtime pm should be enabled before calling compont_add().

Cleanups
- Do not register "by hand" a sysfs file, and use dev_groups instead.
- Drop internal 'pages' array which aren't needed.
- Remove dead-code.
- Correct type casting.
- Drop unnecessary error messages.

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Inki Dae <inki.dae@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1589952785-24210-1-git-send-email-inki.dae@samsung.com
  • Loading branch information
Dave Airlie committed May 21, 2020
2 parents 6cf9916 + f84e1ba commit e20bb85
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 192 deletions.
1 change: 0 additions & 1 deletion drivers/gpu/drm/exynos/exynos_drm_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file)
}

static const struct vm_operations_struct exynos_drm_gem_vm_ops = {
.fault = exynos_drm_gem_fault,
.open = drm_gem_vm_open,
.close = drm_gem_vm_close,
};
Expand Down
26 changes: 17 additions & 9 deletions drivers/gpu/drm/exynos/exynos_drm_dsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@

#define OLD_SCLK_MIPI_CLK_NAME "pll_clk"

static char *clk_names[5] = { "bus_clk", "sclk_mipi",
static const char *const clk_names[5] = { "bus_clk", "sclk_mipi",
"phyclk_mipidphy0_bitclkdiv8", "phyclk_mipidphy0_rxclkesc0",
"sclk_rgb_vclk_to_dsim0" };

Expand Down Expand Up @@ -1759,10 +1759,6 @@ static int exynos_dsi_probe(struct platform_device *pdev)
dsi->dev = dev;
dsi->driver_data = of_device_get_match_data(dev);

ret = exynos_dsi_parse_dt(dsi);
if (ret)
return ret;

dsi->supplies[0].supply = "vddcore";
dsi->supplies[1].supply = "vddio";
ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(dsi->supplies),
Expand Down Expand Up @@ -1809,10 +1805,8 @@ static int exynos_dsi_probe(struct platform_device *pdev)
}

dsi->irq = platform_get_irq(pdev, 0);
if (dsi->irq < 0) {
dev_err(dev, "failed to request dsi irq resource\n");
if (dsi->irq < 0)
return dsi->irq;
}

irq_set_status_flags(dsi->irq, IRQ_NOAUTOEN);
ret = devm_request_threaded_irq(dev, dsi->irq, NULL,
Expand All @@ -1823,11 +1817,25 @@ static int exynos_dsi_probe(struct platform_device *pdev)
return ret;
}

ret = exynos_dsi_parse_dt(dsi);
if (ret)
return ret;

platform_set_drvdata(pdev, &dsi->encoder);

pm_runtime_enable(dev);

return component_add(dev, &exynos_dsi_component_ops);
ret = component_add(dev, &exynos_dsi_component_ops);
if (ret)
goto err_disable_runtime;

return 0;

err_disable_runtime:
pm_runtime_disable(dev);
of_node_put(dsi->in_bridge_node);

return ret;
}

static int exynos_dsi_remove(struct platform_device *pdev)
Expand Down
28 changes: 1 addition & 27 deletions drivers/gpu/drm/exynos/exynos_drm_fbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper,
struct fb_info *fbi;
struct drm_framebuffer *fb = helper->fb;
unsigned int size = fb->width * fb->height * fb->format->cpp[0];
unsigned int nr_pages;
unsigned long offset;

fbi = drm_fb_helper_alloc_fbi(helper);
Expand All @@ -90,16 +89,6 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper,

drm_fb_helper_fill_info(fbi, helper, sizes);

nr_pages = exynos_gem->size >> PAGE_SHIFT;

exynos_gem->kvaddr = (void __iomem *) vmap(exynos_gem->pages, nr_pages,
VM_MAP, pgprot_writecombine(PAGE_KERNEL));
if (!exynos_gem->kvaddr) {
DRM_DEV_ERROR(to_dma_dev(helper->dev),
"failed to map pages to kernel space.\n");
return -EIO;
}

offset = fbi->var.xoffset * fb->format->cpp[0];
offset += fbi->var.yoffset * fb->pitches[0];

Expand Down Expand Up @@ -133,18 +122,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper,

size = mode_cmd.pitches[0] * mode_cmd.height;

exynos_gem = exynos_drm_gem_create(dev, EXYNOS_BO_CONTIG, size);
/*
* If physically contiguous memory allocation fails and if IOMMU is
* supported then try to get buffer from non physically contiguous
* memory area.
*/
if (IS_ERR(exynos_gem) && is_drm_iommu_supported(dev)) {
dev_warn(dev->dev, "contiguous FB allocation failed, falling back to non-contiguous\n");
exynos_gem = exynos_drm_gem_create(dev, EXYNOS_BO_NONCONTIG,
size);
}

exynos_gem = exynos_drm_gem_create(dev, EXYNOS_BO_WC, size, true);
if (IS_ERR(exynos_gem))
return PTR_ERR(exynos_gem);

Expand Down Expand Up @@ -229,12 +207,8 @@ int exynos_drm_fbdev_init(struct drm_device *dev)
static void exynos_drm_fbdev_destroy(struct drm_device *dev,
struct drm_fb_helper *fb_helper)
{
struct exynos_drm_fbdev *exynos_fbd = to_exynos_fbdev(fb_helper);
struct exynos_drm_gem *exynos_gem = exynos_fbd->exynos_gem;
struct drm_framebuffer *fb;

vunmap(exynos_gem->kvaddr);

/* release drm framebuffer and real buffer */
if (fb_helper->fb && fb_helper->fb->funcs) {
fb = fb_helper->fb;
Expand Down
Loading

0 comments on commit e20bb85

Please sign in to comment.