media.h 3.4 KB

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