Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp987583ybn; Wed, 2 Oct 2019 09:10:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqxsLdpc9lrfN6Jd/qxAxWAg1bwkEP9f48sD3oQq3wwvz7rx6tOmbsejVObC5dbPGAU8IiWc X-Received: by 2002:a17:906:d92c:: with SMTP id rn12mr3766825ejb.16.1570032630022; Wed, 02 Oct 2019 09:10:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570032630; cv=none; d=google.com; s=arc-20160816; b=QAymJnqcQovbDmtjhYO2g6TGDa0YI9hem4aiBT+2G7jpBUtQEo68GBzvi7DS76kc6/ KSSPBew5B2QS8iBjdJFYpFSVbNtyDD5a7vkDnBp8muaKfoNWzo8EgxTIYWF+hV2zVLxw u1+PUp0gMkC+n5VCrq9Rzln6dY9/AjZEE4OXTbCxLD/xjsPj3bfq6kVbRk15sQhAKLHF JuPGyhet9pH9IXdhP0tUA0IzKXGQdx3QiUgyNg7Sa397yB9A6syrvKjxMakSbXfNXtjw f6uMzpgXJwki8ETrGKFbjuopgQUvrFTNLnwVorxQfeQunVsc4cMvMIzFs+mh9qwcWuah euKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=bzfJFKZOgy9NAhPs1ajGEJPbZdxMVe17fWKmhbaFgfM=; b=Q4z+WJ1eD14P61s5Y4c7OomMcbtwp1ngHZUboqR2LIcvUgESxMUAlLR0LlkaCusJuF +NS408MUNVXnex8Eu5UMlUAFNpLz56nUxQfPM0PyfB37wHDPs+2FVg+/pp6Ygj4wLBmH 0tWtuxXwlV1LDU5DbX1HgbWX7QVf6uxbAxNwxY+A6XnnZtQR7RJ3k6V1mirK+2d5Af3X vkyXgsxg7ARk1pQnetZIvtcjPbDQKYRWbFSf9UnReaUQQWlWijNV3S00au7z/ANdVNZS TxZWLdH5ky9xdWqVekA1+p7H/VRYcfjZfgsvkx2HrYLEPc774d88GBd81fR4mlfz7uO2 q2Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=uvcKcSJX; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id jx7si10801755ejb.84.2019.10.02.09.10.00; Wed, 02 Oct 2019 09:10:30 -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=@google.com header.s=20161025 header.b=uvcKcSJX; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728757AbfJBPZW (ORCPT + 99 others); Wed, 2 Oct 2019 11:25:22 -0400 Received: from mail-yw1-f45.google.com ([209.85.161.45]:42591 "EHLO mail-yw1-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726710AbfJBPZW (ORCPT ); Wed, 2 Oct 2019 11:25:22 -0400 Received: by mail-yw1-f45.google.com with SMTP id i207so6206296ywc.9 for ; Wed, 02 Oct 2019 08:25:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bzfJFKZOgy9NAhPs1ajGEJPbZdxMVe17fWKmhbaFgfM=; b=uvcKcSJXyswHOLl870SnIfHmFhb6o1mt7COyznfinJxFb4sonb7CczbfuvZIwvfmpm MocxsyU9UHGJ77qF7hCNPcOfVaYqI+X0ZsHSqncCxMQIoK+qdMahsugpFV/AuC/Ds4B3 YCiVsk4WXIul14D3Vf2U8+q9cche8AAdre6/rT6RoTDg7ljUTBudyI8PTlaXdlKEP3zD QSMJJizff/gskWTc53+HyCt2njjSQQ7nKSMGJVgGApf3BAcVAB8+Bj5eh9Ocwb+Wkm8g eAbGtKa/cUiy2cBQMubvbbVsuWn+eatIZa3bzzYIajeG4CuO8GYi/AGd3BO61LNBFA1l 8gBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bzfJFKZOgy9NAhPs1ajGEJPbZdxMVe17fWKmhbaFgfM=; b=IPtQJEeX+BQs0tOCALruZ7StRY7gpZW0HzMX+dHYI/w0fC6JvXixAJHrBIjVJLe3m4 skn3O8KlWbkMXOVJDcoA8/LALqhRiOg2OAlo18uQkOOjBtvcFOUXqHYAf0xh5ze0MEUA Jof6hSsX9Pk0WS2u4O4kqA4hXPP+KCDGz/UNmA0JPdUIEOG4KJ0kmiGbKQDJWpFBDYtJ MlwbI8l/nCZ4xa7XQhGL7n4xGOAH46CvX4srr9+Ml93cFm0lVvZRExJBmSUn9sLyVJNT L0gC+6lxlm8hLShf7M9HsTVAZrniXk+hFaMUKRtWU1C+cGU20MBC2+gbPYqJCWORM09h QONg== X-Gm-Message-State: APjAAAXIyed76R3ITVZO4+OPh7NdQkPeynD406yTpSj+eCHWrALXJ8I0 WhIf2z6OmJIWHnoDZkEm5JlfSqb/lRj7xdA7zarvEA== X-Received: by 2002:a81:a144:: with SMTP id y65mr2866880ywg.437.1570029920166; Wed, 02 Oct 2019 08:25:20 -0700 (PDT) MIME-Version: 1.0 References: <87h84rbile.fsf@intel.com> <20191002102428.zaid63hp6wpd7w34@holly.lan> <8736gbbf2b.fsf@intel.com> In-Reply-To: <8736gbbf2b.fsf@intel.com> From: Mat King Date: Wed, 2 Oct 2019 09:25:09 -0600 Message-ID: Subject: Re: New sysfs interface for privacy screens To: Jani Nikula Cc: Daniel Thompson , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, rafael@kernel.org, Greg KH , Ross Zwisler , Jingoo Han , Rajat Jain , Lee Jones , =?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > >> > > >> > I have been looking into adding Linux support for electronic privacy > >> > screens which is a feature on some new laptops which is built into the > >> > display and allows users to turn it on instead of needing to use a > >> > physical privacy filter. In discussions with my colleagues the idea of > >> > using either /sys/class/backlight or /sys/class/leds but this new > >> > feature does not seem to quite fit into either of those classes. > >> > > >> > I am proposing adding a class called "privacy_screen" to interface > >> > with these devices. The initial API would be simple just a single > >> > property called "privacy_state" which when set to 1 would mean that > >> > privacy is enabled and 0 when privacy is disabled. > >> > > >> > Current known use cases will use ACPI _DSM in order to interface with > >> > the privacy screens, but this class would allow device driver authors > >> > to use other interfaces as well. > >> > > >> > Example: > >> > > >> > # get privacy screen state > >> > cat /sys/class/privacy_screen/cros_privacy/privacy_state # 1: privacy > >> > enabled 0: privacy disabled > >> > > >> > # set privacy enabled > >> > echo 1 > /sys/class/privacy_screen/cros_privacy/privacy_state > >> > > >> > Does this approach seem to be reasonable? > >> > >> What part of the userspace would be managing the privacy screen? Should > >> there be a connection between the display and the privacy screen that > >> covers the display? How would the userspace make that connection if it's > >> a sysfs interface? > >> > >> I don't know how the privacy screen operates, but if it draws any power, > >> you'll want to disable it when you switch off the display it covers. > >> > >> If the privacy screen control was part of the graphics subsystem (say, a > >> DRM connector property, which feels somewhat natural), I think it would > >> make it easier for userspace to have policies such as enabling the > >> privacy screen automatically depending on the content you're viewing, > >> but only if the content is on the display that has a privacy screen. > > > > Connectors versus sysfs came up on a backlight thread recently. > > > > Daniel Vetter wrote an excellent summary on why it has been (and still > > is) difficult to migrate backlight controls towards the DRM connector > > interface: > > https://lkml.org/lkml/2019/8/20/752 > > > > Many of the backlight legacy problems do not apply to privacy screens > > but I do suggest reading this post and some of the neighbouring parts > > of the thread. In particular the ACPI driver versus real driver issues > > Daniel mentioned could occur again. Hopefully not though, I mean how > > wrong can a 1-bit control go? (actually no... don't answer that). > > > > It would definitely be a shame to build up an unnecessary sysfs legacy > > for privacy screens so definitely worth seeing if this can use DRM > > connector properties. > > Indeed. I'm painfully aware of the issues Daniel describes, and that's > part of the motivation for writing this. > > Obviously the problem with associating the privacy screen with the DRM > connector is that then the kernel has to make the connection, somehow, > instead of just making it a userspace problem. > > BR, > Jani. > > -- > Jani Nikula, Intel Open Source Graphics Center I am not familiar with the DRM connector interface and I don't quite understand how it would work in this case. How would the connector provide control to userspace? Is there documentation or example code somewhere that you could point me to? Thanks, Mat King