Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4722255ybp; Mon, 7 Oct 2019 12:54:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqztO/dlHHJR/7kyk8j7gVWhqFoYrQ2G19SGTvw5UGa/etcnBbHKgQxnxzts/UJ2B2QST2fg X-Received: by 2002:a17:906:bcd9:: with SMTP id lw25mr18340312ejb.330.1570478040436; Mon, 07 Oct 2019 12:54:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570478040; cv=none; d=google.com; s=arc-20160816; b=mwrpHF9tlJMa/3H8kO7qgSZoQT6q0YoFkhfDThx9u0N4nPTYqwuymnm6eyBDW9yplP P+yP4MZKKBScP3IryuIfdxvLrrwg3fSyLJBg92Ovk0DGM+H50QhQTDpW6+Jxg5EZkeCB sZecbPH6f/Jv5Tvcgrz9GnbGUZ8WFqen9HddTdNfS1JL+3cdD1Gk1lOQKTSLlRv+ecz2 sZAMVdEtm/WdbJeu0LzmALuBmJXbMUBxUfvmJEGAGGoz1llulQX969CWxGB4ciziw7Pz mvORyvWTSA9DfAZtqcNU48lyqJQJ5IkNqU2qh0EZ6znpenMdUoY0PheXmlj9wE2r9riH ASrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=9fZ4Zp2LoFUBEHKFC3VfGjyFqFgPFxRmJbq4J4sKygI=; b=OePzr7lwRythyCXhOqjCT/ynEuW8+qmmlU0nuqMuc0/2uZZdZF6J71QCEBsp82CQiR DDMoLHoVEfNaNgT3k7Mkgq9ZB+4F6tujXJ4q028FXhOfJo+4RSpxFXn1bwr1F5ToIUwp 44zSgGqiMlKBffUQRiG3mVhkSO7vo7yYM5ITzjyZMvHCLKJnWHj2ygzYaB14a4br5u7v Q67L8dZNK8NEXe58R6bLiAnM/bRvz7dJz8nbNx9FaeuP1tLH6Lcyj4Xvh2JIhwhsJ3iI 7jrZHmUDsMlRcRxPfaf+F7scf2kU/kmwdyh6zoEts9eC+5250yflJESsfzUYEPnDN0OR r/TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@poorly.run header.s=google header.b=fND51JmA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id si30si7658841ejb.92.2019.10.07.12.53.35; Mon, 07 Oct 2019 12:54:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@poorly.run header.s=google header.b=fND51JmA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728459AbfJGTxS (ORCPT + 99 others); Mon, 7 Oct 2019 15:53:18 -0400 Received: from mail-yw1-f66.google.com ([209.85.161.66]:33677 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728187AbfJGTxR (ORCPT ); Mon, 7 Oct 2019 15:53:17 -0400 Received: by mail-yw1-f66.google.com with SMTP id w140so3933971ywd.0 for ; Mon, 07 Oct 2019 12:53:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=9fZ4Zp2LoFUBEHKFC3VfGjyFqFgPFxRmJbq4J4sKygI=; b=fND51JmAB40TXr2jZ5eaHDzLl4XiNMU2z/A8DUIdoeHdSxlaLKDARWw5QToebjJ1cU k2FzGi4WjW2CCpFkro3qR8q+3jR8xfuwIBq9arKrI0JaYlZQgdpq9lOla4lnGKfxnsYv H/XvxeIgTStoFvvnmHWGtuMxnqU5LDCh6zJES9cB+ZmkqijzHewwmRhKxJ1xy2XVwivI tz7xwvRw9VPWbdM1NDkc6EDP3zY2fxqNAJUsHJMK9ldiuxTpvd7elXxcnSj2HAdx6qG4 Uj5hYHPMy+aFeNxacsCgeMbG23QnaEURwZebNzRe4QvcZjXKILEJapcEjl1cDFvuuK/w u+MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=9fZ4Zp2LoFUBEHKFC3VfGjyFqFgPFxRmJbq4J4sKygI=; b=GUbpeezTF6y7vfZHyshMLErwHhlbC/I9XIY4Ef9Kvo+BmuKgIH9/wTUIORml9CUxF4 5NXcpmOZwpru/1XSZ3lU73vAVvopzOEK7Mvk8iaRxmk6HduJpQTy5GuJXxo4Ejue6ZbM UTOKlSWRNrs3P+Goyf5JHg40QlqljwYJ8kRki1Fkfld2DC3ibAFnKL3t4yjVSpwp5pAc EzG+p8cHON4rh5IAAk+E6lQy3aItkVzlN+wPlNCtquZPSKqbO+B2uT4l9llg9L3+fsVo 9mo3FRZZuVKRy3Bj03rmB9YHsQ7qMa5+fmKFtMezDkZ/UHdcROQ9rsc0MGbb86T9EhBM 1l4A== X-Gm-Message-State: APjAAAXJ3IBbaVyOFDZnhaSB45FsijtX6S5o0CpKj10xp4ugFr9bUHfZ jkORytqIVqc6I5EPC298PYwvlA== X-Received: by 2002:a81:c202:: with SMTP id z2mr22914112ywc.47.1570477996643; Mon, 07 Oct 2019 12:53:16 -0700 (PDT) Received: from localhost ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id y63sm3905006ywg.5.2019.10.07.12.53.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2019 12:53:15 -0700 (PDT) Date: Mon, 7 Oct 2019 15:53:15 -0400 From: Sean Paul To: Rajat Jain Cc: Mat King , Sean Paul , Jani Nikula , Daniel Thompson , Linux Kernel Mailing List , dri-devel , "Rafael J. Wysocki" , Greg KH , Ross Zwisler , Jingoo Han , Lee Jones , Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , David Airlie , Daniel Vetter , Alexander Schremmer , Andy Shevchenko Subject: Re: New sysfs interface for privacy screens Message-ID: <20191007195315.GH126146@art_vandelay> References: <87h84rbile.fsf@intel.com> <20191002102428.zaid63hp6wpd7w34@holly.lan> <8736gbbf2b.fsf@intel.com> <87h84q9pcj.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 07, 2019 at 12:31:08PM -0700, Rajat Jain wrote: > On Mon, Oct 7, 2019 at 9:19 AM Mat King wrote: > > > > On Mon, Oct 7, 2019 at 7:09 AM Sean Paul wrote: > > > > > > On Thu, Oct 3, 2019 at 3:57 PM Mat King wrote: > > > > > > > > On Thu, Oct 3, 2019 at 2:59 AM Jani Nikula wrote: > > > > > > > > > > On Wed, 02 Oct 2019, Mat King wrote: > > > > > > On Wed, Oct 2, 2019 at 4:46 AM Jani Nikula wrote: > > > > > >> > > > > > >> On Wed, 02 Oct 2019, Daniel Thompson wrote: > > > > > >> > On Wed, Oct 02, 2019 at 12:30:05PM +0300, Jani Nikula wrote: > > > > > >> >> On Tue, 01 Oct 2019, Mat King wrote: > > > > > >> >> > Resending in plain text mode > > > > > > /snip > > > > > > > > > > > So my proposal would now be to add a new standard property to > > > > drm_connector called "privacy_screen" this property would be an enum > > > > which can take one of three values. > > > > > > > > PRIVACY_UNSUPPORTED - Privacy is not available for this connector > > > > PRIVACY_DISABLED - Privacy is available but turned off > > > > PRIVACY_ENABLED - Privacy is available and turned on > > > > > > Agree with Jani, use the property presence to determine if it's supported > > > > That makes sense; just to confirm can a property be added or removed > > after the connector is registered? > > > > > > > > > > > > > When the connector is initized the privacy screen property is set to > > > > PRIVACY_UNSUPPORTED and cannot be changed unless a drm_privacy_screen > > > > is registered to the connector. drm_privacy_screen will look something > > > > like > > > > > > > > struct drm_privacy_screen_ops { > > > > int (*get_privacy_state)(struct drm_privacy_screen *); > > > > int (*set_privacy_state)(struct drm_privacy_screen *, int); > > > > } > > > > > > > > struct drm_privacy_screen { > > > > /* The privacy screen device */ > > > > struct device *dev; > > > > > > > > /* The connector that the privacy screen is attached */ > > > > struct drm_connector *connector; > > > > > > > > /* Ops to get and set the privacy screen state */ > > > > struct drm_privacy_screen_ops *ops; > > > > > > > > /* The current state of the privacy screen */ > > > > int state; > > > > } > > > > > > > > Privacy screen device drivers will call a function to register the > > > > privacy screen with the connector. > > > > > > Do we actually need dedicated drivers for privacy screen? It seems > > > like something that is panel-specific hardware, so I'd suggest just > > > using the panel driver. > > > > The privacy screen is physically part of the display but the control > > interface, at least in all current use cases, is ACPI. Is there a way > > to control an ACPI device with the panel driver? > > I feel that doing it in a dedicated driver has the advantage that if > we can standardise the control interface, it can be used across > different panels. So a new panel can be supported using the existing > driver by merely instantiating the right ACPI HID "privacy screen" > device as a child device of the parent display / panel device. This > parent-child relation would also give the kernel the connection needed > about "which display does this privacy screen attach to". In future,if > non-x86 platforms need the feature using a different control interface > (say via a GPIO driver), the privacy screen driver can be updated to > support that also. I might be misunderstanding the scope of this, but if everything is controlled via drm properties, you could just use a helper function to toggle it on/off? We have helper libraries for a plethora of optional hardware features already. Sean > > Thanks, > > Rajat > > > > > > > > > Sean > > > > > > > > > > > int drm_privacy_screen_register(struct drm_privacy_screen_ops *ops, > > > > struct device *dev, struct drm_connector *); > > > > > > > > Calling this will set a new field on the connector "struct > > > > drm_privacy_screen *privacy_screen" and change the value of the > > > > property to ops->get_privacy_state(). When > > > > drm_mode_connector_set_obj_prop() is called with the > > > > privacy_screen_proptery if a privacy_screen is registered to the > > > > connector the ops->set_privacy_state() will be called with the new > > > > value. > > > > > > > > Setting of this property (and all drm properties) is done in user > > > > space using ioctrl. > > > > > > > > Registering the privacy screen with a connector may be tricky because > > > > the driver for the privacy screen will need to be able to identify > > > > which connector it belongs to and we will have to deal with connectors > > > > being added both before and after the privacy screen device is added > > > > by it's driver. > > > > > > > > How does that sound? I will work on a patch if that all sounds about right. > > > > > > > > One question I still have is there a way to not accept a value that is > > > > passed to drm_mode_connector_set_obj_prop()? In this case if a privacy > > > > screen is not registered the property must stay PRIVACY_UNSUPPORTED > > > > and if a privacy screen is registered then PRIVACY_UNSUPPORTED must > > > > never be set. -- Sean Paul, Software Engineer, Google / Chromium OS