Commit 6ee11c41 authored by Dmitry Baryshkov's avatar Dmitry Baryshkov

drm/msm/dpu: get rid of dpu_encoder_helper_(un)register_irq

Get rid of dpu_encoder_helper_register_irq/unregister_irq helpers, call
dpu_core_register/unregister_callback directly, without surrounding them
with helpers.
Reviewed-by: default avatarAbhinav Kumar <abhinavk@codeaurora.org>
Reviewed-by: default avatarStephen Boyd <swboyd@chromium.org>
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/474698/
Link: https://lore.kernel.org/r/20220217043148.480898-5-dmitry.baryshkov@linaro.orgSigned-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
parent c929ac60
...@@ -350,69 +350,6 @@ int dpu_encoder_helper_wait_for_irq(struct dpu_encoder_phys *phys_enc, ...@@ -350,69 +350,6 @@ int dpu_encoder_helper_wait_for_irq(struct dpu_encoder_phys *phys_enc,
return ret; return ret;
} }
int dpu_encoder_helper_register_irq(struct dpu_encoder_phys *phys_enc,
enum dpu_intr_idx intr_idx)
{
struct dpu_encoder_irq *irq;
int ret = 0;
if (intr_idx >= INTR_IDX_MAX) {
DPU_ERROR("invalid params\n");
return -EINVAL;
}
irq = &phys_enc->irq[intr_idx];
if (irq->irq_idx < 0) {
DPU_ERROR_PHYS(phys_enc,
"invalid IRQ index:%d\n", irq->irq_idx);
return -EINVAL;
}
ret = dpu_core_irq_register_callback(phys_enc->dpu_kms, irq->irq_idx,
irq->func, phys_enc);
if (ret) {
DPU_ERROR_PHYS(phys_enc,
"failed to register IRQ callback for %s\n",
irq->name);
irq->irq_idx = -EINVAL;
return ret;
}
trace_dpu_enc_irq_register_success(DRMID(phys_enc->parent), intr_idx,
irq->irq_idx);
return ret;
}
int dpu_encoder_helper_unregister_irq(struct dpu_encoder_phys *phys_enc,
enum dpu_intr_idx intr_idx)
{
struct dpu_encoder_irq *irq;
int ret;
irq = &phys_enc->irq[intr_idx];
/* silently skip irqs that weren't registered */
if (irq->irq_idx < 0) {
DRM_ERROR("duplicate unregister id=%u, intr=%d, irq=%d",
DRMID(phys_enc->parent), intr_idx,
irq->irq_idx);
return 0;
}
ret = dpu_core_irq_unregister_callback(phys_enc->dpu_kms, irq->irq_idx);
if (ret) {
DRM_ERROR("unreg cb fail id=%u, intr=%d, irq=%d ret=%d",
DRMID(phys_enc->parent), intr_idx,
irq->irq_idx, ret);
}
trace_dpu_enc_irq_unregister_success(DRMID(phys_enc->parent), intr_idx,
irq->irq_idx);
return 0;
}
int dpu_encoder_get_vsync_count(struct drm_encoder *drm_enc) int dpu_encoder_get_vsync_count(struct drm_encoder *drm_enc)
{ {
struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc); struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc);
......
...@@ -363,22 +363,4 @@ int dpu_encoder_helper_wait_for_irq(struct dpu_encoder_phys *phys_enc, ...@@ -363,22 +363,4 @@ int dpu_encoder_helper_wait_for_irq(struct dpu_encoder_phys *phys_enc,
enum dpu_intr_idx intr_idx, enum dpu_intr_idx intr_idx,
struct dpu_encoder_wait_info *wait_info); struct dpu_encoder_wait_info *wait_info);
/**
* dpu_encoder_helper_register_irq - register and enable an irq
* @phys_enc: Pointer to physical encoder structure
* @intr_idx: encoder interrupt index
* @Return: 0 or -ERROR
*/
int dpu_encoder_helper_register_irq(struct dpu_encoder_phys *phys_enc,
enum dpu_intr_idx intr_idx);
/**
* dpu_encoder_helper_unregister_irq - unregister and disable an irq
* @phys_enc: Pointer to physical encoder structure
* @intr_idx: encoder interrupt index
* @Return: 0 or -ERROR
*/
int dpu_encoder_helper_unregister_irq(struct dpu_encoder_phys *phys_enc,
enum dpu_intr_idx intr_idx);
#endif /* __dpu_encoder_phys_H__ */ #endif /* __dpu_encoder_phys_H__ */
...@@ -192,7 +192,8 @@ static int _dpu_encoder_phys_cmd_handle_ppdone_timeout( ...@@ -192,7 +192,8 @@ static int _dpu_encoder_phys_cmd_handle_ppdone_timeout(
cmd_enc->pp_timeout_report_cnt, cmd_enc->pp_timeout_report_cnt,
atomic_read(&phys_enc->pending_kickoff_cnt)); atomic_read(&phys_enc->pending_kickoff_cnt));
msm_disp_snapshot_state(drm_enc->dev); msm_disp_snapshot_state(drm_enc->dev);
dpu_encoder_helper_unregister_irq(phys_enc, INTR_IDX_RDPTR); dpu_core_irq_unregister_callback(phys_enc->dpu_kms,
phys_enc->irq[INTR_IDX_RDPTR].irq_idx);
} }
atomic_add_unless(&phys_enc->pending_kickoff_cnt, -1, 0); atomic_add_unless(&phys_enc->pending_kickoff_cnt, -1, 0);
...@@ -258,10 +259,12 @@ static int dpu_encoder_phys_cmd_control_vblank_irq( ...@@ -258,10 +259,12 @@ static int dpu_encoder_phys_cmd_control_vblank_irq(
enable ? "true" : "false", refcount); enable ? "true" : "false", refcount);
if (enable && atomic_inc_return(&phys_enc->vblank_refcount) == 1) if (enable && atomic_inc_return(&phys_enc->vblank_refcount) == 1)
ret = dpu_encoder_helper_register_irq(phys_enc, INTR_IDX_RDPTR); ret = dpu_core_irq_register_callback(phys_enc->dpu_kms,
phys_enc->irq[INTR_IDX_RDPTR].irq_idx,
phys_enc->irq[INTR_IDX_RDPTR].func, phys_enc);
else if (!enable && atomic_dec_return(&phys_enc->vblank_refcount) == 0) else if (!enable && atomic_dec_return(&phys_enc->vblank_refcount) == 0)
ret = dpu_encoder_helper_unregister_irq(phys_enc, ret = dpu_core_irq_unregister_callback(phys_enc->dpu_kms,
INTR_IDX_RDPTR); phys_enc->irq[INTR_IDX_RDPTR].irq_idx);
end: end:
if (ret) { if (ret) {
...@@ -282,21 +285,28 @@ static void dpu_encoder_phys_cmd_irq_control(struct dpu_encoder_phys *phys_enc, ...@@ -282,21 +285,28 @@ static void dpu_encoder_phys_cmd_irq_control(struct dpu_encoder_phys *phys_enc,
enable, atomic_read(&phys_enc->vblank_refcount)); enable, atomic_read(&phys_enc->vblank_refcount));
if (enable) { if (enable) {
dpu_encoder_helper_register_irq(phys_enc, INTR_IDX_PINGPONG); dpu_core_irq_register_callback(phys_enc->dpu_kms,
dpu_encoder_helper_register_irq(phys_enc, INTR_IDX_UNDERRUN); phys_enc->irq[INTR_IDX_PINGPONG].irq_idx,
phys_enc->irq[INTR_IDX_PINGPONG].func, phys_enc);
dpu_core_irq_register_callback(phys_enc->dpu_kms,
phys_enc->irq[INTR_IDX_UNDERRUN].irq_idx,
phys_enc->irq[INTR_IDX_UNDERRUN].func, phys_enc);
dpu_encoder_phys_cmd_control_vblank_irq(phys_enc, true); dpu_encoder_phys_cmd_control_vblank_irq(phys_enc, true);
if (dpu_encoder_phys_cmd_is_master(phys_enc)) if (dpu_encoder_phys_cmd_is_master(phys_enc))
dpu_encoder_helper_register_irq(phys_enc, dpu_core_irq_register_callback(phys_enc->dpu_kms,
INTR_IDX_CTL_START); phys_enc->irq[INTR_IDX_CTL_START].irq_idx,
phys_enc->irq[INTR_IDX_CTL_START].func, phys_enc);
} else { } else {
if (dpu_encoder_phys_cmd_is_master(phys_enc)) if (dpu_encoder_phys_cmd_is_master(phys_enc))
dpu_encoder_helper_unregister_irq(phys_enc, dpu_core_irq_unregister_callback(phys_enc->dpu_kms,
INTR_IDX_CTL_START); phys_enc->irq[INTR_IDX_CTL_START].irq_idx);
dpu_encoder_helper_unregister_irq(phys_enc, INTR_IDX_UNDERRUN); dpu_core_irq_unregister_callback(phys_enc->dpu_kms,
phys_enc->irq[INTR_IDX_UNDERRUN].irq_idx);
dpu_encoder_phys_cmd_control_vblank_irq(phys_enc, false); dpu_encoder_phys_cmd_control_vblank_irq(phys_enc, false);
dpu_encoder_helper_unregister_irq(phys_enc, INTR_IDX_PINGPONG); dpu_core_irq_unregister_callback(phys_enc->dpu_kms,
phys_enc->irq[INTR_IDX_PINGPONG].irq_idx);
} }
} }
......
...@@ -399,10 +399,12 @@ static int dpu_encoder_phys_vid_control_vblank_irq( ...@@ -399,10 +399,12 @@ static int dpu_encoder_phys_vid_control_vblank_irq(
atomic_read(&phys_enc->vblank_refcount)); atomic_read(&phys_enc->vblank_refcount));
if (enable && atomic_inc_return(&phys_enc->vblank_refcount) == 1) if (enable && atomic_inc_return(&phys_enc->vblank_refcount) == 1)
ret = dpu_encoder_helper_register_irq(phys_enc, INTR_IDX_VSYNC); ret = dpu_core_irq_register_callback(phys_enc->dpu_kms,
phys_enc->irq[INTR_IDX_VSYNC].irq_idx,
phys_enc->irq[INTR_IDX_VSYNC].func, phys_enc);
else if (!enable && atomic_dec_return(&phys_enc->vblank_refcount) == 0) else if (!enable && atomic_dec_return(&phys_enc->vblank_refcount) == 0)
ret = dpu_encoder_helper_unregister_irq(phys_enc, ret = dpu_core_irq_unregister_callback(phys_enc->dpu_kms,
INTR_IDX_VSYNC); phys_enc->irq[INTR_IDX_VSYNC].irq_idx);
end: end:
if (ret) { if (ret) {
...@@ -527,7 +529,8 @@ static void dpu_encoder_phys_vid_prepare_for_kickoff( ...@@ -527,7 +529,8 @@ static void dpu_encoder_phys_vid_prepare_for_kickoff(
DPU_ERROR_VIDENC(phys_enc, "ctl %d reset failure: %d\n", DPU_ERROR_VIDENC(phys_enc, "ctl %d reset failure: %d\n",
ctl->idx, rc); ctl->idx, rc);
msm_disp_snapshot_state(drm_enc->dev); msm_disp_snapshot_state(drm_enc->dev);
dpu_encoder_helper_unregister_irq(phys_enc, INTR_IDX_VSYNC); dpu_core_irq_unregister_callback(phys_enc->dpu_kms,
phys_enc->irq[INTR_IDX_VSYNC].irq_idx);
} }
} }
...@@ -616,10 +619,13 @@ static void dpu_encoder_phys_vid_irq_control(struct dpu_encoder_phys *phys_enc, ...@@ -616,10 +619,13 @@ static void dpu_encoder_phys_vid_irq_control(struct dpu_encoder_phys *phys_enc,
if (WARN_ON(ret)) if (WARN_ON(ret))
return; return;
dpu_encoder_helper_register_irq(phys_enc, INTR_IDX_UNDERRUN); dpu_core_irq_register_callback(phys_enc->dpu_kms,
phys_enc->irq[INTR_IDX_UNDERRUN].irq_idx,
phys_enc->irq[INTR_IDX_UNDERRUN].func, phys_enc);
} else { } else {
dpu_encoder_phys_vid_control_vblank_irq(phys_enc, false); dpu_encoder_phys_vid_control_vblank_irq(phys_enc, false);
dpu_encoder_helper_unregister_irq(phys_enc, INTR_IDX_UNDERRUN); dpu_core_irq_unregister_callback(phys_enc->dpu_kms,
phys_enc->irq[INTR_IDX_UNDERRUN].irq_idx);
} }
} }
......
...@@ -475,6 +475,8 @@ int dpu_core_irq_register_callback(struct dpu_kms *dpu_kms, int irq_idx, ...@@ -475,6 +475,8 @@ int dpu_core_irq_register_callback(struct dpu_kms *dpu_kms, int irq_idx,
irq_idx); irq_idx);
spin_unlock_irqrestore(&dpu_kms->hw_intr->irq_lock, irq_flags); spin_unlock_irqrestore(&dpu_kms->hw_intr->irq_lock, irq_flags);
trace_dpu_irq_register_success(irq_idx);
return 0; return 0;
} }
...@@ -503,6 +505,8 @@ int dpu_core_irq_unregister_callback(struct dpu_kms *dpu_kms, int irq_idx) ...@@ -503,6 +505,8 @@ int dpu_core_irq_unregister_callback(struct dpu_kms *dpu_kms, int irq_idx)
spin_unlock_irqrestore(&dpu_kms->hw_intr->irq_lock, irq_flags); spin_unlock_irqrestore(&dpu_kms->hw_intr->irq_lock, irq_flags);
trace_dpu_irq_unregister_success(irq_idx);
return 0; return 0;
} }
......
...@@ -167,33 +167,24 @@ TRACE_EVENT(dpu_perf_crtc_update, ...@@ -167,33 +167,24 @@ TRACE_EVENT(dpu_perf_crtc_update,
__entry->update_clk) __entry->update_clk)
); );
DECLARE_EVENT_CLASS(dpu_enc_irq_template, DECLARE_EVENT_CLASS(dpu_irq_template,
TP_PROTO(uint32_t drm_id, enum dpu_intr_idx intr_idx, TP_PROTO(int irq_idx),
int irq_idx), TP_ARGS(irq_idx),
TP_ARGS(drm_id, intr_idx, irq_idx),
TP_STRUCT__entry( TP_STRUCT__entry(
__field( uint32_t, drm_id )
__field( enum dpu_intr_idx, intr_idx )
__field( int, irq_idx ) __field( int, irq_idx )
), ),
TP_fast_assign( TP_fast_assign(
__entry->drm_id = drm_id;
__entry->intr_idx = intr_idx;
__entry->irq_idx = irq_idx; __entry->irq_idx = irq_idx;
), ),
TP_printk("id=%u, intr=%d, irq=%d", TP_printk("irq=%d", __entry->irq_idx)
__entry->drm_id, __entry->intr_idx,
__entry->irq_idx)
); );
DEFINE_EVENT(dpu_enc_irq_template, dpu_enc_irq_register_success, DEFINE_EVENT(dpu_irq_template, dpu_irq_register_success,
TP_PROTO(uint32_t drm_id, enum dpu_intr_idx intr_idx, TP_PROTO(int irq_idx),
int irq_idx), TP_ARGS(irq_idx)
TP_ARGS(drm_id, intr_idx, irq_idx)
); );
DEFINE_EVENT(dpu_enc_irq_template, dpu_enc_irq_unregister_success, DEFINE_EVENT(dpu_irq_template, dpu_irq_unregister_success,
TP_PROTO(uint32_t drm_id, enum dpu_intr_idx intr_idx, TP_PROTO(int irq_idx),
int irq_idx), TP_ARGS(irq_idx)
TP_ARGS(drm_id, intr_idx, irq_idx)
); );
TRACE_EVENT(dpu_enc_irq_wait_success, TRACE_EVENT(dpu_enc_irq_wait_success,
......
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