mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 09:04:39 +02:00
drm/i915/bios: Throw out the !has_ddi_port_info() codepaths
Now that we parse the DDI port info from the VBT on all g4x+ platforms we can throw out all the old codepaths in intel_bios_is_port_present(), intel_bios_is_port_edp() and intel_bios_is_port_dp_dual_mode(). None of these should be called on pre-g4x platforms. For good measure throw in a WARN into intel_bios_is_port_present() should someone get the urge to call it on older platforms. The other two functions are specific to HDMI and DP so should not need any protection as those encoder types don't even exist on older platforms. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20211217155403.31477-5-ville.syrjala@linux.intel.com Reviewed-by: Jani Nikula <jani.nikula@intel.com>
This commit is contained in:
parent
594c504d33
commit
a868a1e57e
|
|
@ -2643,37 +2643,10 @@ bool intel_bios_is_lvds_present(struct drm_i915_private *i915, u8 *i2c_pin)
|
|||
*/
|
||||
bool intel_bios_is_port_present(struct drm_i915_private *i915, enum port port)
|
||||
{
|
||||
const struct intel_bios_encoder_data *devdata;
|
||||
const struct child_device_config *child;
|
||||
static const struct {
|
||||
u16 dp, hdmi;
|
||||
} port_mapping[] = {
|
||||
[PORT_B] = { DVO_PORT_DPB, DVO_PORT_HDMIB, },
|
||||
[PORT_C] = { DVO_PORT_DPC, DVO_PORT_HDMIC, },
|
||||
[PORT_D] = { DVO_PORT_DPD, DVO_PORT_HDMID, },
|
||||
[PORT_E] = { DVO_PORT_DPE, DVO_PORT_HDMIE, },
|
||||
[PORT_F] = { DVO_PORT_DPF, DVO_PORT_HDMIF, },
|
||||
};
|
||||
if (WARN_ON(!has_ddi_port_info(i915)))
|
||||
return true;
|
||||
|
||||
if (has_ddi_port_info(i915))
|
||||
return i915->vbt.ports[port];
|
||||
|
||||
/* FIXME maybe deal with port A as well? */
|
||||
if (drm_WARN_ON(&i915->drm,
|
||||
port == PORT_A) || port >= ARRAY_SIZE(port_mapping))
|
||||
return false;
|
||||
|
||||
list_for_each_entry(devdata, &i915->vbt.display_devices, node) {
|
||||
child = &devdata->child;
|
||||
|
||||
if ((child->dvo_port == port_mapping[port].dp ||
|
||||
child->dvo_port == port_mapping[port].hdmi) &&
|
||||
(child->device_type & (DEVICE_TYPE_TMDS_DVI_SIGNALING |
|
||||
DEVICE_TYPE_DISPLAYPORT_OUTPUT)))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return i915->vbt.ports[port];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2685,34 +2658,10 @@ bool intel_bios_is_port_present(struct drm_i915_private *i915, enum port port)
|
|||
*/
|
||||
bool intel_bios_is_port_edp(struct drm_i915_private *i915, enum port port)
|
||||
{
|
||||
const struct intel_bios_encoder_data *devdata;
|
||||
const struct child_device_config *child;
|
||||
static const short port_mapping[] = {
|
||||
[PORT_B] = DVO_PORT_DPB,
|
||||
[PORT_C] = DVO_PORT_DPC,
|
||||
[PORT_D] = DVO_PORT_DPD,
|
||||
[PORT_E] = DVO_PORT_DPE,
|
||||
[PORT_F] = DVO_PORT_DPF,
|
||||
};
|
||||
const struct intel_bios_encoder_data *devdata =
|
||||
intel_bios_encoder_data_lookup(i915, port);
|
||||
|
||||
if (has_ddi_port_info(i915)) {
|
||||
const struct intel_bios_encoder_data *devdata;
|
||||
|
||||
devdata = intel_bios_encoder_data_lookup(i915, port);
|
||||
|
||||
return devdata && intel_bios_encoder_supports_edp(devdata);
|
||||
}
|
||||
|
||||
list_for_each_entry(devdata, &i915->vbt.display_devices, node) {
|
||||
child = &devdata->child;
|
||||
|
||||
if (child->dvo_port == port_mapping[port] &&
|
||||
(child->device_type & DEVICE_TYPE_eDP_BITS) ==
|
||||
(DEVICE_TYPE_eDP & DEVICE_TYPE_eDP_BITS))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return devdata && intel_bios_encoder_supports_edp(devdata);
|
||||
}
|
||||
|
||||
static bool child_dev_is_dp_dual_mode(const struct child_device_config *child)
|
||||
|
|
@ -2735,40 +2684,10 @@ static bool child_dev_is_dp_dual_mode(const struct child_device_config *child)
|
|||
bool intel_bios_is_port_dp_dual_mode(struct drm_i915_private *i915,
|
||||
enum port port)
|
||||
{
|
||||
static const struct {
|
||||
u16 dp, hdmi;
|
||||
} port_mapping[] = {
|
||||
/*
|
||||
* Buggy VBTs may declare DP ports as having
|
||||
* HDMI type dvo_port :( So let's check both.
|
||||
*/
|
||||
[PORT_B] = { DVO_PORT_DPB, DVO_PORT_HDMIB, },
|
||||
[PORT_C] = { DVO_PORT_DPC, DVO_PORT_HDMIC, },
|
||||
[PORT_D] = { DVO_PORT_DPD, DVO_PORT_HDMID, },
|
||||
[PORT_E] = { DVO_PORT_DPE, DVO_PORT_HDMIE, },
|
||||
[PORT_F] = { DVO_PORT_DPF, DVO_PORT_HDMIF, },
|
||||
};
|
||||
const struct intel_bios_encoder_data *devdata;
|
||||
const struct intel_bios_encoder_data *devdata =
|
||||
intel_bios_encoder_data_lookup(i915, port);
|
||||
|
||||
if (has_ddi_port_info(i915)) {
|
||||
const struct intel_bios_encoder_data *devdata;
|
||||
|
||||
devdata = intel_bios_encoder_data_lookup(i915, port);
|
||||
|
||||
return devdata && child_dev_is_dp_dual_mode(&devdata->child);
|
||||
}
|
||||
|
||||
if (port == PORT_A || port >= ARRAY_SIZE(port_mapping))
|
||||
return false;
|
||||
|
||||
list_for_each_entry(devdata, &i915->vbt.display_devices, node) {
|
||||
if ((devdata->child.dvo_port == port_mapping[port].dp ||
|
||||
devdata->child.dvo_port == port_mapping[port].hdmi) &&
|
||||
child_dev_is_dp_dual_mode(&devdata->child))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return devdata && child_dev_is_dp_dual_mode(&devdata->child);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -226,21 +226,6 @@ struct bdb_general_features {
|
|||
#define DEVICE_TYPE_DIGITAL_OUTPUT (1 << 1)
|
||||
#define DEVICE_TYPE_ANALOG_OUTPUT (1 << 0)
|
||||
|
||||
/*
|
||||
* Bits we care about when checking for DEVICE_TYPE_eDP. Depending on the
|
||||
* system, the other bits may or may not be set for eDP outputs.
|
||||
*/
|
||||
#define DEVICE_TYPE_eDP_BITS \
|
||||
(DEVICE_TYPE_INTERNAL_CONNECTOR | \
|
||||
DEVICE_TYPE_MIPI_OUTPUT | \
|
||||
DEVICE_TYPE_COMPOSITE_OUTPUT | \
|
||||
DEVICE_TYPE_DUAL_CHANNEL | \
|
||||
DEVICE_TYPE_LVDS_SIGNALING | \
|
||||
DEVICE_TYPE_TMDS_DVI_SIGNALING | \
|
||||
DEVICE_TYPE_VIDEO_SIGNALING | \
|
||||
DEVICE_TYPE_DISPLAYPORT_OUTPUT | \
|
||||
DEVICE_TYPE_ANALOG_OUTPUT)
|
||||
|
||||
#define DEVICE_TYPE_DP_DUAL_MODE_BITS \
|
||||
(DEVICE_TYPE_INTERNAL_CONNECTOR | \
|
||||
DEVICE_TYPE_MIPI_OUTPUT | \
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user