public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Paul <sean@poorly.run>
To: Rajat Jain <rajatja@google.com>
Cc: "Mat King" <mathewk@google.com>,
	"Sean Paul" <seanpaul@chromium.org>,
	"Jani Nikula" <jani.nikula@linux.intel.com>,
	"Daniel Thompson" <daniel.thompson@linaro.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Greg KH" <gregkh@linuxfoundation.org>,
	"Ross Zwisler" <zwisler@google.com>,
	"Jingoo Han" <jingoohan1@gmail.com>,
	"Lee Jones" <lee.jones@linaro.org>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"David Airlie" <airlied@redhat.com>,
	"Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Alexander Schremmer" <alex@alexanderweb.de>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>
Subject: Re: New sysfs interface for privacy screens
Date: Mon, 7 Oct 2019 15:53:15 -0400	[thread overview]
Message-ID: <20191007195315.GH126146@art_vandelay> (raw)
In-Reply-To: <CACK8Z6H+tBHproaH2hf59mYF406ohYhAWj8szYn=Fjao2SUZVA@mail.gmail.com>

On Mon, Oct 07, 2019 at 12:31:08PM -0700, Rajat Jain wrote:
> On Mon, Oct 7, 2019 at 9:19 AM Mat King <mathewk@google.com> wrote:
> >
> > On Mon, Oct 7, 2019 at 7:09 AM Sean Paul <seanpaul@chromium.org> wrote:
> > >
> > > On Thu, Oct 3, 2019 at 3:57 PM Mat King <mathewk@google.com> wrote:
> > > >
> > > > On Thu, Oct 3, 2019 at 2:59 AM Jani Nikula <jani.nikula@linux.intel.com> wrote:
> > > > >
> > > > > On Wed, 02 Oct 2019, Mat King <mathewk@google.com> wrote:
> > > > > > On Wed, Oct 2, 2019 at 4:46 AM Jani Nikula <jani.nikula@linux.intel.com> wrote:
> > > > > >>
> > > > > >> On Wed, 02 Oct 2019, Daniel Thompson <daniel.thompson@linaro.org> wrote:
> > > > > >> > On Wed, Oct 02, 2019 at 12:30:05PM +0300, Jani Nikula wrote:
> > > > > >> >> On Tue, 01 Oct 2019, Mat King <mathewk@google.com> 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

  reply	other threads:[~2019-10-07 19:53 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-01 16:09 New sysfs interface for privacy screens Mat King
2019-10-01 16:27 ` Greg KH
2019-10-01 16:42   ` Mat King
2019-10-02  9:30 ` Jani Nikula
2019-10-02 10:24   ` Daniel Thompson
2019-10-02 10:46     ` Jani Nikula
2019-10-02 15:25       ` Mat King
2019-10-03  8:59         ` Jani Nikula
2019-10-03 19:57           ` Mat King
2019-10-07  4:56             ` Rajat Jain
2019-10-07  8:59               ` Jani Nikula
2019-10-07 13:08             ` Sean Paul
2019-10-07 16:19               ` Mat King
2019-10-07 19:31                 ` Rajat Jain
2019-10-07 19:53                   ` Sean Paul [this message]
2019-10-08  6:13                 ` Jani Nikula
     [not found]                   ` <CACK8Z6FF1CBmti797sYWS51j-8ag-pSL9RJ2r9NDibXk2M=tEQ@mail.gmail.com>
2019-10-23  0:17                     ` Rajat Jain
2019-10-23  8:39                   ` Daniel Vetter
2019-10-02 15:46 ` Jonathan Corbet
2019-10-02 17:13   ` Mat King
2019-10-03  8:19   ` Jani Nikula
2019-10-03 10:22     ` Daniel Thompson
2019-10-06 11:04       ` Pavel Machek
2019-10-06 16:48         ` Jingoo Han
2019-10-06 20:34       ` Henrique de Moraes Holschuh
2019-10-06 11:00   ` Pavel Machek
2019-10-06 10:58 ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191007195315.GH126146@art_vandelay \
    --to=sean@poorly.run \
    --cc=airlied@redhat.com \
    --cc=alex@alexanderweb.de \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=daniel.thompson@linaro.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=jingoohan1@gmail.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathewk@google.com \
    --cc=rafael@kernel.org \
    --cc=rajatja@google.com \
    --cc=seanpaul@chromium.org \
    --cc=ville.syrjala@linux.intel.com \
    --cc=zwisler@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox