Skip to content

Commit

Permalink
[media] V4L: soc-camera: remove soc-camera bus and devices on it
Browse files Browse the repository at this point in the history
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: Guennadi Liakhovetski <[email protected]>
Acked-by: Paul Mundt <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
lyakh authored and Mauro Carvalho Chehab committed Jul 27, 2011
1 parent d33b290 commit 7dfff95
Show file tree
Hide file tree
Showing 24 changed files with 337 additions and 462 deletions.
13 changes: 6 additions & 7 deletions arch/arm/mach-shmobile/board-mackerel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 = {
Expand Down
15 changes: 7 additions & 8 deletions arch/sh/boards/mach-ap325rxa/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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 */

Expand Down
64 changes: 32 additions & 32 deletions drivers/media/video/atmel-isi.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,15 +253,15 @@ 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;

/* 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 */
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
}
Expand All @@ -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 */
Expand All @@ -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);

Expand All @@ -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;
}

Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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)
Expand All @@ -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;
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -702,15 +702,15 @@ 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;
}

/* 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;
}
Expand All @@ -725,15 +725,15 @@ 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;
default:
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);
}
Expand All @@ -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;

Expand All @@ -764,22 +764,22 @@ 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);

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);
}

Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
14 changes: 5 additions & 9 deletions drivers/media/video/mt9m001.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down
Loading

0 comments on commit 7dfff95

Please sign in to comment.