drm/amd/display: restore edid reading from a given i2c adapter
Subsystems (3)
PATCH v2 1/1 drm/amd/display: restore edid reading from a given i2c adapter
When switching to drm_edid, we slightly changed how to get edid by removing the possibility of getting them from dc_link when in aux transaction mode. As MST doesn't initialize the connector with drm_connector_init_with_ddc(), restore the original behavior to avoid functional changes.
v2:
- Fix build warning of unchecked dereference (kernel test bot)
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +15 -2
@@ -7269,8 +7269,14 @@ static void amdgpu_dm_connector_funcs_force(struct drm_connector *connector)struct dc_link *dc_link = aconnector->dc_link;struct dc_sink *dc_em_sink = aconnector->dc_em_sink;const struct drm_edid *drm_edid; +struct i2c_adapter *ddc; - drm_edid =drm_edid_read (connector); +if (dc_link && dc_link->aux_mode) + ddc = &aconnector->dm_dp_aux.aux.ddc; +else + ddc = &aconnector->i2c->base; + + drm_edid =drm_edid_read_ddc (connector, ddc);drm_edid_connector_update (connector, drm_edid);if (!drm_edid) {DRM_ERROR ("No EDID found on connector: %s.\n" , connector->name);
@@ -7315,14 +7321,21 @@ static int get_modes(struct drm_connector *connector)static void create_eml_sink (struct amdgpu_dm_connector *aconnector) {struct drm_connector *connector = &aconnector->base; +struct dc_link *dc_link = aconnector->dc_link;struct dc_sink_init_data init_params = { .link = aconnector->dc_link, .sink_signal =SIGNAL_TYPE_VIRTUAL };const struct drm_edid *drm_edid;const struct edid *edid; +struct i2c_adapter *ddc; - drm_edid =drm_edid_read (connector); +if (dc_link && dc_link->aux_mode) + ddc = &aconnector->dm_dp_aux.aux.ddc; +else + ddc = &aconnector->i2c->base; + + drm_edid =drm_edid_read_ddc (connector, ddc);drm_edid_connector_update (connector, drm_edid);if (!drm_edid) {DRM_ERROR ("No EDID found on connector: %s.\n" , connector->name);
Signature · 1 line
2.47.2
Quoted 62 lines · Melissa Wen
When switching to
drm_edid, we slightly changed how to get edid by removing the possibility of getting them fromdc_linkwhen in aux transaction mode. As MST doesn't initialize the connector withdrm_connector_init_with_ddc(), restore the original behavior to avoid functional changes.v2:
- Fix build warning of unchecked dereference (kernel test bot)CC Alex Hung <[email protected]>CC Mario Limonciello <[email protected]>CC Roman Li <[email protected]>CC Aurabindo Pillai <[email protected]>Fixes 48edb2a4256e ("drm/amd/display: switch amdgpu_dm_connector to use struct drm_edid")Signed-off-by Melissa Wen <[email protected]>--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +15
-2@@ -7269,8 +7269,14 @@ static void amdgpu_dm_connector_funcs_force(struct drm_connector *connector)struct dc_link *dc_link = aconnector->dc_link;struct dc_sink *dc_em_sink = aconnector->dc_em_sink;const struct drm_edid *drm_edid; +struct i2c_adapter *ddc; - drm_edid =drm_edid_read (connector); +if (dc_link && dc_link->aux_mode) + ddc = &aconnector->dm_dp_aux.aux.ddc; +else + ddc = &aconnector->i2c->base; + + drm_edid =drm_edid_read_ddc (connector, ddc);drm_edid_connector_update (connector, drm_edid);if (!drm_edid) {DRM_ERROR ("No EDID found on connector: %s.\n" , connector->name);@@ -7315,14 +7321,21 @@ static int get_modes(struct drm_connector *connector)static void create_eml_sink (struct amdgpu_dm_connector *aconnector) {struct drm_connector *connector = &aconnector->base; +struct dc_link *dc_link = aconnector->dc_link;struct dc_sink_init_data init_params = { .link = aconnector->dc_link, .sink_signal =SIGNAL_TYPE_VIRTUAL };const struct drm_edid *drm_edid;const struct edid *edid; +struct i2c_adapter *ddc; - drm_edid =drm_edid_read (connector); +if (dc_link && dc_link->aux_mode) + ddc = &aconnector->dm_dp_aux.aux.ddc; +else + ddc = &aconnector->i2c->base; + + drm_edid =drm_edid_read_ddc (connector, ddc);drm_edid_connector_update (connector, drm_edid);if (!drm_edid) {DRM_ERROR ("No EDID found on connector: %s.\n" , connector->name);
Alex Deucher
AppliedApplied. Thanks!
Alex
Quoted 67 lines · Alex Hung
Reviewed-by Alex Hung <[email protected]>Quoted 62 lines · Melissa Wen
When switching to
drm_edid, we slightly changed how to get edid by removing the possibility of getting them fromdc_linkwhen in aux transaction mode. As MST doesn't initialize the connector withdrm_connector_init_with_ddc(), restore the original behavior to avoid functional changes.v2:
- Fix build warning of unchecked dereference (kernel test bot)CC Alex Hung <[email protected]>CC Mario Limonciello <[email protected]>CC Roman Li <[email protected]>CC Aurabindo Pillai <[email protected]>Fixes 48edb2a4256e ("drm/amd/display: switch amdgpu_dm_connector to use struct drm_edid")Signed-off-by Melissa Wen <[email protected]>--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +15
-2@@ -7269,8 +7269,14 @@ static void amdgpu_dm_connector_funcs_force(struct drm_connector *connector)struct dc_link *dc_link = aconnector->dc_link;struct dc_sink *dc_em_sink = aconnector->dc_em_sink;const struct drm_edid *drm_edid; +struct i2c_adapter *ddc; - drm_edid =drm_edid_read (connector); +if (dc_link && dc_link->aux_mode) + ddc = &aconnector->dm_dp_aux.aux.ddc; +else + ddc = &aconnector->i2c->base; + + drm_edid =drm_edid_read_ddc (connector, ddc);drm_edid_connector_update (connector, drm_edid);if (!drm_edid) {DRM_ERROR ("No EDID found on connector: %s.\n" , connector->name);@@ -7315,14 +7321,21 @@ static int get_modes(struct drm_connector *connector)static void create_eml_sink (struct amdgpu_dm_connector *aconnector) {struct drm_connector *connector = &aconnector->base; +struct dc_link *dc_link = aconnector->dc_link;struct dc_sink_init_data init_params = { .link = aconnector->dc_link, .sink_signal =SIGNAL_TYPE_VIRTUAL };const struct drm_edid *drm_edid;const struct edid *edid; +struct i2c_adapter *ddc; - drm_edid =drm_edid_read (connector); +if (dc_link && dc_link->aux_mode) + ddc = &aconnector->dm_dp_aux.aux.ddc; +else + ddc = &aconnector->i2c->base; + + drm_edid =drm_edid_read_ddc (connector, ddc);drm_edid_connector_update (connector, drm_edid);if (!drm_edid) {DRM_ERROR ("No EDID found on connector: %s.\n" , connector->name);