From patchwork Fri Aug 12 21:00:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Srivatsa, Anusha" X-Patchwork-Id: 9277951 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EA65660780 for ; Fri, 12 Aug 2016 21:04:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DBE0328AF1 for ; Fri, 12 Aug 2016 21:04:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D073128AF5; Fri, 12 Aug 2016 21:04:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9750F28AF1 for ; Fri, 12 Aug 2016 21:04:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AE5FD6EC41; Fri, 12 Aug 2016 21:04:46 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 143906EC43; Fri, 12 Aug 2016 21:04:45 +0000 (UTC) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 12 Aug 2016 14:04:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.28,512,1464678000"; d="scan'208"; a="1013456089" Received: from anusha.jf.intel.com ([10.7.198.61]) by orsmga001.jf.intel.com with ESMTP; 12 Aug 2016 14:04:45 -0700 From: Anusha Srivatsa To: intel-gfx@lists.freedesktop.org Date: Fri, 12 Aug 2016 14:00:47 -0700 Message-Id: <1471035647-5384-2-git-send-email-anusha.srivatsa@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1471035647-5384-1-git-send-email-anusha.srivatsa@intel.com> References: <1471035647-5384-1-git-send-email-anusha.srivatsa@intel.com> Cc: dhinakaran.pandiyan@intel.com, dri-devel@lists.freedesktop.org Subject: [Intel-gfx] [PATCH v2 2/2] drm/mst: A Helper function that returns available link bandwidth X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP 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. v2: Put the Signed-off to the end of commit message Cc: dri-devel@lists.freedesktop.org Cc: dhinakaran.pandiyan@intel.com Signed-off-by: Anusha Srivatsa --- 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);