[1/2] A Helper function that returns available link bandwidth
diff mbox

Message ID 1470958900-822-1-git-send-email-anusha.srivatsa@intel.com
State New
Headers show

Commit Message

Srivatsa, Anusha Aug. 11, 2016, 11:41 p.m. UTC
drm/dp/mst

Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>

Add a function that returns the available link bandwidth for
MST port so that we can accurately determine whether a new
mode is valid for the link or not.

Cc: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 12 ++++++++++++
 include/drm/drm_dp_mst_helper.h       |  1 +
 2 files changed, 13 insertions(+)

Comments

Dhinakaran Pandiyan Aug. 12, 2016, 3:26 a.m. UTC | #1
On Thu, 2016-08-11 at 16:41 -0700, Anusha Srivatsa wrote:
> drm/dp/mst

> 

> Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>

> 

> Add a function that returns the available link bandwidth for

> MST port so that we can accurately determine whether a new

> mode is valid for the link or not.

> 


The Signed-off line should follow the explanation body.

> Cc: dri-devel@lists.freedesktop.org

> ---

>  drivers/gpu/drm/drm_dp_mst_topology.c | 12 ++++++++++++

>  include/drm/drm_dp_mst_helper.h       |  1 +

>  2 files changed, 13 insertions(+)

> 

> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c

> index 04e4571..7a239f6 100644

> --- a/drivers/gpu/drm/drm_dp_mst_topology.c

> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c

> @@ -43,6 +43,8 @@ static bool dump_dp_payload_table(struct drm_dp_mst_topology_mgr *mgr,

>  				  char *buf);

>  static int test_calc_pbn_mode(void);

>  

> +int drm_dp_mst_get_avail_pbn(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);

> +

>  static void drm_dp_put_port(struct drm_dp_mst_port *port);

>  

>  static int drm_dp_dpcd_write_payload(struct drm_dp_mst_topology_mgr *mgr,

> @@ -2730,6 +2732,16 @@ static int test_calc_pbn_mode(void)

>  	return 0;

>  }

>  

> +int drm_dp_mst_get_avail_pbn(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port)

> +{

> +        port = drm_dp_get_validated_port_ref(mgr,port);

> +        if (port)

> +                return port->available_pbn;

> +

> +        return -EINVAL;

> +}

> +EXPORT_SYMBOL(drm_dp_mst_get_avail_pbn);

> +

>  /* we want to kick the TX after we've ack the up/down IRQs. */

>  static void drm_dp_mst_kick_tx(struct drm_dp_mst_topology_mgr *mgr)

>  {

> diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h

> index 0032076..74dc4ab 100644

> --- a/include/drm/drm_dp_mst_helper.h

> +++ b/include/drm/drm_dp_mst_helper.h

> @@ -576,6 +576,7 @@ struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_

>  

>  int drm_dp_calc_pbn_mode(int clock, int bpp);

>  

> +int drm_dp_mst_get_avail_pbn(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);

>  

>  bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, int pbn, int *slots);

>

Patch
diff mbox

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 04e4571..7a239f6 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -43,6 +43,8 @@  static bool dump_dp_payload_table(struct drm_dp_mst_topology_mgr *mgr,
 				  char *buf);
 static int test_calc_pbn_mode(void);
 
+int drm_dp_mst_get_avail_pbn(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
+
 static void drm_dp_put_port(struct drm_dp_mst_port *port);
 
 static int drm_dp_dpcd_write_payload(struct drm_dp_mst_topology_mgr *mgr,
@@ -2730,6 +2732,16 @@  static int test_calc_pbn_mode(void)
 	return 0;
 }
 
+int drm_dp_mst_get_avail_pbn(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port)
+{
+        port = drm_dp_get_validated_port_ref(mgr,port);
+        if (port)
+                return port->available_pbn;
+
+        return -EINVAL;
+}
+EXPORT_SYMBOL(drm_dp_mst_get_avail_pbn);
+
 /* we want to kick the TX after we've ack the up/down IRQs. */
 static void drm_dp_mst_kick_tx(struct drm_dp_mst_topology_mgr *mgr)
 {
diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h
index 0032076..74dc4ab 100644
--- a/include/drm/drm_dp_mst_helper.h
+++ b/include/drm/drm_dp_mst_helper.h
@@ -576,6 +576,7 @@  struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_
 
 int drm_dp_calc_pbn_mode(int clock, int bpp);
 
+int drm_dp_mst_get_avail_pbn(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
 
 bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, int pbn, int *slots);