linux-headers (unknown)

(root)/
include/
linux/
virtio_gpio.h
       1  /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
       2  
       3  #ifndef _LINUX_VIRTIO_GPIO_H
       4  #define _LINUX_VIRTIO_GPIO_H
       5  
       6  #include <linux/types.h>
       7  
       8  /* Virtio GPIO Feature bits */
       9  #define VIRTIO_GPIO_F_IRQ			0
      10  
      11  /* Virtio GPIO request types */
      12  #define VIRTIO_GPIO_MSG_GET_NAMES		0x0001
      13  #define VIRTIO_GPIO_MSG_GET_DIRECTION		0x0002
      14  #define VIRTIO_GPIO_MSG_SET_DIRECTION		0x0003
      15  #define VIRTIO_GPIO_MSG_GET_VALUE		0x0004
      16  #define VIRTIO_GPIO_MSG_SET_VALUE		0x0005
      17  #define VIRTIO_GPIO_MSG_IRQ_TYPE		0x0006
      18  
      19  /* Possible values of the status field */
      20  #define VIRTIO_GPIO_STATUS_OK			0x0
      21  #define VIRTIO_GPIO_STATUS_ERR			0x1
      22  
      23  /* Direction types */
      24  #define VIRTIO_GPIO_DIRECTION_NONE		0x00
      25  #define VIRTIO_GPIO_DIRECTION_OUT		0x01
      26  #define VIRTIO_GPIO_DIRECTION_IN		0x02
      27  
      28  /* Virtio GPIO IRQ types */
      29  #define VIRTIO_GPIO_IRQ_TYPE_NONE		0x00
      30  #define VIRTIO_GPIO_IRQ_TYPE_EDGE_RISING	0x01
      31  #define VIRTIO_GPIO_IRQ_TYPE_EDGE_FALLING	0x02
      32  #define VIRTIO_GPIO_IRQ_TYPE_EDGE_BOTH		0x03
      33  #define VIRTIO_GPIO_IRQ_TYPE_LEVEL_HIGH		0x04
      34  #define VIRTIO_GPIO_IRQ_TYPE_LEVEL_LOW		0x08
      35  
      36  struct virtio_gpio_config {
      37  	__le16 ngpio;
      38  	__u8 padding[2];
      39  	__le32 gpio_names_size;
      40  };
      41  
      42  /* Virtio GPIO Request / Response */
      43  struct virtio_gpio_request {
      44  	__le16 type;
      45  	__le16 gpio;
      46  	__le32 value;
      47  };
      48  
      49  struct virtio_gpio_response {
      50  	__u8 status;
      51  	__u8 value;
      52  };
      53  
      54  struct virtio_gpio_response_get_names {
      55  	__u8 status;
      56  	__u8 value[];
      57  };
      58  
      59  /* Virtio GPIO IRQ Request / Response */
      60  struct virtio_gpio_irq_request {
      61  	__le16 gpio;
      62  };
      63  
      64  struct virtio_gpio_irq_response {
      65  	__u8 status;
      66  };
      67  
      68  /* Possible values of the interrupt status field */
      69  #define VIRTIO_GPIO_IRQ_STATUS_INVALID		0x0
      70  #define VIRTIO_GPIO_IRQ_STATUS_VALID		0x1
      71  
      72  #endif /* _LINUX_VIRTIO_GPIO_H */