Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp744623pxu; Fri, 4 Dec 2020 14:41:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJyKXDQ4eWqigrDUe8/lpqHgrtC1irMnWlL+8CARknuUYBWUD7OXJMNlLF8B6GykVp03Ji6n X-Received: by 2002:aa7:c058:: with SMTP id k24mr9782387edo.263.1607121686120; Fri, 04 Dec 2020 14:41:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607121686; cv=none; d=google.com; s=arc-20160816; b=H2yC4A/prL7ilxbQm+OBgeOruqfRFx5S8k9k9e9yVI45486HAuEXkVLr22WsLSSF4O n4th70jLquUpylVeGo9RO8cksCwAIfkCWRIka+1IxYjy6JVgkqZBe48rHZDi8luZjBIL 9ihB7H+32bkltwBuhF65FjXAX4C+QmunwdY+iPtnGkKoKnZqkqdvHPie8z97pDtr0RMD FOjZnHPURMrLiLnz7gJRVP3ZCsJXPXv4egP57tS8UtjJXSLtHNILIWe2TF72mzgPm5Dt 6rw0Oi7OlbNSRvhPNdYstOHO/dpwjmMQSmaf8bB7OtLbM1FtF2NGnqBJyRfXKOA6AO5U FTlg== 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=mtFGz+xr8ZTzNuIvtSs0J3PJEBaoOpZ5xtvC9fGE1tk=; b=EEoBFR1EHZ2qZzcm6g8pu3bVzAnauxpZifliPsFH5PYOH25l2mfwBQ5DRY3n4Z2OZb kWOOctsK4AJonpZfGfQ0UgkgVVqsK7qYXuN9zTaSWAUj6zK1s8RqwOxogmTDtgC6or9e GSsCJEFRX6yJ5fppuzg3EE+zq3sHJd6CnLiZSoTerEPC+Z+QPYyDSyPRr4Pc5P4jBhxa zRD6NIvSr2zdgfCZt7OeuT273PI3Tszk4zspbYH9llgvns8TJw2CixcHypnxD1IId53/ ms1oglLbF77E5vBG4m/bTXH7xvL5B6IM75TZ1zYcoxs2x6NNS2ciyQWuIivmvrXK7rs7 LNRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=humLdENt; 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 g12si3812045edl.16.2020.12.04.14.41.03; Fri, 04 Dec 2020 14:41:26 -0800 (PST) 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=humLdENt; 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 S2387793AbgLDWiZ (ORCPT + 99 others); Fri, 4 Dec 2020 17:38:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:33834 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387494AbgLDWiW (ORCPT ); Fri, 4 Dec 2020 17:38:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607121415; 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=mtFGz+xr8ZTzNuIvtSs0J3PJEBaoOpZ5xtvC9fGE1tk=; b=humLdENtmGv7wwtzFIJ2JXjirhuIdGjGilzeGgyOoIifdTX7eH2VWwsoFlVyvVSIZPGx8g ffMcG5QRc12iCv+kUvDxUvdzEfxeyU9/sDoyxmOZpfTNZBM4Ywu/ZKSTdfpOwTQ+4JVSws /uoIlPxuvJ7XyFbdoh/L0xsbQfOp5y4= 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-277-9He1obtkMzOmu_G3fd0HKg-1; Fri, 04 Dec 2020 17:36:53 -0500 X-MC-Unique: 9He1obtkMzOmu_G3fd0HKg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5E56D802B45; Fri, 4 Dec 2020 22:36:51 +0000 (UTC) Received: from Whitewolf.redhat.com (ovpn-112-159.rdu2.redhat.com [10.10.112.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0F23319635; Fri, 4 Dec 2020 22:36:49 +0000 (UTC) From: Lyude Paul To: Rodrigo Vivi , Jani Nikula , Dave Airlie , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: thaytan@noraisin.net, Vasily Khoruzhick , Joonas Lahtinen , David Airlie , Daniel Vetter , Juha-Pekka Heikkila , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Sean Paul , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v3 8/9] drm/i915/dp: Allow forcing specific interfaces through enable_dpcd_backlight Date: Fri, 4 Dec 2020 17:36:02 -0500 Message-Id: <20201204223603.249878-9-lyude@redhat.com> In-Reply-To: <20201204223603.249878-1-lyude@redhat.com> References: <20201204223603.249878-1-lyude@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since we now support controlling panel backlights through DPCD using both the standard VESA interface, and Intel's proprietary HDR backlight interface, we should allow the user to be able to explicitly choose between one or the other in the event that we're wrong about panels reliably reporting support for the Intel HDR interface. So, this commit adds support for this by introducing two new enable_dpcd_backlight options: 2 which forces i915 to only probe for the VESA interface, and 3 which forces i915 to only probe for the Intel backlight interface (might be useful if we find panels in the wild that report the VESA interface in their VBT, but actually only support the Intel backlight interface). v3: * Rebase Signed-off-by: Lyude Paul Cc: thaytan@noraisin.net Cc: Vasily Khoruzhick --- .../drm/i915/display/intel_dp_aux_backlight.c | 45 +++++++++++++++++-- drivers/gpu/drm/i915/i915_params.c | 2 +- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c index 9a3ff3ffc158..eef14ab6bddc 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c @@ -609,15 +609,54 @@ static const struct intel_panel_bl_funcs intel_dp_vesa_bl_funcs = { .get = intel_dp_aux_vesa_get_backlight, }; +enum intel_dp_aux_backlight_modparam { + INTEL_DP_AUX_BACKLIGHT_AUTO = -1, + INTEL_DP_AUX_BACKLIGHT_OFF = 0, + INTEL_DP_AUX_BACKLIGHT_ON = 1, + INTEL_DP_AUX_BACKLIGHT_FORCE_VESA = 2, + INTEL_DP_AUX_BACKLIGHT_FORCE_INTEL = 3, +}; + int intel_dp_aux_init_backlight_funcs(struct intel_connector *connector) { struct drm_device *dev = connector->base.dev; struct intel_panel *panel = &connector->panel; struct intel_dp *intel_dp = enc_to_intel_dp(connector->encoder); struct drm_i915_private *i915 = dp_to_i915(intel_dp); + bool try_intel_interface = false, try_vesa_interface = false; - if (i915->params.enable_dpcd_backlight == 0) + /* Check the VBT and user's module parameters to figure out which + * interfaces to probe + */ + switch (i915->params.enable_dpcd_backlight) { + case INTEL_DP_AUX_BACKLIGHT_OFF: return -ENODEV; + case INTEL_DP_AUX_BACKLIGHT_AUTO: + switch (i915->vbt.backlight.type) { + case INTEL_BACKLIGHT_VESA_EDP_AUX_INTERFACE: + try_vesa_interface = true; + break; + case INTEL_BACKLIGHT_DISPLAY_DDI: + try_intel_interface = true; + try_vesa_interface = true; + break; + default: + return -ENODEV; + } + break; + case INTEL_DP_AUX_BACKLIGHT_ON: + if (i915->vbt.backlight.type != INTEL_BACKLIGHT_VESA_EDP_AUX_INTERFACE) + try_intel_interface = true; + + try_vesa_interface = true; + break; + case INTEL_DP_AUX_BACKLIGHT_FORCE_VESA: + try_vesa_interface = true; + break; + case INTEL_DP_AUX_BACKLIGHT_FORCE_INTEL: + try_intel_interface = true; + break; + } /* * A lot of eDP panels in the wild will report supporting both the @@ -626,13 +665,13 @@ int intel_dp_aux_init_backlight_funcs(struct intel_connector *connector) * and will only work with the Intel interface. So, always probe for * that first. */ - if (intel_dp_aux_supports_hdr_backlight(connector)) { + if (try_intel_interface && intel_dp_aux_supports_hdr_backlight(connector)) { drm_dbg(dev, "Using Intel proprietary eDP backlight controls\n"); panel->backlight.funcs = &intel_dp_hdr_bl_funcs; return 0; } - if (intel_dp_aux_supports_vesa_backlight(connector)) { + if (try_vesa_interface && intel_dp_aux_supports_vesa_backlight(connector)) { drm_dbg(dev, "Using VESA eDP backlight controls\n"); panel->backlight.funcs = &intel_dp_vesa_bl_funcs; return 0; diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c index 7f139ea4a90b..6939634e56ed 100644 --- a/drivers/gpu/drm/i915/i915_params.c +++ b/drivers/gpu/drm/i915/i915_params.c @@ -185,7 +185,7 @@ i915_param_named_unsafe(inject_probe_failure, uint, 0400, i915_param_named(enable_dpcd_backlight, int, 0400, "Enable support for DPCD backlight control" - "(-1=use per-VBT LFP backlight type setting [default], 0=disabled, 1=enabled)"); + "(-1=use per-VBT LFP backlight type setting [default], 0=disabled, 1=enable, 2=force VESA interface, 3=force Intel interface)"); #if IS_ENABLED(CONFIG_DRM_I915_GVT) i915_param_named(enable_gvt, bool, 0400, -- 2.28.0