@@ -18,6 +18,7 @@
#include <drm/display/drm_dp_helper.h>
#include <drm/drm_edid.h>
#include <drm/drm_panel.h>
+#include <drm/drm_property.h>
/* T3 VCC to HPD high is max 200 ms */
#define HPD_MAX_MS 200
@@ -36,8 +37,6 @@ struct atana33xc20_panel {
struct gpio_desc *el_on3_gpio;
struct drm_dp_aux *aux;
- struct edid *edid;
-
ktime_t powered_off_time;
ktime_t powered_on_time;
ktime_t el_on3_off_time;
@@ -241,15 +240,19 @@ static int atana33xc20_prepare(struct drm_panel *panel)
static int atana33xc20_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
- struct atana33xc20_panel *p = to_atana33xc20(panel);
struct dp_aux_ep_device *aux_ep = to_dp_aux_ep_dev(panel->dev);
int num = 0;
pm_runtime_get_sync(panel->dev);
- if (!p->edid)
- p->edid = drm_get_edid(connector, &aux_ep->aux->ddc);
- num = drm_add_edid_modes(connector, p->edid);
+ /*
+ * We read the EDID and then immediately free it, relying on the side
+ * effect of drm_get_edid() to store a copy in connector->edid_blob_ptr.
+ * We always use the copy cached in the connector since that allows the
+ * edid_override to work.
+ */
+ kfree(drm_get_edid(connector, &aux_ep->aux->ddc));
+ num = drm_add_edid_modes(connector, connector->edid_blob_ptr->data);
pm_runtime_mark_last_busy(panel->dev);
pm_runtime_put_autosuspend(panel->dev);
@@ -339,8 +342,6 @@ static void atana33xc20_remove(struct dp_aux_ep_device *aux_ep)
drm_panel_remove(&panel->base);
drm_panel_disable(&panel->base);
drm_panel_unprepare(&panel->base);
-
- kfree(panel->edid);
}
static void atana33xc20_shutdown(struct dp_aux_ep_device *aux_ep)
The atna33xc20 has the same problem as panel-edp where it was caching the EDID. Let's copy the fix over. See the patch ("drm/panel-edp: Allow overriding the eDP EDID") NOTE: the question will of course be asked why we've got a copy of this code. panel-samsung-atna33xc20 was purposely _copied_ from the generic eDP panel code in response to worries that the generic code was becoming a tangled mess (described as panel-panacea). It should also be noted that at some point I attempted to move the EDID caching into the core [1] but was told not to. [1] https://lore.kernel.org/all/20210329195255.v2.9.Ia7e9bb7cf6c51d960b9455fb0fa447cc68ece99d@changeid/ Signed-off-by: Douglas Anderson <dianders@chromium.org> --- .../gpu/drm/panel/panel-samsung-atna33xc20.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)