Extend struct drm_bus_cfg with a clock field. This makes it possible for an upstream bridge (further from scanout engine) to indicate to a downstream bridge which frequency it expects on a link. This is particularly useful in case of DSI bridges which derive their own internal clock from the DSI HS clock. Signed-off-by: Marek Vasut <marex@xxxxxxx> Cc: Laurent Pinchart <Laurent.pinchart@xxxxxxxxxxxxxxxx> Cc: Maxime Ripard <maxime@xxxxxxxxxx> Cc: Neil Armstrong <narmstrong@xxxxxxxxxxxx> Cc: Sam Ravnborg <sam@xxxxxxxxxxxx> --- drivers/gpu/drm/drm_bridge.c | 6 ++++++ include/drm/drm_atomic.h | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index a069c50cc7d6b..6a5981b82499a 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -859,7 +859,9 @@ static int select_bus_fmt_recursive(struct drm_bridge *first_bridge, */ if (cur_state) { cur_state->input_bus_cfg.format = MEDIA_BUS_FMT_FIXED; + cur_state->input_bus_cfg.clock = 0; cur_state->output_bus_cfg.format = out_bus_cfg->format; + cur_state->output_bus_cfg.clock = out_bus_cfg->clock; } return 0; @@ -911,7 +913,9 @@ static int select_bus_fmt_recursive(struct drm_bridge *first_bridge, if (first_bridge == cur_bridge) { cur_state->input_bus_cfg.format = in_bus_cfgs[0].format; + cur_state->input_bus_cfg.clock = in_bus_cfgs[0].clock; cur_state->output_bus_cfg.format = out_bus_cfg->format; + cur_state->output_bus_cfg.clock = out_bus_cfg->clock; kfree(in_bus_cfgs); return 0; } @@ -926,7 +930,9 @@ static int select_bus_fmt_recursive(struct drm_bridge *first_bridge, if (!ret) { cur_state->input_bus_cfg.format = in_bus_cfgs[i].format; + cur_state->input_bus_cfg.clock = in_bus_cfgs[i].clock; cur_state->output_bus_cfg.format = out_bus_cfg->format; + cur_state->output_bus_cfg.clock = out_bus_cfg->clock; } kfree(in_bus_cfgs); diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index 1701c2128a5cb..32455cf28f0bc 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h @@ -1077,6 +1077,11 @@ struct drm_bus_cfg { * @flags: DRM_BUS_* flags used on this bus */ u32 flags; + + /** + * @clock: Clock frequency in kHz used on this bus + */ + u32 clock; }; /** -- 2.34.1