From patchwork Tue Dec 17 20:08:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajat Jain X-Patchwork-Id: 11301865 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 BF7FE1580 for ; Wed, 18 Dec 2019 20:21:38 +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 9DC8D21582 for ; Wed, 18 Dec 2019 20:21:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="sNt7r1l5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9DC8D21582 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.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 C03516EA76; Wed, 18 Dec 2019 20:21:37 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pf1-x44a.google.com (mail-pf1-x44a.google.com [IPv6:2607:f8b0:4864:20::44a]) by gabe.freedesktop.org (Postfix) with ESMTPS id AF77D6E117 for ; Tue, 17 Dec 2019 20:08:37 +0000 (UTC) Received: by mail-pf1-x44a.google.com with SMTP id r127so1119703pfc.11 for ; Tue, 17 Dec 2019 12:08:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=/Qw4GD/L/BHUnMfNxnXbv2iuA578RGnnJhQc59pGIoc=; b=sNt7r1l54qCXMwcU/JndJHedUHyn/DbHJ4OiXxqK//EZcA+w2Uow0BPlrICVDVsY0A wtweXoHeXsAAhIvbTIP29lhcyqeVUbfgkJkASX+XqhvnMCZFUBv7/C68uXyCtV/F+Mbn v+uBjug5qpANmU+3g2eyH425b8EU2rvLFiUmkLb1kFtDA5iS3yxcO4qtn9HTYeG/O3bN BZj8GAzrtLfafLuFC3DvyVDi+x+bRUpRvAiXZOdKmWN846JLu0g6HxwQuzAgOlVsMHuh dS2tb0/ULilEsMttVeJv/CMipZwA08fZlngrl1Em5FMl0ysDS7x5raqFm5nbQk79CCfe 3OOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=/Qw4GD/L/BHUnMfNxnXbv2iuA578RGnnJhQc59pGIoc=; b=GD1+sjBCPCWgWOpkb2xs6ZgsIxggyR3AEdqvRC+i/O3RGL5acGmOVUPrTv5StoGSrr KX2avpA+8mbLe/ZQjTT20SpgKXG6vb0Al/i8W/+wurD8H9V/XBr3My5MbUxpJjwcdqVO oblB0CXr4lc24m2GetMUQXTuwreQCjt1GRcpadkpwxg+TtYf3M7Px4SdpSo6rsDxnXr5 0MhKgB/cKWL+VraP8vSh+tJdtPv5YaDialil50KmCYizCLJm5tKZW92sM3g3Cibg9Pjp VDAJNzFHwdmReaJqa+haIe092nJq3HOx6O0sb1Jelfw8wD84IPV9oyqzWIaHjZXM0inK WwLw== X-Gm-Message-State: APjAAAWoBxEZm0/KTPIQKVhLP7370phiLWY1Gn4i3/WBNlJhqSXqwCOg A3kNnX8Dv4wph1ZLZ+CNB1Ao29ASbkdJ X-Google-Smtp-Source: APXvYqwjvZMH70noVOzNSK6DTz7LvPJVJ2Thym9CDAU+9EfavMdifR8PT/wOePLfhotp0U5XGFp1fNeF15In X-Received: by 2002:a63:bc01:: with SMTP id q1mr28463259pge.442.1576613316975; Tue, 17 Dec 2019 12:08:36 -0800 (PST) Date: Tue, 17 Dec 2019 12:08:28 -0800 In-Reply-To: <20191217200829.120993-1-rajatja@google.com> Message-Id: <20191217200829.120993-2-rajatja@google.com> Mime-Version: 1.0 References: <20191217200829.120993-1-rajatja@google.com> X-Mailer: git-send-email 2.24.1.735.g03f4e72817-goog From: Rajat Jain To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , " =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= " , Chris Wilson , Imre Deak , " =?utf-8?q?Jos=C3=A9_Roberto_de_Souza?= " , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, gregkh@linuxfoundation.org, mathewk@google.com, Daniel Thompson , Jonathan Corbet , Pavel Machek , seanpaul@google.com, Duncan Laurie , jsbarnes@google.com, Thierry Reding X-Mailman-Approved-At: Wed, 18 Dec 2019 20:21:34 +0000 Subject: [Intel-gfx] [PATCH v4 2/3] drm/i915: Lookup and attach ACPI device node for connectors 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: rajatxjain@gmail.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Lookup and attach ACPI nodes for intel connectors. The lookup is done in compliance with ACPI Spec 6.3 https://uefi.org/sites/default/files/resources/ACPI_6_3_final_Jan30.pdf (Ref: Pages 1119 - 1123). This can be useful for any connector specific platform properties. (This will be used for privacy screen in next patch). Signed-off-by: Rajat Jain --- v4: Same as v3 v3: fold the code into existing acpi_device_id_update() function v2: formed by splitting the original patch into ACPI lookup, and privacy screen property. Also move it into i915 now that I found existing code in i915 that can be re-used. drivers/gpu/drm/i915/display/intel_acpi.c | 24 +++++++++++++++++++ .../drm/i915/display/intel_display_types.h | 3 +++ drivers/gpu/drm/i915/display/intel_dp.c | 3 +++ 3 files changed, 30 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_acpi.c b/drivers/gpu/drm/i915/display/intel_acpi.c index e21fb14d5e07..101a56c08996 100644 --- a/drivers/gpu/drm/i915/display/intel_acpi.c +++ b/drivers/gpu/drm/i915/display/intel_acpi.c @@ -222,11 +222,23 @@ static u32 acpi_display_type(struct intel_connector *connector) return display_type; } +/* + * Ref: ACPI Spec 6.3 + * https://uefi.org/sites/default/files/resources/ACPI_6_3_final_Jan30.pdf + * Pages 1119 - 1123 describe, what I believe, a standard way of + * identifying / addressing "display panels" in the ACPI. It provides + * a way for the ACPI to define devices for the display panels attached + * to the system. It thus provides a way for the BIOS to export any panel + * specific properties to the system via ACPI (like device trees). + */ void intel_acpi_device_id_update(struct drm_i915_private *dev_priv) { struct drm_device *drm_dev = &dev_priv->drm; struct intel_connector *connector; struct drm_connector_list_iter conn_iter; + struct device *dev = &drm_dev->pdev->dev; + struct acpi_device *conn_dev; + u64 conn_addr; u8 display_index[16] = {}; /* Populate the ACPI IDs for all connectors for a given drm_device */ @@ -242,6 +254,18 @@ void intel_acpi_device_id_update(struct drm_i915_private *dev_priv) device_id |= display_index[type]++ << ACPI_DISPLAY_INDEX_SHIFT; connector->acpi_device_id = device_id; + + /* Build the _ADR to look for */ + conn_addr = device_id | ACPI_DEVICE_ID_SCHEME | + ACPI_BIOS_CAN_DETECT; + + DRM_DEV_INFO(dev, "Checking connector ACPI node at _ADR=%llX\n", + conn_addr); + + /* Look up the connector device, under the PCI device */ + conn_dev = acpi_find_child_device(ACPI_COMPANION(dev), + conn_addr, false); + connector->acpi_handle = conn_dev ? conn_dev->handle : NULL; } drm_connector_list_iter_end(&conn_iter); } diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h index 1a7334dbe802..0a4a04116091 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -407,6 +407,9 @@ struct intel_connector { /* ACPI device id for ACPI and driver cooperation */ u32 acpi_device_id; + /* ACPI handle corresponding to this connector display, if found */ + void *acpi_handle; + /* Reads out the current hw, returning true if the connector is enabled * and active (i.e. dpms ON state). */ bool (*get_hw_state)(struct intel_connector *); diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index b05b2191b919..93cece8e2516 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -45,6 +45,7 @@ #include "i915_debugfs.h" #include "i915_drv.h" #include "i915_trace.h" +#include "intel_acpi.h" #include "intel_atomic.h" #include "intel_audio.h" #include "intel_connector.h" @@ -6623,6 +6624,8 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect connector->state->scaling_mode = DRM_MODE_SCALE_ASPECT; + /* Lookup the ACPI node corresponding to the connector */ + intel_acpi_device_id_update(dev_priv); } }