diff options
author | Maxime Ripard <maxime@cerno.tech> | 2023-01-03 08:32:12 +0100 |
---|---|---|
committer | Maxime Ripard <maxime@cerno.tech> | 2023-01-03 08:32:12 +0100 |
commit | 2c55d703391acf7e9101da596d0c15ee03b318a3 (patch) | |
tree | 422ef671343624b56d333b47d20a538eeedbfe10 /include/media | |
parent | 92d43bd3bc9728c1fb114d7011d46f5ea9489e28 (diff) | |
parent | 88603b6dc419445847923fcb7fe5080067a30f98 (diff) |
Merge drm/drm-fixes into drm-misc-fixes
Let's start the fixes cycle.
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/davinci/vpbe.h | 2 | ||||
-rw-r--r-- | include/media/dvb_ringbuffer.h | 2 | ||||
-rw-r--r-- | include/media/dvbdev.h | 38 | ||||
-rw-r--r-- | include/media/frame_vector.h | 2 | ||||
-rw-r--r-- | include/media/i2c/ov9650.h | 24 | ||||
-rw-r--r-- | include/media/i2c/s5c73m3.h | 15 | ||||
-rw-r--r-- | include/media/i2c/s5k4ecgx.h | 33 | ||||
-rw-r--r-- | include/media/i2c/ths7303.h | 4 | ||||
-rw-r--r-- | include/media/media-entity.h | 4 | ||||
-rw-r--r-- | include/media/v4l2-mediabus.h | 17 | ||||
-rw-r--r-- | include/media/v4l2-subdev.h | 11 | ||||
-rw-r--r-- | include/media/videobuf2-core.h | 14 | ||||
-rw-r--r-- | include/media/videobuf2-memops.h | 3 |
13 files changed, 63 insertions, 106 deletions
diff --git a/include/media/davinci/vpbe.h b/include/media/davinci/vpbe.h index e74a93475d21..646c4b48b29d 100644 --- a/include/media/davinci/vpbe.h +++ b/include/media/davinci/vpbe.h @@ -28,7 +28,7 @@ struct vpbe_output { */ char *subdev_name; /* - * defualt_mode identifies the default timings set at the venc or + * default_mode identifies the default timings set at the venc or * external encoder. */ char *default_mode; diff --git a/include/media/dvb_ringbuffer.h b/include/media/dvb_ringbuffer.h index 8ed6bcc3a56e..029c8b615e49 100644 --- a/include/media/dvb_ringbuffer.h +++ b/include/media/dvb_ringbuffer.h @@ -214,7 +214,7 @@ extern ssize_t dvb_ringbuffer_write_user(struct dvb_ringbuffer *rbuf, * @buf: Buffer to write. * @len: Length of buffer (currently limited to 65535 bytes max). * - * Return: Number of bytes written, or -EFAULT, -ENOMEM, -EVINAL. + * Return: Number of bytes written, or -EFAULT, -ENOMEM, -EINVAL. */ extern ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8 *buf, size_t len); diff --git a/include/media/dvbdev.h b/include/media/dvbdev.h index 2f6b0861322a..29d25c8a6f13 100644 --- a/include/media/dvbdev.h +++ b/include/media/dvbdev.h @@ -87,7 +87,11 @@ struct dvb_frontend; * @device: pointer to struct device * @module: pointer to struct module * @mfe_shared: indicates mutually exclusive frontends. - * Use of this flag is currently deprecated. + * 1 = legacy exclusion behavior: blocking any open() call + * 2 = enhanced exclusion behavior, emulating the standard + * behavior of busy frontends: allowing read-only sharing + * and otherwise returning immediately with -EBUSY when any + * of the frontends is already opened with write access. * @mfe_dvbdev: Frontend device in use, in the case of MFE * @mfe_lock: Lock to prevent using the other frontends when MFE is * used. @@ -126,6 +130,7 @@ struct dvb_adapter { * struct dvb_device - represents a DVB device node * * @list_head: List head with all DVB devices + * @ref: reference counter * @fops: pointer to struct file_operations * @adapter: pointer to the adapter that holds this device node * @type: type of the device, as defined by &enum dvb_device_type. @@ -156,6 +161,7 @@ struct dvb_adapter { */ struct dvb_device { struct list_head list_head; + struct kref ref; const struct file_operations *fops; struct dvb_adapter *adapter; enum dvb_device_type type; @@ -188,6 +194,20 @@ struct dvb_device { }; /** + * dvb_device_get - Increase dvb_device reference + * + * @dvbdev: pointer to struct dvb_device + */ +struct dvb_device *dvb_device_get(struct dvb_device *dvbdev); + +/** + * dvb_device_put - Decrease dvb_device reference + * + * @dvbdev: pointer to struct dvb_device + */ +void dvb_device_put(struct dvb_device *dvbdev); + +/** * dvb_register_adapter - Registers a new DVB adapter * * @adap: pointer to struct dvb_adapter @@ -231,29 +251,17 @@ int dvb_register_device(struct dvb_adapter *adap, /** * dvb_remove_device - Remove a registered DVB device * - * This does not free memory. To do that, call dvb_free_device(). + * This does not free memory. dvb_free_device() will do that when + * reference counter is empty * * @dvbdev: pointer to struct dvb_device */ void dvb_remove_device(struct dvb_device *dvbdev); -/** - * dvb_free_device - Free memory occupied by a DVB device. - * - * Call dvb_unregister_device() before calling this function. - * - * @dvbdev: pointer to struct dvb_device - */ -void dvb_free_device(struct dvb_device *dvbdev); /** * dvb_unregister_device - Unregisters a DVB device * - * This is a combination of dvb_remove_device() and dvb_free_device(). - * Using this function is usually a mistake, and is often an indicator - * for a use-after-free bug (when a userspace process keeps a file - * handle to a detached device). - * * @dvbdev: pointer to struct dvb_device */ void dvb_unregister_device(struct dvb_device *dvbdev); diff --git a/include/media/frame_vector.h b/include/media/frame_vector.h index bfed1710dc24..541c71a2c7be 100644 --- a/include/media/frame_vector.h +++ b/include/media/frame_vector.h @@ -16,7 +16,7 @@ struct frame_vector { struct frame_vector *frame_vector_create(unsigned int nr_frames); void frame_vector_destroy(struct frame_vector *vec); int get_vaddr_frames(unsigned long start, unsigned int nr_pfns, - struct frame_vector *vec); + bool write, struct frame_vector *vec); void put_vaddr_frames(struct frame_vector *vec); int frame_vector_to_pages(struct frame_vector *vec); void frame_vector_to_pfns(struct frame_vector *vec); diff --git a/include/media/i2c/ov9650.h b/include/media/i2c/ov9650.h deleted file mode 100644 index 3ec7e06955b4..000000000000 --- a/include/media/i2c/ov9650.h +++ /dev/null @@ -1,24 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * OV9650/OV9652 camera sensors driver - * - * Copyright (C) 2013 Sylwester Nawrocki <sylvester.nawrocki@gmail.com> - */ -#ifndef OV9650_H_ -#define OV9650_H_ - -/** - * struct ov9650_platform_data - ov9650 driver platform data - * @mclk_frequency: the sensor's master clock frequency in Hz - * @gpio_pwdn: number of a GPIO connected to OV965X PWDN pin - * @gpio_reset: number of a GPIO connected to OV965X RESET pin - * - * If any of @gpio_pwdn or @gpio_reset are unused then they should be - * set to a negative value. @mclk_frequency must always be specified. - */ -struct ov9650_platform_data { - unsigned long mclk_frequency; - int gpio_pwdn; - int gpio_reset; -}; -#endif /* OV9650_H_ */ diff --git a/include/media/i2c/s5c73m3.h b/include/media/i2c/s5c73m3.h index a51f1025ba1c..df0769d64523 100644 --- a/include/media/i2c/s5c73m3.h +++ b/include/media/i2c/s5c73m3.h @@ -21,20 +21,8 @@ #include <media/v4l2-mediabus.h> /** - * struct s5c73m3_gpio - data structure describing a GPIO - * @gpio: GPIO number - * @level: indicates active state of the @gpio - */ -struct s5c73m3_gpio { - int gpio; - int level; -}; - -/** * struct s5c73m3_platform_data - s5c73m3 driver platform data * @mclk_frequency: sensor's master clock frequency in Hz - * @gpio_reset: GPIO driving RESET pin - * @gpio_stby: GPIO driving STBY pin * @bus_type: bus type * @nlanes: maximum number of MIPI-CSI lanes used * @horiz_flip: default horizontal image flip value, non zero to enable @@ -44,9 +32,6 @@ struct s5c73m3_gpio { struct s5c73m3_platform_data { unsigned long mclk_frequency; - struct s5c73m3_gpio gpio_reset; - struct s5c73m3_gpio gpio_stby; - enum v4l2_mbus_type bus_type; u8 nlanes; u8 horiz_flip; diff --git a/include/media/i2c/s5k4ecgx.h b/include/media/i2c/s5k4ecgx.h deleted file mode 100644 index 92202eb35249..000000000000 --- a/include/media/i2c/s5k4ecgx.h +++ /dev/null @@ -1,33 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * S5K4ECGX image sensor header file - * - * Copyright (C) 2012, Linaro - * Copyright (C) 2012, Samsung Electronics Co., Ltd. - */ - -#ifndef S5K4ECGX_H -#define S5K4ECGX_H - -/** - * struct s5k4ecgx_gpio - data structure describing a GPIO - * @gpio: GPIO number - * @level: indicates active state of the @gpio - */ -struct s5k4ecgx_gpio { - int gpio; - int level; -}; - -/** - * struct s5k4ecgx_platform_data - s5k4ecgx driver platform data - * @gpio_reset: GPIO driving RESET pin - * @gpio_stby: GPIO driving STBY pin - */ - -struct s5k4ecgx_platform_data { - struct s5k4ecgx_gpio gpio_reset; - struct s5k4ecgx_gpio gpio_stby; -}; - -#endif /* S5K4ECGX_H */ diff --git a/include/media/i2c/ths7303.h b/include/media/i2c/ths7303.h index 95492d12786d..fee2818c558d 100644 --- a/include/media/i2c/ths7303.h +++ b/include/media/i2c/ths7303.h @@ -10,8 +10,8 @@ * Martin Bugge <marbugge@cisco.com> */ -#ifndef THS7353_H -#define THS7353_H +#ifndef THS7303_H +#define THS7303_H /** * struct ths7303_platform_data - Platform dependent data diff --git a/include/media/media-entity.h b/include/media/media-entity.h index 28c9de8a1f34..85ed08ddee9d 100644 --- a/include/media/media-entity.h +++ b/include/media/media-entity.h @@ -237,7 +237,7 @@ struct media_pad { * @link_validate: Return whether a link is valid from the entity point of * view. The media_pipeline_start() function * validates all links by calling this operation. Optional. - * @has_pad_interdep: Return whether a two pads inside the entity are + * @has_pad_interdep: Return whether two pads of the entity are * interdependent. If two pads are interdependent they are * part of the same pipeline and enabling one of the pads * means that the other pad will become "locked" and @@ -1144,7 +1144,7 @@ __must_check int __media_pipeline_start(struct media_pad *pad, * media_pipeline_stop - Mark a pipeline as not streaming * @pad: Starting pad * - * Mark all pads connected to a given pads through enabled links, either + * Mark all pads connected to a given pad through enabled links, either * directly or indirectly, as not streaming. The media_pad pipe field is * reset to %NULL. * diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h index f67a74daf799..5bce6e423e94 100644 --- a/include/media/v4l2-mediabus.h +++ b/include/media/v4l2-mediabus.h @@ -54,17 +54,18 @@ #define V4L2_MBUS_VSYNC_ACTIVE_LOW BIT(5) #define V4L2_MBUS_PCLK_SAMPLE_RISING BIT(6) #define V4L2_MBUS_PCLK_SAMPLE_FALLING BIT(7) -#define V4L2_MBUS_DATA_ACTIVE_HIGH BIT(8) -#define V4L2_MBUS_DATA_ACTIVE_LOW BIT(9) +#define V4L2_MBUS_PCLK_SAMPLE_DUALEDGE BIT(8) +#define V4L2_MBUS_DATA_ACTIVE_HIGH BIT(9) +#define V4L2_MBUS_DATA_ACTIVE_LOW BIT(10) /* FIELD = 0/1 - Field1 (odd)/Field2 (even) */ -#define V4L2_MBUS_FIELD_EVEN_HIGH BIT(10) +#define V4L2_MBUS_FIELD_EVEN_HIGH BIT(11) /* FIELD = 1/0 - Field1 (odd)/Field2 (even) */ -#define V4L2_MBUS_FIELD_EVEN_LOW BIT(11) +#define V4L2_MBUS_FIELD_EVEN_LOW BIT(12) /* Active state of Sync-on-green (SoG) signal, 0/1 for LOW/HIGH respectively. */ -#define V4L2_MBUS_VIDEO_SOG_ACTIVE_HIGH BIT(12) -#define V4L2_MBUS_VIDEO_SOG_ACTIVE_LOW BIT(13) -#define V4L2_MBUS_DATA_ENABLE_HIGH BIT(14) -#define V4L2_MBUS_DATA_ENABLE_LOW BIT(15) +#define V4L2_MBUS_VIDEO_SOG_ACTIVE_HIGH BIT(13) +#define V4L2_MBUS_VIDEO_SOG_ACTIVE_LOW BIT(14) +#define V4L2_MBUS_DATA_ENABLE_HIGH BIT(15) +#define V4L2_MBUS_DATA_ENABLE_LOW BIT(16) /* Serial flags */ /* Clock non-continuous mode support. */ diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 2f80c9c818ed..b15fa9930f30 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -176,7 +176,10 @@ struct v4l2_subdev_io_pin_config { * @s_register: callback for VIDIOC_DBG_S_REGISTER() ioctl handler code. * * @s_power: puts subdevice in power saving mode (on == 0) or normal operation - * mode (on == 1). + * mode (on == 1). DEPRECATED. See + * Documentation/driver-api/media/camera-sensor.rst . pre_streamon and + * post_streamoff callbacks can be used for e.g. setting the bus to LP-11 + * mode before s_stream is called. * * @interrupt_service_routine: Called by the bridge chip's interrupt service * handler, when an interrupt status has be raised due to this subdev, @@ -437,8 +440,10 @@ enum v4l2_subdev_pre_streamon_flags { * @g_input_status: get input status. Same as the status field in the * &struct v4l2_input * - * @s_stream: used to notify the driver that a video stream will start or has - * stopped. + * @s_stream: start (enabled == 1) or stop (enabled == 0) streaming on the + * sub-device. Failure on stop will remove any resources acquired in + * streaming start, while the error code is still returned by the driver. + * Also see call_s_stream wrapper in v4l2-subdev.c. * * @g_pixelaspect: callback to return the pixelaspect ratio. * diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index 3253bd2f6fee..4b6a9d2ea372 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h @@ -386,6 +386,12 @@ struct vb2_buffer { * the buffer contents will be ignored anyway. * @buf_cleanup: called once before the buffer is freed; drivers may * perform any additional cleanup; optional. + * @prepare_streaming: called once to prepare for 'streaming' state; this is + * where validation can be done to verify everything is + * okay and streaming resources can be claimed. It is + * called when the VIDIOC_STREAMON ioctl is called. The + * actual streaming starts when @start_streaming is called. + * Optional. * @start_streaming: called once to enter 'streaming' state; the driver may * receive buffers with @buf_queue callback * before @start_streaming is called; the driver gets the @@ -405,6 +411,10 @@ struct vb2_buffer { * callback by calling vb2_buffer_done() with either * %VB2_BUF_STATE_DONE or %VB2_BUF_STATE_ERROR; may use * vb2_wait_for_all_buffers() function + * @unprepare_streaming:called as counterpart to @prepare_streaming; any claimed + * streaming resources can be released here. It is + * called when the VIDIOC_STREAMOFF ioctls is called or + * when the streaming filehandle is closed. Optional. * @buf_queue: passes buffer vb to the driver; driver may start * hardware operation on this buffer; driver should give * the buffer back by calling vb2_buffer_done() function; @@ -432,8 +442,10 @@ struct vb2_ops { void (*buf_finish)(struct vb2_buffer *vb); void (*buf_cleanup)(struct vb2_buffer *vb); + int (*prepare_streaming)(struct vb2_queue *q); int (*start_streaming)(struct vb2_queue *q, unsigned int count); void (*stop_streaming)(struct vb2_queue *q); + void (*unprepare_streaming)(struct vb2_queue *q); void (*buf_queue)(struct vb2_buffer *vb); @@ -641,8 +653,10 @@ struct vb2_queue { u32 cnt_queue_setup; u32 cnt_wait_prepare; u32 cnt_wait_finish; + u32 cnt_prepare_streaming; u32 cnt_start_streaming; u32 cnt_stop_streaming; + u32 cnt_unprepare_streaming; #endif }; diff --git a/include/media/videobuf2-memops.h b/include/media/videobuf2-memops.h index cd4a46331531..4b5b84f93538 100644 --- a/include/media/videobuf2-memops.h +++ b/include/media/videobuf2-memops.h @@ -34,7 +34,8 @@ struct vb2_vmarea_handler { extern const struct vm_operations_struct vb2_common_vm_ops; struct frame_vector *vb2_create_framevec(unsigned long start, - unsigned long length); + unsigned long length, + bool write); void vb2_destroy_framevec(struct frame_vector *vec); #endif |