lkml.org 
[lkml]   [2022]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 2/2] drivers/misc: add transfer ioctl for HPS
From


On 1/27/22 00:35, Sami Kyöstilä wrote:
> This patch adds an ioctl operation for sending and receiving data from
> the ChromeOS snooping protection sensor (a.k.a., HPS). This allows
> userspace programs to perform a combined read/write I2C transaction
> through a single syscall.
>
> The I2C wire protocol for the device is documented at:
>
> https://chromium.googlesource.com/chromiumos/platform/hps-firmware/+/
> refs/heads/main/docs/host_device_i2c_protocol.md
>
> Signed-off-by: Sami Kyöstilä <skyostil@chromium.org>
> ---
>
> MAINTAINERS | 1 +
> drivers/misc/hps-i2c.c | 81 ++++++++++++++++++++++++++++++++++++++++
> include/uapi/linux/hps.h | 20 ++++++++++
> 3 files changed, 102 insertions(+)
> create mode 100644 include/uapi/linux/hps.h
>

Hi--

If your next patch version continues to use an ioctl, its magic "number"
('h') should be documented in Documentation/userspace-api/ioctl/ioctl-number.rst.

thanks.

> diff --git a/include/uapi/linux/hps.h b/include/uapi/linux/hps.h
> new file mode 100644
> index 000000000000..2c1bd174cd02
> --- /dev/null
> +++ b/include/uapi/linux/hps.h
> @@ -0,0 +1,20 @@
> +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
> +/*
> + * Copyright 2022 Google LLC.
> + */
> +
> +#ifndef _UAPI_HPS_H
> +#define _UAPI_HPS_H
> +
> +#include <linux/types.h>
> +
> +#define HPS_IOC_TRANSFER _IOWR('h', 0x01, struct hps_transfer_ioctl_data)
> +
> +struct hps_transfer_ioctl_data {
> + __u32 isize; /* Number of bytes to send */
> + unsigned char __user *ibuf; /* Input buffer */
> + __u32 osize; /* Number of bytes to receive */
> + unsigned char __user *obuf; /* Output buffer */
> +};
> +
> +#endif /* _UAPI_HPS_H */

--
~Randy

\
 
 \ /
  Last update: 2022-01-27 23:40    [W:1.749 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site