media.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /*
  2. * Multimedia device API
  3. *
  4. * Copyright (C) 2010 Nokia Corporation
  5. *
  6. * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
  7. * Sakari Ailus <sakari.ailus@iki.fi>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. */
  22. #ifndef __LINUX_MEDIA_H
  23. #define __LINUX_MEDIA_H
  24. #include <linux/ioctl.h>
  25. #include <linux/types.h>
  26. #include <linux/version.h>
  27. #define MEDIA_API_VERSION KERNEL_VERSION(0, 1, 0)
  28. struct media_device_info {
  29. char driver[16];
  30. char model[32];
  31. char serial[40];
  32. char bus_info[32];
  33. __u32 media_version;
  34. __u32 hw_revision;
  35. __u32 driver_version;
  36. __u32 reserved[31];
  37. };
  38. #define MEDIA_ENT_ID_FLAG_NEXT (1 << 31)
  39. #define MEDIA_ENT_TYPE_SHIFT 16
  40. #define MEDIA_ENT_TYPE_MASK 0x00ff0000
  41. #define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff
  42. #define MEDIA_ENT_T_DEVNODE (1 << MEDIA_ENT_TYPE_SHIFT)
  43. #define MEDIA_ENT_T_DEVNODE_V4L (MEDIA_ENT_T_DEVNODE + 1)
  44. #define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2)
  45. #define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3)
  46. #define MEDIA_ENT_T_DEVNODE_DVB_FE (MEDIA_ENT_T_DEVNODE + 4)
  47. #define MEDIA_ENT_T_DEVNODE_DVB_DEMUX (MEDIA_ENT_T_DEVNODE + 5)
  48. #define MEDIA_ENT_T_DEVNODE_DVB_DVR (MEDIA_ENT_T_DEVNODE + 6)
  49. #define MEDIA_ENT_T_DEVNODE_DVB_CA (MEDIA_ENT_T_DEVNODE + 7)
  50. #define MEDIA_ENT_T_DEVNODE_DVB_NET (MEDIA_ENT_T_DEVNODE + 8)
  51. /* Legacy symbol. Use it to avoid userspace compilation breakages */
  52. #define MEDIA_ENT_T_DEVNODE_DVB MEDIA_ENT_T_DEVNODE_DVB_FE
  53. #define MEDIA_ENT_T_V4L2_SUBDEV (2 << MEDIA_ENT_TYPE_SHIFT)
  54. #define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV + 1)
  55. #define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV + 2)
  56. #define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV + 3)
  57. /* A converter of analogue video to its digital representation. */
  58. #define MEDIA_ENT_T_V4L2_SUBDEV_DECODER (MEDIA_ENT_T_V4L2_SUBDEV + 4)
  59. #define MEDIA_ENT_T_V4L2_SUBDEV_TUNER (MEDIA_ENT_T_V4L2_SUBDEV + 5)
  60. #define MEDIA_ENT_FL_DEFAULT (1 << 0)
  61. struct media_entity_desc {
  62. __u32 id;
  63. char name[32];
  64. __u32 type;
  65. __u32 revision;
  66. __u32 flags;
  67. __u32 group_id;
  68. __u16 pads;
  69. __u16 links;
  70. __u32 reserved[4];
  71. union {
  72. /* Node specifications */
  73. struct {
  74. __u32 major;
  75. __u32 minor;
  76. } dev;
  77. #if 1
  78. /*
  79. * TODO: this shouldn't have been added without
  80. * actual drivers that use this. When the first real driver
  81. * appears that sets this information, special attention
  82. * should be given whether this information is 1) enough, and
  83. * 2) can deal with udev rules that rename devices. The struct
  84. * dev would not be sufficient for this since that does not
  85. * contain the subdevice information. In addition, struct dev
  86. * can only refer to a single device, and not to multiple (e.g.
  87. * pcm and mixer devices).
  88. *
  89. * So for now mark this as a to do.
  90. */
  91. struct {
  92. __u32 card;
  93. __u32 device;
  94. __u32 subdevice;
  95. } alsa;
  96. #endif
  97. #if 1
  98. /*
  99. * DEPRECATED: previous node specifications. Kept just to
  100. * avoid breaking compilation, but media_entity_desc.dev
  101. * should be used instead. In particular, alsa and dvb
  102. * fields below are wrong: for all devnodes, there should
  103. * be just major/minor inside the struct, as this is enough
  104. * to represent any devnode, no matter what type.
  105. */
  106. struct {
  107. __u32 major;
  108. __u32 minor;
  109. } v4l;
  110. struct {
  111. __u32 major;
  112. __u32 minor;
  113. } fb;
  114. int dvb;
  115. #endif
  116. /* Sub-device specifications */
  117. /* Nothing needed yet */
  118. __u8 raw[184];
  119. };
  120. };
  121. #define MEDIA_PAD_FL_SINK (1 << 0)
  122. #define MEDIA_PAD_FL_SOURCE (1 << 1)
  123. #define MEDIA_PAD_FL_MUST_CONNECT (1 << 2)
  124. struct media_pad_desc {
  125. __u32 entity; /* entity ID */
  126. __u16 index; /* pad index */
  127. __u32 flags; /* pad flags */
  128. __u32 reserved[2];
  129. };
  130. #define MEDIA_LNK_FL_ENABLED (1 << 0)
  131. #define MEDIA_LNK_FL_IMMUTABLE (1 << 1)
  132. #define MEDIA_LNK_FL_DYNAMIC (1 << 2)
  133. struct media_link_desc {
  134. struct media_pad_desc source;
  135. struct media_pad_desc sink;
  136. __u32 flags;
  137. __u32 reserved[2];
  138. };
  139. struct media_links_enum {
  140. __u32 entity;
  141. /* Should have enough room for pads elements */
  142. struct media_pad_desc *pads;
  143. /* Should have enough room for links elements */
  144. struct media_link_desc *links;
  145. __u32 reserved[4];
  146. };
  147. #define MEDIA_IOC_DEVICE_INFO _IOWR('|', 0x00, struct media_device_info)
  148. #define MEDIA_IOC_ENUM_ENTITIES _IOWR('|', 0x01, struct media_entity_desc)
  149. #define MEDIA_IOC_ENUM_LINKS _IOWR('|', 0x02, struct media_links_enum)
  150. #define MEDIA_IOC_SETUP_LINK _IOWR('|', 0x03, struct media_link_desc)
  151. #endif /* __LINUX_MEDIA_H */