From patchwork Fri Apr 24 12:50:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "B, Jeevan" X-Patchwork-Id: 11507793 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 278D413B2 for ; Fri, 24 Apr 2020 12:54:34 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1037120706 for ; Fri, 24 Apr 2020 12:54:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1037120706 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5933189CFA; Fri, 24 Apr 2020 12:54:31 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id 14A1289CFA; Fri, 24 Apr 2020 12:54:30 +0000 (UTC) IronPort-SDR: kI3asgeiJ5K5ZE0QgmIAoC1S6/fEuufL68gDRU/aJ4Aeec5BuJ5Qy7+QJF7ddLzBt7Hk8fsomF SWOCLeySwKUQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2020 05:54:29 -0700 IronPort-SDR: QtZ5Mt/3IHEGdGQPeV0g8SOXc4ZeRjq0Xp++16zPOiYWZL/5tE1cuFfF8/sCCKvvadpjEswKEk cHId+yAy0t1g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,311,1583222400"; d="scan'208";a="430756359" Received: from unknown (HELO jeevan-desktop.iind.intel.com) ([10.223.74.85]) by orsmga005.jf.intel.com with ESMTP; 24 Apr 2020 05:54:26 -0700 From: Jeevan B To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Fri, 24 Apr 2020 18:20:53 +0530 Message-Id: <1587732655-17544-3-git-send-email-jeevan.b@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1587732655-17544-1-git-send-email-jeevan.b@intel.com> References: <1587732655-17544-1-git-send-email-jeevan.b@intel.com> Subject: [Intel-gfx] [PATCH 3/5] drm/nouveau: utilize subconnector property for DP X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, nouveau@lists.freedesktop.org, Oleg Vasilev , Jeevan B , Ben Skeggs MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Oleg Vasilev Since DP-specific information is stored in driver's structures, every driver needs to implement subconnector property by itself. v2: rebase Cc: Ben Skeggs Cc: nouveau@lists.freedesktop.org Signed-off-by: Jeevan B Signed-off-by: Oleg Vasilev Reviewed-by: Emil Velikov --- drivers/gpu/drm/nouveau/nouveau_connector.c | 13 +++++++++++++ drivers/gpu/drm/nouveau/nouveau_dp.c | 9 +++++++++ drivers/gpu/drm/nouveau/nouveau_encoder.h | 1 + 3 files changed, 23 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index 9a9a7f5..6464e48 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -648,6 +648,17 @@ nouveau_connector_detect(struct drm_connector *connector, bool force) pm_runtime_mark_last_busy(dev->dev); pm_runtime_put_autosuspend(dev->dev); + if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort || + connector->connector_type == DRM_MODE_CONNECTOR_eDP) { + enum drm_mode_subconnector subconnector = DRM_MODE_SUBCONNECTOR_Unknown; + + if (conn_status == connector_status_connected && nv_encoder) + subconnector = nv_encoder->dp.subconnector; + drm_object_property_set_value(&connector->base, + connector->dev->mode_config.dp_subconnector_property, + subconnector); + } + return conn_status; } @@ -1373,6 +1384,8 @@ nouveau_connector_create(struct drm_device *dev, kfree(nv_connector); return ERR_PTR(ret); } + + drm_mode_add_dp_subconnector_property(connector); funcs = &nouveau_connector_funcs; break; default: diff --git a/drivers/gpu/drm/nouveau/nouveau_dp.c b/drivers/gpu/drm/nouveau/nouveau_dp.c index 2674f15..85eac85 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dp.c +++ b/drivers/gpu/drm/nouveau/nouveau_dp.c @@ -62,6 +62,7 @@ nouveau_dp_detect(struct nouveau_encoder *nv_encoder) struct nouveau_drm *drm = nouveau_drm(dev); struct nvkm_i2c_aux *aux; u8 dpcd[8]; + u8 port_cap[DP_MAX_DOWNSTREAM_PORTS] = {}; int ret; aux = nv_encoder->aux; @@ -72,6 +73,14 @@ nouveau_dp_detect(struct nouveau_encoder *nv_encoder) if (ret) return ret; + if (dpcd[DP_DPCD_REV] > 0x10) { + ret = nvkm_rdaux(aux, DP_DOWNSTREAM_PORT_0, + port_cap, DP_MAX_DOWNSTREAM_PORTS); + if (ret) + memset(port_cap, 0, DP_MAX_DOWNSTREAM_PORTS); + } + nv_encoder->dp.subconnector = drm_dp_subconnector_type(dpcd, port_cap); + nv_encoder->dp.link_bw = 27000 * dpcd[1]; nv_encoder->dp.link_nr = dpcd[2] & DP_MAX_LANE_COUNT_MASK; diff --git a/drivers/gpu/drm/nouveau/nouveau_encoder.h b/drivers/gpu/drm/nouveau/nouveau_encoder.h index 3517f92..e17971a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_encoder.h +++ b/drivers/gpu/drm/nouveau/nouveau_encoder.h @@ -63,6 +63,7 @@ struct nouveau_encoder { struct nv50_mstm *mstm; int link_nr; int link_bw; + enum drm_mode_subconnector subconnector; } dp; };