Skip to content

Commit 1cfc64a

Browse files
Paloma Arellanolumag
authored andcommitted
drm/msm/dpu: move widebus logic to its own API
Widebus enablement is decided by the interfaces based on their specific checks and that already happens with DSI/DP specific helpers. Let's invoke these helpers from dpu_encoder_is_widebus_enabled() to make it cleaner overall. Signed-off-by: Paloma Arellano <quic_parellan@quicinc.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Patchwork: https://patchwork.freedesktop.org/patch/579632/ Link: https://lore.kernel.org/r/20240222194025.25329-10-quic_parellan@quicinc.com Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
1 parent ab2f860 commit 1cfc64a

2 files changed

Lines changed: 20 additions & 13 deletions

File tree

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,21 @@ static u32 dither_matrix[DITHER_MATRIX_SZ] = {
221221

222222
bool dpu_encoder_is_widebus_enabled(const struct drm_encoder *drm_enc)
223223
{
224-
const struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc);
224+
const struct dpu_encoder_virt *dpu_enc;
225+
struct msm_drm_private *priv = drm_enc->dev->dev_private;
226+
const struct msm_display_info *disp_info;
227+
int index;
228+
229+
dpu_enc = to_dpu_encoder_virt(drm_enc);
230+
disp_info = &dpu_enc->disp_info;
231+
index = disp_info->h_tile_instance[0];
232+
233+
if (disp_info->intf_type == INTF_DP)
234+
return msm_dp_wide_bus_available(priv->dp[index]);
235+
else if (disp_info->intf_type == INTF_DSI)
236+
return msm_dsi_wide_bus_enabled(priv->dsi[index]);
225237

226-
return dpu_enc->wide_bus_en;
238+
return false;
227239
}
228240

229241
bool dpu_encoder_is_dsc_enabled(const struct drm_encoder *drm_enc)
@@ -1209,26 +1221,17 @@ static void dpu_encoder_virt_atomic_enable(struct drm_encoder *drm_enc,
12091221
struct dpu_encoder_virt *dpu_enc = NULL;
12101222
int ret = 0;
12111223
struct drm_display_mode *cur_mode = NULL;
1212-
struct msm_drm_private *priv = drm_enc->dev->dev_private;
1213-
struct msm_display_info *disp_info;
1214-
int index;
12151224

12161225
dpu_enc = to_dpu_encoder_virt(drm_enc);
1217-
disp_info = &dpu_enc->disp_info;
1218-
index = disp_info->h_tile_instance[0];
1219-
12201226
dpu_enc->dsc = dpu_encoder_get_dsc_config(drm_enc);
12211227

12221228
atomic_set(&dpu_enc->frame_done_timeout_cnt, 0);
12231229

1224-
if (disp_info->intf_type == INTF_DP)
1225-
dpu_enc->wide_bus_en = msm_dp_wide_bus_available(priv->dp[index]);
1226-
else if (disp_info->intf_type == INTF_DSI)
1227-
dpu_enc->wide_bus_en = msm_dsi_wide_bus_enabled(priv->dsi[index]);
1228-
12291230
mutex_lock(&dpu_enc->enc_lock);
12301231
cur_mode = &dpu_enc->base.crtc->state->adjusted_mode;
12311232

1233+
dpu_enc->wide_bus_en = dpu_encoder_is_widebus_enabled(drm_enc);
1234+
12321235
trace_dpu_enc_enable(DRMID(drm_enc), cur_mode->hdisplay,
12331236
cur_mode->vdisplay);
12341237

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ int dpu_encoder_get_linecount(struct drm_encoder *drm_enc);
156156
*/
157157
int dpu_encoder_get_vsync_count(struct drm_encoder *drm_enc);
158158

159+
/**
160+
* dpu_encoder_is_widebus_enabled - return bool value if widebus is enabled
161+
* @drm_enc: Pointer to previously created drm encoder structure
162+
*/
159163
bool dpu_encoder_is_widebus_enabled(const struct drm_encoder *drm_enc);
160164

161165
/**

0 commit comments

Comments
 (0)