aboutsummaryrefslogtreecommitdiffstats
path: root/include/media
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-09-05 21:21:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-05 21:21:14 -0400
commit9cfcc658da9693f65e7224e8329e40ada2f3c699 (patch)
tree44fb518eee069733f3f895177899815e7c89e5b0 /include/media
parente3a98ac47698bf1c1e4e6fae72afc9866953fce5 (diff)
parent50ef28a6ac216fd8b796257a3768fef8f57b917d (diff)
Merge tag 'media/v4.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab: - new DVB frontend drivers: ascot2e, cxd2841er, horus3a, lnbh25 - new HDMI capture driver: tc358743 - new driver for NetUP DVB new boards (netup_unidvb) - IR support for DVBSky cards (smipcie-ir) - Coda driver has gain macroblock tiling support - Renesas R-Car gains JPEG codec driver - new DVB platform driver for STi boards: c8sectpfe - added documentation for the media core kABI to device-drivers DocBook - lots of driver fixups, cleanups and improvements * tag 'media/v4.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (297 commits) [media] c8sectpfe: Remove select on undefined LIBELF_32 [media] i2c: fix platform_no_drv_owner.cocci warnings [media] cx231xx: Use wake_up_interruptible() instead of wake_up_interruptible_nr() [media] tc358743: only queue subdev notifications if devnode is set [media] tc358743: add missing Kconfig dependency/select [media] c8sectpfe: Use %pad to print 'dma_addr_t' [media] DocBook media: Fix typo "the the" in xml files [media] tc358743: make reset gpio optional [media] tc358743: set direction of reset gpio using devm_gpiod_get [media] dvbdev: document most of the functions/data structs [media] dvb_frontend.h: document the struct dvb_frontend [media] dvb-frontend.h: document struct dtv_frontend_properties [media] dvb-frontend.h: document struct dvb_frontend_ops [media] dvb: Use DVBFE_ALGO_HW where applicable [media] dvb_frontend.h: document struct analog_demod_ops [media] dvb_frontend.h: Document struct dvb_tuner_ops [media] Docbook: Document struct analog_parameters [media] dvb_frontend.h: get rid of dvbfe_modcod [media] add documentation for struct dvb_tuner_info [media] dvb_frontend: document dvb_frontend_tune_settings ...
Diffstat (limited to 'include/media')
-rw-r--r--include/media/media-devnode.h4
-rw-r--r--include/media/omap3isp.h158
-rw-r--r--include/media/rc-core.h6
-rw-r--r--include/media/rc-map.h38
-rw-r--r--include/media/tc358743.h131
-rw-r--r--include/media/v4l2-async.h8
-rw-r--r--include/media/v4l2-ctrls.h1018
-rw-r--r--include/media/v4l2-dv-timings.h141
-rw-r--r--include/media/v4l2-event.h47
-rw-r--r--include/media/v4l2-flash-led-class.h12
-rw-r--r--include/media/v4l2-mediabus.h4
-rw-r--r--include/media/v4l2-mem2mem.h20
-rw-r--r--include/media/v4l2-subdev.h376
-rw-r--r--include/media/videobuf2-core.h10
-rw-r--r--include/media/videobuf2-memops.h3
15 files changed, 1111 insertions, 865 deletions
diff --git a/include/media/media-devnode.h b/include/media/media-devnode.h
index 0dc7060f9625..17ddae32060d 100644
--- a/include/media/media-devnode.h
+++ b/include/media/media-devnode.h
@@ -53,9 +53,13 @@ struct media_file_operations {
53 53
54/** 54/**
55 * struct media_devnode - Media device node 55 * struct media_devnode - Media device node
56 * @fops: pointer to struct media_file_operations with media device ops
57 * @dev: struct device pointer for the media controller device
58 * @cdev: struct cdev pointer character device
56 * @parent: parent device 59 * @parent: parent device
57 * @minor: device node minor number 60 * @minor: device node minor number
58 * @flags: flags, combination of the MEDIA_FLAG_* constants 61 * @flags: flags, combination of the MEDIA_FLAG_* constants
62 * @release: release callback called at the end of media_devnode_release()
59 * 63 *
60 * This structure represents a media-related device node. 64 * This structure represents a media-related device node.
61 * 65 *
diff --git a/include/media/omap3isp.h b/include/media/omap3isp.h
deleted file mode 100644
index 048f8f9117ef..000000000000
--- a/include/media/omap3isp.h
+++ /dev/null
@@ -1,158 +0,0 @@
1/*
2 * omap3isp.h
3 *
4 * TI OMAP3 ISP - Platform data
5 *
6 * Copyright (C) 2011 Nokia Corporation
7 *
8 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 * Sakari Ailus <sakari.ailus@iki.fi>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23 * 02110-1301 USA
24 */
25
26#ifndef __MEDIA_OMAP3ISP_H__
27#define __MEDIA_OMAP3ISP_H__
28
29struct i2c_board_info;
30struct isp_device;
31
32enum isp_interface_type {
33 ISP_INTERFACE_PARALLEL,
34 ISP_INTERFACE_CSI2A_PHY2,
35 ISP_INTERFACE_CCP2B_PHY1,
36 ISP_INTERFACE_CCP2B_PHY2,
37 ISP_INTERFACE_CSI2C_PHY1,
38};
39
40enum {
41 ISP_LANE_SHIFT_0 = 0,
42 ISP_LANE_SHIFT_2 = 1,
43 ISP_LANE_SHIFT_4 = 2,
44 ISP_LANE_SHIFT_6 = 3,
45};
46
47/**
48 * struct isp_parallel_cfg - Parallel interface configuration
49 * @data_lane_shift: Data lane shifter
50 * ISP_LANE_SHIFT_0 - CAMEXT[13:0] -> CAM[13:0]
51 * ISP_LANE_SHIFT_2 - CAMEXT[13:2] -> CAM[11:0]
52 * ISP_LANE_SHIFT_4 - CAMEXT[13:4] -> CAM[9:0]
53 * ISP_LANE_SHIFT_6 - CAMEXT[13:6] -> CAM[7:0]
54 * @clk_pol: Pixel clock polarity
55 * 0 - Sample on rising edge, 1 - Sample on falling edge
56 * @hs_pol: Horizontal synchronization polarity
57 * 0 - Active high, 1 - Active low
58 * @vs_pol: Vertical synchronization polarity
59 * 0 - Active high, 1 - Active low
60 * @fld_pol: Field signal polarity
61 * 0 - Positive, 1 - Negative
62 * @data_pol: Data polarity
63 * 0 - Normal, 1 - One's complement
64 */
65struct isp_parallel_cfg {
66 unsigned int data_lane_shift:2;
67 unsigned int clk_pol:1;
68 unsigned int hs_pol:1;
69 unsigned int vs_pol:1;
70 unsigned int fld_pol:1;
71 unsigned int data_pol:1;
72};
73
74enum {
75 ISP_CCP2_PHY_DATA_CLOCK = 0,
76 ISP_CCP2_PHY_DATA_STROBE = 1,
77};
78
79enum {
80 ISP_CCP2_MODE_MIPI = 0,
81 ISP_CCP2_MODE_CCP2 = 1,
82};
83
84/**
85 * struct isp_csiphy_lane: CCP2/CSI2 lane position and polarity
86 * @pos: position of the lane
87 * @pol: polarity of the lane
88 */
89struct isp_csiphy_lane {
90 u8 pos;
91 u8 pol;
92};
93
94#define ISP_CSIPHY1_NUM_DATA_LANES 1
95#define ISP_CSIPHY2_NUM_DATA_LANES 2
96
97/**
98 * struct isp_csiphy_lanes_cfg - CCP2/CSI2 lane configuration
99 * @data: Configuration of one or two data lanes
100 * @clk: Clock lane configuration
101 */
102struct isp_csiphy_lanes_cfg {
103 struct isp_csiphy_lane data[ISP_CSIPHY2_NUM_DATA_LANES];
104 struct isp_csiphy_lane clk;
105};
106
107/**
108 * struct isp_ccp2_cfg - CCP2 interface configuration
109 * @strobe_clk_pol: Strobe/clock polarity
110 * 0 - Non Inverted, 1 - Inverted
111 * @crc: Enable the cyclic redundancy check
112 * @ccp2_mode: Enable CCP2 compatibility mode
113 * ISP_CCP2_MODE_MIPI - MIPI-CSI1 mode
114 * ISP_CCP2_MODE_CCP2 - CCP2 mode
115 * @phy_layer: Physical layer selection
116 * ISP_CCP2_PHY_DATA_CLOCK - Data/clock physical layer
117 * ISP_CCP2_PHY_DATA_STROBE - Data/strobe physical layer
118 * @vpclk_div: Video port output clock control
119 */
120struct isp_ccp2_cfg {
121 unsigned int strobe_clk_pol:1;
122 unsigned int crc:1;
123 unsigned int ccp2_mode:1;
124 unsigned int phy_layer:1;
125 unsigned int vpclk_div:2;
126 struct isp_csiphy_lanes_cfg lanecfg;
127};
128
129/**
130 * struct isp_csi2_cfg - CSI2 interface configuration
131 * @crc: Enable the cyclic redundancy check
132 */
133struct isp_csi2_cfg {
134 unsigned crc:1;
135 struct isp_csiphy_lanes_cfg lanecfg;
136};
137
138struct isp_bus_cfg {
139 enum isp_interface_type interface;
140 union {
141 struct isp_parallel_cfg parallel;
142 struct isp_ccp2_cfg ccp2;
143 struct isp_csi2_cfg csi2;
144 } bus; /* gcc < 4.6.0 chokes on anonymous union initializers */
145};
146
147struct isp_platform_subdev {
148 struct i2c_board_info *board_info;
149 int i2c_adapter_id;
150 struct isp_bus_cfg *bus;
151};
152
153struct isp_platform_data {
154 struct isp_platform_subdev *subdevs;
155 void (*set_constraints)(struct isp_device *isp, bool enable);
156};
157
158#endif /* __MEDIA_OMAP3ISP_H__ */
diff --git a/include/media/rc-core.h b/include/media/rc-core.h
index 644bdc61c387..ec921f6538c7 100644
--- a/include/media/rc-core.h
+++ b/include/media/rc-core.h
@@ -69,7 +69,7 @@ enum rc_filter_type {
69 * @rc_map: current scan/key table 69 * @rc_map: current scan/key table
70 * @lock: used to ensure we've filled in all protocol details before 70 * @lock: used to ensure we've filled in all protocol details before
71 * anyone can call show_protocols or store_protocols 71 * anyone can call show_protocols or store_protocols
72 * @devno: unique remote control device number 72 * @minor: unique minor remote control device number
73 * @raw: additional data for raw pulse/space devices 73 * @raw: additional data for raw pulse/space devices
74 * @input_dev: the input child device used to communicate events to userspace 74 * @input_dev: the input child device used to communicate events to userspace
75 * @driver_type: specifies if protocol decoding is done in hardware or software 75 * @driver_type: specifies if protocol decoding is done in hardware or software
@@ -110,7 +110,7 @@ enum rc_filter_type {
110 * @s_tx_mask: set transmitter mask (for devices with multiple tx outputs) 110 * @s_tx_mask: set transmitter mask (for devices with multiple tx outputs)
111 * @s_tx_carrier: set transmit carrier frequency 111 * @s_tx_carrier: set transmit carrier frequency
112 * @s_tx_duty_cycle: set transmit duty cycle (0% - 100%) 112 * @s_tx_duty_cycle: set transmit duty cycle (0% - 100%)
113 * @s_rx_carrier: inform driver about carrier it is expected to handle 113 * @s_rx_carrier_range: inform driver about carrier it is expected to handle
114 * @tx_ir: transmit IR 114 * @tx_ir: transmit IR
115 * @s_idle: enable/disable hardware idle mode, upon which, 115 * @s_idle: enable/disable hardware idle mode, upon which,
116 * device doesn't interrupt host until it sees IR pulses 116 * device doesn't interrupt host until it sees IR pulses
@@ -129,7 +129,7 @@ struct rc_dev {
129 const char *map_name; 129 const char *map_name;
130 struct rc_map rc_map; 130 struct rc_map rc_map;
131 struct mutex lock; 131 struct mutex lock;
132 unsigned long devno; 132 unsigned int minor;
133 struct ir_raw_event_ctrl *raw; 133 struct ir_raw_event_ctrl *raw;
134 struct input_dev *input_dev; 134 struct input_dev *input_dev;
135 enum rc_driver_type driver_type; 135 enum rc_driver_type driver_type;
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index 27763d5bd261..7c4bbc4dfab4 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -14,30 +14,28 @@
14enum rc_type { 14enum rc_type {
15 RC_TYPE_UNKNOWN = 0, /* Protocol not known */ 15 RC_TYPE_UNKNOWN = 0, /* Protocol not known */
16 RC_TYPE_OTHER = 1, /* Protocol known but proprietary */ 16 RC_TYPE_OTHER = 1, /* Protocol known but proprietary */
17 RC_TYPE_LIRC = 2, /* Pass raw IR to lirc userspace */ 17 RC_TYPE_RC5 = 2, /* Philips RC5 protocol */
18 RC_TYPE_RC5 = 3, /* Philips RC5 protocol */ 18 RC_TYPE_RC5X = 3, /* Philips RC5x protocol */
19 RC_TYPE_RC5X = 4, /* Philips RC5x protocol */ 19 RC_TYPE_RC5_SZ = 4, /* StreamZap variant of RC5 */
20 RC_TYPE_RC5_SZ = 5, /* StreamZap variant of RC5 */ 20 RC_TYPE_JVC = 5, /* JVC protocol */
21 RC_TYPE_JVC = 6, /* JVC protocol */ 21 RC_TYPE_SONY12 = 6, /* Sony 12 bit protocol */
22 RC_TYPE_SONY12 = 7, /* Sony 12 bit protocol */ 22 RC_TYPE_SONY15 = 7, /* Sony 15 bit protocol */
23 RC_TYPE_SONY15 = 8, /* Sony 15 bit protocol */ 23 RC_TYPE_SONY20 = 8, /* Sony 20 bit protocol */
24 RC_TYPE_SONY20 = 9, /* Sony 20 bit protocol */ 24 RC_TYPE_NEC = 9, /* NEC protocol */
25 RC_TYPE_NEC = 10, /* NEC protocol */ 25 RC_TYPE_SANYO = 10, /* Sanyo protocol */
26 RC_TYPE_SANYO = 11, /* Sanyo protocol */ 26 RC_TYPE_MCE_KBD = 11, /* RC6-ish MCE keyboard/mouse */
27 RC_TYPE_MCE_KBD = 12, /* RC6-ish MCE keyboard/mouse */ 27 RC_TYPE_RC6_0 = 12, /* Philips RC6-0-16 protocol */
28 RC_TYPE_RC6_0 = 13, /* Philips RC6-0-16 protocol */ 28 RC_TYPE_RC6_6A_20 = 13, /* Philips RC6-6A-20 protocol */
29 RC_TYPE_RC6_6A_20 = 14, /* Philips RC6-6A-20 protocol */ 29 RC_TYPE_RC6_6A_24 = 14, /* Philips RC6-6A-24 protocol */
30 RC_TYPE_RC6_6A_24 = 15, /* Philips RC6-6A-24 protocol */ 30 RC_TYPE_RC6_6A_32 = 15, /* Philips RC6-6A-32 protocol */
31 RC_TYPE_RC6_6A_32 = 16, /* Philips RC6-6A-32 protocol */ 31 RC_TYPE_RC6_MCE = 16, /* MCE (Philips RC6-6A-32 subtype) protocol */
32 RC_TYPE_RC6_MCE = 17, /* MCE (Philips RC6-6A-32 subtype) protocol */ 32 RC_TYPE_SHARP = 17, /* Sharp protocol */
33 RC_TYPE_SHARP = 18, /* Sharp protocol */ 33 RC_TYPE_XMP = 18, /* XMP protocol */
34 RC_TYPE_XMP = 19, /* XMP protocol */
35}; 34};
36 35
37#define RC_BIT_NONE 0 36#define RC_BIT_NONE 0
38#define RC_BIT_UNKNOWN (1 << RC_TYPE_UNKNOWN) 37#define RC_BIT_UNKNOWN (1 << RC_TYPE_UNKNOWN)
39#define RC_BIT_OTHER (1 << RC_TYPE_OTHER) 38#define RC_BIT_OTHER (1 << RC_TYPE_OTHER)
40#define RC_BIT_LIRC (1 << RC_TYPE_LIRC)
41#define RC_BIT_RC5 (1 << RC_TYPE_RC5) 39#define RC_BIT_RC5 (1 << RC_TYPE_RC5)
42#define RC_BIT_RC5X (1 << RC_TYPE_RC5X) 40#define RC_BIT_RC5X (1 << RC_TYPE_RC5X)
43#define RC_BIT_RC5_SZ (1 << RC_TYPE_RC5_SZ) 41#define RC_BIT_RC5_SZ (1 << RC_TYPE_RC5_SZ)
@@ -56,7 +54,7 @@ enum rc_type {
56#define RC_BIT_SHARP (1 << RC_TYPE_SHARP) 54#define RC_BIT_SHARP (1 << RC_TYPE_SHARP)
57#define RC_BIT_XMP (1 << RC_TYPE_XMP) 55#define RC_BIT_XMP (1 << RC_TYPE_XMP)
58 56
59#define RC_BIT_ALL (RC_BIT_UNKNOWN | RC_BIT_OTHER | RC_BIT_LIRC | \ 57#define RC_BIT_ALL (RC_BIT_UNKNOWN | RC_BIT_OTHER | \
60 RC_BIT_RC5 | RC_BIT_RC5X | RC_BIT_RC5_SZ | \ 58 RC_BIT_RC5 | RC_BIT_RC5X | RC_BIT_RC5_SZ | \
61 RC_BIT_JVC | \ 59 RC_BIT_JVC | \
62 RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20 | \ 60 RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20 | \
diff --git a/include/media/tc358743.h b/include/media/tc358743.h
new file mode 100644
index 000000000000..4513f2f9cfbc
--- /dev/null
+++ b/include/media/tc358743.h
@@ -0,0 +1,131 @@
1/*
2 * tc358743 - Toshiba HDMI to CSI-2 bridge
3 *
4 * Copyright 2015 Cisco Systems, Inc. and/or its affiliates. All rights
5 * reserved.
6 *
7 * This program is free software; you may redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
12 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
13 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
15 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
16 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
17 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18 * SOFTWARE.
19 *
20 */
21
22/*
23 * References (c = chapter, p = page):
24 * REF_01 - Toshiba, TC358743XBG (H2C), Functional Specification, Rev 0.60
25 * REF_02 - Toshiba, TC358743XBG_HDMI-CSI_Tv11p_nm.xls
26 */
27
28#ifndef _TC358743_
29#define _TC358743_
30
31enum tc358743_ddc5v_delays {
32 DDC5V_DELAY_0_MS,
33 DDC5V_DELAY_50_MS,
34 DDC5V_DELAY_100_MS,
35 DDC5V_DELAY_200_MS,
36};
37
38enum tc358743_hdmi_detection_delay {
39 HDMI_MODE_DELAY_0_MS,
40 HDMI_MODE_DELAY_25_MS,
41 HDMI_MODE_DELAY_50_MS,
42 HDMI_MODE_DELAY_100_MS,
43};
44
45struct tc358743_platform_data {
46 /* System clock connected to REFCLK (pin H5) */
47 u32 refclk_hz; /* 26 MHz, 27 MHz or 42 MHz */
48
49 /* DDC +5V debounce delay to avoid spurious interrupts when the cable
50 * is connected.
51 * Sets DDC5V_MODE in register DDC_CTL.
52 * Default: DDC5V_DELAY_0_MS
53 */
54 enum tc358743_ddc5v_delays ddc5v_delay;
55
56 bool enable_hdcp;
57
58 /*
59 * The FIFO size is 512x32, so Toshiba recommend to set the default FIFO
60 * level to somewhere in the middle (e.g. 300), so it can cover speed
61 * mismatches in input and output ports.
62 */
63 u16 fifo_level;
64
65 /* Bps pr lane is (refclk_hz / pll_prd) * pll_fbd */
66 u16 pll_prd;
67 u16 pll_fbd;
68
69 /* CSI
70 * Calculate CSI parameters with REF_02 for the highest resolution your
71 * CSI interface can handle. The driver will adjust the number of CSI
72 * lanes in use according to the pixel clock.
73 *
74 * The values in brackets are calculated with REF_02 when the number of
75 * bps pr lane is 823.5 MHz, and can serve as a starting point.
76 */
77 u32 lineinitcnt; /* (0x00001770) */
78 u32 lptxtimecnt; /* (0x00000005) */
79 u32 tclk_headercnt; /* (0x00001d04) */
80 u32 tclk_trailcnt; /* (0x00000000) */
81 u32 ths_headercnt; /* (0x00000505) */
82 u32 twakeup; /* (0x00004650) */
83 u32 tclk_postcnt; /* (0x00000000) */
84 u32 ths_trailcnt; /* (0x00000004) */
85 u32 hstxvregcnt; /* (0x00000005) */
86
87 /* DVI->HDMI detection delay to avoid unnecessary switching between DVI
88 * and HDMI mode.
89 * Sets HDMI_DET_V in register HDMI_DET.
90 * Default: HDMI_MODE_DELAY_0_MS
91 */
92 enum tc358743_hdmi_detection_delay hdmi_detection_delay;
93
94 /* Reset PHY automatically when TMDS clock goes from DC to AC.
95 * Sets PHY_AUTO_RST2 in register PHY_CTL2.
96 * Default: false
97 */
98 bool hdmi_phy_auto_reset_tmds_detected;
99
100 /* Reset PHY automatically when TMDS clock passes 21 MHz.
101 * Sets PHY_AUTO_RST3 in register PHY_CTL2.
102 * Default: false
103 */
104 bool hdmi_phy_auto_reset_tmds_in_range;
105
106 /* Reset PHY automatically when TMDS clock is detected.
107 * Sets PHY_AUTO_RST4 in register PHY_CTL2.
108 * Default: false
109 */
110 bool hdmi_phy_auto_reset_tmds_valid;
111
112 /* Reset HDMI PHY automatically when hsync period is out of range.
113 * Sets H_PI_RST in register HV_RST.
114 * Default: false
115 */
116 bool hdmi_phy_auto_reset_hsync_out_of_range;
117
118 /* Reset HDMI PHY automatically when vsync period is out of range.
119 * Sets V_PI_RST in register HV_RST.
120 * Default: false
121 */
122 bool hdmi_phy_auto_reset_vsync_out_of_range;
123};
124
125/* custom controls */
126/* Audio sample rate in Hz */
127#define TC358743_CID_AUDIO_SAMPLING_RATE (V4L2_CID_USER_TC358743_BASE + 0)
128/* Audio present status */
129#define TC358743_CID_AUDIO_PRESENT (V4L2_CID_USER_TC358743_BASE + 1)
130
131#endif
diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h
index 768356917bea..1d6d7da4c45d 100644
--- a/include/media/v4l2-async.h
+++ b/include/media/v4l2-async.h
@@ -32,7 +32,8 @@ enum v4l2_async_match_type {
32 32
33/** 33/**
34 * struct v4l2_async_subdev - sub-device descriptor, as known to a bridge 34 * struct v4l2_async_subdev - sub-device descriptor, as known to a bridge
35 * @bus_type: subdevice bus type to select the appropriate matching method 35 *
36 * @match_type: type of match that will be used
36 * @match: union of per-bus type matching data sets 37 * @match: union of per-bus type matching data sets
37 * @list: used to link struct v4l2_async_subdev objects, waiting to be 38 * @list: used to link struct v4l2_async_subdev objects, waiting to be
38 * probed, to a notifier->waiting list 39 * probed, to a notifier->waiting list
@@ -62,8 +63,9 @@ struct v4l2_async_subdev {
62}; 63};
63 64
64/** 65/**
65 * v4l2_async_notifier - v4l2_device notifier data 66 * struct v4l2_async_notifier - v4l2_device notifier data
66 * @num_subdevs:number of subdevices 67 *
68 * @num_subdevs: number of subdevices
67 * @subdevs: array of pointers to subdevice descriptors 69 * @subdevs: array of pointers to subdevice descriptors
68 * @v4l2_dev: pointer to struct v4l2_device 70 * @v4l2_dev: pointer to struct v4l2_device
69 * @waiting: list of struct v4l2_async_subdev, waiting for their drivers 71 * @waiting: list of struct v4l2_async_subdev, waiting for their drivers
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 911f3e542834..da6fe9802fee 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -36,7 +36,8 @@ struct v4l2_subscribed_event;
36struct v4l2_fh; 36struct v4l2_fh;
37struct poll_table_struct; 37struct poll_table_struct;
38 38
39/** union v4l2_ctrl_ptr - A pointer to a control value. 39/**
40 * union v4l2_ctrl_ptr - A pointer to a control value.
40 * @p_s32: Pointer to a 32-bit signed value. 41 * @p_s32: Pointer to a 32-bit signed value.
41 * @p_s64: Pointer to a 64-bit signed value. 42 * @p_s64: Pointer to a 64-bit signed value.
42 * @p_u8: Pointer to a 8-bit unsigned value. 43 * @p_u8: Pointer to a 8-bit unsigned value.
@@ -55,30 +56,34 @@ union v4l2_ctrl_ptr {
55 void *p; 56 void *p;
56}; 57};
57 58
58/** struct v4l2_ctrl_ops - The control operations that the driver has to provide. 59/**
59 * @g_volatile_ctrl: Get a new value for this control. Generally only relevant 60 * struct v4l2_ctrl_ops - The control operations that the driver has to provide.
60 * for volatile (and usually read-only) controls such as a control 61 * @g_volatile_ctrl: Get a new value for this control. Generally only relevant
61 * that returns the current signal strength which changes 62 * for volatile (and usually read-only) controls such as a control
62 * continuously. 63 * that returns the current signal strength which changes
63 * If not set, then the currently cached value will be returned. 64 * continuously.
64 * @try_ctrl: Test whether the control's value is valid. Only relevant when 65 * If not set, then the currently cached value will be returned.
65 * the usual min/max/step checks are not sufficient. 66 * @try_ctrl: Test whether the control's value is valid. Only relevant when
66 * @s_ctrl: Actually set the new control value. s_ctrl is compulsory. The 67 * the usual min/max/step checks are not sufficient.
67 * ctrl->handler->lock is held when these ops are called, so no 68 * @s_ctrl: Actually set the new control value. s_ctrl is compulsory. The
68 * one else can access controls owned by that handler. 69 * ctrl->handler->lock is held when these ops are called, so no
69 */ 70 * one else can access controls owned by that handler.
71 */
70struct v4l2_ctrl_ops { 72struct v4l2_ctrl_ops {
71 int (*g_volatile_ctrl)(struct v4l2_ctrl *ctrl); 73 int (*g_volatile_ctrl)(struct v4l2_ctrl *ctrl);
72 int (*try_ctrl)(struct v4l2_ctrl *ctrl); 74 int (*try_ctrl)(struct v4l2_ctrl *ctrl);
73 int (*s_ctrl)(struct v4l2_ctrl *ctrl); 75 int (*s_ctrl)(struct v4l2_ctrl *ctrl);
74}; 76};
75 77
76/** struct v4l2_ctrl_type_ops - The control type operations that the driver has to provide. 78/**
77 * @equal: return true if both values are equal. 79 * struct v4l2_ctrl_type_ops - The control type operations that the driver
78 * @init: initialize the value. 80 * has to provide.
79 * @log: log the value. 81 *
80 * @validate: validate the value. Return 0 on success and a negative value otherwise. 82 * @equal: return true if both values are equal.
81 */ 83 * @init: initialize the value.
84 * @log: log the value.
85 * @validate: validate the value. Return 0 on success and a negative value otherwise.
86 */
82struct v4l2_ctrl_type_ops { 87struct v4l2_ctrl_type_ops {
83 bool (*equal)(const struct v4l2_ctrl *ctrl, u32 idx, 88 bool (*equal)(const struct v4l2_ctrl *ctrl, u32 idx,
84 union v4l2_ctrl_ptr ptr1, 89 union v4l2_ctrl_ptr ptr1,
@@ -92,74 +97,80 @@ struct v4l2_ctrl_type_ops {
92 97
93typedef void (*v4l2_ctrl_notify_fnc)(struct v4l2_ctrl *ctrl, void *priv); 98typedef void (*v4l2_ctrl_notify_fnc)(struct v4l2_ctrl *ctrl, void *priv);
94 99
95/** struct v4l2_ctrl - The control structure. 100/**
96 * @node: The list node. 101 * struct v4l2_ctrl - The control structure.
97 * @ev_subs: The list of control event subscriptions. 102 * @node: The list node.
98 * @handler: The handler that owns the control. 103 * @ev_subs: The list of control event subscriptions.
99 * @cluster: Point to start of cluster array. 104 * @handler: The handler that owns the control.
100 * @ncontrols: Number of controls in cluster array. 105 * @cluster: Point to start of cluster array.
101 * @done: Internal flag: set for each processed control. 106 * @ncontrols: Number of controls in cluster array.
102 * @is_new: Set when the user specified a new value for this control. It 107 * @done: Internal flag: set for each processed control.
103 * is also set when called from v4l2_ctrl_handler_setup. Drivers 108 * @is_new: Set when the user specified a new value for this control. It
104 * should never set this flag. 109 * is also set when called from v4l2_ctrl_handler_setup. Drivers
105 * @has_changed: Set when the current value differs from the new value. Drivers 110 * should never set this flag.
106 * should never use this flag. 111 * @has_changed: Set when the current value differs from the new value. Drivers
107 * @is_private: If set, then this control is private to its handler and it 112 * should never use this flag.
108 * will not be added to any other handlers. Drivers can set 113 * @is_private: If set, then this control is private to its handler and it
109 * this flag. 114 * will not be added to any other handlers. Drivers can set
110 * @is_auto: If set, then this control selects whether the other cluster 115 * this flag.
111 * members are in 'automatic' mode or 'manual' mode. This is 116 * @is_auto: If set, then this control selects whether the other cluster
112 * used for autogain/gain type clusters. Drivers should never 117 * members are in 'automatic' mode or 'manual' mode. This is
113 * set this flag directly. 118 * used for autogain/gain type clusters. Drivers should never
114 * @is_int: If set, then this control has a simple integer value (i.e. it 119 * set this flag directly.
115 * uses ctrl->val). 120 * @is_int: If set, then this control has a simple integer value (i.e. it
116 * @is_string: If set, then this control has type V4L2_CTRL_TYPE_STRING. 121 * uses ctrl->val).
117 * @is_ptr: If set, then this control is an array and/or has type >= V4L2_CTRL_COMPOUND_TYPES 122 * @is_string: If set, then this control has type V4L2_CTRL_TYPE_STRING.
118 * and/or has type V4L2_CTRL_TYPE_STRING. In other words, struct 123 * @is_ptr: If set, then this control is an array and/or has type >= V4L2_CTRL_COMPOUND_TYPES
119 * v4l2_ext_control uses field p to point to the data. 124 * and/or has type V4L2_CTRL_TYPE_STRING. In other words, struct
120 * @is_array: If set, then this control contains an N-dimensional array. 125 * v4l2_ext_control uses field p to point to the data.
121 * @has_volatiles: If set, then one or more members of the cluster are volatile. 126 * @is_array: If set, then this control contains an N-dimensional array.
122 * Drivers should never touch this flag. 127 * @has_volatiles: If set, then one or more members of the cluster are volatile.
123 * @call_notify: If set, then call the handler's notify function whenever the 128 * Drivers should never touch this flag.
124 * control's value changes. 129 * @call_notify: If set, then call the handler's notify function whenever the
125 * @manual_mode_value: If the is_auto flag is set, then this is the value 130 * control's value changes.
126 * of the auto control that determines if that control is in 131 * @manual_mode_value: If the is_auto flag is set, then this is the value
127 * manual mode. So if the value of the auto control equals this 132 * of the auto control that determines if that control is in
128 * value, then the whole cluster is in manual mode. Drivers should 133 * manual mode. So if the value of the auto control equals this
129 * never set this flag directly. 134 * value, then the whole cluster is in manual mode. Drivers should
130 * @ops: The control ops. 135 * never set this flag directly.
131 * @type_ops: The control type ops. 136 * @ops: The control ops.
132 * @id: The control ID. 137 * @type_ops: The control type ops.
133 * @name: The control name. 138 * @id: The control ID.
134 * @type: The control type. 139 * @name: The control name.
135 * @minimum: The control's minimum value. 140 * @type: The control type.
136 * @maximum: The control's maximum value. 141 * @minimum: The control's minimum value.
137 * @default_value: The control's default value. 142 * @maximum: The control's maximum value.
138 * @step: The control's step value for non-menu controls. 143 * @default_value: The control's default value.
139 * @elems: The number of elements in the N-dimensional array. 144 * @step: The control's step value for non-menu controls.
140 * @elem_size: The size in bytes of the control. 145 * @elems: The number of elements in the N-dimensional array.
141 * @dims: The size of each dimension. 146 * @elem_size: The size in bytes of the control.
142 * @nr_of_dims:The number of dimensions in @dims. 147 * @dims: The size of each dimension.
143 * @menu_skip_mask: The control's skip mask for menu controls. This makes it 148 * @nr_of_dims:The number of dimensions in @dims.
144 * easy to skip menu items that are not valid. If bit X is set, 149 * @menu_skip_mask: The control's skip mask for menu controls. This makes it
145 * then menu item X is skipped. Of course, this only works for 150 * easy to skip menu items that are not valid. If bit X is set,
146 * menus with <= 32 menu items. There are no menus that come 151 * then menu item X is skipped. Of course, this only works for
147 * close to that number, so this is OK. Should we ever need more, 152 * menus with <= 32 menu items. There are no menus that come
148 * then this will have to be extended to a u64 or a bit array. 153 * close to that number, so this is OK. Should we ever need more,
149 * @qmenu: A const char * array for all menu items. Array entries that are 154 * then this will have to be extended to a u64 or a bit array.
150 * empty strings ("") correspond to non-existing menu items (this 155 * @qmenu: A const char * array for all menu items. Array entries that are
151 * is in addition to the menu_skip_mask above). The last entry 156 * empty strings ("") correspond to non-existing menu items (this
152 * must be NULL. 157 * is in addition to the menu_skip_mask above). The last entry
153 * @flags: The control's flags. 158 * must be NULL.
154 * @cur: The control's current value. 159 * @flags: The control's flags.
155 * @val: The control's new s32 value. 160 * @cur: The control's current value.
156 * @val64: The control's new s64 value. 161 * @val: The control's new s32 value.
157 * @priv: The control's private pointer. For use by the driver. It is 162 * @priv: The control's private pointer. For use by the driver. It is
158 * untouched by the control framework. Note that this pointer is 163 * untouched by the control framework. Note that this pointer is
159 * not freed when the control is deleted. Should this be needed 164 * not freed when the control is deleted. Should this be needed
160 * then a new internal bitfield can be added to tell the framework 165 * then a new internal bitfield can be added to tell the framework
161 * to free this pointer. 166 * to free this pointer.
162 */ 167 * @p_cur: The control's current value represented via an union with
168 * provides a standard way of accessing control types
169 * through a pointer.
170 * @p_new: The control's new value represented via an union with provides
171 * a standard way of accessing control types
172 * through a pointer.
173 */
163struct v4l2_ctrl { 174struct v4l2_ctrl {
164 /* Administrative fields */ 175 /* Administrative fields */
165 struct list_head node; 176 struct list_head node;
@@ -210,16 +221,17 @@ struct v4l2_ctrl {
210 union v4l2_ctrl_ptr p_cur; 221 union v4l2_ctrl_ptr p_cur;
211}; 222};
212 223
213/** struct v4l2_ctrl_ref - The control reference. 224/**
214 * @node: List node for the sorted list. 225 * struct v4l2_ctrl_ref - The control reference.
215 * @next: Single-link list node for the hash. 226 * @node: List node for the sorted list.
216 * @ctrl: The actual control information. 227 * @next: Single-link list node for the hash.
217 * @helper: Pointer to helper struct. Used internally in prepare_ext_ctrls(). 228 * @ctrl: The actual control information.
218 * 229 * @helper: Pointer to helper struct. Used internally in prepare_ext_ctrls().
219 * Each control handler has a list of these refs. The list_head is used to 230 *
220 * keep a sorted-by-control-ID list of all controls, while the next pointer 231 * Each control handler has a list of these refs. The list_head is used to
221 * is used to link the control in the hash's bucket. 232 * keep a sorted-by-control-ID list of all controls, while the next pointer
222 */ 233 * is used to link the control in the hash's bucket.
234 */
223struct v4l2_ctrl_ref { 235struct v4l2_ctrl_ref {
224 struct list_head node; 236 struct list_head node;
225 struct v4l2_ctrl_ref *next; 237 struct v4l2_ctrl_ref *next;
@@ -227,25 +239,26 @@ struct v4l2_ctrl_ref {
227 struct v4l2_ctrl_helper *helper; 239 struct v4l2_ctrl_helper *helper;
228}; 240};
229 241
230/** struct v4l2_ctrl_handler - The control handler keeps track of all the 242/**
231 * controls: both the controls owned by the handler and those inherited 243 * struct v4l2_ctrl_handler - The control handler keeps track of all the
232 * from other handlers. 244 * controls: both the controls owned by the handler and those inherited
233 * @_lock: Default for "lock". 245 * from other handlers.
234 * @lock: Lock to control access to this handler and its controls. 246 * @_lock: Default for "lock".
235 * May be replaced by the user right after init. 247 * @lock: Lock to control access to this handler and its controls.
236 * @ctrls: The list of controls owned by this handler. 248 * May be replaced by the user right after init.
237 * @ctrl_refs: The list of control references. 249 * @ctrls: The list of controls owned by this handler.
238 * @cached: The last found control reference. It is common that the same 250 * @ctrl_refs: The list of control references.
239 * control is needed multiple times, so this is a simple 251 * @cached: The last found control reference. It is common that the same
240 * optimization. 252 * control is needed multiple times, so this is a simple
241 * @buckets: Buckets for the hashing. Allows for quick control lookup. 253 * optimization.
242 * @notify: A notify callback that is called whenever the control changes value. 254 * @buckets: Buckets for the hashing. Allows for quick control lookup.
243 * Note that the handler's lock is held when the notify function 255 * @notify: A notify callback that is called whenever the control changes value.
244 * is called! 256 * Note that the handler's lock is held when the notify function
245 * @notify_priv: Passed as argument to the v4l2_ctrl notify callback. 257 * is called!
246 * @nr_of_buckets: Total number of buckets in the array. 258 * @notify_priv: Passed as argument to the v4l2_ctrl notify callback.
247 * @error: The error code of the first failed control addition. 259 * @nr_of_buckets: Total number of buckets in the array.
248 */ 260 * @error: The error code of the first failed control addition.
261 */
249struct v4l2_ctrl_handler { 262struct v4l2_ctrl_handler {
250 struct mutex _lock; 263 struct mutex _lock;
251 struct mutex *lock; 264 struct mutex *lock;
@@ -259,32 +272,35 @@ struct v4l2_ctrl_handler {
259 int error; 272 int error;
260}; 273};
261 274
262/** struct v4l2_ctrl_config - Control configuration structure. 275/**
263 * @ops: The control ops. 276 * struct v4l2_ctrl_config - Control configuration structure.
264 * @type_ops: The control type ops. Only needed for compound controls. 277 * @ops: The control ops.
265 * @id: The control ID. 278 * @type_ops: The control type ops. Only needed for compound controls.
266 * @name: The control name. 279 * @id: The control ID.
267 * @type: The control type. 280 * @name: The control name.
268 * @min: The control's minimum value. 281 * @type: The control type.
269 * @max: The control's maximum value. 282 * @min: The control's minimum value.
270 * @step: The control's step value for non-menu controls. 283 * @max: The control's maximum value.
271 * @def: The control's default value. 284 * @step: The control's step value for non-menu controls.
272 * @dims: The size of each dimension. 285 * @def: The control's default value.
273 * @elem_size: The size in bytes of the control. 286 * @dims: The size of each dimension.
274 * @flags: The control's flags. 287 * @elem_size: The size in bytes of the control.
275 * @menu_skip_mask: The control's skip mask for menu controls. This makes it 288 * @flags: The control's flags.
276 * easy to skip menu items that are not valid. If bit X is set, 289 * @menu_skip_mask: The control's skip mask for menu controls. This makes it
277 * then menu item X is skipped. Of course, this only works for 290 * easy to skip menu items that are not valid. If bit X is set,
278 * menus with <= 64 menu items. There are no menus that come 291 * then menu item X is skipped. Of course, this only works for
279 * close to that number, so this is OK. Should we ever need more, 292 * menus with <= 64 menu items. There are no menus that come
280 * then this will have to be extended to a bit array. 293 * close to that number, so this is OK. Should we ever need more,
281 * @qmenu: A const char * array for all menu items. Array entries that are 294 * then this will have to be extended to a bit array.
282 * empty strings ("") correspond to non-existing menu items (this 295 * @qmenu: A const char * array for all menu items. Array entries that are
283 * is in addition to the menu_skip_mask above). The last entry 296 * empty strings ("") correspond to non-existing menu items (this
284 * must be NULL. 297 * is in addition to the menu_skip_mask above). The last entry
285 * @is_private: If set, then this control is private to its handler and it 298 * must be NULL.
286 * will not be added to any other handlers. 299 * @qmenu_int: A const s64 integer array for all menu items of the type
287 */ 300 * V4L2_CTRL_TYPE_INTEGER_MENU.
301 * @is_private: If set, then this control is private to its handler and it
302 * will not be added to any other handlers.
303 */
288struct v4l2_ctrl_config { 304struct v4l2_ctrl_config {
289 const struct v4l2_ctrl_ops *ops; 305 const struct v4l2_ctrl_ops *ops;
290 const struct v4l2_ctrl_type_ops *type_ops; 306 const struct v4l2_ctrl_type_ops *type_ops;
@@ -304,42 +320,44 @@ struct v4l2_ctrl_config {
304 unsigned int is_private:1; 320 unsigned int is_private:1;
305}; 321};
306 322
307/** v4l2_ctrl_fill() - Fill in the control fields based on the control ID. 323/*
308 * 324 * v4l2_ctrl_fill() - Fill in the control fields based on the control ID.
309 * This works for all standard V4L2 controls. 325 *
310 * For non-standard controls it will only fill in the given arguments 326 * This works for all standard V4L2 controls.
311 * and @name will be NULL. 327 * For non-standard controls it will only fill in the given arguments
312 * 328 * and @name will be NULL.
313 * This function will overwrite the contents of @name, @type and @flags. 329 *
314 * The contents of @min, @max, @step and @def may be modified depending on 330 * This function will overwrite the contents of @name, @type and @flags.
315 * the type. 331 * The contents of @min, @max, @step and @def may be modified depending on
316 * 332 * the type.
317 * Do not use in drivers! It is used internally for backwards compatibility 333 *
318 * control handling only. Once all drivers are converted to use the new 334 * Do not use in drivers! It is used internally for backwards compatibility
319 * control framework this function will no longer be exported. 335 * control handling only. Once all drivers are converted to use the new
320 */ 336 * control framework this function will no longer be exported.
337 */
321void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, 338void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
322 s64 *min, s64 *max, u64 *step, s64 *def, u32 *flags); 339 s64 *min, s64 *max, u64 *step, s64 *def, u32 *flags);
323 340
324 341
325/** v4l2_ctrl_handler_init_class() - Initialize the control handler. 342/**
326 * @hdl: The control handler. 343 * v4l2_ctrl_handler_init_class() - Initialize the control handler.
327 * @nr_of_controls_hint: A hint of how many controls this handler is 344 * @hdl: The control handler.
328 * expected to refer to. This is the total number, so including 345 * @nr_of_controls_hint: A hint of how many controls this handler is
329 * any inherited controls. It doesn't have to be precise, but if 346 * expected to refer to. This is the total number, so including
330 * it is way off, then you either waste memory (too many buckets 347 * any inherited controls. It doesn't have to be precise, but if
331 * are allocated) or the control lookup becomes slower (not enough 348 * it is way off, then you either waste memory (too many buckets
332 * buckets are allocated, so there are more slow list lookups). 349 * are allocated) or the control lookup becomes slower (not enough
333 * It will always work, though. 350 * buckets are allocated, so there are more slow list lookups).
334 * @key: Used by the lock validator if CONFIG_LOCKDEP is set. 351 * It will always work, though.
335 * @name: Used by the lock validator if CONFIG_LOCKDEP is set. 352 * @key: Used by the lock validator if CONFIG_LOCKDEP is set.
336 * 353 * @name: Used by the lock validator if CONFIG_LOCKDEP is set.
337 * Returns an error if the buckets could not be allocated. This error will 354 *
338 * also be stored in @hdl->error. 355 * Returns an error if the buckets could not be allocated. This error will
339 * 356 * also be stored in @hdl->error.
340 * Never use this call directly, always use the v4l2_ctrl_handler_init 357 *
341 * macro that hides the @key and @name arguments. 358 * Never use this call directly, always use the v4l2_ctrl_handler_init
342 */ 359 * macro that hides the @key and @name arguments.
360 */
343int v4l2_ctrl_handler_init_class(struct v4l2_ctrl_handler *hdl, 361int v4l2_ctrl_handler_init_class(struct v4l2_ctrl_handler *hdl,
344 unsigned nr_of_controls_hint, 362 unsigned nr_of_controls_hint,
345 struct lock_class_key *key, const char *name); 363 struct lock_class_key *key, const char *name);
@@ -361,289 +379,326 @@ int v4l2_ctrl_handler_init_class(struct v4l2_ctrl_handler *hdl,
361 v4l2_ctrl_handler_init_class(hdl, nr_of_controls_hint, NULL, NULL) 379 v4l2_ctrl_handler_init_class(hdl, nr_of_controls_hint, NULL, NULL)
362#endif 380#endif
363 381
364/** v4l2_ctrl_handler_free() - Free all controls owned by the handler and free 382/**
365 * the control list. 383 * v4l2_ctrl_handler_free() - Free all controls owned by the handler and free
366 * @hdl: The control handler. 384 * the control list.
367 * 385 * @hdl: The control handler.
368 * Does nothing if @hdl == NULL. 386 *
369 */ 387 * Does nothing if @hdl == NULL.
388 */
370void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl); 389void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl);
371 390
372/** v4l2_ctrl_lock() - Helper function to lock the handler 391/**
373 * associated with the control. 392 * v4l2_ctrl_lock() - Helper function to lock the handler
374 * @ctrl: The control to lock. 393 * associated with the control.
375 */ 394 * @ctrl: The control to lock.
395 */
376static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl) 396static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl)
377{ 397{
378 mutex_lock(ctrl->handler->lock); 398 mutex_lock(ctrl->handler->lock);
379} 399}
380 400
381/** v4l2_ctrl_unlock() - Helper function to unlock the handler 401/**
382 * associated with the control. 402 * v4l2_ctrl_unlock() - Helper function to unlock the handler
383 * @ctrl: The control to unlock. 403 * associated with the control.
384 */ 404 * @ctrl: The control to unlock.
405 */
385static inline void v4l2_ctrl_unlock(struct v4l2_ctrl *ctrl) 406static inline void v4l2_ctrl_unlock(struct v4l2_ctrl *ctrl)
386{ 407{
387 mutex_unlock(ctrl->handler->lock); 408 mutex_unlock(ctrl->handler->lock);
388} 409}
389 410
390/** v4l2_ctrl_handler_setup() - Call the s_ctrl op for all controls belonging 411/**
391 * to the handler to initialize the hardware to the current control values. 412 * v4l2_ctrl_handler_setup() - Call the s_ctrl op for all controls belonging
392 * @hdl: The control handler. 413 * to the handler to initialize the hardware to the current control values.
393 * 414 * @hdl: The control handler.
394 * Button controls will be skipped, as are read-only controls. 415 *
395 * 416 * Button controls will be skipped, as are read-only controls.
396 * If @hdl == NULL, then this just returns 0. 417 *
397 */ 418 * If @hdl == NULL, then this just returns 0.
419 */
398int v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl); 420int v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl);
399 421
400/** v4l2_ctrl_handler_log_status() - Log all controls owned by the handler. 422/**
401 * @hdl: The control handler. 423 * v4l2_ctrl_handler_log_status() - Log all controls owned by the handler.
402 * @prefix: The prefix to use when logging the control values. If the 424 * @hdl: The control handler.
403 * prefix does not end with a space, then ": " will be added 425 * @prefix: The prefix to use when logging the control values. If the
404 * after the prefix. If @prefix == NULL, then no prefix will be 426 * prefix does not end with a space, then ": " will be added
405 * used. 427 * after the prefix. If @prefix == NULL, then no prefix will be
406 * 428 * used.
407 * For use with VIDIOC_LOG_STATUS. 429 *
408 * 430 * For use with VIDIOC_LOG_STATUS.
409 * Does nothing if @hdl == NULL. 431 *
410 */ 432 * Does nothing if @hdl == NULL.
433 */
411void v4l2_ctrl_handler_log_status(struct v4l2_ctrl_handler *hdl, 434void v4l2_ctrl_handler_log_status(struct v4l2_ctrl_handler *hdl,
412 const char *prefix); 435 const char *prefix);
413 436
414/** v4l2_ctrl_new_custom() - Allocate and initialize a new custom V4L2 437/**
415 * control. 438 * v4l2_ctrl_new_custom() - Allocate and initialize a new custom V4L2
416 * @hdl: The control handler. 439 * control.
417 * @cfg: The control's configuration data. 440 * @hdl: The control handler.
418 * @priv: The control's driver-specific private data. 441 * @cfg: The control's configuration data.
419 * 442 * @priv: The control's driver-specific private data.
420 * If the &v4l2_ctrl struct could not be allocated then NULL is returned 443 *
421 * and @hdl->error is set to the error code (if it wasn't set already). 444 * If the &v4l2_ctrl struct could not be allocated then NULL is returned
422 */ 445 * and @hdl->error is set to the error code (if it wasn't set already).
446 */
423struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl, 447struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl,
424 const struct v4l2_ctrl_config *cfg, void *priv); 448 const struct v4l2_ctrl_config *cfg, void *priv);
425 449
426/** v4l2_ctrl_new_std() - Allocate and initialize a new standard V4L2 non-menu control. 450/**
427 * @hdl: The control handler. 451 * v4l2_ctrl_new_std() - Allocate and initialize a new standard V4L2 non-menu control.
428 * @ops: The control ops. 452 * @hdl: The control handler.
429 * @id: The control ID. 453 * @ops: The control ops.
430 * @min: The control's minimum value. 454 * @id: The control ID.
431 * @max: The control's maximum value. 455 * @min: The control's minimum value.
432 * @step: The control's step value 456 * @max: The control's maximum value.
433 * @def: The control's default value. 457 * @step: The control's step value
434 * 458 * @def: The control's default value.
435 * If the &v4l2_ctrl struct could not be allocated, or the control 459 *
436 * ID is not known, then NULL is returned and @hdl->error is set to the 460 * If the &v4l2_ctrl struct could not be allocated, or the control
437 * appropriate error code (if it wasn't set already). 461 * ID is not known, then NULL is returned and @hdl->error is set to the
438 * 462 * appropriate error code (if it wasn't set already).
439 * If @id refers to a menu control, then this function will return NULL. 463 *
440 * 464 * If @id refers to a menu control, then this function will return NULL.
441 * Use v4l2_ctrl_new_std_menu() when adding menu controls. 465 *
442 */ 466 * Use v4l2_ctrl_new_std_menu() when adding menu controls.
467 */
443struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl, 468struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl,
444 const struct v4l2_ctrl_ops *ops, 469 const struct v4l2_ctrl_ops *ops,
445 u32 id, s64 min, s64 max, u64 step, s64 def); 470 u32 id, s64 min, s64 max, u64 step, s64 def);
446 471
447/** v4l2_ctrl_new_std_menu() - Allocate and initialize a new standard V4L2 menu control. 472/**
448 * @hdl: The control handler. 473 * v4l2_ctrl_new_std_menu() - Allocate and initialize a new standard V4L2 menu control.
449 * @ops: The control ops. 474 * @hdl: The control handler.
450 * @id: The control ID. 475 * @ops: The control ops.
451 * @max: The control's maximum value. 476 * @id: The control ID.
452 * @mask: The control's skip mask for menu controls. This makes it 477 * @max: The control's maximum value.
453 * easy to skip menu items that are not valid. If bit X is set, 478 * @mask: The control's skip mask for menu controls. This makes it
454 * then menu item X is skipped. Of course, this only works for 479 * easy to skip menu items that are not valid. If bit X is set,
455 * menus with <= 64 menu items. There are no menus that come 480 * then menu item X is skipped. Of course, this only works for
456 * close to that number, so this is OK. Should we ever need more, 481 * menus with <= 64 menu items. There are no menus that come
457 * then this will have to be extended to a bit array. 482 * close to that number, so this is OK. Should we ever need more,
458 * @def: The control's default value. 483 * then this will have to be extended to a bit array.
459 * 484 * @def: The control's default value.
460 * Same as v4l2_ctrl_new_std(), but @min is set to 0 and the @mask value 485 *
461 * determines which menu items are to be skipped. 486 * Same as v4l2_ctrl_new_std(), but @min is set to 0 and the @mask value
462 * 487 * determines which menu items are to be skipped.
463 * If @id refers to a non-menu control, then this function will return NULL. 488 *
464 */ 489 * If @id refers to a non-menu control, then this function will return NULL.
490 */
465struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl, 491struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
466 const struct v4l2_ctrl_ops *ops, 492 const struct v4l2_ctrl_ops *ops,
467 u32 id, u8 max, u64 mask, u8 def); 493 u32 id, u8 max, u64 mask, u8 def);
468 494
469/** v4l2_ctrl_new_std_menu_items() - Create a new standard V4L2 menu control 495/**
470 * with driver specific menu. 496 * v4l2_ctrl_new_std_menu_items() - Create a new standard V4L2 menu control
471 * @hdl: The control handler. 497 * with driver specific menu.
472 * @ops: The control ops. 498 * @hdl: The control handler.
473 * @id: The control ID. 499 * @ops: The control ops.
474 * @max: The control's maximum value. 500 * @id: The control ID.
475 * @mask: The control's skip mask for menu controls. This makes it 501 * @max: The control's maximum value.
476 * easy to skip menu items that are not valid. If bit X is set, 502 * @mask: The control's skip mask for menu controls. This makes it
477 * then menu item X is skipped. Of course, this only works for 503 * easy to skip menu items that are not valid. If bit X is set,
478 * menus with <= 64 menu items. There are no menus that come 504 * then menu item X is skipped. Of course, this only works for
479 * close to that number, so this is OK. Should we ever need more, 505 * menus with <= 64 menu items. There are no menus that come
480 * then this will have to be extended to a bit array. 506 * close to that number, so this is OK. Should we ever need more,
481 * @def: The control's default value. 507 * then this will have to be extended to a bit array.
482 * @qmenu: The new menu. 508 * @def: The control's default value.
483 * 509 * @qmenu: The new menu.
484 * Same as v4l2_ctrl_new_std_menu(), but @qmenu will be the driver specific 510 *
485 * menu of this control. 511 * Same as v4l2_ctrl_new_std_menu(), but @qmenu will be the driver specific
486 * 512 * menu of this control.
487 */ 513 *
514 */
488struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *hdl, 515struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *hdl,
489 const struct v4l2_ctrl_ops *ops, u32 id, u8 max, 516 const struct v4l2_ctrl_ops *ops, u32 id, u8 max,
490 u64 mask, u8 def, const char * const *qmenu); 517 u64 mask, u8 def, const char * const *qmenu);
491 518
492/** v4l2_ctrl_new_int_menu() - Create a new standard V4L2 integer menu control. 519/**
493 * @hdl: The control handler. 520 * v4l2_ctrl_new_int_menu() - Create a new standard V4L2 integer menu control.
494 * @ops: The control ops. 521 * @hdl: The control handler.
495 * @id: The control ID. 522 * @ops: The control ops.
496 * @max: The control's maximum value. 523 * @id: The control ID.
497 * @def: The control's default value. 524 * @max: The control's maximum value.
498 * @qmenu_int: The control's menu entries. 525 * @def: The control's default value.
499 * 526 * @qmenu_int: The control's menu entries.
500 * Same as v4l2_ctrl_new_std_menu(), but @mask is set to 0 and it additionaly 527 *
501 * takes as an argument an array of integers determining the menu items. 528 * Same as v4l2_ctrl_new_std_menu(), but @mask is set to 0 and it additionaly
502 * 529 * takes as an argument an array of integers determining the menu items.
503 * If @id refers to a non-integer-menu control, then this function will return NULL. 530 *
504 */ 531 * If @id refers to a non-integer-menu control, then this function will return NULL.
532 */
505struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl, 533struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl,
506 const struct v4l2_ctrl_ops *ops, 534 const struct v4l2_ctrl_ops *ops,
507 u32 id, u8 max, u8 def, const s64 *qmenu_int); 535 u32 id, u8 max, u8 def, const s64 *qmenu_int);
508 536
509/** v4l2_ctrl_add_ctrl() - Add a control from another handler to this handler. 537/**
510 * @hdl: The control handler. 538 * v4l2_ctrl_add_ctrl() - Add a control from another handler to this handler.
511 * @ctrl: The control to add. 539 * @hdl: The control handler.
512 * 540 * @ctrl: The control to add.
513 * It will return NULL if it was unable to add the control reference. 541 *
514 * If the control already belonged to the handler, then it will do 542 * It will return NULL if it was unable to add the control reference.
515 * nothing and just return @ctrl. 543 * If the control already belonged to the handler, then it will do
516 */ 544 * nothing and just return @ctrl.
545 */
517struct v4l2_ctrl *v4l2_ctrl_add_ctrl(struct v4l2_ctrl_handler *hdl, 546struct v4l2_ctrl *v4l2_ctrl_add_ctrl(struct v4l2_ctrl_handler *hdl,
518 struct v4l2_ctrl *ctrl); 547 struct v4l2_ctrl *ctrl);
519 548
520/** v4l2_ctrl_add_handler() - Add all controls from handler @add to 549/**
521 * handler @hdl. 550 * v4l2_ctrl_add_handler() - Add all controls from handler @add to
522 * @hdl: The control handler. 551 * handler @hdl.
523 * @add: The control handler whose controls you want to add to 552 * @hdl: The control handler.
524 * the @hdl control handler. 553 * @add: The control handler whose controls you want to add to
525 * @filter: This function will filter which controls should be added. 554 * the @hdl control handler.
526 * 555 * @filter: This function will filter which controls should be added.
527 * Does nothing if either of the two handlers is a NULL pointer. 556 *
528 * If @filter is NULL, then all controls are added. Otherwise only those 557 * Does nothing if either of the two handlers is a NULL pointer.
529 * controls for which @filter returns true will be added. 558 * If @filter is NULL, then all controls are added. Otherwise only those
530 * In case of an error @hdl->error will be set to the error code (if it 559 * controls for which @filter returns true will be added.
531 * wasn't set already). 560 * In case of an error @hdl->error will be set to the error code (if it
532 */ 561 * wasn't set already).
562 */
533int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl, 563int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl,
534 struct v4l2_ctrl_handler *add, 564 struct v4l2_ctrl_handler *add,
535 bool (*filter)(const struct v4l2_ctrl *ctrl)); 565 bool (*filter)(const struct v4l2_ctrl *ctrl));
536 566
537/** v4l2_ctrl_radio_filter() - Standard filter for radio controls. 567/**
538 * @ctrl: The control that is filtered. 568 * v4l2_ctrl_radio_filter() - Standard filter for radio controls.
539 * 569 * @ctrl: The control that is filtered.
540 * This will return true for any controls that are valid for radio device 570 *
541 * nodes. Those are all of the V4L2_CID_AUDIO_* user controls and all FM 571 * This will return true for any controls that are valid for radio device
542 * transmitter class controls. 572 * nodes. Those are all of the V4L2_CID_AUDIO_* user controls and all FM
543 * 573 * transmitter class controls.
544 * This function is to be used with v4l2_ctrl_add_handler(). 574 *
545 */ 575 * This function is to be used with v4l2_ctrl_add_handler().
576 */
546bool v4l2_ctrl_radio_filter(const struct v4l2_ctrl *ctrl); 577bool v4l2_ctrl_radio_filter(const struct v4l2_ctrl *ctrl);
547 578
548/** v4l2_ctrl_cluster() - Mark all controls in the cluster as belonging to that cluster. 579/**
549 * @ncontrols: The number of controls in this cluster. 580 * v4l2_ctrl_cluster() - Mark all controls in the cluster as belonging to that cluster.
550 * @controls: The cluster control array of size @ncontrols. 581 * @ncontrols: The number of controls in this cluster.
551 */ 582 * @controls: The cluster control array of size @ncontrols.
583 */
552void v4l2_ctrl_cluster(unsigned ncontrols, struct v4l2_ctrl **controls); 584void v4l2_ctrl_cluster(unsigned ncontrols, struct v4l2_ctrl **controls);
553 585
554 586
555/** v4l2_ctrl_auto_cluster() - Mark all controls in the cluster as belonging to 587/**
556 * that cluster and set it up for autofoo/foo-type handling. 588 * v4l2_ctrl_auto_cluster() - Mark all controls in the cluster as belonging to
557 * @ncontrols: The number of controls in this cluster. 589 * that cluster and set it up for autofoo/foo-type handling.
558 * @controls: The cluster control array of size @ncontrols. The first control 590 * @ncontrols: The number of controls in this cluster.
559 * must be the 'auto' control (e.g. autogain, autoexposure, etc.) 591 * @controls: The cluster control array of size @ncontrols. The first control
560 * @manual_val: The value for the first control in the cluster that equals the 592 * must be the 'auto' control (e.g. autogain, autoexposure, etc.)
561 * manual setting. 593 * @manual_val: The value for the first control in the cluster that equals the
562 * @set_volatile: If true, then all controls except the first auto control will 594 * manual setting.
563 * be volatile. 595 * @set_volatile: If true, then all controls except the first auto control will
564 * 596 * be volatile.
565 * Use for control groups where one control selects some automatic feature and 597 *
566 * the other controls are only active whenever the automatic feature is turned 598 * Use for control groups where one control selects some automatic feature and
567 * off (manual mode). Typical examples: autogain vs gain, auto-whitebalance vs 599 * the other controls are only active whenever the automatic feature is turned
568 * red and blue balance, etc. 600 * off (manual mode). Typical examples: autogain vs gain, auto-whitebalance vs
569 * 601 * red and blue balance, etc.
570 * The behavior of such controls is as follows: 602 *
571 * 603 * The behavior of such controls is as follows:
572 * When the autofoo control is set to automatic, then any manual controls 604 *
573 * are set to inactive and any reads will call g_volatile_ctrl (if the control 605 * When the autofoo control is set to automatic, then any manual controls
574 * was marked volatile). 606 * are set to inactive and any reads will call g_volatile_ctrl (if the control
575 * 607 * was marked volatile).
576 * When the autofoo control is set to manual, then any manual controls will 608 *
577 * be marked active, and any reads will just return the current value without 609 * When the autofoo control is set to manual, then any manual controls will
578 * going through g_volatile_ctrl. 610 * be marked active, and any reads will just return the current value without
579 * 611 * going through g_volatile_ctrl.
580 * In addition, this function will set the V4L2_CTRL_FLAG_UPDATE flag 612 *
581 * on the autofoo control and V4L2_CTRL_FLAG_INACTIVE on the foo control(s) 613 * In addition, this function will set the V4L2_CTRL_FLAG_UPDATE flag
582 * if autofoo is in auto mode. 614 * on the autofoo control and V4L2_CTRL_FLAG_INACTIVE on the foo control(s)
583 */ 615 * if autofoo is in auto mode.
616 */
584void v4l2_ctrl_auto_cluster(unsigned ncontrols, struct v4l2_ctrl **controls, 617void v4l2_ctrl_auto_cluster(unsigned ncontrols, struct v4l2_ctrl **controls,
585 u8 manual_val, bool set_volatile); 618 u8 manual_val, bool set_volatile);
586 619
587 620
588/** v4l2_ctrl_find() - Find a control with the given ID. 621/**
589 * @hdl: The control handler. 622 * v4l2_ctrl_find() - Find a control with the given ID.
590 * @id: The control ID to find. 623 * @hdl: The control handler.
591 * 624 * @id: The control ID to find.
592 * If @hdl == NULL this will return NULL as well. Will lock the handler so 625 *
593 * do not use from inside &v4l2_ctrl_ops. 626 * If @hdl == NULL this will return NULL as well. Will lock the handler so
594 */ 627 * do not use from inside &v4l2_ctrl_ops.
628 */
595struct v4l2_ctrl *v4l2_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id); 629struct v4l2_ctrl *v4l2_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id);
596 630
597/** v4l2_ctrl_activate() - Make the control active or inactive. 631/**
598 * @ctrl: The control to (de)activate. 632 * v4l2_ctrl_activate() - Make the control active or inactive.
599 * @active: True if the control should become active. 633 * @ctrl: The control to (de)activate.
600 * 634 * @active: True if the control should become active.
601 * This sets or clears the V4L2_CTRL_FLAG_INACTIVE flag atomically. 635 *
602 * Does nothing if @ctrl == NULL. 636 * This sets or clears the V4L2_CTRL_FLAG_INACTIVE flag atomically.
603 * This will usually be called from within the s_ctrl op. 637 * Does nothing if @ctrl == NULL.
604 * The V4L2_EVENT_CTRL event will be generated afterwards. 638 * This will usually be called from within the s_ctrl op.
605 * 639 * The V4L2_EVENT_CTRL event will be generated afterwards.
606 * This function assumes that the control handler is locked. 640 *
607 */ 641 * This function assumes that the control handler is locked.
642 */
608void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active); 643void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active);
609 644
610/** v4l2_ctrl_grab() - Mark the control as grabbed or not grabbed. 645/**
611 * @ctrl: The control to (de)activate. 646 * v4l2_ctrl_grab() - Mark the control as grabbed or not grabbed.
612 * @grabbed: True if the control should become grabbed. 647 * @ctrl: The control to (de)activate.
613 * 648 * @grabbed: True if the control should become grabbed.
614 * This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically. 649 *
615 * Does nothing if @ctrl == NULL. 650 * This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically.
616 * The V4L2_EVENT_CTRL event will be generated afterwards. 651 * Does nothing if @ctrl == NULL.
617 * This will usually be called when starting or stopping streaming in the 652 * The V4L2_EVENT_CTRL event will be generated afterwards.
618 * driver. 653 * This will usually be called when starting or stopping streaming in the
619 * 654 * driver.
620 * This function assumes that the control handler is not locked and will 655 *
621 * take the lock itself. 656 * This function assumes that the control handler is not locked and will
622 */ 657 * take the lock itself.
658 */
623void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed); 659void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed);
624 660
625 661
626/** __v4l2_ctrl_modify_range() - Unlocked variant of v4l2_ctrl_modify_range() */ 662/**
663 *__v4l2_ctrl_modify_range() - Unlocked variant of v4l2_ctrl_modify_range()
664 *
665 * @ctrl: The control to update.
666 * @min: The control's minimum value.
667 * @max: The control's maximum value.
668 * @step: The control's step value
669 * @def: The control's default value.
670 *
671 * Update the range of a control on the fly. This works for control types
672 * INTEGER, BOOLEAN, MENU, INTEGER MENU and BITMASK. For menu controls the
673 * @step value is interpreted as a menu_skip_mask.
674 *
675 * An error is returned if one of the range arguments is invalid for this
676 * control type.
677 *
678 * This function assumes that the control handler is not locked and will
679 * take the lock itself.
680 */
627int __v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl, 681int __v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
628 s64 min, s64 max, u64 step, s64 def); 682 s64 min, s64 max, u64 step, s64 def);
629 683
630/** v4l2_ctrl_modify_range() - Update the range of a control. 684/**
631 * @ctrl: The control to update. 685 * v4l2_ctrl_modify_range() - Update the range of a control.
632 * @min: The control's minimum value. 686 * @ctrl: The control to update.
633 * @max: The control's maximum value. 687 * @min: The control's minimum value.
634 * @step: The control's step value 688 * @max: The control's maximum value.
635 * @def: The control's default value. 689 * @step: The control's step value
636 * 690 * @def: The control's default value.
637 * Update the range of a control on the fly. This works for control types 691 *
638 * INTEGER, BOOLEAN, MENU, INTEGER MENU and BITMASK. For menu controls the 692 * Update the range of a control on the fly. This works for control types
639 * @step value is interpreted as a menu_skip_mask. 693 * INTEGER, BOOLEAN, MENU, INTEGER MENU and BITMASK. For menu controls the
640 * 694 * @step value is interpreted as a menu_skip_mask.
641 * An error is returned if one of the range arguments is invalid for this 695 *
642 * control type. 696 * An error is returned if one of the range arguments is invalid for this
643 * 697 * control type.
644 * This function assumes that the control handler is not locked and will 698 *
645 * take the lock itself. 699 * This function assumes that the control handler is not locked and will
646 */ 700 * take the lock itself.
701 */
647static inline int v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl, 702static inline int v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
648 s64 min, s64 max, u64 step, s64 def) 703 s64 min, s64 max, u64 step, s64 def)
649{ 704{
@@ -656,21 +711,23 @@ static inline int v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
656 return rval; 711 return rval;
657} 712}
658 713
659/** v4l2_ctrl_notify() - Function to set a notify callback for a control. 714/**
660 * @ctrl: The control. 715 * v4l2_ctrl_notify() - Function to set a notify callback for a control.
661 * @notify: The callback function. 716 * @ctrl: The control.
662 * @priv: The callback private handle, passed as argument to the callback. 717 * @notify: The callback function.
663 * 718 * @priv: The callback private handle, passed as argument to the callback.
664 * This function sets a callback function for the control. If @ctrl is NULL, 719 *
665 * then it will do nothing. If @notify is NULL, then the notify callback will 720 * This function sets a callback function for the control. If @ctrl is NULL,
666 * be removed. 721 * then it will do nothing. If @notify is NULL, then the notify callback will
667 * 722 * be removed.
668 * There can be only one notify. If another already exists, then a WARN_ON 723 *
669 * will be issued and the function will do nothing. 724 * There can be only one notify. If another already exists, then a WARN_ON
670 */ 725 * will be issued and the function will do nothing.
726 */
671void v4l2_ctrl_notify(struct v4l2_ctrl *ctrl, v4l2_ctrl_notify_fnc notify, void *priv); 727void v4l2_ctrl_notify(struct v4l2_ctrl *ctrl, v4l2_ctrl_notify_fnc notify, void *priv);
672 728
673/** v4l2_ctrl_get_name() - Get the name of the control 729/**
730 * v4l2_ctrl_get_name() - Get the name of the control
674 * @id: The control ID. 731 * @id: The control ID.
675 * 732 *
676 * This function returns the name of the given control ID or NULL if it isn't 733 * This function returns the name of the given control ID or NULL if it isn't
@@ -678,7 +735,8 @@ void v4l2_ctrl_notify(struct v4l2_ctrl *ctrl, v4l2_ctrl_notify_fnc notify, void
678 */ 735 */
679const char *v4l2_ctrl_get_name(u32 id); 736const char *v4l2_ctrl_get_name(u32 id);
680 737
681/** v4l2_ctrl_get_menu() - Get the menu string array of the control 738/**
739 * v4l2_ctrl_get_menu() - Get the menu string array of the control
682 * @id: The control ID. 740 * @id: The control ID.
683 * 741 *
684 * This function returns the NULL-terminated menu string array name of the 742 * This function returns the NULL-terminated menu string array name of the
@@ -686,7 +744,8 @@ const char *v4l2_ctrl_get_name(u32 id);
686 */ 744 */
687const char * const *v4l2_ctrl_get_menu(u32 id); 745const char * const *v4l2_ctrl_get_menu(u32 id);
688 746
689/** v4l2_ctrl_get_int_menu() - Get the integer menu array of the control 747/**
748 * v4l2_ctrl_get_int_menu() - Get the integer menu array of the control
690 * @id: The control ID. 749 * @id: The control ID.
691 * @len: The size of the integer array. 750 * @len: The size of the integer array.
692 * 751 *
@@ -695,29 +754,41 @@ const char * const *v4l2_ctrl_get_menu(u32 id);
695 */ 754 */
696const s64 *v4l2_ctrl_get_int_menu(u32 id, u32 *len); 755const s64 *v4l2_ctrl_get_int_menu(u32 id, u32 *len);
697 756
698/** v4l2_ctrl_g_ctrl() - Helper function to get the control's value from within a driver. 757/**
699 * @ctrl: The control. 758 * v4l2_ctrl_g_ctrl() - Helper function to get the control's value from within a driver.
700 * 759 * @ctrl: The control.
701 * This returns the control's value safely by going through the control 760 *
702 * framework. This function will lock the control's handler, so it cannot be 761 * This returns the control's value safely by going through the control
703 * used from within the &v4l2_ctrl_ops functions. 762 * framework. This function will lock the control's handler, so it cannot be
704 * 763 * used from within the &v4l2_ctrl_ops functions.
705 * This function is for integer type controls only. 764 *
706 */ 765 * This function is for integer type controls only.
766 */
707s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl); 767s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl);
708 768
709/** __v4l2_ctrl_s_ctrl() - Unlocked variant of v4l2_ctrl_s_ctrl(). */ 769/**
770 * __v4l2_ctrl_s_ctrl() - Unlocked variant of v4l2_ctrl_s_ctrl().
771 * @ctrl: The control.
772 * @val: The new value.
773 *
774 * This set the control's new value safely by going through the control
775 * framework. This function will lock the control's handler, so it cannot be
776 * used from within the &v4l2_ctrl_ops functions.
777 *
778 * This function is for integer type controls only.
779 */
710int __v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val); 780int __v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val);
781
711/** v4l2_ctrl_s_ctrl() - Helper function to set the control's value from within a driver. 782/** v4l2_ctrl_s_ctrl() - Helper function to set the control's value from within a driver.
712 * @ctrl: The control. 783 * @ctrl: The control.
713 * @val: The new value. 784 * @val: The new value.
714 * 785 *
715 * This set the control's new value safely by going through the control 786 * This set the control's new value safely by going through the control
716 * framework. This function will lock the control's handler, so it cannot be 787 * framework. This function will lock the control's handler, so it cannot be
717 * used from within the &v4l2_ctrl_ops functions. 788 * used from within the &v4l2_ctrl_ops functions.
718 * 789 *
719 * This function is for integer type controls only. 790 * This function is for integer type controls only.
720 */ 791 */
721static inline int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val) 792static inline int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val)
722{ 793{
723 int rval; 794 int rval;
@@ -729,30 +800,45 @@ static inline int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val)
729 return rval; 800 return rval;
730} 801}
731 802
732/** v4l2_ctrl_g_ctrl_int64() - Helper function to get a 64-bit control's value from within a driver. 803/**
733 * @ctrl: The control. 804 * v4l2_ctrl_g_ctrl_int64() - Helper function to get a 64-bit control's value
734 * 805 * from within a driver.
735 * This returns the control's value safely by going through the control 806 * @ctrl: The control.
736 * framework. This function will lock the control's handler, so it cannot be 807 *
737 * used from within the &v4l2_ctrl_ops functions. 808 * This returns the control's value safely by going through the control
738 * 809 * framework. This function will lock the control's handler, so it cannot be
739 * This function is for 64-bit integer type controls only. 810 * used from within the &v4l2_ctrl_ops functions.
740 */ 811 *
812 * This function is for 64-bit integer type controls only.
813 */
741s64 v4l2_ctrl_g_ctrl_int64(struct v4l2_ctrl *ctrl); 814s64 v4l2_ctrl_g_ctrl_int64(struct v4l2_ctrl *ctrl);
742 815
743/** __v4l2_ctrl_s_ctrl_int64() - Unlocked variant of v4l2_ctrl_s_ctrl_int64(). */ 816/**
817 * __v4l2_ctrl_s_ctrl_int64() - Unlocked variant of v4l2_ctrl_s_ctrl_int64().
818 *
819 * @ctrl: The control.
820 * @val: The new value.
821 *
822 * This set the control's new value safely by going through the control
823 * framework. This function will lock the control's handler, so it cannot be
824 * used from within the &v4l2_ctrl_ops functions.
825 *
826 * This function is for 64-bit integer type controls only.
827 */
744int __v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val); 828int __v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val);
745 829
746/** v4l2_ctrl_s_ctrl_int64() - Helper function to set a 64-bit control's value from within a driver. 830/** v4l2_ctrl_s_ctrl_int64() - Helper function to set a 64-bit control's value
747 * @ctrl: The control. 831 * from within a driver.
748 * @val: The new value. 832 *
749 * 833 * @ctrl: The control.
750 * This set the control's new value safely by going through the control 834 * @val: The new value.
751 * framework. This function will lock the control's handler, so it cannot be 835 *
752 * used from within the &v4l2_ctrl_ops functions. 836 * This set the control's new value safely by going through the control
753 * 837 * framework. This function will lock the control's handler, so it cannot be
754 * This function is for 64-bit integer type controls only. 838 * used from within the &v4l2_ctrl_ops functions.
755 */ 839 *
840 * This function is for 64-bit integer type controls only.
841 */
756static inline int v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val) 842static inline int v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val)
757{ 843{
758 int rval; 844 int rval;
@@ -764,19 +850,31 @@ static inline int v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val)
764 return rval; 850 return rval;
765} 851}
766 852
767/** __v4l2_ctrl_s_ctrl_string() - Unlocked variant of v4l2_ctrl_s_ctrl_string(). */ 853/** __v4l2_ctrl_s_ctrl_string() - Unlocked variant of v4l2_ctrl_s_ctrl_string().
854 *
855 * @ctrl: The control.
856 * @s: The new string.
857 *
858 * This set the control's new string safely by going through the control
859 * framework. This function will lock the control's handler, so it cannot be
860 * used from within the &v4l2_ctrl_ops functions.
861 *
862 * This function is for string type controls only.
863 */
768int __v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s); 864int __v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s);
769 865
770/** v4l2_ctrl_s_ctrl_string() - Helper function to set a control's string value from within a driver. 866/** v4l2_ctrl_s_ctrl_string() - Helper function to set a control's string value
771 * @ctrl: The control. 867 * from within a driver.
772 * @s: The new string. 868 *
773 * 869 * @ctrl: The control.
774 * This set the control's new string safely by going through the control 870 * @s: The new string.
775 * framework. This function will lock the control's handler, so it cannot be 871 *
776 * used from within the &v4l2_ctrl_ops functions. 872 * This set the control's new string safely by going through the control
777 * 873 * framework. This function will lock the control's handler, so it cannot be
778 * This function is for string type controls only. 874 * used from within the &v4l2_ctrl_ops functions.
779 */ 875 *
876 * This function is for string type controls only.
877 */
780static inline int v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s) 878static inline int v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s)
781{ 879{
782 int rval; 880 int rval;
diff --git a/include/media/v4l2-dv-timings.h b/include/media/v4l2-dv-timings.h
index eecd3102a618..b6130b50a0f1 100644
--- a/include/media/v4l2-dv-timings.h
+++ b/include/media/v4l2-dv-timings.h
@@ -23,11 +23,14 @@
23 23
24#include <linux/videodev2.h> 24#include <linux/videodev2.h>
25 25
26/** v4l2_dv_timings_presets: list of all dv_timings presets. 26/**
27 * v4l2_dv_timings_presets: list of all dv_timings presets.
27 */ 28 */
28extern const struct v4l2_dv_timings v4l2_dv_timings_presets[]; 29extern const struct v4l2_dv_timings v4l2_dv_timings_presets[];
29 30
30/** v4l2_check_dv_timings_fnc - timings check callback 31/**
32 * v4l2_check_dv_timings_fnc - timings check callback
33 *
31 * @t: the v4l2_dv_timings struct. 34 * @t: the v4l2_dv_timings struct.
32 * @handle: a handle from the driver. 35 * @handle: a handle from the driver.
33 * 36 *
@@ -35,86 +38,101 @@ extern const struct v4l2_dv_timings v4l2_dv_timings_presets[];
35 */ 38 */
36typedef bool v4l2_check_dv_timings_fnc(const struct v4l2_dv_timings *t, void *handle); 39typedef bool v4l2_check_dv_timings_fnc(const struct v4l2_dv_timings *t, void *handle);
37 40
38/** v4l2_valid_dv_timings() - are these timings valid? 41/**
39 * @t: the v4l2_dv_timings struct. 42 * v4l2_valid_dv_timings() - are these timings valid?
40 * @cap: the v4l2_dv_timings_cap capabilities. 43 *
41 * @fnc: callback to check if this timing is OK. May be NULL. 44 * @t: the v4l2_dv_timings struct.
42 * @fnc_handle: a handle that is passed on to @fnc. 45 * @cap: the v4l2_dv_timings_cap capabilities.
43 * 46 * @fnc: callback to check if this timing is OK. May be NULL.
44 * Returns true if the given dv_timings struct is supported by the 47 * @fnc_handle: a handle that is passed on to @fnc.
45 * hardware capabilities and the callback function (if non-NULL), returns 48 *
46 * false otherwise. 49 * Returns true if the given dv_timings struct is supported by the
47 */ 50 * hardware capabilities and the callback function (if non-NULL), returns
51 * false otherwise.
52 */
48bool v4l2_valid_dv_timings(const struct v4l2_dv_timings *t, 53bool v4l2_valid_dv_timings(const struct v4l2_dv_timings *t,
49 const struct v4l2_dv_timings_cap *cap, 54 const struct v4l2_dv_timings_cap *cap,
50 v4l2_check_dv_timings_fnc fnc, 55 v4l2_check_dv_timings_fnc fnc,
51 void *fnc_handle); 56 void *fnc_handle);
52 57
53/** v4l2_enum_dv_timings_cap() - Helper function to enumerate possible DV timings based on capabilities 58/**
54 * @t: the v4l2_enum_dv_timings struct. 59 * v4l2_enum_dv_timings_cap() - Helper function to enumerate possible DV
55 * @cap: the v4l2_dv_timings_cap capabilities. 60 * timings based on capabilities
56 * @fnc: callback to check if this timing is OK. May be NULL. 61 *
57 * @fnc_handle: a handle that is passed on to @fnc. 62 * @t: the v4l2_enum_dv_timings struct.
58 * 63 * @cap: the v4l2_dv_timings_cap capabilities.
59 * This enumerates dv_timings using the full list of possible CEA-861 and DMT 64 * @fnc: callback to check if this timing is OK. May be NULL.
60 * timings, filtering out any timings that are not supported based on the 65 * @fnc_handle: a handle that is passed on to @fnc.
61 * hardware capabilities and the callback function (if non-NULL). 66 *
62 * 67 * This enumerates dv_timings using the full list of possible CEA-861 and DMT
63 * If a valid timing for the given index is found, it will fill in @t and 68 * timings, filtering out any timings that are not supported based on the
64 * return 0, otherwise it returns -EINVAL. 69 * hardware capabilities and the callback function (if non-NULL).
65 */ 70 *
71 * If a valid timing for the given index is found, it will fill in @t and
72 * return 0, otherwise it returns -EINVAL.
73 */
66int v4l2_enum_dv_timings_cap(struct v4l2_enum_dv_timings *t, 74int v4l2_enum_dv_timings_cap(struct v4l2_enum_dv_timings *t,
67 const struct v4l2_dv_timings_cap *cap, 75 const struct v4l2_dv_timings_cap *cap,
68 v4l2_check_dv_timings_fnc fnc, 76 v4l2_check_dv_timings_fnc fnc,
69 void *fnc_handle); 77 void *fnc_handle);
70 78
71/** v4l2_find_dv_timings_cap() - Find the closest timings struct 79/**
72 * @t: the v4l2_enum_dv_timings struct. 80 * v4l2_find_dv_timings_cap() - Find the closest timings struct
73 * @cap: the v4l2_dv_timings_cap capabilities. 81 *
74 * @pclock_delta: maximum delta between t->pixelclock and the timing struct 82 * @t: the v4l2_enum_dv_timings struct.
75 * under consideration. 83 * @cap: the v4l2_dv_timings_cap capabilities.
76 * @fnc: callback to check if a given timings struct is OK. May be NULL. 84 * @pclock_delta: maximum delta between t->pixelclock and the timing struct
77 * @fnc_handle: a handle that is passed on to @fnc. 85 * under consideration.
78 * 86 * @fnc: callback to check if a given timings struct is OK. May be NULL.
79 * This function tries to map the given timings to an entry in the 87 * @fnc_handle: a handle that is passed on to @fnc.
80 * full list of possible CEA-861 and DMT timings, filtering out any timings 88 *
81 * that are not supported based on the hardware capabilities and the callback 89 * This function tries to map the given timings to an entry in the
82 * function (if non-NULL). 90 * full list of possible CEA-861 and DMT timings, filtering out any timings
83 * 91 * that are not supported based on the hardware capabilities and the callback
84 * On success it will fill in @t with the found timings and it returns true. 92 * function (if non-NULL).
85 * On failure it will return false. 93 *
86 */ 94 * On success it will fill in @t with the found timings and it returns true.
95 * On failure it will return false.
96 */
87bool v4l2_find_dv_timings_cap(struct v4l2_dv_timings *t, 97bool v4l2_find_dv_timings_cap(struct v4l2_dv_timings *t,
88 const struct v4l2_dv_timings_cap *cap, 98 const struct v4l2_dv_timings_cap *cap,
89 unsigned pclock_delta, 99 unsigned pclock_delta,
90 v4l2_check_dv_timings_fnc fnc, 100 v4l2_check_dv_timings_fnc fnc,
91 void *fnc_handle); 101 void *fnc_handle);
92 102
93/** v4l2_match_dv_timings() - do two timings match? 103/**
94 * @measured: the measured timings data. 104 * v4l2_match_dv_timings() - do two timings match?
95 * @standard: the timings according to the standard. 105 *
96 * @pclock_delta: maximum delta in Hz between standard->pixelclock and 106 * @measured: the measured timings data.
97 * the measured timings. 107 * @standard: the timings according to the standard.
98 * 108 * @pclock_delta: maximum delta in Hz between standard->pixelclock and
99 * Returns true if the two timings match, returns false otherwise. 109 * the measured timings.
100 */ 110 *
111 * Returns true if the two timings match, returns false otherwise.
112 */
101bool v4l2_match_dv_timings(const struct v4l2_dv_timings *measured, 113bool v4l2_match_dv_timings(const struct v4l2_dv_timings *measured,
102 const struct v4l2_dv_timings *standard, 114 const struct v4l2_dv_timings *standard,
103 unsigned pclock_delta); 115 unsigned pclock_delta);
104 116
105/** v4l2_print_dv_timings() - log the contents of a dv_timings struct 117/**
106 * @dev_prefix:device prefix for each log line. 118 * v4l2_print_dv_timings() - log the contents of a dv_timings struct
107 * @prefix: additional prefix for each log line, may be NULL. 119 * @dev_prefix:device prefix for each log line.
108 * @t: the timings data. 120 * @prefix: additional prefix for each log line, may be NULL.
109 * @detailed: if true, give a detailed log. 121 * @t: the timings data.
110 */ 122 * @detailed: if true, give a detailed log.
123 */
111void v4l2_print_dv_timings(const char *dev_prefix, const char *prefix, 124void v4l2_print_dv_timings(const char *dev_prefix, const char *prefix,
112 const struct v4l2_dv_timings *t, bool detailed); 125 const struct v4l2_dv_timings *t, bool detailed);
113 126
114/** v4l2_detect_cvt - detect if the given timings follow the CVT standard 127/**
128 * v4l2_detect_cvt - detect if the given timings follow the CVT standard
129 *
115 * @frame_height - the total height of the frame (including blanking) in lines. 130 * @frame_height - the total height of the frame (including blanking) in lines.
116 * @hfreq - the horizontal frequency in Hz. 131 * @hfreq - the horizontal frequency in Hz.
117 * @vsync - the height of the vertical sync in lines. 132 * @vsync - the height of the vertical sync in lines.
133 * @active_width - active width of image (does not include blanking). This
134 * information is needed only in case of version 2 of reduced blanking.
135 * In other cases, this parameter does not have any effect on timings.
118 * @polarities - the horizontal and vertical polarities (same as struct 136 * @polarities - the horizontal and vertical polarities (same as struct
119 * v4l2_bt_timings polarities). 137 * v4l2_bt_timings polarities).
120 * @interlaced - if this flag is true, it indicates interlaced format 138 * @interlaced - if this flag is true, it indicates interlaced format
@@ -125,9 +143,12 @@ void v4l2_print_dv_timings(const char *dev_prefix, const char *prefix,
125 * in with the found CVT timings. 143 * in with the found CVT timings.
126 */ 144 */
127bool v4l2_detect_cvt(unsigned frame_height, unsigned hfreq, unsigned vsync, 145bool v4l2_detect_cvt(unsigned frame_height, unsigned hfreq, unsigned vsync,
128 u32 polarities, bool interlaced, struct v4l2_dv_timings *fmt); 146 unsigned active_width, u32 polarities, bool interlaced,
147 struct v4l2_dv_timings *fmt);
129 148
130/** v4l2_detect_gtf - detect if the given timings follow the GTF standard 149/**
150 * v4l2_detect_gtf - detect if the given timings follow the GTF standard
151 *
131 * @frame_height - the total height of the frame (including blanking) in lines. 152 * @frame_height - the total height of the frame (including blanking) in lines.
132 * @hfreq - the horizontal frequency in Hz. 153 * @hfreq - the horizontal frequency in Hz.
133 * @vsync - the height of the vertical sync in lines. 154 * @vsync - the height of the vertical sync in lines.
@@ -149,8 +170,10 @@ bool v4l2_detect_gtf(unsigned frame_height, unsigned hfreq, unsigned vsync,
149 u32 polarities, bool interlaced, struct v4l2_fract aspect, 170 u32 polarities, bool interlaced, struct v4l2_fract aspect,
150 struct v4l2_dv_timings *fmt); 171 struct v4l2_dv_timings *fmt);
151 172
152/** v4l2_calc_aspect_ratio - calculate the aspect ratio based on bytes 173/**
174 * v4l2_calc_aspect_ratio - calculate the aspect ratio based on bytes
153 * 0x15 and 0x16 from the EDID. 175 * 0x15 and 0x16 from the EDID.
176 *
154 * @hor_landscape - byte 0x15 from the EDID. 177 * @hor_landscape - byte 0x15 from the EDID.
155 * @vert_portrait - byte 0x16 from the EDID. 178 * @vert_portrait - byte 0x16 from the EDID.
156 * 179 *
diff --git a/include/media/v4l2-event.h b/include/media/v4l2-event.h
index 1ab9045e52e3..9792f906423b 100644
--- a/include/media/v4l2-event.h
+++ b/include/media/v4l2-event.h
@@ -68,10 +68,11 @@ struct v4l2_subdev;
68struct v4l2_subscribed_event; 68struct v4l2_subscribed_event;
69struct video_device; 69struct video_device;
70 70
71/** struct v4l2_kevent - Internal kernel event struct. 71/**
72 * @list: List node for the v4l2_fh->available list. 72 * struct v4l2_kevent - Internal kernel event struct.
73 * @sev: Pointer to parent v4l2_subscribed_event. 73 * @list: List node for the v4l2_fh->available list.
74 * @event: The event itself. 74 * @sev: Pointer to parent v4l2_subscribed_event.
75 * @event: The event itself.
75 */ 76 */
76struct v4l2_kevent { 77struct v4l2_kevent {
77 struct list_head list; 78 struct list_head list;
@@ -80,11 +81,12 @@ struct v4l2_kevent {
80}; 81};
81 82
82/** struct v4l2_subscribed_event_ops - Subscribed event operations. 83/** struct v4l2_subscribed_event_ops - Subscribed event operations.
83 * @add: Optional callback, called when a new listener is added 84 *
84 * @del: Optional callback, called when a listener stops listening 85 * @add: Optional callback, called when a new listener is added
85 * @replace: Optional callback that can replace event 'old' with event 'new'. 86 * @del: Optional callback, called when a listener stops listening
86 * @merge: Optional callback that can merge event 'old' into event 'new'. 87 * @replace: Optional callback that can replace event 'old' with event 'new'.
87 */ 88 * @merge: Optional callback that can merge event 'old' into event 'new'.
89 */
88struct v4l2_subscribed_event_ops { 90struct v4l2_subscribed_event_ops {
89 int (*add)(struct v4l2_subscribed_event *sev, unsigned elems); 91 int (*add)(struct v4l2_subscribed_event *sev, unsigned elems);
90 void (*del)(struct v4l2_subscribed_event *sev); 92 void (*del)(struct v4l2_subscribed_event *sev);
@@ -92,19 +94,20 @@ struct v4l2_subscribed_event_ops {
92 void (*merge)(const struct v4l2_event *old, struct v4l2_event *new); 94 void (*merge)(const struct v4l2_event *old, struct v4l2_event *new);
93}; 95};
94 96
95/** struct v4l2_subscribed_event - Internal struct representing a subscribed event. 97/**
96 * @list: List node for the v4l2_fh->subscribed list. 98 * struct v4l2_subscribed_event - Internal struct representing a subscribed event.
97 * @type: Event type. 99 * @list: List node for the v4l2_fh->subscribed list.
98 * @id: Associated object ID (e.g. control ID). 0 if there isn't any. 100 * @type: Event type.
99 * @flags: Copy of v4l2_event_subscription->flags. 101 * @id: Associated object ID (e.g. control ID). 0 if there isn't any.
100 * @fh: Filehandle that subscribed to this event. 102 * @flags: Copy of v4l2_event_subscription->flags.
101 * @node: List node that hooks into the object's event list (if there is one). 103 * @fh: Filehandle that subscribed to this event.
102 * @ops: v4l2_subscribed_event_ops 104 * @node: List node that hooks into the object's event list (if there is one).
103 * @elems: The number of elements in the events array. 105 * @ops: v4l2_subscribed_event_ops
104 * @first: The index of the events containing the oldest available event. 106 * @elems: The number of elements in the events array.
105 * @in_use: The number of queued events. 107 * @first: The index of the events containing the oldest available event.
106 * @events: An array of @elems events. 108 * @in_use: The number of queued events.
107 */ 109 * @events: An array of @elems events.
110 */
108struct v4l2_subscribed_event { 111struct v4l2_subscribed_event {
109 struct list_head list; 112 struct list_head list;
110 u32 type; 113 u32 type;
diff --git a/include/media/v4l2-flash-led-class.h b/include/media/v4l2-flash-led-class.h
index 098236c083b8..3d184ab52274 100644
--- a/include/media/v4l2-flash-led-class.h
+++ b/include/media/v4l2-flash-led-class.h
@@ -48,13 +48,13 @@ struct v4l2_flash_ops {
48/** 48/**
49 * struct v4l2_flash_config - V4L2 Flash sub-device initialization data 49 * struct v4l2_flash_config - V4L2 Flash sub-device initialization data
50 * @dev_name: the name of the media entity, 50 * @dev_name: the name of the media entity,
51 unique in the system 51 * unique in the system
52 * @torch_intensity: constraints for the LED in torch mode 52 * @torch_intensity: constraints for the LED in torch mode
53 * @indicator_intensity: constraints for the indicator LED 53 * @indicator_intensity: constraints for the indicator LED
54 * @flash_faults: bitmask of flash faults that the LED flash class 54 * @flash_faults: bitmask of flash faults that the LED flash class
55 device can report; corresponding LED_FAULT* bit 55 * device can report; corresponding LED_FAULT* bit
56 definitions are available in the header file 56 * definitions are available in the header file
57 <linux/led-class-flash.h> 57 * <linux/led-class-flash.h>
58 * @has_external_strobe: external strobe capability 58 * @has_external_strobe: external strobe capability
59 */ 59 */
60struct v4l2_flash_config { 60struct v4l2_flash_config {
@@ -105,7 +105,7 @@ static inline struct v4l2_flash *v4l2_ctrl_to_v4l2_flash(struct v4l2_ctrl *c)
105 * @fled_cdev: LED flash class device to wrap 105 * @fled_cdev: LED flash class device to wrap
106 * @iled_cdev: LED flash class device representing indicator LED associated 106 * @iled_cdev: LED flash class device representing indicator LED associated
107 * with fled_cdev, may be NULL 107 * with fled_cdev, may be NULL
108 * @flash_ops: V4L2 Flash device ops 108 * @ops: V4L2 Flash device ops
109 * @config: initialization data for V4L2 Flash sub-device 109 * @config: initialization data for V4L2 Flash sub-device
110 * 110 *
111 * Create V4L2 Flash sub-device wrapping given LED subsystem device. 111 * Create V4L2 Flash sub-device wrapping given LED subsystem device.
@@ -123,7 +123,7 @@ struct v4l2_flash *v4l2_flash_init(
123 123
124/** 124/**
125 * v4l2_flash_release - release V4L2 Flash sub-device 125 * v4l2_flash_release - release V4L2 Flash sub-device
126 * @flash: the V4L2 Flash sub-device to release 126 * @v4l2_flash: the V4L2 Flash sub-device to release
127 * 127 *
128 * Release V4L2 Flash sub-device. 128 * Release V4L2 Flash sub-device.
129 */ 129 */
diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h
index 73069e4c2796..34cc99e093ef 100644
--- a/include/media/v4l2-mediabus.h
+++ b/include/media/v4l2-mediabus.h
@@ -65,7 +65,7 @@
65 V4L2_MBUS_CSI2_CHANNEL_2 | V4L2_MBUS_CSI2_CHANNEL_3) 65 V4L2_MBUS_CSI2_CHANNEL_2 | V4L2_MBUS_CSI2_CHANNEL_3)
66 66
67/** 67/**
68 * v4l2_mbus_type - media bus type 68 * enum v4l2_mbus_type - media bus type
69 * @V4L2_MBUS_PARALLEL: parallel interface with hsync and vsync 69 * @V4L2_MBUS_PARALLEL: parallel interface with hsync and vsync
70 * @V4L2_MBUS_BT656: parallel interface with embedded synchronisation, can 70 * @V4L2_MBUS_BT656: parallel interface with embedded synchronisation, can
71 * also be used for BT.1120 71 * also be used for BT.1120
@@ -78,7 +78,7 @@ enum v4l2_mbus_type {
78}; 78};
79 79
80/** 80/**
81 * v4l2_mbus_config - media bus configuration 81 * struct v4l2_mbus_config - media bus configuration
82 * @type: in: interface type 82 * @type: in: interface type
83 * @flags: in / out: configuration flags, depending on @type 83 * @flags: in / out: configuration flags, depending on @type
84 */ 84 */
diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h
index 3bbd96da25c9..8849aaba6aa5 100644
--- a/include/media/v4l2-mem2mem.h
+++ b/include/media/v4l2-mem2mem.h
@@ -40,6 +40,10 @@
40 * v4l2_m2m_job_finish() (as if the transaction ended normally). 40 * v4l2_m2m_job_finish() (as if the transaction ended normally).
41 * This function does not have to (and will usually not) wait 41 * This function does not have to (and will usually not) wait
42 * until the device enters a state when it can be stopped. 42 * until the device enters a state when it can be stopped.
43 * @lock: optional. Define a driver's own lock callback, instead of using
44 * m2m_ctx->q_lock.
45 * @unlock: optional. Define a driver's own unlock callback, instead of
46 * using m2m_ctx->q_lock.
43 */ 47 */
44struct v4l2_m2m_ops { 48struct v4l2_m2m_ops {
45 void (*device_run)(void *priv); 49 void (*device_run)(void *priv);
@@ -161,6 +165,8 @@ void v4l2_m2m_buf_queue(struct v4l2_m2m_ctx *m2m_ctx, struct vb2_buffer *vb);
161/** 165/**
162 * v4l2_m2m_num_src_bufs_ready() - return the number of source buffers ready for 166 * v4l2_m2m_num_src_bufs_ready() - return the number of source buffers ready for
163 * use 167 * use
168 *
169 * @m2m_ctx: pointer to struct v4l2_m2m_ctx
164 */ 170 */
165static inline 171static inline
166unsigned int v4l2_m2m_num_src_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx) 172unsigned int v4l2_m2m_num_src_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx)
@@ -171,6 +177,8 @@ unsigned int v4l2_m2m_num_src_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx)
171/** 177/**
172 * v4l2_m2m_num_src_bufs_ready() - return the number of destination buffers 178 * v4l2_m2m_num_src_bufs_ready() - return the number of destination buffers
173 * ready for use 179 * ready for use
180 *
181 * @m2m_ctx: pointer to struct v4l2_m2m_ctx
174 */ 182 */
175static inline 183static inline
176unsigned int v4l2_m2m_num_dst_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx) 184unsigned int v4l2_m2m_num_dst_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx)
@@ -183,6 +191,8 @@ void *v4l2_m2m_next_buf(struct v4l2_m2m_queue_ctx *q_ctx);
183/** 191/**
184 * v4l2_m2m_next_src_buf() - return next source buffer from the list of ready 192 * v4l2_m2m_next_src_buf() - return next source buffer from the list of ready
185 * buffers 193 * buffers
194 *
195 * @m2m_ctx: pointer to struct v4l2_m2m_ctx
186 */ 196 */
187static inline void *v4l2_m2m_next_src_buf(struct v4l2_m2m_ctx *m2m_ctx) 197static inline void *v4l2_m2m_next_src_buf(struct v4l2_m2m_ctx *m2m_ctx)
188{ 198{
@@ -192,6 +202,8 @@ static inline void *v4l2_m2m_next_src_buf(struct v4l2_m2m_ctx *m2m_ctx)
192/** 202/**
193 * v4l2_m2m_next_dst_buf() - return next destination buffer from the list of 203 * v4l2_m2m_next_dst_buf() - return next destination buffer from the list of
194 * ready buffers 204 * ready buffers
205 *
206 * @m2m_ctx: pointer to struct v4l2_m2m_ctx
195 */ 207 */
196static inline void *v4l2_m2m_next_dst_buf(struct v4l2_m2m_ctx *m2m_ctx) 208static inline void *v4l2_m2m_next_dst_buf(struct v4l2_m2m_ctx *m2m_ctx)
197{ 209{
@@ -200,6 +212,8 @@ static inline void *v4l2_m2m_next_dst_buf(struct v4l2_m2m_ctx *m2m_ctx)
200 212
201/** 213/**
202 * v4l2_m2m_get_src_vq() - return vb2_queue for source buffers 214 * v4l2_m2m_get_src_vq() - return vb2_queue for source buffers
215 *
216 * @m2m_ctx: pointer to struct v4l2_m2m_ctx
203 */ 217 */
204static inline 218static inline
205struct vb2_queue *v4l2_m2m_get_src_vq(struct v4l2_m2m_ctx *m2m_ctx) 219struct vb2_queue *v4l2_m2m_get_src_vq(struct v4l2_m2m_ctx *m2m_ctx)
@@ -209,6 +223,8 @@ struct vb2_queue *v4l2_m2m_get_src_vq(struct v4l2_m2m_ctx *m2m_ctx)
209 223
210/** 224/**
211 * v4l2_m2m_get_dst_vq() - return vb2_queue for destination buffers 225 * v4l2_m2m_get_dst_vq() - return vb2_queue for destination buffers
226 *
227 * @m2m_ctx: pointer to struct v4l2_m2m_ctx
212 */ 228 */
213static inline 229static inline
214struct vb2_queue *v4l2_m2m_get_dst_vq(struct v4l2_m2m_ctx *m2m_ctx) 230struct vb2_queue *v4l2_m2m_get_dst_vq(struct v4l2_m2m_ctx *m2m_ctx)
@@ -221,6 +237,8 @@ void *v4l2_m2m_buf_remove(struct v4l2_m2m_queue_ctx *q_ctx);
221/** 237/**
222 * v4l2_m2m_src_buf_remove() - take off a source buffer from the list of ready 238 * v4l2_m2m_src_buf_remove() - take off a source buffer from the list of ready
223 * buffers and return it 239 * buffers and return it
240 *
241 * @m2m_ctx: pointer to struct v4l2_m2m_ctx
224 */ 242 */
225static inline void *v4l2_m2m_src_buf_remove(struct v4l2_m2m_ctx *m2m_ctx) 243static inline void *v4l2_m2m_src_buf_remove(struct v4l2_m2m_ctx *m2m_ctx)
226{ 244{
@@ -230,6 +248,8 @@ static inline void *v4l2_m2m_src_buf_remove(struct v4l2_m2m_ctx *m2m_ctx)
230/** 248/**
231 * v4l2_m2m_dst_buf_remove() - take off a destination buffer from the list of 249 * v4l2_m2m_dst_buf_remove() - take off a destination buffer from the list of
232 * ready buffers and return it 250 * ready buffers and return it
251 *
252 * @m2m_ctx: pointer to struct v4l2_m2m_ctx
233 */ 253 */
234static inline void *v4l2_m2m_dst_buf_remove(struct v4l2_m2m_ctx *m2m_ctx) 254static inline void *v4l2_m2m_dst_buf_remove(struct v4l2_m2m_ctx *m2m_ctx)
235{ 255{
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 4e18318eb425..b273cf9ac047 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -44,6 +44,7 @@
44 44
45struct v4l2_device; 45struct v4l2_device;
46struct v4l2_ctrl_handler; 46struct v4l2_ctrl_handler;
47struct v4l2_event;
47struct v4l2_event_subscription; 48struct v4l2_event_subscription;
48struct v4l2_fh; 49struct v4l2_fh;
49struct v4l2_subdev; 50struct v4l2_subdev;
@@ -117,34 +118,67 @@ struct v4l2_subdev_io_pin_config {
117 u8 strength; /* Pin drive strength */ 118 u8 strength; /* Pin drive strength */
118}; 119};
119 120
120/* 121/**
121 s_io_pin_config: configure one or more chip I/O pins for chips that 122 * struct v4l2_subdev_core_ops - Define core ops callbacks for subdevs
122 multiplex different internal signal pads out to IO pins. This function 123 *
123 takes a pointer to an array of 'n' pin configuration entries, one for 124 * @log_status: callback for VIDIOC_LOG_STATUS ioctl handler code.
124 each pin being configured. This function could be called at times 125 *
125 other than just subdevice initialization. 126 * @s_io_pin_config: configure one or more chip I/O pins for chips that
126 127 * multiplex different internal signal pads out to IO pins. This function
127 init: initialize the sensor registers to some sort of reasonable default 128 * takes a pointer to an array of 'n' pin configuration entries, one for
128 values. Do not use for new drivers and should be removed in existing 129 * each pin being configured. This function could be called at times
129 drivers. 130 * other than just subdevice initialization.
130 131 *
131 load_fw: load firmware. 132 * @init: initialize the sensor registers to some sort of reasonable default
132 133 * values. Do not use for new drivers and should be removed in existing
133 reset: generic reset command. The argument selects which subsystems to 134 * drivers.
134 reset. Passing 0 will always reset the whole chip. Do not use for new 135 *
135 drivers without discussing this first on the linux-media mailinglist. 136 * @load_fw: load firmware.
136 There should be no reason normally to reset a device. 137 *
137 138 * @reset: generic reset command. The argument selects which subsystems to
138 s_gpio: set GPIO pins. Very simple right now, might need to be extended with 139 * reset. Passing 0 will always reset the whole chip. Do not use for new
139 a direction argument if needed. 140 * drivers without discussing this first on the linux-media mailinglist.
140 141 * There should be no reason normally to reset a device.
141 s_power: puts subdevice in power saving mode (on == 0) or normal operation 142 *
142 mode (on == 1). 143 * @s_gpio: set GPIO pins. Very simple right now, might need to be extended with
143 144 * a direction argument if needed.
144 interrupt_service_routine: Called by the bridge chip's interrupt service 145 *
145 handler, when an interrupt status has be raised due to this subdev, 146 * @queryctrl: callback for VIDIOC_QUERYCTL ioctl handler code.
146 so that this subdev can handle the details. It may schedule work to be 147 *
147 performed later. It must not sleep. *Called from an IRQ context*. 148 * @g_ctrl: callback for VIDIOC_G_CTRL ioctl handler code.
149 *
150 * @s_ctrl: callback for VIDIOC_S_CTRL ioctl handler code.
151 *
152 * @g_ext_ctrls: callback for VIDIOC_G_EXT_CTRLS ioctl handler code.
153 *
154 * @s_ext_ctrls: callback for VIDIOC_S_EXT_CTRLS ioctl handler code.
155 *
156 * @try_ext_ctrls: callback for VIDIOC_TRY_EXT_CTRLS ioctl handler code.
157 *
158 * @querymenu: callback for VIDIOC_QUERYMENU ioctl handler code.
159 *
160 * @ioctl: called at the end of ioctl() syscall handler at the V4L2 core.
161 * used to provide support for private ioctls used on the driver.
162 *
163 * @compat_ioctl32: called when a 32 bits application uses a 64 bits Kernel,
164 * in order to fix data passed from/to userspace.
165 *
166 * @g_register: callback for VIDIOC_G_REGISTER ioctl handler code.
167 *
168 * @s_register: callback for VIDIOC_G_REGISTER ioctl handler code.
169 *
170 * @s_power: puts subdevice in power saving mode (on == 0) or normal operation
171 * mode (on == 1).
172 *
173 * @interrupt_service_routine: Called by the bridge chip's interrupt service
174 * handler, when an interrupt status has be raised due to this subdev,
175 * so that this subdev can handle the details. It may schedule work to be
176 * performed later. It must not sleep. *Called from an IRQ context*.
177 *
178 * @subscribe_event: used by the drivers to request the control framework that
179 * for it to be warned when the value of a control changes.
180 *
181 * @unsubscribe_event: remove event subscription from the control framework.
148 */ 182 */
149struct v4l2_subdev_core_ops { 183struct v4l2_subdev_core_ops {
150 int (*log_status)(struct v4l2_subdev *sd); 184 int (*log_status)(struct v4l2_subdev *sd);
@@ -179,18 +213,32 @@ struct v4l2_subdev_core_ops {
179 struct v4l2_event_subscription *sub); 213 struct v4l2_event_subscription *sub);
180}; 214};
181 215
182/* s_radio: v4l device was opened in radio mode. 216/**
183 217 * struct s_radio - Callbacks used when v4l device was opened in radio mode.
184 g_frequency: freq->type must be filled in. Normally done by video_ioctl2 218 *
185 or the bridge driver. 219 * @s_radio: callback for VIDIOC_S_RADIO ioctl handler code.
186 220 *
187 g_tuner: 221 * @s_frequency: callback for VIDIOC_S_FREQUENCY ioctl handler code.
188 s_tuner: vt->type must be filled in. Normally done by video_ioctl2 or the 222 *
189 bridge driver. 223 * @g_frequency: callback for VIDIOC_G_FREQUENCY ioctl handler code.
190 224 * freq->type must be filled in. Normally done by video_ioctl2
191 s_type_addr: sets tuner type and its I2C addr. 225 * or the bridge driver.
192 226 *
193 s_config: sets tda9887 specific stuff, like port1, port2 and qss 227 * @enum_freq_bands: callback for VIDIOC_ENUM_FREQ_BANDS ioctl handler code.
228 *
229 * @g_tuner: callback for VIDIOC_G_TUNER ioctl handler code.
230 *
231 * @s_tuner: callback for VIDIOC_S_TUNER ioctl handler code. vt->type must be
232 * filled in. Normally done by video_ioctl2 or the
233 * bridge driver.
234 *
235 * @g_modulator: callback for VIDIOC_G_MODULATOR ioctl handler code.
236 *
237 * @s_modulator: callback for VIDIOC_S_MODULATOR ioctl handler code.
238 *
239 * @s_type_addr: sets tuner type and its I2C addr.
240 *
241 * @s_config: sets tda9887 specific stuff, like port1, port2 and qss
194 */ 242 */
195struct v4l2_subdev_tuner_ops { 243struct v4l2_subdev_tuner_ops {
196 int (*s_radio)(struct v4l2_subdev *sd); 244 int (*s_radio)(struct v4l2_subdev *sd);
@@ -205,25 +253,31 @@ struct v4l2_subdev_tuner_ops {
205 int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config); 253 int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config);
206}; 254};
207 255
208/* s_clock_freq: set the frequency (in Hz) of the audio clock output. 256/**
209 Used to slave an audio processor to the video decoder, ensuring that 257 * struct v4l2_subdev_audio_ops - Callbacks used for audio-related settings
210 audio and video remain synchronized. Usual values for the frequency 258 *
211 are 48000, 44100 or 32000 Hz. If the frequency is not supported, then 259 * @s_clock_freq: set the frequency (in Hz) of the audio clock output.
212 -EINVAL is returned. 260 * Used to slave an audio processor to the video decoder, ensuring that
213 261 * audio and video remain synchronized. Usual values for the frequency
214 s_i2s_clock_freq: sets I2S speed in bps. This is used to provide a standard 262 * are 48000, 44100 or 32000 Hz. If the frequency is not supported, then
215 way to select I2S clock used by driving digital audio streams at some 263 * -EINVAL is returned.
216 board designs. Usual values for the frequency are 1024000 and 2048000. 264 *
217 If the frequency is not supported, then -EINVAL is returned. 265 * @s_i2s_clock_freq: sets I2S speed in bps. This is used to provide a standard
218 266 * way to select I2S clock used by driving digital audio streams at some
219 s_routing: used to define the input and/or output pins of an audio chip, 267 * board designs. Usual values for the frequency are 1024000 and 2048000.
220 and any additional configuration data. 268 * If the frequency is not supported, then -EINVAL is returned.
221 Never attempt to use user-level input IDs (e.g. Composite, S-Video, 269 *
222 Tuner) at this level. An i2c device shouldn't know about whether an 270 * @s_routing: used to define the input and/or output pins of an audio chip,
223 input pin is connected to a Composite connector, become on another 271 * and any additional configuration data.
224 board or platform it might be connected to something else entirely. 272 * Never attempt to use user-level input IDs (e.g. Composite, S-Video,
225 The calling driver is responsible for mapping a user-level input to 273 * Tuner) at this level. An i2c device shouldn't know about whether an
226 the right pins on the i2c device. 274 * input pin is connected to a Composite connector, become on another
275 * board or platform it might be connected to something else entirely.
276 * The calling driver is responsible for mapping a user-level input to
277 * the right pins on the i2c device.
278 *
279 * @s_stream: used to notify the audio code that stream will start or has
280 * stopped.
227 */ 281 */
228struct v4l2_subdev_audio_ops { 282struct v4l2_subdev_audio_ops {
229 int (*s_clock_freq)(struct v4l2_subdev *sd, u32 freq); 283 int (*s_clock_freq)(struct v4l2_subdev *sd, u32 freq);
@@ -242,6 +296,7 @@ struct v4l2_subdev_audio_ops {
242 296
243/** 297/**
244 * struct v4l2_mbus_frame_desc_entry - media bus frame description structure 298 * struct v4l2_mbus_frame_desc_entry - media bus frame description structure
299 *
245 * @flags: V4L2_MBUS_FRAME_DESC_FL_* flags 300 * @flags: V4L2_MBUS_FRAME_DESC_FL_* flags
246 * @pixelcode: media bus pixel code, valid if FRAME_DESC_FL_BLOB is not set 301 * @pixelcode: media bus pixel code, valid if FRAME_DESC_FL_BLOB is not set
247 * @length: number of octets per frame, valid if V4L2_MBUS_FRAME_DESC_FL_BLOB 302 * @length: number of octets per frame, valid if V4L2_MBUS_FRAME_DESC_FL_BLOB
@@ -265,45 +320,73 @@ struct v4l2_mbus_frame_desc {
265 unsigned short num_entries; 320 unsigned short num_entries;
266}; 321};
267 322
268/* 323/**
269 s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by 324 * struct v4l2_subdev_video_ops - Callbacks used when v4l device was opened
270 video input devices. 325 * in video mode.
271 326 *
272 g_std_output: get current standard for video OUTPUT devices. This is ignored 327 * @s_routing: see s_routing in audio_ops, except this version is for video
273 by video input devices. 328 * devices.
274 329 *
275 g_tvnorms: get v4l2_std_id with all standards supported by the video 330 * @s_crystal_freq: sets the frequency of the crystal used to generate the
276 CAPTURE device. This is ignored by video output devices. 331 * clocks in Hz. An extra flags field allows device specific configuration
277 332 * regarding clock frequency dividers, etc. If not used, then set flags
278 g_tvnorms_output: get v4l2_std_id with all standards supported by the video 333 * to 0. If the frequency is not supported, then -EINVAL is returned.
279 OUTPUT device. This is ignored by video capture devices. 334 *
280 335 * @g_std: callback for VIDIOC_G_STD ioctl handler code.
281 s_crystal_freq: sets the frequency of the crystal used to generate the 336 *
282 clocks in Hz. An extra flags field allows device specific configuration 337 * @s_std: callback for VIDIOC_S_STD ioctl handler code.
283 regarding clock frequency dividers, etc. If not used, then set flags 338 *
284 to 0. If the frequency is not supported, then -EINVAL is returned. 339 * @s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by
285 340 * video input devices.
286 g_input_status: get input status. Same as the status field in the v4l2_input 341 *
287 struct. 342 * @g_std_output: get current standard for video OUTPUT devices. This is ignored
288 343 * by video input devices.
289 s_routing: see s_routing in audio_ops, except this version is for video 344 *
290 devices. 345 * @querystd: callback for VIDIOC_QUERYSTD ioctl handler code.
291 346 *
292 s_dv_timings(): Set custom dv timings in the sub device. This is used 347 * @g_tvnorms: get v4l2_std_id with all standards supported by the video
293 when sub device is capable of setting detailed timing information 348 * CAPTURE device. This is ignored by video output devices.
294 in the hardware to generate/detect the video signal. 349 *
295 350 * @g_tvnorms_output: get v4l2_std_id with all standards supported by the video
296 g_dv_timings(): Get custom dv timings in the sub device. 351 * OUTPUT device. This is ignored by video capture devices.
297 352 *
298 g_mbus_config: get supported mediabus configurations 353 * @g_input_status: get input status. Same as the status field in the v4l2_input
299 354 * struct.
300 s_mbus_config: set a certain mediabus configuration. This operation is added 355 *
301 for compatibility with soc-camera drivers and should not be used by new 356 * @s_stream: used to notify the driver that a video stream will start or has
302 software. 357 * stopped.
303 358 *
304 s_rx_buffer: set a host allocated memory buffer for the subdev. The subdev 359 * @cropcap: callback for VIDIOC_CROPCAP ioctl handler code.
305 can adjust @size to a lower value and must not write more data to the 360 *
306 buffer starting at @data than the original value of @size. 361 * @g_crop: callback for VIDIOC_G_CROP ioctl handler code.
362 *
363 * @s_crop: callback for VIDIOC_S_CROP ioctl handler code.
364 *
365 * @g_parm: callback for VIDIOC_G_PARM ioctl handler code.
366 *
367 * @s_parm: callback for VIDIOC_S_PARM ioctl handler code.
368 *
369 * @g_frame_interval: callback for VIDIOC_G_FRAMEINTERVAL ioctl handler code.
370 *
371 * @s_frame_interval: callback for VIDIOC_S_FRAMEINTERVAL ioctl handler code.
372 *
373 * @s_dv_timings: Set custom dv timings in the sub device. This is used
374 * when sub device is capable of setting detailed timing information
375 * in the hardware to generate/detect the video signal.
376 *
377 * @g_dv_timings: Get custom dv timings in the sub device.
378 *
379 * @query_dv_timings: callback for VIDIOC_QUERY_DV_TIMINGS ioctl handler code.
380 *
381 * @g_mbus_config: get supported mediabus configurations
382 *
383 * @s_mbus_config: set a certain mediabus configuration. This operation is added
384 * for compatibility with soc-camera drivers and should not be used by new
385 * software.
386 *
387 * @s_rx_buffer: set a host allocated memory buffer for the subdev. The subdev
388 * can adjust @size to a lower value and must not write more data to the
389 * buffer starting at @data than the original value of @size.
307 */ 390 */
308struct v4l2_subdev_video_ops { 391struct v4l2_subdev_video_ops {
309 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config); 392 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
@@ -340,34 +423,39 @@ struct v4l2_subdev_video_ops {
340 unsigned int *size); 423 unsigned int *size);
341}; 424};
342 425
343/* 426/**
344 decode_vbi_line: video decoders that support sliced VBI need to implement 427 * struct v4l2_subdev_vbi_ops - Callbacks used when v4l device was opened
345 this ioctl. Field p of the v4l2_sliced_vbi_line struct is set to the 428 * in video mode via the vbi device node.
346 start of the VBI data that was generated by the decoder. The driver 429 *
347 then parses the sliced VBI data and sets the other fields in the 430 * @decode_vbi_line: video decoders that support sliced VBI need to implement
348 struct accordingly. The pointer p is updated to point to the start of 431 * this ioctl. Field p of the v4l2_sliced_vbi_line struct is set to the
349 the payload which can be copied verbatim into the data field of the 432 * start of the VBI data that was generated by the decoder. The driver
350 v4l2_sliced_vbi_data struct. If no valid VBI data was found, then the 433 * then parses the sliced VBI data and sets the other fields in the
351 type field is set to 0 on return. 434 * struct accordingly. The pointer p is updated to point to the start of
352 435 * the payload which can be copied verbatim into the data field of the
353 s_vbi_data: used to generate VBI signals on a video signal. 436 * v4l2_sliced_vbi_data struct. If no valid VBI data was found, then the
354 v4l2_sliced_vbi_data is filled with the data packets that should be 437 * type field is set to 0 on return.
355 output. Note that if you set the line field to 0, then that VBI signal 438 *
356 is disabled. If no valid VBI data was found, then the type field is 439 * @s_vbi_data: used to generate VBI signals on a video signal.
357 set to 0 on return. 440 * v4l2_sliced_vbi_data is filled with the data packets that should be
358 441 * output. Note that if you set the line field to 0, then that VBI signal
359 g_vbi_data: used to obtain the sliced VBI packet from a readback register. 442 * is disabled. If no valid VBI data was found, then the type field is
360 Not all video decoders support this. If no data is available because 443 * set to 0 on return.
361 the readback register contains invalid or erroneous data -EIO is 444 *
362 returned. Note that you must fill in the 'id' member and the 'field' 445 * @g_vbi_data: used to obtain the sliced VBI packet from a readback register.
363 member (to determine whether CC data from the first or second field 446 * Not all video decoders support this. If no data is available because
364 should be obtained). 447 * the readback register contains invalid or erroneous data -EIO is
365 448 * returned. Note that you must fill in the 'id' member and the 'field'
366 s_raw_fmt: setup the video encoder/decoder for raw VBI. 449 * member (to determine whether CC data from the first or second field
367 450 * should be obtained).
368 g_sliced_fmt: retrieve the current sliced VBI settings. 451 *
369 452 * @g_sliced_vbi_cap: callback for VIDIOC_SLICED_VBI_CAP ioctl handler code.
370 s_sliced_fmt: setup the sliced VBI settings. 453 *
454 * @s_raw_fmt: setup the video encoder/decoder for raw VBI.
455 *
456 * @g_sliced_fmt: retrieve the current sliced VBI settings.
457 *
458 * @s_sliced_fmt: setup the sliced VBI settings.
371 */ 459 */
372struct v4l2_subdev_vbi_ops { 460struct v4l2_subdev_vbi_ops {
373 int (*decode_vbi_line)(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi_line); 461 int (*decode_vbi_line)(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi_line);
@@ -480,8 +568,39 @@ struct v4l2_subdev_pad_config {
480 568
481/** 569/**
482 * struct v4l2_subdev_pad_ops - v4l2-subdev pad level operations 570 * struct v4l2_subdev_pad_ops - v4l2-subdev pad level operations
571 *
572 * @enum_mbus_code: callback for VIDIOC_SUBDEV_ENUM_MBUS_CODE ioctl handler
573 * code.
574 * @enum_frame_size: callback for VIDIOC_SUBDEV_ENUM_FRAME_SIZE ioctl handler
575 * code.
576 *
577 * @enum_frame_interval: callback for VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL ioctl
578 * handler code.
579 *
580 * @get_fmt: callback for VIDIOC_SUBDEV_G_FMT ioctl handler code.
581 *
582 * @set_fmt: callback for VIDIOC_SUBDEV_S_FMT ioctl handler code.
583 *
584 * @get_selection: callback for VIDIOC_SUBDEV_G_SELECTION ioctl handler code.
585 *
586 * @set_selection: callback for VIDIOC_SUBDEV_S_SELECTION ioctl handler code.
587 *
588 * @get_edid: callback for VIDIOC_SUBDEV_G_EDID ioctl handler code.
589 *
590 * @set_edid: callback for VIDIOC_SUBDEV_S_EDID ioctl handler code.
591 *
592 * @dv_timings_cap: callback for VIDIOC_SUBDEV_DV_TIMINGS_CAP ioctl handler
593 * code.
594 *
595 * @enum_dv_timings: callback for VIDIOC_SUBDEV_ENUM_DV_TIMINGS ioctl handler
596 * code.
597 *
598 * @link_validate: used by the media controller code to check if the links
599 * that belongs to a pipeline can be used for stream.
600 *
483 * @get_frame_desc: get the current low level media bus frame parameters. 601 * @get_frame_desc: get the current low level media bus frame parameters.
484 * @get_frame_desc: set the low level media bus frame parameters, @fd array 602 *
603 * @set_frame_desc: set the low level media bus frame parameters, @fd array
485 * may be adjusted by the subdev driver to device capabilities. 604 * may be adjusted by the subdev driver to device capabilities.
486 */ 605 */
487struct v4l2_subdev_pad_ops { 606struct v4l2_subdev_pad_ops {
@@ -695,4 +814,7 @@ void v4l2_subdev_init(struct v4l2_subdev *sd,
695#define v4l2_subdev_has_op(sd, o, f) \ 814#define v4l2_subdev_has_op(sd, o, f) \
696 ((sd)->ops->o && (sd)->ops->o->f) 815 ((sd)->ops->o && (sd)->ops->o->f)
697 816
817void v4l2_subdev_notify_event(struct v4l2_subdev *sd,
818 const struct v4l2_event *ev);
819
698#endif 820#endif
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index c192e1b46cdc..589b56c68400 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -364,7 +364,9 @@ struct v4l2_fh;
364 * start_streaming() can be called. Used when a DMA engine 364 * start_streaming() can be called. Used when a DMA engine
365 * cannot be started unless at least this number of buffers 365 * cannot be started unless at least this number of buffers
366 * have been queued into the driver. 366 * have been queued into the driver.
367 * 367 */
368/*
369 * Private elements (won't appear at the DocBook):
368 * @mmap_lock: private mutex used when buffers are allocated/freed/mmapped 370 * @mmap_lock: private mutex used when buffers are allocated/freed/mmapped
369 * @memory: current memory type used 371 * @memory: current memory type used
370 * @bufs: videobuf buffer structures 372 * @bufs: videobuf buffer structures
@@ -407,7 +409,7 @@ struct vb2_queue {
407 gfp_t gfp_flags; 409 gfp_t gfp_flags;
408 u32 min_buffers_needed; 410 u32 min_buffers_needed;
409 411
410/* private: internal use only */ 412 /* private: internal use only */
411 struct mutex mmap_lock; 413 struct mutex mmap_lock;
412 enum v4l2_memory memory; 414 enum v4l2_memory memory;
413 struct vb2_buffer *bufs[VIDEO_MAX_FRAME]; 415 struct vb2_buffer *bufs[VIDEO_MAX_FRAME];
@@ -484,7 +486,8 @@ size_t vb2_read(struct vb2_queue *q, char __user *data, size_t count,
484 loff_t *ppos, int nonblock); 486 loff_t *ppos, int nonblock);
485size_t vb2_write(struct vb2_queue *q, const char __user *data, size_t count, 487size_t vb2_write(struct vb2_queue *q, const char __user *data, size_t count,
486 loff_t *ppos, int nonblock); 488 loff_t *ppos, int nonblock);
487/** 489
490/*
488 * vb2_thread_fnc - callback function for use with vb2_thread 491 * vb2_thread_fnc - callback function for use with vb2_thread
489 * 492 *
490 * This is called whenever a buffer is dequeued in the thread. 493 * This is called whenever a buffer is dequeued in the thread.
@@ -577,7 +580,6 @@ static inline void vb2_set_plane_payload(struct vb2_buffer *vb,
577 * vb2_get_plane_payload() - get bytesused for the plane plane_no 580 * vb2_get_plane_payload() - get bytesused for the plane plane_no
578 * @vb: buffer for which plane payload should be set 581 * @vb: buffer for which plane payload should be set
579 * @plane_no: plane number for which payload should be set 582 * @plane_no: plane number for which payload should be set
580 * @size: payload in bytes
581 */ 583 */
582static inline unsigned long vb2_get_plane_payload(struct vb2_buffer *vb, 584static inline unsigned long vb2_get_plane_payload(struct vb2_buffer *vb,
583 unsigned int plane_no) 585 unsigned int plane_no)
diff --git a/include/media/videobuf2-memops.h b/include/media/videobuf2-memops.h
index f05444ca8c0c..9f36641a6781 100644
--- a/include/media/videobuf2-memops.h
+++ b/include/media/videobuf2-memops.h
@@ -17,7 +17,8 @@
17#include <media/videobuf2-core.h> 17#include <media/videobuf2-core.h>
18 18
19/** 19/**
20 * vb2_vmarea_handler - common vma refcount tracking handler 20 * struct vb2_vmarea_handler - common vma refcount tracking handler
21 *
21 * @refcount: pointer to refcount entry in the buffer 22 * @refcount: pointer to refcount entry in the buffer
22 * @put: callback to function that decreases buffer refcount 23 * @put: callback to function that decreases buffer refcount
23 * @arg: argument for @put callback 24 * @arg: argument for @put callback