Re: [PATCH v2 1/1] drivers/misc: add a driver for HPS

From: Sami Kyostila
Date: Sun Feb 06 2022 - 20:09:04 EST


la 5. helmik. 2022 klo 2.27 Greg KH (gregkh@xxxxxxxxxxxxxxxxxxx) kirjoitti:
>
> On Wed, Feb 02, 2022 at 03:49:37PM +1100, Sami Kyöstilä wrote:
> > This patch introduces a driver for the ChromeOS screen privacy
> > sensor (aka. HPS). The driver supports a sensor connected to the I2C bus
> > and identified as "GOOG0020" in the ACPI tables.
> >
> > When loaded, the driver exports the sensor to userspace through a
> > character device. This device only supports power management, i.e.,
> > communication with the sensor must be done through regular I2C
> > transmissions from userspace.
> >
> > Power management is implemented by enabling the respective power GPIO
> > while at least one userspace process holds an open fd on the character
> > device. By default, the device is powered down if there are no active
> > clients.
> >
> > Note that the driver makes no effort to preserve the state of the sensor
> > between power down and power up events. Userspace is responsible for
> > reinitializing any needed state once power has been restored.
> >
> > The device firmware, I2C protocol and other documentation is available
> > at https://chromium.googlesource.com/chromiumos/platform/hps-firmware.
> >
> > Signed-off-by: Sami Kyöstilä <skyostil@xxxxxxxxxxxx>
> > ---
> >
> > Changes in v2:
> > - Removed custom ioctl interface.
> > - Reworked to use miscdev.
> >
> > MAINTAINERS | 6 ++
> > drivers/misc/Kconfig | 10 +++
> > drivers/misc/Makefile | 1 +
> > drivers/misc/hps-i2c.c | 184 +++++++++++++++++++++++++++++++++++++++++
>
> Why isn't this in drivers/platform/chrome/ instead?

Only because I didn't realize that was a thing :) Will move it there instead.

> And what can you do with this hardware when it is enabled? What
> userspace tool uses it?

The hardware is basically an isolated computer vision sensor that
computes a high level inference result (e.g., whether there is a
person in the image) while making sure the raw sensor data (e.g.,
camera images) aren't accessible to the host. It's driven by a
userspace daemon (hpsd) which exposes this functionality to other
ChromeOS components through dbus. There are also some more
developer-oriented userspace tools for updating firmware, reading
debug registers, etc.

Source code for the userspace tools is available at
https://chromium.googlesource.com/chromiumos/platform2/+/HEAD/hps, and
the sensor firmware is at
https://chromium.googlesource.com/chromiumos/platform/hps-firmware.

- Sami

>
> thanks,
>
> greg k-h