Commit 45c0673a authored by Jani Nikula's avatar Jani Nikula

drm/i915/bios: start using the intel_bios_encoder_data directly

Start using struct intel_bios_encoder_data directly. We'll start
sanitizing the child device data directly as well, instead of the cached
data in ddi_port_info[]. The one downside here is having to store a
non-const pointer back to intel_bios_encoder_data.

Eventually we'll be able to have a direct pointer from encoder to
intel_bios_encoder_data, removing the need to go through the
ddi_port_info[] array altogether. And we'll be able to remove all the
cached data in ddi_port_info[].

v2:
- Remove supports_dp and supports_edp from ddi_port_info too
- Add devdata != NULL check in intel_bios_is_port_edp()

Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com> # v1
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/061df32a012ff640060920fcd730fb23f8717ee8.1615998927.git.jani.nikula@intel.com
parent dbc13742
...@@ -1524,6 +1524,7 @@ static void sanitize_ddc_pin(struct drm_i915_private *i915, ...@@ -1524,6 +1524,7 @@ static void sanitize_ddc_pin(struct drm_i915_private *i915,
enum port port) enum port port)
{ {
struct ddi_vbt_port_info *info = &i915->vbt.ddi_port_info[port]; struct ddi_vbt_port_info *info = &i915->vbt.ddi_port_info[port];
struct child_device_config *child;
enum port p; enum port p;
p = get_port_by_ddc_pin(i915, info->alternate_ddc_pin); p = get_port_by_ddc_pin(i915, info->alternate_ddc_pin);
...@@ -1546,9 +1547,11 @@ static void sanitize_ddc_pin(struct drm_i915_private *i915, ...@@ -1546,9 +1547,11 @@ static void sanitize_ddc_pin(struct drm_i915_private *i915,
* port A and port E with the same AUX ch and we must pick port E :( * port A and port E with the same AUX ch and we must pick port E :(
*/ */
info = &i915->vbt.ddi_port_info[p]; info = &i915->vbt.ddi_port_info[p];
child = &info->devdata->child;
child->device_type &= ~DEVICE_TYPE_TMDS_DVI_SIGNALING;
child->device_type |= DEVICE_TYPE_NOT_HDMI_OUTPUT;
info->supports_dvi = false;
info->supports_hdmi = false;
info->alternate_ddc_pin = 0; info->alternate_ddc_pin = 0;
} }
...@@ -1574,6 +1577,7 @@ static void sanitize_aux_ch(struct drm_i915_private *i915, ...@@ -1574,6 +1577,7 @@ static void sanitize_aux_ch(struct drm_i915_private *i915,
enum port port) enum port port)
{ {
struct ddi_vbt_port_info *info = &i915->vbt.ddi_port_info[port]; struct ddi_vbt_port_info *info = &i915->vbt.ddi_port_info[port];
struct child_device_config *child;
enum port p; enum port p;
p = get_port_by_aux_ch(i915, info->alternate_aux_channel); p = get_port_by_aux_ch(i915, info->alternate_aux_channel);
...@@ -1596,8 +1600,9 @@ static void sanitize_aux_ch(struct drm_i915_private *i915, ...@@ -1596,8 +1600,9 @@ static void sanitize_aux_ch(struct drm_i915_private *i915,
* port A and port E with the same AUX ch and we must pick port E :( * port A and port E with the same AUX ch and we must pick port E :(
*/ */
info = &i915->vbt.ddi_port_info[p]; info = &i915->vbt.ddi_port_info[p];
child = &info->devdata->child;
info->supports_dp = false; child->device_type &= ~DEVICE_TYPE_DISPLAYPORT_OUTPUT;
info->alternate_aux_channel = 0; info->alternate_aux_channel = 0;
} }
...@@ -1822,20 +1827,20 @@ intel_bios_encoder_supports_crt(const struct intel_bios_encoder_data *devdata) ...@@ -1822,20 +1827,20 @@ intel_bios_encoder_supports_crt(const struct intel_bios_encoder_data *devdata)
return devdata->child.device_type & DEVICE_TYPE_ANALOG_OUTPUT; return devdata->child.device_type & DEVICE_TYPE_ANALOG_OUTPUT;
} }
static bool bool
intel_bios_encoder_supports_dvi(const struct intel_bios_encoder_data *devdata) intel_bios_encoder_supports_dvi(const struct intel_bios_encoder_data *devdata)
{ {
return devdata->child.device_type & DEVICE_TYPE_TMDS_DVI_SIGNALING; return devdata->child.device_type & DEVICE_TYPE_TMDS_DVI_SIGNALING;
} }
static bool bool
intel_bios_encoder_supports_hdmi(const struct intel_bios_encoder_data *devdata) intel_bios_encoder_supports_hdmi(const struct intel_bios_encoder_data *devdata)
{ {
return intel_bios_encoder_supports_dvi(devdata) && return intel_bios_encoder_supports_dvi(devdata) &&
(devdata->child.device_type & DEVICE_TYPE_NOT_HDMI_OUTPUT) == 0; (devdata->child.device_type & DEVICE_TYPE_NOT_HDMI_OUTPUT) == 0;
} }
static bool bool
intel_bios_encoder_supports_dp(const struct intel_bios_encoder_data *devdata) intel_bios_encoder_supports_dp(const struct intel_bios_encoder_data *devdata)
{ {
return devdata->child.device_type & DEVICE_TYPE_DISPLAYPORT_OUTPUT; return devdata->child.device_type & DEVICE_TYPE_DISPLAYPORT_OUTPUT;
...@@ -1877,11 +1882,6 @@ static void parse_ddi_port(struct drm_i915_private *i915, ...@@ -1877,11 +1882,6 @@ static void parse_ddi_port(struct drm_i915_private *i915,
is_hdmi = intel_bios_encoder_supports_hdmi(devdata); is_hdmi = intel_bios_encoder_supports_hdmi(devdata);
is_edp = intel_bios_encoder_supports_edp(devdata); is_edp = intel_bios_encoder_supports_edp(devdata);
info->supports_dvi = is_dvi;
info->supports_hdmi = is_hdmi;
info->supports_dp = is_dp;
info->supports_edp = is_edp;
if (i915->vbt.version >= 195) if (i915->vbt.version >= 195)
info->supports_typec_usb = child->dp_usb_type_c; info->supports_typec_usb = child->dp_usb_type_c;
...@@ -2557,8 +2557,13 @@ bool intel_bios_is_port_edp(struct drm_i915_private *i915, enum port port) ...@@ -2557,8 +2557,13 @@ bool intel_bios_is_port_edp(struct drm_i915_private *i915, enum port port)
[PORT_F] = DVO_PORT_DPF, [PORT_F] = DVO_PORT_DPF,
}; };
if (HAS_DDI(i915)) if (HAS_DDI(i915)) {
return i915->vbt.ddi_port_info[port].supports_edp; 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) { list_for_each_entry(devdata, &i915->vbt.display_devices, node) {
child = &devdata->child; child = &devdata->child;
...@@ -2930,21 +2935,6 @@ int intel_bios_alternate_ddc_pin(struct intel_encoder *encoder) ...@@ -2930,21 +2935,6 @@ int intel_bios_alternate_ddc_pin(struct intel_encoder *encoder)
return i915->vbt.ddi_port_info[encoder->port].alternate_ddc_pin; return i915->vbt.ddi_port_info[encoder->port].alternate_ddc_pin;
} }
bool intel_bios_port_supports_dvi(struct drm_i915_private *i915, enum port port)
{
return i915->vbt.ddi_port_info[port].supports_dvi;
}
bool intel_bios_port_supports_hdmi(struct drm_i915_private *i915, enum port port)
{
return i915->vbt.ddi_port_info[port].supports_hdmi;
}
bool intel_bios_port_supports_dp(struct drm_i915_private *i915, enum port port)
{
return i915->vbt.ddi_port_info[port].supports_dp;
}
bool intel_bios_port_supports_typec_usb(struct drm_i915_private *i915, bool intel_bios_port_supports_typec_usb(struct drm_i915_private *i915,
enum port port) enum port port)
{ {
...@@ -2955,3 +2945,9 @@ bool intel_bios_port_supports_tbt(struct drm_i915_private *i915, enum port port) ...@@ -2955,3 +2945,9 @@ bool intel_bios_port_supports_tbt(struct drm_i915_private *i915, enum port port)
{ {
return i915->vbt.ddi_port_info[port].supports_tbt; return i915->vbt.ddi_port_info[port].supports_tbt;
} }
const struct intel_bios_encoder_data *
intel_bios_encoder_data_lookup(struct drm_i915_private *i915, enum port port)
{
return i915->vbt.ddi_port_info[port].devdata;
}
...@@ -254,10 +254,14 @@ int intel_bios_dp_boost_level(struct intel_encoder *encoder); ...@@ -254,10 +254,14 @@ int intel_bios_dp_boost_level(struct intel_encoder *encoder);
int intel_bios_hdmi_boost_level(struct intel_encoder *encoder); int intel_bios_hdmi_boost_level(struct intel_encoder *encoder);
int intel_bios_dp_max_link_rate(struct intel_encoder *encoder); int intel_bios_dp_max_link_rate(struct intel_encoder *encoder);
int intel_bios_alternate_ddc_pin(struct intel_encoder *encoder); int intel_bios_alternate_ddc_pin(struct intel_encoder *encoder);
bool intel_bios_port_supports_dvi(struct drm_i915_private *i915, enum port port);
bool intel_bios_port_supports_hdmi(struct drm_i915_private *i915, enum port port);
bool intel_bios_port_supports_dp(struct drm_i915_private *i915, enum port port);
bool intel_bios_port_supports_typec_usb(struct drm_i915_private *i915, enum port port); bool intel_bios_port_supports_typec_usb(struct drm_i915_private *i915, enum port port);
bool intel_bios_port_supports_tbt(struct drm_i915_private *i915, enum port port); bool intel_bios_port_supports_tbt(struct drm_i915_private *i915, enum port port);
const struct intel_bios_encoder_data *
intel_bios_encoder_data_lookup(struct drm_i915_private *i915, enum port port);
bool intel_bios_encoder_supports_dvi(const struct intel_bios_encoder_data *devdata);
bool intel_bios_encoder_supports_hdmi(const struct intel_bios_encoder_data *devdata);
bool intel_bios_encoder_supports_dp(const struct intel_bios_encoder_data *devdata);
#endif /* _INTEL_BIOS_H_ */ #endif /* _INTEL_BIOS_H_ */
...@@ -4426,6 +4426,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port) ...@@ -4426,6 +4426,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
{ {
struct intel_digital_port *dig_port; struct intel_digital_port *dig_port;
struct intel_encoder *encoder; struct intel_encoder *encoder;
const struct intel_bios_encoder_data *devdata;
bool init_hdmi, init_dp; bool init_hdmi, init_dp;
enum phy phy = intel_port_to_phy(dev_priv, port); enum phy phy = intel_port_to_phy(dev_priv, port);
...@@ -4441,9 +4442,17 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port) ...@@ -4441,9 +4442,17 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
return; return;
} }
init_hdmi = intel_bios_port_supports_dvi(dev_priv, port) || devdata = intel_bios_encoder_data_lookup(dev_priv, port);
intel_bios_port_supports_hdmi(dev_priv, port); if (!devdata) {
init_dp = intel_bios_port_supports_dp(dev_priv, port); drm_dbg_kms(&dev_priv->drm,
"VBT says port %c is not present\n",
port_name(port));
return;
}
init_hdmi = intel_bios_encoder_supports_dvi(devdata) ||
intel_bios_encoder_supports_hdmi(devdata);
init_dp = intel_bios_encoder_supports_dp(devdata);
if (intel_bios_is_lspcon_present(dev_priv, port)) { if (intel_bios_is_lspcon_present(dev_priv, port)) {
/* /*
......
...@@ -582,7 +582,7 @@ i915_fence_timeout(const struct drm_i915_private *i915) ...@@ -582,7 +582,7 @@ i915_fence_timeout(const struct drm_i915_private *i915)
struct ddi_vbt_port_info { struct ddi_vbt_port_info {
/* Non-NULL if port present. */ /* Non-NULL if port present. */
const struct intel_bios_encoder_data *devdata; struct intel_bios_encoder_data *devdata;
int max_tmds_clock; int max_tmds_clock;
...@@ -590,10 +590,6 @@ struct ddi_vbt_port_info { ...@@ -590,10 +590,6 @@ struct ddi_vbt_port_info {
u8 hdmi_level_shift; u8 hdmi_level_shift;
u8 hdmi_level_shift_set:1; u8 hdmi_level_shift_set:1;
u8 supports_dvi:1;
u8 supports_hdmi:1;
u8 supports_dp:1;
u8 supports_edp:1;
u8 supports_typec_usb:1; u8 supports_typec_usb:1;
u8 supports_tbt:1; u8 supports_tbt:1;
......
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