Commit 15d045fd authored by Jani Nikula's avatar Jani Nikula

drm/i915/panel: move panel fixed EDID to struct intel_panel

It's a bit confusing to have two cached EDIDs in struct intel_connector
with slightly different purposes. Make the distinction a bit clearer by
moving the EDID cached for eDP and LVDS panels at connector init time to
struct intel_panel, and name it fixed_edid. That's what it is, a fixed
EDID for the panels.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/328350ef918638928a8286cdbab3107c8258332d.1674643465.git.jani.nikula@intel.com
parent 91ec555f
......@@ -2054,7 +2054,7 @@ void icl_dsi_init(struct drm_i915_private *dev_priv)
goto err;
}
intel_panel_init(intel_connector);
intel_panel_init(intel_connector, NULL);
intel_backlight_setup(intel_connector, INVALID_PIPE);
......
......@@ -99,9 +99,6 @@ void intel_connector_destroy(struct drm_connector *connector)
intel_hdcp_cleanup(intel_connector);
if (!IS_ERR_OR_NULL(intel_connector->edid))
drm_edid_free(intel_connector->edid);
intel_panel_fini(intel_connector);
drm_connector_cleanup(connector);
......
......@@ -350,6 +350,9 @@ struct intel_vbt_panel_data {
};
struct intel_panel {
/* Fixed EDID for eDP and LVDS. May hold ERR_PTR for invalid EDID. */
const struct drm_edid *fixed_edid;
struct list_head fixed_modes;
/* backlight */
......@@ -590,8 +593,7 @@ struct intel_connector {
/* Panel info for eDP and LVDS */
struct intel_panel panel;
/* Cached EDID for eDP and LVDS. May hold ERR_PTR for invalid EDID. */
const struct drm_edid *edid;
/* Cached EDID for detect. */
const struct drm_edid *detect_edid;
/* Number of times hotplug detection was tried after an HPD interrupt */
......
......@@ -4479,18 +4479,19 @@ bool intel_digital_port_connected(struct intel_encoder *encoder)
static const struct drm_edid *
intel_dp_get_edid(struct intel_dp *intel_dp)
{
struct intel_connector *intel_connector = intel_dp->attached_connector;
struct intel_connector *connector = intel_dp->attached_connector;
const struct drm_edid *fixed_edid = connector->panel.fixed_edid;
/* use cached edid if we have one */
if (intel_connector->edid) {
/* Use panel fixed edid if we have one */
if (fixed_edid) {
/* invalid edid */
if (IS_ERR(intel_connector->edid))
if (IS_ERR(fixed_edid))
return NULL;
return drm_edid_dup(intel_connector->edid);
} else
return drm_edid_read_ddc(&intel_connector->base,
&intel_dp->aux.ddc);
return drm_edid_dup(fixed_edid);
}
return drm_edid_read_ddc(&connector->base, &intel_dp->aux.ddc);
}
static void
......@@ -5315,7 +5316,6 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
} else {
drm_edid = ERR_PTR(-ENOENT);
}
intel_connector->edid = drm_edid;
intel_bios_init_panel_late(dev_priv, &intel_connector->panel, encoder->devdata,
IS_ERR(drm_edid) ? NULL : drm_edid);
......@@ -5342,7 +5342,7 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
goto out_vdd_off;
}
intel_panel_init(intel_connector);
intel_panel_init(intel_connector, drm_edid);
intel_edp_backlight_setup(intel_dp, intel_connector);
......
......@@ -554,6 +554,6 @@ void intel_dvo_init(struct drm_i915_private *i915)
*/
intel_panel_add_encoder_fixed_mode(connector, encoder);
intel_panel_init(connector);
intel_panel_init(connector, NULL);
}
}
......@@ -477,10 +477,11 @@ static int intel_lvds_compute_config(struct intel_encoder *intel_encoder,
static int intel_lvds_get_modes(struct drm_connector *connector)
{
struct intel_connector *intel_connector = to_intel_connector(connector);
const struct drm_edid *fixed_edid = intel_connector->panel.fixed_edid;
/* use cached edid if we have one */
if (!IS_ERR_OR_NULL(intel_connector->edid)) {
drm_edid_connector_update(connector, intel_connector->edid);
/* Use panel fixed edid if we have one */
if (!IS_ERR_OR_NULL(fixed_edid)) {
drm_edid_connector_update(connector, fixed_edid);
return drm_edid_connector_add_modes(connector);
}
......@@ -974,8 +975,6 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
} else {
drm_edid = ERR_PTR(-ENOENT);
}
intel_connector->edid = drm_edid;
intel_bios_init_panel_late(dev_priv, &intel_connector->panel, NULL,
IS_ERR(drm_edid) ? NULL : drm_edid);
......@@ -1000,7 +999,7 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
if (!intel_panel_preferred_fixed_mode(intel_connector))
goto failed;
intel_panel_init(intel_connector);
intel_panel_init(intel_connector, drm_edid);
intel_backlight_setup(intel_connector, INVALID_PIPE);
......
......@@ -31,6 +31,8 @@
#include <linux/kernel.h>
#include <linux/pwm.h>
#include <drm/drm_edid.h>
#include "i915_reg.h"
#include "intel_backlight.h"
#include "intel_connector.h"
......@@ -670,10 +672,13 @@ void intel_panel_init_alloc(struct intel_connector *connector)
INIT_LIST_HEAD(&panel->fixed_modes);
}
int intel_panel_init(struct intel_connector *connector)
int intel_panel_init(struct intel_connector *connector,
const struct drm_edid *fixed_edid)
{
struct intel_panel *panel = &connector->panel;
panel->fixed_edid = fixed_edid;
intel_backlight_init_funcs(panel);
if (!has_drrs_modes(connector))
......@@ -692,6 +697,9 @@ void intel_panel_fini(struct intel_connector *connector)
struct intel_panel *panel = &connector->panel;
struct drm_display_mode *fixed_mode, *next;
if (!IS_ERR_OR_NULL(panel->fixed_edid))
drm_edid_free(panel->fixed_edid);
intel_backlight_destroy(panel);
intel_bios_fini_panel(panel);
......
......@@ -13,13 +13,15 @@ enum drrs_type;
struct drm_connector;
struct drm_connector_state;
struct drm_display_mode;
struct drm_edid;
struct drm_i915_private;
struct intel_connector;
struct intel_crtc_state;
struct intel_encoder;
void intel_panel_init_alloc(struct intel_connector *connector);
int intel_panel_init(struct intel_connector *connector);
int intel_panel_init(struct intel_connector *connector,
const struct drm_edid *fixed_edid);
void intel_panel_fini(struct intel_connector *connector);
enum drm_connector_status
intel_panel_detect(struct drm_connector *connector, bool force);
......
......@@ -2924,7 +2924,7 @@ intel_sdvo_lvds_init(struct intel_sdvo *intel_sdvo, u16 type)
mutex_unlock(&i915->drm.mode_config.mutex);
}
intel_panel_init(intel_connector);
intel_panel_init(intel_connector, NULL);
if (!intel_panel_preferred_fixed_mode(intel_connector))
goto err;
......
......@@ -1983,7 +1983,7 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv)
goto err_cleanup_connector;
}
intel_panel_init(intel_connector);
intel_panel_init(intel_connector, NULL);
intel_backlight_setup(intel_connector, INVALID_PIPE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment