Commit a2380124 authored by Archit Taneja's avatar Archit Taneja Committed by Rob Clark

drm/msm/mdp5: Simplify LM <-> PP mapping

PingPong ID for a Layer Mixer is already contained in
mdp5_hw_mixer.

This avoids the need to retrieve PP ID using macros
Signed-off-by: default avatarArchit Taneja <architt@codeaurora.org>
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
parent adfc0e63
...@@ -52,7 +52,7 @@ static int pingpong_tearcheck_setup(struct drm_encoder *encoder, ...@@ -52,7 +52,7 @@ static int pingpong_tearcheck_setup(struct drm_encoder *encoder,
u32 total_lines_x100, vclks_line, cfg; u32 total_lines_x100, vclks_line, cfg;
long vsync_clk_speed; long vsync_clk_speed;
struct mdp5_hw_mixer *mixer = mdp5_crtc_get_mixer(encoder->crtc); struct mdp5_hw_mixer *mixer = mdp5_crtc_get_mixer(encoder->crtc);
int pp_id = GET_PING_PONG_ID(mixer->lm); int pp_id = mixer->pp;
if (IS_ERR_OR_NULL(mdp5_kms->vsync_clk)) { if (IS_ERR_OR_NULL(mdp5_kms->vsync_clk)) {
dev_err(dev, "vsync_clk is not initialized\n"); dev_err(dev, "vsync_clk is not initialized\n");
...@@ -96,7 +96,7 @@ static int pingpong_tearcheck_enable(struct drm_encoder *encoder) ...@@ -96,7 +96,7 @@ static int pingpong_tearcheck_enable(struct drm_encoder *encoder)
{ {
struct mdp5_kms *mdp5_kms = get_kms(encoder); struct mdp5_kms *mdp5_kms = get_kms(encoder);
struct mdp5_hw_mixer *mixer = mdp5_crtc_get_mixer(encoder->crtc); struct mdp5_hw_mixer *mixer = mdp5_crtc_get_mixer(encoder->crtc);
int pp_id = GET_PING_PONG_ID(mixer->lm); int pp_id = mixer->pp;
int ret; int ret;
ret = clk_set_rate(mdp5_kms->vsync_clk, ret = clk_set_rate(mdp5_kms->vsync_clk,
...@@ -122,7 +122,7 @@ static void pingpong_tearcheck_disable(struct drm_encoder *encoder) ...@@ -122,7 +122,7 @@ static void pingpong_tearcheck_disable(struct drm_encoder *encoder)
{ {
struct mdp5_kms *mdp5_kms = get_kms(encoder); struct mdp5_kms *mdp5_kms = get_kms(encoder);
struct mdp5_hw_mixer *mixer = mdp5_crtc_get_mixer(encoder->crtc); struct mdp5_hw_mixer *mixer = mdp5_crtc_get_mixer(encoder->crtc);
int pp_id = GET_PING_PONG_ID(mixer->lm); int pp_id = mixer->pp;
mdp5_write(mdp5_kms, REG_MDP5_PP_TEAR_CHECK_EN(pp_id), 0); mdp5_write(mdp5_kms, REG_MDP5_PP_TEAR_CHECK_EN(pp_id), 0);
clk_disable_unprepare(mdp5_kms->vsync_clk); clk_disable_unprepare(mdp5_kms->vsync_clk);
......
...@@ -755,15 +755,14 @@ void mdp5_crtc_set_pipeline(struct drm_crtc *crtc, ...@@ -755,15 +755,14 @@ void mdp5_crtc_set_pipeline(struct drm_crtc *crtc,
struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc); struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc);
struct mdp5_kms *mdp5_kms = get_kms(crtc); struct mdp5_kms *mdp5_kms = get_kms(crtc);
struct mdp5_hw_mixer *mixer = mdp5_crtc->mixer; struct mdp5_hw_mixer *mixer = mdp5_crtc->mixer;
uint32_t lm = mixer->lm;
/* now that we know what irq's we want: */ /* now that we know what irq's we want: */
mdp5_crtc->err.irqmask = intf2err(intf->num); mdp5_crtc->err.irqmask = intf2err(intf->num);
mdp5_crtc->vblank.irqmask = intf2vblank(lm, intf); mdp5_crtc->vblank.irqmask = intf2vblank(mixer, intf);
if ((intf->type == INTF_DSI) && if ((intf->type == INTF_DSI) &&
(intf->mode == MDP5_INTF_DSI_MODE_COMMAND)) { (intf->mode == MDP5_INTF_DSI_MODE_COMMAND)) {
mdp5_crtc->pp_done.irqmask = lm2ppdone(lm); mdp5_crtc->pp_done.irqmask = lm2ppdone(mixer);
mdp5_crtc->pp_done.irq = mdp5_crtc_pp_done_irq; mdp5_crtc->pp_done.irq = mdp5_crtc_pp_done_irq;
mdp5_crtc->cmd_mode = true; mdp5_crtc->cmd_mode = true;
} else { } else {
......
...@@ -238,7 +238,7 @@ static void mdp5_vid_encoder_disable(struct drm_encoder *encoder) ...@@ -238,7 +238,7 @@ static void mdp5_vid_encoder_disable(struct drm_encoder *encoder)
* the settings changes for the new modeset (like new * the settings changes for the new modeset (like new
* scanout buffer) don't latch properly.. * scanout buffer) don't latch properly..
*/ */
mdp_irq_wait(&mdp5_kms->base, intf2vblank(mixer->lm, intf)); mdp_irq_wait(&mdp5_kms->base, intf2vblank(mixer, intf));
bs_set(mdp5_encoder, 0); bs_set(mdp5_encoder, 0);
......
...@@ -201,8 +201,8 @@ static inline uint32_t intf2err(int intf_num) ...@@ -201,8 +201,8 @@ static inline uint32_t intf2err(int intf_num)
} }
} }
#define GET_PING_PONG_ID(layer_mixer) ((layer_mixer == 5) ? 3 : layer_mixer) static inline uint32_t intf2vblank(struct mdp5_hw_mixer *mixer,
static inline uint32_t intf2vblank(int lm, struct mdp5_interface *intf) struct mdp5_interface *intf)
{ {
/* /*
* In case of DSI Command Mode, the Ping Pong's read pointer IRQ * In case of DSI Command Mode, the Ping Pong's read pointer IRQ
...@@ -212,7 +212,7 @@ static inline uint32_t intf2vblank(int lm, struct mdp5_interface *intf) ...@@ -212,7 +212,7 @@ static inline uint32_t intf2vblank(int lm, struct mdp5_interface *intf)
if ((intf->type == INTF_DSI) && if ((intf->type == INTF_DSI) &&
(intf->mode == MDP5_INTF_DSI_MODE_COMMAND)) (intf->mode == MDP5_INTF_DSI_MODE_COMMAND))
return MDP5_IRQ_PING_PONG_0_RD_PTR << GET_PING_PONG_ID(lm); return MDP5_IRQ_PING_PONG_0_RD_PTR << mixer->pp;
if (intf->type == INTF_WB) if (intf->type == INTF_WB)
return MDP5_IRQ_WB_2_DONE; return MDP5_IRQ_WB_2_DONE;
...@@ -226,9 +226,9 @@ static inline uint32_t intf2vblank(int lm, struct mdp5_interface *intf) ...@@ -226,9 +226,9 @@ static inline uint32_t intf2vblank(int lm, struct mdp5_interface *intf)
} }
} }
static inline uint32_t lm2ppdone(int lm) static inline uint32_t lm2ppdone(struct mdp5_hw_mixer *mixer)
{ {
return MDP5_IRQ_PING_PONG_0_DONE << GET_PING_PONG_ID(lm); return MDP5_IRQ_PING_PONG_0_DONE << mixer->pp;
} }
int mdp5_disable(struct mdp5_kms *mdp5_kms); int mdp5_disable(struct mdp5_kms *mdp5_kms);
......
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