Skip to content

Commit b01a582

Browse files
jayesh-tigregkh
authored andcommitted
drm/bridge: cadence: cdns-mhdp8546-core: Add mode_valid hook to drm_bridge_funcs
[ Upstream commit 6dbff34 ] Add cdns_mhdp_bridge_mode_valid() to check if specific mode is valid for this bridge or not. In the legacy usecase with !DRM_BRIDGE_ATTACH_NO_CONNECTOR we were using the hook from drm_connector_helper_funcs but with DRM_BRIDGE_ATTACH_NO_CONNECTOR we need to have mode_valid() in drm_bridge_funcs. Without this patch, when using DRM_BRIDGE_ATTACH_NO_CONNECTOR flag, the cdns_mhdp_bandwidth_ok() function would not be called during mode validation, potentially allowing modes that exceed the bridge's bandwidth capabilities to be incorrectly marked as valid. Fixes: c932ced ("drm/tidss: Update encoder/bridge chain connect model") Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Jayesh Choudhary <j-choudhary@ti.com> Signed-off-by: Harikrishna Shenoy <h-shenoy@ti.com> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Link: https://patch.msgid.link/20251209120332.3559893-3-h-shenoy@ti.com Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 5302015 commit b01a582

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2234,6 +2234,25 @@ static struct edid *cdns_mhdp_bridge_get_edid(struct drm_bridge *bridge,
22342234
return cdns_mhdp_get_edid(mhdp, connector);
22352235
}
22362236

2237+
static enum drm_mode_status
2238+
cdns_mhdp_bridge_mode_valid(struct drm_bridge *bridge,
2239+
const struct drm_display_info *info,
2240+
const struct drm_display_mode *mode)
2241+
{
2242+
struct cdns_mhdp_device *mhdp = bridge_to_mhdp(bridge);
2243+
2244+
mutex_lock(&mhdp->link_mutex);
2245+
2246+
if (!cdns_mhdp_bandwidth_ok(mhdp, mode, mhdp->link.num_lanes,
2247+
mhdp->link.rate)) {
2248+
mutex_unlock(&mhdp->link_mutex);
2249+
return MODE_CLOCK_HIGH;
2250+
}
2251+
2252+
mutex_unlock(&mhdp->link_mutex);
2253+
return MODE_OK;
2254+
}
2255+
22372256
static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = {
22382257
.atomic_enable = cdns_mhdp_atomic_enable,
22392258
.atomic_disable = cdns_mhdp_atomic_disable,
@@ -2248,6 +2267,7 @@ static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = {
22482267
.get_edid = cdns_mhdp_bridge_get_edid,
22492268
.hpd_enable = cdns_mhdp_bridge_hpd_enable,
22502269
.hpd_disable = cdns_mhdp_bridge_hpd_disable,
2270+
.mode_valid = cdns_mhdp_bridge_mode_valid,
22512271
};
22522272

22532273
static bool cdns_mhdp_detect_hpd(struct cdns_mhdp_device *mhdp, bool *hpd_pulse)

0 commit comments

Comments
 (0)