Add a driver for the ChromeOS screen privacy sensor (HPS)
v2 cover Add a driver for the ChromeOS screen privacy sensor (HPS)
This series adds a driver for the ChromeOS screen privacy sensor (a.k.a. HPS) device, attached on the I2C bus. The sensor is a hardware-isolated module which reports a high-level presence signal, e.g., whether there is person in front of the computer or not.
The driver exposes the device to userspace as a character device, which can be used to control the power state of the device. The driver automatically turns power off to the sensor unless a process is using it.
More information about HPS, its firmware and communication protocol can be found at
https://chromium.googlesource.com/chromiumos/platform/hps-firmware.
Changes in v2:
- Removed custom ioctl interface.
- Reworked to use miscdev.
Sami Kyöstilä (1):
drivers/misc: add a driver for HPS
MAINTAINERS | 6 ++ drivers/misc/Kconfig | 10 +++ drivers/misc/Makefile | 1 + drivers/misc/hps-i2c.c | 184 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 201 insertions(+) create mode 100644 drivers/misc/hps-i2c.c
Signature · 1 line
2.35.0.rc2.247.g8bbb082509-goog
PATCH v2 1/1 drivers/misc: add a driver for HPS
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.
---
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 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 201 insertions(+) create mode 100644 drivers/misc/hps-i2c.c
MAINTAINERS +6 -0
@@ -8801,6 +8801,12 @@ S: Maintained W: http://artax.karlin.mff.cuni.cz/~mikulas/vyplody/hpfs/index-e.cgi F: fs/hpfs/ +HPS (ChromeOS snooping protection sensor) DRIVER +M: Sami Kyöstilä <[email protected]> +R: Evan Benn <[email protected]> +S: Maintained +F: drivers/misc/hps-i2c.c + HSI SUBSYSTEM M: Sebastian Reichel <[email protected]> S: Maintained
drivers/misc/Kconfig +10 -0
@@ -244,6 +244,16 @@ config HP_ILO To compile this driver as a module, choose M here: the module will be called hpilo. +config HPS_I2C + tristate "ChromeOS HPS device" + depends on HID && I2C && PM + help + Say Y here if you want to enable support for the ChromeOS + anti-snooping sensor (HPS), attached via I2C. The driver supports a + sensor connected to the I2C bus and exposes it as a character device. + To save power, the sensor is automatically powered down when no + clients are accessing it. + config QCOM_COINCELL tristate "Qualcomm coincell charger support" depends on MFD_SPMI_PMIC || COMPILE_TEST
drivers/misc/Makefile +1 -0
@@ -26,6 +26,7 @@ obj-$(CONFIG_SGI_GRU) += sgi-gru/ obj-$(CONFIG_CS5535_MFGPT) += cs5535-mfgpt.o obj-$(CONFIG_GEHC_ACHC) += gehc-achc.o obj-$(CONFIG_HP_ILO) += hpilo.o +obj-$(CONFIG_HPS_I2C) += hps-i2c.o obj-$(CONFIG_APDS9802ALS) += apds9802als.o obj-$(CONFIG_ISL29003) += isl29003.o obj-$(CONFIG_ISL29020) += isl29020.o
drivers/misc/hps-i2c.c new file +184 -0
184 lines not on this page · raw message
Signature · 1 line
2.35.0.rc2.247.g8bbb082509-goog
Greg KH
maintainerRe: [PATCH v2 1/1] drivers/misc: add a driver for HPS
Quoted 24 lines · Sami Kyöstilä
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ä <[email protected]>---
Quoted 8 lines
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
Re: [PATCH v2 1/1] drivers/misc: add a driver for HPS
la 5. helmik. 2022 klo 2.27 Greg KH ([email protected]) kirjoitti:
Quoted 30 lines · Sami Kyöstilä
Quoted 28 lines
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ä <[email protected]>---
Changes in v2:
- Removed custom ioctl interface.
- Reworked to use miscdev.
Quoted 6 lines
Quoted 4 lines
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.
Quoted 2 lines
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
Quoted 4 lines
thanks,
greg k-h