Messages in this thread | | | From | Sami Kyostila <> | Date | Fri, 28 Jan 2022 18:42:31 +1100 | Subject | Re: [PATCH 2/2] drivers/misc: add transfer ioctl for HPS |
| |
pe 28. tammik. 2022 klo 9.39 Randy Dunlap (rdunlap@infradead.org) kirjoitti: > > > > 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.
Ah, thanks for the pointer. Will do.
- Sami
> > 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
| |