Commit c36225a1 authored by Jani Nikula's avatar Jani Nikula

drm/i915/bios: convert intel_bios_init_panel() to drm_edid

Try to use struct drm_edid where possible, even if having to fall back
to looking into struct edid down low via drm_edid_raw().

v2: Rebase

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/897807d62f74f690a173ecd405e25c6ccdd63b98.1674643465.git.jani.nikula@intel.com
parent 25fa6b0f
...@@ -619,14 +619,14 @@ static void dump_pnp_id(struct drm_i915_private *i915, ...@@ -619,14 +619,14 @@ static void dump_pnp_id(struct drm_i915_private *i915,
static int opregion_get_panel_type(struct drm_i915_private *i915, static int opregion_get_panel_type(struct drm_i915_private *i915,
const struct intel_bios_encoder_data *devdata, const struct intel_bios_encoder_data *devdata,
const struct edid *edid, bool use_fallback) const struct drm_edid *drm_edid, bool use_fallback)
{ {
return intel_opregion_get_panel_type(i915); return intel_opregion_get_panel_type(i915);
} }
static int vbt_get_panel_type(struct drm_i915_private *i915, static int vbt_get_panel_type(struct drm_i915_private *i915,
const struct intel_bios_encoder_data *devdata, const struct intel_bios_encoder_data *devdata,
const struct edid *edid, bool use_fallback) const struct drm_edid *drm_edid, bool use_fallback)
{ {
const struct bdb_lvds_options *lvds_options; const struct bdb_lvds_options *lvds_options;
...@@ -651,12 +651,13 @@ static int vbt_get_panel_type(struct drm_i915_private *i915, ...@@ -651,12 +651,13 @@ static int vbt_get_panel_type(struct drm_i915_private *i915,
static int pnpid_get_panel_type(struct drm_i915_private *i915, static int pnpid_get_panel_type(struct drm_i915_private *i915,
const struct intel_bios_encoder_data *devdata, const struct intel_bios_encoder_data *devdata,
const struct edid *edid, bool use_fallback) const struct drm_edid *drm_edid, bool use_fallback)
{ {
const struct bdb_lvds_lfp_data *data; const struct bdb_lvds_lfp_data *data;
const struct bdb_lvds_lfp_data_ptrs *ptrs; const struct bdb_lvds_lfp_data_ptrs *ptrs;
const struct lvds_pnp_id *edid_id; const struct lvds_pnp_id *edid_id;
struct lvds_pnp_id edid_id_nodate; struct lvds_pnp_id edid_id_nodate;
const struct edid *edid = drm_edid_raw(drm_edid); /* FIXME */
int i, best = -1; int i, best = -1;
if (!edid) if (!edid)
...@@ -700,7 +701,7 @@ static int pnpid_get_panel_type(struct drm_i915_private *i915, ...@@ -700,7 +701,7 @@ static int pnpid_get_panel_type(struct drm_i915_private *i915,
static int fallback_get_panel_type(struct drm_i915_private *i915, static int fallback_get_panel_type(struct drm_i915_private *i915,
const struct intel_bios_encoder_data *devdata, const struct intel_bios_encoder_data *devdata,
const struct edid *edid, bool use_fallback) const struct drm_edid *drm_edid, bool use_fallback)
{ {
return use_fallback ? 0 : -1; return use_fallback ? 0 : -1;
} }
...@@ -714,13 +715,13 @@ enum panel_type { ...@@ -714,13 +715,13 @@ enum panel_type {
static int get_panel_type(struct drm_i915_private *i915, static int get_panel_type(struct drm_i915_private *i915,
const struct intel_bios_encoder_data *devdata, const struct intel_bios_encoder_data *devdata,
const struct edid *edid, bool use_fallback) const struct drm_edid *drm_edid, bool use_fallback)
{ {
struct { struct {
const char *name; const char *name;
int (*get_panel_type)(struct drm_i915_private *i915, int (*get_panel_type)(struct drm_i915_private *i915,
const struct intel_bios_encoder_data *devdata, const struct intel_bios_encoder_data *devdata,
const struct edid *edid, bool use_fallback); const struct drm_edid *drm_edid, bool use_fallback);
int panel_type; int panel_type;
} panel_types[] = { } panel_types[] = {
[PANEL_TYPE_OPREGION] = { [PANEL_TYPE_OPREGION] = {
...@@ -744,7 +745,7 @@ static int get_panel_type(struct drm_i915_private *i915, ...@@ -744,7 +745,7 @@ static int get_panel_type(struct drm_i915_private *i915,
for (i = 0; i < ARRAY_SIZE(panel_types); i++) { for (i = 0; i < ARRAY_SIZE(panel_types); i++) {
panel_types[i].panel_type = panel_types[i].get_panel_type(i915, devdata, panel_types[i].panel_type = panel_types[i].get_panel_type(i915, devdata,
edid, use_fallback); drm_edid, use_fallback);
drm_WARN_ON(&i915->drm, panel_types[i].panel_type > 0xf && drm_WARN_ON(&i915->drm, panel_types[i].panel_type > 0xf &&
panel_types[i].panel_type != 0xff); panel_types[i].panel_type != 0xff);
...@@ -3186,7 +3187,7 @@ void intel_bios_init(struct drm_i915_private *i915) ...@@ -3186,7 +3187,7 @@ void intel_bios_init(struct drm_i915_private *i915)
static void intel_bios_init_panel(struct drm_i915_private *i915, static void intel_bios_init_panel(struct drm_i915_private *i915,
struct intel_panel *panel, struct intel_panel *panel,
const struct intel_bios_encoder_data *devdata, const struct intel_bios_encoder_data *devdata,
const struct edid *edid, const struct drm_edid *drm_edid,
bool use_fallback) bool use_fallback)
{ {
/* already have it? */ /* already have it? */
...@@ -3196,7 +3197,7 @@ static void intel_bios_init_panel(struct drm_i915_private *i915, ...@@ -3196,7 +3197,7 @@ static void intel_bios_init_panel(struct drm_i915_private *i915,
} }
panel->vbt.panel_type = get_panel_type(i915, devdata, panel->vbt.panel_type = get_panel_type(i915, devdata,
edid, use_fallback); drm_edid, use_fallback);
if (panel->vbt.panel_type < 0) { if (panel->vbt.panel_type < 0) {
drm_WARN_ON(&i915->drm, use_fallback); drm_WARN_ON(&i915->drm, use_fallback);
return; return;
...@@ -3227,9 +3228,9 @@ void intel_bios_init_panel_early(struct drm_i915_private *i915, ...@@ -3227,9 +3228,9 @@ void intel_bios_init_panel_early(struct drm_i915_private *i915,
void intel_bios_init_panel_late(struct drm_i915_private *i915, void intel_bios_init_panel_late(struct drm_i915_private *i915,
struct intel_panel *panel, struct intel_panel *panel,
const struct intel_bios_encoder_data *devdata, const struct intel_bios_encoder_data *devdata,
const struct edid *edid) const struct drm_edid *drm_edid)
{ {
intel_bios_init_panel(i915, panel, devdata, edid, true); intel_bios_init_panel(i915, panel, devdata, drm_edid, true);
} }
/** /**
......
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
#include <linux/types.h> #include <linux/types.h>
struct drm_edid;
struct drm_i915_private; struct drm_i915_private;
struct edid;
struct intel_bios_encoder_data; struct intel_bios_encoder_data;
struct intel_crtc_state; struct intel_crtc_state;
struct intel_encoder; struct intel_encoder;
...@@ -238,7 +238,7 @@ void intel_bios_init_panel_early(struct drm_i915_private *dev_priv, ...@@ -238,7 +238,7 @@ void intel_bios_init_panel_early(struct drm_i915_private *dev_priv,
void intel_bios_init_panel_late(struct drm_i915_private *dev_priv, void intel_bios_init_panel_late(struct drm_i915_private *dev_priv,
struct intel_panel *panel, struct intel_panel *panel,
const struct intel_bios_encoder_data *devdata, const struct intel_bios_encoder_data *devdata,
const struct edid *edid); const struct drm_edid *drm_edid);
void intel_bios_fini_panel(struct intel_panel *panel); void intel_bios_fini_panel(struct intel_panel *panel);
void intel_bios_driver_remove(struct drm_i915_private *dev_priv); void intel_bios_driver_remove(struct drm_i915_private *dev_priv);
bool intel_bios_is_valid_vbt(const void *buf, size_t size); bool intel_bios_is_valid_vbt(const void *buf, size_t size);
......
...@@ -5324,7 +5324,7 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, ...@@ -5324,7 +5324,7 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
intel_connector->edid = drm_edid; intel_connector->edid = drm_edid;
intel_bios_init_panel_late(dev_priv, &intel_connector->panel, encoder->devdata, intel_bios_init_panel_late(dev_priv, &intel_connector->panel, encoder->devdata,
IS_ERR_OR_NULL(drm_edid) ? NULL : drm_edid_raw(drm_edid)); IS_ERR(drm_edid) ? NULL : drm_edid);
intel_panel_add_edid_fixed_modes(intel_connector, true); intel_panel_add_edid_fixed_modes(intel_connector, true);
......
...@@ -977,7 +977,7 @@ void intel_lvds_init(struct drm_i915_private *dev_priv) ...@@ -977,7 +977,7 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
intel_connector->edid = drm_edid; intel_connector->edid = drm_edid;
intel_bios_init_panel_late(dev_priv, &intel_connector->panel, NULL, intel_bios_init_panel_late(dev_priv, &intel_connector->panel, NULL,
IS_ERR_OR_NULL(drm_edid) ? NULL : drm_edid_raw(drm_edid)); IS_ERR(drm_edid) ? NULL : drm_edid);
/* Try EDID first */ /* Try EDID first */
intel_panel_add_edid_fixed_modes(intel_connector, true); intel_panel_add_edid_fixed_modes(intel_connector, true);
......
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