Skip to content

Commit

Permalink
drm: apple: iomfb: Provide the EDID as connector property
Browse files Browse the repository at this point in the history
External display only since the EDID provided by integrated panels
holds no useful / correct information.

Signed-off-by: Janne Grunau <[email protected]>
  • Loading branch information
jannau committed Aug 31, 2024
1 parent 8108ddc commit 8cd704a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/gpu/drm/apple/connector.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <drm/drm_atomic.h>
#include "drm/drm_connector.h"
#include "drm/drm_edid.h"

struct apple_connector;

Expand All @@ -21,6 +22,8 @@ struct apple_connector {

struct platform_device *dcp;

const struct drm_edid *drm_edid;

/* Workqueue for sending hotplug events to the associated device */
struct work_struct hotplug_wq;

Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/apple/dcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ static void dcp_rtk_crashed(void *cookie)
dev_err(dcp->dev, "DCP has crashed\n");
if (dcp->connector) {
dcp->connector->connected = 0;
drm_edid_free(dcp->connector->drm_edid);
dcp->connector->drm_edid = NULL;
schedule_work(&dcp->connector->hotplug_wq);
}
complete(&dcp->start_done);
Expand Down
20 changes: 20 additions & 0 deletions drivers/gpu/drm/apple/iomfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <linux/slab.h>
#include <linux/soc/apple/rtkit.h>

#include <drm/drm_edid.h>
#include <drm/drm_fb_dma_helper.h>
#include <drm/drm_fourcc.h>
#include <drm/drm_framebuffer.h>
Expand Down Expand Up @@ -241,6 +242,11 @@ void dcp_hotplug(struct work_struct *work)
dev_info(dcp->dev, "%s() connected:%d valid_mode:%d nr_modes:%u\n", __func__,
connector->connected, dcp->valid_mode, dcp->nr_modes);

if (!connector->connected) {
drm_edid_free(connector->drm_edid);
connector->drm_edid = NULL;
}

/*
* DCP defers link training until we set a display mode. But we set
* display modes from atomic_flush, so userspace needs to trigger a
Expand Down Expand Up @@ -391,6 +397,20 @@ int dcp_get_modes(struct drm_connector *connector)
drm_mode_probed_add(connector, mode);
}

if (dcp->nr_modes && dcp->dcpavserv.enabled &&
!apple_connector->drm_edid) {
const struct drm_edid *edid;
edid = dcpavserv_copy_edid(dcp->dcpavserv.service);
if (IS_ERR_OR_NULL(edid)) {
dev_info(dcp->dev, "copy_edid failed: %pe\n", edid);
} else {
drm_edid_free(apple_connector->drm_edid);
apple_connector->drm_edid = edid;
}
}
if (dcp->nr_modes && apple_connector->drm_edid)
drm_edid_connector_update(connector, apple_connector->drm_edid);

return dcp->nr_modes;
}
EXPORT_SYMBOL_GPL(dcp_get_modes);
Expand Down

0 comments on commit 8cd704a

Please sign in to comment.