Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1593110pxy; Fri, 23 Apr 2021 11:47:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiSS63uP0qkkPMl3j4YtyhcjbvScxy/YhSqeITUTIb1ifoz9zIFHshOP0UtmFdwNQfP+Mt X-Received: by 2002:a17:906:1b54:: with SMTP id p20mr5821621ejg.477.1619203633909; Fri, 23 Apr 2021 11:47:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619203633; cv=none; d=google.com; s=arc-20160816; b=xTIomZiijNnfWVxNuqWq463dEqmiNo7aUBga+r563tbfQnNJL6gzSKog9qFou8WqWP Fv/JoOj3b83f96iCs/Cbxl/oEi8Fjiyn9eV8tEpJoAloAggSiqeezzA/FT/x7Xqfc2kx ptCYwTjh/he5Zx0NO1voR03wuPUwD4dX9gUgODBhlHLEsR5vu/zGKms7TgnghRbLfGv1 fbIU+shwKTHyzxYuS9G0NKaM0BVUsMcuWYF90hsv33zZmsY4TH1ZZ3BuVSILPxMWxBDS cdRuanWBKdjVJX6WtZeowSM50cf2Lght1s/ZD1WDBEOv3VXGQ5rIJIYEro2HymFJpmkS 3H0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=s3xILF1G/BWWkGYxsN+ddfd7+1qnJ8Wx51GpkkVphNc=; b=ReTzbf4pYOwezm4ZZR+iJnkfzTF/fbI7mQu7ms3hfxXREvPr1/nOFQzYEtLNnyEc87 MUG1ItXeSDBhasyAxyc9l5+8hn6TxXimGGpi0HzdYGaUlvUp1iwBneUsOw4qFPeVrDJa N7YLXWQjTOMKKBogxTyOm/nAlJRexsTeunLLo6OdH8CgsQQj3JZNb/1fp8F3oaspYgAe XJyUxnMQsWS+gnwFMn8ufEBCwyHRKOxv5t30ztJuli5CC0BS5ScrDyx/OrCWCI8bQRvp +Qzh+pmJ0NLaGdggR740tmZHrAiQFFOoaNpthaDAo4hvmonOuU9ZtKJyAxKqBGErJDKg FbmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TZV1uze2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y15si6037959ejb.688.2021.04.23.11.46.49; Fri, 23 Apr 2021 11:47:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TZV1uze2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243532AbhDWSqQ (ORCPT + 99 others); Fri, 23 Apr 2021 14:46:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:59961 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229549AbhDWSqM (ORCPT ); Fri, 23 Apr 2021 14:46:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619203535; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=s3xILF1G/BWWkGYxsN+ddfd7+1qnJ8Wx51GpkkVphNc=; b=TZV1uze2IqkxZf0+yv8Qz7rsE8oKtvV+KIXvJetMPbcHpgXz50Fgvx9IGlxZ8hpCS0BstC l4DJk9KM/dFlWT8+qPMeO8QNOyVO8F2nmGWSuA+KlDqlSxHdXiLa1CDY1nJ8IbcYWOwrcp h0cteSOk4haEHl6wKZp5ES4IN6TGZQw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-331-rmIFbNBTNzm-2a1VAVARUA-1; Fri, 23 Apr 2021 14:45:31 -0400 X-MC-Unique: rmIFbNBTNzm-2a1VAVARUA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 17A05107ACF8; Fri, 23 Apr 2021 18:44:50 +0000 (UTC) Received: from Ruby.lyude.net (ovpn-114-74.rdu2.redhat.com [10.10.114.74]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47CE7687D7; Fri, 23 Apr 2021 18:44:47 +0000 (UTC) From: Lyude Paul To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Jani Nikula , Rodrigo Vivi , Thomas Zimmermann , Thierry Reding Cc: Maarten Lankhorst , Maxime Ripard , David Airlie , Daniel Vetter , Joonas Lahtinen , Ramalingam C , Uma Shankar , Matt Roper , Sean Paul , Lucas De Marchi , Ankit Nautiyal , Kai-Heng Feng , Gwan-gyeong Mun , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v4 08/17] drm/dp_dual_mode: Pass drm_device to drm_dp_dual_mode_detect() Date: Fri, 23 Apr 2021 14:43:00 -0400 Message-Id: <20210423184309.207645-9-lyude@redhat.com> In-Reply-To: <20210423184309.207645-1-lyude@redhat.com> References: <20210423184309.207645-1-lyude@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since we're about to be using drm_dbg_*() throughout the DP helpers, we'll need to be able to access the DRM device in the dual mode DP helpers as well. Note however that since drm_dp_dual_mode_detect() can be called with DDC adapters that aren't part of a drm_dp_aux struct, we need to pass down the drm_device to these functions instead of using drm_dp_aux. Signed-off-by: Lyude Paul --- drivers/gpu/drm/drm_dp_dual_mode_helper.c | 4 +++- drivers/gpu/drm/i915/display/intel_hdmi.c | 2 +- drivers/gpu/drm/i915/display/intel_lspcon.c | 5 +++-- include/drm/drm_dp_dual_mode_helper.h | 4 +++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_dual_mode_helper.c b/drivers/gpu/drm/drm_dp_dual_mode_helper.c index 1c9ea9f7fdaf..9ee75c568c37 100644 --- a/drivers/gpu/drm/drm_dp_dual_mode_helper.c +++ b/drivers/gpu/drm/drm_dp_dual_mode_helper.c @@ -165,6 +165,7 @@ static bool is_lspcon_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN], /** * drm_dp_dual_mode_detect - Identify the DP dual mode adaptor + * @dev: &drm_device to use * @adapter: I2C adapter for the DDC bus * * Attempt to identify the type of the DP dual mode adaptor used. @@ -178,7 +179,8 @@ static bool is_lspcon_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN], * Returns: * The type of the DP dual mode adaptor used */ -enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter) +enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(const struct drm_device *dev, + struct i2c_adapter *adapter) { char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN] = {}; uint8_t adaptor_id = 0x00; diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c index 47a8f0a1c5e2..08fb98dac169 100644 --- a/drivers/gpu/drm/i915/display/intel_hdmi.c +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c @@ -2224,7 +2224,7 @@ intel_hdmi_dp_dual_mode_detect(struct drm_connector *connector, bool has_edid) enum port port = hdmi_to_dig_port(hdmi)->base.port; struct i2c_adapter *adapter = intel_gmbus_get_adapter(dev_priv, hdmi->ddc_bus); - enum drm_dp_dual_mode_type type = drm_dp_dual_mode_detect(adapter); + enum drm_dp_dual_mode_type type = drm_dp_dual_mode_detect(&dev_priv->drm, adapter); /* * Type 1 DVI adaptors are not required to implement any diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.c b/drivers/gpu/drm/i915/display/intel_lspcon.c index e4ff533e3a69..ca25044e7d1b 100644 --- a/drivers/gpu/drm/i915/display/intel_lspcon.c +++ b/drivers/gpu/drm/i915/display/intel_lspcon.c @@ -221,7 +221,8 @@ static bool lspcon_probe(struct intel_lspcon *lspcon) { int retry; enum drm_dp_dual_mode_type adaptor_type; - struct i2c_adapter *adapter = &lspcon_to_intel_dp(lspcon)->aux.ddc; + struct intel_dp *intel_dp = lspcon_to_intel_dp(lspcon); + struct i2c_adapter *adapter = &intel_dp->aux.ddc; enum drm_lspcon_mode expected_mode; expected_mode = lspcon_wake_native_aux_ch(lspcon) ? @@ -232,7 +233,7 @@ static bool lspcon_probe(struct intel_lspcon *lspcon) if (retry) usleep_range(500, 1000); - adaptor_type = drm_dp_dual_mode_detect(adapter); + adaptor_type = drm_dp_dual_mode_detect(intel_dp->aux.drm_dev, adapter); if (adaptor_type == DRM_DP_DUAL_MODE_LSPCON) break; } diff --git a/include/drm/drm_dp_dual_mode_helper.h b/include/drm/drm_dp_dual_mode_helper.h index 4c42db81fcb4..23ce849152f3 100644 --- a/include/drm/drm_dp_dual_mode_helper.h +++ b/include/drm/drm_dp_dual_mode_helper.h @@ -62,6 +62,7 @@ #define DP_DUAL_MODE_LSPCON_CURRENT_MODE 0x41 #define DP_DUAL_MODE_LSPCON_MODE_PCON 0x1 +struct drm_device; struct i2c_adapter; ssize_t drm_dp_dual_mode_read(struct i2c_adapter *adapter, @@ -103,7 +104,8 @@ enum drm_dp_dual_mode_type { DRM_DP_DUAL_MODE_LSPCON, }; -enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter); +enum drm_dp_dual_mode_type +drm_dp_dual_mode_detect(const struct drm_device *dev, struct i2c_adapter *adapter); int drm_dp_dual_mode_max_tmds_clock(enum drm_dp_dual_mode_type type, struct i2c_adapter *adapter); int drm_dp_dual_mode_get_tmds_output(enum drm_dp_dual_mode_type type, -- 2.30.2