drm/i915: Do panel VBT init early if the VBT declares an explicit panel type
Lots of ADL machines out there with bogus VBTs that declare two eDP child devices. In order for those to work we need to figure out which power sequencer to use before we try the EDID read. So let's do the panel VBT init early if we can, falling back to the post-EDID init otherwise. The post-EDID init panel_type=0xff approach of assuming the power sequencer should already be enabled doesn't really work with multiple eDP panels, and currently we just end up using the same power sequencer for both eDP ports, which at least confuses the wakeref tracking, and potentially also causes us to toggle the VDD for the panel when we should not. Cc: Animesh Manna <animesh.manna@intel.com> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20221125173156.31689-3-ville.syrjala@linux.intel.com
This commit is contained in:
parent
f70f8153e3
commit
3f9ffce576
9 changed files with 61 additions and 26 deletions
|
@ -2043,7 +2043,7 @@ void icl_dsi_init(struct drm_i915_private *dev_priv)
|
||||||
/* attach connector to encoder */
|
/* attach connector to encoder */
|
||||||
intel_connector_attach_encoder(intel_connector, encoder);
|
intel_connector_attach_encoder(intel_connector, encoder);
|
||||||
|
|
||||||
intel_bios_init_panel(dev_priv, &intel_connector->panel, NULL, NULL);
|
intel_bios_init_panel_late(dev_priv, &intel_connector->panel, NULL, NULL);
|
||||||
|
|
||||||
mutex_lock(&dev_priv->drm.mode_config.mutex);
|
mutex_lock(&dev_priv->drm.mode_config.mutex);
|
||||||
intel_panel_add_vbt_lfp_fixed_mode(intel_connector);
|
intel_panel_add_vbt_lfp_fixed_mode(intel_connector);
|
||||||
|
|
|
@ -620,14 +620,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)
|
const struct edid *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)
|
const struct edid *edid, bool use_fallback)
|
||||||
{
|
{
|
||||||
const struct bdb_lvds_options *lvds_options;
|
const struct bdb_lvds_options *lvds_options;
|
||||||
|
|
||||||
|
@ -652,7 +652,7 @@ 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)
|
const struct edid *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;
|
||||||
|
@ -701,9 +701,9 @@ 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)
|
const struct edid *edid, bool use_fallback)
|
||||||
{
|
{
|
||||||
return 0;
|
return use_fallback ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum panel_type {
|
enum panel_type {
|
||||||
|
@ -715,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)
|
const struct edid *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);
|
const struct edid *edid, bool use_fallback);
|
||||||
int panel_type;
|
int panel_type;
|
||||||
} panel_types[] = {
|
} panel_types[] = {
|
||||||
[PANEL_TYPE_OPREGION] = {
|
[PANEL_TYPE_OPREGION] = {
|
||||||
|
@ -744,7 +744,8 @@ static int get_panel_type(struct drm_i915_private *i915,
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
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, edid);
|
panel_types[i].panel_type = panel_types[i].get_panel_type(i915, devdata,
|
||||||
|
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);
|
||||||
|
@ -3183,14 +3184,26 @@ out:
|
||||||
kfree(oprom_vbt);
|
kfree(oprom_vbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 edid *edid,
|
||||||
|
bool use_fallback)
|
||||||
{
|
{
|
||||||
init_vbt_panel_defaults(panel);
|
/* already have it? */
|
||||||
|
if (panel->vbt.panel_type >= 0) {
|
||||||
|
drm_WARN_ON(&i915->drm, !use_fallback);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
panel->vbt.panel_type = get_panel_type(i915, devdata, edid);
|
panel->vbt.panel_type = get_panel_type(i915, devdata,
|
||||||
|
edid, use_fallback);
|
||||||
|
if (panel->vbt.panel_type < 0) {
|
||||||
|
drm_WARN_ON(&i915->drm, use_fallback);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
init_vbt_panel_defaults(panel);
|
||||||
|
|
||||||
parse_panel_options(i915, panel);
|
parse_panel_options(i915, panel);
|
||||||
parse_generic_dtd(i915, panel);
|
parse_generic_dtd(i915, panel);
|
||||||
|
@ -3205,6 +3218,21 @@ void intel_bios_init_panel(struct drm_i915_private *i915,
|
||||||
parse_mipi_sequence(i915, panel);
|
parse_mipi_sequence(i915, panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void intel_bios_init_panel_early(struct drm_i915_private *i915,
|
||||||
|
struct intel_panel *panel,
|
||||||
|
const struct intel_bios_encoder_data *devdata)
|
||||||
|
{
|
||||||
|
intel_bios_init_panel(i915, panel, devdata, NULL, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void intel_bios_init_panel_late(struct drm_i915_private *i915,
|
||||||
|
struct intel_panel *panel,
|
||||||
|
const struct intel_bios_encoder_data *devdata,
|
||||||
|
const struct edid *edid)
|
||||||
|
{
|
||||||
|
intel_bios_init_panel(i915, panel, devdata, edid, true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* intel_bios_driver_remove - Free any resources allocated by intel_bios_init()
|
* intel_bios_driver_remove - Free any resources allocated by intel_bios_init()
|
||||||
* @i915: i915 device instance
|
* @i915: i915 device instance
|
||||||
|
|
|
@ -232,10 +232,13 @@ struct mipi_pps_data {
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
void intel_bios_init(struct drm_i915_private *dev_priv);
|
void intel_bios_init(struct drm_i915_private *dev_priv);
|
||||||
void intel_bios_init_panel(struct drm_i915_private *dev_priv,
|
void intel_bios_init_panel_early(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);
|
void intel_bios_init_panel_late(struct drm_i915_private *dev_priv,
|
||||||
|
struct intel_panel *panel,
|
||||||
|
const struct intel_bios_encoder_data *devdata,
|
||||||
|
const struct edid *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);
|
||||||
|
|
|
@ -291,7 +291,7 @@ struct intel_vbt_panel_data {
|
||||||
struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */
|
struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */
|
||||||
|
|
||||||
/* Feature bits */
|
/* Feature bits */
|
||||||
unsigned int panel_type:4;
|
int panel_type;
|
||||||
unsigned int lvds_dither:1;
|
unsigned int lvds_dither:1;
|
||||||
unsigned int bios_lvds_val; /* initial [PCH_]LVDS reg val in VBIOS */
|
unsigned int bios_lvds_val; /* initial [PCH_]LVDS reg val in VBIOS */
|
||||||
|
|
||||||
|
|
|
@ -5221,6 +5221,9 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
intel_bios_init_panel_early(dev_priv, &intel_connector->panel,
|
||||||
|
encoder->devdata);
|
||||||
|
|
||||||
intel_pps_init(intel_dp);
|
intel_pps_init(intel_dp);
|
||||||
|
|
||||||
/* Cache DPCD and EDID for edp. */
|
/* Cache DPCD and EDID for edp. */
|
||||||
|
@ -5256,8 +5259,8 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
|
||||||
}
|
}
|
||||||
intel_connector->edid = edid;
|
intel_connector->edid = edid;
|
||||||
|
|
||||||
intel_bios_init_panel(dev_priv, &intel_connector->panel,
|
intel_bios_init_panel_late(dev_priv, &intel_connector->panel,
|
||||||
encoder->devdata, IS_ERR(edid) ? NULL : edid);
|
encoder->devdata, IS_ERR(edid) ? NULL : edid);
|
||||||
|
|
||||||
intel_panel_add_edid_fixed_modes(intel_connector, true);
|
intel_panel_add_edid_fixed_modes(intel_connector, true);
|
||||||
|
|
||||||
|
|
|
@ -964,8 +964,8 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
|
||||||
}
|
}
|
||||||
intel_connector->edid = edid;
|
intel_connector->edid = edid;
|
||||||
|
|
||||||
intel_bios_init_panel(dev_priv, &intel_connector->panel, NULL,
|
intel_bios_init_panel_late(dev_priv, &intel_connector->panel, NULL,
|
||||||
IS_ERR(edid) ? NULL : edid);
|
IS_ERR(edid) ? NULL : 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);
|
||||||
|
|
|
@ -665,6 +665,7 @@ void intel_panel_init_alloc(struct intel_connector *connector)
|
||||||
{
|
{
|
||||||
struct intel_panel *panel = &connector->panel;
|
struct intel_panel *panel = &connector->panel;
|
||||||
|
|
||||||
|
connector->panel.vbt.panel_type = -1;
|
||||||
INIT_LIST_HEAD(&panel->fixed_modes);
|
INIT_LIST_HEAD(&panel->fixed_modes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2886,7 +2886,7 @@ intel_sdvo_lvds_init(struct intel_sdvo *intel_sdvo, u16 type)
|
||||||
if (!intel_sdvo_create_enhance_property(intel_sdvo, intel_sdvo_connector))
|
if (!intel_sdvo_create_enhance_property(intel_sdvo, intel_sdvo_connector))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
intel_bios_init_panel(i915, &intel_connector->panel, NULL, NULL);
|
intel_bios_init_panel_late(i915, &intel_connector->panel, NULL, NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fetch modes from VBT. For SDVO prefer the VBT mode since some
|
* Fetch modes from VBT. For SDVO prefer the VBT mode since some
|
||||||
|
|
|
@ -1916,7 +1916,7 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv)
|
||||||
|
|
||||||
intel_dsi->panel_power_off_time = ktime_get_boottime();
|
intel_dsi->panel_power_off_time = ktime_get_boottime();
|
||||||
|
|
||||||
intel_bios_init_panel(dev_priv, &intel_connector->panel, NULL, NULL);
|
intel_bios_init_panel_late(dev_priv, &intel_connector->panel, NULL, NULL);
|
||||||
|
|
||||||
if (intel_connector->panel.vbt.dsi.config->dual_link)
|
if (intel_connector->panel.vbt.dsi.config->dual_link)
|
||||||
intel_dsi->ports = BIT(PORT_A) | BIT(PORT_C);
|
intel_dsi->ports = BIT(PORT_A) | BIT(PORT_C);
|
||||||
|
|
Loading…
Add table
Reference in a new issue