diff mbox

[03/24] drm/i915/icl: introduce tc_port

Message ID 20180522002558.29262-4-paulo.r.zanoni@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Zanoni, Paulo R May 22, 2018, 12:25 a.m. UTC
Add and enum for TC ports and auxiliary functions to handle them.
Icelake brings a lot of registers and other things that only apply to
the TC ports and are indexed starting from 0, so having an enum for
tc_ports that starts at 0 really helps the indexing.

This patch is based on previous patches written by Dhinakaran Pandiyan
and Mahesh Kumar.

Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Cc: Mahesh Kumar <mahesh1.kumar@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 16 ++++++++++++++++
 drivers/gpu/drm/i915/intel_display.h | 11 +++++++++++
 drivers/gpu/drm/i915/intel_drv.h     |  3 +++
 3 files changed, 30 insertions(+)

Comments

Kumar, Mahesh May 22, 2018, 6:13 a.m. UTC | #1
Reviewed-by: Mahesh Kumar <mahesh1.kumar@intel.com>


On 5/22/2018 5:55 AM, Paulo Zanoni wrote:
> Add and enum for TC ports and auxiliary functions to handle them.
> Icelake brings a lot of registers and other things that only apply to
> the TC ports and are indexed starting from 0, so having an enum for
> tc_ports that starts at 0 really helps the indexing.
>
> This patch is based on previous patches written by Dhinakaran Pandiyan
> and Mahesh Kumar.
>
> Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> Cc: Mahesh Kumar <mahesh1.kumar@intel.com>
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_display.c | 16 ++++++++++++++++
>   drivers/gpu/drm/i915/intel_display.h | 11 +++++++++++
>   drivers/gpu/drm/i915/intel_drv.h     |  3 +++
>   3 files changed, 30 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index c9ec88acad9c..64593b0fbebd 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -5807,6 +5807,22 @@ static void i9xx_pfit_enable(struct intel_crtc *crtc)
>   	I915_WRITE(BCLRPAT(crtc->pipe), 0);
>   }
>   
> +bool intel_port_is_tc(struct drm_i915_private *dev_priv, enum port port)
> +{
> +	if (IS_ICELAKE(dev_priv))
> +		return port >= PORT_C && port <= PORT_F;
> +
> +	return false;
> +}
> +
> +enum tc_port intel_port_to_tc(struct drm_i915_private *dev_priv, enum port port)
> +{
> +	if (!intel_port_is_tc(dev_priv, port))
> +		return PORT_TC_NONE;
> +
> +	return port - PORT_C;
> +}
> +
>   enum intel_display_power_domain intel_port_to_power_domain(enum port port)
>   {
>   	switch (port) {
> diff --git a/drivers/gpu/drm/i915/intel_display.h b/drivers/gpu/drm/i915/intel_display.h
> index 2ef31617614a..c88185ed7594 100644
> --- a/drivers/gpu/drm/i915/intel_display.h
> +++ b/drivers/gpu/drm/i915/intel_display.h
> @@ -126,6 +126,17 @@ enum port {
>   
>   #define port_name(p) ((p) + 'A')
>   
> +enum tc_port {
> +	PORT_TC_NONE = -1,
> +
> +	PORT_TC1 = 0,
> +	PORT_TC2,
> +	PORT_TC3,
> +	PORT_TC4,
> +
> +	I915_MAX_TC_PORTS
> +};
> +
>   enum dpio_channel {
>   	DPIO_CH0,
>   	DPIO_CH1
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 22af249393a4..a54232c270e1 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1493,6 +1493,9 @@ void intel_connector_attach_encoder(struct intel_connector *connector,
>   				    struct intel_encoder *encoder);
>   struct drm_display_mode *
>   intel_encoder_current_mode(struct intel_encoder *encoder);
> +bool intel_port_is_tc(struct drm_i915_private *dev_priv, enum port port);
> +enum tc_port intel_port_to_tc(struct drm_i915_private *dev_priv,
> +			      enum port port);
>   
>   enum pipe intel_get_pipe_from_connector(struct intel_connector *connector);
>   int intel_get_pipe_from_crtc_id_ioctl(struct drm_device *dev, void *data,
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index c9ec88acad9c..64593b0fbebd 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5807,6 +5807,22 @@  static void i9xx_pfit_enable(struct intel_crtc *crtc)
 	I915_WRITE(BCLRPAT(crtc->pipe), 0);
 }
 
+bool intel_port_is_tc(struct drm_i915_private *dev_priv, enum port port)
+{
+	if (IS_ICELAKE(dev_priv))
+		return port >= PORT_C && port <= PORT_F;
+
+	return false;
+}
+
+enum tc_port intel_port_to_tc(struct drm_i915_private *dev_priv, enum port port)
+{
+	if (!intel_port_is_tc(dev_priv, port))
+		return PORT_TC_NONE;
+
+	return port - PORT_C;
+}
+
 enum intel_display_power_domain intel_port_to_power_domain(enum port port)
 {
 	switch (port) {
diff --git a/drivers/gpu/drm/i915/intel_display.h b/drivers/gpu/drm/i915/intel_display.h
index 2ef31617614a..c88185ed7594 100644
--- a/drivers/gpu/drm/i915/intel_display.h
+++ b/drivers/gpu/drm/i915/intel_display.h
@@ -126,6 +126,17 @@  enum port {
 
 #define port_name(p) ((p) + 'A')
 
+enum tc_port {
+	PORT_TC_NONE = -1,
+
+	PORT_TC1 = 0,
+	PORT_TC2,
+	PORT_TC3,
+	PORT_TC4,
+
+	I915_MAX_TC_PORTS
+};
+
 enum dpio_channel {
 	DPIO_CH0,
 	DPIO_CH1
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 22af249393a4..a54232c270e1 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1493,6 +1493,9 @@  void intel_connector_attach_encoder(struct intel_connector *connector,
 				    struct intel_encoder *encoder);
 struct drm_display_mode *
 intel_encoder_current_mode(struct intel_encoder *encoder);
+bool intel_port_is_tc(struct drm_i915_private *dev_priv, enum port port);
+enum tc_port intel_port_to_tc(struct drm_i915_private *dev_priv,
+			      enum port port);
 
 enum pipe intel_get_pipe_from_connector(struct intel_connector *connector);
 int intel_get_pipe_from_crtc_id_ioctl(struct drm_device *dev, void *data,