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