提交 7dfff953 编写于 作者: G Guennadi Liakhovetski 提交者: Mauro Carvalho Chehab

[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: NGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: NPaul Mundt <lethal@linux-sh.org>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 d33b290a
...@@ -1192,8 +1192,8 @@ static struct platform_device sh_mmcif_device = { ...@@ -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 int mackerel_camera_add(struct soc_camera_device *icd);
static void mackerel_camera_del(struct soc_camera_link *icl); static void mackerel_camera_del(struct soc_camera_device *icd);
static int camera_set_capture(struct soc_camera_platform_info *info, static int camera_set_capture(struct soc_camera_platform_info *info,
int enable) int enable)
...@@ -1232,16 +1232,15 @@ static void mackerel_camera_release(struct device *dev) ...@@ -1232,16 +1232,15 @@ static void mackerel_camera_release(struct device *dev)
soc_camera_platform_release(&camera_device); soc_camera_platform_release(&camera_device);
} }
static int mackerel_camera_add(struct soc_camera_link *icl, static int mackerel_camera_add(struct soc_camera_device *icd)
struct device *dev)
{ {
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); 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 = { static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
......
...@@ -332,8 +332,8 @@ static int camera_set_capture(struct soc_camera_platform_info *info, ...@@ -332,8 +332,8 @@ static int camera_set_capture(struct soc_camera_platform_info *info,
return ret; return ret;
} }
static int ap325rxa_camera_add(struct soc_camera_link *icl, struct device *dev); static int ap325rxa_camera_add(struct soc_camera_device *icd);
static void ap325rxa_camera_del(struct soc_camera_link *icl); static void ap325rxa_camera_del(struct soc_camera_device *icd);
static struct soc_camera_platform_info camera_info = { static struct soc_camera_platform_info camera_info = {
.format_name = "UYVY", .format_name = "UYVY",
...@@ -366,24 +366,23 @@ static void ap325rxa_camera_release(struct device *dev) ...@@ -366,24 +366,23 @@ static void ap325rxa_camera_release(struct device *dev)
soc_camera_platform_release(&camera_device); soc_camera_platform_release(&camera_device);
} }
static int ap325rxa_camera_add(struct soc_camera_link *icl, static int ap325rxa_camera_add(struct soc_camera_device *icd)
struct device *dev)
{ {
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); ap325rxa_camera_release, 0);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = camera_probe(); ret = camera_probe();
if (ret < 0) if (ret < 0)
soc_camera_platform_del(icl, camera_device, &camera_link); soc_camera_platform_del(icd, camera_device, &camera_link);
return ret; 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 */ #endif /* CONFIG_I2C */
......
...@@ -253,7 +253,7 @@ static int queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, ...@@ -253,7 +253,7 @@ static int queue_setup(struct vb2_queue *vq, unsigned int *nbuffers,
void *alloc_ctxs[]) void *alloc_ctxs[])
{ {
struct soc_camera_device *icd = soc_camera_from_vb2q(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 atmel_isi *isi = ici->priv;
unsigned long size; unsigned long size;
int ret, bytes_per_line; int ret, bytes_per_line;
...@@ -261,7 +261,7 @@ static int queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, ...@@ -261,7 +261,7 @@ static int queue_setup(struct vb2_queue *vq, unsigned int *nbuffers,
/* Reset ISI */ /* Reset ISI */
ret = atmel_isi_wait_status(isi, WAIT_ISI_RESET); ret = atmel_isi_wait_status(isi, WAIT_ISI_RESET);
if (ret < 0) { if (ret < 0) {
dev_err(icd->dev.parent, "Reset ISI timed out\n"); dev_err(icd->parent, "Reset ISI timed out\n");
return ret; return ret;
} }
/* Disable all interrupts */ /* Disable all interrupts */
...@@ -288,7 +288,7 @@ static int queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, ...@@ -288,7 +288,7 @@ static int queue_setup(struct vb2_queue *vq, unsigned int *nbuffers,
isi->sequence = 0; isi->sequence = 0;
isi->active = NULL; 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); *nbuffers, size);
return 0; return 0;
...@@ -308,7 +308,7 @@ static int buffer_prepare(struct vb2_buffer *vb) ...@@ -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 soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue);
struct frame_buffer *buf = container_of(vb, struct frame_buffer, vb); 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; struct atmel_isi *isi = ici->priv;
unsigned long size; unsigned long size;
struct isi_dma_desc *desc; struct isi_dma_desc *desc;
...@@ -321,7 +321,7 @@ static int buffer_prepare(struct vb2_buffer *vb) ...@@ -321,7 +321,7 @@ static int buffer_prepare(struct vb2_buffer *vb)
size = bytes_per_line * icd->user_height; size = bytes_per_line * icd->user_height;
if (vb2_plane_size(vb, 0) < size) { 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); __func__, vb2_plane_size(vb, 0), size);
return -EINVAL; return -EINVAL;
} }
...@@ -330,7 +330,7 @@ static int buffer_prepare(struct vb2_buffer *vb) ...@@ -330,7 +330,7 @@ static int buffer_prepare(struct vb2_buffer *vb)
if (!buf->p_dma_desc) { if (!buf->p_dma_desc) {
if (list_empty(&isi->dma_desc_head)) { 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; return -EINVAL;
} else { } else {
/* Get an available descriptor */ /* Get an available descriptor */
...@@ -354,7 +354,7 @@ static int buffer_prepare(struct vb2_buffer *vb) ...@@ -354,7 +354,7 @@ static int buffer_prepare(struct vb2_buffer *vb)
static void buffer_cleanup(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_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 atmel_isi *isi = ici->priv;
struct frame_buffer *buf = container_of(vb, struct frame_buffer, vb); 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) ...@@ -374,7 +374,7 @@ static void start_dma(struct atmel_isi *isi, struct frame_buffer *buffer)
/* Check if already in a frame */ /* Check if already in a frame */
if (isi_readl(isi, ISI_STATUS) & ISI_CTRL_CDC) { 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; return;
} }
...@@ -394,7 +394,7 @@ static void start_dma(struct atmel_isi *isi, struct frame_buffer *buffer) ...@@ -394,7 +394,7 @@ static void start_dma(struct atmel_isi *isi, struct frame_buffer *buffer)
static void buffer_queue(struct vb2_buffer *vb) static void buffer_queue(struct vb2_buffer *vb)
{ {
struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); 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 atmel_isi *isi = ici->priv;
struct frame_buffer *buf = container_of(vb, struct frame_buffer, vb); struct frame_buffer *buf = container_of(vb, struct frame_buffer, vb);
unsigned long flags = 0; unsigned long flags = 0;
...@@ -412,7 +412,7 @@ static void buffer_queue(struct vb2_buffer *vb) ...@@ -412,7 +412,7 @@ static void buffer_queue(struct vb2_buffer *vb)
static int start_streaming(struct vb2_queue *vq) static int start_streaming(struct vb2_queue *vq)
{ {
struct soc_camera_device *icd = soc_camera_from_vb2q(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 atmel_isi *isi = ici->priv;
u32 sr = 0; u32 sr = 0;
...@@ -427,7 +427,7 @@ static int start_streaming(struct vb2_queue *vq) ...@@ -427,7 +427,7 @@ static int start_streaming(struct vb2_queue *vq)
isi_writel(isi, ISI_CTRL, ISI_CTRL_EN); isi_writel(isi, ISI_CTRL, ISI_CTRL_EN);
spin_unlock_irq(&isi->lock); 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, ret = wait_event_interruptible(isi->vsync_wq,
isi->state != ISI_STATE_IDLE); isi->state != ISI_STATE_IDLE);
if (ret) if (ret)
...@@ -448,7 +448,7 @@ static int start_streaming(struct vb2_queue *vq) ...@@ -448,7 +448,7 @@ static int start_streaming(struct vb2_queue *vq)
static int stop_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_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 atmel_isi *isi = ici->priv;
struct frame_buffer *buf, *node; struct frame_buffer *buf, *node;
int ret = 0; int ret = 0;
...@@ -470,7 +470,7 @@ static int stop_streaming(struct vb2_queue *vq) ...@@ -470,7 +470,7 @@ static int stop_streaming(struct vb2_queue *vq)
msleep(1); msleep(1);
if (time_after(jiffies, timeout)) { if (time_after(jiffies, timeout)) {
dev_err(icd->dev.parent, dev_err(icd->parent,
"Timeout waiting for finishing codec request\n"); "Timeout waiting for finishing codec request\n");
return -ETIMEDOUT; return -ETIMEDOUT;
} }
...@@ -482,7 +482,7 @@ static int stop_streaming(struct vb2_queue *vq) ...@@ -482,7 +482,7 @@ static int stop_streaming(struct vb2_queue *vq)
/* Disable ISI and wait for it is done */ /* Disable ISI and wait for it is done */
ret = atmel_isi_wait_status(isi, WAIT_ISI_DISABLE); ret = atmel_isi_wait_status(isi, WAIT_ISI_DISABLE);
if (ret < 0) if (ret < 0)
dev_err(icd->dev.parent, "Disable ISI timed out\n"); dev_err(icd->parent, "Disable ISI timed out\n");
return ret; return ret;
} }
...@@ -518,7 +518,7 @@ static int isi_camera_init_videobuf(struct vb2_queue *q, ...@@ -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, static int isi_camera_set_fmt(struct soc_camera_device *icd,
struct v4l2_format *f) 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 atmel_isi *isi = ici->priv;
struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
const struct soc_camera_format_xlate *xlate; const struct soc_camera_format_xlate *xlate;
...@@ -528,12 +528,12 @@ static int isi_camera_set_fmt(struct soc_camera_device *icd, ...@@ -528,12 +528,12 @@ static int isi_camera_set_fmt(struct soc_camera_device *icd,
xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat);
if (!xlate) { if (!xlate) {
dev_warn(icd->dev.parent, "Format %x not found\n", dev_warn(icd->parent, "Format %x not found\n",
pix->pixelformat); pix->pixelformat);
return -EINVAL; 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); pix->width, pix->height);
mf.width = pix->width; mf.width = pix->width;
...@@ -559,7 +559,7 @@ static int isi_camera_set_fmt(struct soc_camera_device *icd, ...@@ -559,7 +559,7 @@ static int isi_camera_set_fmt(struct soc_camera_device *icd,
pix->colorspace = mf.colorspace; pix->colorspace = mf.colorspace;
icd->current_fmt = xlate; 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); pix->width, pix->height);
return ret; return ret;
...@@ -577,7 +577,7 @@ static int isi_camera_try_fmt(struct soc_camera_device *icd, ...@@ -577,7 +577,7 @@ static int isi_camera_try_fmt(struct soc_camera_device *icd,
xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
if (pixfmt && !xlate) { 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; return -EINVAL;
} }
...@@ -609,7 +609,7 @@ static int isi_camera_try_fmt(struct soc_camera_device *icd, ...@@ -609,7 +609,7 @@ static int isi_camera_try_fmt(struct soc_camera_device *icd,
case V4L2_FIELD_NONE: case V4L2_FIELD_NONE:
break; break;
default: default:
dev_err(icd->dev.parent, "Field type %d unsupported.\n", dev_err(icd->parent, "Field type %d unsupported.\n",
mf.field); mf.field);
ret = -EINVAL; ret = -EINVAL;
} }
...@@ -670,7 +670,7 @@ static unsigned long make_bus_param(struct atmel_isi *isi) ...@@ -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, static int isi_camera_try_bus_param(struct soc_camera_device *icd,
unsigned char buswidth) 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; struct atmel_isi *isi = ici->priv;
unsigned long camera_flags; unsigned long camera_flags;
int ret; int ret;
...@@ -702,7 +702,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd, ...@@ -702,7 +702,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd,
fmt = soc_mbus_get_fmtdesc(code); fmt = soc_mbus_get_fmtdesc(code);
if (!fmt) { if (!fmt) {
dev_err(icd->dev.parent, dev_err(icd->parent,
"Invalid format code #%u: %d\n", idx, code); "Invalid format code #%u: %d\n", idx, code);
return 0; return 0;
} }
...@@ -710,7 +710,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd, ...@@ -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 */ /* This also checks support for the requested bits-per-sample */
ret = isi_camera_try_bus_param(icd, fmt->bits_per_sample); ret = isi_camera_try_bus_param(icd, fmt->bits_per_sample);
if (ret < 0) { if (ret < 0) {
dev_err(icd->dev.parent, dev_err(icd->parent,
"Fail to try the bus parameters.\n"); "Fail to try the bus parameters.\n");
return 0; return 0;
} }
...@@ -725,7 +725,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd, ...@@ -725,7 +725,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd,
xlate->host_fmt = &isi_camera_formats[0]; xlate->host_fmt = &isi_camera_formats[0];
xlate->code = code; xlate->code = code;
xlate++; 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); isi_camera_formats[0].name, code);
} }
break; break;
...@@ -733,7 +733,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd, ...@@ -733,7 +733,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd,
if (!isi_camera_packing_supported(fmt)) if (!isi_camera_packing_supported(fmt))
return 0; return 0;
if (xlate) if (xlate)
dev_dbg(icd->dev.parent, dev_dbg(icd->parent,
"Providing format %s in pass-through mode\n", "Providing format %s in pass-through mode\n",
fmt->name); fmt->name);
} }
...@@ -752,7 +752,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd, ...@@ -752,7 +752,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd,
/* Called with .video_lock held */ /* Called with .video_lock held */
static int isi_camera_add_device(struct soc_camera_device *icd) 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; struct atmel_isi *isi = ici->priv;
int ret; int ret;
...@@ -764,14 +764,14 @@ static int isi_camera_add_device(struct soc_camera_device *icd) ...@@ -764,14 +764,14 @@ static int isi_camera_add_device(struct soc_camera_device *icd)
return ret; return ret;
isi->icd = icd; 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); icd->devnum);
return 0; return 0;
} }
/* Called with .video_lock held */ /* Called with .video_lock held */
static void isi_camera_remove_device(struct soc_camera_device *icd) 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; struct atmel_isi *isi = ici->priv;
BUG_ON(icd != isi->icd); BUG_ON(icd != isi->icd);
...@@ -779,7 +779,7 @@ static void isi_camera_remove_device(struct soc_camera_device *icd) ...@@ -779,7 +779,7 @@ static void isi_camera_remove_device(struct soc_camera_device *icd)
clk_disable(isi->pclk); clk_disable(isi->pclk);
isi->icd = NULL; 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); icd->devnum);
} }
...@@ -802,7 +802,7 @@ static int isi_camera_querycap(struct soc_camera_host *ici, ...@@ -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) 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; struct atmel_isi *isi = ici->priv;
unsigned long bus_flags, camera_flags, common_flags; unsigned long bus_flags, camera_flags, common_flags;
int ret; int ret;
...@@ -812,7 +812,7 @@ static int isi_camera_set_bus_param(struct soc_camera_device *icd, u32 pixfmt) ...@@ -812,7 +812,7 @@ static int isi_camera_set_bus_param(struct soc_camera_device *icd, u32 pixfmt)
bus_flags = make_bus_param(isi); bus_flags = make_bus_param(isi);
common_flags = soc_camera_bus_param_compatible(camera_flags, bus_flags); 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); camera_flags, bus_flags, common_flags);
if (!common_flags) if (!common_flags)
return -EINVAL; return -EINVAL;
...@@ -844,7 +844,7 @@ static int isi_camera_set_bus_param(struct soc_camera_device *icd, u32 pixfmt) ...@@ -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); ret = icd->ops->set_bus_param(icd, common_flags);
if (ret < 0) { 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); common_flags, ret);
return ret; return ret;
} }
......
...@@ -603,13 +603,9 @@ static int mt9m001_video_probe(struct soc_camera_device *icd, ...@@ -603,13 +603,9 @@ static int mt9m001_video_probe(struct soc_camera_device *icd,
unsigned long flags; unsigned long flags;
int ret; int ret;
/* /* We must have a parent by now. And it cannot be a wrong one. */
* We must have a parent by now. And it cannot be a wrong one. BUG_ON(!icd->parent ||
* So this entire test is completely redundant. to_soc_camera_host(icd->parent)->nr != icd->iface);
*/
if (!icd->dev.parent ||
to_soc_camera_host(icd->dev.parent)->nr != icd->iface)
return -ENODEV;
/* Enable the chip */ /* Enable the chip */
data = reg_write(client, MT9M001_CHIP_ENABLE, 1); data = reg_write(client, MT9M001_CHIP_ENABLE, 1);
...@@ -675,8 +671,8 @@ static void mt9m001_video_remove(struct soc_camera_device *icd) ...@@ -675,8 +671,8 @@ static void mt9m001_video_remove(struct soc_camera_device *icd)
{ {
struct soc_camera_link *icl = to_soc_camera_link(icd); struct soc_camera_link *icl = to_soc_camera_link(icd);
dev_dbg(&icd->dev, "Video removed: %p, %p\n", dev_dbg(icd->pdev, "Video removed: %p, %p\n",
icd->dev.parent, icd->vdev); icd->parent, icd->vdev);
if (icl->free_bus) if (icl->free_bus)
icl->free_bus(icl); icl->free_bus(icl);
} }
......
...@@ -960,13 +960,9 @@ static int mt9m111_video_probe(struct soc_camera_device *icd, ...@@ -960,13 +960,9 @@ static int mt9m111_video_probe(struct soc_camera_device *icd,
s32 data; s32 data;
int ret; int ret;
/* /* We must have a parent by now. And it cannot be a wrong one. */
* We must have a parent by now. And it cannot be a wrong one. BUG_ON(!icd->parent ||
* So this entire test is completely redundant. to_soc_camera_host(icd->parent)->nr != icd->iface);
*/
if (!icd->dev.parent ||
to_soc_camera_host(icd->dev.parent)->nr != icd->iface)
return -ENODEV;
mt9m111->autoexposure = 1; mt9m111->autoexposure = 1;
mt9m111->autowhitebalance = 1; mt9m111->autowhitebalance = 1;
......
...@@ -700,8 +700,7 @@ static int mt9t031_runtime_suspend(struct device *dev) ...@@ -700,8 +700,7 @@ static int mt9t031_runtime_suspend(struct device *dev)
static int mt9t031_runtime_resume(struct device *dev) static int mt9t031_runtime_resume(struct device *dev)
{ {
struct video_device *vdev = to_video_device(dev); struct video_device *vdev = to_video_device(dev);
struct soc_camera_device *icd = container_of(vdev->parent, struct soc_camera_device *icd = dev_get_drvdata(vdev->parent);
struct soc_camera_device, dev);
struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
struct i2c_client *client = v4l2_get_subdevdata(sd); struct i2c_client *client = v4l2_get_subdevdata(sd);
struct mt9t031 *mt9t031 = to_mt9t031(client); struct mt9t031 *mt9t031 = to_mt9t031(client);
......
...@@ -1057,13 +1057,9 @@ static int mt9t112_camera_probe(struct soc_camera_device *icd, ...@@ -1057,13 +1057,9 @@ static int mt9t112_camera_probe(struct soc_camera_device *icd,
const char *devname; const char *devname;
int chipid; int chipid;
/* /* We must have a parent by now. And it cannot be a wrong one. */
* We must have a parent by now. And it cannot be a wrong one. BUG_ON(!icd->parent ||
* So this entire test is completely redundant. to_soc_camera_host(icd->parent)->nr != icd->iface);
*/
if (!icd->dev.parent ||
to_soc_camera_host(icd->dev.parent)->nr != icd->iface)
return -ENODEV;
/* /*
* check and show chip ID * check and show chip ID
......
...@@ -728,9 +728,9 @@ static int mt9v022_video_probe(struct soc_camera_device *icd, ...@@ -728,9 +728,9 @@ static int mt9v022_video_probe(struct soc_camera_device *icd,
int ret; int ret;
unsigned long flags; unsigned long flags;
if (!icd->dev.parent || /* We must have a parent by now. And it cannot be a wrong one. */
to_soc_camera_host(icd->dev.parent)->nr != icd->iface) BUG_ON(!icd->parent ||
return -ENODEV; to_soc_camera_host(icd->parent)->nr != icd->iface);
/* Read out the chip version register */ /* Read out the chip version register */
data = reg_read(client, MT9V022_CHIP_VERSION); data = reg_read(client, MT9V022_CHIP_VERSION);
...@@ -809,8 +809,8 @@ static void mt9v022_video_remove(struct soc_camera_device *icd) ...@@ -809,8 +809,8 @@ static void mt9v022_video_remove(struct soc_camera_device *icd)
{ {
struct soc_camera_link *icl = to_soc_camera_link(icd); struct soc_camera_link *icl = to_soc_camera_link(icd);
dev_dbg(&icd->dev, "Video removed: %p, %p\n", dev_dbg(icd->pdev, "Video removed: %p, %p\n",
icd->dev.parent, icd->vdev); icd->parent, icd->vdev);
if (icl->free_bus) if (icl->free_bus)
icl->free_bus(icl); icl->free_bus(icl);
} }
......
...@@ -141,7 +141,7 @@ static int mx1_videobuf_setup(struct videobuf_queue *vq, unsigned int *count, ...@@ -141,7 +141,7 @@ static int mx1_videobuf_setup(struct videobuf_queue *vq, unsigned int *count,
if (*size * *count > MAX_VIDEO_MEM * 1024 * 1024) if (*size * *count > MAX_VIDEO_MEM * 1024 * 1024)
*count = (MAX_VIDEO_MEM * 1024 * 1024) / *size; *count = (MAX_VIDEO_MEM * 1024 * 1024) / *size;
dev_dbg(icd->dev.parent, "count=%d, size=%d\n", *count, *size); dev_dbg(icd->parent, "count=%d, size=%d\n", *count, *size);
return 0; return 0;
} }
...@@ -153,7 +153,7 @@ static void free_buffer(struct videobuf_queue *vq, struct mx1_buffer *buf) ...@@ -153,7 +153,7 @@ static void free_buffer(struct videobuf_queue *vq, struct mx1_buffer *buf)
BUG_ON(in_interrupt()); BUG_ON(in_interrupt());
dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
vb, vb->baddr, vb->bsize); vb, vb->baddr, vb->bsize);
/* /*
...@@ -178,7 +178,7 @@ static int mx1_videobuf_prepare(struct videobuf_queue *vq, ...@@ -178,7 +178,7 @@ static int mx1_videobuf_prepare(struct videobuf_queue *vq,
if (bytes_per_line < 0) if (bytes_per_line < 0)
return bytes_per_line; return bytes_per_line;
dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
vb, vb->baddr, vb->bsize); vb, vb->baddr, vb->bsize);
/* Added list head initialization on alloc */ /* Added list head initialization on alloc */
...@@ -231,7 +231,7 @@ static int mx1_videobuf_prepare(struct videobuf_queue *vq, ...@@ -231,7 +231,7 @@ static int mx1_videobuf_prepare(struct videobuf_queue *vq,
static int mx1_camera_setup_dma(struct mx1_camera_dev *pcdev) static int mx1_camera_setup_dma(struct mx1_camera_dev *pcdev)
{ {
struct videobuf_buffer *vbuf = &pcdev->active->vb; struct videobuf_buffer *vbuf = &pcdev->active->vb;
struct device *dev = pcdev->icd->dev.parent; struct device *dev = pcdev->icd->parent;
int ret; int ret;
if (unlikely(!pcdev->active)) { if (unlikely(!pcdev->active)) {
...@@ -255,11 +255,11 @@ static void mx1_videobuf_queue(struct videobuf_queue *vq, ...@@ -255,11 +255,11 @@ static void mx1_videobuf_queue(struct videobuf_queue *vq,
struct videobuf_buffer *vb) struct videobuf_buffer *vb)
{ {
struct soc_camera_device *icd = vq->priv_data; struct soc_camera_device *icd = vq->priv_data;
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
struct mx1_camera_dev *pcdev = ici->priv; struct mx1_camera_dev *pcdev = ici->priv;
struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb); struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb);
dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
vb, vb->baddr, vb->bsize); vb, vb->baddr, vb->bsize);
list_add_tail(&vb->queue, &pcdev->capture); list_add_tail(&vb->queue, &pcdev->capture);
...@@ -286,7 +286,7 @@ static void mx1_videobuf_release(struct videobuf_queue *vq, ...@@ -286,7 +286,7 @@ static void mx1_videobuf_release(struct videobuf_queue *vq,
struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb); struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb);
#ifdef DEBUG #ifdef DEBUG
struct soc_camera_device *icd = vq->priv_data; struct soc_camera_device *icd = vq->priv_data;
struct device *dev = icd->dev.parent; struct device *dev = icd->parent;
dev_dbg(dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, dev_dbg(dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
vb, vb->baddr, vb->bsize); vb, vb->baddr, vb->bsize);
...@@ -342,7 +342,7 @@ static void mx1_camera_wakeup(struct mx1_camera_dev *pcdev, ...@@ -342,7 +342,7 @@ static void mx1_camera_wakeup(struct mx1_camera_dev *pcdev,
static void mx1_camera_dma_irq(int channel, void *data) static void mx1_camera_dma_irq(int channel, void *data)
{ {
struct mx1_camera_dev *pcdev = data; struct mx1_camera_dev *pcdev = data;
struct device *dev = pcdev->icd->dev.parent; struct device *dev = pcdev->icd->parent;
struct mx1_buffer *buf; struct mx1_buffer *buf;
struct videobuf_buffer *vb; struct videobuf_buffer *vb;
unsigned long flags; unsigned long flags;
...@@ -377,10 +377,10 @@ static struct videobuf_queue_ops mx1_videobuf_ops = { ...@@ -377,10 +377,10 @@ static struct videobuf_queue_ops mx1_videobuf_ops = {
static void mx1_camera_init_videobuf(struct videobuf_queue *q, static void mx1_camera_init_videobuf(struct videobuf_queue *q,
struct soc_camera_device *icd) 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 mx1_camera_dev *pcdev = ici->priv; struct mx1_camera_dev *pcdev = ici->priv;
videobuf_queue_dma_contig_init(q, &mx1_videobuf_ops, icd->dev.parent, videobuf_queue_dma_contig_init(q, &mx1_videobuf_ops, icd->parent,
&pcdev->lock, V4L2_BUF_TYPE_VIDEO_CAPTURE, &pcdev->lock, V4L2_BUF_TYPE_VIDEO_CAPTURE,
V4L2_FIELD_NONE, V4L2_FIELD_NONE,
sizeof(struct mx1_buffer), icd, &icd->video_lock); sizeof(struct mx1_buffer), icd, &icd->video_lock);
...@@ -400,7 +400,7 @@ static int mclk_get_divisor(struct mx1_camera_dev *pcdev) ...@@ -400,7 +400,7 @@ static int mclk_get_divisor(struct mx1_camera_dev *pcdev)
*/ */
div = (lcdclk + 2 * mclk - 1) / (2 * mclk) - 1; div = (lcdclk + 2 * mclk - 1) / (2 * mclk) - 1;
dev_dbg(pcdev->icd->dev.parent, dev_dbg(pcdev->icd->parent,
"System clock %lukHz, target freq %dkHz, divisor %lu\n", "System clock %lukHz, target freq %dkHz, divisor %lu\n",
lcdclk / 1000, mclk / 1000, div); lcdclk / 1000, mclk / 1000, div);
...@@ -411,7 +411,7 @@ static void mx1_camera_activate(struct mx1_camera_dev *pcdev) ...@@ -411,7 +411,7 @@ static void mx1_camera_activate(struct mx1_camera_dev *pcdev)
{ {
unsigned int csicr1 = CSICR1_EN; unsigned int csicr1 = CSICR1_EN;
dev_dbg(pcdev->icd->dev.parent, "Activate device\n"); dev_dbg(pcdev->icd->parent, "Activate device\n");
clk_enable(pcdev->clk); clk_enable(pcdev->clk);
...@@ -427,7 +427,7 @@ static void mx1_camera_activate(struct mx1_camera_dev *pcdev) ...@@ -427,7 +427,7 @@ static void mx1_camera_activate(struct mx1_camera_dev *pcdev)
static void mx1_camera_deactivate(struct mx1_camera_dev *pcdev) static void mx1_camera_deactivate(struct mx1_camera_dev *pcdev)
{ {
dev_dbg(pcdev->icd->dev.parent, "Deactivate device\n"); dev_dbg(pcdev->icd->parent, "Deactivate device\n");
/* Disable all CSI interface */ /* Disable all CSI interface */
__raw_writel(0x00, pcdev->base + CSICR1); __raw_writel(0x00, pcdev->base + CSICR1);
...@@ -441,13 +441,13 @@ static void mx1_camera_deactivate(struct mx1_camera_dev *pcdev) ...@@ -441,13 +441,13 @@ static void mx1_camera_deactivate(struct mx1_camera_dev *pcdev)
*/ */
static int mx1_camera_add_device(struct soc_camera_device *icd) static int mx1_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 mx1_camera_dev *pcdev = ici->priv; struct mx1_camera_dev *pcdev = ici->priv;
if (pcdev->icd) if (pcdev->icd)
return -EBUSY; return -EBUSY;
dev_info(icd->dev.parent, "MX1 Camera driver attached to camera %d\n", dev_info(icd->parent, "MX1 Camera driver attached to camera %d\n",
icd->devnum); icd->devnum);
mx1_camera_activate(pcdev); mx1_camera_activate(pcdev);
...@@ -459,7 +459,7 @@ static int mx1_camera_add_device(struct soc_camera_device *icd) ...@@ -459,7 +459,7 @@ static int mx1_camera_add_device(struct soc_camera_device *icd)
static void mx1_camera_remove_device(struct soc_camera_device *icd) static void mx1_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 mx1_camera_dev *pcdev = ici->priv; struct mx1_camera_dev *pcdev = ici->priv;
unsigned int csicr1; unsigned int csicr1;
...@@ -472,7 +472,7 @@ static void mx1_camera_remove_device(struct soc_camera_device *icd) ...@@ -472,7 +472,7 @@ static void mx1_camera_remove_device(struct soc_camera_device *icd)
/* Stop DMA engine */ /* Stop DMA engine */
imx_dma_disable(pcdev->dma_chan); imx_dma_disable(pcdev->dma_chan);
dev_info(icd->dev.parent, "MX1 Camera driver detached from camera %d\n", dev_info(icd->parent, "MX1 Camera driver detached from camera %d\n",
icd->devnum); icd->devnum);
mx1_camera_deactivate(pcdev); mx1_camera_deactivate(pcdev);
...@@ -490,7 +490,7 @@ static int mx1_camera_set_crop(struct soc_camera_device *icd, ...@@ -490,7 +490,7 @@ static int mx1_camera_set_crop(struct soc_camera_device *icd,
static int mx1_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) static int mx1_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 mx1_camera_dev *pcdev = ici->priv; struct mx1_camera_dev *pcdev = ici->priv;
unsigned long camera_flags, common_flags; unsigned long camera_flags, common_flags;
unsigned int csicr1; unsigned int csicr1;
...@@ -561,14 +561,14 @@ static int mx1_camera_set_fmt(struct soc_camera_device *icd, ...@@ -561,14 +561,14 @@ static int mx1_camera_set_fmt(struct soc_camera_device *icd,
xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat);
if (!xlate) { if (!xlate) {
dev_warn(icd->dev.parent, "Format %x not found\n", dev_warn(icd->parent, "Format %x not found\n",
pix->pixelformat); pix->pixelformat);
return -EINVAL; return -EINVAL;
} }
buswidth = xlate->host_fmt->bits_per_sample; buswidth = xlate->host_fmt->bits_per_sample;
if (buswidth > 8) { if (buswidth > 8) {
dev_warn(icd->dev.parent, dev_warn(icd->parent,
"bits-per-sample %d for format %x unsupported\n", "bits-per-sample %d for format %x unsupported\n",
buswidth, pix->pixelformat); buswidth, pix->pixelformat);
return -EINVAL; return -EINVAL;
...@@ -608,7 +608,7 @@ static int mx1_camera_try_fmt(struct soc_camera_device *icd, ...@@ -608,7 +608,7 @@ static int mx1_camera_try_fmt(struct soc_camera_device *icd,
xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat);
if (!xlate) { if (!xlate) {
dev_warn(icd->dev.parent, "Format %x not found\n", dev_warn(icd->parent, "Format %x not found\n",
pix->pixelformat); pix->pixelformat);
return -EINVAL; return -EINVAL;
} }
......
...@@ -277,7 +277,7 @@ static void mx2_camera_deactivate(struct mx2_camera_dev *pcdev) ...@@ -277,7 +277,7 @@ static void mx2_camera_deactivate(struct mx2_camera_dev *pcdev)
*/ */
static int mx2_camera_add_device(struct soc_camera_device *icd) static int mx2_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 mx2_camera_dev *pcdev = ici->priv; struct mx2_camera_dev *pcdev = ici->priv;
int ret; int ret;
u32 csicr1; u32 csicr1;
...@@ -302,7 +302,7 @@ static int mx2_camera_add_device(struct soc_camera_device *icd) ...@@ -302,7 +302,7 @@ static int mx2_camera_add_device(struct soc_camera_device *icd)
pcdev->icd = icd; pcdev->icd = icd;
dev_info(icd->dev.parent, "Camera driver attached to camera %d\n", dev_info(icd->parent, "Camera driver attached to camera %d\n",
icd->devnum); icd->devnum);
return 0; return 0;
...@@ -310,12 +310,12 @@ static int mx2_camera_add_device(struct soc_camera_device *icd) ...@@ -310,12 +310,12 @@ static int mx2_camera_add_device(struct soc_camera_device *icd)
static void mx2_camera_remove_device(struct soc_camera_device *icd) static void mx2_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 mx2_camera_dev *pcdev = ici->priv; struct mx2_camera_dev *pcdev = ici->priv;
BUG_ON(icd != pcdev->icd); BUG_ON(icd != pcdev->icd);
dev_info(icd->dev.parent, "Camera driver detached from camera %d\n", dev_info(icd->parent, "Camera driver detached from camera %d\n",
icd->devnum); icd->devnum);
mx2_camera_deactivate(pcdev); mx2_camera_deactivate(pcdev);
...@@ -436,7 +436,7 @@ static int mx2_videobuf_setup(struct videobuf_queue *vq, unsigned int *count, ...@@ -436,7 +436,7 @@ static int mx2_videobuf_setup(struct videobuf_queue *vq, unsigned int *count,
int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width,
icd->current_fmt->host_fmt); icd->current_fmt->host_fmt);
dev_dbg(&icd->dev, "count=%d, size=%d\n", *count, *size); dev_dbg(icd->parent, "count=%d, size=%d\n", *count, *size);
if (bytes_per_line < 0) if (bytes_per_line < 0)
return bytes_per_line; return bytes_per_line;
...@@ -456,7 +456,7 @@ static void free_buffer(struct videobuf_queue *vq, struct mx2_buffer *buf) ...@@ -456,7 +456,7 @@ static void free_buffer(struct videobuf_queue *vq, struct mx2_buffer *buf)
struct soc_camera_device *icd = vq->priv_data; struct soc_camera_device *icd = vq->priv_data;
struct videobuf_buffer *vb = &buf->vb; struct videobuf_buffer *vb = &buf->vb;
dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
vb, vb->baddr, vb->bsize); vb, vb->baddr, vb->bsize);
/* /*
...@@ -466,7 +466,7 @@ static void free_buffer(struct videobuf_queue *vq, struct mx2_buffer *buf) ...@@ -466,7 +466,7 @@ static void free_buffer(struct videobuf_queue *vq, struct mx2_buffer *buf)
videobuf_waiton(vq, vb, 0, 0); videobuf_waiton(vq, vb, 0, 0);
videobuf_dma_contig_free(vq, vb); videobuf_dma_contig_free(vq, vb);
dev_dbg(&icd->dev, "%s freed\n", __func__); dev_dbg(icd->parent, "%s freed\n", __func__);
vb->state = VIDEOBUF_NEEDS_INIT; vb->state = VIDEOBUF_NEEDS_INIT;
} }
...@@ -480,7 +480,7 @@ static int mx2_videobuf_prepare(struct videobuf_queue *vq, ...@@ -480,7 +480,7 @@ static int mx2_videobuf_prepare(struct videobuf_queue *vq,
icd->current_fmt->host_fmt); icd->current_fmt->host_fmt);
int ret = 0; int ret = 0;
dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
vb, vb->baddr, vb->bsize); vb, vb->baddr, vb->bsize);
if (bytes_per_line < 0) if (bytes_per_line < 0)
...@@ -532,12 +532,12 @@ static void mx2_videobuf_queue(struct videobuf_queue *vq, ...@@ -532,12 +532,12 @@ static void mx2_videobuf_queue(struct videobuf_queue *vq,
{ {
struct soc_camera_device *icd = vq->priv_data; struct soc_camera_device *icd = vq->priv_data;
struct soc_camera_host *ici = struct soc_camera_host *ici =
to_soc_camera_host(icd->dev.parent); to_soc_camera_host(icd->parent);
struct mx2_camera_dev *pcdev = ici->priv; struct mx2_camera_dev *pcdev = ici->priv;
struct mx2_buffer *buf = container_of(vb, struct mx2_buffer, vb); struct mx2_buffer *buf = container_of(vb, struct mx2_buffer, vb);
unsigned long flags; unsigned long flags;
dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
vb, vb->baddr, vb->bsize); vb, vb->baddr, vb->bsize);
spin_lock_irqsave(&pcdev->lock, flags); spin_lock_irqsave(&pcdev->lock, flags);
...@@ -610,27 +610,27 @@ static void mx2_videobuf_release(struct videobuf_queue *vq, ...@@ -610,27 +610,27 @@ static void mx2_videobuf_release(struct videobuf_queue *vq,
struct videobuf_buffer *vb) struct videobuf_buffer *vb)
{ {
struct soc_camera_device *icd = vq->priv_data; struct soc_camera_device *icd = vq->priv_data;
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
struct mx2_camera_dev *pcdev = ici->priv; struct mx2_camera_dev *pcdev = ici->priv;
struct mx2_buffer *buf = container_of(vb, struct mx2_buffer, vb); struct mx2_buffer *buf = container_of(vb, struct mx2_buffer, vb);
unsigned long flags; unsigned long flags;
#ifdef DEBUG #ifdef DEBUG
dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
vb, vb->baddr, vb->bsize); vb, vb->baddr, vb->bsize);
switch (vb->state) { switch (vb->state) {
case VIDEOBUF_ACTIVE: case VIDEOBUF_ACTIVE:
dev_info(&icd->dev, "%s (active)\n", __func__); dev_info(icd->parent, "%s (active)\n", __func__);
break; break;
case VIDEOBUF_QUEUED: case VIDEOBUF_QUEUED:
dev_info(&icd->dev, "%s (queued)\n", __func__); dev_info(icd->parent, "%s (queued)\n", __func__);
break; break;
case VIDEOBUF_PREPARED: case VIDEOBUF_PREPARED:
dev_info(&icd->dev, "%s (prepared)\n", __func__); dev_info(icd->parent, "%s (prepared)\n", __func__);
break; break;
default: default:
dev_info(&icd->dev, "%s (unknown) %d\n", __func__, dev_info(icd->parent, "%s (unknown) %d\n", __func__,
vb->state); vb->state);
break; break;
} }
...@@ -677,7 +677,7 @@ static struct videobuf_queue_ops mx2_videobuf_ops = { ...@@ -677,7 +677,7 @@ static struct videobuf_queue_ops mx2_videobuf_ops = {
static void mx2_camera_init_videobuf(struct videobuf_queue *q, static void mx2_camera_init_videobuf(struct videobuf_queue *q,
struct soc_camera_device *icd) 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 mx2_camera_dev *pcdev = ici->priv; struct mx2_camera_dev *pcdev = ici->priv;
videobuf_queue_dma_contig_init(q, &mx2_videobuf_ops, pcdev->dev, videobuf_queue_dma_contig_init(q, &mx2_videobuf_ops, pcdev->dev,
...@@ -718,7 +718,7 @@ static void mx27_camera_emma_buf_init(struct soc_camera_device *icd, ...@@ -718,7 +718,7 @@ static void mx27_camera_emma_buf_init(struct soc_camera_device *icd,
int bytesperline) int bytesperline)
{ {
struct soc_camera_host *ici = struct soc_camera_host *ici =
to_soc_camera_host(icd->dev.parent); to_soc_camera_host(icd->parent);
struct mx2_camera_dev *pcdev = ici->priv; struct mx2_camera_dev *pcdev = ici->priv;
writel(pcdev->discard_buffer_dma, writel(pcdev->discard_buffer_dma,
...@@ -771,7 +771,7 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd, ...@@ -771,7 +771,7 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd,
__u32 pixfmt) __u32 pixfmt)
{ {
struct soc_camera_host *ici = struct soc_camera_host *ici =
to_soc_camera_host(icd->dev.parent); to_soc_camera_host(icd->parent);
struct mx2_camera_dev *pcdev = ici->priv; struct mx2_camera_dev *pcdev = ici->priv;
unsigned long camera_flags, common_flags; unsigned long camera_flags, common_flags;
int ret = 0; int ret = 0;
...@@ -890,7 +890,7 @@ static int mx2_camera_set_crop(struct soc_camera_device *icd, ...@@ -890,7 +890,7 @@ static int mx2_camera_set_crop(struct soc_camera_device *icd,
if (ret < 0) if (ret < 0)
return ret; return ret;
dev_dbg(icd->dev.parent, "Sensor cropped %dx%d\n", dev_dbg(icd->parent, "Sensor cropped %dx%d\n",
mf.width, mf.height); mf.width, mf.height);
icd->user_width = mf.width; icd->user_width = mf.width;
...@@ -910,7 +910,7 @@ static int mx2_camera_set_fmt(struct soc_camera_device *icd, ...@@ -910,7 +910,7 @@ static int mx2_camera_set_fmt(struct soc_camera_device *icd,
xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat);
if (!xlate) { if (!xlate) {
dev_warn(icd->dev.parent, "Format %x not found\n", dev_warn(icd->parent, "Format %x not found\n",
pix->pixelformat); pix->pixelformat);
return -EINVAL; return -EINVAL;
} }
...@@ -950,7 +950,7 @@ static int mx2_camera_try_fmt(struct soc_camera_device *icd, ...@@ -950,7 +950,7 @@ static int mx2_camera_try_fmt(struct soc_camera_device *icd,
xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
if (pixfmt && !xlate) { 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; return -EINVAL;
} }
...@@ -1000,7 +1000,7 @@ static int mx2_camera_try_fmt(struct soc_camera_device *icd, ...@@ -1000,7 +1000,7 @@ static int mx2_camera_try_fmt(struct soc_camera_device *icd,
if (mf.field == V4L2_FIELD_ANY) if (mf.field == V4L2_FIELD_ANY)
mf.field = V4L2_FIELD_NONE; mf.field = V4L2_FIELD_NONE;
if (mf.field != V4L2_FIELD_NONE) { if (mf.field != V4L2_FIELD_NONE) {
dev_err(icd->dev.parent, "Field type %d unsupported.\n", dev_err(icd->parent, "Field type %d unsupported.\n",
mf.field); mf.field);
return -EINVAL; return -EINVAL;
} }
......
...@@ -194,7 +194,7 @@ static int mx3_videobuf_setup(struct vb2_queue *vq, ...@@ -194,7 +194,7 @@ static int mx3_videobuf_setup(struct vb2_queue *vq,
unsigned long sizes[], void *alloc_ctxs[]) unsigned long sizes[], void *alloc_ctxs[])
{ {
struct soc_camera_device *icd = soc_camera_from_vb2q(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 mx3_camera_dev *mx3_cam = ici->priv; struct mx3_camera_dev *mx3_cam = ici->priv;
int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width,
icd->current_fmt->host_fmt); icd->current_fmt->host_fmt);
...@@ -223,7 +223,7 @@ static int mx3_videobuf_setup(struct vb2_queue *vq, ...@@ -223,7 +223,7 @@ static int mx3_videobuf_setup(struct vb2_queue *vq,
static int mx3_videobuf_prepare(struct vb2_buffer *vb) static int mx3_videobuf_prepare(struct vb2_buffer *vb)
{ {
struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); 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 mx3_camera_dev *mx3_cam = ici->priv; struct mx3_camera_dev *mx3_cam = ici->priv;
struct idmac_channel *ichan = mx3_cam->idmac_channel[0]; struct idmac_channel *ichan = mx3_cam->idmac_channel[0];
struct scatterlist *sg; struct scatterlist *sg;
...@@ -241,7 +241,7 @@ static int mx3_videobuf_prepare(struct vb2_buffer *vb) ...@@ -241,7 +241,7 @@ static int mx3_videobuf_prepare(struct vb2_buffer *vb)
new_size = bytes_per_line * icd->user_height; new_size = bytes_per_line * icd->user_height;
if (vb2_plane_size(vb, 0) < new_size) { if (vb2_plane_size(vb, 0) < new_size) {
dev_err(icd->dev.parent, "Buffer too small (%lu < %zu)\n", dev_err(icd->parent, "Buffer too small (%lu < %zu)\n",
vb2_plane_size(vb, 0), new_size); vb2_plane_size(vb, 0), new_size);
return -ENOBUFS; return -ENOBUFS;
} }
...@@ -283,7 +283,7 @@ static enum pixel_fmt fourcc_to_ipu_pix(__u32 fourcc) ...@@ -283,7 +283,7 @@ static enum pixel_fmt fourcc_to_ipu_pix(__u32 fourcc)
static void mx3_videobuf_queue(struct vb2_buffer *vb) static void mx3_videobuf_queue(struct vb2_buffer *vb)
{ {
struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); 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 mx3_camera_dev *mx3_cam = ici->priv; struct mx3_camera_dev *mx3_cam = ici->priv;
struct mx3_camera_buffer *buf = to_mx3_vb(vb); struct mx3_camera_buffer *buf = to_mx3_vb(vb);
struct dma_async_tx_descriptor *txd = buf->txd; struct dma_async_tx_descriptor *txd = buf->txd;
...@@ -336,7 +336,7 @@ static void mx3_videobuf_queue(struct vb2_buffer *vb) ...@@ -336,7 +336,7 @@ static void mx3_videobuf_queue(struct vb2_buffer *vb)
spin_unlock_irq(&mx3_cam->lock); spin_unlock_irq(&mx3_cam->lock);
cookie = txd->tx_submit(txd); cookie = txd->tx_submit(txd);
dev_dbg(icd->dev.parent, "Submitted cookie %d DMA 0x%08x\n", dev_dbg(icd->parent, "Submitted cookie %d DMA 0x%08x\n",
cookie, sg_dma_address(&buf->sg)); cookie, sg_dma_address(&buf->sg));
if (cookie >= 0) if (cookie >= 0)
...@@ -357,13 +357,13 @@ static void mx3_videobuf_queue(struct vb2_buffer *vb) ...@@ -357,13 +357,13 @@ static void mx3_videobuf_queue(struct vb2_buffer *vb)
static void mx3_videobuf_release(struct vb2_buffer *vb) static void mx3_videobuf_release(struct vb2_buffer *vb)
{ {
struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); 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 mx3_camera_dev *mx3_cam = ici->priv; struct mx3_camera_dev *mx3_cam = ici->priv;
struct mx3_camera_buffer *buf = to_mx3_vb(vb); struct mx3_camera_buffer *buf = to_mx3_vb(vb);
struct dma_async_tx_descriptor *txd = buf->txd; struct dma_async_tx_descriptor *txd = buf->txd;
unsigned long flags; unsigned long flags;
dev_dbg(icd->dev.parent, dev_dbg(icd->parent,
"Release%s DMA 0x%08x, queue %sempty\n", "Release%s DMA 0x%08x, queue %sempty\n",
mx3_cam->active == buf ? " active" : "", sg_dma_address(&buf->sg), mx3_cam->active == buf ? " active" : "", sg_dma_address(&buf->sg),
list_empty(&buf->queue) ? "" : "not "); list_empty(&buf->queue) ? "" : "not ");
...@@ -402,7 +402,7 @@ static int mx3_videobuf_init(struct vb2_buffer *vb) ...@@ -402,7 +402,7 @@ static int mx3_videobuf_init(struct vb2_buffer *vb)
static int mx3_stop_streaming(struct vb2_queue *q) static int mx3_stop_streaming(struct vb2_queue *q)
{ {
struct soc_camera_device *icd = soc_camera_from_vb2q(q); struct soc_camera_device *icd = soc_camera_from_vb2q(q);
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
struct mx3_camera_dev *mx3_cam = ici->priv; struct mx3_camera_dev *mx3_cam = ici->priv;
struct idmac_channel *ichan = mx3_cam->idmac_channel[0]; struct idmac_channel *ichan = mx3_cam->idmac_channel[0];
struct dma_chan *chan; struct dma_chan *chan;
...@@ -498,7 +498,7 @@ static void mx3_camera_activate(struct mx3_camera_dev *mx3_cam, ...@@ -498,7 +498,7 @@ static void mx3_camera_activate(struct mx3_camera_dev *mx3_cam,
clk_enable(mx3_cam->clk); clk_enable(mx3_cam->clk);
rate = clk_round_rate(mx3_cam->clk, mx3_cam->mclk); rate = clk_round_rate(mx3_cam->clk, mx3_cam->mclk);
dev_dbg(icd->dev.parent, "Set SENS_CONF to %x, rate %ld\n", conf, rate); dev_dbg(icd->parent, "Set SENS_CONF to %x, rate %ld\n", conf, rate);
if (rate) if (rate)
clk_set_rate(mx3_cam->clk, rate); clk_set_rate(mx3_cam->clk, rate);
} }
...@@ -506,7 +506,7 @@ static void mx3_camera_activate(struct mx3_camera_dev *mx3_cam, ...@@ -506,7 +506,7 @@ static void mx3_camera_activate(struct mx3_camera_dev *mx3_cam,
/* Called with .video_lock held */ /* Called with .video_lock held */
static int mx3_camera_add_device(struct soc_camera_device *icd) static int mx3_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 mx3_camera_dev *mx3_cam = ici->priv; struct mx3_camera_dev *mx3_cam = ici->priv;
if (mx3_cam->icd) if (mx3_cam->icd)
...@@ -516,7 +516,7 @@ static int mx3_camera_add_device(struct soc_camera_device *icd) ...@@ -516,7 +516,7 @@ static int mx3_camera_add_device(struct soc_camera_device *icd)
mx3_cam->icd = icd; mx3_cam->icd = icd;
dev_info(icd->dev.parent, "MX3 Camera driver attached to camera %d\n", dev_info(icd->parent, "MX3 Camera driver attached to camera %d\n",
icd->devnum); icd->devnum);
return 0; return 0;
...@@ -525,7 +525,7 @@ static int mx3_camera_add_device(struct soc_camera_device *icd) ...@@ -525,7 +525,7 @@ static int mx3_camera_add_device(struct soc_camera_device *icd)
/* Called with .video_lock held */ /* Called with .video_lock held */
static void mx3_camera_remove_device(struct soc_camera_device *icd) static void mx3_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 mx3_camera_dev *mx3_cam = ici->priv; struct mx3_camera_dev *mx3_cam = ici->priv;
struct idmac_channel **ichan = &mx3_cam->idmac_channel[0]; struct idmac_channel **ichan = &mx3_cam->idmac_channel[0];
...@@ -540,7 +540,7 @@ static void mx3_camera_remove_device(struct soc_camera_device *icd) ...@@ -540,7 +540,7 @@ static void mx3_camera_remove_device(struct soc_camera_device *icd)
mx3_cam->icd = NULL; mx3_cam->icd = NULL;
dev_info(icd->dev.parent, "MX3 Camera driver detached from camera %d\n", dev_info(icd->parent, "MX3 Camera driver detached from camera %d\n",
icd->devnum); icd->devnum);
} }
...@@ -607,12 +607,12 @@ static int test_platform_param(struct mx3_camera_dev *mx3_cam, ...@@ -607,12 +607,12 @@ static int test_platform_param(struct mx3_camera_dev *mx3_cam,
static int mx3_camera_try_bus_param(struct soc_camera_device *icd, static int mx3_camera_try_bus_param(struct soc_camera_device *icd,
const unsigned int depth) const unsigned int depth)
{ {
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
struct mx3_camera_dev *mx3_cam = ici->priv; struct mx3_camera_dev *mx3_cam = ici->priv;
unsigned long bus_flags, camera_flags; unsigned long bus_flags, camera_flags;
int ret = test_platform_param(mx3_cam, depth, &bus_flags); int ret = test_platform_param(mx3_cam, depth, &bus_flags);
dev_dbg(icd->dev.parent, "request bus width %d bit: %d\n", depth, ret); dev_dbg(icd->parent, "request bus width %d bit: %d\n", depth, ret);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -621,7 +621,7 @@ static int mx3_camera_try_bus_param(struct soc_camera_device *icd, ...@@ -621,7 +621,7 @@ static int mx3_camera_try_bus_param(struct soc_camera_device *icd,
ret = soc_camera_bus_param_compatible(camera_flags, bus_flags); ret = soc_camera_bus_param_compatible(camera_flags, bus_flags);
if (ret < 0) if (ret < 0)
dev_warn(icd->dev.parent, dev_warn(icd->parent,
"Flags incompatible: camera %lx, host %lx\n", "Flags incompatible: camera %lx, host %lx\n",
camera_flags, bus_flags); camera_flags, bus_flags);
...@@ -675,7 +675,7 @@ static int mx3_camera_get_formats(struct soc_camera_device *icd, unsigned int id ...@@ -675,7 +675,7 @@ static int mx3_camera_get_formats(struct soc_camera_device *icd, unsigned int id
struct soc_camera_format_xlate *xlate) struct soc_camera_format_xlate *xlate)
{ {
struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
struct device *dev = icd->dev.parent; struct device *dev = icd->parent;
int formats = 0, ret; int formats = 0, ret;
enum v4l2_mbus_pixelcode code; enum v4l2_mbus_pixelcode code;
const struct soc_mbus_pixelfmt *fmt; const struct soc_mbus_pixelfmt *fmt;
...@@ -687,7 +687,7 @@ static int mx3_camera_get_formats(struct soc_camera_device *icd, unsigned int id ...@@ -687,7 +687,7 @@ static int mx3_camera_get_formats(struct soc_camera_device *icd, unsigned int id
fmt = soc_mbus_get_fmtdesc(code); fmt = soc_mbus_get_fmtdesc(code);
if (!fmt) { if (!fmt) {
dev_warn(icd->dev.parent, dev_warn(icd->parent,
"Unsupported format code #%u: %d\n", idx, code); "Unsupported format code #%u: %d\n", idx, code);
return 0; return 0;
} }
...@@ -815,7 +815,7 @@ static int mx3_camera_set_crop(struct soc_camera_device *icd, ...@@ -815,7 +815,7 @@ static int mx3_camera_set_crop(struct soc_camera_device *icd,
struct v4l2_crop *a) struct v4l2_crop *a)
{ {
struct v4l2_rect *rect = &a->c; struct v4l2_rect *rect = &a->c;
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
struct mx3_camera_dev *mx3_cam = ici->priv; struct mx3_camera_dev *mx3_cam = ici->priv;
struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
struct v4l2_mbus_framefmt mf; struct v4l2_mbus_framefmt mf;
...@@ -848,7 +848,7 @@ static int mx3_camera_set_crop(struct soc_camera_device *icd, ...@@ -848,7 +848,7 @@ static int mx3_camera_set_crop(struct soc_camera_device *icd,
configure_geometry(mx3_cam, mf.width, mf.height, configure_geometry(mx3_cam, mf.width, mf.height,
icd->current_fmt->host_fmt); icd->current_fmt->host_fmt);
dev_dbg(icd->dev.parent, "Sensor cropped %dx%d\n", dev_dbg(icd->parent, "Sensor cropped %dx%d\n",
mf.width, mf.height); mf.width, mf.height);
icd->user_width = mf.width; icd->user_width = mf.width;
...@@ -860,7 +860,7 @@ static int mx3_camera_set_crop(struct soc_camera_device *icd, ...@@ -860,7 +860,7 @@ static int mx3_camera_set_crop(struct soc_camera_device *icd,
static int mx3_camera_set_fmt(struct soc_camera_device *icd, static int mx3_camera_set_fmt(struct soc_camera_device *icd,
struct v4l2_format *f) 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 mx3_camera_dev *mx3_cam = ici->priv; struct mx3_camera_dev *mx3_cam = ici->priv;
struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
const struct soc_camera_format_xlate *xlate; const struct soc_camera_format_xlate *xlate;
...@@ -870,13 +870,13 @@ static int mx3_camera_set_fmt(struct soc_camera_device *icd, ...@@ -870,13 +870,13 @@ static int mx3_camera_set_fmt(struct soc_camera_device *icd,
xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat);
if (!xlate) { if (!xlate) {
dev_warn(icd->dev.parent, "Format %x not found\n", dev_warn(icd->parent, "Format %x not found\n",
pix->pixelformat); pix->pixelformat);
return -EINVAL; return -EINVAL;
} }
stride_align(&pix->width); stride_align(&pix->width);
dev_dbg(icd->dev.parent, "Set format %dx%d\n", pix->width, pix->height); dev_dbg(icd->parent, "Set format %dx%d\n", pix->width, pix->height);
/* /*
* Might have to perform a complete interface initialisation like in * Might have to perform a complete interface initialisation like in
...@@ -912,7 +912,7 @@ static int mx3_camera_set_fmt(struct soc_camera_device *icd, ...@@ -912,7 +912,7 @@ static int mx3_camera_set_fmt(struct soc_camera_device *icd,
pix->colorspace = mf.colorspace; pix->colorspace = mf.colorspace;
icd->current_fmt = xlate; icd->current_fmt = xlate;
dev_dbg(icd->dev.parent, "Sensor set %dx%d\n", pix->width, pix->height); dev_dbg(icd->parent, "Sensor set %dx%d\n", pix->width, pix->height);
return ret; return ret;
} }
...@@ -929,7 +929,7 @@ static int mx3_camera_try_fmt(struct soc_camera_device *icd, ...@@ -929,7 +929,7 @@ static int mx3_camera_try_fmt(struct soc_camera_device *icd,
xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
if (pixfmt && !xlate) { 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; return -EINVAL;
} }
...@@ -961,7 +961,7 @@ static int mx3_camera_try_fmt(struct soc_camera_device *icd, ...@@ -961,7 +961,7 @@ static int mx3_camera_try_fmt(struct soc_camera_device *icd,
case V4L2_FIELD_NONE: case V4L2_FIELD_NONE:
break; break;
default: default:
dev_err(icd->dev.parent, "Field type %d unsupported.\n", dev_err(icd->parent, "Field type %d unsupported.\n",
mf.field); mf.field);
ret = -EINVAL; ret = -EINVAL;
} }
...@@ -994,7 +994,7 @@ static int mx3_camera_querycap(struct soc_camera_host *ici, ...@@ -994,7 +994,7 @@ static int mx3_camera_querycap(struct soc_camera_host *ici,
static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) static int mx3_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 mx3_camera_dev *mx3_cam = ici->priv; struct mx3_camera_dev *mx3_cam = ici->priv;
unsigned long bus_flags, camera_flags, common_flags; unsigned long bus_flags, camera_flags, common_flags;
u32 dw, sens_conf; u32 dw, sens_conf;
...@@ -1002,7 +1002,7 @@ static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) ...@@ -1002,7 +1002,7 @@ static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt)
int buswidth; int buswidth;
int ret; int ret;
const struct soc_camera_format_xlate *xlate; const struct soc_camera_format_xlate *xlate;
struct device *dev = icd->dev.parent; struct device *dev = icd->parent;
fmt = soc_mbus_get_fmtdesc(icd->current_fmt->code); fmt = soc_mbus_get_fmtdesc(icd->current_fmt->code);
if (!fmt) if (!fmt)
......
...@@ -207,7 +207,7 @@ static int omap1_videobuf_setup(struct videobuf_queue *vq, unsigned int *count, ...@@ -207,7 +207,7 @@ static int omap1_videobuf_setup(struct videobuf_queue *vq, unsigned int *count,
struct soc_camera_device *icd = vq->priv_data; struct soc_camera_device *icd = vq->priv_data;
int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width,
icd->current_fmt->host_fmt); icd->current_fmt->host_fmt);
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
struct omap1_cam_dev *pcdev = ici->priv; struct omap1_cam_dev *pcdev = ici->priv;
if (bytes_per_line < 0) if (bytes_per_line < 0)
...@@ -221,7 +221,7 @@ static int omap1_videobuf_setup(struct videobuf_queue *vq, unsigned int *count, ...@@ -221,7 +221,7 @@ static int omap1_videobuf_setup(struct videobuf_queue *vq, unsigned int *count,
if (*size * *count > MAX_VIDEO_MEM * 1024 * 1024) if (*size * *count > MAX_VIDEO_MEM * 1024 * 1024)
*count = (MAX_VIDEO_MEM * 1024 * 1024) / *size; *count = (MAX_VIDEO_MEM * 1024 * 1024) / *size;
dev_dbg(icd->dev.parent, dev_dbg(icd->parent,
"%s: count=%d, size=%d\n", __func__, *count, *size); "%s: count=%d, size=%d\n", __func__, *count, *size);
return 0; return 0;
...@@ -240,7 +240,7 @@ static void free_buffer(struct videobuf_queue *vq, struct omap1_cam_buf *buf, ...@@ -240,7 +240,7 @@ static void free_buffer(struct videobuf_queue *vq, struct omap1_cam_buf *buf,
videobuf_dma_contig_free(vq, vb); videobuf_dma_contig_free(vq, vb);
} else { } else {
struct soc_camera_device *icd = vq->priv_data; struct soc_camera_device *icd = vq->priv_data;
struct device *dev = icd->dev.parent; struct device *dev = icd->parent;
struct videobuf_dmabuf *dma = videobuf_to_dma(vb); struct videobuf_dmabuf *dma = videobuf_to_dma(vb);
videobuf_dma_unmap(dev, dma); videobuf_dma_unmap(dev, dma);
...@@ -257,7 +257,7 @@ static int omap1_videobuf_prepare(struct videobuf_queue *vq, ...@@ -257,7 +257,7 @@ static int omap1_videobuf_prepare(struct videobuf_queue *vq,
struct omap1_cam_buf *buf = container_of(vb, struct omap1_cam_buf, vb); struct omap1_cam_buf *buf = container_of(vb, struct omap1_cam_buf, vb);
int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width,
icd->current_fmt->host_fmt); icd->current_fmt->host_fmt);
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
struct omap1_cam_dev *pcdev = ici->priv; struct omap1_cam_dev *pcdev = ici->priv;
int ret; int ret;
...@@ -489,7 +489,7 @@ static void omap1_videobuf_queue(struct videobuf_queue *vq, ...@@ -489,7 +489,7 @@ static void omap1_videobuf_queue(struct videobuf_queue *vq,
struct videobuf_buffer *vb) struct videobuf_buffer *vb)
{ {
struct soc_camera_device *icd = vq->priv_data; struct soc_camera_device *icd = vq->priv_data;
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
struct omap1_cam_dev *pcdev = ici->priv; struct omap1_cam_dev *pcdev = ici->priv;
struct omap1_cam_buf *buf; struct omap1_cam_buf *buf;
u32 mode; u32 mode;
...@@ -518,7 +518,7 @@ static void omap1_videobuf_queue(struct videobuf_queue *vq, ...@@ -518,7 +518,7 @@ static void omap1_videobuf_queue(struct videobuf_queue *vq,
pcdev->active = buf; pcdev->active = buf;
pcdev->ready = NULL; pcdev->ready = NULL;
dev_dbg(icd->dev.parent, dev_dbg(icd->parent,
"%s: capture not active, setup FIFO, start DMA\n", __func__); "%s: capture not active, setup FIFO, start DMA\n", __func__);
mode = CAM_READ_CACHE(pcdev, MODE) & ~THRESHOLD_MASK; mode = CAM_READ_CACHE(pcdev, MODE) & ~THRESHOLD_MASK;
mode |= THRESHOLD_LEVEL(pcdev->vb_mode) << THRESHOLD_SHIFT; mode |= THRESHOLD_LEVEL(pcdev->vb_mode) << THRESHOLD_SHIFT;
...@@ -542,8 +542,8 @@ static void omap1_videobuf_release(struct videobuf_queue *vq, ...@@ -542,8 +542,8 @@ static void omap1_videobuf_release(struct videobuf_queue *vq,
struct omap1_cam_buf *buf = struct omap1_cam_buf *buf =
container_of(vb, struct omap1_cam_buf, vb); container_of(vb, struct omap1_cam_buf, vb);
struct soc_camera_device *icd = vq->priv_data; struct soc_camera_device *icd = vq->priv_data;
struct device *dev = icd->dev.parent; struct device *dev = icd->parent;
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct soc_camera_host *ici = to_soc_camera_host(dev);
struct omap1_cam_dev *pcdev = ici->priv; struct omap1_cam_dev *pcdev = ici->priv;
switch (vb->state) { switch (vb->state) {
...@@ -572,7 +572,7 @@ static void videobuf_done(struct omap1_cam_dev *pcdev, ...@@ -572,7 +572,7 @@ static void videobuf_done(struct omap1_cam_dev *pcdev,
{ {
struct omap1_cam_buf *buf = pcdev->active; struct omap1_cam_buf *buf = pcdev->active;
struct videobuf_buffer *vb; struct videobuf_buffer *vb;
struct device *dev = pcdev->icd->dev.parent; struct device *dev = pcdev->icd->parent;
if (WARN_ON(!buf)) { if (WARN_ON(!buf)) {
suspend_capture(pcdev); suspend_capture(pcdev);
...@@ -798,7 +798,7 @@ static void dma_isr(int channel, unsigned short status, void *data) ...@@ -798,7 +798,7 @@ static void dma_isr(int channel, unsigned short status, void *data)
static irqreturn_t cam_isr(int irq, void *data) static irqreturn_t cam_isr(int irq, void *data)
{ {
struct omap1_cam_dev *pcdev = data; struct omap1_cam_dev *pcdev = data;
struct device *dev = pcdev->icd->dev.parent; struct device *dev = pcdev->icd->parent;
struct omap1_cam_buf *buf = pcdev->active; struct omap1_cam_buf *buf = pcdev->active;
u32 it_status; u32 it_status;
unsigned long flags; unsigned long flags;
...@@ -908,7 +908,7 @@ static void sensor_reset(struct omap1_cam_dev *pcdev, bool reset) ...@@ -908,7 +908,7 @@ static void sensor_reset(struct omap1_cam_dev *pcdev, bool reset)
*/ */
static int omap1_cam_add_device(struct soc_camera_device *icd) static int omap1_cam_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 omap1_cam_dev *pcdev = ici->priv; struct omap1_cam_dev *pcdev = ici->priv;
u32 ctrlclock; u32 ctrlclock;
...@@ -951,14 +951,14 @@ static int omap1_cam_add_device(struct soc_camera_device *icd) ...@@ -951,14 +951,14 @@ static int omap1_cam_add_device(struct soc_camera_device *icd)
pcdev->icd = icd; pcdev->icd = icd;
dev_dbg(icd->dev.parent, "OMAP1 Camera driver attached to camera %d\n", dev_dbg(icd->parent, "OMAP1 Camera driver attached to camera %d\n",
icd->devnum); icd->devnum);
return 0; return 0;
} }
static void omap1_cam_remove_device(struct soc_camera_device *icd) static void omap1_cam_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 omap1_cam_dev *pcdev = ici->priv; struct omap1_cam_dev *pcdev = ici->priv;
u32 ctrlclock; u32 ctrlclock;
...@@ -984,7 +984,7 @@ static void omap1_cam_remove_device(struct soc_camera_device *icd) ...@@ -984,7 +984,7 @@ static void omap1_cam_remove_device(struct soc_camera_device *icd)
pcdev->icd = NULL; pcdev->icd = NULL;
dev_dbg(icd->dev.parent, dev_dbg(icd->parent,
"OMAP1 Camera driver detached from camera %d\n", icd->devnum); "OMAP1 Camera driver detached from camera %d\n", icd->devnum);
} }
...@@ -1069,7 +1069,7 @@ static int omap1_cam_get_formats(struct soc_camera_device *icd, ...@@ -1069,7 +1069,7 @@ static int omap1_cam_get_formats(struct soc_camera_device *icd,
unsigned int idx, struct soc_camera_format_xlate *xlate) unsigned int idx, struct soc_camera_format_xlate *xlate)
{ {
struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
struct device *dev = icd->dev.parent; struct device *dev = icd->parent;
int formats = 0, ret; int formats = 0, ret;
enum v4l2_mbus_pixelcode code; enum v4l2_mbus_pixelcode code;
const struct soc_mbus_pixelfmt *fmt; const struct soc_mbus_pixelfmt *fmt;
...@@ -1221,9 +1221,9 @@ static int omap1_cam_set_crop(struct soc_camera_device *icd, ...@@ -1221,9 +1221,9 @@ static int omap1_cam_set_crop(struct soc_camera_device *icd,
struct v4l2_rect *rect = &crop->c; struct v4l2_rect *rect = &crop->c;
const struct soc_camera_format_xlate *xlate = icd->current_fmt; const struct soc_camera_format_xlate *xlate = icd->current_fmt;
struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct device *dev = icd->parent;
struct soc_camera_host *ici = to_soc_camera_host(dev);
struct omap1_cam_dev *pcdev = ici->priv; struct omap1_cam_dev *pcdev = ici->priv;
struct device *dev = icd->dev.parent;
struct v4l2_mbus_framefmt mf; struct v4l2_mbus_framefmt mf;
int ret; int ret;
...@@ -1269,8 +1269,8 @@ static int omap1_cam_set_fmt(struct soc_camera_device *icd, ...@@ -1269,8 +1269,8 @@ static int omap1_cam_set_fmt(struct soc_camera_device *icd,
{ {
struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
const struct soc_camera_format_xlate *xlate; const struct soc_camera_format_xlate *xlate;
struct device *dev = icd->dev.parent; struct device *dev = icd->parent;
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct soc_camera_host *ici = to_soc_camera_host(dev);
struct omap1_cam_dev *pcdev = ici->priv; struct omap1_cam_dev *pcdev = ici->priv;
struct v4l2_pix_format *pix = &f->fmt.pix; struct v4l2_pix_format *pix = &f->fmt.pix;
struct v4l2_mbus_framefmt mf; struct v4l2_mbus_framefmt mf;
...@@ -1325,7 +1325,7 @@ static int omap1_cam_try_fmt(struct soc_camera_device *icd, ...@@ -1325,7 +1325,7 @@ static int omap1_cam_try_fmt(struct soc_camera_device *icd,
xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat);
if (!xlate) { if (!xlate) {
dev_warn(icd->dev.parent, "Format %#x not found\n", dev_warn(icd->parent, "Format %#x not found\n",
pix->pixelformat); pix->pixelformat);
return -EINVAL; return -EINVAL;
} }
...@@ -1361,7 +1361,7 @@ static int omap1_cam_mmap_mapper(struct videobuf_queue *q, ...@@ -1361,7 +1361,7 @@ static int omap1_cam_mmap_mapper(struct videobuf_queue *q,
struct vm_area_struct *vma) struct vm_area_struct *vma)
{ {
struct soc_camera_device *icd = q->priv_data; struct soc_camera_device *icd = q->priv_data;
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
struct omap1_cam_dev *pcdev = ici->priv; struct omap1_cam_dev *pcdev = ici->priv;
int ret; int ret;
...@@ -1376,17 +1376,17 @@ static int omap1_cam_mmap_mapper(struct videobuf_queue *q, ...@@ -1376,17 +1376,17 @@ static int omap1_cam_mmap_mapper(struct videobuf_queue *q,
static void omap1_cam_init_videobuf(struct videobuf_queue *q, static void omap1_cam_init_videobuf(struct videobuf_queue *q,
struct soc_camera_device *icd) 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 omap1_cam_dev *pcdev = ici->priv; struct omap1_cam_dev *pcdev = ici->priv;
if (!sg_mode) if (!sg_mode)
videobuf_queue_dma_contig_init(q, &omap1_videobuf_ops, videobuf_queue_dma_contig_init(q, &omap1_videobuf_ops,
icd->dev.parent, &pcdev->lock, icd->parent, &pcdev->lock,
V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE,
sizeof(struct omap1_cam_buf), icd, &icd->video_lock); sizeof(struct omap1_cam_buf), icd, &icd->video_lock);
else else
videobuf_queue_sg_init(q, &omap1_videobuf_ops, videobuf_queue_sg_init(q, &omap1_videobuf_ops,
icd->dev.parent, &pcdev->lock, icd->parent, &pcdev->lock,
V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE,
sizeof(struct omap1_cam_buf), icd, &icd->video_lock); sizeof(struct omap1_cam_buf), icd, &icd->video_lock);
...@@ -1438,9 +1438,9 @@ static int omap1_cam_querycap(struct soc_camera_host *ici, ...@@ -1438,9 +1438,9 @@ static int omap1_cam_querycap(struct soc_camera_host *ici,
static int omap1_cam_set_bus_param(struct soc_camera_device *icd, static int omap1_cam_set_bus_param(struct soc_camera_device *icd,
__u32 pixfmt) __u32 pixfmt)
{ {
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct device *dev = icd->parent;
struct soc_camera_host *ici = to_soc_camera_host(dev);
struct omap1_cam_dev *pcdev = ici->priv; struct omap1_cam_dev *pcdev = ici->priv;
struct device *dev = icd->dev.parent;
const struct soc_camera_format_xlate *xlate; const struct soc_camera_format_xlate *xlate;
const struct soc_mbus_pixelfmt *fmt; const struct soc_mbus_pixelfmt *fmt;
unsigned long camera_flags, common_flags; unsigned long camera_flags, common_flags;
......
...@@ -1031,16 +1031,9 @@ static int ov2640_video_probe(struct soc_camera_device *icd, ...@@ -1031,16 +1031,9 @@ static int ov2640_video_probe(struct soc_camera_device *icd,
const char *devname; const char *devname;
int ret; int ret;
/* /* We must have a parent by now. And it cannot be a wrong one. */
* we must have a parent by now. And it cannot be a wrong one. BUG_ON(!icd->parent ||
* So this entire test is completely redundant. to_soc_camera_host(icd->parent)->nr != icd->iface);
*/
if (!icd->dev.parent ||
to_soc_camera_host(icd->dev.parent)->nr != icd->iface) {
dev_err(&client->dev, "Parent missing or invalid!\n");
ret = -ENODEV;
goto err;
}
/* /*
* check and show product ID and manufacturer ID * check and show product ID and manufacturer ID
......
...@@ -1032,13 +1032,9 @@ static int ov772x_video_probe(struct soc_camera_device *icd, ...@@ -1032,13 +1032,9 @@ static int ov772x_video_probe(struct soc_camera_device *icd,
u8 pid, ver; u8 pid, ver;
const char *devname; const char *devname;
/* /* We must have a parent by now. And it cannot be a wrong one. */
* We must have a parent by now. And it cannot be a wrong one. BUG_ON(!icd->parent ||
* So this entire test is completely redundant. to_soc_camera_host(icd->parent)->nr != icd->iface);
*/
if (!icd->dev.parent ||
to_soc_camera_host(icd->dev.parent)->nr != icd->iface)
return -ENODEV;
/* /*
* check and show product ID and manufacturer ID * check and show product ID and manufacturer ID
......
...@@ -657,16 +657,9 @@ static int ov9640_video_probe(struct soc_camera_device *icd, ...@@ -657,16 +657,9 @@ static int ov9640_video_probe(struct soc_camera_device *icd,
const char *devname; const char *devname;
int ret = 0; int ret = 0;
/* /* We must have a parent by now. And it cannot be a wrong one. */
* We must have a parent by now. And it cannot be a wrong one. BUG_ON(!icd->parent ||
* So this entire test is completely redundant. to_soc_camera_host(icd->parent)->nr != icd->iface);
*/
if (!icd->dev.parent ||
to_soc_camera_host(icd->dev.parent)->nr != icd->iface) {
dev_err(&client->dev, "Parent missing or invalid!\n");
ret = -ENODEV;
goto err;
}
/* /*
* check and show product ID and manufacturer ID * check and show product ID and manufacturer ID
......
...@@ -898,16 +898,9 @@ static int ov9740_video_probe(struct soc_camera_device *icd, ...@@ -898,16 +898,9 @@ static int ov9740_video_probe(struct soc_camera_device *icd,
u8 modelhi, modello; u8 modelhi, modello;
int ret; int ret;
/* /* We must have a parent by now. And it cannot be a wrong one. */
* We must have a parent by now. And it cannot be a wrong one. BUG_ON(!icd->parent ||
* So this entire test is completely redundant. to_soc_camera_host(icd->parent)->nr != icd->iface);
*/
if (!icd->dev.parent ||
to_soc_camera_host(icd->dev.parent)->nr != icd->iface) {
dev_err(&client->dev, "Parent missing or invalid!\n");
ret = -ENODEV;
goto err;
}
/* /*
* check and show product ID and manufacturer ID * check and show product ID and manufacturer ID
......
...@@ -246,7 +246,7 @@ static int pxa_videobuf_setup(struct videobuf_queue *vq, unsigned int *count, ...@@ -246,7 +246,7 @@ static int pxa_videobuf_setup(struct videobuf_queue *vq, unsigned int *count,
if (bytes_per_line < 0) if (bytes_per_line < 0)
return bytes_per_line; return bytes_per_line;
dev_dbg(icd->dev.parent, "count=%d, size=%d\n", *count, *size); dev_dbg(icd->parent, "count=%d, size=%d\n", *count, *size);
*size = bytes_per_line * icd->user_height; *size = bytes_per_line * icd->user_height;
...@@ -261,13 +261,13 @@ static int pxa_videobuf_setup(struct videobuf_queue *vq, unsigned int *count, ...@@ -261,13 +261,13 @@ static int pxa_videobuf_setup(struct videobuf_queue *vq, unsigned int *count,
static void free_buffer(struct videobuf_queue *vq, struct pxa_buffer *buf) static void free_buffer(struct videobuf_queue *vq, struct pxa_buffer *buf)
{ {
struct soc_camera_device *icd = vq->priv_data; struct soc_camera_device *icd = vq->priv_data;
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
struct videobuf_dmabuf *dma = videobuf_to_dma(&buf->vb); struct videobuf_dmabuf *dma = videobuf_to_dma(&buf->vb);
int i; int i;
BUG_ON(in_interrupt()); BUG_ON(in_interrupt());
dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
&buf->vb, buf->vb.baddr, buf->vb.bsize); &buf->vb, buf->vb.baddr, buf->vb.bsize);
/* /*
...@@ -428,7 +428,7 @@ static int pxa_videobuf_prepare(struct videobuf_queue *vq, ...@@ -428,7 +428,7 @@ static int pxa_videobuf_prepare(struct videobuf_queue *vq,
struct videobuf_buffer *vb, enum v4l2_field field) struct videobuf_buffer *vb, enum v4l2_field field)
{ {
struct soc_camera_device *icd = vq->priv_data; struct soc_camera_device *icd = vq->priv_data;
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
struct pxa_camera_dev *pcdev = ici->priv; struct pxa_camera_dev *pcdev = ici->priv;
struct device *dev = pcdev->soc_host.v4l2_dev.dev; struct device *dev = pcdev->soc_host.v4l2_dev.dev;
struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb); struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb);
...@@ -635,11 +635,11 @@ static void pxa_videobuf_queue(struct videobuf_queue *vq, ...@@ -635,11 +635,11 @@ static void pxa_videobuf_queue(struct videobuf_queue *vq,
struct videobuf_buffer *vb) struct videobuf_buffer *vb)
{ {
struct soc_camera_device *icd = vq->priv_data; struct soc_camera_device *icd = vq->priv_data;
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
struct pxa_camera_dev *pcdev = ici->priv; struct pxa_camera_dev *pcdev = ici->priv;
struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb); struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb);
dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d active=%p\n", dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d active=%p\n",
__func__, vb, vb->baddr, vb->bsize, pcdev->active); __func__, vb, vb->baddr, vb->bsize, pcdev->active);
list_add_tail(&vb->queue, &pcdev->capture); list_add_tail(&vb->queue, &pcdev->capture);
...@@ -657,7 +657,7 @@ static void pxa_videobuf_release(struct videobuf_queue *vq, ...@@ -657,7 +657,7 @@ static void pxa_videobuf_release(struct videobuf_queue *vq,
struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb); struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb);
#ifdef DEBUG #ifdef DEBUG
struct soc_camera_device *icd = vq->priv_data; struct soc_camera_device *icd = vq->priv_data;
struct device *dev = icd->dev.parent; struct device *dev = icd->parent;
dev_dbg(dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, dev_dbg(dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
vb, vb->baddr, vb->bsize); vb, vb->baddr, vb->bsize);
...@@ -842,7 +842,7 @@ static struct videobuf_queue_ops pxa_videobuf_ops = { ...@@ -842,7 +842,7 @@ static struct videobuf_queue_ops pxa_videobuf_ops = {
static void pxa_camera_init_videobuf(struct videobuf_queue *q, static void pxa_camera_init_videobuf(struct videobuf_queue *q,
struct soc_camera_device *icd) 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 pxa_camera_dev *pcdev = ici->priv; struct pxa_camera_dev *pcdev = ici->priv;
/* /*
...@@ -971,7 +971,7 @@ static irqreturn_t pxa_camera_irq(int irq, void *data) ...@@ -971,7 +971,7 @@ static irqreturn_t pxa_camera_irq(int irq, void *data)
*/ */
static int pxa_camera_add_device(struct soc_camera_device *icd) static int pxa_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 pxa_camera_dev *pcdev = ici->priv; struct pxa_camera_dev *pcdev = ici->priv;
if (pcdev->icd) if (pcdev->icd)
...@@ -981,7 +981,7 @@ static int pxa_camera_add_device(struct soc_camera_device *icd) ...@@ -981,7 +981,7 @@ static int pxa_camera_add_device(struct soc_camera_device *icd)
pcdev->icd = icd; pcdev->icd = icd;
dev_info(icd->dev.parent, "PXA Camera driver attached to camera %d\n", dev_info(icd->parent, "PXA Camera driver attached to camera %d\n",
icd->devnum); icd->devnum);
return 0; return 0;
...@@ -990,12 +990,12 @@ static int pxa_camera_add_device(struct soc_camera_device *icd) ...@@ -990,12 +990,12 @@ static int pxa_camera_add_device(struct soc_camera_device *icd)
/* Called with .video_lock held */ /* Called with .video_lock held */
static void pxa_camera_remove_device(struct soc_camera_device *icd) static void pxa_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 pxa_camera_dev *pcdev = ici->priv; struct pxa_camera_dev *pcdev = ici->priv;
BUG_ON(icd != pcdev->icd); BUG_ON(icd != pcdev->icd);
dev_info(icd->dev.parent, "PXA Camera driver detached from camera %d\n", dev_info(icd->parent, "PXA Camera driver detached from camera %d\n",
icd->devnum); icd->devnum);
/* disable capture, disable interrupts */ /* disable capture, disable interrupts */
...@@ -1056,7 +1056,7 @@ static int test_platform_param(struct pxa_camera_dev *pcdev, ...@@ -1056,7 +1056,7 @@ static int test_platform_param(struct pxa_camera_dev *pcdev,
static void pxa_camera_setup_cicr(struct soc_camera_device *icd, static void pxa_camera_setup_cicr(struct soc_camera_device *icd,
unsigned long flags, __u32 pixfmt) unsigned long flags, __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 pxa_camera_dev *pcdev = ici->priv; struct pxa_camera_dev *pcdev = ici->priv;
struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
unsigned long dw, bpp; unsigned long dw, bpp;
...@@ -1151,7 +1151,7 @@ static void pxa_camera_setup_cicr(struct soc_camera_device *icd, ...@@ -1151,7 +1151,7 @@ static void pxa_camera_setup_cicr(struct soc_camera_device *icd,
static int pxa_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) static int pxa_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 pxa_camera_dev *pcdev = ici->priv; struct pxa_camera_dev *pcdev = ici->priv;
unsigned long bus_flags, camera_flags, common_flags; unsigned long bus_flags, camera_flags, common_flags;
int ret; int ret;
...@@ -1209,7 +1209,7 @@ static int pxa_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) ...@@ -1209,7 +1209,7 @@ static int pxa_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt)
static int pxa_camera_try_bus_param(struct soc_camera_device *icd, static int pxa_camera_try_bus_param(struct soc_camera_device *icd,
unsigned char buswidth) 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 pxa_camera_dev *pcdev = ici->priv; struct pxa_camera_dev *pcdev = ici->priv;
unsigned long bus_flags, camera_flags; unsigned long bus_flags, camera_flags;
int ret = test_platform_param(pcdev, buswidth, &bus_flags); int ret = test_platform_param(pcdev, buswidth, &bus_flags);
...@@ -1246,7 +1246,7 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, unsigned int id ...@@ -1246,7 +1246,7 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, unsigned int id
struct soc_camera_format_xlate *xlate) struct soc_camera_format_xlate *xlate)
{ {
struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
struct device *dev = icd->dev.parent; struct device *dev = icd->parent;
int formats = 0, ret; int formats = 0, ret;
struct pxa_cam *cam; struct pxa_cam *cam;
enum v4l2_mbus_pixelcode code; enum v4l2_mbus_pixelcode code;
...@@ -1334,9 +1334,9 @@ static int pxa_camera_set_crop(struct soc_camera_device *icd, ...@@ -1334,9 +1334,9 @@ static int pxa_camera_set_crop(struct soc_camera_device *icd,
struct v4l2_crop *a) struct v4l2_crop *a)
{ {
struct v4l2_rect *rect = &a->c; struct v4l2_rect *rect = &a->c;
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct device *dev = icd->parent;
struct soc_camera_host *ici = to_soc_camera_host(dev);
struct pxa_camera_dev *pcdev = ici->priv; struct pxa_camera_dev *pcdev = ici->priv;
struct device *dev = icd->dev.parent;
struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
struct soc_camera_sense sense = { struct soc_camera_sense sense = {
.master_clock = pcdev->mclk, .master_clock = pcdev->mclk,
...@@ -1378,7 +1378,7 @@ static int pxa_camera_set_crop(struct soc_camera_device *icd, ...@@ -1378,7 +1378,7 @@ static int pxa_camera_set_crop(struct soc_camera_device *icd,
return ret; return ret;
if (pxa_camera_check_frame(mf.width, mf.height)) { if (pxa_camera_check_frame(mf.width, mf.height)) {
dev_warn(icd->dev.parent, dev_warn(icd->parent,
"Inconsistent state. Use S_FMT to repair\n"); "Inconsistent state. Use S_FMT to repair\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1405,9 +1405,9 @@ static int pxa_camera_set_crop(struct soc_camera_device *icd, ...@@ -1405,9 +1405,9 @@ static int pxa_camera_set_crop(struct soc_camera_device *icd,
static int pxa_camera_set_fmt(struct soc_camera_device *icd, static int pxa_camera_set_fmt(struct soc_camera_device *icd,
struct v4l2_format *f) struct v4l2_format *f)
{ {
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct device *dev = icd->parent;
struct soc_camera_host *ici = to_soc_camera_host(dev);
struct pxa_camera_dev *pcdev = ici->priv; struct pxa_camera_dev *pcdev = ici->priv;
struct device *dev = icd->dev.parent;
struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
const struct soc_camera_format_xlate *xlate = NULL; const struct soc_camera_format_xlate *xlate = NULL;
struct soc_camera_sense sense = { struct soc_camera_sense sense = {
...@@ -1484,7 +1484,7 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd, ...@@ -1484,7 +1484,7 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd,
xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
if (!xlate) { if (!xlate) {
dev_warn(icd->dev.parent, "Format %x not found\n", pixfmt); dev_warn(icd->parent, "Format %x not found\n", pixfmt);
return -EINVAL; return -EINVAL;
} }
...@@ -1521,7 +1521,7 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd, ...@@ -1521,7 +1521,7 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd,
break; break;
default: default:
/* TODO: support interlaced at least in pass-through mode */ /* TODO: support interlaced at least in pass-through mode */
dev_err(icd->dev.parent, "Field type %d unsupported.\n", dev_err(icd->parent, "Field type %d unsupported.\n",
mf.field); mf.field);
return -EINVAL; return -EINVAL;
} }
......
...@@ -1364,10 +1364,9 @@ static int rj54n1_video_probe(struct soc_camera_device *icd, ...@@ -1364,10 +1364,9 @@ static int rj54n1_video_probe(struct soc_camera_device *icd,
int data1, data2; int data1, data2;
int ret; int ret;
/* This could be a BUG_ON() or a WARN_ON(), or remove it completely */ /* We must have a parent by now. And it cannot be a wrong one. */
if (!icd->dev.parent || BUG_ON(!icd->parent ||
to_soc_camera_host(icd->dev.parent)->nr != icd->iface) to_soc_camera_host(icd->parent)->nr != icd->iface);
return -ENODEV;
/* Read out the chip version register */ /* Read out the chip version register */
data1 = reg_read(client, RJ54N1_DEV_CODE); data1 = reg_read(client, RJ54N1_DEV_CODE);
......
...@@ -206,7 +206,7 @@ static int sh_mobile_ceu_soft_reset(struct sh_mobile_ceu_dev *pcdev) ...@@ -206,7 +206,7 @@ static int sh_mobile_ceu_soft_reset(struct sh_mobile_ceu_dev *pcdev)
if (2 != success) { if (2 != success) {
dev_warn(&icd->dev, "soft reset time out\n"); dev_warn(icd->pdev, "soft reset time out\n");
return -EIO; return -EIO;
} }
...@@ -221,7 +221,7 @@ static int sh_mobile_ceu_videobuf_setup(struct vb2_queue *vq, ...@@ -221,7 +221,7 @@ static int sh_mobile_ceu_videobuf_setup(struct vb2_queue *vq,
unsigned long sizes[], void *alloc_ctxs[]) unsigned long sizes[], void *alloc_ctxs[])
{ {
struct soc_camera_device *icd = container_of(vq, struct soc_camera_device, vb2_vidq); struct soc_camera_device *icd = container_of(vq, struct soc_camera_device, vb2_vidq);
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
struct sh_mobile_ceu_dev *pcdev = ici->priv; struct sh_mobile_ceu_dev *pcdev = ici->priv;
int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width,
icd->current_fmt->host_fmt); icd->current_fmt->host_fmt);
...@@ -243,7 +243,7 @@ static int sh_mobile_ceu_videobuf_setup(struct vb2_queue *vq, ...@@ -243,7 +243,7 @@ static int sh_mobile_ceu_videobuf_setup(struct vb2_queue *vq,
*count = pcdev->video_limit / PAGE_ALIGN(sizes[0]); *count = pcdev->video_limit / PAGE_ALIGN(sizes[0]);
} }
dev_dbg(icd->dev.parent, "count=%d, size=%lu\n", *count, sizes[0]); dev_dbg(icd->parent, "count=%d, size=%lu\n", *count, sizes[0]);
return 0; return 0;
} }
...@@ -352,7 +352,7 @@ static int sh_mobile_ceu_videobuf_prepare(struct vb2_buffer *vb) ...@@ -352,7 +352,7 @@ static int sh_mobile_ceu_videobuf_prepare(struct vb2_buffer *vb)
buf = to_ceu_vb(vb); buf = to_ceu_vb(vb);
dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%p %lu\n", __func__, dev_dbg(icd->parent, "%s (vb=0x%p) 0x%p %lu\n", __func__,
vb, vb2_plane_vaddr(vb, 0), vb2_get_plane_payload(vb, 0)); vb, vb2_plane_vaddr(vb, 0), vb2_get_plane_payload(vb, 0));
/* Added list head initialization on alloc */ /* Added list head initialization on alloc */
...@@ -372,7 +372,7 @@ static int sh_mobile_ceu_videobuf_prepare(struct vb2_buffer *vb) ...@@ -372,7 +372,7 @@ static int sh_mobile_ceu_videobuf_prepare(struct vb2_buffer *vb)
size = icd->user_height * bytes_per_line; size = icd->user_height * bytes_per_line;
if (vb2_plane_size(vb, 0) < size) { if (vb2_plane_size(vb, 0) < size) {
dev_err(icd->dev.parent, "Buffer too small (%lu < %lu)\n", dev_err(icd->parent, "Buffer too small (%lu < %lu)\n",
vb2_plane_size(vb, 0), size); vb2_plane_size(vb, 0), size);
return -ENOBUFS; return -ENOBUFS;
} }
...@@ -385,11 +385,11 @@ static int sh_mobile_ceu_videobuf_prepare(struct vb2_buffer *vb) ...@@ -385,11 +385,11 @@ static int sh_mobile_ceu_videobuf_prepare(struct vb2_buffer *vb)
static void sh_mobile_ceu_videobuf_queue(struct vb2_buffer *vb) static void sh_mobile_ceu_videobuf_queue(struct vb2_buffer *vb)
{ {
struct soc_camera_device *icd = container_of(vb->vb2_queue, struct soc_camera_device, vb2_vidq); struct soc_camera_device *icd = container_of(vb->vb2_queue, struct soc_camera_device, vb2_vidq);
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
struct sh_mobile_ceu_dev *pcdev = ici->priv; struct sh_mobile_ceu_dev *pcdev = ici->priv;
struct sh_mobile_ceu_buffer *buf = to_ceu_vb(vb); struct sh_mobile_ceu_buffer *buf = to_ceu_vb(vb);
dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%p %lu\n", __func__, dev_dbg(icd->parent, "%s (vb=0x%p) 0x%p %lu\n", __func__,
vb, vb2_plane_vaddr(vb, 0), vb2_get_plane_payload(vb, 0)); vb, vb2_plane_vaddr(vb, 0), vb2_get_plane_payload(vb, 0));
spin_lock_irq(&pcdev->lock); spin_lock_irq(&pcdev->lock);
...@@ -410,7 +410,7 @@ static void sh_mobile_ceu_videobuf_queue(struct vb2_buffer *vb) ...@@ -410,7 +410,7 @@ static void sh_mobile_ceu_videobuf_queue(struct vb2_buffer *vb)
static void sh_mobile_ceu_videobuf_release(struct vb2_buffer *vb) static void sh_mobile_ceu_videobuf_release(struct vb2_buffer *vb)
{ {
struct soc_camera_device *icd = container_of(vb->vb2_queue, struct soc_camera_device, vb2_vidq); struct soc_camera_device *icd = container_of(vb->vb2_queue, struct soc_camera_device, vb2_vidq);
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
struct sh_mobile_ceu_buffer *buf = to_ceu_vb(vb); struct sh_mobile_ceu_buffer *buf = to_ceu_vb(vb);
struct sh_mobile_ceu_dev *pcdev = ici->priv; struct sh_mobile_ceu_dev *pcdev = ici->priv;
...@@ -438,7 +438,7 @@ static int sh_mobile_ceu_videobuf_init(struct vb2_buffer *vb) ...@@ -438,7 +438,7 @@ static int sh_mobile_ceu_videobuf_init(struct vb2_buffer *vb)
static int sh_mobile_ceu_stop_streaming(struct vb2_queue *q) static int sh_mobile_ceu_stop_streaming(struct vb2_queue *q)
{ {
struct soc_camera_device *icd = container_of(q, struct soc_camera_device, vb2_vidq); struct soc_camera_device *icd = container_of(q, struct soc_camera_device, vb2_vidq);
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
struct sh_mobile_ceu_dev *pcdev = ici->priv; struct sh_mobile_ceu_dev *pcdev = ici->priv;
struct list_head *buf_head, *tmp; struct list_head *buf_head, *tmp;
...@@ -517,7 +517,7 @@ static struct v4l2_subdev *find_csi2(struct sh_mobile_ceu_dev *pcdev) ...@@ -517,7 +517,7 @@ static struct v4l2_subdev *find_csi2(struct sh_mobile_ceu_dev *pcdev)
/* Called with .video_lock held */ /* Called with .video_lock held */
static int sh_mobile_ceu_add_device(struct soc_camera_device *icd) static int sh_mobile_ceu_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 sh_mobile_ceu_dev *pcdev = ici->priv; struct sh_mobile_ceu_dev *pcdev = ici->priv;
struct v4l2_subdev *csi2_sd; struct v4l2_subdev *csi2_sd;
int ret; int ret;
...@@ -525,7 +525,7 @@ static int sh_mobile_ceu_add_device(struct soc_camera_device *icd) ...@@ -525,7 +525,7 @@ static int sh_mobile_ceu_add_device(struct soc_camera_device *icd)
if (pcdev->icd) if (pcdev->icd)
return -EBUSY; return -EBUSY;
dev_info(icd->dev.parent, dev_info(icd->parent,
"SuperH Mobile CEU driver attached to camera %d\n", "SuperH Mobile CEU driver attached to camera %d\n",
icd->devnum); icd->devnum);
...@@ -549,7 +549,7 @@ static int sh_mobile_ceu_add_device(struct soc_camera_device *icd) ...@@ -549,7 +549,7 @@ static int sh_mobile_ceu_add_device(struct soc_camera_device *icd)
/* Called with .video_lock held */ /* Called with .video_lock held */
static void sh_mobile_ceu_remove_device(struct soc_camera_device *icd) static void sh_mobile_ceu_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 sh_mobile_ceu_dev *pcdev = ici->priv; struct sh_mobile_ceu_dev *pcdev = ici->priv;
struct v4l2_subdev *csi2_sd = find_csi2(pcdev); struct v4l2_subdev *csi2_sd = find_csi2(pcdev);
...@@ -571,7 +571,7 @@ static void sh_mobile_ceu_remove_device(struct soc_camera_device *icd) ...@@ -571,7 +571,7 @@ static void sh_mobile_ceu_remove_device(struct soc_camera_device *icd)
pm_runtime_put_sync(ici->v4l2_dev.dev); pm_runtime_put_sync(ici->v4l2_dev.dev);
dev_info(icd->dev.parent, dev_info(icd->parent,
"SuperH Mobile CEU driver detached from camera %d\n", "SuperH Mobile CEU driver detached from camera %d\n",
icd->devnum); icd->devnum);
...@@ -611,14 +611,14 @@ static u16 calc_scale(unsigned int src, unsigned int *dst) ...@@ -611,14 +611,14 @@ static u16 calc_scale(unsigned int src, unsigned int *dst)
/* rect is guaranteed to not exceed the scaled camera rectangle */ /* rect is guaranteed to not exceed the scaled camera rectangle */
static void sh_mobile_ceu_set_rect(struct soc_camera_device *icd) static void sh_mobile_ceu_set_rect(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 sh_mobile_ceu_cam *cam = icd->host_priv; struct sh_mobile_ceu_cam *cam = icd->host_priv;
struct sh_mobile_ceu_dev *pcdev = ici->priv; struct sh_mobile_ceu_dev *pcdev = ici->priv;
unsigned int height, width, cdwdr_width, in_width, in_height; unsigned int height, width, cdwdr_width, in_width, in_height;
unsigned int left_offset, top_offset; unsigned int left_offset, top_offset;
u32 camor; u32 camor;
dev_geo(icd->dev.parent, "Crop %ux%u@%u:%u\n", dev_geo(icd->parent, "Crop %ux%u@%u:%u\n",
icd->user_width, icd->user_height, cam->ceu_left, cam->ceu_top); icd->user_width, icd->user_height, cam->ceu_left, cam->ceu_top);
left_offset = cam->ceu_left; left_offset = cam->ceu_left;
...@@ -675,7 +675,7 @@ static void sh_mobile_ceu_set_rect(struct soc_camera_device *icd) ...@@ -675,7 +675,7 @@ static void sh_mobile_ceu_set_rect(struct soc_camera_device *icd)
/* Set CAMOR, CAPWR, CFSZR, take care of CDWDR */ /* Set CAMOR, CAPWR, CFSZR, take care of CDWDR */
camor = left_offset | (top_offset << 16); camor = left_offset | (top_offset << 16);
dev_geo(icd->dev.parent, dev_geo(icd->parent,
"CAMOR 0x%x, CAPWR 0x%x, CFSZR 0x%x, CDWDR 0x%x\n", camor, "CAMOR 0x%x, CAPWR 0x%x, CFSZR 0x%x, CDWDR 0x%x\n", camor,
(in_height << 16) | in_width, (height << 16) | width, (in_height << 16) | in_width, (height << 16) | width,
cdwdr_width); cdwdr_width);
...@@ -723,7 +723,7 @@ static void capture_restore(struct sh_mobile_ceu_dev *pcdev, u32 capsr) ...@@ -723,7 +723,7 @@ static void capture_restore(struct sh_mobile_ceu_dev *pcdev, u32 capsr)
static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd, static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd,
__u32 pixfmt) __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 sh_mobile_ceu_dev *pcdev = ici->priv; struct sh_mobile_ceu_dev *pcdev = ici->priv;
int ret; int ret;
unsigned long camera_flags, common_flags, value; unsigned long camera_flags, common_flags, value;
...@@ -832,7 +832,7 @@ static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd, ...@@ -832,7 +832,7 @@ static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd,
sh_mobile_ceu_set_rect(icd); sh_mobile_ceu_set_rect(icd);
mdelay(1); mdelay(1);
dev_geo(icd->dev.parent, "CFLCR 0x%x\n", pcdev->cflcr); dev_geo(icd->parent, "CFLCR 0x%x\n", pcdev->cflcr);
ceu_write(pcdev, CFLCR, pcdev->cflcr); ceu_write(pcdev, CFLCR, pcdev->cflcr);
/* /*
...@@ -855,7 +855,7 @@ static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd, ...@@ -855,7 +855,7 @@ static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd,
ceu_write(pcdev, CDOCR, value); ceu_write(pcdev, CDOCR, value);
ceu_write(pcdev, CFWCR, 0); /* keep "datafetch firewall" disabled */ ceu_write(pcdev, CFWCR, 0); /* keep "datafetch firewall" disabled */
dev_dbg(icd->dev.parent, "S_FMT successful for %c%c%c%c %ux%u\n", dev_dbg(icd->parent, "S_FMT successful for %c%c%c%c %ux%u\n",
pixfmt & 0xff, (pixfmt >> 8) & 0xff, pixfmt & 0xff, (pixfmt >> 8) & 0xff,
(pixfmt >> 16) & 0xff, (pixfmt >> 24) & 0xff, (pixfmt >> 16) & 0xff, (pixfmt >> 24) & 0xff,
icd->user_width, icd->user_height); icd->user_width, icd->user_height);
...@@ -869,7 +869,7 @@ static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd, ...@@ -869,7 +869,7 @@ static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd,
static int sh_mobile_ceu_try_bus_param(struct soc_camera_device *icd, static int sh_mobile_ceu_try_bus_param(struct soc_camera_device *icd,
unsigned char buswidth) 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 sh_mobile_ceu_dev *pcdev = ici->priv; struct sh_mobile_ceu_dev *pcdev = ici->priv;
unsigned long camera_flags, common_flags; unsigned long camera_flags, common_flags;
...@@ -927,7 +927,7 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, unsigned int ...@@ -927,7 +927,7 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, unsigned int
struct soc_camera_format_xlate *xlate) struct soc_camera_format_xlate *xlate)
{ {
struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
struct device *dev = icd->dev.parent; struct device *dev = icd->parent;
struct soc_camera_host *ici = to_soc_camera_host(dev); struct soc_camera_host *ici = to_soc_camera_host(dev);
struct sh_mobile_ceu_dev *pcdev = ici->priv; struct sh_mobile_ceu_dev *pcdev = ici->priv;
int ret, k, n; int ret, k, n;
...@@ -1270,7 +1270,7 @@ static int client_s_fmt(struct soc_camera_device *icd, ...@@ -1270,7 +1270,7 @@ static int client_s_fmt(struct soc_camera_device *icd,
{ {
struct sh_mobile_ceu_cam *cam = icd->host_priv; struct sh_mobile_ceu_cam *cam = icd->host_priv;
struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
struct device *dev = icd->dev.parent; struct device *dev = icd->parent;
unsigned int width = mf->width, height = mf->height, tmp_w, tmp_h; unsigned int width = mf->width, height = mf->height, tmp_w, tmp_h;
unsigned int max_width, max_height; unsigned int max_width, max_height;
struct v4l2_cropcap cap; struct v4l2_cropcap cap;
...@@ -1339,7 +1339,7 @@ static int client_scale(struct soc_camera_device *icd, ...@@ -1339,7 +1339,7 @@ static int client_scale(struct soc_camera_device *icd,
bool ceu_can_scale) bool ceu_can_scale)
{ {
struct sh_mobile_ceu_cam *cam = icd->host_priv; struct sh_mobile_ceu_cam *cam = icd->host_priv;
struct device *dev = icd->dev.parent; struct device *dev = icd->parent;
struct v4l2_mbus_framefmt mf_tmp = *mf; struct v4l2_mbus_framefmt mf_tmp = *mf;
unsigned int scale_h, scale_v; unsigned int scale_h, scale_v;
int ret; int ret;
...@@ -1389,13 +1389,13 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd, ...@@ -1389,13 +1389,13 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
struct v4l2_crop *a) struct v4l2_crop *a)
{ {
struct v4l2_rect *rect = &a->c; struct v4l2_rect *rect = &a->c;
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct device *dev = icd->parent;
struct soc_camera_host *ici = to_soc_camera_host(dev);
struct sh_mobile_ceu_dev *pcdev = ici->priv; struct sh_mobile_ceu_dev *pcdev = ici->priv;
struct v4l2_crop cam_crop; struct v4l2_crop cam_crop;
struct sh_mobile_ceu_cam *cam = icd->host_priv; struct sh_mobile_ceu_cam *cam = icd->host_priv;
struct v4l2_rect *cam_rect = &cam_crop.c; struct v4l2_rect *cam_rect = &cam_crop.c;
struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
struct device *dev = icd->dev.parent;
struct v4l2_mbus_framefmt mf; struct v4l2_mbus_framefmt mf;
unsigned int scale_cam_h, scale_cam_v, scale_ceu_h, scale_ceu_v, unsigned int scale_cam_h, scale_cam_v, scale_ceu_h, scale_ceu_v,
out_width, out_height; out_width, out_height;
...@@ -1537,7 +1537,7 @@ static void calculate_client_output(struct soc_camera_device *icd, ...@@ -1537,7 +1537,7 @@ static void calculate_client_output(struct soc_camera_device *icd,
struct v4l2_pix_format *pix, struct v4l2_mbus_framefmt *mf) struct v4l2_pix_format *pix, struct v4l2_mbus_framefmt *mf)
{ {
struct sh_mobile_ceu_cam *cam = icd->host_priv; struct sh_mobile_ceu_cam *cam = icd->host_priv;
struct device *dev = icd->dev.parent; struct device *dev = icd->parent;
struct v4l2_rect *cam_subrect = &cam->subrect; struct v4l2_rect *cam_subrect = &cam->subrect;
unsigned int scale_v, scale_h; unsigned int scale_v, scale_h;
...@@ -1581,12 +1581,12 @@ static void calculate_client_output(struct soc_camera_device *icd, ...@@ -1581,12 +1581,12 @@ static void calculate_client_output(struct soc_camera_device *icd,
static int sh_mobile_ceu_set_fmt(struct soc_camera_device *icd, static int sh_mobile_ceu_set_fmt(struct soc_camera_device *icd,
struct v4l2_format *f) struct v4l2_format *f)
{ {
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct device *dev = icd->parent;
struct soc_camera_host *ici = to_soc_camera_host(dev);
struct sh_mobile_ceu_dev *pcdev = ici->priv; struct sh_mobile_ceu_dev *pcdev = ici->priv;
struct sh_mobile_ceu_cam *cam = icd->host_priv; struct sh_mobile_ceu_cam *cam = icd->host_priv;
struct v4l2_pix_format *pix = &f->fmt.pix; struct v4l2_pix_format *pix = &f->fmt.pix;
struct v4l2_mbus_framefmt mf; struct v4l2_mbus_framefmt mf;
struct device *dev = icd->dev.parent;
__u32 pixfmt = pix->pixelformat; __u32 pixfmt = pix->pixelformat;
const struct soc_camera_format_xlate *xlate; const struct soc_camera_format_xlate *xlate;
/* Keep Compiler Happy */ /* Keep Compiler Happy */
...@@ -1710,12 +1710,12 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, ...@@ -1710,12 +1710,12 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
int width, height; int width, height;
int ret; int ret;
dev_geo(icd->dev.parent, "TRY_FMT(pix=0x%x, %ux%u)\n", dev_geo(icd->parent, "TRY_FMT(pix=0x%x, %ux%u)\n",
pixfmt, pix->width, pix->height); pixfmt, pix->width, pix->height);
xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
if (!xlate) { if (!xlate) {
dev_warn(icd->dev.parent, "Format %x not found\n", pixfmt); dev_warn(icd->parent, "Format %x not found\n", pixfmt);
return -EINVAL; return -EINVAL;
} }
...@@ -1762,7 +1762,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, ...@@ -1762,7 +1762,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
try_mbus_fmt, &mf); try_mbus_fmt, &mf);
if (ret < 0) { if (ret < 0) {
/* Shouldn't actually happen... */ /* Shouldn't actually happen... */
dev_err(icd->dev.parent, dev_err(icd->parent,
"FIXME: client try_fmt() = %d\n", ret); "FIXME: client try_fmt() = %d\n", ret);
return ret; return ret;
} }
...@@ -1774,7 +1774,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, ...@@ -1774,7 +1774,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
pix->height = height; pix->height = height;
} }
dev_geo(icd->dev.parent, "%s(): return %d, fmt 0x%x, %ux%u\n", dev_geo(icd->parent, "%s(): return %d, fmt 0x%x, %ux%u\n",
__func__, ret, pix->pixelformat, pix->width, pix->height); __func__, ret, pix->pixelformat, pix->width, pix->height);
return ret; return ret;
...@@ -1784,7 +1784,7 @@ static int sh_mobile_ceu_set_livecrop(struct soc_camera_device *icd, ...@@ -1784,7 +1784,7 @@ static int sh_mobile_ceu_set_livecrop(struct soc_camera_device *icd,
struct v4l2_crop *a) struct v4l2_crop *a)
{ {
struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct v4l2_subdev *sd = soc_camera_to_subdev(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 sh_mobile_ceu_dev *pcdev = ici->priv; struct sh_mobile_ceu_dev *pcdev = ici->priv;
u32 out_width = icd->user_width, out_height = icd->user_height; u32 out_width = icd->user_width, out_height = icd->user_height;
int ret; int ret;
...@@ -1796,13 +1796,13 @@ static int sh_mobile_ceu_set_livecrop(struct soc_camera_device *icd, ...@@ -1796,13 +1796,13 @@ static int sh_mobile_ceu_set_livecrop(struct soc_camera_device *icd,
/* Stop the client */ /* Stop the client */
ret = v4l2_subdev_call(sd, video, s_stream, 0); ret = v4l2_subdev_call(sd, video, s_stream, 0);
if (ret < 0) if (ret < 0)
dev_warn(icd->dev.parent, dev_warn(icd->parent,
"Client failed to stop the stream: %d\n", ret); "Client failed to stop the stream: %d\n", ret);
else else
/* Do the crop, if it fails, there's nothing more we can do */ /* Do the crop, if it fails, there's nothing more we can do */
sh_mobile_ceu_set_crop(icd, a); sh_mobile_ceu_set_crop(icd, a);
dev_geo(icd->dev.parent, "Output after crop: %ux%u\n", icd->user_width, icd->user_height); dev_geo(icd->parent, "Output after crop: %ux%u\n", icd->user_width, icd->user_height);
if (icd->user_width != out_width || icd->user_height != out_height) { if (icd->user_width != out_width || icd->user_height != out_height) {
struct v4l2_format f = { struct v4l2_format f = {
...@@ -1868,7 +1868,7 @@ static int sh_mobile_ceu_init_videobuf(struct vb2_queue *q, ...@@ -1868,7 +1868,7 @@ static int sh_mobile_ceu_init_videobuf(struct vb2_queue *q,
static int sh_mobile_ceu_get_ctrl(struct soc_camera_device *icd, static int sh_mobile_ceu_get_ctrl(struct soc_camera_device *icd,
struct v4l2_control *ctrl) struct v4l2_control *ctrl)
{ {
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
struct sh_mobile_ceu_dev *pcdev = ici->priv; struct sh_mobile_ceu_dev *pcdev = ici->priv;
u32 val; u32 val;
...@@ -1884,7 +1884,7 @@ static int sh_mobile_ceu_get_ctrl(struct soc_camera_device *icd, ...@@ -1884,7 +1884,7 @@ static int sh_mobile_ceu_get_ctrl(struct soc_camera_device *icd,
static int sh_mobile_ceu_set_ctrl(struct soc_camera_device *icd, static int sh_mobile_ceu_set_ctrl(struct soc_camera_device *icd,
struct v4l2_control *ctrl) struct v4l2_control *ctrl)
{ {
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
struct sh_mobile_ceu_dev *pcdev = ici->priv; struct sh_mobile_ceu_dev *pcdev = ici->priv;
switch (ctrl->id) { switch (ctrl->id) {
......
此差异已折叠。
...@@ -146,7 +146,7 @@ static int soc_camera_platform_probe(struct platform_device *pdev) ...@@ -146,7 +146,7 @@ static int soc_camera_platform_probe(struct platform_device *pdev)
if (!p) if (!p)
return -EINVAL; return -EINVAL;
if (!p->dev) { if (!p->icd) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Platform has not set soc_camera_device pointer!\n"); "Platform has not set soc_camera_device pointer!\n");
return -EINVAL; return -EINVAL;
...@@ -156,16 +156,16 @@ static int soc_camera_platform_probe(struct platform_device *pdev) ...@@ -156,16 +156,16 @@ static int soc_camera_platform_probe(struct platform_device *pdev)
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
icd = to_soc_camera_dev(p->dev); icd = p->icd;
/* soc-camera convention: control's drvdata points to the subdev */ /* soc-camera convention: control's drvdata points to the subdev */
platform_set_drvdata(pdev, &priv->subdev); platform_set_drvdata(pdev, &priv->subdev);
/* Set the control device reference */ /* Set the control device reference */
dev_set_drvdata(&icd->dev, &pdev->dev); icd->control = &pdev->dev;
icd->ops = &soc_camera_platform_ops; icd->ops = &soc_camera_platform_ops;
ici = to_soc_camera_host(icd->dev.parent); ici = to_soc_camera_host(icd->parent);
v4l2_subdev_init(&priv->subdev, &platform_subdev_ops); v4l2_subdev_init(&priv->subdev, &platform_subdev_ops);
v4l2_set_subdevdata(&priv->subdev, p); v4l2_set_subdevdata(&priv->subdev, p);
...@@ -188,7 +188,7 @@ static int soc_camera_platform_remove(struct platform_device *pdev) ...@@ -188,7 +188,7 @@ static int soc_camera_platform_remove(struct platform_device *pdev)
{ {
struct soc_camera_platform_priv *priv = get_priv(pdev); struct soc_camera_platform_priv *priv = get_priv(pdev);
struct soc_camera_platform_info *p = pdev->dev.platform_data; struct soc_camera_platform_info *p = pdev->dev.platform_data;
struct soc_camera_device *icd = to_soc_camera_dev(p->dev); struct soc_camera_device *icd = p->icd;
v4l2_device_unregister_subdev(&priv->subdev); v4l2_device_unregister_subdev(&priv->subdev);
icd->ops = NULL; icd->ops = NULL;
......
...@@ -836,13 +836,9 @@ static int tw9910_video_probe(struct soc_camera_device *icd, ...@@ -836,13 +836,9 @@ static int tw9910_video_probe(struct soc_camera_device *icd,
struct tw9910_priv *priv = to_tw9910(client); struct tw9910_priv *priv = to_tw9910(client);
s32 id; s32 id;
/* /* We must have a parent by now. And it cannot be a wrong one. */
* We must have a parent by now. And it cannot be a wrong one. BUG_ON(!icd->parent ||
* So this entire test is completely redundant. to_soc_camera_host(icd->parent)->nr != icd->iface);
*/
if (!icd->dev.parent ||
to_soc_camera_host(icd->dev.parent)->nr != icd->iface)
return -ENODEV;
/* /*
* tw9910 only use 8 or 16 bit bus width * tw9910 only use 8 or 16 bit bus width
......
...@@ -21,11 +21,14 @@ ...@@ -21,11 +21,14 @@
#include <media/v4l2-device.h> #include <media/v4l2-device.h>
struct file; struct file;
struct soc_camera_link;
struct soc_camera_device { struct soc_camera_device {
struct list_head list; /* list of all registered devices */ struct list_head list; /* list of all registered devices */
struct device dev; struct soc_camera_link *link;
struct device *pdev; /* Platform device */ struct device *pdev; /* Platform device */
struct device *parent; /* Camera host device */
struct device *control; /* E.g., the i2c client */
s32 user_width; s32 user_width;
s32 user_height; s32 user_height;
u32 bytesperline; /* for padding, zero if unused */ u32 bytesperline; /* for padding, zero if unused */
...@@ -127,8 +130,8 @@ struct soc_camera_link { ...@@ -127,8 +130,8 @@ struct soc_camera_link {
* For non-I2C devices platform has to provide methods to add a device * For non-I2C devices platform has to provide methods to add a device
* to the system and to remove it * to the system and to remove it
*/ */
int (*add_device)(struct soc_camera_link *, struct device *); int (*add_device)(struct soc_camera_device *);
void (*del_device)(struct soc_camera_link *); void (*del_device)(struct soc_camera_device *);
/* Optional callbacks to power on or off and reset the sensor */ /* Optional callbacks to power on or off and reset the sensor */
int (*power)(struct device *, int); int (*power)(struct device *, int);
int (*reset)(struct device *); int (*reset)(struct device *);
...@@ -142,12 +145,6 @@ struct soc_camera_link { ...@@ -142,12 +145,6 @@ struct soc_camera_link {
void (*free_bus)(struct soc_camera_link *); void (*free_bus)(struct soc_camera_link *);
}; };
static inline struct soc_camera_device *to_soc_camera_dev(
const struct device *dev)
{
return container_of(dev, struct soc_camera_device, dev);
}
static inline struct soc_camera_host *to_soc_camera_host( static inline struct soc_camera_host *to_soc_camera_host(
const struct device *dev) const struct device *dev)
{ {
...@@ -159,13 +156,13 @@ static inline struct soc_camera_host *to_soc_camera_host( ...@@ -159,13 +156,13 @@ static inline struct soc_camera_host *to_soc_camera_host(
static inline struct soc_camera_link *to_soc_camera_link( static inline struct soc_camera_link *to_soc_camera_link(
const struct soc_camera_device *icd) const struct soc_camera_device *icd)
{ {
return icd->dev.platform_data; return icd->link;
} }
static inline struct device *to_soc_camera_control( static inline struct device *to_soc_camera_control(
const struct soc_camera_device *icd) const struct soc_camera_device *icd)
{ {
return dev_get_drvdata(&icd->dev); return icd->control;
} }
static inline struct v4l2_subdev *soc_camera_to_subdev( static inline struct v4l2_subdev *soc_camera_to_subdev(
......
...@@ -21,7 +21,7 @@ struct soc_camera_platform_info { ...@@ -21,7 +21,7 @@ struct soc_camera_platform_info {
unsigned long format_depth; unsigned long format_depth;
struct v4l2_mbus_framefmt format; struct v4l2_mbus_framefmt format;
unsigned long bus_param; unsigned long bus_param;
struct device *dev; struct soc_camera_device *icd;
int (*set_capture)(struct soc_camera_platform_info *info, int enable); int (*set_capture)(struct soc_camera_platform_info *info, int enable);
}; };
...@@ -30,8 +30,7 @@ static inline void soc_camera_platform_release(struct platform_device **pdev) ...@@ -30,8 +30,7 @@ static inline void soc_camera_platform_release(struct platform_device **pdev)
*pdev = NULL; *pdev = NULL;
} }
static inline int soc_camera_platform_add(const struct soc_camera_link *icl, static inline int soc_camera_platform_add(struct soc_camera_device *icd,
struct device *dev,
struct platform_device **pdev, struct platform_device **pdev,
struct soc_camera_link *plink, struct soc_camera_link *plink,
void (*release)(struct device *dev), void (*release)(struct device *dev),
...@@ -40,7 +39,7 @@ static inline int soc_camera_platform_add(const struct soc_camera_link *icl, ...@@ -40,7 +39,7 @@ static inline int soc_camera_platform_add(const struct soc_camera_link *icl,
struct soc_camera_platform_info *info = plink->priv; struct soc_camera_platform_info *info = plink->priv;
int ret; int ret;
if (icl != plink) if (icd->link != plink)
return -ENODEV; return -ENODEV;
if (*pdev) if (*pdev)
...@@ -50,7 +49,7 @@ static inline int soc_camera_platform_add(const struct soc_camera_link *icl, ...@@ -50,7 +49,7 @@ static inline int soc_camera_platform_add(const struct soc_camera_link *icl,
if (!*pdev) if (!*pdev)
return -ENOMEM; return -ENOMEM;
info->dev = dev; info->icd = icd;
(*pdev)->dev.platform_data = info; (*pdev)->dev.platform_data = info;
(*pdev)->dev.release = release; (*pdev)->dev.release = release;
...@@ -59,17 +58,17 @@ static inline int soc_camera_platform_add(const struct soc_camera_link *icl, ...@@ -59,17 +58,17 @@ static inline int soc_camera_platform_add(const struct soc_camera_link *icl,
if (ret < 0) { if (ret < 0) {
platform_device_put(*pdev); platform_device_put(*pdev);
*pdev = NULL; *pdev = NULL;
info->dev = NULL; info->icd = NULL;
} }
return ret; return ret;
} }
static inline void soc_camera_platform_del(const struct soc_camera_link *icl, static inline void soc_camera_platform_del(const struct soc_camera_device *icd,
struct platform_device *pdev, struct platform_device *pdev,
const struct soc_camera_link *plink) const struct soc_camera_link *plink)
{ {
if (icl != plink || !pdev) if (icd->link != plink || !pdev)
return; return;
platform_device_unregister(pdev); platform_device_unregister(pdev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册