From patchwork Mon May 23 10:50:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kahola, Mika" X-Patchwork-Id: 9131543 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 6CE5860459 for ; Mon, 23 May 2016 11:02:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6151A2822E for ; Mon, 23 May 2016 11:02:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5634128233; Mon, 23 May 2016 11:02:14 +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]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 245202822E for ; Mon, 23 May 2016 11:02:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3DF0D6E597; Mon, 23 May 2016 11:02:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTP id A1ACA6E57B; Mon, 23 May 2016 10:51:14 +0000 (UTC) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 23 May 2016 03:51:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,355,1459839600"; d="scan'208";a="982783334" Received: from sorvi.fi.intel.com ([10.237.72.50]) by orsmga002.jf.intel.com with ESMTP; 23 May 2016 03:51:13 -0700 From: Mika Kahola To: dri-devel@lists.freedesktop.org Subject: [PATCH v3 07/12] drm: Compute max pixel rate for DP sink Date: Mon, 23 May 2016 13:50:52 +0300 Message-Id: <1464000657-16867-8-git-send-email-mika.kahola@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1464000657-16867-1-git-send-email-mika.kahola@intel.com> References: <1464000657-16867-1-git-send-email-mika.kahola@intel.com> X-Mailman-Approved-At: Mon, 23 May 2016 11:02:04 +0000 Cc: intel-gfx@lists.freedesktop.org, jim.bride@intel.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP For DP branch devices DPCD register may define the max supported pixel rate for VGA dongles. This patch adds a check if DPCD register value is less than current setting for pixel rate. Signed-off-by: Mika Kahola --- drivers/gpu/drm/drm_dp_helper.c | 22 ++++++++++++++++++++++ include/drm/drm_dp_helper.h | 1 + 2 files changed, 23 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 2c91771..b222aa0 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -413,6 +413,28 @@ int drm_dp_link_power_down(struct drm_dp_aux *aux, struct drm_dp_link *link) EXPORT_SYMBOL(drm_dp_link_power_down); /* + * drm_dp_max_sink_dotclock() - Compute max pixel rate + * @dotclk: reference pixel rate + * @bd: pointer to a structure containing DP branch device information + * + * Returns max supported pixel rate. + */ +int drm_dp_max_sink_dotclock(int dotclk, struct drm_dp_bd *bd) +{ + int max_dotclk = dotclk; + + /* DP to VGA dongle may define max pixel rate in DPCD */ + if (bd->present) { + if ((bd->type & DP_DS_PORT_TYPE_VGA) && + (bd->dfp.vga.dot_clk > 0)) + max_dotclk = min(dotclk, bd->dfp.vga.dot_clk); + } + + return max_dotclk; +} +EXPORT_SYMBOL(drm_dp_max_sink_dotclock); + +/* * drm_dp_bd() - read DisplayPort Receiver Capability Fields for * DP branch devices * @aux: DisplayPort AUX channel diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 831f944..ee4084d 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -882,6 +882,7 @@ int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link); int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link); int drm_dp_link_power_down(struct drm_dp_aux *aux, struct drm_dp_link *link); int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link); +int drm_dp_max_sink_dotclock(int dotclk, struct drm_dp_bd *bd); int drm_dp_bd(struct drm_dp_aux *aux, struct drm_dp_bd *bd); int drm_dp_aux_register(struct drm_dp_aux *aux);