Commit bb9f1880 authored by Marijn Suijten's avatar Marijn Suijten Committed by Dmitry Baryshkov

drm/msm/dpu: Merge setup_- and enable_tearcheck pingpong callbacks

These functions are always called consecutively and are best bundled
together for simplicity, especially when the same structure of callbacks
will be replicated later on the interface block for INTF TE support.
The enable_tearcheck(false) case is now replaced with a more obvious
disable_tearcheck(), encapsulating the original register write with 0.
Suggested-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: default avatarMarijn Suijten <marijn.suijten@somainline.org>
Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/534217/
Link: https://lore.kernel.org/r/20230411-dpu-intf-te-v4-20-27ce1a5ab5c6@somainline.orgSigned-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
parent 0272b9c3
...@@ -327,8 +327,7 @@ static void dpu_encoder_phys_cmd_tearcheck_config( ...@@ -327,8 +327,7 @@ static void dpu_encoder_phys_cmd_tearcheck_config(
DPU_DEBUG_CMDENC(cmd_enc, "pp %d\n", phys_enc->hw_pp->idx - PINGPONG_0); DPU_DEBUG_CMDENC(cmd_enc, "pp %d\n", phys_enc->hw_pp->idx - PINGPONG_0);
if (!phys_enc->hw_pp->ops.setup_tearcheck || if (!phys_enc->hw_pp->ops.enable_tearcheck) {
!phys_enc->hw_pp->ops.enable_tearcheck) {
DPU_DEBUG_CMDENC(cmd_enc, "tearcheck not supported\n"); DPU_DEBUG_CMDENC(cmd_enc, "tearcheck not supported\n");
return; return;
} }
...@@ -383,8 +382,7 @@ static void dpu_encoder_phys_cmd_tearcheck_config( ...@@ -383,8 +382,7 @@ static void dpu_encoder_phys_cmd_tearcheck_config(
phys_enc->hw_pp->idx - PINGPONG_0, tc_cfg.sync_cfg_height, phys_enc->hw_pp->idx - PINGPONG_0, tc_cfg.sync_cfg_height,
tc_cfg.sync_threshold_start, tc_cfg.sync_threshold_continue); tc_cfg.sync_threshold_start, tc_cfg.sync_threshold_continue);
phys_enc->hw_pp->ops.setup_tearcheck(phys_enc->hw_pp, &tc_cfg); phys_enc->hw_pp->ops.enable_tearcheck(phys_enc->hw_pp, &tc_cfg);
phys_enc->hw_pp->ops.enable_tearcheck(phys_enc->hw_pp, tc_enable);
} }
static void _dpu_encoder_phys_cmd_pingpong_config( static void _dpu_encoder_phys_cmd_pingpong_config(
...@@ -511,8 +509,8 @@ static void dpu_encoder_phys_cmd_disable(struct dpu_encoder_phys *phys_enc) ...@@ -511,8 +509,8 @@ static void dpu_encoder_phys_cmd_disable(struct dpu_encoder_phys *phys_enc)
return; return;
} }
if (phys_enc->hw_pp->ops.enable_tearcheck) if (phys_enc->hw_pp->ops.disable_tearcheck)
phys_enc->hw_pp->ops.enable_tearcheck(phys_enc->hw_pp, false); phys_enc->hw_pp->ops.disable_tearcheck(phys_enc->hw_pp);
if (phys_enc->hw_intf->ops.bind_pingpong_blk) { if (phys_enc->hw_intf->ops.bind_pingpong_blk) {
phys_enc->hw_intf->ops.bind_pingpong_blk( phys_enc->hw_intf->ops.bind_pingpong_blk(
......
...@@ -73,7 +73,7 @@ static void dpu_hw_pp_setup_dither(struct dpu_hw_pingpong *pp, ...@@ -73,7 +73,7 @@ static void dpu_hw_pp_setup_dither(struct dpu_hw_pingpong *pp,
DPU_REG_WRITE(c, base + PP_DITHER_EN, 1); DPU_REG_WRITE(c, base + PP_DITHER_EN, 1);
} }
static int dpu_hw_pp_setup_te_config(struct dpu_hw_pingpong *pp, static int dpu_hw_pp_enable_te(struct dpu_hw_pingpong *pp,
struct dpu_hw_tear_check *te) struct dpu_hw_tear_check *te)
{ {
struct dpu_hw_blk_reg_map *c; struct dpu_hw_blk_reg_map *c;
...@@ -100,6 +100,8 @@ static int dpu_hw_pp_setup_te_config(struct dpu_hw_pingpong *pp, ...@@ -100,6 +100,8 @@ static int dpu_hw_pp_setup_te_config(struct dpu_hw_pingpong *pp,
DPU_REG_WRITE(c, PP_SYNC_WRCOUNT, DPU_REG_WRITE(c, PP_SYNC_WRCOUNT,
(te->start_pos + te->sync_threshold_start + 1)); (te->start_pos + te->sync_threshold_start + 1));
DPU_REG_WRITE(c, PP_TEAR_CHECK_EN, 1);
return 0; return 0;
} }
...@@ -126,7 +128,7 @@ static bool dpu_hw_pp_get_autorefresh_config(struct dpu_hw_pingpong *pp, ...@@ -126,7 +128,7 @@ static bool dpu_hw_pp_get_autorefresh_config(struct dpu_hw_pingpong *pp,
return !!((val & BIT(31)) >> 31); return !!((val & BIT(31)) >> 31);
} }
static int dpu_hw_pp_enable_te(struct dpu_hw_pingpong *pp, bool enable) static int dpu_hw_pp_disable_te(struct dpu_hw_pingpong *pp)
{ {
struct dpu_hw_blk_reg_map *c; struct dpu_hw_blk_reg_map *c;
...@@ -134,7 +136,7 @@ static int dpu_hw_pp_enable_te(struct dpu_hw_pingpong *pp, bool enable) ...@@ -134,7 +136,7 @@ static int dpu_hw_pp_enable_te(struct dpu_hw_pingpong *pp, bool enable)
return -EINVAL; return -EINVAL;
c = &pp->hw; c = &pp->hw;
DPU_REG_WRITE(c, PP_TEAR_CHECK_EN, enable); DPU_REG_WRITE(c, PP_TEAR_CHECK_EN, 0);
return 0; return 0;
} }
...@@ -283,8 +285,8 @@ static void _setup_pingpong_ops(struct dpu_hw_pingpong *c, ...@@ -283,8 +285,8 @@ static void _setup_pingpong_ops(struct dpu_hw_pingpong *c,
unsigned long features) unsigned long features)
{ {
if (test_bit(DPU_PINGPONG_TE, &features)) { if (test_bit(DPU_PINGPONG_TE, &features)) {
c->ops.setup_tearcheck = dpu_hw_pp_setup_te_config;
c->ops.enable_tearcheck = dpu_hw_pp_enable_te; c->ops.enable_tearcheck = dpu_hw_pp_enable_te;
c->ops.disable_tearcheck = dpu_hw_pp_disable_te;
c->ops.connect_external_te = dpu_hw_pp_connect_external_te; c->ops.connect_external_te = dpu_hw_pp_connect_external_te;
c->ops.get_line_count = dpu_hw_pp_get_line_count; c->ops.get_line_count = dpu_hw_pp_get_line_count;
c->ops.disable_autorefresh = dpu_hw_pp_disable_autorefresh; c->ops.disable_autorefresh = dpu_hw_pp_disable_autorefresh;
......
...@@ -37,8 +37,8 @@ struct dpu_hw_dither_cfg { ...@@ -37,8 +37,8 @@ struct dpu_hw_dither_cfg {
* *
* struct dpu_hw_pingpong_ops : Interface to the pingpong Hw driver functions * struct dpu_hw_pingpong_ops : Interface to the pingpong Hw driver functions
* Assumption is these functions will be called after clocks are enabled * Assumption is these functions will be called after clocks are enabled
* @setup_tearcheck : program tear check values * @enable_tearcheck: program and enable tear check block
* @enable_tearcheck : enables tear check * @disable_tearcheck: disable able tear check block
* @setup_dither : function to program the dither hw block * @setup_dither : function to program the dither hw block
* @get_line_count: obtain current vertical line counter * @get_line_count: obtain current vertical line counter
*/ */
...@@ -47,14 +47,13 @@ struct dpu_hw_pingpong_ops { ...@@ -47,14 +47,13 @@ struct dpu_hw_pingpong_ops {
* enables vysnc generation and sets up init value of * enables vysnc generation and sets up init value of
* read pointer and programs the tear check cofiguration * read pointer and programs the tear check cofiguration
*/ */
int (*setup_tearcheck)(struct dpu_hw_pingpong *pp, int (*enable_tearcheck)(struct dpu_hw_pingpong *pp,
struct dpu_hw_tear_check *cfg); struct dpu_hw_tear_check *cfg);
/** /**
* enables tear check block * disables tear check block
*/ */
int (*enable_tearcheck)(struct dpu_hw_pingpong *pp, int (*disable_tearcheck)(struct dpu_hw_pingpong *pp);
bool enable);
/** /**
* read, modify, write to either set or clear listening to external TE * read, modify, write to either set or clear listening to external TE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment