Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2848649pxb; Mon, 19 Apr 2021 15:59:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDpEc0Jj7weC8RA1KzyJARz1ip3PpAJacHWfN/spgtLlAagrwY/qW/HkMzYzeVZskDUwVC X-Received: by 2002:a05:6402:1ec:: with SMTP id i12mr15726276edy.374.1618873163917; Mon, 19 Apr 2021 15:59:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618873163; cv=none; d=google.com; s=arc-20160816; b=zrjndEn2FrJFKZQ+dCTYdu+YJRNAKMZTvOTWstHtDN5xqqQ15AHotHfKhNedg1vFgN hEtBd69xPY+CalqWmadjNRNI3sKAU1XW6ST3U1LwCXkmmuckmCpb/Xja/QT3bU6KpVLE bn0xLUyA/QqvunFkvND7ts+N0Iq8/5+wuPqAFM1RfCD3a+jmR9j2PdEjaUqOpTY2xzMb E65q+MnI9R0zBDi4JNsdgv5Uc6WrqO8KQVBoZG6xQj2y13jJBIPqkBZKw4Bw40SOcOtP PAs/wUSRTQ+1TYh9zrvjji/U+36ubwgB9+8R5SVGqHEE46cd0vx7CgL67Xz1ay7aIRzz 7/jw== 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=ePeisqWsuNFllavRJjNrQv2tVzi7Qgd6HQ1B2WCGdpqjSz+MQ9g0Lm17D1byipwiJo vchHopjmEzUu/v4Xyksz0ZY9hAid3jy2Qht8blH/baL72eSl80ns1i5voJubjSIaIhci bUkLFWzgmV2VRgLiyxCDQGzml43MULxWjaBIGU0ySyx3BDUsk5up+bWTiEP8oeOycxPq zjf0TCc7QqNONxMCIDyzKN8xRAUXI3UHITDZVARy18dI4rfJtx1/RSYpoibh3jqFK7F6 jIWJrWcV1bZRue0nB/sWA82JsbOnQKKEHgX7xeGBCSpgui4jypaUyUYJ1ybUhFa7ftPj gQvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hvBO2I62; 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 a4si2179780edq.154.2021.04.19.15.59.01; Mon, 19 Apr 2021 15:59:23 -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=hvBO2I62; 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 S232431AbhDSW6O (ORCPT + 99 others); Mon, 19 Apr 2021 18:58:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:49975 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231138AbhDSW6B (ORCPT ); Mon, 19 Apr 2021 18:58:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618873049; 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=hvBO2I62cwOkV0y3VqvyuPwF7Ln4nhNHpFogbTSMS0TykKNs83Naa0xT8xkInNDWoZqsV2 mLwSvgXTrsttivFXMG8Y8L3zmEgGEgOORqt1ONlECgCT6N1XBIEcTmmIFyvpdE9xxT0sLh dctzklPIUXZPb3w59hhptvU1NhSqvrE= 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-139-aDW2ZjRBMJ2VkLAmIowUMg-1; Mon, 19 Apr 2021 18:57:25 -0400 X-MC-Unique: aDW2ZjRBMJ2VkLAmIowUMg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 93502107ACCD; Mon, 19 Apr 2021 22:57:22 +0000 (UTC) Received: from Ruby.lyude.net (ovpn-119-153.rdu2.redhat.com [10.10.119.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id 959385C1C4; Mon, 19 Apr 2021 22:57:19 +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 , Ankit Nautiyal , Lucas De Marchi , Vipin Anand , Chris Wilson , Gwan-gyeong Mun , Kai-Heng Feng , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v3 11/20] drm/dp_dual_mode: Pass drm_device to drm_dp_dual_mode_detect() Date: Mon, 19 Apr 2021 18:55:13 -0400 Message-Id: <20210419225523.184856-12-lyude@redhat.com> In-Reply-To: <20210419225523.184856-1-lyude@redhat.com> References: <20210419225523.184856-1-lyude@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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