Commit 460b71cb authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Mauro Carvalho Chehab

V4L/DVB (12533): soc-camera: Use video device object for output in host drivers

Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 80d19766
...@@ -135,7 +135,7 @@ static int mx1_videobuf_setup(struct videobuf_queue *vq, unsigned int *count, ...@@ -135,7 +135,7 @@ static int mx1_videobuf_setup(struct videobuf_queue *vq, unsigned int *count,
while (*size * *count > MAX_VIDEO_MEM * 1024 * 1024) while (*size * *count > MAX_VIDEO_MEM * 1024 * 1024)
(*count)--; (*count)--;
dev_dbg(&icd->dev, "count=%d, size=%d\n", *count, *size); dev_dbg(icd->dev.parent, "count=%d, size=%d\n", *count, *size);
return 0; return 0;
} }
...@@ -147,7 +147,7 @@ static void free_buffer(struct videobuf_queue *vq, struct mx1_buffer *buf) ...@@ -147,7 +147,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, "%s (vb=0x%p) 0x%08lx %d\n", __func__, dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
vb, vb->baddr, vb->bsize); vb, vb->baddr, vb->bsize);
/* This waits until this buffer is out of danger, i.e., until it is no /* This waits until this buffer is out of danger, i.e., until it is no
...@@ -165,7 +165,7 @@ static int mx1_videobuf_prepare(struct videobuf_queue *vq, ...@@ -165,7 +165,7 @@ static int mx1_videobuf_prepare(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);
int ret; int ret;
dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, dev_dbg(icd->dev.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 */
...@@ -216,10 +216,11 @@ out: ...@@ -216,10 +216,11 @@ out:
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;
int ret; int ret;
if (unlikely(!pcdev->active)) { if (unlikely(!pcdev->active)) {
dev_err(pcdev->icd->dev.parent, "DMA End IRQ with no active buffer\n"); dev_err(dev, "DMA End IRQ with no active buffer\n");
return -EFAULT; return -EFAULT;
} }
...@@ -229,7 +230,7 @@ static int mx1_camera_setup_dma(struct mx1_camera_dev *pcdev) ...@@ -229,7 +230,7 @@ static int mx1_camera_setup_dma(struct mx1_camera_dev *pcdev)
vbuf->size, pcdev->res->start + vbuf->size, pcdev->res->start +
CSIRXR, DMA_MODE_READ); CSIRXR, DMA_MODE_READ);
if (unlikely(ret)) if (unlikely(ret))
dev_err(pcdev->icd->dev.parent, "Failed to setup DMA sg list\n"); dev_err(dev, "Failed to setup DMA sg list\n");
return ret; return ret;
} }
...@@ -243,7 +244,7 @@ static void mx1_videobuf_queue(struct videobuf_queue *vq, ...@@ -243,7 +244,7 @@ static void mx1_videobuf_queue(struct videobuf_queue *vq,
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, "%s (vb=0x%p) 0x%08lx %d\n", __func__, dev_dbg(icd->dev.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);
...@@ -270,22 +271,23 @@ static void mx1_videobuf_release(struct videobuf_queue *vq, ...@@ -270,22 +271,23 @@ 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;
dev_dbg(&icd->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);
switch (vb->state) { switch (vb->state) {
case VIDEOBUF_ACTIVE: case VIDEOBUF_ACTIVE:
dev_dbg(&icd->dev, "%s (active)\n", __func__); dev_dbg(dev, "%s (active)\n", __func__);
break; break;
case VIDEOBUF_QUEUED: case VIDEOBUF_QUEUED:
dev_dbg(&icd->dev, "%s (queued)\n", __func__); dev_dbg(dev, "%s (queued)\n", __func__);
break; break;
case VIDEOBUF_PREPARED: case VIDEOBUF_PREPARED:
dev_dbg(&icd->dev, "%s (prepared)\n", __func__); dev_dbg(dev, "%s (prepared)\n", __func__);
break; break;
default: default:
dev_dbg(&icd->dev, "%s (unknown)\n", __func__); dev_dbg(dev, "%s (unknown)\n", __func__);
break; break;
} }
#endif #endif
...@@ -325,6 +327,7 @@ static void mx1_camera_wakeup(struct mx1_camera_dev *pcdev, ...@@ -325,6 +327,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 mx1_buffer *buf; struct mx1_buffer *buf;
struct videobuf_buffer *vb; struct videobuf_buffer *vb;
unsigned long flags; unsigned long flags;
...@@ -334,14 +337,14 @@ static void mx1_camera_dma_irq(int channel, void *data) ...@@ -334,14 +337,14 @@ static void mx1_camera_dma_irq(int channel, void *data)
imx_dma_disable(channel); imx_dma_disable(channel);
if (unlikely(!pcdev->active)) { if (unlikely(!pcdev->active)) {
dev_err(pcdev->icd->dev.parent, "DMA End IRQ with no active buffer\n"); dev_err(dev, "DMA End IRQ with no active buffer\n");
goto out; goto out;
} }
vb = &pcdev->active->vb; vb = &pcdev->active->vb;
buf = container_of(vb, struct mx1_buffer, vb); buf = container_of(vb, struct mx1_buffer, vb);
WARN_ON(buf->inwork || list_empty(&vb->queue)); WARN_ON(buf->inwork || list_empty(&vb->queue));
dev_dbg(pcdev->icd->dev.parent, "%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);
mx1_camera_wakeup(pcdev, vb, buf); mx1_camera_wakeup(pcdev, vb, buf);
...@@ -381,8 +384,9 @@ static int mclk_get_divisor(struct mx1_camera_dev *pcdev) ...@@ -381,8 +384,9 @@ static int mclk_get_divisor(struct mx1_camera_dev *pcdev)
* they get a nice Oops */ * they get a nice Oops */
div = (lcdclk + 2 * mclk - 1) / (2 * mclk) - 1; div = (lcdclk + 2 * mclk - 1) / (2 * mclk) - 1;
dev_dbg(pcdev->icd->dev.parent, "System clock %lukHz, target freq %dkHz, " dev_dbg(pcdev->icd->dev.parent,
"divisor %lu\n", lcdclk / 1000, mclk / 1000, div); "System clock %lukHz, target freq %dkHz, divisor %lu\n",
lcdclk / 1000, mclk / 1000, div);
return div; return div;
} }
...@@ -428,7 +432,7 @@ static int mx1_camera_add_device(struct soc_camera_device *icd) ...@@ -428,7 +432,7 @@ static int mx1_camera_add_device(struct soc_camera_device *icd)
goto ebusy; goto ebusy;
} }
dev_info(&icd->dev, "MX1 Camera driver attached to camera %d\n", dev_info(icd->dev.parent, "MX1 Camera driver attached to camera %d\n",
icd->devnum); icd->devnum);
mx1_camera_activate(pcdev); mx1_camera_activate(pcdev);
...@@ -454,7 +458,7 @@ static void mx1_camera_remove_device(struct soc_camera_device *icd) ...@@ -454,7 +458,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, "MX1 Camera driver detached from camera %d\n", dev_info(icd->dev.parent, "MX1 Camera driver detached from camera %d\n",
icd->devnum); icd->devnum);
mx1_camera_deactivate(pcdev); mx1_camera_deactivate(pcdev);
......
...@@ -178,7 +178,7 @@ static void free_buffer(struct videobuf_queue *vq, struct mx3_camera_buffer *buf ...@@ -178,7 +178,7 @@ static void free_buffer(struct videobuf_queue *vq, struct mx3_camera_buffer *buf
BUG_ON(in_interrupt()); BUG_ON(in_interrupt());
dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
vb, vb->baddr, vb->bsize); vb, vb->baddr, vb->bsize);
/* /*
...@@ -375,7 +375,8 @@ static void mx3_videobuf_queue(struct videobuf_queue *vq, ...@@ -375,7 +375,8 @@ static void mx3_videobuf_queue(struct videobuf_queue *vq,
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, "Submitted cookie %d DMA 0x%08x\n", cookie, sg_dma_address(&buf->sg)); dev_dbg(icd->dev.parent, "Submitted cookie %d DMA 0x%08x\n",
cookie, sg_dma_address(&buf->sg));
spin_lock_irq(&mx3_cam->lock); spin_lock_irq(&mx3_cam->lock);
...@@ -402,7 +403,8 @@ static void mx3_videobuf_release(struct videobuf_queue *vq, ...@@ -402,7 +403,8 @@ static void mx3_videobuf_release(struct videobuf_queue *vq,
container_of(vb, struct mx3_camera_buffer, vb); container_of(vb, struct mx3_camera_buffer, vb);
unsigned long flags; unsigned long flags;
dev_dbg(&icd->dev, "Release%s DMA 0x%08x (state %d), queue %sempty\n", dev_dbg(icd->dev.parent,
"Release%s DMA 0x%08x (state %d), queue %sempty\n",
mx3_cam->active == buf ? " active" : "", sg_dma_address(&buf->sg), mx3_cam->active == buf ? " active" : "", sg_dma_address(&buf->sg),
vb->state, list_empty(&vb->queue) ? "" : "not "); vb->state, list_empty(&vb->queue) ? "" : "not ");
spin_lock_irqsave(&mx3_cam->lock, flags); spin_lock_irqsave(&mx3_cam->lock, flags);
...@@ -484,7 +486,7 @@ static void mx3_camera_activate(struct mx3_camera_dev *mx3_cam, ...@@ -484,7 +486,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, "Set SENS_CONF to %x, rate %ld\n", conf, rate); dev_dbg(icd->dev.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);
} }
...@@ -502,7 +504,7 @@ static int mx3_camera_add_device(struct soc_camera_device *icd) ...@@ -502,7 +504,7 @@ static int mx3_camera_add_device(struct soc_camera_device *icd)
mx3_cam->icd = icd; mx3_cam->icd = icd;
dev_info(&icd->dev, "MX3 Camera driver attached to camera %d\n", dev_info(icd->dev.parent, "MX3 Camera driver attached to camera %d\n",
icd->devnum); icd->devnum);
return 0; return 0;
...@@ -526,7 +528,7 @@ static void mx3_camera_remove_device(struct soc_camera_device *icd) ...@@ -526,7 +528,7 @@ static void mx3_camera_remove_device(struct soc_camera_device *icd)
mx3_cam->icd = NULL; mx3_cam->icd = NULL;
dev_info(&icd->dev, "MX3 Camera driver detached from camera %d\n", dev_info(icd->dev.parent, "MX3 Camera driver detached from camera %d\n",
icd->devnum); icd->devnum);
} }
...@@ -603,7 +605,8 @@ static int mx3_camera_try_bus_param(struct soc_camera_device *icd, ...@@ -603,7 +605,8 @@ static int mx3_camera_try_bus_param(struct soc_camera_device *icd,
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, "requested bus width %d bit: %d\n", depth, ret); dev_dbg(icd->dev.parent, "requested bus width %d bit: %d\n",
depth, ret);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -612,7 +615,8 @@ static int mx3_camera_try_bus_param(struct soc_camera_device *icd, ...@@ -612,7 +615,8 @@ 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, "Flags incompatible: camera %lx, host %lx\n", dev_warn(icd->dev.parent,
"Flags incompatible: camera %lx, host %lx\n",
camera_flags, bus_flags); camera_flags, bus_flags);
return ret; return ret;
...@@ -686,7 +690,8 @@ static int mx3_camera_get_formats(struct soc_camera_device *icd, int idx, ...@@ -686,7 +690,8 @@ static int mx3_camera_get_formats(struct soc_camera_device *icd, int idx,
xlate->cam_fmt = icd->formats + idx; xlate->cam_fmt = icd->formats + idx;
xlate->buswidth = buswidth; xlate->buswidth = buswidth;
xlate++; xlate++;
dev_dbg(icd->dev.parent, "Providing format %s using %s\n", dev_dbg(icd->dev.parent,
"Providing format %s using %s\n",
mx3_camera_formats[0].name, mx3_camera_formats[0].name,
icd->formats[idx].name); icd->formats[idx].name);
} }
...@@ -698,7 +703,8 @@ static int mx3_camera_get_formats(struct soc_camera_device *icd, int idx, ...@@ -698,7 +703,8 @@ static int mx3_camera_get_formats(struct soc_camera_device *icd, int idx,
xlate->cam_fmt = icd->formats + idx; xlate->cam_fmt = icd->formats + idx;
xlate->buswidth = buswidth; xlate->buswidth = buswidth;
xlate++; xlate++;
dev_dbg(icd->dev.parent, "Providing format %s using %s\n", dev_dbg(icd->dev.parent,
"Providing format %s using %s\n",
mx3_camera_formats[0].name, mx3_camera_formats[0].name,
icd->formats[idx].name); icd->formats[idx].name);
} }
...@@ -821,7 +827,8 @@ static int mx3_camera_set_fmt(struct soc_camera_device *icd, ...@@ -821,7 +827,8 @@ 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", pix->pixelformat); dev_warn(icd->dev.parent, "Format %x not found\n",
pix->pixelformat);
return -EINVAL; return -EINVAL;
} }
...@@ -883,7 +890,7 @@ static int mx3_camera_try_fmt(struct soc_camera_device *icd, ...@@ -883,7 +890,7 @@ static int mx3_camera_try_fmt(struct soc_camera_device *icd,
if (field == V4L2_FIELD_ANY) { if (field == V4L2_FIELD_ANY) {
pix->field = V4L2_FIELD_NONE; pix->field = V4L2_FIELD_NONE;
} else if (field != V4L2_FIELD_NONE) { } else if (field != V4L2_FIELD_NONE) {
dev_err(&icd->dev, "Field type %d unsupported.\n", field); dev_err(icd->dev.parent, "Field type %d unsupported.\n", field);
return -EINVAL; return -EINVAL;
} }
...@@ -922,14 +929,15 @@ static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) ...@@ -922,14 +929,15 @@ static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt)
u32 dw, sens_conf; u32 dw, sens_conf;
int ret = test_platform_param(mx3_cam, icd->buswidth, &bus_flags); int ret = test_platform_param(mx3_cam, icd->buswidth, &bus_flags);
const struct soc_camera_format_xlate *xlate; const struct soc_camera_format_xlate *xlate;
struct device *dev = icd->dev.parent;
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(dev, "Format %x not found\n", pixfmt);
return -EINVAL; return -EINVAL;
} }
dev_dbg(icd->dev.parent, "requested bus width %d bit: %d\n", dev_dbg(dev, "requested bus width %d bit: %d\n",
icd->buswidth, ret); icd->buswidth, ret);
if (ret < 0) if (ret < 0)
...@@ -938,10 +946,10 @@ static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) ...@@ -938,10 +946,10 @@ static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt)
camera_flags = icd->ops->query_bus_param(icd); camera_flags = icd->ops->query_bus_param(icd);
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(dev, "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) {
dev_dbg(icd->dev.parent, "no common flags"); dev_dbg(dev, "no common flags");
return -EINVAL; return -EINVAL;
} }
...@@ -995,7 +1003,7 @@ static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) ...@@ -995,7 +1003,7 @@ static int mx3_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(dev, "camera set_bus_param(%lx) returned %d\n",
common_flags, ret); common_flags, ret);
return ret; return ret;
} }
...@@ -1050,7 +1058,7 @@ static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) ...@@ -1050,7 +1058,7 @@ static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt)
csi_reg_write(mx3_cam, sens_conf | dw, CSI_SENS_CONF); csi_reg_write(mx3_cam, sens_conf | dw, CSI_SENS_CONF);
dev_dbg(icd->dev.parent, "Set SENS_CONF to %x\n", sens_conf | dw); dev_dbg(dev, "Set SENS_CONF to %x\n", sens_conf | dw);
return 0; return 0;
} }
......
...@@ -237,7 +237,7 @@ static int pxa_videobuf_setup(struct videobuf_queue *vq, unsigned int *count, ...@@ -237,7 +237,7 @@ static int pxa_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;
dev_dbg(&icd->dev, "count=%d, size=%d\n", *count, *size); dev_dbg(icd->dev.parent, "count=%d, size=%d\n", *count, *size);
*size = roundup(icd->rect_current.width * icd->rect_current.height * *size = roundup(icd->rect_current.width * icd->rect_current.height *
((icd->current_fmt->depth + 7) >> 3), 8); ((icd->current_fmt->depth + 7) >> 3), 8);
...@@ -259,7 +259,7 @@ static void free_buffer(struct videobuf_queue *vq, struct pxa_buffer *buf) ...@@ -259,7 +259,7 @@ static void free_buffer(struct videobuf_queue *vq, struct pxa_buffer *buf)
BUG_ON(in_interrupt()); BUG_ON(in_interrupt());
dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, dev_dbg(icd->dev.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);
/* This waits until this buffer is out of danger, i.e., until it is no /* This waits until this buffer is out of danger, i.e., until it is no
...@@ -540,7 +540,8 @@ static void pxa_dma_start_channels(struct pxa_camera_dev *pcdev) ...@@ -540,7 +540,8 @@ static void pxa_dma_start_channels(struct pxa_camera_dev *pcdev)
active = pcdev->active; active = pcdev->active;
for (i = 0; i < pcdev->channels; i++) { for (i = 0; i < pcdev->channels; i++) {
dev_dbg(pcdev->soc_host.v4l2_dev.dev, "%s (channel=%d) ddadr=%08x\n", __func__, dev_dbg(pcdev->soc_host.v4l2_dev.dev,
"%s (channel=%d) ddadr=%08x\n", __func__,
i, active->dmas[i].sg_dma); i, active->dmas[i].sg_dma);
DDADR(pcdev->dma_chans[i]) = active->dmas[i].sg_dma; DDADR(pcdev->dma_chans[i]) = active->dmas[i].sg_dma;
DCSR(pcdev->dma_chans[i]) = DCSR_RUN; DCSR(pcdev->dma_chans[i]) = DCSR_RUN;
...@@ -552,7 +553,8 @@ static void pxa_dma_stop_channels(struct pxa_camera_dev *pcdev) ...@@ -552,7 +553,8 @@ static void pxa_dma_stop_channels(struct pxa_camera_dev *pcdev)
int i; int i;
for (i = 0; i < pcdev->channels; i++) { for (i = 0; i < pcdev->channels; i++) {
dev_dbg(pcdev->soc_host.v4l2_dev.dev, "%s (channel=%d)\n", __func__, i); dev_dbg(pcdev->soc_host.v4l2_dev.dev,
"%s (channel=%d)\n", __func__, i);
DCSR(pcdev->dma_chans[i]) = 0; DCSR(pcdev->dma_chans[i]) = 0;
} }
} }
...@@ -620,8 +622,8 @@ static void pxa_videobuf_queue(struct videobuf_queue *vq, ...@@ -620,8 +622,8 @@ static void pxa_videobuf_queue(struct videobuf_queue *vq,
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, "%s (vb=0x%p) 0x%08lx %d active=%p\n", __func__, dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d active=%p\n",
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);
...@@ -638,22 +640,23 @@ static void pxa_videobuf_release(struct videobuf_queue *vq, ...@@ -638,22 +640,23 @@ 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;
dev_dbg(&icd->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);
switch (vb->state) { switch (vb->state) {
case VIDEOBUF_ACTIVE: case VIDEOBUF_ACTIVE:
dev_dbg(&icd->dev, "%s (active)\n", __func__); dev_dbg(dev, "%s (active)\n", __func__);
break; break;
case VIDEOBUF_QUEUED: case VIDEOBUF_QUEUED:
dev_dbg(&icd->dev, "%s (queued)\n", __func__); dev_dbg(dev, "%s (queued)\n", __func__);
break; break;
case VIDEOBUF_PREPARED: case VIDEOBUF_PREPARED:
dev_dbg(&icd->dev, "%s (prepared)\n", __func__); dev_dbg(dev, "%s (prepared)\n", __func__);
break; break;
default: default:
dev_dbg(&icd->dev, "%s (unknown)\n", __func__); dev_dbg(dev, "%s (unknown)\n", __func__);
break; break;
} }
#endif #endif
...@@ -924,7 +927,8 @@ static irqreturn_t pxa_camera_irq(int irq, void *data) ...@@ -924,7 +927,8 @@ static irqreturn_t pxa_camera_irq(int irq, void *data)
struct videobuf_buffer *vb; struct videobuf_buffer *vb;
status = __raw_readl(pcdev->base + CISR); status = __raw_readl(pcdev->base + CISR);
dev_dbg(pcdev->soc_host.v4l2_dev.dev, "Camera interrupt status 0x%lx\n", status); dev_dbg(pcdev->soc_host.v4l2_dev.dev,
"Camera interrupt status 0x%lx\n", status);
if (!status) if (!status)
return IRQ_NONE; return IRQ_NONE;
...@@ -964,7 +968,7 @@ static int pxa_camera_add_device(struct soc_camera_device *icd) ...@@ -964,7 +968,7 @@ static int pxa_camera_add_device(struct soc_camera_device *icd)
pcdev->icd = icd; pcdev->icd = icd;
dev_info(&icd->dev, "PXA Camera driver attached to camera %d\n", dev_info(icd->dev.parent, "PXA Camera driver attached to camera %d\n",
icd->devnum); icd->devnum);
return 0; return 0;
...@@ -978,7 +982,7 @@ static void pxa_camera_remove_device(struct soc_camera_device *icd) ...@@ -978,7 +982,7 @@ static void pxa_camera_remove_device(struct soc_camera_device *icd)
BUG_ON(icd != pcdev->icd); BUG_ON(icd != pcdev->icd);
dev_info(&icd->dev, "PXA Camera driver detached from camera %d\n", dev_info(icd->dev.parent, "PXA Camera driver detached from camera %d\n",
icd->devnum); icd->devnum);
/* disable capture, disable interrupts */ /* disable capture, disable interrupts */
...@@ -1224,7 +1228,7 @@ static int required_buswidth(const struct soc_camera_data_format *fmt) ...@@ -1224,7 +1228,7 @@ static int required_buswidth(const struct soc_camera_data_format *fmt)
static int pxa_camera_get_formats(struct soc_camera_device *icd, int idx, static int pxa_camera_get_formats(struct soc_camera_device *icd, int idx,
struct soc_camera_format_xlate *xlate) struct soc_camera_format_xlate *xlate)
{ {
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct device *dev = icd->dev.parent;
int formats = 0, buswidth, ret; int formats = 0, buswidth, ret;
buswidth = required_buswidth(icd->formats + idx); buswidth = required_buswidth(icd->formats + idx);
...@@ -1244,7 +1248,7 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, int idx, ...@@ -1244,7 +1248,7 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, int idx,
xlate->cam_fmt = icd->formats + idx; xlate->cam_fmt = icd->formats + idx;
xlate->buswidth = buswidth; xlate->buswidth = buswidth;
xlate++; xlate++;
dev_dbg(ici->v4l2_dev.dev, "Providing format %s using %s\n", dev_dbg(dev, "Providing format %s using %s\n",
pxa_camera_formats[0].name, pxa_camera_formats[0].name,
icd->formats[idx].name); icd->formats[idx].name);
} }
...@@ -1259,7 +1263,7 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, int idx, ...@@ -1259,7 +1263,7 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, int idx,
xlate->cam_fmt = icd->formats + idx; xlate->cam_fmt = icd->formats + idx;
xlate->buswidth = buswidth; xlate->buswidth = buswidth;
xlate++; xlate++;
dev_dbg(ici->v4l2_dev.dev, "Providing format %s packed\n", dev_dbg(dev, "Providing format %s packed\n",
icd->formats[idx].name); icd->formats[idx].name);
} }
break; break;
...@@ -1271,7 +1275,7 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, int idx, ...@@ -1271,7 +1275,7 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, int idx,
xlate->cam_fmt = icd->formats + idx; xlate->cam_fmt = icd->formats + idx;
xlate->buswidth = icd->formats[idx].depth; xlate->buswidth = icd->formats[idx].depth;
xlate++; xlate++;
dev_dbg(ici->v4l2_dev.dev, dev_dbg(dev,
"Providing format %s in pass-through mode\n", "Providing format %s in pass-through mode\n",
icd->formats[idx].name); icd->formats[idx].name);
} }
...@@ -1286,6 +1290,7 @@ static int pxa_camera_set_crop(struct soc_camera_device *icd, ...@@ -1286,6 +1290,7 @@ static int pxa_camera_set_crop(struct soc_camera_device *icd,
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->dev.parent);
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,
...@@ -1302,11 +1307,11 @@ static int pxa_camera_set_crop(struct soc_camera_device *icd, ...@@ -1302,11 +1307,11 @@ static int pxa_camera_set_crop(struct soc_camera_device *icd,
icd->sense = NULL; icd->sense = NULL;
if (ret < 0) { if (ret < 0) {
dev_warn(ici->v4l2_dev.dev, "Failed to crop to %ux%u@%u:%u\n", dev_warn(dev, "Failed to crop to %ux%u@%u:%u\n",
rect->width, rect->height, rect->left, rect->top); rect->width, rect->height, rect->left, rect->top);
} else if (sense.flags & SOCAM_SENSE_PCLK_CHANGED) { } else if (sense.flags & SOCAM_SENSE_PCLK_CHANGED) {
if (sense.pixel_clock > sense.pixel_clock_max) { if (sense.pixel_clock > sense.pixel_clock_max) {
dev_err(ici->v4l2_dev.dev, dev_err(dev,
"pixel clock %lu set by the camera too high!", "pixel clock %lu set by the camera too high!",
sense.pixel_clock); sense.pixel_clock);
return -EIO; return -EIO;
...@@ -1322,6 +1327,7 @@ static int pxa_camera_set_fmt(struct soc_camera_device *icd, ...@@ -1322,6 +1327,7 @@ static int pxa_camera_set_fmt(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->dev.parent);
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_data_format *cam_fmt = NULL; const struct soc_camera_data_format *cam_fmt = NULL;
const struct soc_camera_format_xlate *xlate = NULL; const struct soc_camera_format_xlate *xlate = NULL;
...@@ -1335,7 +1341,7 @@ static int pxa_camera_set_fmt(struct soc_camera_device *icd, ...@@ -1335,7 +1341,7 @@ static int pxa_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(ici->v4l2_dev.dev, "Format %x not found\n", pix->pixelformat); dev_warn(dev, "Format %x not found\n", pix->pixelformat);
return -EINVAL; return -EINVAL;
} }
...@@ -1351,11 +1357,11 @@ static int pxa_camera_set_fmt(struct soc_camera_device *icd, ...@@ -1351,11 +1357,11 @@ static int pxa_camera_set_fmt(struct soc_camera_device *icd,
icd->sense = NULL; icd->sense = NULL;
if (ret < 0) { if (ret < 0) {
dev_warn(ici->v4l2_dev.dev, "Failed to configure for format %x\n", dev_warn(dev, "Failed to configure for format %x\n",
pix->pixelformat); pix->pixelformat);
} else if (sense.flags & SOCAM_SENSE_PCLK_CHANGED) { } else if (sense.flags & SOCAM_SENSE_PCLK_CHANGED) {
if (sense.pixel_clock > sense.pixel_clock_max) { if (sense.pixel_clock > sense.pixel_clock_max) {
dev_err(ici->v4l2_dev.dev, dev_err(dev,
"pixel clock %lu set by the camera too high!", "pixel clock %lu set by the camera too high!",
sense.pixel_clock); sense.pixel_clock);
return -EIO; return -EIO;
...@@ -1413,7 +1419,7 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd, ...@@ -1413,7 +1419,7 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd,
if (field == V4L2_FIELD_ANY) { if (field == V4L2_FIELD_ANY) {
pix->field = V4L2_FIELD_NONE; pix->field = V4L2_FIELD_NONE;
} else if (field != V4L2_FIELD_NONE) { } else if (field != V4L2_FIELD_NONE) {
dev_err(&icd->dev, "Field type %d unsupported.\n", field); dev_err(icd->dev.parent, "Field type %d unsupported.\n", field);
return -EINVAL; return -EINVAL;
} }
......
...@@ -168,7 +168,7 @@ static int sh_mobile_ceu_videobuf_setup(struct videobuf_queue *vq, ...@@ -168,7 +168,7 @@ static int sh_mobile_ceu_videobuf_setup(struct videobuf_queue *vq,
(*count)--; (*count)--;
} }
dev_dbg(&icd->dev, "count=%d, size=%d\n", *count, *size); dev_dbg(icd->dev.parent, "count=%d, size=%d\n", *count, *size);
return 0; return 0;
} }
...@@ -178,7 +178,7 @@ static void free_buffer(struct videobuf_queue *vq, ...@@ -178,7 +178,7 @@ static void free_buffer(struct videobuf_queue *vq,
{ {
struct soc_camera_device *icd = vq->priv_data; struct soc_camera_device *icd = vq->priv_data;
dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %zd\n", __func__, dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %zd\n", __func__,
&buf->vb, buf->vb.baddr, buf->vb.bsize); &buf->vb, buf->vb.baddr, buf->vb.bsize);
if (in_interrupt()) if (in_interrupt())
...@@ -186,7 +186,7 @@ static void free_buffer(struct videobuf_queue *vq, ...@@ -186,7 +186,7 @@ static void free_buffer(struct videobuf_queue *vq,
videobuf_waiton(&buf->vb, 0, 0); videobuf_waiton(&buf->vb, 0, 0);
videobuf_dma_contig_free(vq, &buf->vb); videobuf_dma_contig_free(vq, &buf->vb);
dev_dbg(&icd->dev, "%s freed\n", __func__); dev_dbg(icd->dev.parent, "%s freed\n", __func__);
buf->vb.state = VIDEOBUF_NEEDS_INIT; buf->vb.state = VIDEOBUF_NEEDS_INIT;
} }
...@@ -250,7 +250,7 @@ static int sh_mobile_ceu_videobuf_prepare(struct videobuf_queue *vq, ...@@ -250,7 +250,7 @@ static int sh_mobile_ceu_videobuf_prepare(struct videobuf_queue *vq,
buf = container_of(vb, struct sh_mobile_ceu_buffer, vb); buf = container_of(vb, struct sh_mobile_ceu_buffer, vb);
dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %zd\n", __func__, dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %zd\n", __func__,
vb, vb->baddr, vb->bsize); vb, vb->baddr, vb->bsize);
/* Added list head initialization on alloc */ /* Added list head initialization on alloc */
...@@ -303,7 +303,7 @@ static void sh_mobile_ceu_videobuf_queue(struct videobuf_queue *vq, ...@@ -303,7 +303,7 @@ static void sh_mobile_ceu_videobuf_queue(struct videobuf_queue *vq,
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
struct sh_mobile_ceu_dev *pcdev = ici->priv; struct sh_mobile_ceu_dev *pcdev = ici->priv;
dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %zd\n", __func__, dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %zd\n", __func__,
vb, vb->baddr, vb->bsize); vb, vb->baddr, vb->bsize);
vb->state = VIDEOBUF_QUEUED; vb->state = VIDEOBUF_QUEUED;
...@@ -392,7 +392,7 @@ static int sh_mobile_ceu_add_device(struct soc_camera_device *icd) ...@@ -392,7 +392,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, dev_info(icd->dev.parent,
"SuperH Mobile CEU driver attached to camera %d\n", "SuperH Mobile CEU driver attached to camera %d\n",
icd->devnum); icd->devnum);
...@@ -432,7 +432,7 @@ static void sh_mobile_ceu_remove_device(struct soc_camera_device *icd) ...@@ -432,7 +432,7 @@ static void sh_mobile_ceu_remove_device(struct soc_camera_device *icd)
clk_disable(pcdev->clk); clk_disable(pcdev->clk);
dev_info(&icd->dev, dev_info(icd->dev.parent,
"SuperH Mobile CEU driver detached from camera %d\n", "SuperH Mobile CEU driver detached from camera %d\n",
icd->devnum); icd->devnum);
...@@ -498,7 +498,7 @@ static void sh_mobile_ceu_set_rect(struct soc_camera_device *icd, ...@@ -498,7 +498,7 @@ static void sh_mobile_ceu_set_rect(struct soc_camera_device *icd,
left = size_src(rect->left, hscale); left = size_src(rect->left, hscale);
top = size_src(rect->top, vscale); top = size_src(rect->top, vscale);
dev_dbg(&icd->dev, "Left %u * 0x%x = %u, top %u * 0x%x = %u\n", dev_dbg(icd->dev.parent, "Left %u * 0x%x = %u, top %u * 0x%x = %u\n",
rect->left, hscale, left, rect->top, vscale, top); rect->left, hscale, left, rect->top, vscale, top);
if (left > cam->camera_rect.left) { if (left > cam->camera_rect.left) {
...@@ -515,7 +515,7 @@ static void sh_mobile_ceu_set_rect(struct soc_camera_device *icd, ...@@ -515,7 +515,7 @@ static void sh_mobile_ceu_set_rect(struct soc_camera_device *icd,
top = cam->camera_rect.top; top = cam->camera_rect.top;
} }
dev_dbg(&icd->dev, "New left %u, top %u, offsets %u:%u\n", dev_dbg(icd->dev.parent, "New left %u, top %u, offsets %u:%u\n",
rect->left, rect->top, left_offset, top_offset); rect->left, rect->top, left_offset, top_offset);
if (pcdev->image_mode) { if (pcdev->image_mode) {
...@@ -688,7 +688,7 @@ static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd, ...@@ -688,7 +688,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, "S_FMT successful for %c%c%c%c %ux%u@%u:%u\n", dev_dbg(icd->dev.parent, "S_FMT successful for %c%c%c%c %ux%u@%u:%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->rect_current.width, icd->rect_current.height, icd->rect_current.width, icd->rect_current.height,
...@@ -745,7 +745,6 @@ static const struct soc_camera_data_format sh_mobile_ceu_formats[] = { ...@@ -745,7 +745,6 @@ static const struct soc_camera_data_format sh_mobile_ceu_formats[] = {
static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, int idx, static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, int idx,
struct soc_camera_format_xlate *xlate) struct soc_camera_format_xlate *xlate)
{ {
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
int ret, k, n; int ret, k, n;
int formats = 0; int formats = 0;
struct sh_mobile_ceu_cam *cam; struct sh_mobile_ceu_cam *cam;
...@@ -795,7 +794,8 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, int idx, ...@@ -795,7 +794,8 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, int idx,
xlate->cam_fmt = icd->formats + idx; xlate->cam_fmt = icd->formats + idx;
xlate->buswidth = icd->formats[idx].depth; xlate->buswidth = icd->formats[idx].depth;
xlate++; xlate++;
dev_dbg(ici->v4l2_dev.dev, "Providing format %s using %s\n", dev_dbg(icd->dev.parent,
"Providing format %s using %s\n",
sh_mobile_ceu_formats[k].name, sh_mobile_ceu_formats[k].name,
icd->formats[idx].name); icd->formats[idx].name);
} }
...@@ -808,7 +808,7 @@ add_single_format: ...@@ -808,7 +808,7 @@ add_single_format:
xlate->cam_fmt = icd->formats + idx; xlate->cam_fmt = icd->formats + idx;
xlate->buswidth = icd->formats[idx].depth; xlate->buswidth = icd->formats[idx].depth;
xlate++; xlate++;
dev_dbg(ici->v4l2_dev.dev, dev_dbg(icd->dev.parent,
"Providing format %s in pass-through mode\n", "Providing format %s in pass-through mode\n",
icd->formats[idx].name); icd->formats[idx].name);
} }
...@@ -871,19 +871,21 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd, ...@@ -871,19 +871,21 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
target = *cam_rect; target = *cam_rect;
capsr = capture_save_reset(pcdev); capsr = capture_save_reset(pcdev);
dev_dbg(&icd->dev, "CAPSR 0x%x, CFLCR 0x%x\n", capsr, pcdev->cflcr); dev_dbg(icd->dev.parent, "CAPSR 0x%x, CFLCR 0x%x\n",
capsr, pcdev->cflcr);
/* First attempt - see if the client can deliver a perfect result */ /* First attempt - see if the client can deliver a perfect result */
ret = v4l2_subdev_call(sd, video, s_crop, &cam_crop); ret = v4l2_subdev_call(sd, video, s_crop, &cam_crop);
if (!ret && !memcmp(&target, &cam_rect, sizeof(target))) { if (!ret && !memcmp(&target, &cam_rect, sizeof(target))) {
dev_dbg(&icd->dev, "Camera S_CROP successful for %ux%u@%u:%u\n", dev_dbg(icd->dev.parent,
"Camera S_CROP successful for %ux%u@%u:%u\n",
cam_rect->width, cam_rect->height, cam_rect->width, cam_rect->height,
cam_rect->left, cam_rect->top); cam_rect->left, cam_rect->top);
goto ceu_set_rect; goto ceu_set_rect;
} }
/* Try to fix cropping, that camera hasn't managed to do */ /* Try to fix cropping, that camera hasn't managed to do */
dev_dbg(&icd->dev, "Fix camera S_CROP %d for %ux%u@%u:%u" dev_dbg(icd->dev.parent, "Fix camera S_CROP %d for %ux%u@%u:%u"
" to %ux%u@%u:%u\n", " to %ux%u@%u:%u\n",
ret, cam_rect->width, cam_rect->height, ret, cam_rect->width, cam_rect->height,
cam_rect->left, cam_rect->top, cam_rect->left, cam_rect->top,
...@@ -934,7 +936,7 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd, ...@@ -934,7 +936,7 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
cam_rect->height, cam_max.top); cam_rect->height, cam_max.top);
ret = v4l2_subdev_call(sd, video, s_crop, &cam_crop); ret = v4l2_subdev_call(sd, video, s_crop, &cam_crop);
dev_dbg(&icd->dev, "Camera S_CROP %d for %ux%u@%u:%u\n", dev_dbg(icd->dev.parent, "Camera S_CROP %d for %ux%u@%u:%u\n",
ret, cam_rect->width, cam_rect->height, ret, cam_rect->width, cam_rect->height,
cam_rect->left, cam_rect->top); cam_rect->left, cam_rect->top);
} }
...@@ -952,7 +954,8 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd, ...@@ -952,7 +954,8 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
*/ */
*cam_rect = cam_max; *cam_rect = cam_max;
ret = v4l2_subdev_call(sd, video, s_crop, &cam_crop); ret = v4l2_subdev_call(sd, video, s_crop, &cam_crop);
dev_dbg(&icd->dev, "Camera S_CROP %d for max %ux%u@%u:%u\n", dev_dbg(icd->dev.parent,
"Camera S_CROP %d for max %ux%u@%u:%u\n",
ret, cam_rect->width, cam_rect->height, ret, cam_rect->width, cam_rect->height,
cam_rect->left, cam_rect->top); cam_rect->left, cam_rect->top);
if (ret < 0 && ret != -ENOIOCTLCMD) if (ret < 0 && ret != -ENOIOCTLCMD)
...@@ -980,7 +983,7 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd, ...@@ -980,7 +983,7 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
* last before last close() _user_ rectangle, which can be different * last before last close() _user_ rectangle, which can be different
* from camera rectangle. * from camera rectangle.
*/ */
dev_dbg(&icd->dev, dev_dbg(icd->dev.parent,
"SH S_CROP from %ux%u@%u:%u to %ux%u@%u:%u, scale to %ux%u@%u:%u\n", "SH S_CROP from %ux%u@%u:%u to %ux%u@%u:%u, scale to %ux%u@%u:%u\n",
cam_rect->width, cam_rect->height, cam_rect->left, cam_rect->top, cam_rect->width, cam_rect->height, cam_rect->left, cam_rect->top,
target.width, target.height, target.left, target.top, target.width, target.height, target.left, target.top,
...@@ -1038,14 +1041,15 @@ static int sh_mobile_ceu_set_fmt(struct soc_camera_device *icd, ...@@ -1038,14 +1041,15 @@ static int sh_mobile_ceu_set_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(ici->v4l2_dev.dev, "Format %x not found\n", pixfmt); dev_warn(icd->dev.parent, "Format %x not found\n", pixfmt);
return -EINVAL; return -EINVAL;
} }
pix->pixelformat = xlate->cam_fmt->fourcc; pix->pixelformat = xlate->cam_fmt->fourcc;
ret = v4l2_subdev_call(sd, video, s_fmt, f); ret = v4l2_subdev_call(sd, video, s_fmt, f);
pix->pixelformat = pixfmt; pix->pixelformat = pixfmt;
dev_dbg(&icd->dev, "Camera %d fmt %ux%u, requested %ux%u, max %ux%u\n", dev_dbg(icd->dev.parent,
"Camera %d fmt %ux%u, requested %ux%u, max %ux%u\n",
ret, pix->width, pix->height, width, height, ret, pix->width, pix->height, width, height,
icd->rect_max.width, icd->rect_max.height); icd->rect_max.width, icd->rect_max.height);
if (ret < 0) if (ret < 0)
...@@ -1085,12 +1089,12 @@ static int sh_mobile_ceu_set_fmt(struct soc_camera_device *icd, ...@@ -1085,12 +1089,12 @@ static int sh_mobile_ceu_set_fmt(struct soc_camera_device *icd,
pix->pixelformat = xlate->cam_fmt->fourcc; pix->pixelformat = xlate->cam_fmt->fourcc;
ret = v4l2_subdev_call(sd, video, s_fmt, f); ret = v4l2_subdev_call(sd, video, s_fmt, f);
pix->pixelformat = pixfmt; pix->pixelformat = pixfmt;
dev_dbg(&icd->dev, "Camera scaled to %ux%u\n", dev_dbg(icd->dev.parent, "Camera scaled to %ux%u\n",
pix->width, pix->height); pix->width, pix->height);
if (ret < 0) { if (ret < 0) {
/* This shouldn't happen */ /* This shouldn't happen */
dev_err(&icd->dev, "Client failed to set format: %d\n", dev_err(icd->dev.parent,
ret); "Client failed to set format: %d\n", ret);
return ret; return ret;
} }
} }
...@@ -1106,7 +1110,7 @@ static int sh_mobile_ceu_set_fmt(struct soc_camera_device *icd, ...@@ -1106,7 +1110,7 @@ static int sh_mobile_ceu_set_fmt(struct soc_camera_device *icd,
hscale = calc_scale(pix->width, &width); hscale = calc_scale(pix->width, &width);
vscale = calc_scale(pix->height, &height); vscale = calc_scale(pix->height, &height);
dev_dbg(&icd->dev, "W: %u : 0x%x = %u, H: %u : 0x%x = %u\n", dev_dbg(icd->dev.parent, "W: %u : 0x%x = %u, H: %u : 0x%x = %u\n",
pix->width, hscale, width, pix->height, vscale, height); pix->width, hscale, width, pix->height, vscale, height);
out: out:
...@@ -1137,7 +1141,6 @@ out: ...@@ -1137,7 +1141,6 @@ out:
static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, static int sh_mobile_ceu_try_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);
const struct soc_camera_format_xlate *xlate; const struct soc_camera_format_xlate *xlate;
struct v4l2_pix_format *pix = &f->fmt.pix; struct v4l2_pix_format *pix = &f->fmt.pix;
struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
...@@ -1147,7 +1150,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, ...@@ -1147,7 +1150,7 @@ static int sh_mobile_ceu_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(ici->v4l2_dev.dev, "Format %x not found\n", pixfmt); dev_warn(icd->dev.parent, "Format %x not found\n", pixfmt);
return -EINVAL; return -EINVAL;
} }
...@@ -1185,7 +1188,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, ...@@ -1185,7 +1188,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
ret = v4l2_subdev_call(sd, video, try_fmt, f); ret = v4l2_subdev_call(sd, video, try_fmt, f);
if (ret < 0) { if (ret < 0) {
/* Shouldn't actually happen... */ /* Shouldn't actually happen... */
dev_err(&icd->dev, dev_err(icd->dev.parent,
"FIXME: try_fmt() returned %d\n", ret); "FIXME: try_fmt() returned %d\n", ret);
pix->width = tmp_w; pix->width = tmp_w;
pix->height = tmp_h; pix->height = tmp_h;
...@@ -1254,7 +1257,7 @@ static void sh_mobile_ceu_init_videobuf(struct videobuf_queue *q, ...@@ -1254,7 +1257,7 @@ static void sh_mobile_ceu_init_videobuf(struct videobuf_queue *q,
videobuf_queue_dma_contig_init(q, videobuf_queue_dma_contig_init(q,
&sh_mobile_ceu_videobuf_ops, &sh_mobile_ceu_videobuf_ops,
ici->v4l2_dev.dev, &pcdev->lock, icd->dev.parent, &pcdev->lock,
V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_BUF_TYPE_VIDEO_CAPTURE,
pcdev->is_interlaced ? pcdev->is_interlaced ?
V4L2_FIELD_INTERLACED : V4L2_FIELD_NONE, V4L2_FIELD_INTERLACED : V4L2_FIELD_NONE,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment