virtio_i2c.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. #ifndef _LINUX_VIRTIO_I2C_H
  8. #define _LINUX_VIRTIO_I2C_H
  9. #include <linux/const.h>
  10. #include <linux/types.h>
  11. /* Virtio I2C Feature bits */
  12. #define VIRTIO_I2C_F_ZERO_LENGTH_REQUEST 0
  13. /* The bit 0 of the @virtio_i2c_out_hdr.@flags, used to group the requests */
  14. #define VIRTIO_I2C_FLAGS_FAIL_NEXT _BITUL(0)
  15. /* The bit 1 of the @virtio_i2c_out_hdr.@flags, used to mark a buffer as read */
  16. #define VIRTIO_I2C_FLAGS_M_RD _BITUL(1)
  17. /**
  18. * struct virtio_i2c_out_hdr - the virtio I2C message OUT header
  19. * @addr: the controlled device address
  20. * @padding: used to pad to full dword
  21. * @flags: used for feature extensibility
  22. */
  23. struct virtio_i2c_out_hdr {
  24. __le16 addr;
  25. __le16 padding;
  26. __le32 flags;
  27. };
  28. /**
  29. * struct virtio_i2c_in_hdr - the virtio I2C message IN header
  30. * @status: the processing result from the backend
  31. */
  32. struct virtio_i2c_in_hdr {
  33. __u8 status;
  34. };
  35. /* The final status written by the device */
  36. #define VIRTIO_I2C_MSG_OK 0
  37. #define VIRTIO_I2C_MSG_ERR 1
  38. #endif /* _LINUX_VIRTIO_I2C_H */