From patchwork Thu Aug 11 23:41:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Srivatsa, Anusha" X-Patchwork-Id: 9276159 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 E9D0B60CDC for ; Thu, 11 Aug 2016 23:45:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB1DE2879B for ; Thu, 11 Aug 2016 23:45:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CFAE4287C3; Thu, 11 Aug 2016 23:45:51 +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=unavailable 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 984BE2879B for ; Thu, 11 Aug 2016 23:45:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4F70E6EA29; Thu, 11 Aug 2016 23:45:49 +0000 (UTC) X-Original-To: intel-gfx@freedesktop.org Delivered-To: intel-gfx@freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTP id 6480F6EA26 for ; Thu, 11 Aug 2016 23:45:47 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP; 11 Aug 2016 16:45:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,507,1464678000"; d="scan'208";a="864028277" Received: from anusha.jf.intel.com ([10.7.198.61]) by orsmga003.jf.intel.com with ESMTP; 11 Aug 2016 16:45:47 -0700 From: Anusha Srivatsa To: intel-gfx@freedesktop.org Date: Thu, 11 Aug 2016 16:41:39 -0700 Message-Id: <1470958900-822-1-git-send-email-anusha.srivatsa@intel.com> X-Mailer: git-send-email 2.7.4 Cc: dri-devel@lists.freedesktop.org Subject: [Intel-gfx] [PATCH 1/2] 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 drm/dp/mst Signed-off-by: Anusha Srivatsa 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(+) 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);