From patchwork Thu Dec 5 09:33:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajat Jain X-Patchwork-Id: 11275737 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 2626E138D for ; Fri, 6 Dec 2019 08:17:44 +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 0E1D12467A for ; Fri, 6 Dec 2019 08:17:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0E1D12467A Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 47BBE6EABB; Fri, 6 Dec 2019 08:17:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x64a.google.com (mail-pl1-x64a.google.com [IPv6:2607:f8b0:4864:20::64a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 839196F629 for ; Thu, 5 Dec 2019 09:33:57 +0000 (UTC) Received: by mail-pl1-x64a.google.com with SMTP id b8so1300226plz.12 for ; Thu, 05 Dec 2019 01:33:57 -0800 (PST) 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=wp5Hqa04NiNpVI0Gi6ri3k2VouPX1J685cmLNBWDRLo=; b=b6eb9+PjVM1dYqf8/Qg49YVtTNx4ubXbETdFvdSDlYDxDaqPzyJOPLyHmj3CY51CmY mmsNTvVH8w9VkV0mP1cyHyOggzUaQeD2R4cfujaSuuNinUyioMWX0NgqKPsBijoRl37A mHVhuieKUAj/F8eLQPkUPu9b7socmhSw1rCvpzb095UTnr4V32J7Q4t8NFCkbxohHW8C W6Ny+sGsjk+FCrngr5HWlXua634Rv3YrUHuWFRilvLJw621nc//ifztBwSBfBSo2JAvF 9o1f+LIBxEtiMy52LBDhaxahv77icH1ONhYSRZkdZvz7LVEMFhVLWpuepw47M41B6bUO 6aSg== X-Gm-Message-State: APjAAAVCMf+/SiuPWLIIj24dlxjcFJ/Fn9ModcIWxfFHqYUCOam/EhnF FQE83CifOWNLsiWEUmEW9zmr+Rr9icoV X-Google-Smtp-Source: APXvYqwlYdEIBF3g7q7/xxN3WN159P3fvUwGUy0fSQIQoqsbJJBIW+2ZQA7X0c0kSvUit1djFIItsxG5KNoj X-Received: by 2002:a63:ca05:: with SMTP id n5mr192737pgi.187.1575538436938; Thu, 05 Dec 2019 01:33:56 -0800 (PST) Date: Thu, 5 Dec 2019 01:33:45 -0800 In-Reply-To: <20191205093346.57930-1-rajatja@google.com> Message-Id: <20191205093346.57930-2-rajatja@google.com> Mime-Version: 1.0 References: <20191205093346.57930-1-rajatja@google.com> X-Mailer: git-send-email 2.24.0.393.g34dc348eaf-goog Subject: [PATCH v3 2/3] drm/i915: Lookup and attach ACPI device node for connectors 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: Fri, 06 Dec 2019 08:17:34 +0000 X-Mailman-Original-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=wp5Hqa04NiNpVI0Gi6ri3k2VouPX1J685cmLNBWDRLo=; b=DQMNELuqmxLXYUixlbuKvLG4C4Sxqh8YxfPQbtdPxoRO1tQljGrp/be1l164DOyG3e ZricFE9u2NZ8nr3SsTExMQa73HaBxNCzjtd9Ipq1HPAVfPvNnaPFkIHYmEQDYKgdyRAV C5jGZyvbt4npWdQNoMydwEgPmFW5I1ZDonGvDDq7WuThZTd/VNoz3vIUhmWbt2+baaRd AGEZlRhg9P1k0PTa3zzAMxI5NgHGqo9JHhRJmEKLf8DYdmZx02v+wJLrwnxCci6qM33U V9J11CSnefdZh0QPkWMWFgx0CiNYNs1u8nFYY4qA7h3LRA6D/wa5tgWgGMGZY1v9kFZD ZSmQ== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rajat Jain , rajatxjain@gmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- 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 c61ac0c3acb5..6b209193cbbb 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" @@ -6628,6 +6629,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); } }