Skip to content

Commit

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

 Summary:
   - expose HDMI-PHY clock to other drivers.
     . this patch was included in below patch series but I missed.
             http://www.spinics.net/lists/dri-devel/msg103097.html
   - some fixups about DECON5433 driver
     . this patch corrects vblank handling and fixes up trigger
       configuration.
   - use generic functions - gem_prime_mmap and dma_buf_mmap.
   - use DMA-Mapping API instead of specific one.
   - some code cleanups and fixeups.

* 'exynos-drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos:
  drm/exynos/decon5433: fix trigger configuration
  drm/exynos/dsi: use of_graph_get_endpoint_by_regs helper
  drm/exynos/dpi: use of_graph_get_endpoint_by_regs helper
  drm/exynos: Nuke dummy fb->dirty callback
  drm/exynos: use directly DMA mapping APIs on g2d
  drm/exynos/hdmi: Don't print error on deferral due to regulators
  drm/exynos: fix imported dma-buf to be mapped
  drm/exynos: support gem_prime_mmap
  drm/exynos: fimd: harden fimd_calc_clkdiv()
  drm/exynos: fix cancel page flip code
  drm/exynos/decon5433: do not use unnecessary software trigger
  drm/exynos/decon5433: handle vblank in vblank interrupt
  drm/exynos/hdmi: expose HDMI-PHY clock as pipeline clock
  • Loading branch information
Dave Airlie committed May 12, 2016
2 parents 19ea5da + dd65a68 commit 6d23abf
Show file tree
Hide file tree
Showing 11 changed files with 120 additions and 223 deletions.
16 changes: 7 additions & 9 deletions drivers/gpu/drm/exynos/exynos5433_drm_decon.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,13 @@ static void decon_commit(struct exynos_drm_crtc *crtc)
val = CMU_CLKGAGE_MODE_SFR_F | CMU_CLKGAGE_MODE_MEM_F;
writel(val, ctx->addr + DECON_CMU);

if (ctx->out_type & (IFTYPE_I80 | I80_HW_TRG))
decon_setup_trigger(ctx);

/* lcd on and use command if */
val = VIDOUT_LCD_ON;
if (ctx->out_type & IFTYPE_I80) {
val |= VIDOUT_COMMAND_IF;
decon_setup_trigger(ctx);
} else {
val |= VIDOUT_RGB_IF;
}
Expand Down Expand Up @@ -376,9 +378,6 @@ static void decon_swreset(struct decon_context *ctx)
writel(VIDCON1_VCLK_RUN_VDEN_DISABLE, ctx->addr + DECON_VIDCON1);
writel(CRCCTRL_CRCEN | CRCCTRL_CRCSTART_F | CRCCTRL_CRCCLKEN,
ctx->addr + DECON_CRCCTRL);

if (ctx->out_type & IFTYPE_I80)
decon_setup_trigger(ctx);
}

static void decon_enable(struct exynos_drm_crtc *crtc)
Expand Down Expand Up @@ -434,13 +433,12 @@ static void decon_te_irq_handler(struct exynos_drm_crtc *crtc)
{
struct decon_context *ctx = crtc->ctx;

if (!test_bit(BIT_CLKS_ENABLED, &ctx->flags))
if (!test_bit(BIT_CLKS_ENABLED, &ctx->flags) ||
(ctx->out_type & I80_HW_TRG))
return;

if (test_and_clear_bit(BIT_WIN_UPDATED, &ctx->flags))
decon_set_bits(ctx, DECON_TRIGCON, TRIGCON_SWTRIGCMD, ~0);

drm_crtc_handle_vblank(&ctx->crtc->base);
}

static void decon_clear_channels(struct exynos_drm_crtc *crtc)
Expand Down Expand Up @@ -573,6 +571,7 @@ static irqreturn_t decon_irq_handler(int irq, void *dev_id)

/* clear */
writel(val, ctx->addr + DECON_VIDINTCON1);
drm_crtc_handle_vblank(&ctx->crtc->base);
}

out:
Expand Down Expand Up @@ -648,9 +647,8 @@ static int exynos5433_decon_probe(struct platform_device *pdev)

if (ctx->out_type & IFTYPE_HDMI) {
ctx->first_win = 1;
ctx->out_type = IFTYPE_I80;
} else if (of_get_child_by_name(dev->of_node, "i80-if-timings")) {
ctx->out_type = IFTYPE_I80;
ctx->out_type |= IFTYPE_I80;
}

for (i = 0; i < ARRAY_SIZE(decon_clks_name); i++) {
Expand Down
15 changes: 5 additions & 10 deletions drivers/gpu/drm/exynos/exynos_drm_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,20 +233,15 @@ void exynos_drm_crtc_cancel_page_flip(struct drm_crtc *crtc,
unsigned long flags;

spin_lock_irqsave(&crtc->dev->event_lock, flags);

e = exynos_crtc->event;
if (e && e->base.file_priv == file) {
exynos_crtc->event = NULL;
/*
* event will be destroyed by core part
* so below line should be removed later with core changes
*/
e->base.destroy(&e->base);
/*
* event_space will be increased by core part
* so below line should be removed later with core changes.
*/
file->event_space += sizeof(e->event);
atomic_dec(&exynos_crtc->pending_update);
}

spin_unlock_irqrestore(&crtc->dev->event_lock, flags);

if (e && e->base.file_priv == file)
drm_event_cancel_free(crtc->dev, &e->base);
}
69 changes: 2 additions & 67 deletions drivers/gpu/drm/exynos/exynos_drm_dpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <drm/drm_panel.h>
#include <drm/drm_atomic_helper.h>

#include <linux/of_graph.h>
#include <linux/regulator/consumer.h>

#include <video/of_videomode.h>
Expand Down Expand Up @@ -164,67 +165,6 @@ static const struct drm_encoder_funcs exynos_dpi_encoder_funcs = {
.destroy = drm_encoder_cleanup,
};

/* of_* functions will be removed after merge of of_graph patches */
static struct device_node *
of_get_child_by_name_reg(struct device_node *parent, const char *name, u32 reg)
{
struct device_node *np;

for_each_child_of_node(parent, np) {
u32 r;

if (!np->name || of_node_cmp(np->name, name))
continue;

if (of_property_read_u32(np, "reg", &r) < 0)
r = 0;

if (reg == r)
break;
}

return np;
}

static struct device_node *of_graph_get_port_by_reg(struct device_node *parent,
u32 reg)
{
struct device_node *ports, *port;

ports = of_get_child_by_name(parent, "ports");
if (ports)
parent = ports;

port = of_get_child_by_name_reg(parent, "port", reg);

of_node_put(ports);

return port;
}

static struct device_node *
of_graph_get_endpoint_by_reg(struct device_node *port, u32 reg)
{
return of_get_child_by_name_reg(port, "endpoint", reg);
}

static struct device_node *
of_graph_get_remote_port_parent(const struct device_node *node)
{
struct device_node *np;
unsigned int depth;

np = of_parse_phandle(node, "remote-endpoint", 0);

/* Walk 3 levels up only if there is 'ports' node. */
for (depth = 3; depth && np; depth--) {
np = of_get_next_parent(np);
if (depth == 2 && of_node_cmp(np->name, "ports"))
break;
}
return np;
}

enum {
FIMD_PORT_IN0,
FIMD_PORT_IN1,
Expand All @@ -237,12 +177,7 @@ static struct device_node *exynos_dpi_of_find_panel_node(struct device *dev)
{
struct device_node *np, *ep;

np = of_graph_get_port_by_reg(dev->of_node, FIMD_PORT_RGB);
if (!np)
return NULL;

ep = of_graph_get_endpoint_by_reg(np, 0);
of_node_put(np);
ep = of_graph_get_endpoint_by_regs(dev->of_node, FIMD_PORT_RGB, 0);
if (!ep)
return NULL;

Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/exynos/exynos_drm_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ static struct drm_driver exynos_drm_driver = {
.gem_prime_import_sg_table = exynos_drm_gem_prime_import_sg_table,
.gem_prime_vmap = exynos_drm_gem_prime_vmap,
.gem_prime_vunmap = exynos_drm_gem_prime_vunmap,
.gem_prime_mmap = exynos_drm_gem_prime_mmap,
.ioctls = exynos_ioctls,
.num_ioctls = ARRAY_SIZE(exynos_ioctls),
.fops = &exynos_drm_driver_fops,
Expand Down
57 changes: 3 additions & 54 deletions drivers/gpu/drm/exynos/exynos_drm_dsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1632,50 +1632,6 @@ static const struct drm_encoder_funcs exynos_dsi_encoder_funcs = {

MODULE_DEVICE_TABLE(of, exynos_dsi_of_match);

/* of_* functions will be removed after merge of of_graph patches */
static struct device_node *
of_get_child_by_name_reg(struct device_node *parent, const char *name, u32 reg)
{
struct device_node *np;

for_each_child_of_node(parent, np) {
u32 r;

if (!np->name || of_node_cmp(np->name, name))
continue;

if (of_property_read_u32(np, "reg", &r) < 0)
r = 0;

if (reg == r)
break;
}

return np;
}

static struct device_node *of_graph_get_port_by_reg(struct device_node *parent,
u32 reg)
{
struct device_node *ports, *port;

ports = of_get_child_by_name(parent, "ports");
if (ports)
parent = ports;

port = of_get_child_by_name_reg(parent, "port", reg);

of_node_put(ports);

return port;
}

static struct device_node *
of_graph_get_endpoint_by_reg(struct device_node *port, u32 reg)
{
return of_get_child_by_name_reg(port, "endpoint", reg);
}

static int exynos_dsi_of_read_u32(const struct device_node *np,
const char *propname, u32 *out_value)
{
Expand All @@ -1697,24 +1653,17 @@ static int exynos_dsi_parse_dt(struct exynos_dsi *dsi)
{
struct device *dev = dsi->dev;
struct device_node *node = dev->of_node;
struct device_node *port, *ep;
struct device_node *ep;
int ret;

ret = exynos_dsi_of_read_u32(node, "samsung,pll-clock-frequency",
&dsi->pll_clk_rate);
if (ret < 0)
return ret;

port = of_graph_get_port_by_reg(node, DSI_PORT_OUT);
if (!port) {
dev_err(dev, "no output port specified\n");
return -EINVAL;
}

ep = of_graph_get_endpoint_by_reg(port, 0);
of_node_put(port);
ep = of_graph_get_endpoint_by_regs(node, DSI_PORT_OUT, 0);
if (!ep) {
dev_err(dev, "no endpoint specified in output port\n");
dev_err(dev, "no output port with endpoint specified\n");
return -EINVAL;
}

Expand Down
11 changes: 0 additions & 11 deletions drivers/gpu/drm/exynos/exynos_drm_fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,20 +97,9 @@ static int exynos_drm_fb_create_handle(struct drm_framebuffer *fb,
&exynos_fb->exynos_gem[0]->base, handle);
}

static int exynos_drm_fb_dirty(struct drm_framebuffer *fb,
struct drm_file *file_priv, unsigned flags,
unsigned color, struct drm_clip_rect *clips,
unsigned num_clips)
{
/* TODO */

return 0;
}

static const struct drm_framebuffer_funcs exynos_drm_fb_funcs = {
.destroy = exynos_drm_fb_destroy,
.create_handle = exynos_drm_fb_create_handle,
.dirty = exynos_drm_fb_dirty,
};

struct drm_framebuffer *
Expand Down
9 changes: 8 additions & 1 deletion drivers/gpu/drm/exynos/exynos_drm_fimd.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,16 @@ static void fimd_clear_channels(struct exynos_drm_crtc *crtc)
static u32 fimd_calc_clkdiv(struct fimd_context *ctx,
const struct drm_display_mode *mode)
{
unsigned long ideal_clk = mode->htotal * mode->vtotal * mode->vrefresh;
unsigned long ideal_clk;
u32 clkdiv;

if (mode->clock == 0) {
DRM_ERROR("Mode has zero clock value.\n");
return 0xff;
}

ideal_clk = mode->clock * 1000;

if (ctx->i80_if) {
/*
* The frame done interrupt should be occurred prior to the
Expand Down
10 changes: 5 additions & 5 deletions drivers/gpu/drm/exynos/exynos_drm_g2d.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ static void g2d_userptr_put_dma_addr(struct drm_device *drm_dev,
return;

out:
exynos_gem_unmap_sgt_from_dma(drm_dev, g2d_userptr->sgt,
DMA_BIDIRECTIONAL);
dma_unmap_sg(to_dma_dev(drm_dev), g2d_userptr->sgt->sgl,
g2d_userptr->sgt->nents, DMA_BIDIRECTIONAL);

pages = frame_vector_pages(g2d_userptr->vec);
if (!IS_ERR(pages)) {
Expand Down Expand Up @@ -501,10 +501,10 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev,

g2d_userptr->sgt = sgt;

ret = exynos_gem_map_sgt_with_dma(drm_dev, g2d_userptr->sgt,
DMA_BIDIRECTIONAL);
if (ret < 0) {
if (!dma_map_sg(to_dma_dev(drm_dev), sgt->sgl, sgt->nents,
DMA_BIDIRECTIONAL)) {
DRM_ERROR("failed to map sgt with dma region.\n");
ret = -ENOMEM;
goto err_sg_free_table;
}

Expand Down
Loading

0 comments on commit 6d23abf

Please sign in to comment.