drm/exynos: fix and cleanup ipp subsystem drivers
Subsystems (4)
v3 cover drm/exynos: fix and cleanup ipp subsystem drivers
Hi All.
This patch fix some issue and cleanup code. please check my commit and let me know about your comment.
Changelog v3:
- Subject clean like bellow:
* change all subject name from Inki.Dae
Changelog v2:
- This patch set fixes the following:
* consider both case of vflip and hflip: we use vflip, hflip set at the same time for 180 degree supporting. so, we add FLIP_BOTH for fixing warnning.
Changelog v1:
- This patch set fixes the following:
* consider both case of vflip and hflip: we use vflip, hflip set at the same time for 180 degree supporting. so, we add this case.
* fix build warning: we don't use directly readl, but this code remained. so, we change it.
* fix incorrect interrupt induced by m2m operation : m2m operation call reset function at every time. but we don't disable dma start. so, we add dma stop and capture stop operation.
- And code clean like bellow:
* change memory variable name : we use 'cmd' in property structure and so on.
so, this naming make some confusion. we change 'cmd' to 'c_node' to avoid confusion.
* remove needless error handling to property : property could't be NULL. so, we remove error handling about NULL.
* correct some comments to abbreviation : we change comments for right grammar.
* remove needless parenthesis : we misse changing of fimc side. so, I added it.
* remove color bar pattern operation : we don't use color display at writeback. so, remove it.
Thank's
BR
Eunchul Kim
Eunchul Kim (6):
drm/exynos: change member variable name. drm/exynos: remove needless error handling to property. drm/exynos: consider both case of vflip and hflip. drm/exynos: fix build warning.
drm/exynos: correct some comments to abbreviation. drm/exynos: remove needless parenthesis.
Jinyoung Jeon (1):
drm/exynos: fix incorrect interrupt induced by m2m operation.
JoongMock Shin (1):
drm/exynos: remove color bar pattern operation.
drivers/gpu/drm/exynos/exynos_drm_fimc.c | 47 +++++++++++++-------------- drivers/gpu/drm/exynos/exynos_drm_gsc.c | 26 ++++----------- drivers/gpu/drm/exynos/exynos_drm_ipp.c | 13 ++----- drivers/gpu/drm/exynos/exynos_drm_ipp.h | 4 +- drivers/gpu/drm/exynos/exynos_drm_rotator.c | 3 +- include/uapi/drm/exynos_drm.h | 2 + 6 files changed, 40 insertions(+), 55 deletions(-)
PATCH v3 1/8 drm/exynos: change member variable name.
This patch change current command name from cmd to c_node.
because we are using the member name, 'cmd', for command control ioctl in another structure. so, this patch changes it to c_node to avoid such confusing.
--- drivers/gpu/drm/exynos/exynos_drm_fimc.c | 8 ++++---- drivers/gpu/drm/exynos/exynos_drm_gsc.c | 8 ++++---- drivers/gpu/drm/exynos/exynos_drm_ipp.c | 6 +++--- drivers/gpu/drm/exynos/exynos_drm_ipp.h | 4 ++-- drivers/gpu/drm/exynos/exynos_drm_rotator.c | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimc.c +4 -4
@@ -695,7 +695,7 @@ static int fimc_src_set_addr(struct device *dev, {struct fimc_context *ctx =get_fimc_context (dev);struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; -struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; +struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;struct drm_exynos_ipp_property *property;struct drm_exynos_ipp_config *config;
@@ -1231,7 +1231,7 @@ static int fimc_dst_set_addr(struct device *dev, {struct fimc_context *ctx =get_fimc_context (dev);struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; -struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; +struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;struct drm_exynos_ipp_property *property;struct drm_exynos_ipp_config *config;
@@ -1317,7 +1317,7 @@ static irqreturn_t fimc_irq_handler(int irq, void *dev_id) {struct fimc_context *ctx = dev_id;struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; -struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; +struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;struct drm_exynos_ipp_event_work *event_work = c_node->event_work;int buf_id;
@@ -1557,7 +1557,7 @@ static int fimc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd) {struct fimc_context *ctx =get_fimc_context (dev);struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; -struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; +struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;struct drm_exynos_ipp_property *property;struct drm_exynos_ipp_config *config;struct drm_exynos_pos img_pos[EXYNOS_DRM_OPS_MAX ];
drivers/gpu/drm/exynos/exynos_drm_gsc.c +4 -4
@@ -711,7 +711,7 @@ static int gsc_src_set_addr(struct device *dev, {struct gsc_context *ctx =get_gsc_context (dev);struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; -struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; +struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;struct drm_exynos_ipp_property *property;if (!c_node) {
@@ -1171,7 +1171,7 @@ static int gsc_dst_set_addr(struct device *dev, {struct gsc_context *ctx =get_gsc_context (dev);struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; -struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; +struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;struct drm_exynos_ipp_property *property;if (!c_node) {
@@ -1312,7 +1312,7 @@ static irqreturn_t gsc_irq_handler(int irq, void *dev_id) {struct gsc_context *ctx = dev_id;struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; -struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; +struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;struct drm_exynos_ipp_event_work *event_work = c_node->event_work;u32 status;
@@ -1549,7 +1549,7 @@ static int gsc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd) {struct gsc_context *ctx =get_gsc_context (dev);struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; -struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; +struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;struct drm_exynos_ipp_property *property;struct drm_exynos_ipp_config *config;struct drm_exynos_pos img_pos[EXYNOS_DRM_OPS_MAX ];
drivers/gpu/drm/exynos/exynos_drm_ipp.c +3 -3
@@ -1292,7 +1292,7 @@ static int ipp_start_property(struct exynos_drm_ippdrv *ippdrv,DRM_DEBUG_KMS ("%s:prop_id[%d]\n" , __func__, property->prop_id);/* store command info in ippdrv */ - ippdrv->cmd = c_node; + ippdrv->c_node = c_node;if (!ipp_check_mem_list (c_node)) {DRM_DEBUG_KMS ("%s:empty memory.\n" , __func__);
@@ -1303,7 +1303,7 @@ static int ipp_start_property(struct exynos_drm_ippdrv *ippdrv, ret =ipp_set_property (ippdrv, property);if (ret) {DRM_ERROR ("failed to set property.\n" ); - ippdrv->cmd =NULL ; + ippdrv->c_node =NULL ;return ret; }
@@ -1704,7 +1704,7 @@ void ipp_sched_event(struct work_struct *work)return ; } - c_node = ippdrv->cmd; + c_node = ippdrv->c_node;if (!c_node) {DRM_ERROR ("failed to get command node.\n" );return ;
drivers/gpu/drm/exynos/exynos_drm_ipp.h +2 -2
@@ -160,7 +160,7 @@ struct exynos_drm_ipp_ops {* @dedicated: dedicated ipp device. * @ops: source, destination operations. * @event_workq: event work queue. -* @cmd: current command information. +* @c_node: current command information. * @cmd_list: list head for command information. * @prop_list: property informations of current ipp driver. * @check_property: check property about format, size, buffer.
@@ -178,7 +178,7 @@ struct exynos_drm_ippdrv {bool dedicated;struct exynos_drm_ipp_ops *ops[EXYNOS_DRM_OPS_MAX ];struct workqueue_struct *event_workq; -struct drm_exynos_ipp_cmd_node *cmd; +struct drm_exynos_ipp_cmd_node *c_node;struct list_head cmd_list;struct drm_exynos_ipp_prop_list *prop_list;
drivers/gpu/drm/exynos/exynos_drm_rotator.c +1 -1
@@ -139,7 +139,7 @@ static irqreturn_t rotator_irq_handler(int irq, void *arg) {struct rot_context *rot = arg;struct exynos_drm_ippdrv *ippdrv = &rot->ippdrv; -struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; +struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;struct drm_exynos_ipp_event_work *event_work = c_node->event_work;enum rot_irq_status irq_status;u32 val;
Signature · 1 line
1.7.0.4
PATCH v3 2/8 drm/exynos: remove needless error handling to property.
In reply to Eunchul KimThis patch removes property error handling. because property couldn't be NULL.
--- drivers/gpu/drm/exynos/exynos_drm_fimc.c | 12 ------------ drivers/gpu/drm/exynos/exynos_drm_gsc.c | 12 ------------ drivers/gpu/drm/exynos/exynos_drm_ipp.c | 5 ----- 3 files changed, 0 insertions(+), 29 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimc.c +0 -12
@@ -705,10 +705,6 @@ static int fimc_src_set_addr(struct device *dev, } property = &c_node->property; -if (!property) { -DRM_ERROR ("failed to get property.\n" ); -return -EINVAL ; - }DRM_DEBUG_KMS ("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n" , __func__, property->prop_id, buf_id, buf_type);
@@ -1241,10 +1237,6 @@ static int fimc_dst_set_addr(struct device *dev, } property = &c_node->property; -if (!property) { -DRM_ERROR ("failed to get property.\n" ); -return -EINVAL ; - }DRM_DEBUG_KMS ("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n" , __func__, property->prop_id, buf_id, buf_type);
@@ -1573,10 +1565,6 @@ static int fimc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd) } property = &c_node->property; -if (!property) { -DRM_ERROR ("failed to get property.\n" ); -return -EINVAL ; - }fimc_handle_irq (ctx, true, false, true);
drivers/gpu/drm/exynos/exynos_drm_gsc.c +0 -12
@@ -720,10 +720,6 @@ static int gsc_src_set_addr(struct device *dev, } property = &c_node->property; -if (!property) { -DRM_ERROR ("failed to get property.\n" ); -return -EFAULT ; - }DRM_DEBUG_KMS ("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n" , __func__, property->prop_id, buf_id, buf_type);
@@ -1180,10 +1176,6 @@ static int gsc_dst_set_addr(struct device *dev, } property = &c_node->property; -if (!property) { -DRM_ERROR ("failed to get property.\n" ); -return -EFAULT ; - }DRM_DEBUG_KMS ("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n" , __func__, property->prop_id, buf_id, buf_type);
@@ -1565,10 +1557,6 @@ static int gsc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd) } property = &c_node->property; -if (!property) { -DRM_ERROR ("failed to get property.\n" ); -return -EINVAL ; - }gsc_handle_irq (ctx, true, false, true);
drivers/gpu/drm/exynos/exynos_drm_ipp.c +0 -5
@@ -1487,11 +1487,6 @@ void ipp_sched_cmd(struct work_struct *work)mutex_lock (&c_node->cmd_lock); property = &c_node->property; -if (!property) { -DRM_ERROR ("failed to get property:prop_id[%d]\n" , - c_node->property.prop_id); - goto err_unlock; - }switch (cmd_work->ctrl) {case IPP_CTRL_PLAY :
Signature · 1 line
1.7.0.4
PATCH v3 3/8 drm/exynos: consider both case of vflip and hflip.
In reply to Eunchul KimThis patch considers both case of vflip and hflip.
If we want that the contents in buffer to be rotated to 180 degree, then we can use h,vflip or 180 degree.
Changelog v2:
- added EXYNOS_DRM_FLIP_BOTH enum value to avoid build warnning.
--- drivers/gpu/drm/exynos/exynos_drm_fimc.c | 1 + drivers/gpu/drm/exynos/exynos_drm_gsc.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_rotator.c | 1 + include/uapi/drm/exynos_drm.h | 2 ++ 4 files changed, 5 insertions(+), 1 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimc.c +1 -0
@@ -1387,6 +1387,7 @@ static inline bool fimc_check_drm_flip(enum drm_exynos_flip flip)case EXYNOS_DRM_FLIP_NONE :case EXYNOS_DRM_FLIP_VERTICAL :case EXYNOS_DRM_FLIP_HORIZONTAL : +case EXYNOS_DRM_FLIP_BOTH :return true;default :DRM_DEBUG_KMS ("%s:invalid flip\n" , __func__);
drivers/gpu/drm/exynos/exynos_drm_gsc.c +1 -1
@@ -1391,7 +1391,7 @@ static inline bool gsc_check_drm_flip(enum drm_exynos_flip flip)case EXYNOS_DRM_FLIP_NONE :case EXYNOS_DRM_FLIP_VERTICAL :case EXYNOS_DRM_FLIP_HORIZONTAL : -case EXYNOS_DRM_FLIP_VERTICAL |EXYNOS_DRM_FLIP_HORIZONTAL : +case EXYNOS_DRM_FLIP_BOTH :return true;default :DRM_DEBUG_KMS ("%s:invalid flip\n" , __func__);
drivers/gpu/drm/exynos/exynos_drm_rotator.c +1 -0
@@ -513,6 +513,7 @@ static inline bool rotator_check_drm_flip(enum drm_exynos_flip flip)case EXYNOS_DRM_FLIP_NONE :case EXYNOS_DRM_FLIP_VERTICAL :case EXYNOS_DRM_FLIP_HORIZONTAL : +case EXYNOS_DRM_FLIP_BOTH :return true;default :DRM_DEBUG_KMS ("%s:invalid flip\n" , __func__);
include/uapi/drm/exynos_drm.h +2 -0
@@ -185,6 +185,8 @@ enum drm_exynos_flip {EXYNOS_DRM_FLIP_NONE = (0 <<0 ),EXYNOS_DRM_FLIP_VERTICAL = (1 <<0 ),EXYNOS_DRM_FLIP_HORIZONTAL = (1 <<1 ), +EXYNOS_DRM_FLIP_BOTH =EXYNOS_DRM_FLIP_VERTICAL | + EXYNOS_DRM_FLIP_HORIZONTAL, }; enum drm_exynos_degree {
Signature · 1 line
1.7.0.4
PATCH v3 4/8 drm/exynos: fix build warning.
In reply to Eunchul KimThis patch fixes erroneous register read.
reall function needs register base address + offset but exynos_drm_gsc module used only offset to read a register. so this patch uses gsc_read function instead of readl.
--- drivers/gpu/drm/exynos/exynos_drm_gsc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_gsc.c +1 -1
@@ -1592,7 +1592,7 @@ static int gsc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd)exynos_drm_ippnb_send_event (IPP_SET_WRITEBACK , (void *)&set_wb);/* src local path */ - cfg =readl (GSC_IN_CON ); + cfg =gsc_read (GSC_IN_CON ); cfg &= ~(GSC_IN_PATH_MASK |GSC_IN_LOCAL_SEL_MASK ); cfg |= (GSC_IN_PATH_LOCAL |GSC_IN_LOCAL_FIMD_WB );gsc_write (cfg,GSC_IN_CON );
Signature · 1 line
1.7.0.4
PATCH v3 5/8 drm/exynos: correct some comments to abbreviation.
In reply to Eunchul KimThis patch cleanup corrects some comments to abbreviation. We would like to prevent it stands misunderstood.
--- drivers/gpu/drm/exynos/exynos_drm_fimc.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_gsc.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_ipp.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimc.c +1 -1
@@ -25,7 +25,7 @@#include "exynos_drm_fimc.h" /* -* FIMC is stand for Fully Interactive Mobile Camera and +* FIMC stands for Fully Interactive Mobile Camera and * supports image scaler/rotator and input/output DMA operations. * input DMA reads image data from the memory. * output DMA writes image data to memory.
drivers/gpu/drm/exynos/exynos_drm_gsc.c +1 -1
@@ -25,7 +25,7 @@#include "exynos_drm_gsc.h" /* -* GSC is stand for General SCaler and +* GSC stands for General SCaler and * supports image scaler/rotator and input/output DMA operations. * input DMA reads image data from the memory. * output DMA writes image data to memory.
drivers/gpu/drm/exynos/exynos_drm_ipp.c +1 -1
@@ -27,7 +27,7 @@#include "exynos_drm_iommu.h" /* -* IPP is stand for Image Post Processing and +* IPP stands for Image Post Processing and * supports image scaler/rotator and input/output DMA operations. * using FIMC, GSC, Rotator, so on. * IPP is integration device driver of same attribute h/w
Signature · 1 line
1.7.0.4
PATCH v3 6/8 drm/exynos: remove color bar pattern operation.
In reply to Eunchul KimFrom: JoongMock Shin <[email protected]>
This patch removes color bar pattern register because we don't use the register anymore. because it doesn't support color bar feature for writeback operation. camera driver only supports color bar feature. but IPP doesn't support camera driver.
--- drivers/gpu/drm/exynos/exynos_drm_fimc.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimc.c +3 -6
@@ -163,17 +163,14 @@ struct fimc_context {bool suspended; }; -static void fimc_sw_reset (struct fimc_context *ctx,bool pattern) +static void fimc_sw_reset (struct fimc_context *ctx) {u32 cfg; -DRM_DEBUG_KMS ("%s:pattern[%d]\n" , __func__, pattern); +DRM_DEBUG_KMS ("%s\n" , __func__); cfg =fimc_read (EXYNOS_CISRCFMT ); cfg |=EXYNOS_CISRCFMT_ITU601_8BIT ; -if (pattern) - cfg |=EXYNOS_CIGCTRL_TESTPATTERN_COLOR_BAR ; -fimc_write (cfg,EXYNOS_CISRCFMT );/* s/w reset */
@@ -1536,7 +1533,7 @@ static int fimc_ippdrv_reset(struct device *dev)DRM_DEBUG_KMS ("%s\n" , __func__);/* reset h/w block */ -fimc_sw_reset (ctx, false); +fimc_sw_reset (ctx);/* reset scaler capability */ memset (&ctx->sc,0x0 ,sizeof (ctx->sc));
Signature · 1 line
1.7.0.4
PATCH v3 7/8 drm/exynos: fix incorrect interrupt induced by m2m operation.
In reply to Eunchul KimFrom: Jinyoung Jeon <[email protected]>
This patch fixes incorrect interrupt induced by m2m operation. the m2m operation calls s/w reset every frame but there is the case that the interrupt to m2m operation occures after s/w reset sometimes. So this patch makes dma and capture operations stop at s/w reset to avoid incorrect interrupt.
--- drivers/gpu/drm/exynos/exynos_drm_fimc.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimc.c +13 -0
@@ -169,10 +169,23 @@ static void fimc_sw_reset(struct fimc_context *ctx)DRM_DEBUG_KMS ("%s\n" , __func__); +/* stop dma operation */ + cfg =fimc_read (EXYNOS_CISTATUS ); +if (EXYNOS_CISTATUS_GET_ENVID_STATUS (cfg)) { + cfg =fimc_read (EXYNOS_MSCTRL ); + cfg &= ~EXYNOS_MSCTRL_ENVID ; +fimc_write (cfg,EXYNOS_MSCTRL ); + } + cfg =fimc_read (EXYNOS_CISRCFMT ); cfg |=EXYNOS_CISRCFMT_ITU601_8BIT ;fimc_write (cfg,EXYNOS_CISRCFMT ); +/* disable image capture */ + cfg =fimc_read (EXYNOS_CIIMGCPT ); + cfg &= ~(EXYNOS_CIIMGCPT_IMGCPTEN_SC |EXYNOS_CIIMGCPT_IMGCPTEN ); +fimc_write (cfg,EXYNOS_CIIMGCPT ); +/* s/w reset */ cfg =fimc_read (EXYNOS_CIGCTRL ); cfg |= (EXYNOS_CIGCTRL_SWRST );
Signature · 1 line
1.7.0.4
PATCH v3 8/8 drm/exynos: remove needless parenthesis.
In reply to Eunchul KimThis patch removes needless parenthesis.
This was pointed out but in case of fimc side. we missed it.
--- drivers/gpu/drm/exynos/exynos_drm_fimc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimc.c +1 -1
@@ -1212,7 +1212,7 @@ static int fimc_dst_set_buf_seq(struct fimc_context *ctx, u32 buf_id, }/* sequence id */ - cfg &= (~mask); + cfg &= ~mask; cfg |= (enable << buf_id);fimc_write (cfg,EXYNOS_CIFCNTSEQ );
Signature · 1 line
1.7.0.4