History

Merge tag 'media/v5.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media updates from Mauro Carvalho Chehab: - Legacy soc_camera driver was removed from staging - New I2C sensor related drivers: dw9768, ch7322, max9271, rdacm20 - TI vpe driver code was re-organized and had new features added - Added Xilinx MIPI CSI-2 Rx Subsystem driver - Added support for Infrared Toy and IR Droid devices - Lots of random driver fixes, new features and cleanups * tag 'media/v5.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (318 commits) media: camss: fix memory leaks on error handling paths in probe media: davinci: vpif_capture: fix potential double free media: radio: remove redundant assignment to variable retval media: allegro: fix potential null dereference on header media: mtk-mdp: Fix a refcounting bug on error in init media: allegro: fix an error pointer vs NULL check media: meye: fix missing pm_mchip_mode field media: cafe-driver: use generic power management media: saa7164: use generic power management media: v4l2-dev/ioctl: Fix document for VIDIOC_QUERYCAP media: v4l2: Correct kernel-doc inconsistency media: v4l2: Correct kernel-doc inconsistency media: dvbdev.h: keep * together with the type media: v4l2-subdev.h: keep * together with the type media: videobuf2: Print videobuf2 buffer state by name media: colorspaces-details.rst: fix V4L2_COLORSPACE_JPEG description media: tw68: use generic power management media: meye: use generic power management media: cx88: use generic power management media: cx25821: use generic power management ...

Linus Torvalds committed 6 years ago

Commit fa73e212 parents 75dee3b f45882c268 files · +12785 −12116Browse files

Showing the changes to include (17 of 268 files). Show all

Unified · Split

17 files
  1. include/linux/platform_data/media/omap1_camera.h +0 −32
  2. include/linux/property.h +5 −0
  3. include/media/cec.h +55 −2
  4. include/media/davinci/vpbe_display.h +1 −1
  5. include/media/drv-intf/soc_mediabus.h +0 −107
  6. include/media/dvbdev.h +3 −3
  7. include/media/media-device.h +1 −1
  8. include/media/media-devnode.h +1 −1
  9. include/media/media-entity.h +1 −1
  10. include/media/soc_camera.h +0 −397
  11. include/media/tpg/v4l2-tpg.h +2 −1
  12. include/media/v4l2-mc.h +4 −4
  13. include/media/v4l2-rect.h +20 −0
  14. include/media/v4l2-subdev.h +20 −19
  15. include/media/videobuf2-core.h +40 −11
  16. include/media/videobuf2-v4l2.h +13 −0
  17. include/uapi/linux/videodev2.h +15 −2
include/linux/platform_data/media/omap1_camera.h+0−32
@@ -1,32 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Header for V4L2 SoC Camera driver for OMAP1 Camera Interface
4 *
5 * Copyright (C) 2010, Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
6 */
7
8#ifndef __MEDIA_OMAP1_CAMERA_H_
9#define __MEDIA_OMAP1_CAMERA_H_
10
11#include <linux/bitops.h>
12
13#define OMAP1_CAMERA_IOSIZE 0x1c
14
15enum omap1_cam_vb_mode {
16 OMAP1_CAM_DMA_CONTIG = 0,
17 OMAP1_CAM_DMA_SG,
18};
19
20#define OMAP1_CAMERA_MIN_BUF_COUNT(x) ((x) == OMAP1_CAM_DMA_CONTIG ? 3 : 2)
21
22struct omap1_cam_platform_data {
23 unsigned long camexclk_khz;
24 unsigned long lclk_khz_max;
25 unsigned long flags;
26};
27
28#define OMAP1_CAMERA_LCLK_RISING BIT(0)
29#define OMAP1_CAMERA_RST_LOW BIT(1)
30#define OMAP1_CAMERA_RST_HIGH BIT(2)
31
32#endif /* __MEDIA_OMAP1_CAMERA_H_ */
include/linux/property.h+5−0
@@ -389,6 +389,11 @@ struct fwnode_handle * · 388 unmodified lines
389fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port,389fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port,
390 u32 endpoint);390 u32 endpoint);
391 391
392static inline bool fwnode_graph_is_endpoint(struct fwnode_handle *fwnode)
393{
394 return fwnode_property_present(fwnode, "remote-endpoint");
395}
396
392/*397/*
393 * Fwnode lookup flags398 * Fwnode lookup flags
394 *399 *
include/media/cec.h+55−2
@@ -144,6 +144,60 @@ struct cec_adap_ops { · 143 unmodified lines
144 */144 */
145#define CEC_MAX_MSG_TX_QUEUE_SZ (18 * 1)145#define CEC_MAX_MSG_TX_QUEUE_SZ (18 * 1)
146 146
147/**
148 * struct cec_adapter - cec adapter structure
149 * @owner: module owner
150 * @name: name of the CEC adapter
151 * @devnode: device node for the /dev/cecX device
152 * @lock: mutex controlling access to this structure
153 * @rc: remote control device
154 * @transmit_queue: queue of pending transmits
155 * @transmit_queue_sz: number of pending transmits
156 * @wait_queue: queue of transmits waiting for a reply
157 * @transmitting: CEC messages currently being transmitted
158 * @transmit_in_progress: true if a transmit is in progress
159 * @kthread_config: kthread used to configure a CEC adapter
160 * @config_completion: used to signal completion of the config kthread
161 * @kthread: main CEC processing thread
162 * @kthread_waitq: main CEC processing wait_queue
163 * @ops: cec adapter ops
164 * @priv: cec driver's private data
165 * @capabilities: cec adapter capabilities
166 * @available_log_addrs: maximum number of available logical addresses
167 * @phys_addr: the current physical address
168 * @needs_hpd: if true, then the HDMI HotPlug Detect pin must be high
169 * in order to transmit or receive CEC messages. This is usually a HW
170 * limitation.
171 * @is_configuring: the CEC adapter is configuring (i.e. claiming LAs)
172 * @is_configured: the CEC adapter is configured (i.e. has claimed LAs)
173 * @cec_pin_is_high: if true then the CEC pin is high. Only used with the
174 * CEC pin framework.
175 * @adap_controls_phys_addr: if true, then the CEC adapter controls the
176 * physical address, i.e. the CEC hardware can detect HPD changes and
177 * read the EDID and is not dependent on an external HDMI driver.
178 * Drivers that need this can set this field to true after the
179 * cec_allocate_adapter() call.
180 * @last_initiator: the initiator of the last transmitted message.
181 * @monitor_all_cnt: number of filehandles monitoring all msgs
182 * @monitor_pin_cnt: number of filehandles monitoring pin changes
183 * @follower_cnt: number of filehandles in follower mode
184 * @cec_follower: filehandle of the exclusive follower
185 * @cec_initiator: filehandle of the exclusive initiator
186 * @passthrough: if true, then the exclusive follower is in
187 * passthrough mode.
188 * @log_addrs: current logical addresses
189 * @conn_info: current connector info
190 * @tx_timeouts: number of transmit timeouts
191 * @notifier: CEC notifier
192 * @pin: CEC pin status struct
193 * @cec_dir: debugfs cec directory
194 * @status_file: debugfs cec status file
195 * @error_inj_file: debugfs cec error injection file
196 * @sequence: transmit sequence counter
197 * @input_phys: remote control input_phys name
198 *
199 * This structure represents a cec adapter.
200 */
147struct cec_adapter {201struct cec_adapter {
148 struct module *owner;202 struct module *owner;
149 char name[32];203 char name[32];
@@ -162,7 +216,6 @@ struct cec_adapter { · 12 unmodified lines
162 216
163 struct task_struct *kthread;217 struct task_struct *kthread;
164 wait_queue_head_t kthread_waitq;218 wait_queue_head_t kthread_waitq;
165 wait_queue_head_t waitq;
166 219
167 const struct cec_adap_ops *ops;220 const struct cec_adap_ops *ops;
168 void *priv;221 void *priv;
@@ -174,6 +227,7 @@ struct cec_adapter { · 5 unmodified lines
174 bool is_configuring;227 bool is_configuring;
175 bool is_configured;228 bool is_configured;
176 bool cec_pin_is_high;229 bool cec_pin_is_high;
230 bool adap_controls_phys_addr;
177 u8 last_initiator;231 u8 last_initiator;
178 u32 monitor_all_cnt;232 u32 monitor_all_cnt;
179 u32 monitor_pin_cnt;233 u32 monitor_pin_cnt;
@@ -197,7 +251,6 @@ struct cec_adapter { · 17 unmodified lines
197 struct dentry *status_file;251 struct dentry *status_file;
198 struct dentry *error_inj_file;252 struct dentry *error_inj_file;
199 253
200 u16 phys_addrs[15];
201 u32 sequence;254 u32 sequence;
202 255
203 char input_phys[32];256 char input_phys[32];
include/media/davinci/vpbe_display.h+1−1
@@ -1,6 +1,6 @@
1/* SPDX-License-Identifier: GPL-2.0-only */1/* SPDX-License-Identifier: GPL-2.0-only */
2/*2/*
3 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/3 * Copyright (C) 2010 Texas Instruments Incorporated - https://www.ti.com/
4 */4 */
5#ifndef VPBE_DISPLAY_H5#ifndef VPBE_DISPLAY_H
6#define VPBE_DISPLAY_H6#define VPBE_DISPLAY_H
include/media/drv-intf/soc_mediabus.h+0−107
@@ -1,107 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * SoC-camera Media Bus API extensions
4 *
5 * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
6 */
7
8#ifndef SOC_MEDIABUS_H
9#define SOC_MEDIABUS_H
10
11#include <linux/videodev2.h>
12#include <linux/v4l2-mediabus.h>
13
14/**
15 * enum soc_mbus_packing - data packing types on the media-bus
16 * @SOC_MBUS_PACKING_NONE: no packing, bit-for-bit transfer to RAM, one
17 * sample represents one pixel
18 * @SOC_MBUS_PACKING_2X8_PADHI: 16 bits transferred in 2 8-bit samples, in the
19 * possibly incomplete byte high bits are padding
20 * @SOC_MBUS_PACKING_2X8_PADLO: as above, but low bits are padding
21 * @SOC_MBUS_PACKING_EXTEND16: sample width (e.g., 10 bits) has to be extended
22 * to 16 bits
23 * @SOC_MBUS_PACKING_VARIABLE: compressed formats with variable packing
24 * @SOC_MBUS_PACKING_1_5X8: used for packed YUV 4:2:0 formats, where 4
25 * pixels occupy 6 bytes in RAM
26 * @SOC_MBUS_PACKING_EXTEND32: sample width (e.g., 24 bits) has to be extended
27 * to 32 bits
28 */
29enum soc_mbus_packing {
30 SOC_MBUS_PACKING_NONE,
31 SOC_MBUS_PACKING_2X8_PADHI,
32 SOC_MBUS_PACKING_2X8_PADLO,
33 SOC_MBUS_PACKING_EXTEND16,
34 SOC_MBUS_PACKING_VARIABLE,
35 SOC_MBUS_PACKING_1_5X8,
36 SOC_MBUS_PACKING_EXTEND32,
37};
38
39/**
40 * enum soc_mbus_order - sample order on the media bus
41 * @SOC_MBUS_ORDER_LE: least significant sample first
42 * @SOC_MBUS_ORDER_BE: most significant sample first
43 */
44enum soc_mbus_order {
45 SOC_MBUS_ORDER_LE,
46 SOC_MBUS_ORDER_BE,
47};
48
49/**
50 * enum soc_mbus_layout - planes layout in memory
51 * @SOC_MBUS_LAYOUT_PACKED: color components packed
52 * @SOC_MBUS_LAYOUT_PLANAR_2Y_U_V: YUV components stored in 3 planes (4:2:2)
53 * @SOC_MBUS_LAYOUT_PLANAR_2Y_C: YUV components stored in a luma and a
54 * chroma plane (C plane is half the size
55 * of Y plane)
56 * @SOC_MBUS_LAYOUT_PLANAR_Y_C: YUV components stored in a luma and a
57 * chroma plane (C plane is the same size
58 * as Y plane)
59 */
60enum soc_mbus_layout {
61 SOC_MBUS_LAYOUT_PACKED = 0,
62 SOC_MBUS_LAYOUT_PLANAR_2Y_U_V,
63 SOC_MBUS_LAYOUT_PLANAR_2Y_C,
64 SOC_MBUS_LAYOUT_PLANAR_Y_C,
65};
66
67/**
68 * struct soc_mbus_pixelfmt - Data format on the media bus
69 * @fourcc: Fourcc code, that will be obtained if the data is
70 * stored in memory in the following way:
71 * @packing: Type of sample-packing, that has to be used
72 * @order: Sample order when storing in memory
73 * @bits_per_sample: How many bits the bridge has to sample
74 */
75struct soc_mbus_pixelfmt {
76 u32 fourcc;
77 enum soc_mbus_packing packing;
78 enum soc_mbus_order order;
79 enum soc_mbus_layout layout;
80 u8 bits_per_sample;
81};
82
83/**
84 * struct soc_mbus_lookup - Lookup FOURCC IDs by mediabus codes for pass-through
85 * @code: mediabus pixel-code
86 * @fmt: pixel format description
87 */
88struct soc_mbus_lookup {
89 u32 code;
90 struct soc_mbus_pixelfmt fmt;
91};
92
93const struct soc_mbus_pixelfmt *soc_mbus_find_fmtdesc(
94 u32 code,
95 const struct soc_mbus_lookup *lookup,
96 int n);
97const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc(
98 u32 code);
99s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf);
100s32 soc_mbus_image_size(const struct soc_mbus_pixelfmt *mf,
101 u32 bytes_per_line, u32 height);
102int soc_mbus_samples_per_pixel(const struct soc_mbus_pixelfmt *mf,
103 unsigned int *numerator, unsigned int *denominator);
104unsigned int soc_mbus_config_compatible(const struct v4l2_mbus_config *cfg,
105 unsigned int flags);
106
107#endif
include/media/dvbdev.h+3−3
@@ -293,8 +293,8 @@ static inline void dvb_register_media_controller(struct dvb_adapter *adap, · 292 unmodified lines
293 *293 *
294 * @adap: pointer to &struct dvb_adapter294 * @adap: pointer to &struct dvb_adapter
295 */295 */
296static inline struct media_device296static inline struct media_device *
297*dvb_get_media_controller(struct dvb_adapter *adap)297dvb_get_media_controller(struct dvb_adapter *adap)
298{298{
299 return adap->mdev;299 return adap->mdev;
300}300}
@@ -385,7 +385,7 @@ struct i2c_client; · 84 unmodified lines
385 * with dvb_module_probe() should use dvb_module_release() to unbind.385 * with dvb_module_probe() should use dvb_module_release() to unbind.
386 *386 *
387 * Return:387 * Return:
388 * On success, return an &struct i2c_client, pointing the the bound388 * On success, return an &struct i2c_client, pointing to the bound
389 * I2C device. %NULL otherwise.389 * I2C device. %NULL otherwise.
390 *390 *
391 * .. note::391 * .. note::
include/media/media-device.h+1−1
@@ -128,7 +128,7 @@ struct media_device_ops { · 127 unmodified lines
128 *128 *
129 * Use-case: find tuner entity connected to the decoder129 * Use-case: find tuner entity connected to the decoder
130 * entity and check if it is available, and activate the130 * entity and check if it is available, and activate the
131 * the link between them from @enable_source and deactivate131 * link between them from @enable_source and deactivate
132 * from @disable_source.132 * from @disable_source.
133 *133 *
134 * .. note::134 * .. note::
include/media/media-devnode.h+1−1
@@ -39,7 +39,7 @@ struct media_device; · 38 unmodified lines
39 * @poll: pointer to the function that implements poll() syscall39 * @poll: pointer to the function that implements poll() syscall
40 * @ioctl: pointer to the function that implements ioctl() syscall40 * @ioctl: pointer to the function that implements ioctl() syscall
41 * @compat_ioctl: pointer to the function that will handle 32 bits userspace41 * @compat_ioctl: pointer to the function that will handle 32 bits userspace
42 * calls to the the ioctl() syscall on a Kernel compiled with 64 bits.42 * calls to the ioctl() syscall on a Kernel compiled with 64 bits.
43 * @open: pointer to the function that implements open() syscall43 * @open: pointer to the function that implements open() syscall
44 * @release: pointer to the function that will release the resources allocated44 * @release: pointer to the function that will release the resources allocated
45 * by the @open function.45 * by the @open function.
include/media/media-entity.h+1−1
@@ -803,7 +803,7 @@ int __media_entity_setup_link(struct media_link *link, u32 flags); · 802 unmodified lines
803 * @flags: the requested new link flags803 * @flags: the requested new link flags
804 *804 *
805 * The only configurable property is the %MEDIA_LNK_FL_ENABLED link flag805 * The only configurable property is the %MEDIA_LNK_FL_ENABLED link flag
806 * flag to enable/disable a link. Links marked with the806 * to enable/disable a link. Links marked with the
807 * %MEDIA_LNK_FL_IMMUTABLE link flag can not be enabled or disabled.807 * %MEDIA_LNK_FL_IMMUTABLE link flag can not be enabled or disabled.
808 *808 *
809 * When a link is enabled or disabled, the media framework calls the809 * When a link is enabled or disabled, the media framework calls the
include/media/soc_camera.h+0−397
@@ -1,397 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * camera image capture (abstract) bus driver header
4 *
5 * Copyright (C) 2006, Sascha Hauer, Pengutronix
6 * Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de>
7 */
8
9#ifndef SOC_CAMERA_H
10#define SOC_CAMERA_H
11
12#include <linux/bitops.h>
13#include <linux/device.h>
14#include <linux/mutex.h>
15#include <linux/pm.h>
16#include <linux/videodev2.h>
17#include <media/videobuf2-v4l2.h>
18#include <media/v4l2-async.h>
19#include <media/v4l2-ctrls.h>
20#include <media/v4l2-device.h>
21
22struct file;
23struct soc_camera_desc;
24struct soc_camera_async_client;
25
26struct soc_camera_device {
27 struct list_head list; /* list of all registered devices */
28 struct soc_camera_desc *sdesc;
29 struct device *pdev; /* Platform device */
30 struct device *parent; /* Camera host device */
31 struct device *control; /* E.g., the i2c client */
32 s32 user_width;
33 s32 user_height;
34 u32 bytesperline; /* for padding, zero if unused */
35 u32 sizeimage;
36 enum v4l2_colorspace colorspace;
37 unsigned char iface; /* Host number */
38 unsigned char devnum; /* Device number per host */
39 struct soc_camera_sense *sense; /* See comment in struct definition */
40 struct video_device *vdev;
41 struct v4l2_ctrl_handler ctrl_handler;
42 const struct soc_camera_format_xlate *current_fmt;
43 struct soc_camera_format_xlate *user_formats;
44 int num_user_formats;
45 enum v4l2_field field; /* Preserve field over close() */
46 void *host_priv; /* Per-device host private data */
47 /* soc_camera.c private count. Only accessed with .host_lock held */
48 int use_count;
49 struct file *streamer; /* stream owner */
50 struct v4l2_clk *clk;
51 /* Asynchronous subdevice management */
52 struct soc_camera_async_client *sasc;
53 /* video buffer queue */
54 struct vb2_queue vb2_vidq;
55};
56
57/* Host supports programmable stride */
58#define SOCAM_HOST_CAP_STRIDE (1 << 0)
59
60enum soc_camera_subdev_role {
61 SOCAM_SUBDEV_DATA_SOURCE = 1,
62 SOCAM_SUBDEV_DATA_SINK,
63 SOCAM_SUBDEV_DATA_PROCESSOR,
64};
65
66struct soc_camera_async_subdev {
67 struct v4l2_async_subdev asd;
68 enum soc_camera_subdev_role role;
69};
70
71struct soc_camera_host {
72 struct v4l2_device v4l2_dev;
73 struct list_head list;
74 struct mutex host_lock; /* Main synchronisation lock */
75 struct mutex clk_lock; /* Protect pipeline modifications */
76 unsigned char nr; /* Host number */
77 u32 capabilities;
78 struct soc_camera_device *icd; /* Currently attached client */
79 void *priv;
80 const char *drv_name;
81 struct soc_camera_host_ops *ops;
82 struct v4l2_async_subdev **asd; /* Flat array, arranged in groups */
83 unsigned int *asd_sizes; /* 0-terminated array of asd group sizes */
84};
85
86struct soc_camera_host_ops {
87 struct module *owner;
88 int (*add)(struct soc_camera_device *);
89 void (*remove)(struct soc_camera_device *);
90 int (*clock_start)(struct soc_camera_host *);
91 void (*clock_stop)(struct soc_camera_host *);
92 /*
93 * .get_formats() is called for each client device format, but
94 * .put_formats() is only called once. Further, if any of the calls to
95 * .get_formats() fail, .put_formats() will not be called at all, the
96 * failing .get_formats() must then clean up internally.
97 */
98 int (*get_formats)(struct soc_camera_device *, unsigned int,
99 struct soc_camera_format_xlate *);
100 void (*put_formats)(struct soc_camera_device *);
101 int (*get_selection)(struct soc_camera_device *, struct v4l2_selection *);
102 int (*set_selection)(struct soc_camera_device *, struct v4l2_selection *);
103 /*
104 * The difference to .set_selection() is, that .set_liveselection is not allowed
105 * to change the output sizes
106 */
107 int (*set_liveselection)(struct soc_camera_device *, struct v4l2_selection *);
108 int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *);
109 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *);
110 int (*init_videobuf2)(struct vb2_queue *,
111 struct soc_camera_device *);
112 int (*querycap)(struct soc_camera_host *, struct v4l2_capability *);
113 int (*set_bus_param)(struct soc_camera_device *);
114 int (*get_parm)(struct soc_camera_device *, struct v4l2_streamparm *);
115 int (*set_parm)(struct soc_camera_device *, struct v4l2_streamparm *);
116 int (*enum_framesizes)(struct soc_camera_device *, struct v4l2_frmsizeenum *);
117 __poll_t (*poll)(struct file *, poll_table *);
118};
119
120#define SOCAM_SENSOR_INVERT_PCLK (1 << 0)
121#define SOCAM_SENSOR_INVERT_MCLK (1 << 1)
122#define SOCAM_SENSOR_INVERT_HSYNC (1 << 2)
123#define SOCAM_SENSOR_INVERT_VSYNC (1 << 3)
124#define SOCAM_SENSOR_INVERT_DATA (1 << 4)
125
126struct i2c_board_info;
127struct regulator_bulk_data;
128
129struct soc_camera_subdev_desc {
130 /* Per camera SOCAM_SENSOR_* bus flags */
131 unsigned long flags;
132
133 /* sensor driver private platform data */
134 void *drv_priv;
135
136 /*
137 * Set unbalanced_power to true to deal with legacy drivers, failing to
138 * balance their calls to subdevice's .s_power() method. clock_state is
139 * then used internally by helper functions, it shouldn't be touched by
140 * drivers or the platform code.
141 */
142 bool unbalanced_power;
143 unsigned long clock_state;
144
145 /* Optional callbacks to power on or off and reset the sensor */
146 int (*power)(struct device *, int);
147 int (*reset)(struct device *);
148
149 /*
150 * some platforms may support different data widths than the sensors
151 * native ones due to different data line routing. Let the board code
152 * overwrite the width flags.
153 */
154 int (*set_bus_param)(struct soc_camera_subdev_desc *, unsigned long flags);
155 unsigned long (*query_bus_param)(struct soc_camera_subdev_desc *);
156 void (*free_bus)(struct soc_camera_subdev_desc *);
157
158 /* Optional regulators that have to be managed on power on/off events */
159 struct v4l2_subdev_platform_data sd_pdata;
160};
161
162struct soc_camera_host_desc {
163 /* Camera bus id, used to match a camera and a bus */
164 int bus_id;
165 int i2c_adapter_id;
166 struct i2c_board_info *board_info;
167 const char *module_name;
168
169 /*
170 * For non-I2C devices platform has to provide methods to add a device
171 * to the system and to remove it
172 */
173 int (*add_device)(struct soc_camera_device *);
174 void (*del_device)(struct soc_camera_device *);
175};
176
177/*
178 * Platform data for "soc-camera-pdrv"
179 * This MUST be kept binary-identical to struct soc_camera_link below, until
180 * it is completely replaced by this one, after which we can split it into its
181 * two components.
182 */
183struct soc_camera_desc {
184 struct soc_camera_subdev_desc subdev_desc;
185 struct soc_camera_host_desc host_desc;
186};
187
188/* Prepare to replace this struct: don't change its layout any more! */
189struct soc_camera_link {
190 /*
191 * Subdevice part - keep at top and compatible to
192 * struct soc_camera_subdev_desc
193 */
194
195 /* Per camera SOCAM_SENSOR_* bus flags */
196 unsigned long flags;
197
198 void *priv;
199
200 /* Set by platforms to handle misbehaving drivers */
201 bool unbalanced_power;
202 /* Used by soc-camera helper functions */
203 unsigned long clock_state;
204
205 /* Optional callbacks to power on or off and reset the sensor */
206 int (*power)(struct device *, int);
207 int (*reset)(struct device *);
208 /*
209 * some platforms may support different data widths than the sensors
210 * native ones due to different data line routing. Let the board code
211 * overwrite the width flags.
212 */
213 int (*set_bus_param)(struct soc_camera_link *, unsigned long flags);
214 unsigned long (*query_bus_param)(struct soc_camera_link *);
215 void (*free_bus)(struct soc_camera_link *);
216
217 /* Optional regulators that have to be managed on power on/off events */
218 struct regulator_bulk_data *regulators;
219 int num_regulators;
220
221 void *host_priv;
222
223 /*
224 * Host part - keep at bottom and compatible to
225 * struct soc_camera_host_desc
226 */
227
228 /* Camera bus id, used to match a camera and a bus */
229 int bus_id;
230 int i2c_adapter_id;
231 struct i2c_board_info *board_info;
232 const char *module_name;
233
234 /*
235 * For non-I2C devices platform has to provide methods to add a device
236 * to the system and to remove it
237 */
238 int (*add_device)(struct soc_camera_device *);
239 void (*del_device)(struct soc_camera_device *);
240};
241
242static inline struct soc_camera_host *to_soc_camera_host(
243 const struct device *dev)
244{
245 struct v4l2_device *v4l2_dev = dev_get_drvdata(dev);
246
247 return container_of(v4l2_dev, struct soc_camera_host, v4l2_dev);
248}
249
250static inline struct soc_camera_desc *to_soc_camera_desc(
251 const struct soc_camera_device *icd)
252{
253 return icd->sdesc;
254}
255
256static inline struct device *to_soc_camera_control(
257 const struct soc_camera_device *icd)
258{
259 return icd->control;
260}
261
262static inline struct v4l2_subdev *soc_camera_to_subdev(
263 const struct soc_camera_device *icd)
264{
265 struct device *control = to_soc_camera_control(icd);
266 return dev_get_drvdata(control);
267}
268
269int soc_camera_host_register(struct soc_camera_host *ici);
270void soc_camera_host_unregister(struct soc_camera_host *ici);
271
272const struct soc_camera_format_xlate *soc_camera_xlate_by_fourcc(
273 struct soc_camera_device *icd, unsigned int fourcc);
274
275/**
276 * struct soc_camera_format_xlate - match between host and sensor formats
277 * @code: code of a sensor provided format
278 * @host_fmt: host format after host translation from code
279 *
280 * Host and sensor translation structure. Used in table of host and sensor
281 * formats matchings in soc_camera_device. A host can override the generic list
282 * generation by implementing get_formats(), and use it for format checks and
283 * format setup.
284 */
285struct soc_camera_format_xlate {
286 u32 code;
287 const struct soc_mbus_pixelfmt *host_fmt;
288};
289
290#define SOCAM_SENSE_PCLK_CHANGED (1 << 0)
291
292/**
293 * This struct can be attached to struct soc_camera_device by the host driver
294 * to request sense from the camera, for example, when calling .set_fmt(). The
295 * host then can check which flags are set and verify respective values if any.
296 * For example, if SOCAM_SENSE_PCLK_CHANGED is set, it means, pixclock has
297 * changed during this operation. After completion the host should detach sense.
298 *
299 * @flags ored SOCAM_SENSE_* flags
300 * @master_clock if the host wants to be informed about pixel-clock
301 * change, it better set master_clock.
302 * @pixel_clock_max maximum pixel clock frequency supported by the host,
303 * camera is not allowed to exceed this.
304 * @pixel_clock if the camera driver changed pixel clock during this
305 * operation, it sets SOCAM_SENSE_PCLK_CHANGED, uses
306 * master_clock to calculate the new pixel-clock and
307 * sets this field.
308 */
309struct soc_camera_sense {
310 unsigned long flags;
311 unsigned long master_clock;
312 unsigned long pixel_clock_max;
313 unsigned long pixel_clock;
314};
315
316#define SOCAM_DATAWIDTH(x) BIT((x) - 1)
317#define SOCAM_DATAWIDTH_4 SOCAM_DATAWIDTH(4)
318#define SOCAM_DATAWIDTH_8 SOCAM_DATAWIDTH(8)
319#define SOCAM_DATAWIDTH_9 SOCAM_DATAWIDTH(9)
320#define SOCAM_DATAWIDTH_10 SOCAM_DATAWIDTH(10)
321#define SOCAM_DATAWIDTH_12 SOCAM_DATAWIDTH(12)
322#define SOCAM_DATAWIDTH_15 SOCAM_DATAWIDTH(15)
323#define SOCAM_DATAWIDTH_16 SOCAM_DATAWIDTH(16)
324#define SOCAM_DATAWIDTH_18 SOCAM_DATAWIDTH(18)
325#define SOCAM_DATAWIDTH_24 SOCAM_DATAWIDTH(24)
326
327#define SOCAM_DATAWIDTH_MASK (SOCAM_DATAWIDTH_4 | SOCAM_DATAWIDTH_8 | \
328 SOCAM_DATAWIDTH_9 | SOCAM_DATAWIDTH_10 | \
329 SOCAM_DATAWIDTH_12 | SOCAM_DATAWIDTH_15 | \
330 SOCAM_DATAWIDTH_16 | SOCAM_DATAWIDTH_18 | \
331 SOCAM_DATAWIDTH_24)
332
333static inline void soc_camera_limit_side(int *start, int *length,
334 unsigned int start_min,
335 unsigned int length_min, unsigned int length_max)
336{
337 if (*length < length_min)
338 *length = length_min;
339 else if (*length > length_max)
340 *length = length_max;
341
342 if (*start < start_min)
343 *start = start_min;
344 else if (*start > start_min + length_max - *length)
345 *start = start_min + length_max - *length;
346}
347
348unsigned long soc_camera_apply_board_flags(struct soc_camera_subdev_desc *ssdd,
349 const struct v4l2_mbus_config *cfg);
350
351int soc_camera_power_init(struct device *dev, struct soc_camera_subdev_desc *ssdd);
352int soc_camera_power_on(struct device *dev, struct soc_camera_subdev_desc *ssdd,
353 struct v4l2_clk *clk);
354int soc_camera_power_off(struct device *dev, struct soc_camera_subdev_desc *ssdd,
355 struct v4l2_clk *clk);
356
357static inline int soc_camera_set_power(struct device *dev,
358 struct soc_camera_subdev_desc *ssdd, struct v4l2_clk *clk, bool on)
359{
360 return on ? soc_camera_power_on(dev, ssdd, clk)
361 : soc_camera_power_off(dev, ssdd, clk);
362}
363
364/* This is only temporary here - until v4l2-subdev begins to link to video_device */
365#include <linux/i2c.h>
366static inline struct video_device *soc_camera_i2c_to_vdev(const struct i2c_client *client)
367{
368 struct v4l2_subdev *sd = i2c_get_clientdata(client);
369 struct soc_camera_device *icd = v4l2_get_subdev_hostdata(sd);
370 return icd ? icd->vdev : NULL;
371}
372
373static inline struct soc_camera_subdev_desc *soc_camera_i2c_to_desc(const struct i2c_client *client)
374{
375 return client->dev.platform_data;
376}
377
378static inline struct v4l2_subdev *soc_camera_vdev_to_subdev(struct video_device *vdev)
379{
380 struct soc_camera_device *icd = video_get_drvdata(vdev);
381 return soc_camera_to_subdev(icd);
382}
383
384static inline struct soc_camera_device *soc_camera_from_vb2q(const struct vb2_queue *vq)
385{
386 return container_of(vq, struct soc_camera_device, vb2_vidq);
387}
388
389static inline u32 soc_camera_grp_id(const struct soc_camera_device *icd)
390{
391 return (icd->iface << 8) | (icd->devnum + 1);
392}
393
394void soc_camera_lock(struct vb2_queue *vq);
395void soc_camera_unlock(struct vb2_queue *vq);
396
397#endif
include/media/tpg/v4l2-tpg.h+2−1
@@ -241,7 +241,7 @@ void tpg_log_status(struct tpg_data *tpg); · 240 unmodified lines
241 241
242void tpg_set_font(const u8 *f);242void tpg_set_font(const u8 *f);
243void tpg_gen_text(const struct tpg_data *tpg,243void tpg_gen_text(const struct tpg_data *tpg,
244 u8 *basep[TPG_MAX_PLANES][2], int y, int x, char *text);244 u8 *basep[TPG_MAX_PLANES][2], int y, int x, const char *text);
245void tpg_calc_text_basep(struct tpg_data *tpg,245void tpg_calc_text_basep(struct tpg_data *tpg,
246 u8 *basep[TPG_MAX_PLANES][2], unsigned p, u8 *vbuf);246 u8 *basep[TPG_MAX_PLANES][2], unsigned p, u8 *vbuf);
247unsigned tpg_g_interleaved_plane(const struct tpg_data *tpg, unsigned buf_line);247unsigned tpg_g_interleaved_plane(const struct tpg_data *tpg, unsigned buf_line);
@@ -252,6 +252,7 @@ void tpg_fillbuffer(struct tpg_data *tpg, v4l2_std_id std, · 4 unmodified lines
252bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc);252bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc);
253void tpg_s_crop_compose(struct tpg_data *tpg, const struct v4l2_rect *crop,253void tpg_s_crop_compose(struct tpg_data *tpg, const struct v4l2_rect *crop,
254 const struct v4l2_rect *compose);254 const struct v4l2_rect *compose);
255const char *tpg_g_color_order(const struct tpg_data *tpg);
255 256
256static inline void tpg_s_pattern(struct tpg_data *tpg, enum tpg_pattern pattern)257static inline void tpg_s_pattern(struct tpg_data *tpg, enum tpg_pattern pattern)
257{258{
include/media/v4l2-mc.h+4−4
@@ -89,8 +89,8 @@ int v4l_vb2q_enable_media_source(struct vb2_queue *q); · 88 unmodified lines
89 * v4l2_create_fwnode_links_to_pad - Create fwnode-based links from a89 * v4l2_create_fwnode_links_to_pad - Create fwnode-based links from a
90 * source subdev to a sink subdev pad.90 * source subdev to a sink subdev pad.
91 *91 *
92 * @src_sd - pointer to a source subdev92 * @src_sd: pointer to a source subdev
93 * @sink - pointer to a subdev sink pad93 * @sink: pointer to a subdev sink pad
94 *94 *
95 * This function searches for fwnode endpoint connections from a source95 * This function searches for fwnode endpoint connections from a source
96 * subdevice to a single sink pad, and if suitable connections are found,96 * subdevice to a single sink pad, and if suitable connections are found,
@@ -113,8 +113,8 @@ int v4l2_create_fwnode_links_to_pad(struct v4l2_subdev *src_sd, · 16 unmodified lines
113 * v4l2_create_fwnode_links - Create fwnode-based links from a source113 * v4l2_create_fwnode_links - Create fwnode-based links from a source
114 * subdev to a sink subdev.114 * subdev to a sink subdev.
115 *115 *
116 * @src_sd - pointer to a source subdevice116 * @src_sd: pointer to a source subdevice
117 * @sink_sd - pointer to a sink subdevice117 * @sink_sd: pointer to a sink subdevice
118 *118 *
119 * This function searches for any and all fwnode endpoint connections119 * This function searches for any and all fwnode endpoint connections
120 * between source and sink subdevices, and translates them into media120 * between source and sink subdevices, and translates them into media
include/media/v4l2-rect.h+20−0
@@ -184,4 +184,24 @@ static inline bool v4l2_rect_overlap(const struct v4l2_rect *r1, · 183 unmodified lines
184 return true;184 return true;
185}185}
186 186
187/**
188 * v4l2_rect_enclosed() - is r1 enclosed in r2?
189 * @r1: rectangle.
190 * @r2: rectangle.
191 *
192 * Returns true if @r1 is enclosed in @r2.
193 */
194static inline bool v4l2_rect_enclosed(struct v4l2_rect *r1,
195 struct v4l2_rect *r2)
196{
197 if (r1->left < r2->left || r1->top < r2->top)
198 return false;
199 if (r1->left + r1->width > r2->left + r2->width)
200 return false;
201 if (r1->top + r1->height > r2->top + r2->height)
202 return false;
203
204 return true;
205}
206
187#endif207#endif
include/media/v4l2-subdev.h+20−19
@@ -566,9 +566,9 @@ struct v4l2_subdev_ir_parameters { · 565 unmodified lines
566 *566 *
567 * @rx_read: Reads received codes or pulse width data.567 * @rx_read: Reads received codes or pulse width data.
568 * The semantics are similar to a non-blocking read() call.568 * The semantics are similar to a non-blocking read() call.
569 * @rx_g_parameters: Get the current operating parameters and state of the569 * @rx_g_parameters: Get the current operating parameters and state of
570 * the IR receiver.570 * the IR receiver.
571 * @rx_s_parameters: Set the current operating parameters and state of the571 * @rx_s_parameters: Set the current operating parameters and state of
572 * the IR receiver. It is recommended to call572 * the IR receiver. It is recommended to call
573 * [rt]x_g_parameters first to fill out the current state, and only change573 * [rt]x_g_parameters first to fill out the current state, and only change
574 * the fields that need to be changed. Upon return, the actual device574 * the fields that need to be changed. Upon return, the actual device
@@ -582,9 +582,9 @@ struct v4l2_subdev_ir_parameters { · 7 unmodified lines
582 *582 *
583 * @tx_write: Writes codes or pulse width data for transmission.583 * @tx_write: Writes codes or pulse width data for transmission.
584 * The semantics are similar to a non-blocking write() call.584 * The semantics are similar to a non-blocking write() call.
585 * @tx_g_parameters: Get the current operating parameters and state of the585 * @tx_g_parameters: Get the current operating parameters and state of
586 * the IR transmitter.586 * the IR transmitter.
587 * @tx_s_parameters: Set the current operating parameters and state of the587 * @tx_s_parameters: Set the current operating parameters and state of
588 * the IR transmitter. It is recommended to call588 * the IR transmitter. It is recommended to call
589 * [rt]x_g_parameters first to fill out the current state, and only change589 * [rt]x_g_parameters first to fill out the current state, and only change
590 * the fields that need to be changed. Upon return, the actual device590 * the fields that need to be changed. Upon return, the actual device
@@ -930,10 +930,10 @@ struct v4l2_subdev_fh { · 339 unmodified lines
930 * @cfg: pointer to &struct v4l2_subdev_pad_config array.930 * @cfg: pointer to &struct v4l2_subdev_pad_config array.
931 * @pad: index of the pad in the @cfg array.931 * @pad: index of the pad in the @cfg array.
932 */932 */
933static inline struct v4l2_mbus_framefmt933static inline struct v4l2_mbus_framefmt *
934*v4l2_subdev_get_try_format(struct v4l2_subdev *sd,934v4l2_subdev_get_try_format(struct v4l2_subdev *sd,
935 struct v4l2_subdev_pad_config *cfg,935 struct v4l2_subdev_pad_config *cfg,
936 unsigned int pad)936 unsigned int pad)
937{937{
938 if (WARN_ON(pad >= sd->entity.num_pads))938 if (WARN_ON(pad >= sd->entity.num_pads))
939 pad = 0;939 pad = 0;
@@ -948,10 +948,10 @@ static inline struct v4l2_mbus_framefmt · 8 unmodified lines
948 * @cfg: pointer to &struct v4l2_subdev_pad_config array.948 * @cfg: pointer to &struct v4l2_subdev_pad_config array.
949 * @pad: index of the pad in the @cfg array.949 * @pad: index of the pad in the @cfg array.
950 */950 */
951static inline struct v4l2_rect951static inline struct v4l2_rect *
952*v4l2_subdev_get_try_crop(struct v4l2_subdev *sd,952v4l2_subdev_get_try_crop(struct v4l2_subdev *sd,
953 struct v4l2_subdev_pad_config *cfg,953 struct v4l2_subdev_pad_config *cfg,
954 unsigned int pad)954 unsigned int pad)
955{955{
956 if (WARN_ON(pad >= sd->entity.num_pads))956 if (WARN_ON(pad >= sd->entity.num_pads))
957 pad = 0;957 pad = 0;
@@ -959,22 +959,23 @@ static inline struct v4l2_rect · 1 unmodified line
959}959}
960 960
961/**961/**
962 * v4l2_subdev_get_try_crop - ancillary routine to call962 * v4l2_subdev_get_try_compose - ancillary routine to call
963 * &struct v4l2_subdev_pad_config->try_compose963 * &struct v4l2_subdev_pad_config->try_compose
964 *964 *
965 * @sd: pointer to &struct v4l2_subdev965 * @sd: pointer to &struct v4l2_subdev
966 * @cfg: pointer to &struct v4l2_subdev_pad_config array.966 * @cfg: pointer to &struct v4l2_subdev_pad_config array.
967 * @pad: index of the pad in the @cfg array.967 * @pad: index of the pad in the @cfg array.
968 */968 */
969static inline struct v4l2_rect969static inline struct v4l2_rect *
970*v4l2_subdev_get_try_compose(struct v4l2_subdev *sd,970v4l2_subdev_get_try_compose(struct v4l2_subdev *sd,
971 struct v4l2_subdev_pad_config *cfg,971 struct v4l2_subdev_pad_config *cfg,
972 unsigned int pad)972 unsigned int pad)
973{973{
974 if (WARN_ON(pad >= sd->entity.num_pads))974 if (WARN_ON(pad >= sd->entity.num_pads))
975 pad = 0;975 pad = 0;
976 return &cfg[pad].try_compose;976 return &cfg[pad].try_compose;
977}977}
978
978#endif979#endif
979 980
980extern const struct v4l2_file_operations v4l2_subdev_fops;981extern const struct v4l2_file_operations v4l2_subdev_fops;
@@ -1031,8 +1032,8 @@ static inline void *v4l2_get_subdev_hostdata(const struct v4l2_subdev *sd) · 50 unmodified lines
1031 * v4l2_subdev_get_fwnode_pad_1_to_1 - Get pad number from a subdev fwnode1032 * v4l2_subdev_get_fwnode_pad_1_to_1 - Get pad number from a subdev fwnode
1032 * endpoint, assuming 1:1 port:pad1033 * endpoint, assuming 1:1 port:pad
1033 *1034 *
1034 * @entity - Pointer to the subdev entity1035 * @entity: Pointer to the subdev entity
1035 * @endpoint - Pointer to a parsed fwnode endpoint1036 * @endpoint: Pointer to a parsed fwnode endpoint
1036 *1037 *
1037 * This function can be used as the .get_fwnode_pad operation for1038 * This function can be used as the .get_fwnode_pad operation for
1038 * subdevices that map port numbers and pad indexes 1:1. If the endpoint1039 * subdevices that map port numbers and pad indexes 1:1. If the endpoint
include/media/videobuf2-core.h+40−11
@@ -263,6 +263,10 @@ struct vb2_buffer { · 262 unmodified lines
263 * after the 'buf_finish' op is called.263 * after the 'buf_finish' op is called.
264 * copied_timestamp: the timestamp of this capture buffer was copied264 * copied_timestamp: the timestamp of this capture buffer was copied
265 * from an output buffer.265 * from an output buffer.
266 * need_cache_sync_on_prepare: when set buffer's ->prepare() function
267 * performs cache sync/invalidation.
268 * need_cache_sync_on_finish: when set buffer's ->finish() function
269 * performs cache sync/invalidation.
266 * queued_entry: entry on the queued buffers list, which holds270 * queued_entry: entry on the queued buffers list, which holds
267 * all buffers queued from userspace271 * all buffers queued from userspace
268 * done_entry: entry on the list that stores all buffers ready272 * done_entry: entry on the list that stores all buffers ready
@@ -273,6 +277,8 @@ struct vb2_buffer { · 4 unmodified lines
273 unsigned int synced:1;277 unsigned int synced:1;
274 unsigned int prepared:1;278 unsigned int prepared:1;
275 unsigned int copied_timestamp:1;279 unsigned int copied_timestamp:1;
280 unsigned int need_cache_sync_on_prepare:1;
281 unsigned int need_cache_sync_on_finish:1;
276 282
277 struct vb2_plane planes[VB2_MAX_PLANES];283 struct vb2_plane planes[VB2_MAX_PLANES];
278 struct list_head queued_entry;284 struct list_head queued_entry;
@@ -491,6 +497,9 @@ struct vb2_buf_ops { · 212 unmodified lines
491 * @uses_requests: requests are used for this queue. Set to 1 the first time497 * @uses_requests: requests are used for this queue. Set to 1 the first time
492 * a request is queued. Set to 0 when the queue is canceled.498 * a request is queued. Set to 0 when the queue is canceled.
493 * If this is 1, then you cannot queue buffers directly.499 * If this is 1, then you cannot queue buffers directly.
500 * @allow_cache_hints: when set user-space can pass cache management hints in
501 * order to skip cache flush/invalidation on ->prepare() or/and
502 * ->finish().
494 * @lock: pointer to a mutex that protects the &struct vb2_queue. The503 * @lock: pointer to a mutex that protects the &struct vb2_queue. The
495 * driver can set this to a mutex to let the v4l2 core serialize504 * driver can set this to a mutex to let the v4l2 core serialize
496 * the queuing ioctls. If the driver wants to handle locking505 * the queuing ioctls. If the driver wants to handle locking
@@ -552,21 +561,24 @@ struct vb2_buf_ops { · 55 unmodified lines
552 * when a buffer with the %V4L2_BUF_FLAG_LAST is dequeued.561 * when a buffer with the %V4L2_BUF_FLAG_LAST is dequeued.
553 * @fileio: file io emulator internal data, used only if emulator is active562 * @fileio: file io emulator internal data, used only if emulator is active
554 * @threadio: thread io internal data, used only if thread is active563 * @threadio: thread io internal data, used only if thread is active
564 * @name: queue name, used for logging purpose. Initialized automatically
565 * if left empty by drivers.
555 */566 */
556struct vb2_queue {567struct vb2_queue {
557 unsigned int type;568 unsigned int type;
558 unsigned int io_modes;569 unsigned int io_modes;
559 struct device *dev;570 struct device *dev;
560 unsigned long dma_attrs;571 unsigned long dma_attrs;
561 unsigned bidirectional:1;572 unsigned int bidirectional:1;
562 unsigned fileio_read_once:1;573 unsigned int fileio_read_once:1;
563 unsigned fileio_write_immediately:1;574 unsigned int fileio_write_immediately:1;
564 unsigned allow_zero_bytesused:1;575 unsigned int allow_zero_bytesused:1;
565 unsigned quirk_poll_must_check_waiting_for_buffers:1;576 unsigned int quirk_poll_must_check_waiting_for_buffers:1;
566 unsigned supports_requests:1;577 unsigned int supports_requests:1;
567 unsigned requires_requests:1;578 unsigned int requires_requests:1;
568 unsigned uses_qbuf:1;579 unsigned int uses_qbuf:1;
569 unsigned uses_requests:1;580 unsigned int uses_requests:1;
581 unsigned int allow_cache_hints:1;
570 582
571 struct mutex *lock;583 struct mutex *lock;
572 void *owner;584 void *owner;
@@ -612,6 +624,8 @@ struct vb2_queue { · 39 unmodified lines
612 struct vb2_fileio_data *fileio;624 struct vb2_fileio_data *fileio;
613 struct vb2_threadio_data *threadio;625 struct vb2_threadio_data *threadio;
614 626
627 char name[32];
628
615#ifdef CONFIG_VIDEO_ADV_DEBUG629#ifdef CONFIG_VIDEO_ADV_DEBUG
616 /*630 /*
617 * Counters for how often these queue-related ops are631 * Counters for how often these queue-related ops are
@@ -625,6 +639,17 @@ struct vb2_queue { · 7 unmodified lines
625#endif639#endif
626};640};
627 641
642/**
643 * vb2_queue_allows_cache_hints() - Return true if the queue allows cache
644 * and memory consistency hints.
645 *
646 * @q: pointer to &struct vb2_queue with videobuf2 queue
647 */
648static inline bool vb2_queue_allows_cache_hints(struct vb2_queue *q)
649{
650 return q->allow_cache_hints && q->memory == VB2_MEMORY_MMAP;
651}
652
628/**653/**
629 * vb2_plane_vaddr() - Return a kernel virtual address of a given plane.654 * vb2_plane_vaddr() - Return a kernel virtual address of a given plane.
630 * @vb: pointer to &struct vb2_buffer to which the plane in655 * @vb: pointer to &struct vb2_buffer to which the plane in
@@ -719,6 +744,8 @@ void vb2_core_querybuf(struct vb2_queue *q, unsigned int index, void *pb); · 88 unmodified lines
719 * vb2_core_reqbufs() - Initiate streaming.744 * vb2_core_reqbufs() - Initiate streaming.
720 * @q: pointer to &struct vb2_queue with videobuf2 queue.745 * @q: pointer to &struct vb2_queue with videobuf2 queue.
721 * @memory: memory type, as defined by &enum vb2_memory.746 * @memory: memory type, as defined by &enum vb2_memory.
747 * @flags: auxiliary queue/buffer management flags. Currently, the only
748 * used flag is %V4L2_FLAG_MEMORY_NON_CONSISTENT.
722 * @count: requested buffer count.749 * @count: requested buffer count.
723 *750 *
724 * Videobuf2 core helper to implement VIDIOC_REQBUF() operation. It is called751 * Videobuf2 core helper to implement VIDIOC_REQBUF() operation. It is called
@@ -743,12 +770,13 @@ void vb2_core_querybuf(struct vb2_queue *q, unsigned int index, void *pb); · 18 unmodified lines
743 * Return: returns zero on success; an error code otherwise.770 * Return: returns zero on success; an error code otherwise.
744 */771 */
745int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,772int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
746 unsigned int *count);773 unsigned int flags, unsigned int *count);
747 774
748/**775/**
749 * vb2_core_create_bufs() - Allocate buffers and any required auxiliary structs776 * vb2_core_create_bufs() - Allocate buffers and any required auxiliary structs
750 * @q: pointer to &struct vb2_queue with videobuf2 queue.777 * @q: pointer to &struct vb2_queue with videobuf2 queue.
751 * @memory: memory type, as defined by &enum vb2_memory.778 * @memory: memory type, as defined by &enum vb2_memory.
779 * @flags: auxiliary queue/buffer management flags.
752 * @count: requested buffer count.780 * @count: requested buffer count.
753 * @requested_planes: number of planes requested.781 * @requested_planes: number of planes requested.
754 * @requested_sizes: array with the size of the planes.782 * @requested_sizes: array with the size of the planes.
@@ -766,7 +794,8 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory, · 11 unmodified lines
766 * Return: returns zero on success; an error code otherwise.794 * Return: returns zero on success; an error code otherwise.
767 */795 */
768int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory,796int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory,
769 unsigned int *count, unsigned int requested_planes,797 unsigned int flags, unsigned int *count,
798 unsigned int requested_planes,
770 const unsigned int requested_sizes[]);799 const unsigned int requested_sizes[]);
771 800
772/**801/**
include/media/videobuf2-v4l2.h+13−0
@@ -236,6 +236,19 @@ int vb2_streamoff(struct vb2_queue *q, enum v4l2_buf_type type); · 235 unmodified lines
236 */236 */
237int __must_check vb2_queue_init(struct vb2_queue *q);237int __must_check vb2_queue_init(struct vb2_queue *q);
238 238
239/**
240 * vb2_queue_init_name() - initialize a videobuf2 queue with a name
241 * @q: pointer to &struct vb2_queue with videobuf2 queue.
242 * @name: the queue name
243 *
244 * This function initializes the vb2_queue exactly like vb2_queue_init(),
245 * and additionally sets the queue name. The queue name is used for logging
246 * purpose, and should uniquely identify the queue within the context of the
247 * device it belongs to. This is useful to attribute kernel log messages to the
248 * right queue for m2m devices or other devices that handle multiple queues.
249 */
250int __must_check vb2_queue_init_name(struct vb2_queue *q, const char *name);
251
239/**252/**
240 * vb2_queue_release() - stop streaming, release the queue and free memory253 * vb2_queue_release() - stop streaming, release the queue and free memory
241 * @q: pointer to &struct vb2_queue with videobuf2 queue.254 * @q: pointer to &struct vb2_queue with videobuf2 queue.
include/uapi/linux/videodev2.h+15−2
@@ -171,6 +171,8 @@ enum v4l2_buf_type { · 170 unmodified lines
171 || (type) == V4L2_BUF_TYPE_SDR_OUTPUT \171 || (type) == V4L2_BUF_TYPE_SDR_OUTPUT \
172 || (type) == V4L2_BUF_TYPE_META_OUTPUT)172 || (type) == V4L2_BUF_TYPE_META_OUTPUT)
173 173
174#define V4L2_TYPE_IS_CAPTURE(type) (!V4L2_TYPE_IS_OUTPUT(type))
175
174enum v4l2_tuner_type {176enum v4l2_tuner_type {
175 V4L2_TUNER_RADIO = 1,177 V4L2_TUNER_RADIO = 1,
176 V4L2_TUNER_ANALOG_TV = 2,178 V4L2_TUNER_ANALOG_TV = 2,
@@ -189,6 +191,8 @@ enum v4l2_memory { · 12 unmodified lines
189 V4L2_MEMORY_DMABUF = 4,191 V4L2_MEMORY_DMABUF = 4,
190};192};
191 193
194#define V4L2_FLAG_MEMORY_NON_CONSISTENT (1 << 0)
195
192/* see also http://vektor.theorem.ca/graphics/ycbcr/ */196/* see also http://vektor.theorem.ca/graphics/ycbcr/ */
193enum v4l2_colorspace {197enum v4l2_colorspace {
194 /*198 /*
@@ -792,6 +796,7 @@ struct v4l2_fmtdesc { · 597 unmodified lines
792#define V4L2_FMT_FLAG_EMULATED 0x0002796#define V4L2_FMT_FLAG_EMULATED 0x0002
793#define V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM 0x0004797#define V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM 0x0004
794#define V4L2_FMT_FLAG_DYN_RESOLUTION 0x0008798#define V4L2_FMT_FLAG_DYN_RESOLUTION 0x0008
799#define V4L2_FMT_FLAG_ENC_CAP_FRAME_INTERVAL 0x0010
795 800
796 /* Frame Size and frame rate enumeration */801 /* Frame Size and frame rate enumeration */
797/*802/*
@@ -944,7 +949,10 @@ struct v4l2_requestbuffers { · 146 unmodified lines
944 __u32 type; /* enum v4l2_buf_type */949 __u32 type; /* enum v4l2_buf_type */
945 __u32 memory; /* enum v4l2_memory */950 __u32 memory; /* enum v4l2_memory */
946 __u32 capabilities;951 __u32 capabilities;
947 __u32 reserved[1];952 union {
953 __u32 flags;
954 __u32 reserved[1];
955 };
948};956};
949 957
950/* capabilities for struct v4l2_requestbuffers and v4l2_create_buffers */958/* capabilities for struct v4l2_requestbuffers and v4l2_create_buffers */
@@ -954,6 +962,7 @@ struct v4l2_requestbuffers { · 3 unmodified lines
954#define V4L2_BUF_CAP_SUPPORTS_REQUESTS (1 << 3)962#define V4L2_BUF_CAP_SUPPORTS_REQUESTS (1 << 3)
955#define V4L2_BUF_CAP_SUPPORTS_ORPHANED_BUFS (1 << 4)963#define V4L2_BUF_CAP_SUPPORTS_ORPHANED_BUFS (1 << 4)
956#define V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF (1 << 5)964#define V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF (1 << 5)
965#define V4L2_BUF_CAP_SUPPORTS_MMAP_CACHE_HINTS (1 << 6)
957 966
958/**967/**
959 * struct v4l2_plane - plane info for multi-planar buffers968 * struct v4l2_plane - plane info for multi-planar buffers
@@ -2447,6 +2456,9 @@ struct v4l2_dbg_chip_info { · 1487 unmodified lines
2447 * @memory: enum v4l2_memory; buffer memory type2456 * @memory: enum v4l2_memory; buffer memory type
2448 * @format: frame format, for which buffers are requested2457 * @format: frame format, for which buffers are requested
2449 * @capabilities: capabilities of this buffer type.2458 * @capabilities: capabilities of this buffer type.
2459 * @flags: additional buffer management attributes (ignored unless the
2460 * queue has V4L2_BUF_CAP_SUPPORTS_MMAP_CACHE_HINTS capability
2461 * and configured for MMAP streaming I/O).
2450 * @reserved: future extensions2462 * @reserved: future extensions
2451 */2463 */
2452struct v4l2_create_buffers {2464struct v4l2_create_buffers {
@@ -2455,7 +2467,8 @@ struct v4l2_create_buffers { · 2 unmodified lines
2455 __u32 memory;2467 __u32 memory;
2456 struct v4l2_format format;2468 struct v4l2_format format;
2457 __u32 capabilities;2469 __u32 capabilities;
2458 __u32 reserved[7];2470 __u32 flags;
2471 __u32 reserved[6];
2459};2472};
2460 2473
2461/*2474/*

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t