The vc4 HDMI connector reset implementation creates a pristine state, initializes the HDMI state, and sets the TV margins. It does not perform any hardware reset.
Since this is equivalent to what atomic_create_state expects, convert the reset function to an atomic_create_state hook that returns the initialized state. Signed-off-by: Maxime Ripard <[email protected]> --- Cc: "Maíra Canal" <[email protected]> Cc: Dave Stevenson <[email protected]> Cc: Raspberry Pi Kernel Maintenance <[email protected]> --- drivers/gpu/drm/vc4/vc4_hdmi.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index cf84eff847d1..bf4b19910e56 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -503,23 +503,33 @@ static int vc4_hdmi_connector_atomic_check(struct drm_connector *connector, } return drm_atomic_helper_connector_hdmi_check(connector, state); } -static void vc4_hdmi_connector_reset(struct drm_connector *connector) +static struct drm_connector_state * +vc4_hdmi_connector_create_state(struct drm_connector *connector) { - drm_atomic_helper_connector_reset(connector); - __drm_atomic_helper_connector_hdmi_state_init(connector, connector->state); - drm_atomic_helper_connector_tv_margins_state_init(connector->state, + struct drm_connector_state *connector_state; + + connector_state = drm_atomic_helper_connector_create_state(connector); + if (IS_ERR(connector_state)) + return connector_state; + + __drm_atomic_helper_connector_hdmi_state_init(connector, + connector_state); + + drm_atomic_helper_connector_tv_margins_state_init(connector_state, connector); + + return connector_state; } static const struct drm_connector_funcs vc4_hdmi_connector_funcs = { .debugfs_init = drm_hdmi_connector_debugfs_init, .force = drm_atomic_helper_connector_hdmi_force, .fill_modes = drm_helper_probe_single_connector_modes, - .reset = vc4_hdmi_connector_reset, + .atomic_create_state = vc4_hdmi_connector_create_state, .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; static const struct drm_connector_helper_funcs vc4_hdmi_connector_helper_funcs = { @@ -566,12 +576,19 @@ static int vc4_hdmi_connector_init(struct drm_device *dev, /* * Some of the properties below require access to state, like bpc. * Allocate some default initial connector state with our reset helper. */ - if (connector->funcs->reset) - connector->funcs->reset(connector); + if (!connector->state) { + struct drm_connector_state *conn_state; + + conn_state = vc4_hdmi_connector_create_state(connector); + if (IS_ERR(conn_state)) + return PTR_ERR(conn_state); + + connector->state = conn_state; + } /* Create and attach TV margin props to this connector. */ ret = drm_mode_create_tv_margin_properties(dev); if (ret) return ret; -- 2.55.0
