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

From: Greg KH
Date: Fri Feb 04 2022 - 10:27:12 EST


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?

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

thanks,

greg k-h