media.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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 (MEDIA_ENT_T_DEVNODE + 4)
  47. #define MEDIA_ENT_T_V4L2_SUBDEV (2 << MEDIA_ENT_TYPE_SHIFT)
  48. #define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV + 1)
  49. #define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV + 2)
  50. #define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV + 3)
  51. /* A converter of analogue video to its digital representation. */
  52. #define MEDIA_ENT_T_V4L2_SUBDEV_DECODER (MEDIA_ENT_T_V4L2_SUBDEV + 4)
  53. #define MEDIA_ENT_FL_DEFAULT (1 << 0)
  54. struct media_entity_desc {
  55. __u32 id;
  56. char name[32];
  57. __u32 type;
  58. __u32 revision;
  59. __u32 flags;
  60. __u32 group_id;
  61. __u16 pads;
  62. __u16 links;
  63. __u32 reserved[4];
  64. union {
  65. /* Node specifications */
  66. struct {
  67. __u32 major;
  68. __u32 minor;
  69. } v4l;
  70. struct {
  71. __u32 major;
  72. __u32 minor;
  73. } fb;
  74. struct {
  75. __u32 card;
  76. __u32 device;
  77. __u32 subdevice;
  78. } alsa;
  79. int dvb;
  80. /* Sub-device specifications */
  81. /* Nothing needed yet */
  82. __u8 raw[184];
  83. };
  84. };
  85. #define MEDIA_PAD_FL_SINK (1 << 0)
  86. #define MEDIA_PAD_FL_SOURCE (1 << 1)
  87. struct media_pad_desc {
  88. __u32 entity; /* entity ID */
  89. __u16 index; /* pad index */
  90. __u32 flags; /* pad flags */
  91. __u32 reserved[2];
  92. };
  93. #define MEDIA_LNK_FL_ENABLED (1 << 0)
  94. #define MEDIA_LNK_FL_IMMUTABLE (1 << 1)
  95. #define MEDIA_LNK_FL_DYNAMIC (1 << 2)
  96. struct media_link_desc {
  97. struct media_pad_desc source;
  98. struct media_pad_desc sink;
  99. __u32 flags;
  100. __u32 reserved[2];
  101. };
  102. struct media_links_enum {
  103. __u32 entity;
  104. /* Should have enough room for pads elements */
  105. struct media_pad_desc __user *pads;
  106. /* Should have enough room for links elements */
  107. struct media_link_desc __user *links;
  108. __u32 reserved[4];
  109. };
  110. #define MEDIA_IOC_DEVICE_INFO _IOWR('|', 0x00, struct media_device_info)
  111. #define MEDIA_IOC_ENUM_ENTITIES _IOWR('|', 0x01, struct media_entity_desc)
  112. #define MEDIA_IOC_ENUM_LINKS _IOWR('|', 0x02, struct media_links_enum)
  113. #define MEDIA_IOC_SETUP_LINK _IOWR('|', 0x03, struct media_link_desc)
  114. #endif /* __LINUX_MEDIA_H */