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

Commit 7dfff953 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Mauro Carvalho Chehab
Browse files

[media] V4L: soc-camera: remove soc-camera bus and devices on it



Now that v4l2 subdevices have got their own device objects, having
one more device in soc-camera clients became redundant and confusing.
This patch removes those devices and the soc-camera bus, they used to
reside on.

Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: default avatarPaul Mundt <lethal@linux-sh.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent d33b290a
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -1192,8 +1192,8 @@ static struct platform_device sh_mmcif_device = {
};


static int mackerel_camera_add(struct soc_camera_link *icl, struct device *dev);
static void mackerel_camera_del(struct soc_camera_link *icl);
static int mackerel_camera_add(struct soc_camera_device *icd);
static void mackerel_camera_del(struct soc_camera_device *icd);

static int camera_set_capture(struct soc_camera_platform_info *info,
			      int enable)
@@ -1232,16 +1232,15 @@ static void mackerel_camera_release(struct device *dev)
	soc_camera_platform_release(&camera_device);
}

static int mackerel_camera_add(struct soc_camera_link *icl,
			       struct device *dev)
static int mackerel_camera_add(struct soc_camera_device *icd)
{
	return soc_camera_platform_add(icl, dev, &camera_device, &camera_link,
	return soc_camera_platform_add(icd, &camera_device, &camera_link,
				       mackerel_camera_release, 0);
}

static void mackerel_camera_del(struct soc_camera_link *icl)
static void mackerel_camera_del(struct soc_camera_device *icd)
{
	soc_camera_platform_del(icl, camera_device, &camera_link);
	soc_camera_platform_del(icd, camera_device, &camera_link);
}

static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
+7 −8
Original line number Diff line number Diff line
@@ -332,8 +332,8 @@ static int camera_set_capture(struct soc_camera_platform_info *info,
	return ret;
}

static int ap325rxa_camera_add(struct soc_camera_link *icl, struct device *dev);
static void ap325rxa_camera_del(struct soc_camera_link *icl);
static int ap325rxa_camera_add(struct soc_camera_device *icd);
static void ap325rxa_camera_del(struct soc_camera_device *icd);

static struct soc_camera_platform_info camera_info = {
	.format_name = "UYVY",
@@ -366,24 +366,23 @@ static void ap325rxa_camera_release(struct device *dev)
	soc_camera_platform_release(&camera_device);
}

static int ap325rxa_camera_add(struct soc_camera_link *icl,
			       struct device *dev)
static int ap325rxa_camera_add(struct soc_camera_device *icd)
{
	int ret = soc_camera_platform_add(icl, dev, &camera_device, &camera_link,
	int ret = soc_camera_platform_add(icd, &camera_device, &camera_link,
					  ap325rxa_camera_release, 0);
	if (ret < 0)
		return ret;

	ret = camera_probe();
	if (ret < 0)
		soc_camera_platform_del(icl, camera_device, &camera_link);
		soc_camera_platform_del(icd, camera_device, &camera_link);

	return ret;
}

static void ap325rxa_camera_del(struct soc_camera_link *icl)
static void ap325rxa_camera_del(struct soc_camera_device *icd)
{
	soc_camera_platform_del(icl, camera_device, &camera_link);
	soc_camera_platform_del(icd, camera_device, &camera_link);
}
#endif /* CONFIG_I2C */

+32 −32
Original line number Diff line number Diff line
@@ -253,7 +253,7 @@ static int queue_setup(struct vb2_queue *vq, unsigned int *nbuffers,
				void *alloc_ctxs[])
{
	struct soc_camera_device *icd = soc_camera_from_vb2q(vq);
	struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
	struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
	struct atmel_isi *isi = ici->priv;
	unsigned long size;
	int ret, bytes_per_line;
@@ -261,7 +261,7 @@ static int queue_setup(struct vb2_queue *vq, unsigned int *nbuffers,
	/* Reset ISI */
	ret = atmel_isi_wait_status(isi, WAIT_ISI_RESET);
	if (ret < 0) {
		dev_err(icd->dev.parent, "Reset ISI timed out\n");
		dev_err(icd->parent, "Reset ISI timed out\n");
		return ret;
	}
	/* Disable all interrupts */
@@ -288,7 +288,7 @@ static int queue_setup(struct vb2_queue *vq, unsigned int *nbuffers,
	isi->sequence = 0;
	isi->active = NULL;

	dev_dbg(icd->dev.parent, "%s, count=%d, size=%ld\n", __func__,
	dev_dbg(icd->parent, "%s, count=%d, size=%ld\n", __func__,
		*nbuffers, size);

	return 0;
@@ -308,7 +308,7 @@ static int buffer_prepare(struct vb2_buffer *vb)
{
	struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue);
	struct frame_buffer *buf = container_of(vb, struct frame_buffer, vb);
	struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
	struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
	struct atmel_isi *isi = ici->priv;
	unsigned long size;
	struct isi_dma_desc *desc;
@@ -321,7 +321,7 @@ static int buffer_prepare(struct vb2_buffer *vb)
	size = bytes_per_line * icd->user_height;

	if (vb2_plane_size(vb, 0) < size) {
		dev_err(icd->dev.parent, "%s data will not fit into plane (%lu < %lu)\n",
		dev_err(icd->parent, "%s data will not fit into plane (%lu < %lu)\n",
				__func__, vb2_plane_size(vb, 0), size);
		return -EINVAL;
	}
@@ -330,7 +330,7 @@ static int buffer_prepare(struct vb2_buffer *vb)

	if (!buf->p_dma_desc) {
		if (list_empty(&isi->dma_desc_head)) {
			dev_err(icd->dev.parent, "Not enough dma descriptors.\n");
			dev_err(icd->parent, "Not enough dma descriptors.\n");
			return -EINVAL;
		} else {
			/* Get an available descriptor */
@@ -354,7 +354,7 @@ static int buffer_prepare(struct vb2_buffer *vb)
static void buffer_cleanup(struct vb2_buffer *vb)
{
	struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue);
	struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
	struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
	struct atmel_isi *isi = ici->priv;
	struct frame_buffer *buf = container_of(vb, struct frame_buffer, vb);

@@ -374,7 +374,7 @@ static void start_dma(struct atmel_isi *isi, struct frame_buffer *buffer)

	/* Check if already in a frame */
	if (isi_readl(isi, ISI_STATUS) & ISI_CTRL_CDC) {
		dev_err(isi->icd->dev.parent, "Already in frame handling.\n");
		dev_err(isi->icd->parent, "Already in frame handling.\n");
		return;
	}

@@ -394,7 +394,7 @@ static void start_dma(struct atmel_isi *isi, struct frame_buffer *buffer)
static void buffer_queue(struct vb2_buffer *vb)
{
	struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue);
	struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
	struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
	struct atmel_isi *isi = ici->priv;
	struct frame_buffer *buf = container_of(vb, struct frame_buffer, vb);
	unsigned long flags = 0;
@@ -412,7 +412,7 @@ static void buffer_queue(struct vb2_buffer *vb)
static int start_streaming(struct vb2_queue *vq)
{
	struct soc_camera_device *icd = soc_camera_from_vb2q(vq);
	struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
	struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
	struct atmel_isi *isi = ici->priv;

	u32 sr = 0;
@@ -427,7 +427,7 @@ static int start_streaming(struct vb2_queue *vq)
	isi_writel(isi, ISI_CTRL, ISI_CTRL_EN);
	spin_unlock_irq(&isi->lock);

	dev_dbg(icd->dev.parent, "Waiting for SOF\n");
	dev_dbg(icd->parent, "Waiting for SOF\n");
	ret = wait_event_interruptible(isi->vsync_wq,
				       isi->state != ISI_STATE_IDLE);
	if (ret)
@@ -448,7 +448,7 @@ static int start_streaming(struct vb2_queue *vq)
static int stop_streaming(struct vb2_queue *vq)
{
	struct soc_camera_device *icd = soc_camera_from_vb2q(vq);
	struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
	struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
	struct atmel_isi *isi = ici->priv;
	struct frame_buffer *buf, *node;
	int ret = 0;
@@ -470,7 +470,7 @@ static int stop_streaming(struct vb2_queue *vq)
		msleep(1);

	if (time_after(jiffies, timeout)) {
		dev_err(icd->dev.parent,
		dev_err(icd->parent,
			"Timeout waiting for finishing codec request\n");
		return -ETIMEDOUT;
	}
@@ -482,7 +482,7 @@ static int stop_streaming(struct vb2_queue *vq)
	/* Disable ISI and wait for it is done */
	ret = atmel_isi_wait_status(isi, WAIT_ISI_DISABLE);
	if (ret < 0)
		dev_err(icd->dev.parent, "Disable ISI timed out\n");
		dev_err(icd->parent, "Disable ISI timed out\n");

	return ret;
}
@@ -518,7 +518,7 @@ static int isi_camera_init_videobuf(struct vb2_queue *q,
static int isi_camera_set_fmt(struct soc_camera_device *icd,
			      struct v4l2_format *f)
{
	struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
	struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
	struct atmel_isi *isi = ici->priv;
	struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
	const struct soc_camera_format_xlate *xlate;
@@ -528,12 +528,12 @@ static int isi_camera_set_fmt(struct soc_camera_device *icd,

	xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat);
	if (!xlate) {
		dev_warn(icd->dev.parent, "Format %x not found\n",
		dev_warn(icd->parent, "Format %x not found\n",
			 pix->pixelformat);
		return -EINVAL;
	}

	dev_dbg(icd->dev.parent, "Plan to set format %dx%d\n",
	dev_dbg(icd->parent, "Plan to set format %dx%d\n",
			pix->width, pix->height);

	mf.width	= pix->width;
@@ -559,7 +559,7 @@ static int isi_camera_set_fmt(struct soc_camera_device *icd,
	pix->colorspace		= mf.colorspace;
	icd->current_fmt	= xlate;

	dev_dbg(icd->dev.parent, "Finally set format %dx%d\n",
	dev_dbg(icd->parent, "Finally set format %dx%d\n",
		pix->width, pix->height);

	return ret;
@@ -577,7 +577,7 @@ static int isi_camera_try_fmt(struct soc_camera_device *icd,

	xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
	if (pixfmt && !xlate) {
		dev_warn(icd->dev.parent, "Format %x not found\n", pixfmt);
		dev_warn(icd->parent, "Format %x not found\n", pixfmt);
		return -EINVAL;
	}

@@ -609,7 +609,7 @@ static int isi_camera_try_fmt(struct soc_camera_device *icd,
	case V4L2_FIELD_NONE:
		break;
	default:
		dev_err(icd->dev.parent, "Field type %d unsupported.\n",
		dev_err(icd->parent, "Field type %d unsupported.\n",
			mf.field);
		ret = -EINVAL;
	}
@@ -670,7 +670,7 @@ static unsigned long make_bus_param(struct atmel_isi *isi)
static int isi_camera_try_bus_param(struct soc_camera_device *icd,
				    unsigned char buswidth)
{
	struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
	struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
	struct atmel_isi *isi = ici->priv;
	unsigned long camera_flags;
	int ret;
@@ -702,7 +702,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd,

	fmt = soc_mbus_get_fmtdesc(code);
	if (!fmt) {
		dev_err(icd->dev.parent,
		dev_err(icd->parent,
			"Invalid format code #%u: %d\n", idx, code);
		return 0;
	}
@@ -710,7 +710,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd,
	/* This also checks support for the requested bits-per-sample */
	ret = isi_camera_try_bus_param(icd, fmt->bits_per_sample);
	if (ret < 0) {
		dev_err(icd->dev.parent,
		dev_err(icd->parent,
			"Fail to try the bus parameters.\n");
		return 0;
	}
@@ -725,7 +725,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd,
			xlate->host_fmt	= &isi_camera_formats[0];
			xlate->code	= code;
			xlate++;
			dev_dbg(icd->dev.parent, "Providing format %s using code %d\n",
			dev_dbg(icd->parent, "Providing format %s using code %d\n",
				isi_camera_formats[0].name, code);
		}
		break;
@@ -733,7 +733,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd,
		if (!isi_camera_packing_supported(fmt))
			return 0;
		if (xlate)
			dev_dbg(icd->dev.parent,
			dev_dbg(icd->parent,
				"Providing format %s in pass-through mode\n",
				fmt->name);
	}
@@ -752,7 +752,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd,
/* Called with .video_lock held */
static int isi_camera_add_device(struct soc_camera_device *icd)
{
	struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
	struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
	struct atmel_isi *isi = ici->priv;
	int ret;

@@ -764,14 +764,14 @@ static int isi_camera_add_device(struct soc_camera_device *icd)
		return ret;

	isi->icd = icd;
	dev_dbg(icd->dev.parent, "Atmel ISI Camera driver attached to camera %d\n",
	dev_dbg(icd->parent, "Atmel ISI Camera driver attached to camera %d\n",
		 icd->devnum);
	return 0;
}
/* Called with .video_lock held */
static void isi_camera_remove_device(struct soc_camera_device *icd)
{
	struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
	struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
	struct atmel_isi *isi = ici->priv;

	BUG_ON(icd != isi->icd);
@@ -779,7 +779,7 @@ static void isi_camera_remove_device(struct soc_camera_device *icd)
	clk_disable(isi->pclk);
	isi->icd = NULL;

	dev_dbg(icd->dev.parent, "Atmel ISI Camera driver detached from camera %d\n",
	dev_dbg(icd->parent, "Atmel ISI Camera driver detached from camera %d\n",
		 icd->devnum);
}

@@ -802,7 +802,7 @@ static int isi_camera_querycap(struct soc_camera_host *ici,

static int isi_camera_set_bus_param(struct soc_camera_device *icd, u32 pixfmt)
{
	struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
	struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
	struct atmel_isi *isi = ici->priv;
	unsigned long bus_flags, camera_flags, common_flags;
	int ret;
@@ -812,7 +812,7 @@ static int isi_camera_set_bus_param(struct soc_camera_device *icd, u32 pixfmt)

	bus_flags = make_bus_param(isi);
	common_flags = soc_camera_bus_param_compatible(camera_flags, bus_flags);
	dev_dbg(icd->dev.parent, "Flags cam: 0x%lx host: 0x%lx common: 0x%lx\n",
	dev_dbg(icd->parent, "Flags cam: 0x%lx host: 0x%lx common: 0x%lx\n",
		camera_flags, bus_flags, common_flags);
	if (!common_flags)
		return -EINVAL;
@@ -844,7 +844,7 @@ static int isi_camera_set_bus_param(struct soc_camera_device *icd, u32 pixfmt)

	ret = icd->ops->set_bus_param(icd, common_flags);
	if (ret < 0) {
		dev_dbg(icd->dev.parent, "Camera set_bus_param(%lx) returned %d\n",
		dev_dbg(icd->parent, "Camera set_bus_param(%lx) returned %d\n",
			common_flags, ret);
		return ret;
	}
+5 −9
Original line number Diff line number Diff line
@@ -603,13 +603,9 @@ static int mt9m001_video_probe(struct soc_camera_device *icd,
	unsigned long flags;
	int ret;

	/*
	 * We must have a parent by now. And it cannot be a wrong one.
	 * So this entire test is completely redundant.
	 */
	if (!icd->dev.parent ||
	    to_soc_camera_host(icd->dev.parent)->nr != icd->iface)
		return -ENODEV;
	/* We must have a parent by now. And it cannot be a wrong one. */
	BUG_ON(!icd->parent ||
	       to_soc_camera_host(icd->parent)->nr != icd->iface);

	/* Enable the chip */
	data = reg_write(client, MT9M001_CHIP_ENABLE, 1);
@@ -675,8 +671,8 @@ static void mt9m001_video_remove(struct soc_camera_device *icd)
{
	struct soc_camera_link *icl = to_soc_camera_link(icd);

	dev_dbg(&icd->dev, "Video removed: %p, %p\n",
		icd->dev.parent, icd->vdev);
	dev_dbg(icd->pdev, "Video removed: %p, %p\n",
		icd->parent, icd->vdev);
	if (icl->free_bus)
		icl->free_bus(icl);
}
+3 −7
Original line number Diff line number Diff line
@@ -960,13 +960,9 @@ static int mt9m111_video_probe(struct soc_camera_device *icd,
	s32 data;
	int ret;

	/*
	 * We must have a parent by now. And it cannot be a wrong one.
	 * So this entire test is completely redundant.
	 */
	if (!icd->dev.parent ||
	    to_soc_camera_host(icd->dev.parent)->nr != icd->iface)
		return -ENODEV;
	/* We must have a parent by now. And it cannot be a wrong one. */
	BUG_ON(!icd->parent ||
	       to_soc_camera_host(icd->parent)->nr != icd->iface);

	mt9m111->autoexposure = 1;
	mt9m111->autowhitebalance = 1;
Loading