aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-08-25 10:47:00 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-18 23:19:15 -0400
commit0166b74374cae3fa8bff0caef726a3d960a9a50a (patch)
treeb09ce8c3211f86dd3ff79baae5648c10711697ea /drivers/media
parent2aa58db47f5c70635ea278f6a5ff9e1e920bfe6a (diff)
V4L/DVB (12533): soc-camera: Use video device object for output in host drivers
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/mx1_camera.c38
-rw-r--r--drivers/media/video/mx3_camera.c46
-rw-r--r--drivers/media/video/pxa_camera.c54
-rw-r--r--drivers/media/video/sh_mobile_ceu_camera.c61
4 files changed, 110 insertions, 89 deletions
diff --git a/drivers/media/video/mx1_camera.c b/drivers/media/video/mx1_camera.c
index ed7856bdad48..1f1324a1d493 100644
--- a/drivers/media/video/mx1_camera.c
+++ b/drivers/media/video/mx1_camera.c
@@ -135,7 +135,7 @@ static int mx1_videobuf_setup(struct videobuf_queue *vq, unsigned int *count,
135 while (*size * *count > MAX_VIDEO_MEM * 1024 * 1024) 135 while (*size * *count > MAX_VIDEO_MEM * 1024 * 1024)
136 (*count)--; 136 (*count)--;
137 137
138 dev_dbg(&icd->dev, "count=%d, size=%d\n", *count, *size); 138 dev_dbg(icd->dev.parent, "count=%d, size=%d\n", *count, *size);
139 139
140 return 0; 140 return 0;
141} 141}
@@ -147,7 +147,7 @@ static void free_buffer(struct videobuf_queue *vq, struct mx1_buffer *buf)
147 147
148 BUG_ON(in_interrupt()); 148 BUG_ON(in_interrupt());
149 149
150 dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, 150 dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
151 vb, vb->baddr, vb->bsize); 151 vb, vb->baddr, vb->bsize);
152 152
153 /* This waits until this buffer is out of danger, i.e., until it is no 153 /* 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 struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb); 165 struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb);
166 int ret; 166 int ret;
167 167
168 dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, 168 dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
169 vb, vb->baddr, vb->bsize); 169 vb, vb->baddr, vb->bsize);
170 170
171 /* Added list head initialization on alloc */ 171 /* Added list head initialization on alloc */
@@ -216,10 +216,11 @@ out:
216static int mx1_camera_setup_dma(struct mx1_camera_dev *pcdev) 216static int mx1_camera_setup_dma(struct mx1_camera_dev *pcdev)
217{ 217{
218 struct videobuf_buffer *vbuf = &pcdev->active->vb; 218 struct videobuf_buffer *vbuf = &pcdev->active->vb;
219 struct device *dev = pcdev->icd->dev.parent;
219 int ret; 220 int ret;
220 221
221 if (unlikely(!pcdev->active)) { 222 if (unlikely(!pcdev->active)) {
222 dev_err(pcdev->icd->dev.parent, "DMA End IRQ with no active buffer\n"); 223 dev_err(dev, "DMA End IRQ with no active buffer\n");
223 return -EFAULT; 224 return -EFAULT;
224 } 225 }
225 226
@@ -229,7 +230,7 @@ static int mx1_camera_setup_dma(struct mx1_camera_dev *pcdev)
229 vbuf->size, pcdev->res->start + 230 vbuf->size, pcdev->res->start +
230 CSIRXR, DMA_MODE_READ); 231 CSIRXR, DMA_MODE_READ);
231 if (unlikely(ret)) 232 if (unlikely(ret))
232 dev_err(pcdev->icd->dev.parent, "Failed to setup DMA sg list\n"); 233 dev_err(dev, "Failed to setup DMA sg list\n");
233 234
234 return ret; 235 return ret;
235} 236}
@@ -243,7 +244,7 @@ static void mx1_videobuf_queue(struct videobuf_queue *vq,
243 struct mx1_camera_dev *pcdev = ici->priv; 244 struct mx1_camera_dev *pcdev = ici->priv;
244 struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb); 245 struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb);
245 246
246 dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, 247 dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
247 vb, vb->baddr, vb->bsize); 248 vb, vb->baddr, vb->bsize);
248 249
249 list_add_tail(&vb->queue, &pcdev->capture); 250 list_add_tail(&vb->queue, &pcdev->capture);
@@ -270,22 +271,23 @@ static void mx1_videobuf_release(struct videobuf_queue *vq,
270 struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb); 271 struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb);
271#ifdef DEBUG 272#ifdef DEBUG
272 struct soc_camera_device *icd = vq->priv_data; 273 struct soc_camera_device *icd = vq->priv_data;
274 struct device *dev = icd->dev.parent;
273 275
274 dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, 276 dev_dbg(dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
275 vb, vb->baddr, vb->bsize); 277 vb, vb->baddr, vb->bsize);
276 278
277 switch (vb->state) { 279 switch (vb->state) {
278 case VIDEOBUF_ACTIVE: 280 case VIDEOBUF_ACTIVE:
279 dev_dbg(&icd->dev, "%s (active)\n", __func__); 281 dev_dbg(dev, "%s (active)\n", __func__);
280 break; 282 break;
281 case VIDEOBUF_QUEUED: 283 case VIDEOBUF_QUEUED:
282 dev_dbg(&icd->dev, "%s (queued)\n", __func__); 284 dev_dbg(dev, "%s (queued)\n", __func__);
283 break; 285 break;
284 case VIDEOBUF_PREPARED: 286 case VIDEOBUF_PREPARED:
285 dev_dbg(&icd->dev, "%s (prepared)\n", __func__); 287 dev_dbg(dev, "%s (prepared)\n", __func__);
286 break; 288 break;
287 default: 289 default:
288 dev_dbg(&icd->dev, "%s (unknown)\n", __func__); 290 dev_dbg(dev, "%s (unknown)\n", __func__);
289 break; 291 break;
290 } 292 }
291#endif 293#endif
@@ -325,6 +327,7 @@ static void mx1_camera_wakeup(struct mx1_camera_dev *pcdev,
325static void mx1_camera_dma_irq(int channel, void *data) 327static void mx1_camera_dma_irq(int channel, void *data)
326{ 328{
327 struct mx1_camera_dev *pcdev = data; 329 struct mx1_camera_dev *pcdev = data;
330 struct device *dev = pcdev->icd->dev.parent;
328 struct mx1_buffer *buf; 331 struct mx1_buffer *buf;
329 struct videobuf_buffer *vb; 332 struct videobuf_buffer *vb;
330 unsigned long flags; 333 unsigned long flags;
@@ -334,14 +337,14 @@ static void mx1_camera_dma_irq(int channel, void *data)
334 imx_dma_disable(channel); 337 imx_dma_disable(channel);
335 338
336 if (unlikely(!pcdev->active)) { 339 if (unlikely(!pcdev->active)) {
337 dev_err(pcdev->icd->dev.parent, "DMA End IRQ with no active buffer\n"); 340 dev_err(dev, "DMA End IRQ with no active buffer\n");
338 goto out; 341 goto out;
339 } 342 }
340 343
341 vb = &pcdev->active->vb; 344 vb = &pcdev->active->vb;
342 buf = container_of(vb, struct mx1_buffer, vb); 345 buf = container_of(vb, struct mx1_buffer, vb);
343 WARN_ON(buf->inwork || list_empty(&vb->queue)); 346 WARN_ON(buf->inwork || list_empty(&vb->queue));
344 dev_dbg(pcdev->icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, 347 dev_dbg(dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
345 vb, vb->baddr, vb->bsize); 348 vb, vb->baddr, vb->bsize);
346 349
347 mx1_camera_wakeup(pcdev, vb, buf); 350 mx1_camera_wakeup(pcdev, vb, buf);
@@ -381,8 +384,9 @@ static int mclk_get_divisor(struct mx1_camera_dev *pcdev)
381 * they get a nice Oops */ 384 * they get a nice Oops */
382 div = (lcdclk + 2 * mclk - 1) / (2 * mclk) - 1; 385 div = (lcdclk + 2 * mclk - 1) / (2 * mclk) - 1;
383 386
384 dev_dbg(pcdev->icd->dev.parent, "System clock %lukHz, target freq %dkHz, " 387 dev_dbg(pcdev->icd->dev.parent,
385 "divisor %lu\n", lcdclk / 1000, mclk / 1000, div); 388 "System clock %lukHz, target freq %dkHz, divisor %lu\n",
389 lcdclk / 1000, mclk / 1000, div);
386 390
387 return div; 391 return div;
388} 392}
@@ -428,7 +432,7 @@ static int mx1_camera_add_device(struct soc_camera_device *icd)
428 goto ebusy; 432 goto ebusy;
429 } 433 }
430 434
431 dev_info(&icd->dev, "MX1 Camera driver attached to camera %d\n", 435 dev_info(icd->dev.parent, "MX1 Camera driver attached to camera %d\n",
432 icd->devnum); 436 icd->devnum);
433 437
434 mx1_camera_activate(pcdev); 438 mx1_camera_activate(pcdev);
@@ -454,7 +458,7 @@ static void mx1_camera_remove_device(struct soc_camera_device *icd)
454 /* Stop DMA engine */ 458 /* Stop DMA engine */
455 imx_dma_disable(pcdev->dma_chan); 459 imx_dma_disable(pcdev->dma_chan);
456 460
457 dev_info(&icd->dev, "MX1 Camera driver detached from camera %d\n", 461 dev_info(icd->dev.parent, "MX1 Camera driver detached from camera %d\n",
458 icd->devnum); 462 icd->devnum);
459 463
460 mx1_camera_deactivate(pcdev); 464 mx1_camera_deactivate(pcdev);
diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c
index f7888f30da51..d5b51e9900bb 100644
--- a/drivers/media/video/mx3_camera.c
+++ b/drivers/media/video/mx3_camera.c
@@ -178,7 +178,7 @@ static void free_buffer(struct videobuf_queue *vq, struct mx3_camera_buffer *buf
178 178
179 BUG_ON(in_interrupt()); 179 BUG_ON(in_interrupt());
180 180
181 dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, 181 dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
182 vb, vb->baddr, vb->bsize); 182 vb, vb->baddr, vb->bsize);
183 183
184 /* 184 /*
@@ -375,7 +375,8 @@ static void mx3_videobuf_queue(struct videobuf_queue *vq,
375 spin_unlock_irq(&mx3_cam->lock); 375 spin_unlock_irq(&mx3_cam->lock);
376 376
377 cookie = txd->tx_submit(txd); 377 cookie = txd->tx_submit(txd);
378 dev_dbg(&icd->dev, "Submitted cookie %d DMA 0x%08x\n", cookie, sg_dma_address(&buf->sg)); 378 dev_dbg(icd->dev.parent, "Submitted cookie %d DMA 0x%08x\n",
379 cookie, sg_dma_address(&buf->sg));
379 380
380 spin_lock_irq(&mx3_cam->lock); 381 spin_lock_irq(&mx3_cam->lock);
381 382
@@ -402,9 +403,10 @@ static void mx3_videobuf_release(struct videobuf_queue *vq,
402 container_of(vb, struct mx3_camera_buffer, vb); 403 container_of(vb, struct mx3_camera_buffer, vb);
403 unsigned long flags; 404 unsigned long flags;
404 405
405 dev_dbg(&icd->dev, "Release%s DMA 0x%08x (state %d), queue %sempty\n", 406 dev_dbg(icd->dev.parent,
407 "Release%s DMA 0x%08x (state %d), queue %sempty\n",
406 mx3_cam->active == buf ? " active" : "", sg_dma_address(&buf->sg), 408 mx3_cam->active == buf ? " active" : "", sg_dma_address(&buf->sg),
407 vb->state, list_empty(&vb->queue) ? "" : "not "); 409 vb->state, list_empty(&vb->queue) ? "" : "not ");
408 spin_lock_irqsave(&mx3_cam->lock, flags); 410 spin_lock_irqsave(&mx3_cam->lock, flags);
409 if ((vb->state == VIDEOBUF_ACTIVE || vb->state == VIDEOBUF_QUEUED) && 411 if ((vb->state == VIDEOBUF_ACTIVE || vb->state == VIDEOBUF_QUEUED) &&
410 !list_empty(&vb->queue)) { 412 !list_empty(&vb->queue)) {
@@ -484,7 +486,7 @@ static void mx3_camera_activate(struct mx3_camera_dev *mx3_cam,
484 486
485 clk_enable(mx3_cam->clk); 487 clk_enable(mx3_cam->clk);
486 rate = clk_round_rate(mx3_cam->clk, mx3_cam->mclk); 488 rate = clk_round_rate(mx3_cam->clk, mx3_cam->mclk);
487 dev_dbg(&icd->dev, "Set SENS_CONF to %x, rate %ld\n", conf, rate); 489 dev_dbg(icd->dev.parent, "Set SENS_CONF to %x, rate %ld\n", conf, rate);
488 if (rate) 490 if (rate)
489 clk_set_rate(mx3_cam->clk, rate); 491 clk_set_rate(mx3_cam->clk, rate);
490} 492}
@@ -502,7 +504,7 @@ static int mx3_camera_add_device(struct soc_camera_device *icd)
502 504
503 mx3_cam->icd = icd; 505 mx3_cam->icd = icd;
504 506
505 dev_info(&icd->dev, "MX3 Camera driver attached to camera %d\n", 507 dev_info(icd->dev.parent, "MX3 Camera driver attached to camera %d\n",
506 icd->devnum); 508 icd->devnum);
507 509
508 return 0; 510 return 0;
@@ -526,7 +528,7 @@ static void mx3_camera_remove_device(struct soc_camera_device *icd)
526 528
527 mx3_cam->icd = NULL; 529 mx3_cam->icd = NULL;
528 530
529 dev_info(&icd->dev, "MX3 Camera driver detached from camera %d\n", 531 dev_info(icd->dev.parent, "MX3 Camera driver detached from camera %d\n",
530 icd->devnum); 532 icd->devnum);
531} 533}
532 534
@@ -603,7 +605,8 @@ static int mx3_camera_try_bus_param(struct soc_camera_device *icd,
603 unsigned long bus_flags, camera_flags; 605 unsigned long bus_flags, camera_flags;
604 int ret = test_platform_param(mx3_cam, depth, &bus_flags); 606 int ret = test_platform_param(mx3_cam, depth, &bus_flags);
605 607
606 dev_dbg(icd->dev.parent, "requested bus width %d bit: %d\n", depth, ret); 608 dev_dbg(icd->dev.parent, "requested bus width %d bit: %d\n",
609 depth, ret);
607 610
608 if (ret < 0) 611 if (ret < 0)
609 return ret; 612 return ret;
@@ -612,7 +615,8 @@ static int mx3_camera_try_bus_param(struct soc_camera_device *icd,
612 615
613 ret = soc_camera_bus_param_compatible(camera_flags, bus_flags); 616 ret = soc_camera_bus_param_compatible(camera_flags, bus_flags);
614 if (ret < 0) 617 if (ret < 0)
615 dev_warn(&icd->dev, "Flags incompatible: camera %lx, host %lx\n", 618 dev_warn(icd->dev.parent,
619 "Flags incompatible: camera %lx, host %lx\n",
616 camera_flags, bus_flags); 620 camera_flags, bus_flags);
617 621
618 return ret; 622 return ret;
@@ -686,7 +690,8 @@ static int mx3_camera_get_formats(struct soc_camera_device *icd, int idx,
686 xlate->cam_fmt = icd->formats + idx; 690 xlate->cam_fmt = icd->formats + idx;
687 xlate->buswidth = buswidth; 691 xlate->buswidth = buswidth;
688 xlate++; 692 xlate++;
689 dev_dbg(icd->dev.parent, "Providing format %s using %s\n", 693 dev_dbg(icd->dev.parent,
694 "Providing format %s using %s\n",
690 mx3_camera_formats[0].name, 695 mx3_camera_formats[0].name,
691 icd->formats[idx].name); 696 icd->formats[idx].name);
692 } 697 }
@@ -698,7 +703,8 @@ static int mx3_camera_get_formats(struct soc_camera_device *icd, int idx,
698 xlate->cam_fmt = icd->formats + idx; 703 xlate->cam_fmt = icd->formats + idx;
699 xlate->buswidth = buswidth; 704 xlate->buswidth = buswidth;
700 xlate++; 705 xlate++;
701 dev_dbg(icd->dev.parent, "Providing format %s using %s\n", 706 dev_dbg(icd->dev.parent,
707 "Providing format %s using %s\n",
702 mx3_camera_formats[0].name, 708 mx3_camera_formats[0].name,
703 icd->formats[idx].name); 709 icd->formats[idx].name);
704 } 710 }
@@ -821,7 +827,8 @@ static int mx3_camera_set_fmt(struct soc_camera_device *icd,
821 827
822 xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); 828 xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat);
823 if (!xlate) { 829 if (!xlate) {
824 dev_warn(icd->dev.parent, "Format %x not found\n", pix->pixelformat); 830 dev_warn(icd->dev.parent, "Format %x not found\n",
831 pix->pixelformat);
825 return -EINVAL; 832 return -EINVAL;
826 } 833 }
827 834
@@ -883,7 +890,7 @@ static int mx3_camera_try_fmt(struct soc_camera_device *icd,
883 if (field == V4L2_FIELD_ANY) { 890 if (field == V4L2_FIELD_ANY) {
884 pix->field = V4L2_FIELD_NONE; 891 pix->field = V4L2_FIELD_NONE;
885 } else if (field != V4L2_FIELD_NONE) { 892 } else if (field != V4L2_FIELD_NONE) {
886 dev_err(&icd->dev, "Field type %d unsupported.\n", field); 893 dev_err(icd->dev.parent, "Field type %d unsupported.\n", field);
887 return -EINVAL; 894 return -EINVAL;
888 } 895 }
889 896
@@ -922,14 +929,15 @@ static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt)
922 u32 dw, sens_conf; 929 u32 dw, sens_conf;
923 int ret = test_platform_param(mx3_cam, icd->buswidth, &bus_flags); 930 int ret = test_platform_param(mx3_cam, icd->buswidth, &bus_flags);
924 const struct soc_camera_format_xlate *xlate; 931 const struct soc_camera_format_xlate *xlate;
932 struct device *dev = icd->dev.parent;
925 933
926 xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); 934 xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
927 if (!xlate) { 935 if (!xlate) {
928 dev_warn(icd->dev.parent, "Format %x not found\n", pixfmt); 936 dev_warn(dev, "Format %x not found\n", pixfmt);
929 return -EINVAL; 937 return -EINVAL;
930 } 938 }
931 939
932 dev_dbg(icd->dev.parent, "requested bus width %d bit: %d\n", 940 dev_dbg(dev, "requested bus width %d bit: %d\n",
933 icd->buswidth, ret); 941 icd->buswidth, ret);
934 942
935 if (ret < 0) 943 if (ret < 0)
@@ -938,10 +946,10 @@ static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt)
938 camera_flags = icd->ops->query_bus_param(icd); 946 camera_flags = icd->ops->query_bus_param(icd);
939 947
940 common_flags = soc_camera_bus_param_compatible(camera_flags, bus_flags); 948 common_flags = soc_camera_bus_param_compatible(camera_flags, bus_flags);
941 dev_dbg(icd->dev.parent, "Flags cam: 0x%lx host: 0x%lx common: 0x%lx\n", 949 dev_dbg(dev, "Flags cam: 0x%lx host: 0x%lx common: 0x%lx\n",
942 camera_flags, bus_flags, common_flags); 950 camera_flags, bus_flags, common_flags);
943 if (!common_flags) { 951 if (!common_flags) {
944 dev_dbg(icd->dev.parent, "no common flags"); 952 dev_dbg(dev, "no common flags");
945 return -EINVAL; 953 return -EINVAL;
946 } 954 }
947 955
@@ -995,7 +1003,7 @@ static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt)
995 1003
996 ret = icd->ops->set_bus_param(icd, common_flags); 1004 ret = icd->ops->set_bus_param(icd, common_flags);
997 if (ret < 0) { 1005 if (ret < 0) {
998 dev_dbg(icd->dev.parent, "camera set_bus_param(%lx) returned %d\n", 1006 dev_dbg(dev, "camera set_bus_param(%lx) returned %d\n",
999 common_flags, ret); 1007 common_flags, ret);
1000 return ret; 1008 return ret;
1001 } 1009 }
@@ -1050,7 +1058,7 @@ static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt)
1050 1058
1051 csi_reg_write(mx3_cam, sens_conf | dw, CSI_SENS_CONF); 1059 csi_reg_write(mx3_cam, sens_conf | dw, CSI_SENS_CONF);
1052 1060
1053 dev_dbg(icd->dev.parent, "Set SENS_CONF to %x\n", sens_conf | dw); 1061 dev_dbg(dev, "Set SENS_CONF to %x\n", sens_conf | dw);
1054 1062
1055 return 0; 1063 return 0;
1056} 1064}
diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c
index 4bc2a4f81f79..1fd6ef392a54 100644
--- a/drivers/media/video/pxa_camera.c
+++ b/drivers/media/video/pxa_camera.c
@@ -237,7 +237,7 @@ static int pxa_videobuf_setup(struct videobuf_queue *vq, unsigned int *count,
237{ 237{
238 struct soc_camera_device *icd = vq->priv_data; 238 struct soc_camera_device *icd = vq->priv_data;
239 239
240 dev_dbg(&icd->dev, "count=%d, size=%d\n", *count, *size); 240 dev_dbg(icd->dev.parent, "count=%d, size=%d\n", *count, *size);
241 241
242 *size = roundup(icd->rect_current.width * icd->rect_current.height * 242 *size = roundup(icd->rect_current.width * icd->rect_current.height *
243 ((icd->current_fmt->depth + 7) >> 3), 8); 243 ((icd->current_fmt->depth + 7) >> 3), 8);
@@ -259,7 +259,7 @@ static void free_buffer(struct videobuf_queue *vq, struct pxa_buffer *buf)
259 259
260 BUG_ON(in_interrupt()); 260 BUG_ON(in_interrupt());
261 261
262 dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, 262 dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
263 &buf->vb, buf->vb.baddr, buf->vb.bsize); 263 &buf->vb, buf->vb.baddr, buf->vb.bsize);
264 264
265 /* This waits until this buffer is out of danger, i.e., until it is no 265 /* 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 active = pcdev->active; 540 active = pcdev->active;
541 541
542 for (i = 0; i < pcdev->channels; i++) { 542 for (i = 0; i < pcdev->channels; i++) {
543 dev_dbg(pcdev->soc_host.v4l2_dev.dev, "%s (channel=%d) ddadr=%08x\n", __func__, 543 dev_dbg(pcdev->soc_host.v4l2_dev.dev,
544 "%s (channel=%d) ddadr=%08x\n", __func__,
544 i, active->dmas[i].sg_dma); 545 i, active->dmas[i].sg_dma);
545 DDADR(pcdev->dma_chans[i]) = active->dmas[i].sg_dma; 546 DDADR(pcdev->dma_chans[i]) = active->dmas[i].sg_dma;
546 DCSR(pcdev->dma_chans[i]) = DCSR_RUN; 547 DCSR(pcdev->dma_chans[i]) = DCSR_RUN;
@@ -552,7 +553,8 @@ static void pxa_dma_stop_channels(struct pxa_camera_dev *pcdev)
552 int i; 553 int i;
553 554
554 for (i = 0; i < pcdev->channels; i++) { 555 for (i = 0; i < pcdev->channels; i++) {
555 dev_dbg(pcdev->soc_host.v4l2_dev.dev, "%s (channel=%d)\n", __func__, i); 556 dev_dbg(pcdev->soc_host.v4l2_dev.dev,
557 "%s (channel=%d)\n", __func__, i);
556 DCSR(pcdev->dma_chans[i]) = 0; 558 DCSR(pcdev->dma_chans[i]) = 0;
557 } 559 }
558} 560}
@@ -620,8 +622,8 @@ static void pxa_videobuf_queue(struct videobuf_queue *vq,
620 struct pxa_camera_dev *pcdev = ici->priv; 622 struct pxa_camera_dev *pcdev = ici->priv;
621 struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb); 623 struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb);
622 624
623 dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d active=%p\n", __func__, 625 dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d active=%p\n",
624 vb, vb->baddr, vb->bsize, pcdev->active); 626 __func__, vb, vb->baddr, vb->bsize, pcdev->active);
625 627
626 list_add_tail(&vb->queue, &pcdev->capture); 628 list_add_tail(&vb->queue, &pcdev->capture);
627 629
@@ -638,22 +640,23 @@ static void pxa_videobuf_release(struct videobuf_queue *vq,
638 struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb); 640 struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb);
639#ifdef DEBUG 641#ifdef DEBUG
640 struct soc_camera_device *icd = vq->priv_data; 642 struct soc_camera_device *icd = vq->priv_data;
643 struct device *dev = icd->dev.parent;
641 644
642 dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, 645 dev_dbg(dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
643 vb, vb->baddr, vb->bsize); 646 vb, vb->baddr, vb->bsize);
644 647
645 switch (vb->state) { 648 switch (vb->state) {
646 case VIDEOBUF_ACTIVE: 649 case VIDEOBUF_ACTIVE:
647 dev_dbg(&icd->dev, "%s (active)\n", __func__); 650 dev_dbg(dev, "%s (active)\n", __func__);
648 break; 651 break;
649 case VIDEOBUF_QUEUED: 652 case VIDEOBUF_QUEUED:
650 dev_dbg(&icd->dev, "%s (queued)\n", __func__); 653 dev_dbg(dev, "%s (queued)\n", __func__);
651 break; 654 break;
652 case VIDEOBUF_PREPARED: 655 case VIDEOBUF_PREPARED:
653 dev_dbg(&icd->dev, "%s (prepared)\n", __func__); 656 dev_dbg(dev, "%s (prepared)\n", __func__);
654 break; 657 break;
655 default: 658 default:
656 dev_dbg(&icd->dev, "%s (unknown)\n", __func__); 659 dev_dbg(dev, "%s (unknown)\n", __func__);
657 break; 660 break;
658 } 661 }
659#endif 662#endif
@@ -924,7 +927,8 @@ static irqreturn_t pxa_camera_irq(int irq, void *data)
924 struct videobuf_buffer *vb; 927 struct videobuf_buffer *vb;
925 928
926 status = __raw_readl(pcdev->base + CISR); 929 status = __raw_readl(pcdev->base + CISR);
927 dev_dbg(pcdev->soc_host.v4l2_dev.dev, "Camera interrupt status 0x%lx\n", status); 930 dev_dbg(pcdev->soc_host.v4l2_dev.dev,
931 "Camera interrupt status 0x%lx\n", status);
928 932
929 if (!status) 933 if (!status)
930 return IRQ_NONE; 934 return IRQ_NONE;
@@ -964,7 +968,7 @@ static int pxa_camera_add_device(struct soc_camera_device *icd)
964 968
965 pcdev->icd = icd; 969 pcdev->icd = icd;
966 970
967 dev_info(&icd->dev, "PXA Camera driver attached to camera %d\n", 971 dev_info(icd->dev.parent, "PXA Camera driver attached to camera %d\n",
968 icd->devnum); 972 icd->devnum);
969 973
970 return 0; 974 return 0;
@@ -978,7 +982,7 @@ static void pxa_camera_remove_device(struct soc_camera_device *icd)
978 982
979 BUG_ON(icd != pcdev->icd); 983 BUG_ON(icd != pcdev->icd);
980 984
981 dev_info(&icd->dev, "PXA Camera driver detached from camera %d\n", 985 dev_info(icd->dev.parent, "PXA Camera driver detached from camera %d\n",
982 icd->devnum); 986 icd->devnum);
983 987
984 /* disable capture, disable interrupts */ 988 /* disable capture, disable interrupts */
@@ -1224,7 +1228,7 @@ static int required_buswidth(const struct soc_camera_data_format *fmt)
1224static int pxa_camera_get_formats(struct soc_camera_device *icd, int idx, 1228static int pxa_camera_get_formats(struct soc_camera_device *icd, int idx,
1225 struct soc_camera_format_xlate *xlate) 1229 struct soc_camera_format_xlate *xlate)
1226{ 1230{
1227 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); 1231 struct device *dev = icd->dev.parent;
1228 int formats = 0, buswidth, ret; 1232 int formats = 0, buswidth, ret;
1229 1233
1230 buswidth = required_buswidth(icd->formats + idx); 1234 buswidth = required_buswidth(icd->formats + idx);
@@ -1244,7 +1248,7 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, int idx,
1244 xlate->cam_fmt = icd->formats + idx; 1248 xlate->cam_fmt = icd->formats + idx;
1245 xlate->buswidth = buswidth; 1249 xlate->buswidth = buswidth;
1246 xlate++; 1250 xlate++;
1247 dev_dbg(ici->v4l2_dev.dev, "Providing format %s using %s\n", 1251 dev_dbg(dev, "Providing format %s using %s\n",
1248 pxa_camera_formats[0].name, 1252 pxa_camera_formats[0].name,
1249 icd->formats[idx].name); 1253 icd->formats[idx].name);
1250 } 1254 }
@@ -1259,7 +1263,7 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, int idx,
1259 xlate->cam_fmt = icd->formats + idx; 1263 xlate->cam_fmt = icd->formats + idx;
1260 xlate->buswidth = buswidth; 1264 xlate->buswidth = buswidth;
1261 xlate++; 1265 xlate++;
1262 dev_dbg(ici->v4l2_dev.dev, "Providing format %s packed\n", 1266 dev_dbg(dev, "Providing format %s packed\n",
1263 icd->formats[idx].name); 1267 icd->formats[idx].name);
1264 } 1268 }
1265 break; 1269 break;
@@ -1271,7 +1275,7 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, int idx,
1271 xlate->cam_fmt = icd->formats + idx; 1275 xlate->cam_fmt = icd->formats + idx;
1272 xlate->buswidth = icd->formats[idx].depth; 1276 xlate->buswidth = icd->formats[idx].depth;
1273 xlate++; 1277 xlate++;
1274 dev_dbg(ici->v4l2_dev.dev, 1278 dev_dbg(dev,
1275 "Providing format %s in pass-through mode\n", 1279 "Providing format %s in pass-through mode\n",
1276 icd->formats[idx].name); 1280 icd->formats[idx].name);
1277 } 1281 }
@@ -1286,6 +1290,7 @@ static int pxa_camera_set_crop(struct soc_camera_device *icd,
1286 struct v4l2_rect *rect = &a->c; 1290 struct v4l2_rect *rect = &a->c;
1287 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); 1291 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
1288 struct pxa_camera_dev *pcdev = ici->priv; 1292 struct pxa_camera_dev *pcdev = ici->priv;
1293 struct device *dev = icd->dev.parent;
1289 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); 1294 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
1290 struct soc_camera_sense sense = { 1295 struct soc_camera_sense sense = {
1291 .master_clock = pcdev->mclk, 1296 .master_clock = pcdev->mclk,
@@ -1302,11 +1307,11 @@ static int pxa_camera_set_crop(struct soc_camera_device *icd,
1302 icd->sense = NULL; 1307 icd->sense = NULL;
1303 1308
1304 if (ret < 0) { 1309 if (ret < 0) {
1305 dev_warn(ici->v4l2_dev.dev, "Failed to crop to %ux%u@%u:%u\n", 1310 dev_warn(dev, "Failed to crop to %ux%u@%u:%u\n",
1306 rect->width, rect->height, rect->left, rect->top); 1311 rect->width, rect->height, rect->left, rect->top);
1307 } else if (sense.flags & SOCAM_SENSE_PCLK_CHANGED) { 1312 } else if (sense.flags & SOCAM_SENSE_PCLK_CHANGED) {
1308 if (sense.pixel_clock > sense.pixel_clock_max) { 1313 if (sense.pixel_clock > sense.pixel_clock_max) {
1309 dev_err(ici->v4l2_dev.dev, 1314 dev_err(dev,
1310 "pixel clock %lu set by the camera too high!", 1315 "pixel clock %lu set by the camera too high!",
1311 sense.pixel_clock); 1316 sense.pixel_clock);
1312 return -EIO; 1317 return -EIO;
@@ -1322,6 +1327,7 @@ static int pxa_camera_set_fmt(struct soc_camera_device *icd,
1322{ 1327{
1323 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); 1328 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
1324 struct pxa_camera_dev *pcdev = ici->priv; 1329 struct pxa_camera_dev *pcdev = ici->priv;
1330 struct device *dev = icd->dev.parent;
1325 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); 1331 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
1326 const struct soc_camera_data_format *cam_fmt = NULL; 1332 const struct soc_camera_data_format *cam_fmt = NULL;
1327 const struct soc_camera_format_xlate *xlate = NULL; 1333 const struct soc_camera_format_xlate *xlate = NULL;
@@ -1335,7 +1341,7 @@ static int pxa_camera_set_fmt(struct soc_camera_device *icd,
1335 1341
1336 xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); 1342 xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat);
1337 if (!xlate) { 1343 if (!xlate) {
1338 dev_warn(ici->v4l2_dev.dev, "Format %x not found\n", pix->pixelformat); 1344 dev_warn(dev, "Format %x not found\n", pix->pixelformat);
1339 return -EINVAL; 1345 return -EINVAL;
1340 } 1346 }
1341 1347
@@ -1351,11 +1357,11 @@ static int pxa_camera_set_fmt(struct soc_camera_device *icd,
1351 icd->sense = NULL; 1357 icd->sense = NULL;
1352 1358
1353 if (ret < 0) { 1359 if (ret < 0) {
1354 dev_warn(ici->v4l2_dev.dev, "Failed to configure for format %x\n", 1360 dev_warn(dev, "Failed to configure for format %x\n",
1355 pix->pixelformat); 1361 pix->pixelformat);
1356 } else if (sense.flags & SOCAM_SENSE_PCLK_CHANGED) { 1362 } else if (sense.flags & SOCAM_SENSE_PCLK_CHANGED) {
1357 if (sense.pixel_clock > sense.pixel_clock_max) { 1363 if (sense.pixel_clock > sense.pixel_clock_max) {
1358 dev_err(ici->v4l2_dev.dev, 1364 dev_err(dev,
1359 "pixel clock %lu set by the camera too high!", 1365 "pixel clock %lu set by the camera too high!",
1360 sense.pixel_clock); 1366 sense.pixel_clock);
1361 return -EIO; 1367 return -EIO;
@@ -1413,7 +1419,7 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd,
1413 if (field == V4L2_FIELD_ANY) { 1419 if (field == V4L2_FIELD_ANY) {
1414 pix->field = V4L2_FIELD_NONE; 1420 pix->field = V4L2_FIELD_NONE;
1415 } else if (field != V4L2_FIELD_NONE) { 1421 } else if (field != V4L2_FIELD_NONE) {
1416 dev_err(&icd->dev, "Field type %d unsupported.\n", field); 1422 dev_err(icd->dev.parent, "Field type %d unsupported.\n", field);
1417 return -EINVAL; 1423 return -EINVAL;
1418 } 1424 }
1419 1425
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c
index 28c3affe8828..3457bababd36 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -167,7 +167,7 @@ static int sh_mobile_ceu_videobuf_setup(struct videobuf_queue *vq,
167 (*count)--; 167 (*count)--;
168 } 168 }
169 169
170 dev_dbg(&icd->dev, "count=%d, size=%d\n", *count, *size); 170 dev_dbg(icd->dev.parent, "count=%d, size=%d\n", *count, *size);
171 171
172 return 0; 172 return 0;
173} 173}
@@ -177,7 +177,7 @@ static void free_buffer(struct videobuf_queue *vq,
177{ 177{
178 struct soc_camera_device *icd = vq->priv_data; 178 struct soc_camera_device *icd = vq->priv_data;
179 179
180 dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %zd\n", __func__, 180 dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %zd\n", __func__,
181 &buf->vb, buf->vb.baddr, buf->vb.bsize); 181 &buf->vb, buf->vb.baddr, buf->vb.bsize);
182 182
183 if (in_interrupt()) 183 if (in_interrupt())
@@ -185,7 +185,7 @@ static void free_buffer(struct videobuf_queue *vq,
185 185
186 videobuf_waiton(&buf->vb, 0, 0); 186 videobuf_waiton(&buf->vb, 0, 0);
187 videobuf_dma_contig_free(vq, &buf->vb); 187 videobuf_dma_contig_free(vq, &buf->vb);
188 dev_dbg(&icd->dev, "%s freed\n", __func__); 188 dev_dbg(icd->dev.parent, "%s freed\n", __func__);
189 buf->vb.state = VIDEOBUF_NEEDS_INIT; 189 buf->vb.state = VIDEOBUF_NEEDS_INIT;
190} 190}
191 191
@@ -249,7 +249,7 @@ static int sh_mobile_ceu_videobuf_prepare(struct videobuf_queue *vq,
249 249
250 buf = container_of(vb, struct sh_mobile_ceu_buffer, vb); 250 buf = container_of(vb, struct sh_mobile_ceu_buffer, vb);
251 251
252 dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %zd\n", __func__, 252 dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %zd\n", __func__,
253 vb, vb->baddr, vb->bsize); 253 vb, vb->baddr, vb->bsize);
254 254
255 /* Added list head initialization on alloc */ 255 /* Added list head initialization on alloc */
@@ -302,7 +302,7 @@ static void sh_mobile_ceu_videobuf_queue(struct videobuf_queue *vq,
302 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); 302 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
303 struct sh_mobile_ceu_dev *pcdev = ici->priv; 303 struct sh_mobile_ceu_dev *pcdev = ici->priv;
304 304
305 dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %zd\n", __func__, 305 dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %zd\n", __func__,
306 vb, vb->baddr, vb->bsize); 306 vb, vb->baddr, vb->bsize);
307 307
308 vb->state = VIDEOBUF_QUEUED; 308 vb->state = VIDEOBUF_QUEUED;
@@ -391,7 +391,7 @@ static int sh_mobile_ceu_add_device(struct soc_camera_device *icd)
391 if (pcdev->icd) 391 if (pcdev->icd)
392 return -EBUSY; 392 return -EBUSY;
393 393
394 dev_info(&icd->dev, 394 dev_info(icd->dev.parent,
395 "SuperH Mobile CEU driver attached to camera %d\n", 395 "SuperH Mobile CEU driver attached to camera %d\n",
396 icd->devnum); 396 icd->devnum);
397 397
@@ -431,7 +431,7 @@ static void sh_mobile_ceu_remove_device(struct soc_camera_device *icd)
431 431
432 clk_disable(pcdev->clk); 432 clk_disable(pcdev->clk);
433 433
434 dev_info(&icd->dev, 434 dev_info(icd->dev.parent,
435 "SuperH Mobile CEU driver detached from camera %d\n", 435 "SuperH Mobile CEU driver detached from camera %d\n",
436 icd->devnum); 436 icd->devnum);
437 437
@@ -497,7 +497,7 @@ static void sh_mobile_ceu_set_rect(struct soc_camera_device *icd,
497 left = size_src(rect->left, hscale); 497 left = size_src(rect->left, hscale);
498 top = size_src(rect->top, vscale); 498 top = size_src(rect->top, vscale);
499 499
500 dev_dbg(&icd->dev, "Left %u * 0x%x = %u, top %u * 0x%x = %u\n", 500 dev_dbg(icd->dev.parent, "Left %u * 0x%x = %u, top %u * 0x%x = %u\n",
501 rect->left, hscale, left, rect->top, vscale, top); 501 rect->left, hscale, left, rect->top, vscale, top);
502 502
503 if (left > cam->camera_rect.left) { 503 if (left > cam->camera_rect.left) {
@@ -514,7 +514,7 @@ static void sh_mobile_ceu_set_rect(struct soc_camera_device *icd,
514 top = cam->camera_rect.top; 514 top = cam->camera_rect.top;
515 } 515 }
516 516
517 dev_dbg(&icd->dev, "New left %u, top %u, offsets %u:%u\n", 517 dev_dbg(icd->dev.parent, "New left %u, top %u, offsets %u:%u\n",
518 rect->left, rect->top, left_offset, top_offset); 518 rect->left, rect->top, left_offset, top_offset);
519 519
520 if (pcdev->image_mode) { 520 if (pcdev->image_mode) {
@@ -687,7 +687,7 @@ static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd,
687 ceu_write(pcdev, CDOCR, value); 687 ceu_write(pcdev, CDOCR, value);
688 ceu_write(pcdev, CFWCR, 0); /* keep "datafetch firewall" disabled */ 688 ceu_write(pcdev, CFWCR, 0); /* keep "datafetch firewall" disabled */
689 689
690 dev_dbg(&icd->dev, "S_FMT successful for %c%c%c%c %ux%u@%u:%u\n", 690 dev_dbg(icd->dev.parent, "S_FMT successful for %c%c%c%c %ux%u@%u:%u\n",
691 pixfmt & 0xff, (pixfmt >> 8) & 0xff, 691 pixfmt & 0xff, (pixfmt >> 8) & 0xff,
692 (pixfmt >> 16) & 0xff, (pixfmt >> 24) & 0xff, 692 (pixfmt >> 16) & 0xff, (pixfmt >> 24) & 0xff,
693 icd->rect_current.width, icd->rect_current.height, 693 icd->rect_current.width, icd->rect_current.height,
@@ -744,7 +744,6 @@ static const struct soc_camera_data_format sh_mobile_ceu_formats[] = {
744static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, int idx, 744static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, int idx,
745 struct soc_camera_format_xlate *xlate) 745 struct soc_camera_format_xlate *xlate)
746{ 746{
747 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
748 int ret, k, n; 747 int ret, k, n;
749 int formats = 0; 748 int formats = 0;
750 struct sh_mobile_ceu_cam *cam; 749 struct sh_mobile_ceu_cam *cam;
@@ -794,7 +793,8 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, int idx,
794 xlate->cam_fmt = icd->formats + idx; 793 xlate->cam_fmt = icd->formats + idx;
795 xlate->buswidth = icd->formats[idx].depth; 794 xlate->buswidth = icd->formats[idx].depth;
796 xlate++; 795 xlate++;
797 dev_dbg(ici->v4l2_dev.dev, "Providing format %s using %s\n", 796 dev_dbg(icd->dev.parent,
797 "Providing format %s using %s\n",
798 sh_mobile_ceu_formats[k].name, 798 sh_mobile_ceu_formats[k].name,
799 icd->formats[idx].name); 799 icd->formats[idx].name);
800 } 800 }
@@ -807,7 +807,7 @@ add_single_format:
807 xlate->cam_fmt = icd->formats + idx; 807 xlate->cam_fmt = icd->formats + idx;
808 xlate->buswidth = icd->formats[idx].depth; 808 xlate->buswidth = icd->formats[idx].depth;
809 xlate++; 809 xlate++;
810 dev_dbg(ici->v4l2_dev.dev, 810 dev_dbg(icd->dev.parent,
811 "Providing format %s in pass-through mode\n", 811 "Providing format %s in pass-through mode\n",
812 icd->formats[idx].name); 812 icd->formats[idx].name);
813 } 813 }
@@ -870,19 +870,21 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
870 target = *cam_rect; 870 target = *cam_rect;
871 871
872 capsr = capture_save_reset(pcdev); 872 capsr = capture_save_reset(pcdev);
873 dev_dbg(&icd->dev, "CAPSR 0x%x, CFLCR 0x%x\n", capsr, pcdev->cflcr); 873 dev_dbg(icd->dev.parent, "CAPSR 0x%x, CFLCR 0x%x\n",
874 capsr, pcdev->cflcr);
874 875
875 /* First attempt - see if the client can deliver a perfect result */ 876 /* First attempt - see if the client can deliver a perfect result */
876 ret = v4l2_subdev_call(sd, video, s_crop, &cam_crop); 877 ret = v4l2_subdev_call(sd, video, s_crop, &cam_crop);
877 if (!ret && !memcmp(&target, &cam_rect, sizeof(target))) { 878 if (!ret && !memcmp(&target, &cam_rect, sizeof(target))) {
878 dev_dbg(&icd->dev, "Camera S_CROP successful for %ux%u@%u:%u\n", 879 dev_dbg(icd->dev.parent,
880 "Camera S_CROP successful for %ux%u@%u:%u\n",
879 cam_rect->width, cam_rect->height, 881 cam_rect->width, cam_rect->height,
880 cam_rect->left, cam_rect->top); 882 cam_rect->left, cam_rect->top);
881 goto ceu_set_rect; 883 goto ceu_set_rect;
882 } 884 }
883 885
884 /* Try to fix cropping, that camera hasn't managed to do */ 886 /* Try to fix cropping, that camera hasn't managed to do */
885 dev_dbg(&icd->dev, "Fix camera S_CROP %d for %ux%u@%u:%u" 887 dev_dbg(icd->dev.parent, "Fix camera S_CROP %d for %ux%u@%u:%u"
886 " to %ux%u@%u:%u\n", 888 " to %ux%u@%u:%u\n",
887 ret, cam_rect->width, cam_rect->height, 889 ret, cam_rect->width, cam_rect->height,
888 cam_rect->left, cam_rect->top, 890 cam_rect->left, cam_rect->top,
@@ -933,7 +935,7 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
933 cam_rect->height, cam_max.top); 935 cam_rect->height, cam_max.top);
934 936
935 ret = v4l2_subdev_call(sd, video, s_crop, &cam_crop); 937 ret = v4l2_subdev_call(sd, video, s_crop, &cam_crop);
936 dev_dbg(&icd->dev, "Camera S_CROP %d for %ux%u@%u:%u\n", 938 dev_dbg(icd->dev.parent, "Camera S_CROP %d for %ux%u@%u:%u\n",
937 ret, cam_rect->width, cam_rect->height, 939 ret, cam_rect->width, cam_rect->height,
938 cam_rect->left, cam_rect->top); 940 cam_rect->left, cam_rect->top);
939 } 941 }
@@ -951,7 +953,8 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
951 */ 953 */
952 *cam_rect = cam_max; 954 *cam_rect = cam_max;
953 ret = v4l2_subdev_call(sd, video, s_crop, &cam_crop); 955 ret = v4l2_subdev_call(sd, video, s_crop, &cam_crop);
954 dev_dbg(&icd->dev, "Camera S_CROP %d for max %ux%u@%u:%u\n", 956 dev_dbg(icd->dev.parent,
957 "Camera S_CROP %d for max %ux%u@%u:%u\n",
955 ret, cam_rect->width, cam_rect->height, 958 ret, cam_rect->width, cam_rect->height,
956 cam_rect->left, cam_rect->top); 959 cam_rect->left, cam_rect->top);
957 if (ret < 0 && ret != -ENOIOCTLCMD) 960 if (ret < 0 && ret != -ENOIOCTLCMD)
@@ -979,7 +982,7 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
979 * last before last close() _user_ rectangle, which can be different 982 * last before last close() _user_ rectangle, which can be different
980 * from camera rectangle. 983 * from camera rectangle.
981 */ 984 */
982 dev_dbg(&icd->dev, 985 dev_dbg(icd->dev.parent,
983 "SH S_CROP from %ux%u@%u:%u to %ux%u@%u:%u, scale to %ux%u@%u:%u\n", 986 "SH S_CROP from %ux%u@%u:%u to %ux%u@%u:%u, scale to %ux%u@%u:%u\n",
984 cam_rect->width, cam_rect->height, cam_rect->left, cam_rect->top, 987 cam_rect->width, cam_rect->height, cam_rect->left, cam_rect->top,
985 target.width, target.height, target.left, target.top, 988 target.width, target.height, target.left, target.top,
@@ -1037,14 +1040,15 @@ static int sh_mobile_ceu_set_fmt(struct soc_camera_device *icd,
1037 1040
1038 xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); 1041 xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
1039 if (!xlate) { 1042 if (!xlate) {
1040 dev_warn(ici->v4l2_dev.dev, "Format %x not found\n", pixfmt); 1043 dev_warn(icd->dev.parent, "Format %x not found\n", pixfmt);
1041 return -EINVAL; 1044 return -EINVAL;
1042 } 1045 }
1043 1046
1044 pix->pixelformat = xlate->cam_fmt->fourcc; 1047 pix->pixelformat = xlate->cam_fmt->fourcc;
1045 ret = v4l2_subdev_call(sd, video, s_fmt, f); 1048 ret = v4l2_subdev_call(sd, video, s_fmt, f);
1046 pix->pixelformat = pixfmt; 1049 pix->pixelformat = pixfmt;
1047 dev_dbg(&icd->dev, "Camera %d fmt %ux%u, requested %ux%u, max %ux%u\n", 1050 dev_dbg(icd->dev.parent,
1051 "Camera %d fmt %ux%u, requested %ux%u, max %ux%u\n",
1048 ret, pix->width, pix->height, width, height, 1052 ret, pix->width, pix->height, width, height,
1049 icd->rect_max.width, icd->rect_max.height); 1053 icd->rect_max.width, icd->rect_max.height);
1050 if (ret < 0) 1054 if (ret < 0)
@@ -1084,12 +1088,12 @@ static int sh_mobile_ceu_set_fmt(struct soc_camera_device *icd,
1084 pix->pixelformat = xlate->cam_fmt->fourcc; 1088 pix->pixelformat = xlate->cam_fmt->fourcc;
1085 ret = v4l2_subdev_call(sd, video, s_fmt, f); 1089 ret = v4l2_subdev_call(sd, video, s_fmt, f);
1086 pix->pixelformat = pixfmt; 1090 pix->pixelformat = pixfmt;
1087 dev_dbg(&icd->dev, "Camera scaled to %ux%u\n", 1091 dev_dbg(icd->dev.parent, "Camera scaled to %ux%u\n",
1088 pix->width, pix->height); 1092 pix->width, pix->height);
1089 if (ret < 0) { 1093 if (ret < 0) {
1090 /* This shouldn't happen */ 1094 /* This shouldn't happen */
1091 dev_err(&icd->dev, "Client failed to set format: %d\n", 1095 dev_err(icd->dev.parent,
1092 ret); 1096 "Client failed to set format: %d\n", ret);
1093 return ret; 1097 return ret;
1094 } 1098 }
1095 } 1099 }
@@ -1105,7 +1109,7 @@ static int sh_mobile_ceu_set_fmt(struct soc_camera_device *icd,
1105 hscale = calc_scale(pix->width, &width); 1109 hscale = calc_scale(pix->width, &width);
1106 vscale = calc_scale(pix->height, &height); 1110 vscale = calc_scale(pix->height, &height);
1107 1111
1108 dev_dbg(&icd->dev, "W: %u : 0x%x = %u, H: %u : 0x%x = %u\n", 1112 dev_dbg(icd->dev.parent, "W: %u : 0x%x = %u, H: %u : 0x%x = %u\n",
1109 pix->width, hscale, width, pix->height, vscale, height); 1113 pix->width, hscale, width, pix->height, vscale, height);
1110 1114
1111out: 1115out:
@@ -1136,7 +1140,6 @@ out:
1136static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, 1140static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
1137 struct v4l2_format *f) 1141 struct v4l2_format *f)
1138{ 1142{
1139 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
1140 const struct soc_camera_format_xlate *xlate; 1143 const struct soc_camera_format_xlate *xlate;
1141 struct v4l2_pix_format *pix = &f->fmt.pix; 1144 struct v4l2_pix_format *pix = &f->fmt.pix;
1142 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); 1145 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
@@ -1146,7 +1149,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
1146 1149
1147 xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); 1150 xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
1148 if (!xlate) { 1151 if (!xlate) {
1149 dev_warn(ici->v4l2_dev.dev, "Format %x not found\n", pixfmt); 1152 dev_warn(icd->dev.parent, "Format %x not found\n", pixfmt);
1150 return -EINVAL; 1153 return -EINVAL;
1151 } 1154 }
1152 1155
@@ -1184,7 +1187,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
1184 ret = v4l2_subdev_call(sd, video, try_fmt, f); 1187 ret = v4l2_subdev_call(sd, video, try_fmt, f);
1185 if (ret < 0) { 1188 if (ret < 0) {
1186 /* Shouldn't actually happen... */ 1189 /* Shouldn't actually happen... */
1187 dev_err(&icd->dev, 1190 dev_err(icd->dev.parent,
1188 "FIXME: try_fmt() returned %d\n", ret); 1191 "FIXME: try_fmt() returned %d\n", ret);
1189 pix->width = tmp_w; 1192 pix->width = tmp_w;
1190 pix->height = tmp_h; 1193 pix->height = tmp_h;
@@ -1253,7 +1256,7 @@ static void sh_mobile_ceu_init_videobuf(struct videobuf_queue *q,
1253 1256
1254 videobuf_queue_dma_contig_init(q, 1257 videobuf_queue_dma_contig_init(q,
1255 &sh_mobile_ceu_videobuf_ops, 1258 &sh_mobile_ceu_videobuf_ops,
1256 ici->v4l2_dev.dev, &pcdev->lock, 1259 icd->dev.parent, &pcdev->lock,
1257 V4L2_BUF_TYPE_VIDEO_CAPTURE, 1260 V4L2_BUF_TYPE_VIDEO_CAPTURE,
1258 pcdev->is_interlaced ? 1261 pcdev->is_interlaced ?
1259 V4L2_FIELD_INTERLACED : V4L2_FIELD_NONE, 1262 V4L2_FIELD_INTERLACED : V4L2_FIELD_NONE,