diff options
author | Liu Ying <victor.liu@nxp.com> | 2018-06-27 16:29:51 +0800 |
---|---|---|
committer | Jason Liu <jason.hui.liu@nxp.com> | 2019-02-12 10:33:43 +0800 |
commit | 2a1e654f53a48dbee1ebcb9613dbb8506ba645bb (patch) | |
tree | 414f6f1bf5e97078244b1361bb83b3f790900759 | |
parent | 2192e34d671698e73bfabb536faa8a5b1ec9c377 (diff) |
MLK-19413-23 gpu: imx: dpu: Add constframe_framedimenstions_copy_prim() helper support
This patch adds constframe_framedimenstions_copy_prim() helper support
so that callers may may copy frame dimensions from a primary constframe
to the relevant secondary constframe.
Signed-off-by: Liu Ying <victor.liu@nxp.com>
-rw-r--r-- | drivers/gpu/imx/dpu/dpu-constframe.c | 37 | ||||
-rw-r--r-- | include/video/dpu.h | 1 |
2 files changed, 38 insertions, 0 deletions
diff --git a/drivers/gpu/imx/dpu/dpu-constframe.c b/drivers/gpu/imx/dpu/dpu-constframe.c index e25bd7d0118e..a7c2719ae9fa 100644 --- a/drivers/gpu/imx/dpu/dpu-constframe.c +++ b/drivers/gpu/imx/dpu/dpu-constframe.c @@ -53,6 +53,11 @@ struct dpu_constframe { shadow_load_req_t shdlreq; }; +static inline u32 dpu_cf_read(struct dpu_constframe *cf, unsigned int offset) +{ + return readl(cf->base + offset); +} + static inline void dpu_cf_write(struct dpu_constframe *cf, u32 value, unsigned int offset) { @@ -84,6 +89,38 @@ void constframe_framedimensions(struct dpu_constframe *cf, unsigned int w, } EXPORT_SYMBOL_GPL(constframe_framedimensions); +void constframe_framedimensions_copy_prim(struct dpu_constframe *cf) +{ + struct dpu_constframe *prim_cf = NULL; + unsigned int prim_id; + int i; + u32 val; + + if (cf->id != 0 && cf->id != 1) { + dev_warn(cf->dpu->dev, "ConstFrame%d is not a secondary one\n", + cf->id); + return; + } + + prim_id = cf->id + 4; + + for (i = 0; i < ARRAY_SIZE(cf_ids); i++) + if (cf_ids[i] == prim_id) + prim_cf = cf->dpu->cf_priv[i]; + + if (!prim_cf) { + dev_warn(cf->dpu->dev, "cannot find ConstFrame%d's primary peer\n", + cf->id); + return; + } + + mutex_lock(&cf->mutex); + val = dpu_cf_read(prim_cf, FRAMEDIMENSIONS); + dpu_cf_write(cf, val, FRAMEDIMENSIONS); + mutex_unlock(&cf->mutex); +} +EXPORT_SYMBOL_GPL(constframe_framedimensions_copy_prim); + void constframe_constantcolor(struct dpu_constframe *cf, unsigned int r, unsigned int g, unsigned int b, unsigned int a) { diff --git a/include/video/dpu.h b/include/video/dpu.h index 7ac895d20eff..c23a14e7e6c1 100644 --- a/include/video/dpu.h +++ b/include/video/dpu.h @@ -506,6 +506,7 @@ struct dpu_constframe; void constframe_shden(struct dpu_constframe *cf, bool enable); void constframe_framedimensions(struct dpu_constframe *cf, unsigned int w, unsigned int h); +void constframe_framedimensions_copy_prim(struct dpu_constframe *cf); void constframe_constantcolor(struct dpu_constframe *cf, unsigned int r, unsigned int g, unsigned int b, unsigned int a); void constframe_controltrigger(struct dpu_constframe *cf, bool trigger); |