1/* SPDX-License-Identifier: GPL-2.0-or-later WITH Linux-syscall-note */
2/*
3 * Definitions for virtio I2C Adpter
4 *
5 * Copyright (c) 2021 Intel Corporation. All rights reserved.
6 */
7
8#ifndef _UAPI_LINUX_VIRTIO_I2C_H
9#define _UAPI_LINUX_VIRTIO_I2C_H
10
11#include <linux/const.h>
12#include <linux/types.h>
13
14/* Virtio I2C Feature bits */
15#define VIRTIO_I2C_F_ZERO_LENGTH_REQUEST 0
16
17/* The bit 0 of the @virtio_i2c_out_hdr.@flags, used to group the requests */
18#define VIRTIO_I2C_FLAGS_FAIL_NEXT _BITUL(0)
19
20/* The bit 1 of the @virtio_i2c_out_hdr.@flags, used to mark a buffer as read */
21#define VIRTIO_I2C_FLAGS_M_RD _BITUL(1)
22
23/**
24 * struct virtio_i2c_out_hdr - the virtio I2C message OUT header
25 * @addr: the controlled device address
26 * @padding: used to pad to full dword
27 * @flags: used for feature extensibility
28 */
29struct virtio_i2c_out_hdr {
30 __le16 addr;
31 __le16 padding;
32 __le32 flags;
33};
34
35/**
36 * struct virtio_i2c_in_hdr - the virtio I2C message IN header
37 * @status: the processing result from the backend
38 */
39struct virtio_i2c_in_hdr {
40 __u8 status;
41};
42
43/* The final status written by the device */
44#define VIRTIO_I2C_MSG_OK 0
45#define VIRTIO_I2C_MSG_ERR 1
46
47#endif /* _UAPI_LINUX_VIRTIO_I2C_H */
48

source code of linux/include/uapi/linux/virtio_i2c.h