Skip to content

Commit df24f94

Browse files
luoji-nxpjasonimx
authored andcommitted
LF-16700 drm/bridge: it6263: Fix getting EDID for DRM_BRIDGE_ATTACH_NO_CONNECTOR case
If DRM_BRIDGE_ATTACH_NO_CONNECTOR flag is set when attaching the bridge, this bridge driver won't create a DRM connector but instead relying on other drivers to do that, i.e., a bridge connector is created by a DRM driver. In that case, it6263_get_edid() should use the connector parameter of it6263_bridge_edid_read() to get EDID instead of the connector created by this driver for the !DRM_BRIDGE_ATTACH_NO_CONNECTOR case and cached in the main struct it6263, since the latter one is not initialized at all for the DRM_BRIDGE_ATTACH_NO_CONNECTOR case. Note that it6263_bridge_edid_read(), as the drm_bridge_funcs::edid_read callback, is supposed to be only called by bridge connector for the DRM_BRIDGE_ATTACH_NO_CONNECTOR case. So, pass the connector parameter from it6263_bridge_edid_read() to it6263_get_edid() and use it to get get EDID to avoid accessing the uninitialized connector. While at it, change the it6263_get_edid() function call in it6263_connector_get_modes() accordingly. Signed-off-by: Ji Luo <ji.luo@nxp.com> Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com> Tested-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com> Co-developed-by: Liu Ying <victor.liu@nxp.com> Signed-off-by: Liu Ying <victor.liu@nxp.com> Acked-by: Jason Liu <jason.hui.liu@nxp.com>
1 parent d93cce0 commit df24f94

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

drivers/gpu/drm/bridge/it6263.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -594,12 +594,13 @@ it6263_read_edid(void *data, u8 *buf, unsigned int block, size_t len)
594594
return 0;
595595
}
596596

597-
static const struct drm_edid *it6263_get_edid(struct it6263 *it6263)
597+
static const struct drm_edid *
598+
it6263_get_edid(struct it6263 *it6263, struct drm_connector *connector)
598599
{
599600
const struct drm_edid *drm_edid;
600601
const struct edid *edid;
601602

602-
drm_edid = drm_edid_read_custom(&it6263->connector, it6263_read_edid, it6263);
603+
drm_edid = drm_edid_read_custom(connector, it6263_read_edid, it6263);
603604
if (!drm_edid) {
604605
dev_warn(&it6263->hdmi_i2c->dev, "Failed to read EDID\n");
605606
return NULL;
@@ -640,7 +641,7 @@ static int it6263_connector_get_modes(struct drm_connector *connector)
640641
int num = 0;
641642
int ret;
642643

643-
drm_edid = it6263_get_edid(it6263);
644+
drm_edid = it6263_get_edid(it6263, connector);
644645
if (!drm_edid)
645646
return 0;
646647

@@ -871,7 +872,7 @@ it6263_bridge_edid_read(struct drm_bridge *bridge,
871872
{
872873
struct it6263 *it6263 = bridge_to_it6263(bridge);
873874

874-
return it6263_get_edid(it6263);
875+
return it6263_get_edid(it6263, connector);
875876
}
876877

877878
static enum drm_mode_status

0 commit comments

Comments
 (0)