Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2548fee6 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

[media] media/platform: convert drivers to use the new vb2_queue dev field



Stop using alloc_ctx and just fill in the device pointer.

Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent c781e4a5
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -354,11 +354,9 @@ static int queue_setup(struct vb2_queue *vq,
	if (*num_planes) {
		if (*num_planes != fmt->memplanes)
			return -EINVAL;
		for (i = 0; i < *num_planes; i++) {
		for (i = 0; i < *num_planes; i++)
			if (sizes[i] < (wh * fmt->depth[i]) / 8)
				return -EINVAL;
			allocators[i] = ctx->fimc_dev->alloc_ctx;
		}
		return 0;
	}

@@ -371,8 +369,6 @@ static int queue_setup(struct vb2_queue *vq,
			sizes[i] = frame->payload[i];
		else
			sizes[i] = max_t(u32, size, frame->payload[i]);

		allocators[i] = ctx->fimc_dev->alloc_ctx;
	}

	return 0;
@@ -1779,6 +1775,7 @@ static int fimc_register_capture_device(struct fimc_dev *fimc,
	q->buf_struct_size = sizeof(struct fimc_vid_buffer);
	q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
	q->lock = &fimc->lock;
	q->dev = &fimc->pdev->dev;

	ret = vb2_queue_init(q);
	if (ret)
+0 −10
Original line number Diff line number Diff line
@@ -1018,20 +1018,11 @@ static int fimc_probe(struct platform_device *pdev)
			goto err_sd;
	}

	/* Initialize contiguous memory allocator */
	vb2_dma_contig_set_max_seg_size(dev, DMA_BIT_MASK(32));
	fimc->alloc_ctx = vb2_dma_contig_init_ctx(dev);
	if (IS_ERR(fimc->alloc_ctx)) {
		ret = PTR_ERR(fimc->alloc_ctx);
		goto err_gclk;
	}

	dev_dbg(dev, "FIMC.%d registered successfully\n", fimc->id);
	return 0;

err_gclk:
	if (!pm_runtime_enabled(dev))
		clk_disable(fimc->clock[CLK_GATE]);
err_sd:
	fimc_unregister_capture_subdev(fimc);
err_sclk:
@@ -1124,7 +1115,6 @@ static int fimc_remove(struct platform_device *pdev)
	pm_runtime_set_suspended(&pdev->dev);

	fimc_unregister_capture_subdev(fimc);
	vb2_dma_contig_cleanup_ctx(fimc->alloc_ctx);
	vb2_dma_contig_clear_max_seg_size(&pdev->dev);

	clk_disable(fimc->clock[CLK_BUS]);
+0 −3
Original line number Diff line number Diff line
@@ -307,7 +307,6 @@ struct fimc_m2m_device {
 */
struct fimc_vid_cap {
	struct fimc_ctx			*ctx;
	struct vb2_alloc_ctx		*alloc_ctx;
	struct v4l2_subdev		subdev;
	struct exynos_video_entity	ve;
	struct media_pad		vd_pad;
@@ -417,7 +416,6 @@ struct fimc_ctx;
 * @m2m:	memory-to-memory V4L2 device information
 * @vid_cap:	camera capture device information
 * @state:	flags used to synchronize m2m and capture mode operation
 * @alloc_ctx:	videobuf2 memory allocator context
 * @pipeline:	fimc video capture pipeline data structure
 */
struct fimc_dev {
@@ -436,7 +434,6 @@ struct fimc_dev {
	struct fimc_m2m_device		m2m;
	struct fimc_vid_cap		vid_cap;
	unsigned long			state;
	struct vb2_alloc_ctx		*alloc_ctx;
};

/**
+1 −12
Original line number Diff line number Diff line
@@ -204,9 +204,6 @@ static int fimc_is_register_subdevs(struct fimc_is *is)
	if (ret < 0)
		return ret;

	/* Initialize memory allocator context for the ISP DMA. */
	is->isp.alloc_ctx = is->alloc_ctx;

	for_each_compatible_node(i2c_bus, NULL, FIMC_IS_I2C_COMPATIBLE) {
		for_each_available_child_of_node(i2c_bus, child) {
			ret = fimc_is_parse_sensor_config(is, index, child);
@@ -848,18 +845,13 @@ static int fimc_is_probe(struct platform_device *pdev)
		goto err_pm;

	vb2_dma_contig_set_max_seg_size(dev, DMA_BIT_MASK(32));
	is->alloc_ctx = vb2_dma_contig_init_ctx(dev);
	if (IS_ERR(is->alloc_ctx)) {
		ret = PTR_ERR(is->alloc_ctx);
		goto err_pm;
	}
	/*
	 * Register FIMC-IS V4L2 subdevs to this driver. The video nodes
	 * will be created within the subdev's registered() callback.
	 */
	ret = fimc_is_register_subdevs(is);
	if (ret < 0)
		goto err_vb;
		goto err_pm;

	ret = fimc_is_debugfs_create(is);
	if (ret < 0)
@@ -878,8 +870,6 @@ static int fimc_is_probe(struct platform_device *pdev)
	fimc_is_debugfs_remove(is);
err_sd:
	fimc_is_unregister_subdevs(is);
err_vb:
	vb2_dma_contig_cleanup_ctx(is->alloc_ctx);
err_pm:
	if (!pm_runtime_enabled(dev))
		fimc_is_runtime_suspend(dev);
@@ -940,7 +930,6 @@ static int fimc_is_remove(struct platform_device *pdev)
		fimc_is_runtime_suspend(dev);
	free_irq(is->irq, is);
	fimc_is_unregister_subdevs(is);
	vb2_dma_contig_cleanup_ctx(is->alloc_ctx);
	vb2_dma_contig_clear_max_seg_size(dev);
	fimc_is_put_clocks(is);
	fimc_is_debugfs_remove(is);
+0 −2
Original line number Diff line number Diff line
@@ -233,7 +233,6 @@ struct chain_config {
 * @pdev: pointer to FIMC-IS platform device
 * @pctrl: pointer to pinctrl structure for this device
 * @v4l2_dev: pointer to top the level v4l2_device
 * @alloc_ctx: videobuf2 memory allocator context
 * @lock: mutex serializing video device and the subdev operations
 * @slock: spinlock protecting this data structure and the hw registers
 * @clocks: FIMC-LITE gate clock
@@ -256,7 +255,6 @@ struct fimc_is {
	struct fimc_is_sensor		sensor[FIMC_IS_SENSORS_NUM];
	struct fimc_is_setfile		setfile;

	struct vb2_alloc_ctx		*alloc_ctx;
	struct v4l2_ctrl_handler	ctrl_handler;

	struct mutex			lock;
Loading