diff mbox series

[09/12] drm/i915/bios: save a higher level pointer in ddi_vbt_port_info[]

Message ID 1a460aa95d1a03af1f368b209feb5c2ea7a29bbe.1613580193.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/bios: vbt child device rework | expand

Commit Message

Jani Nikula Feb. 17, 2021, 5:03 p.m. UTC
We'll be needing the intel_bios_encoder_data pointer going forward, and
it's just easier to store the higher level pointer in the
ddi_vbt_port_info[] array.

Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/display/intel_bios.c | 28 +++++++++++------------
 drivers/gpu/drm/i915/display/intel_bios.h |  1 +
 drivers/gpu/drm/i915/i915_drv.h           |  2 +-
 3 files changed, 16 insertions(+), 15 deletions(-)

Comments

Lucas De Marchi March 15, 2021, 5:36 p.m. UTC | #1
On Wed, Feb 17, 2021 at 07:03:39PM +0200, Jani Nikula wrote:
>We'll be needing the intel_bios_encoder_data pointer going forward, and
>it's just easier to store the higher level pointer in the
>ddi_vbt_port_info[] array.
>
>Cc: Lucas De Marchi <lucas.demarchi@intel.com>
>Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
>Signed-off-by: Jani Nikula <jani.nikula@intel.com>


Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>

Lucas De Marchi

>---
> drivers/gpu/drm/i915/display/intel_bios.c | 28 +++++++++++------------
> drivers/gpu/drm/i915/display/intel_bios.h |  1 +
> drivers/gpu/drm/i915/i915_drv.h           |  2 +-
> 3 files changed, 16 insertions(+), 15 deletions(-)
>
>diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
>index 739ef5d91907..47e9c609f82a 100644
>--- a/drivers/gpu/drm/i915/display/intel_bios.c
>+++ b/drivers/gpu/drm/i915/display/intel_bios.c
>@@ -1511,7 +1511,7 @@ static enum port get_port_by_ddc_pin(struct drm_i915_private *i915, u8 ddc_pin)
> 	for_each_port(port) {
> 		info = &i915->vbt.ddi_port_info[port];
>
>-		if (info->child && ddc_pin == info->alternate_ddc_pin)
>+		if (info->devdata && ddc_pin == info->alternate_ddc_pin)
> 			return port;
> 	}
>
>@@ -1563,7 +1563,7 @@ static enum port get_port_by_aux_ch(struct drm_i915_private *i915, u8 aux_ch)
> 	for_each_port(port) {
> 		info = &i915->vbt.ddi_port_info[port];
>
>-		if (info->child && aux_ch == info->alternate_aux_channel)
>+		if (info->devdata && aux_ch == info->alternate_aux_channel)
> 			return port;
> 	}
>
>@@ -1823,7 +1823,7 @@ static void parse_ddi_port(struct drm_i915_private *i915,
>
> 	info = &i915->vbt.ddi_port_info[port];
>
>-	if (info->child) {
>+	if (info->devdata) {
> 		drm_dbg_kms(&i915->drm,
> 			    "More than one child device for port %c in VBT, using the first.\n",
> 			    port_name(port));
>@@ -1947,7 +1947,7 @@ static void parse_ddi_port(struct drm_i915_private *i915,
> 			    port_name(port), info->dp_max_link_rate);
> 	}
>
>-	info->child = child;
>+	info->devdata = devdata;
> }
>
> static void parse_ddi_ports(struct drm_i915_private *i915)
>@@ -2488,7 +2488,7 @@ bool intel_bios_is_port_present(struct drm_i915_private *i915, enum port port)
> 		const struct ddi_vbt_port_info *port_info =
> 			&i915->vbt.ddi_port_info[port];
>
>-		return port_info->child;
>+		return port_info->devdata;
> 	}
>
> 	/* FIXME maybe deal with port A as well? */
>@@ -2735,13 +2735,13 @@ bool
> intel_bios_is_port_hpd_inverted(const struct drm_i915_private *i915,
> 				enum port port)
> {
>-	const struct child_device_config *child =
>-		i915->vbt.ddi_port_info[port].child;
>+	const struct intel_bios_encoder_data *devdata =
>+		i915->vbt.ddi_port_info[port].devdata;
>
> 	if (drm_WARN_ON_ONCE(&i915->drm, !IS_GEN9_LP(i915)))
> 		return false;
>
>-	return child && child->hpd_invert;
>+	return devdata && devdata->child.hpd_invert;
> }
>
> /**
>@@ -2755,10 +2755,10 @@ bool
> intel_bios_is_lspcon_present(const struct drm_i915_private *i915,
> 			     enum port port)
> {
>-	const struct child_device_config *child =
>-		i915->vbt.ddi_port_info[port].child;
>+	const struct intel_bios_encoder_data *devdata =
>+		i915->vbt.ddi_port_info[port].devdata;
>
>-	return HAS_LSPCON(i915) && child && child->lspcon;
>+	return HAS_LSPCON(i915) && devdata && devdata->child.lspcon;
> }
>
> /**
>@@ -2772,10 +2772,10 @@ bool
> intel_bios_is_lane_reversal_needed(const struct drm_i915_private *i915,
> 				   enum port port)
> {
>-	const struct child_device_config *child =
>-		i915->vbt.ddi_port_info[port].child;
>+	const struct intel_bios_encoder_data *devdata =
>+		i915->vbt.ddi_port_info[port].devdata;
>
>-	return child && child->lane_reversal;
>+	return devdata && devdata->child.lane_reversal;
> }
>
> enum aux_ch intel_bios_port_aux_ch(struct drm_i915_private *i915,
>diff --git a/drivers/gpu/drm/i915/display/intel_bios.h b/drivers/gpu/drm/i915/display/intel_bios.h
>index f25190ecfe97..6591cf7758f2 100644
>--- a/drivers/gpu/drm/i915/display/intel_bios.h
>+++ b/drivers/gpu/drm/i915/display/intel_bios.h
>@@ -33,6 +33,7 @@
> #include <linux/types.h>
>
> struct drm_i915_private;
>+struct intel_bios_encoder_data;
> struct intel_crtc_state;
> struct intel_encoder;
> enum port;
>diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
>index 62be1465f52b..e2c5ba61b370 100644
>--- a/drivers/gpu/drm/i915/i915_drv.h
>+++ b/drivers/gpu/drm/i915/i915_drv.h
>@@ -584,7 +584,7 @@ i915_fence_timeout(const struct drm_i915_private *i915)
>
> struct ddi_vbt_port_info {
> 	/* Non-NULL if port present. */
>-	const struct child_device_config *child;
>+	const struct intel_bios_encoder_data *devdata;
>
> 	int max_tmds_clock;
>
>-- 
>2.20.1
>
>_______________________________________________
>Intel-gfx mailing list
>Intel-gfx@lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
index 739ef5d91907..47e9c609f82a 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.c
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
@@ -1511,7 +1511,7 @@  static enum port get_port_by_ddc_pin(struct drm_i915_private *i915, u8 ddc_pin)
 	for_each_port(port) {
 		info = &i915->vbt.ddi_port_info[port];
 
-		if (info->child && ddc_pin == info->alternate_ddc_pin)
+		if (info->devdata && ddc_pin == info->alternate_ddc_pin)
 			return port;
 	}
 
@@ -1563,7 +1563,7 @@  static enum port get_port_by_aux_ch(struct drm_i915_private *i915, u8 aux_ch)
 	for_each_port(port) {
 		info = &i915->vbt.ddi_port_info[port];
 
-		if (info->child && aux_ch == info->alternate_aux_channel)
+		if (info->devdata && aux_ch == info->alternate_aux_channel)
 			return port;
 	}
 
@@ -1823,7 +1823,7 @@  static void parse_ddi_port(struct drm_i915_private *i915,
 
 	info = &i915->vbt.ddi_port_info[port];
 
-	if (info->child) {
+	if (info->devdata) {
 		drm_dbg_kms(&i915->drm,
 			    "More than one child device for port %c in VBT, using the first.\n",
 			    port_name(port));
@@ -1947,7 +1947,7 @@  static void parse_ddi_port(struct drm_i915_private *i915,
 			    port_name(port), info->dp_max_link_rate);
 	}
 
-	info->child = child;
+	info->devdata = devdata;
 }
 
 static void parse_ddi_ports(struct drm_i915_private *i915)
@@ -2488,7 +2488,7 @@  bool intel_bios_is_port_present(struct drm_i915_private *i915, enum port port)
 		const struct ddi_vbt_port_info *port_info =
 			&i915->vbt.ddi_port_info[port];
 
-		return port_info->child;
+		return port_info->devdata;
 	}
 
 	/* FIXME maybe deal with port A as well? */
@@ -2735,13 +2735,13 @@  bool
 intel_bios_is_port_hpd_inverted(const struct drm_i915_private *i915,
 				enum port port)
 {
-	const struct child_device_config *child =
-		i915->vbt.ddi_port_info[port].child;
+	const struct intel_bios_encoder_data *devdata =
+		i915->vbt.ddi_port_info[port].devdata;
 
 	if (drm_WARN_ON_ONCE(&i915->drm, !IS_GEN9_LP(i915)))
 		return false;
 
-	return child && child->hpd_invert;
+	return devdata && devdata->child.hpd_invert;
 }
 
 /**
@@ -2755,10 +2755,10 @@  bool
 intel_bios_is_lspcon_present(const struct drm_i915_private *i915,
 			     enum port port)
 {
-	const struct child_device_config *child =
-		i915->vbt.ddi_port_info[port].child;
+	const struct intel_bios_encoder_data *devdata =
+		i915->vbt.ddi_port_info[port].devdata;
 
-	return HAS_LSPCON(i915) && child && child->lspcon;
+	return HAS_LSPCON(i915) && devdata && devdata->child.lspcon;
 }
 
 /**
@@ -2772,10 +2772,10 @@  bool
 intel_bios_is_lane_reversal_needed(const struct drm_i915_private *i915,
 				   enum port port)
 {
-	const struct child_device_config *child =
-		i915->vbt.ddi_port_info[port].child;
+	const struct intel_bios_encoder_data *devdata =
+		i915->vbt.ddi_port_info[port].devdata;
 
-	return child && child->lane_reversal;
+	return devdata && devdata->child.lane_reversal;
 }
 
 enum aux_ch intel_bios_port_aux_ch(struct drm_i915_private *i915,
diff --git a/drivers/gpu/drm/i915/display/intel_bios.h b/drivers/gpu/drm/i915/display/intel_bios.h
index f25190ecfe97..6591cf7758f2 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.h
+++ b/drivers/gpu/drm/i915/display/intel_bios.h
@@ -33,6 +33,7 @@ 
 #include <linux/types.h>
 
 struct drm_i915_private;
+struct intel_bios_encoder_data;
 struct intel_crtc_state;
 struct intel_encoder;
 enum port;
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 62be1465f52b..e2c5ba61b370 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -584,7 +584,7 @@  i915_fence_timeout(const struct drm_i915_private *i915)
 
 struct ddi_vbt_port_info {
 	/* Non-NULL if port present. */
-	const struct child_device_config *child;
+	const struct intel_bios_encoder_data *devdata;
 
 	int max_tmds_clock;