From patchwork Thu Mar 12 00:57:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajat Jain X-Patchwork-Id: 11433089 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 A536790 for ; Thu, 12 Mar 2020 00:57:34 +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 4D88E2072F for ; Thu, 12 Mar 2020 00:57:34 +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="bT1CrWbV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4D88E2072F 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 034A96E9F2; Thu, 12 Mar 2020 00:57:33 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-vk1-xa4a.google.com (mail-vk1-xa4a.google.com [IPv6:2607:f8b0:4864:20::a4a]) by gabe.freedesktop.org (Postfix) with ESMTPS id BFD556E9DE for ; Thu, 12 Mar 2020 00:57:31 +0000 (UTC) Received: by mail-vk1-xa4a.google.com with SMTP id b136so1671992vkf.20 for ; Wed, 11 Mar 2020 17:57:31 -0700 (PDT) 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=zfQL1NufXJXKszWu72jE1H3reXD9X3Cw+0IUbEiABbs=; b=bT1CrWbV4OeJpGXX03s+OUjA04G+CjGZX2Tf3a3Uc+hxyENfPUI+C5i/B3FF5a9Cwc KUXD8rZSh+N82h8RwgutzToHhe2EW0u3Cl24Fy4uDwxSGZn5xQ1ffJ7Wf83wi1GHWAQk Wrseo8utA4nuxC0luM2akfn665xHAB9f10uuUc9f7Mzsi0Hc+vT8w8fp1ecaKUJBCDae ZgyNCq8WxyiiD8e/bmHFSWLCmqyUhdJRXe6xAvu5mxI2vSCcPQDZ7aUevFVjhRvBdStg 1tGQSxOewrQmYz+mdiT4w5beVHsK3h1XiLqXRCXLA4T1xx0UU0wYqzjL/BUx3oudUkWz bQNw== 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=zfQL1NufXJXKszWu72jE1H3reXD9X3Cw+0IUbEiABbs=; b=YdSRQOhzKo5iW9bI5pCesckBYMMlaCRGqbkjV0rpn19eFKSwvdkK6mMaxjQglFOsPD p5nDTU+3hXQnhz5GVZfac5fP77+VFLOQtD1p56pAntSkEtSPmprDYRA+SP77YASOf5M6 EK40DWE1IrnuOqnV5BLdzGiO0KmTkoL2Q5xOBM5gwoe7+nqKeHBSml3eNBXBIREEEcPe pH/H7lfyFZRKZjpP38s8gJp3zg3nNNiFiqhah9P0VABP5N8WkxYpi8nST3w90sIwwZf3 yvSiZ2TLqZJPjOVASND1e575ra4zniexty3Sx+sJ8CbFVssViqJuojcG5nzN/EJ9A19x apuA== X-Gm-Message-State: ANhLgQ2uoUnM9VAmBKRe13mA2wb4NgXprNtjITCPaye1urGk4mPZmYFr n52PSSjreWmEYYzBtMbT4Hjr4sHVPdw4 X-Google-Smtp-Source: ADFU+vudXPpltJWf5kCHaXEyXnesLFR5gJzoEWgqDEP7sXpXeSYgwHh/qrrl5VAWvaMLl86pkFonQ4bkM/3U X-Received: by 2002:a67:7dd0:: with SMTP id y199mr3632675vsc.158.1583974650664; Wed, 11 Mar 2020 17:57:30 -0700 (PDT) Date: Wed, 11 Mar 2020 17:57:18 -0700 In-Reply-To: <20200312005722.48803-1-rajatja@google.com> Message-Id: <20200312005722.48803-2-rajatja@google.com> Mime-Version: 1.0 References: <20200312005722.48803-1-rajatja@google.com> X-Mailer: git-send-email 2.25.1.481.gfbce0eb801-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 , mpearson@lenovo.com, Nitin Joshi1 , Sugumaran Lacshiminarayanan , Tomoki Maruichi Subject: [Intel-gfx] [PATCH v8 1/5] intel_acpi: Rename drm_dev local variable to dev 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: Jani Nikula , rajatxjain@gmail.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Change the struct drm_device * local variable from drm_dev to dev per the feedback received here: https://lkml.org/lkml/2020/1/24/1143 Signed-off-by: Rajat Jain Reviewed-by: Jani Nikula --- v8: same as v7 v7: same as v6 v6: Initial patch (v6 to match other patches in the set) drivers/gpu/drm/i915/display/intel_acpi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_acpi.c b/drivers/gpu/drm/i915/display/intel_acpi.c index e21fb14d5e07b..3e6831cca4ac1 100644 --- a/drivers/gpu/drm/i915/display/intel_acpi.c +++ b/drivers/gpu/drm/i915/display/intel_acpi.c @@ -224,13 +224,13 @@ static u32 acpi_display_type(struct intel_connector *connector) void intel_acpi_device_id_update(struct drm_i915_private *dev_priv) { - struct drm_device *drm_dev = &dev_priv->drm; + struct drm_device *dev = &dev_priv->drm; struct intel_connector *connector; struct drm_connector_list_iter conn_iter; u8 display_index[16] = {}; /* Populate the ACPI IDs for all connectors for a given drm_device */ - drm_connector_list_iter_begin(drm_dev, &conn_iter); + drm_connector_list_iter_begin(dev, &conn_iter); for_each_intel_connector_iter(connector, &conn_iter) { u32 device_id, type; From patchwork Thu Mar 12 00:57:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajat Jain X-Patchwork-Id: 11433091 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 C530D139A for ; Thu, 12 Mar 2020 00:57:36 +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 6DD2D2071B for ; Thu, 12 Mar 2020 00:57:36 +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="SV/fFcT2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6DD2D2071B 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 8725A6E9FE; Thu, 12 Mar 2020 00:57:35 +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 87A4C6E9FF for ; Thu, 12 Mar 2020 00:57:33 +0000 (UTC) Received: by mail-pf1-x44a.google.com with SMTP id i127so2621957pfb.9 for ; Wed, 11 Mar 2020 17:57:33 -0700 (PDT) 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=/y2DfBHFZLeDghC1UZR41SBlZKupXvp616ynoTxZM98=; b=SV/fFcT2tloK2zMo+2k9wlKlbaMrmAFNisfw9kLxe9ZoA4Np+tDrDDzkSKkjHMvvij Uv9PsRDuhz8AG/bOwby+Lh541GkOm/VshGZocjUlvgFEDNtYSK5OO9U0TEjyq7dCgxgU eGFLF0GIL6vAY+LFh9gHqUrGN6/jmxNhqfsI1AZRy8RZOswfhWLQkZcAl1EQpJA9p62X /x8N7qnmob6AsbtpexGvUh4Qt0z80SxMTzs/6FnVrivoXdS2RNxV1nsFOZjkfIUaDIJ+ bMPeVi9VDiH5OwJG4oOI5zYCFah7NMp6weJwhC9ji200LWQzC8QGI2Ab8qGVTeaoe7cq 8jqg== 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=/y2DfBHFZLeDghC1UZR41SBlZKupXvp616ynoTxZM98=; b=C1XAce68so1K0x+yycaBcivRXW5yYSKLKvZsqliqTg24qsax70OLvSfFSthfgAMZtV CbRJufXrV8theqO8tBaBOOMXpoM5QYEzSNAFr/xwXLiKQgq/2GTaoWiEekc6Lzxv9F8L Y8S21Zd8Y3KOKMWa7Ng5zswmrpkClwe15NOi0yb/QcjhxzKN5Ari8NsUBXCT0bFR5vsl ByEcQXNfF1RQg3/fQ+m4eAat5Qn/liLEV6pfg52+kEji2+BpdZZquhLmmIRicE8zbjS7 I3SVPlYCSeiVbmOeVbLHvxnnBZcZwmHYD2qx1vwT+5oY3jsfM+SN0Ckw8eJ7T6Zk2db3 3PfQ== X-Gm-Message-State: ANhLgQ28fhR0sqHsRZaR7jcvN+DqO0hh75PmbSmzlW0MxS6n1j9cQSEj 7O/dKM+iPDswZ9n8bK1i38vovz5lRhRV X-Google-Smtp-Source: ADFU+vshLizOflftnOWAs5W4UTktoOcTU0+c29PIy5C8WM7kPuxnrhF5DwPYwb2WnQXzrBKA5lGcUBJQZ1ZW X-Received: by 2002:a17:90a:a893:: with SMTP id h19mr1486955pjq.30.1583974653042; Wed, 11 Mar 2020 17:57:33 -0700 (PDT) Date: Wed, 11 Mar 2020 17:57:19 -0700 In-Reply-To: <20200312005722.48803-1-rajatja@google.com> Message-Id: <20200312005722.48803-3-rajatja@google.com> Mime-Version: 1.0 References: <20200312005722.48803-1-rajatja@google.com> X-Mailer: git-send-email 2.25.1.481.gfbce0eb801-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 , mpearson@lenovo.com, Nitin Joshi1 , Sugumaran Lacshiminarayanan , Tomoki Maruichi Subject: [Intel-gfx] [PATCH v8 2/5] drm/connector: Add support for privacy-screen property 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" Add support for generic electronic privacy screen property, that can be added by systems that have an integrated EPS. Signed-off-by: Rajat Jain --- v8: Remove the ...destroy_privacy_screen() method and let the property be destroyed along with others at the time of device destruction. (because drm core doesn't also like properties destroyed in late_register()). v7: * Initial version, formed by moving the privacy-screen property into drm core. * Break the init_property() into create_property() and attach_property() so that property can be created while registering connector, but attached in late_register() (after ACPI node detection). drivers/gpu/drm/drm_atomic_uapi.c | 4 +++ drivers/gpu/drm/drm_connector.c | 51 +++++++++++++++++++++++++++++++ include/drm/drm_connector.h | 24 +++++++++++++++ 3 files changed, 79 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c index a1e5e262bae2d..843a8cdacd149 100644 --- a/drivers/gpu/drm/drm_atomic_uapi.c +++ b/drivers/gpu/drm/drm_atomic_uapi.c @@ -766,6 +766,8 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector, fence_ptr); } else if (property == connector->max_bpc_property) { state->max_requested_bpc = val; + } else if (property == connector->privacy_screen_property) { + state->privacy_screen_status = val; } else if (connector->funcs->atomic_set_property) { return connector->funcs->atomic_set_property(connector, state, property, val); @@ -842,6 +844,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector, *val = 0; } else if (property == connector->max_bpc_property) { *val = state->max_requested_bpc; + } else if (property == connector->privacy_screen_property) { + *val = state->privacy_screen_status; } else if (connector->funcs->atomic_get_property) { return connector->funcs->atomic_get_property(connector, state, property, val); diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index f632ca05960e7..9a127f67fc59b 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -1171,6 +1171,10 @@ static const struct drm_prop_enum_list dp_colorspaces[] = { * can also expose this property to external outputs, in which case they * must support "None", which should be the default (since external screens * have a built-in scaler). + * + * privacy-screen: + * This optional property can be used to enable / disable an integrated + * electronic privacy screen that is available on some displays. */ int drm_connector_create_standard_properties(struct drm_device *dev) @@ -2137,6 +2141,53 @@ int drm_connector_set_panel_orientation_with_quirk( } EXPORT_SYMBOL(drm_connector_set_panel_orientation_with_quirk); +static const struct drm_prop_enum_list privacy_screen_enum[] = { + { PRIVACY_SCREEN_DISABLED, "Disabled" }, + { PRIVACY_SCREEN_ENABLED, "Enabled" }, +}; + +/** + * drm_connector_create_privacy_screen_property - + * create the drm connecter's privacy-screen property. + * @connector: connector for which to create the privacy-screen property + * + * This function creates the "privacy-screen" property for the + * connector. It is not attached. + */ +void +drm_connector_create_privacy_screen_property(struct drm_connector *connector) +{ + if (connector->privacy_screen_property) + return; + + connector->privacy_screen_property = + drm_property_create_enum(connector->dev, DRM_MODE_PROP_ENUM, + "privacy-screen", privacy_screen_enum, + ARRAY_SIZE(privacy_screen_enum)); +} +EXPORT_SYMBOL(drm_connector_create_privacy_screen_property); + +/** + * drm_connector_attach_privacy_screen_property - + * attach the drm connecter's privacy-screen property. + * @connector: connector on which to attach the privacy-screen property + * + * This function attaches the "privacy-screen" property to the + * connector. Initial state of privacy-screen is set to disabled. + */ +void +drm_connector_attach_privacy_screen_property(struct drm_connector *connector) +{ + struct drm_property *prop = connector->privacy_screen_property; + + if (!prop) + return; + + drm_object_attach_property(&connector->base, prop, + PRIVACY_SCREEN_DISABLED); +} +EXPORT_SYMBOL(drm_connector_attach_privacy_screen_property); + int drm_connector_set_obj_prop(struct drm_mode_object *obj, struct drm_property *property, uint64_t value) diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 2113500b4075d..f1a42987c5693 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -254,6 +254,20 @@ enum drm_panel_orientation { DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, }; +/** + * enum drm_privacy_screen_status - privacy screen status + * + * This enum is used to track and control the state of the integrated privacy + * screen present on some display panels, via the "privacy-screen" property. + * + * @PRIVACY_SCREEN_DISABLED: The privacy-screen on the panel is disabled + * @PRIVACY_SCREEN_ENABLED: The privacy-screen on the panel is enabled + **/ +enum drm_privacy_screen_status { + PRIVACY_SCREEN_DISABLED = 0, + PRIVACY_SCREEN_ENABLED = 1, +}; + /* * This is a consolidated colorimetry list supported by HDMI and * DP protocol standard. The respective connectors will register @@ -656,6 +670,8 @@ struct drm_connector_state { */ u8 max_bpc; + enum drm_privacy_screen_status privacy_screen_status; + /** * @hdr_output_metadata: * DRM blob property for HDR output metadata @@ -1255,6 +1271,12 @@ struct drm_connector { */ struct drm_property *max_bpc_property; + /** + * @privacy_screen_property: Optional property for the connector to + * control the integrated privacy screen, if available. + */ + struct drm_property *privacy_screen_property; + #define DRM_CONNECTOR_POLL_HPD (1 << 0) #define DRM_CONNECTOR_POLL_CONNECT (1 << 1) #define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2) @@ -1561,6 +1583,8 @@ int drm_connector_set_panel_orientation_with_quirk( int width, int height); int drm_connector_attach_max_bpc_property(struct drm_connector *connector, int min, int max); +void drm_connector_create_privacy_screen_property(struct drm_connector *conn); +void drm_connector_attach_privacy_screen_property(struct drm_connector *conn); /** * struct drm_tile_group - Tile group metadata From patchwork Thu Mar 12 00:57:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajat Jain X-Patchwork-Id: 11433093 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 B4E28139A for ; Thu, 12 Mar 2020 00:57: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 5CD15206F7 for ; Thu, 12 Mar 2020 00:57: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="kld42q1U" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5CD15206F7 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 8772F6EA01; Thu, 12 Mar 2020 00:57:37 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pf1-x449.google.com (mail-pf1-x449.google.com [IPv6:2607:f8b0:4864:20::449]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0A3CF6EA03 for ; Thu, 12 Mar 2020 00:57:36 +0000 (UTC) Received: by mail-pf1-x449.google.com with SMTP id x25so2612925pfq.18 for ; Wed, 11 Mar 2020 17:57:36 -0700 (PDT) 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=qcAbkvR7kU9GB1azrgjvmFCJa8d2ObkOS72LyCjQKeM=; b=kld42q1U0KGeRzqOZmRraNv1+UX7d+mQxkgHJPWyahGGbF1o+gobLTW7aoJiccLH6N L/MYAV3kva8BWYWtsBMMLAVPdGIHHinyShlDsoTLYyQGqGHDKfDyn9w4ItBqj+ChJmCw q9WQxbrfpeCrY4yCYgpA89eWSMw40MIrDTKZ0Qr8O+gBklH6yoIeOSAeDyGucZVtB/AS zhE1LpYJWRkOC/w4KAxl/d3CrdNR/TVBVhTT21IB26b2bPqULyxGNgccUAjNKPmiTnHi 4wFNa6hVUpgHObyb8WMn5dZ81qyqQ/KxZFSuXKaVYjZccKg8nrxT3ckfld4vk2HSU3Yf jaJA== 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=qcAbkvR7kU9GB1azrgjvmFCJa8d2ObkOS72LyCjQKeM=; b=c7iciapCRVFywUJIEBoydJnPLwBToWVkhqm9eN83jAZRYaRJU+gIL4qUS4sPE6GGSk 2FDd3MNipswKTA5Fzyy4dC6KF6oqmj7bxnC9UmpApj4M4qWOmH+WwzCq/R743QZFd8fh qllVpuXFvMVeaZM5cTr40P+b61dHuEq/lN0CVVJZMqyCniFU4TwkEYvWlhUfxFpEPTiV xfvctE29B9d5wk17oBKn+CvyLVCCbfjcjE/hRShdvP1elqdcllS71PtmTYUYrNzKB9e/ OoGqyAOzwz1yB3J/rVg/c1/zW7ucuwlHtryagn45nyB2c2tIVw3xzhiMKM1J1DGSrB/S FO/A== X-Gm-Message-State: ANhLgQ1KyfHBi4qA0uugP69CkorloThBNtdPg2RI1HNiBWXuklv7XHk1 5sT3Z3E/s/Fz3sb+QxgE5BinfaQiKtl9 X-Google-Smtp-Source: ADFU+vu1Xs54tHs0E7QPhfTcOhZHWqyiAbMJr5sRKMFDtIKtzeMAufemiv/Tazb0GPl3kNKKokeoTjqugE3a X-Received: by 2002:a17:90a:2a89:: with SMTP id j9mr1400770pjd.64.1583974655490; Wed, 11 Mar 2020 17:57:35 -0700 (PDT) Date: Wed, 11 Mar 2020 17:57:20 -0700 In-Reply-To: <20200312005722.48803-1-rajatja@google.com> Message-Id: <20200312005722.48803-4-rajatja@google.com> Mime-Version: 1.0 References: <20200312005722.48803-1-rajatja@google.com> X-Mailer: git-send-email 2.25.1.481.gfbce0eb801-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 , mpearson@lenovo.com, Nitin Joshi1 , Sugumaran Lacshiminarayanan , Tomoki Maruichi Subject: [Intel-gfx] [PATCH v8 3/5] 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 --- v8: Also print the connector name in debug message. v7: Look for ACPI node in ->late_register() hook. Do the scan only once per drm_device (instead of 1 per drm_connector) v6: Addressed minor comments from Jani at https://lkml.org/lkml/2020/1/24/1143 - local variable renamed. - used drm_dbg_kms() - used acpi_device_handle() - Used opaque type acpi_handle instead of void* v5: same as v4 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 | 26 +++++++++++++++++++ .../drm/i915/display/intel_display_types.h | 5 ++++ drivers/gpu/drm/i915/display/intel_dp.c | 14 ++++++++++ drivers/gpu/drm/i915/i915_drv.h | 2 ++ 4 files changed, 47 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_acpi.c b/drivers/gpu/drm/i915/display/intel_acpi.c index 3e6831cca4ac1..c203fdd7fda8d 100644 --- a/drivers/gpu/drm/i915/display/intel_acpi.c +++ b/drivers/gpu/drm/i915/display/intel_acpi.c @@ -222,13 +222,26 @@ 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 *dev = &dev_priv->drm; struct intel_connector *connector; struct drm_connector_list_iter conn_iter; + struct acpi_device *conn_dev, *parent; + u64 conn_addr; u8 display_index[16] = {}; + parent = ACPI_COMPANION(&dev->pdev->dev); + /* Populate the ACPI IDs for all connectors for a given drm_device */ drm_connector_list_iter_begin(dev, &conn_iter); for_each_intel_connector_iter(connector, &conn_iter) { @@ -242,6 +255,19 @@ 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_dbg_kms(dev, "%s: Looking for ACPI node at _ADR=%llX\n", + connector->base.kdev ? + dev_name(connector->base.kdev) : "NONAME", + conn_addr); + + /* Look up the connector device, under the PCI device */ + conn_dev = acpi_find_child_device(parent, conn_addr, false); + connector->acpi_handle = acpi_device_handle(conn_dev); } 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 5e00e611f077f..d70612cc1ba2a 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -411,9 +411,14 @@ struct intel_connector { */ struct intel_encoder *encoder; +#ifdef CONFIG_ACPI /* ACPI device id for ACPI and driver cooperation */ u32 acpi_device_id; + /* ACPI handle corresponding to this connector display, if found */ + acpi_handle acpi_handle; +#endif + /* 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 0a417cd2af2bc..3ddc424b028c1 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -44,6 +44,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" @@ -5864,6 +5865,7 @@ static int intel_dp_connector_register(struct drm_connector *connector) { struct intel_dp *intel_dp = intel_attached_dp(to_intel_connector(connector)); + struct drm_i915_private *dev_priv = to_i915(connector->dev); int ret; ret = intel_connector_register(connector); @@ -5872,6 +5874,18 @@ intel_dp_connector_register(struct drm_connector *connector) intel_connector_debugfs_add(connector); + /* + * Lookup the ACPI node corresponding to the connector. This needs + * to be done in ->late_register() hook since it needs to iterate + * over all the connectors after they are registered. Calling it + * once for the device is enough since a single call will update + * for all connectors. + */ + if (!dev_priv->acpi_scan_done) { + intel_acpi_device_id_update(dev_priv); + dev_priv->acpi_scan_done = true; + } + DRM_DEBUG_KMS("registering %s bus for %s\n", intel_dp->aux.name, connector->kdev->kobj.name); diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 19195bde4921b..4e23d7a4a2129 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1189,6 +1189,8 @@ struct drm_i915_private { bool ipc_enabled; + bool acpi_scan_done; + /* Used to save the pipe-to-encoder mapping for audio */ struct intel_encoder *av_enc_map[I915_MAX_PIPES]; From patchwork Thu Mar 12 00:57:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rajat Jain X-Patchwork-Id: 11433095 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 C31A790 for ; Thu, 12 Mar 2020 00:57:40 +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 6BA252071B for ; Thu, 12 Mar 2020 00:57:40 +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="FYhpNVF+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6BA252071B 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 838156EA05; Thu, 12 Mar 2020 00:57:39 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-vk1-xa49.google.com (mail-vk1-xa49.google.com [IPv6:2607:f8b0:4864:20::a49]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1C7FD6EA05 for ; Thu, 12 Mar 2020 00:57:39 +0000 (UTC) Received: by mail-vk1-xa49.google.com with SMTP id n8so1674038vke.13 for ; Wed, 11 Mar 2020 17:57:39 -0700 (PDT) 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:content-transfer-encoding; bh=9+NZL60hxKQVqLsC6LWr9zYj9I18UQ9y4TN5uOQMD5E=; b=FYhpNVF+Anhsb+ZCWqSGGuuOKlkVy2qEQjJdcJrxALzcFBRafcG+QuDIFNyefJcE0U oybNevbBU1b91/WoRDa2pk0jYi5b9wfl9FRx2dQKzsyTjFbZGV8p9rF4U+e6m6hswIsL sfWrZK7AnA97wBrPVf7tnBulMSEjwgwpiE2G5SMtkIM27LNmadVR3sLu3yg1SU9J69PW 7tzpcxMROI5Wtiy586p20ZfcGrNN6w9U7b4VQ/vNLIq1LdHFYJWbp+t6skpzs/psb6w2 zf/Lk74SHVUspL8gyI2J/wHOLQn58f0NKyuJ7P20OnoUa/QbEsHa8P4zFakYj7M+cOOM AmSw== 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:content-transfer-encoding; bh=9+NZL60hxKQVqLsC6LWr9zYj9I18UQ9y4TN5uOQMD5E=; b=GRPfL1xnyipLB8sADKvOpxypuMDJG/Zg7PYVxjOiYyubXNb3nN9y69BGOgomc6KeN6 YvdHntI+7F1KsjOw1dfRs1rSN3AR3vlLvmaJ5ufWo/Z3jmZSNRu5wKbK/h+rBlFtyj1x cURWEVK9FKAv32nXnkTdwunX809n1laPtjLHcrpyvx11pWYVPmdCVy66T8Wgt1w9Jq3h C/tzkSdg8nI4R6kk2aaenmwSg9+il7YnXdf7qGc7HbqztVhlZEF3w3gIVbsBA6+RoIDH KdG1hcLHN4o3Ocb0ag9XXyyN5NPvLVZYQQDiIQzqP/2lBwbimTC0/YwNO+ezHjMXnclU awoQ== X-Gm-Message-State: ANhLgQ03ODLGvpYcpg1i1WnrbOkl0mCt3EQnIUvHOGfphE6aT4WrgKXz jhZWjlEaN+4PdvbjYTCGPrLT05emh25B X-Google-Smtp-Source: ADFU+vtDaZvaf7oRnHi/dLlI6NjupwIimtwcS2AG3lGB96kzAsYgjBQqUml5Skxbv8u1hHcuXEOQt0Nbt+Ks X-Received: by 2002:a1f:9948:: with SMTP id b69mr3867845vke.13.1583974658082; Wed, 11 Mar 2020 17:57:38 -0700 (PDT) Date: Wed, 11 Mar 2020 17:57:21 -0700 In-Reply-To: <20200312005722.48803-1-rajatja@google.com> Message-Id: <20200312005722.48803-5-rajatja@google.com> Mime-Version: 1.0 References: <20200312005722.48803-1-rajatja@google.com> X-Mailer: git-send-email 2.25.1.481.gfbce0eb801-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 , mpearson@lenovo.com, Nitin Joshi1 , Sugumaran Lacshiminarayanan , Tomoki Maruichi Subject: [Intel-gfx] [PATCH v8 4/5] drm/i915: Add helper code for ACPI privacy screen 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" Add helper functions that can allow i915 to detect and control an integrated privacy screen via ACPI methods. These shall be used in the next patch. Signed-off-by: Rajat Jain --- v8: Initial version. formed by refactoring the previous patch 4. print the connector name in the debug messages. drivers/gpu/drm/i915/Makefile | 3 +- .../drm/i915/display/intel_privacy_screen.c | 184 ++++++++++++++++++ .../drm/i915/display/intel_privacy_screen.h | 27 +++ 3 files changed, 213 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/i915/display/intel_privacy_screen.c create mode 100644 drivers/gpu/drm/i915/display/intel_privacy_screen.h diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index 9f887a86e555d..da42389107f9c 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile @@ -209,7 +209,8 @@ i915-y += \ display/intel_vga.o i915-$(CONFIG_ACPI) += \ display/intel_acpi.o \ - display/intel_opregion.o + display/intel_opregion.o \ + display/intel_privacy_screen.o i915-$(CONFIG_DRM_FBDEV_EMULATION) += \ display/intel_fbdev.o diff --git a/drivers/gpu/drm/i915/display/intel_privacy_screen.c b/drivers/gpu/drm/i915/display/intel_privacy_screen.c new file mode 100644 index 0000000000000..66039103c821b --- /dev/null +++ b/drivers/gpu/drm/i915/display/intel_privacy_screen.c @@ -0,0 +1,184 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* + * Intel ACPI privacy screen code + * + * Copyright © 2020 Google Inc. + * + * This code can help detect and control an integrated EPS (electronic + * privacy screen) via ACPI functions. It expects an ACPI node for the + * drm connector device with the following elements: + * + * UUID should be "c7033113-8720-4ceb-9090-9d52b3e52d73" + * + * _ADR = ACPI address per Spec (also see intel_acpi_device_id_update()) + * https://uefi.org/sites/default/files/resources/ACPI_6_3_final_Jan30.pdf + * Pages 1119 - 1123. + * + * _DSM method that will perform the following functions according to + * Local1 argument passed to it: + * - Local1 = 0 (EPS capabilities): Report EPS presence and capabilities. + * - Local1 = 1 (EPS State) : _DSM returns 1 if EPS is enabled, 0 otherwise. + * - Local1 = 2 (EPS Enable) : _DSM enables EPS + * - Local1 = 3 (EPS Disable): _DSM disables EPS + * + * Here is a sample ACPI node: + * + * Scope (\_SB.PCI0.GFX0) // Intel graphics device (PCI device) + * { + * Method (_DOD, 0, NotSerialized) // _DOD: Display Output Devices + * { + * Return (Package (0x01) + * { + * 0x80010400 + * }) + * } + * + * Device (LCD) + * { + * Name (_ADR, 0x80010400) // _ADR: Address + * Name (_STA, 0x0F) // _STA: Status + * + * Method (EPSP, 0, NotSerialized) // EPS Present + * { + * Return (0x01) + * } + * + * Method (EPSS, 0, NotSerialized) // EPS State + * { + * Local0 = \_SB.PCI0.GRXS (0xCD) + * Return (Local0) + * } + * + * Method (EPSE, 0, NotSerialized) // EPS Enable + * { + * \_SB.PCI0.STXS (0xCD) + * } + * + * Method (EPSD, 0, NotSerialized) // EPS Disable + * { + * \_SB.PCI0.CTXS (0xCD) + * } + * + * Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method + * { + * ToBuffer (Arg0, Local0) + * If ((Local0 == ToUUID ("c7033113-8720-4ceb-9090-9d52b3e52d73"))) + * { + * ToInteger (Arg2, Local1) + * If ((Local1 == Zero)) + * { + * Local2 = EPSP () + * If ((Local2 == One)) + * { + * Return (Buffer (One) + * { + * 0x0F + * }) + * } + * } + * + * If ((Local1 == One)) + * { + * Return (EPSS ()) + * } + * + * If ((Local1 == 0x02)) + * { + * EPSE () + * } + * + * If ((Local1 == 0x03)) + * { + * EPSD () + * } + * + * Return (Buffer (One) + * { + * 0x00 + * }) + * } + * + * Return (Buffer (One) + * { + * 0x00 + * }) + * } + * } + * } + */ + +#include + +#include "intel_privacy_screen.h" + +#define CONN_NAME(conn) \ + (conn->base.kdev ? dev_name(conn->base.kdev) : "NONAME") + +#define CONNECTOR_DSM_REVID 1 + +#define CONNECTOR_DSM_FN_PRIVACY_ENABLE 2 +#define CONNECTOR_DSM_FN_PRIVACY_DISABLE 3 + +static const guid_t drm_conn_dsm_guid = + GUID_INIT(0xC7033113, 0x8720, 0x4CEB, + 0x90, 0x90, 0x9D, 0x52, 0xB3, 0xE5, 0x2D, 0x73); + +/* Makes _DSM call to set privacy screen status */ +static void acpi_privacy_screen_call_dsm(struct intel_connector *connector, + u64 func) +{ + union acpi_object *obj; + acpi_handle acpi_handle = connector->acpi_handle; + struct drm_device *drm = connector->base.dev; + + if (!acpi_handle) + return; + + obj = acpi_evaluate_dsm(acpi_handle, &drm_conn_dsm_guid, + CONNECTOR_DSM_REVID, func, NULL); + if (!obj) { + drm_err(drm, "%s: failed to evaluate _DSM for fn %llx\n", + CONN_NAME(connector), func); + return; + } + + ACPI_FREE(obj); +} + +void intel_privacy_screen_set_val(struct intel_connector *connector, + enum drm_privacy_screen_status val) +{ + struct drm_device *drm = connector->base.dev; + + if (val == PRIVACY_SCREEN_DISABLED) { + drm_dbg_kms(drm, "%s: disabling privacy-screen\n", + CONN_NAME(connector)); + acpi_privacy_screen_call_dsm(connector, + CONNECTOR_DSM_FN_PRIVACY_DISABLE); + } else { + drm_dbg_kms(drm, "%s: enabling privacy-screen\n", + CONN_NAME(connector)); + acpi_privacy_screen_call_dsm(connector, + CONNECTOR_DSM_FN_PRIVACY_ENABLE); + } +} + +bool intel_privacy_screen_present(struct intel_connector *connector) +{ + acpi_handle handle = connector->acpi_handle; + struct drm_device *drm = connector->base.dev; + + if (handle && + acpi_check_dsm(handle, &drm_conn_dsm_guid, + CONNECTOR_DSM_REVID, + 1 << CONNECTOR_DSM_FN_PRIVACY_ENABLE | + 1 << CONNECTOR_DSM_FN_PRIVACY_DISABLE)) { + drm_info(drm, "%s: supports ACPI privacy-screen\n", + CONN_NAME(connector)); + return true; + } + + drm_dbg_kms(drm, "%s: doesn't support ACPI privacy-screen\n", + CONN_NAME(connector)); + return false; +} diff --git a/drivers/gpu/drm/i915/display/intel_privacy_screen.h b/drivers/gpu/drm/i915/display/intel_privacy_screen.h new file mode 100644 index 0000000000000..8655745ff9085 --- /dev/null +++ b/drivers/gpu/drm/i915/display/intel_privacy_screen.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ +/* + * Copyright © 2020 Google Inc. + */ + +#ifndef __DRM_PRIVACY_SCREEN_H__ +#define __DRM_PRIVACY_SCREEN_H__ + +#include "intel_display_types.h" + +#ifdef CONFIG_ACPI +bool intel_privacy_screen_present(struct intel_connector *connector); +void intel_privacy_screen_set_val(struct intel_connector *connector, + enum drm_privacy_screen_status val); +#else +static bool intel_privacy_screen_present(struct intel_connector *connector) +{ + return false; +} + +static void +intel_privacy_screen_set_val(struct intel_connector *connector, + enum drm_privacy_screen_status val) +{ } +#endif /* CONFIG_ACPI */ + +#endif /* __DRM_PRIVACY_SCREEN_H__ */ From patchwork Thu Mar 12 00:57:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajat Jain X-Patchwork-Id: 11433097 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 D0EA9139A for ; Thu, 12 Mar 2020 00:57:43 +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 797A82071B for ; Thu, 12 Mar 2020 00:57:43 +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="mmGkCmqF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 797A82071B 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 D2F486EA04; Thu, 12 Mar 2020 00:57:42 +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 19CC56EA08 for ; Thu, 12 Mar 2020 00:57:41 +0000 (UTC) Received: by mail-pf1-x44a.google.com with SMTP id h125so2633668pfg.3 for ; Wed, 11 Mar 2020 17:57:41 -0700 (PDT) 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=hrX565yTBVUaBRHBANP/oUW6tx77j7n+/fB0WrNdRuo=; b=mmGkCmqF1t4vIGKl1vxRmYa4Iw9gw+m0F2Rl36GDX5iFly8hLcreI4jW1JM0aj9fke mEhYDzVhpOaAmixqSzg4Zm5LcbvnOrul+h7AKhTqr9vwmuCxeJ2hQ6GiB7gc7kWUHvWH B1bfDHrvt/E9HTfMP0pIbWBLiFG9MjkavH0Otsac92H+MB+4jaFXYn7fzfii6HNUyEP9 LoaEAooybbbw4wOPB1wo2ldXZ2cMJX2PtI9ACfh7AzN+OehezA9MI68uW7Y5jVc6czVo mle4uCa7o5PzON+Fe+JJ9FApEx33Sw+Z31PPH7UTQaaVSJQoZXojHjMc4kixdB5/w0cq T5/A== 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=hrX565yTBVUaBRHBANP/oUW6tx77j7n+/fB0WrNdRuo=; b=bKsNNNRte83EVODBNvO3/zVFtNIlFQ8lMuWXUGBGqWxGYxTsuUaurytWVXQGXVlkNk +z4ArUKtTFseOdLU/rXGVJJsaFzSlg15xPpSDeI49KwEEPsBu65acpwZ1mtbM8ry7LyX 58Sq5AvO1WKXkHI5UPt5w8+y+yW5YBThmStceMpXpXhiHPcmfZSY3IfEtp9fwC3Q3Sx6 LMFzCZ99Osy2m7K8LfsXyDayDMksnjcpujVLx/TSYPKSghLssmhgoKHOro0gpFjxmi/D PciVRnAcPMcHyT39Ih0ks2b608U5AXUfWA7LKXyh/RbC1eZkdPL5q8Og+5MtGJhoYCRf 5IGw== X-Gm-Message-State: ANhLgQ0XCE66ME515g1Bf6guP+WMaDTZzLfmfBbiNnA5JLOFb6TjubDW H5wBosku3LSUFFqNeyWcsx7ArMnlybL7 X-Google-Smtp-Source: ADFU+vvwh7TxtyhUhqTq0JD2HSw6HCRI/lZYTYLR36CPZC7RY1ZRfZmp0+bpIdsz6npDN4qgr1AMMVBexP3l X-Received: by 2002:a17:90a:2103:: with SMTP id a3mr1404774pje.181.1583974660505; Wed, 11 Mar 2020 17:57:40 -0700 (PDT) Date: Wed, 11 Mar 2020 17:57:22 -0700 In-Reply-To: <20200312005722.48803-1-rajatja@google.com> Message-Id: <20200312005722.48803-6-rajatja@google.com> Mime-Version: 1.0 References: <20200312005722.48803-1-rajatja@google.com> X-Mailer: git-send-email 2.25.1.481.gfbce0eb801-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 , mpearson@lenovo.com, Nitin Joshi1 , Sugumaran Lacshiminarayanan , Tomoki Maruichi Subject: [Intel-gfx] [PATCH v8 5/5] drm/i915: Enable support for integrated privacy screen 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" Add support for an ACPI based integrated privacy screen that is available on some systems. Signed-off-by: Rajat Jain --- v8: - separate the APCI privacy screen into a separate patch. - Don't destroy the property if there is no privacy screen (because drm core doesn't like destroying property in late_register()). - The setting change needs to be committed in ->update_pipe() for ddi.c as well as dp.c and both of them call intel_dp_add_properties() v7: Look for ACPI node in ->late_register() hook. Do the scan only once per drm_device (instead of 1 per drm_connector) v6: Addressed minor comments from Jani at https://lkml.org/lkml/2020/1/24/1143 - local variable renamed. - used drm_dbg_kms() - used acpi_device_handle() - Used opaque type acpi_handle instead of void* v5: same as v4 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_atomic.c | 2 ++ drivers/gpu/drm/i915/display/intel_ddi.c | 1 + drivers/gpu/drm/i915/display/intel_dp.c | 34 ++++++++++++++++++++- drivers/gpu/drm/i915/display/intel_dp.h | 5 +++ 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_atomic.c b/drivers/gpu/drm/i915/display/intel_atomic.c index d043057d2fa03..9898d8980e7ce 100644 --- a/drivers/gpu/drm/i915/display/intel_atomic.c +++ b/drivers/gpu/drm/i915/display/intel_atomic.c @@ -150,6 +150,8 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn, new_conn_state->base.picture_aspect_ratio != old_conn_state->base.picture_aspect_ratio || new_conn_state->base.content_type != old_conn_state->base.content_type || new_conn_state->base.scaling_mode != old_conn_state->base.scaling_mode || + new_conn_state->base.privacy_screen_status != + old_conn_state->base.privacy_screen_status || !blob_equal(new_conn_state->base.hdr_output_metadata, old_conn_state->base.hdr_output_metadata)) crtc_state->mode_changed = true; diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c index 73d0f4648c06a..69a5423216dc5 100644 --- a/drivers/gpu/drm/i915/display/intel_ddi.c +++ b/drivers/gpu/drm/i915/display/intel_ddi.c @@ -3708,6 +3708,7 @@ static void intel_ddi_update_pipe(struct intel_encoder *encoder, if (!intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI)) intel_ddi_update_pipe_dp(encoder, crtc_state, conn_state); + intel_dp_update_privacy_screen(encoder, crtc_state, conn_state); intel_hdcp_update_pipe(encoder, crtc_state, conn_state); } diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index 3ddc424b028c1..5f33ebb466135 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -62,6 +62,7 @@ #include "intel_lspcon.h" #include "intel_lvds.h" #include "intel_panel.h" +#include "intel_privacy_screen.h" #include "intel_psr.h" #include "intel_sideband.h" #include "intel_tc.h" @@ -5886,6 +5887,10 @@ intel_dp_connector_register(struct drm_connector *connector) dev_priv->acpi_scan_done = true; } + /* Check for integrated Privacy screen support */ + if (intel_privacy_screen_present(to_intel_connector(connector))) + drm_connector_attach_privacy_screen_property(connector); + DRM_DEBUG_KMS("registering %s bus for %s\n", intel_dp->aux.name, connector->kdev->kobj.name); @@ -6883,6 +6888,33 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect connector->state->scaling_mode = DRM_MODE_SCALE_ASPECT; } + + /* + * Created here, but depending on result of probing for privacy-screen + * in intel_dp_connector_register(), gets attached in that function. + * Need to create here because the drm core doesn't like creating + * properties during ->late_register(). + */ + drm_connector_create_privacy_screen_property(connector); +} + +void +intel_dp_update_privacy_screen(struct intel_encoder *encoder, + const struct intel_crtc_state *crtc_state, + const struct drm_connector_state *conn_state) +{ + struct drm_connector *connector = conn_state->connector; + + intel_privacy_screen_set_val(to_intel_connector(connector), + conn_state->privacy_screen_status); +} + +static void intel_dp_update_pipe(struct intel_encoder *encoder, + const struct intel_crtc_state *crtc_state, + const struct drm_connector_state *conn_state) +{ + intel_dp_update_privacy_screen(encoder, crtc_state, conn_state); + intel_panel_update_backlight(encoder, crtc_state, conn_state); } static void intel_dp_init_panel_power_timestamps(struct intel_dp *intel_dp) @@ -7826,7 +7858,7 @@ bool intel_dp_init(struct drm_i915_private *dev_priv, intel_encoder->compute_config = intel_dp_compute_config; intel_encoder->get_hw_state = intel_dp_get_hw_state; intel_encoder->get_config = intel_dp_get_config; - intel_encoder->update_pipe = intel_panel_update_backlight; + intel_encoder->update_pipe = intel_dp_update_pipe; intel_encoder->suspend = intel_dp_encoder_suspend; if (IS_CHERRYVIEW(dev_priv)) { intel_encoder->pre_pll_enable = chv_dp_pre_pll_enable; diff --git a/drivers/gpu/drm/i915/display/intel_dp.h b/drivers/gpu/drm/i915/display/intel_dp.h index 0c7be8ed1423a..e4594e27ce5a8 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.h +++ b/drivers/gpu/drm/i915/display/intel_dp.h @@ -123,4 +123,9 @@ static inline unsigned int intel_dp_unused_lane_mask(int lane_count) u32 intel_dp_mode_to_fec_clock(u32 mode_clock); +void +intel_dp_update_privacy_screen(struct intel_encoder *encoder, + const struct intel_crtc_state *crtc_state, + const struct drm_connector_state *conn_state); + #endif /* __INTEL_DP_H__ */