blob: d847c760e8f09c49fec028cbe3a7b599cee2e60f [file] [log] [blame]
Laurent Pinchart140d8812010-08-18 11:41:22 -03001/*
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
23#ifndef __LINUX_MEDIA_H
24#define __LINUX_MEDIA_H
25
26#include <linux/ioctl.h>
27#include <linux/types.h>
28#include <linux/version.h>
29
30#define MEDIA_API_VERSION KERNEL_VERSION(0, 1, 0)
31
32struct media_device_info {
33 char driver[16];
34 char model[32];
35 char serial[40];
36 char bus_info[32];
37 __u32 media_version;
38 __u32 hw_revision;
39 __u32 driver_version;
40 __u32 reserved[31];
41};
42
Laurent Pinchart16513332009-12-09 08:40:01 -030043#define MEDIA_ENT_ID_FLAG_NEXT (1 << 31)
44
45#define MEDIA_ENT_TYPE_SHIFT 16
46#define MEDIA_ENT_TYPE_MASK 0x00ff0000
47#define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff
48
49#define MEDIA_ENT_T_DEVNODE (1 << MEDIA_ENT_TYPE_SHIFT)
50#define MEDIA_ENT_T_DEVNODE_V4L (MEDIA_ENT_T_DEVNODE + 1)
51#define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2)
52#define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3)
53#define MEDIA_ENT_T_DEVNODE_DVB (MEDIA_ENT_T_DEVNODE + 4)
54
55#define MEDIA_ENT_T_V4L2_SUBDEV (2 << MEDIA_ENT_TYPE_SHIFT)
56#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV + 1)
57#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV + 2)
58#define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV + 3)
Manjunath Hadlie64171b2013-02-07 13:48:51 -030059/* A converter of analogue video to its digital representation. */
60#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER (MEDIA_ENT_T_V4L2_SUBDEV + 4)
Laurent Pinchart16513332009-12-09 08:40:01 -030061
62#define MEDIA_ENT_FL_DEFAULT (1 << 0)
63
64struct media_entity_desc {
65 __u32 id;
66 char name[32];
67 __u32 type;
68 __u32 revision;
69 __u32 flags;
70 __u32 group_id;
71 __u16 pads;
72 __u16 links;
73
74 __u32 reserved[4];
75
76 union {
77 /* Node specifications */
78 struct {
79 __u32 major;
80 __u32 minor;
81 } v4l;
82 struct {
83 __u32 major;
84 __u32 minor;
85 } fb;
86 struct {
87 __u32 card;
88 __u32 device;
89 __u32 subdevice;
90 } alsa;
91 int dvb;
92
93 /* Sub-device specifications */
94 /* Nothing needed yet */
95 __u8 raw[184];
96 };
97};
98
99#define MEDIA_PAD_FL_SINK (1 << 0)
100#define MEDIA_PAD_FL_SOURCE (1 << 1)
Sakari Ailusd0700c52013-10-13 07:58:43 -0300101#define MEDIA_PAD_FL_MUST_CONNECT (1 << 2)
Laurent Pinchart16513332009-12-09 08:40:01 -0300102
103struct media_pad_desc {
104 __u32 entity; /* entity ID */
105 __u16 index; /* pad index */
106 __u32 flags; /* pad flags */
107 __u32 reserved[2];
108};
109
110#define MEDIA_LNK_FL_ENABLED (1 << 0)
111#define MEDIA_LNK_FL_IMMUTABLE (1 << 1)
Laurent Pincharte02188c2010-08-25 09:00:41 -0300112#define MEDIA_LNK_FL_DYNAMIC (1 << 2)
Laurent Pinchart16513332009-12-09 08:40:01 -0300113
114struct media_link_desc {
115 struct media_pad_desc source;
116 struct media_pad_desc sink;
117 __u32 flags;
118 __u32 reserved[2];
119};
120
121struct media_links_enum {
122 __u32 entity;
123 /* Should have enough room for pads elements */
124 struct media_pad_desc __user *pads;
125 /* Should have enough room for links elements */
126 struct media_link_desc __user *links;
127 __u32 reserved[4];
128};
129
Laurent Pinchart474966e2011-03-05 17:14:33 -0300130#define MEDIA_IOC_DEVICE_INFO _IOWR('|', 0x00, struct media_device_info)
131#define MEDIA_IOC_ENUM_ENTITIES _IOWR('|', 0x01, struct media_entity_desc)
132#define MEDIA_IOC_ENUM_LINKS _IOWR('|', 0x02, struct media_links_enum)
133#define MEDIA_IOC_SETUP_LINK _IOWR('|', 0x03, struct media_link_desc)
Laurent Pinchart140d8812010-08-18 11:41:22 -0300134
135#endif /* __LINUX_MEDIA_H */