diff mbox

[v4,03/11] drm: Helper to read DP branch device type

Message ID 1465219753-3737-4-git-send-email-mika.kahola@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kahola June 6, 2016, 1:29 p.m. UTC
Helper routine to read out DisplayPort branch device type. The spec
defines these type as following

	0   DisplayPort
	1   Analog VGA
	2   DVI
	3   HDMI
	4   Others without EDID support
	5   DP++
	6   Wireless
	7   Reserved

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 drivers/gpu/drm/drm_dp_helper.c | 14 ++++++++++++++
 include/drm/drm_dp_helper.h     |  1 +
 2 files changed, 15 insertions(+)

Comments

Ville Syrjälä June 9, 2016, 7:57 a.m. UTC | #1
On Mon, Jun 06, 2016 at 04:29:05PM +0300, Mika Kahola wrote:
> Helper routine to read out DisplayPort branch device type. The spec
> defines these type as following
> 
> 	0   DisplayPort
> 	1   Analog VGA
> 	2   DVI
> 	3   HDMI
> 	4   Others without EDID support
> 	5   DP++
> 	6   Wireless
> 	7   Reserved
> 
> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> ---
>  drivers/gpu/drm/drm_dp_helper.c | 14 ++++++++++++++
>  include/drm/drm_dp_helper.h     |  1 +
>  2 files changed, 15 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
> index c4149fd..7d3b245 100644
> --- a/drivers/gpu/drm/drm_dp_helper.c
> +++ b/drivers/gpu/drm/drm_dp_helper.c
> @@ -465,6 +465,20 @@ int drm_dp_downstream_port_cap(struct drm_dp_aux *aux,
>  }
>  EXPORT_SYMBOL(drm_dp_downstream_port_cap);
>  
> +/**
> + * drm_dp_downstream_type() - extract downstream port type
> + * @dpcd: DisplayPort configuration data
> + * @port_cap: port capabilities
> + *
> + * Returns type in success or negative error code on failure
> + */
> +int drm_dp_downstream_type(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
> +			   const u8 port_cap[4])
> +{
> +	return port_cap[0] & DP_DS_PORT_TYPE_MASK;
> +}
> +EXPORT_SYMBOL(drm_dp_downstream_type);

Seems rather pointless to me.

> +
>  /*
>   * I2C-over-AUX implementation
>   */
> diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
> index db8d3d47..f290829 100644
> --- a/include/drm/drm_dp_helper.h
> +++ b/include/drm/drm_dp_helper.h
> @@ -809,6 +809,7 @@ int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link);
>  int drm_dp_downstream_port_cap(struct drm_dp_aux *aux,
>  			       const u8 dpcd[DP_RECEIVER_CAP_SIZE],
>  			       u8 port_cap[4]);
> +int drm_dp_downstream_type(const u8 dpcd[DP_RECEIVER_CAP_SIZE], const u8 port_cap[4]);
>  
>  int drm_dp_aux_register(struct drm_dp_aux *aux);
>  void drm_dp_aux_unregister(struct drm_dp_aux *aux);
> -- 
> 1.9.1
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index c4149fd..7d3b245 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -465,6 +465,20 @@  int drm_dp_downstream_port_cap(struct drm_dp_aux *aux,
 }
 EXPORT_SYMBOL(drm_dp_downstream_port_cap);
 
+/**
+ * drm_dp_downstream_type() - extract downstream port type
+ * @dpcd: DisplayPort configuration data
+ * @port_cap: port capabilities
+ *
+ * Returns type in success or negative error code on failure
+ */
+int drm_dp_downstream_type(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
+			   const u8 port_cap[4])
+{
+	return port_cap[0] & DP_DS_PORT_TYPE_MASK;
+}
+EXPORT_SYMBOL(drm_dp_downstream_type);
+
 /*
  * I2C-over-AUX implementation
  */
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index db8d3d47..f290829 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -809,6 +809,7 @@  int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link);
 int drm_dp_downstream_port_cap(struct drm_dp_aux *aux,
 			       const u8 dpcd[DP_RECEIVER_CAP_SIZE],
 			       u8 port_cap[4]);
+int drm_dp_downstream_type(const u8 dpcd[DP_RECEIVER_CAP_SIZE], const u8 port_cap[4]);
 
 int drm_dp_aux_register(struct drm_dp_aux *aux);
 void drm_dp_aux_unregister(struct drm_dp_aux *aux);