diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2011-07-15 19:03:38 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-07-27 16:56:08 -0400 |
commit | 7dfff95366f48bf66f77c17cdc9ebd8be696ac5d (patch) | |
tree | c4cb975f5b8b8c3008921d38fa6e4deed9c8dbc9 /drivers/media | |
parent | d33b290a149dafe2e3cc2901ec726bea09a2c0f4 (diff) |
[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: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/atmel-isi.c | 64 | ||||
-rw-r--r-- | drivers/media/video/mt9m001.c | 14 | ||||
-rw-r--r-- | drivers/media/video/mt9m111.c | 10 | ||||
-rw-r--r-- | drivers/media/video/mt9t031.c | 3 | ||||
-rw-r--r-- | drivers/media/video/mt9t112.c | 10 | ||||
-rw-r--r-- | drivers/media/video/mt9v022.c | 10 | ||||
-rw-r--r-- | drivers/media/video/mx1_camera.c | 42 | ||||
-rw-r--r-- | drivers/media/video/mx2_camera.c | 46 | ||||
-rw-r--r-- | drivers/media/video/mx3_camera.c | 56 | ||||
-rw-r--r-- | drivers/media/video/omap1_camera.c | 52 | ||||
-rw-r--r-- | drivers/media/video/ov2640.c | 13 | ||||
-rw-r--r-- | drivers/media/video/ov772x.c | 10 | ||||
-rw-r--r-- | drivers/media/video/ov9640.c | 13 | ||||
-rw-r--r-- | drivers/media/video/ov9740.c | 13 | ||||
-rw-r--r-- | drivers/media/video/pxa_camera.c | 46 | ||||
-rw-r--r-- | drivers/media/video/rj54n1cb0c.c | 7 | ||||
-rw-r--r-- | drivers/media/video/sh_mobile_ceu_camera.c | 74 | ||||
-rw-r--r-- | drivers/media/video/soc_camera.c | 234 | ||||
-rw-r--r-- | drivers/media/video/soc_camera_platform.c | 10 | ||||
-rw-r--r-- | drivers/media/video/tw9910.c | 10 |
20 files changed, 309 insertions, 428 deletions
diff --git a/drivers/media/video/atmel-isi.c b/drivers/media/video/atmel-isi.c index 4742c2837eb..7b89f00501b 100644 --- a/drivers/media/video/atmel-isi.c +++ b/drivers/media/video/atmel-isi.c | |||
@@ -253,7 +253,7 @@ static int queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, | |||
253 | void *alloc_ctxs[]) | 253 | void *alloc_ctxs[]) |
254 | { | 254 | { |
255 | struct soc_camera_device *icd = soc_camera_from_vb2q(vq); | 255 | struct soc_camera_device *icd = soc_camera_from_vb2q(vq); |
256 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 256 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
257 | struct atmel_isi *isi = ici->priv; | 257 | struct atmel_isi *isi = ici->priv; |
258 | unsigned long size; | 258 | unsigned long size; |
259 | int ret, bytes_per_line; | 259 | int ret, bytes_per_line; |
@@ -261,7 +261,7 @@ static int queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, | |||
261 | /* Reset ISI */ | 261 | /* Reset ISI */ |
262 | ret = atmel_isi_wait_status(isi, WAIT_ISI_RESET); | 262 | ret = atmel_isi_wait_status(isi, WAIT_ISI_RESET); |
263 | if (ret < 0) { | 263 | if (ret < 0) { |
264 | dev_err(icd->dev.parent, "Reset ISI timed out\n"); | 264 | dev_err(icd->parent, "Reset ISI timed out\n"); |
265 | return ret; | 265 | return ret; |
266 | } | 266 | } |
267 | /* Disable all interrupts */ | 267 | /* Disable all interrupts */ |
@@ -288,7 +288,7 @@ static int queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, | |||
288 | isi->sequence = 0; | 288 | isi->sequence = 0; |
289 | isi->active = NULL; | 289 | isi->active = NULL; |
290 | 290 | ||
291 | dev_dbg(icd->dev.parent, "%s, count=%d, size=%ld\n", __func__, | 291 | dev_dbg(icd->parent, "%s, count=%d, size=%ld\n", __func__, |
292 | *nbuffers, size); | 292 | *nbuffers, size); |
293 | 293 | ||
294 | return 0; | 294 | return 0; |
@@ -308,7 +308,7 @@ static int buffer_prepare(struct vb2_buffer *vb) | |||
308 | { | 308 | { |
309 | struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); | 309 | struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); |
310 | struct frame_buffer *buf = container_of(vb, struct frame_buffer, vb); | 310 | struct frame_buffer *buf = container_of(vb, struct frame_buffer, vb); |
311 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 311 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
312 | struct atmel_isi *isi = ici->priv; | 312 | struct atmel_isi *isi = ici->priv; |
313 | unsigned long size; | 313 | unsigned long size; |
314 | struct isi_dma_desc *desc; | 314 | struct isi_dma_desc *desc; |
@@ -321,7 +321,7 @@ static int buffer_prepare(struct vb2_buffer *vb) | |||
321 | size = bytes_per_line * icd->user_height; | 321 | size = bytes_per_line * icd->user_height; |
322 | 322 | ||
323 | if (vb2_plane_size(vb, 0) < size) { | 323 | if (vb2_plane_size(vb, 0) < size) { |
324 | dev_err(icd->dev.parent, "%s data will not fit into plane (%lu < %lu)\n", | 324 | dev_err(icd->parent, "%s data will not fit into plane (%lu < %lu)\n", |
325 | __func__, vb2_plane_size(vb, 0), size); | 325 | __func__, vb2_plane_size(vb, 0), size); |
326 | return -EINVAL; | 326 | return -EINVAL; |
327 | } | 327 | } |
@@ -330,7 +330,7 @@ static int buffer_prepare(struct vb2_buffer *vb) | |||
330 | 330 | ||
331 | if (!buf->p_dma_desc) { | 331 | if (!buf->p_dma_desc) { |
332 | if (list_empty(&isi->dma_desc_head)) { | 332 | if (list_empty(&isi->dma_desc_head)) { |
333 | dev_err(icd->dev.parent, "Not enough dma descriptors.\n"); | 333 | dev_err(icd->parent, "Not enough dma descriptors.\n"); |
334 | return -EINVAL; | 334 | return -EINVAL; |
335 | } else { | 335 | } else { |
336 | /* Get an available descriptor */ | 336 | /* Get an available descriptor */ |
@@ -354,7 +354,7 @@ static int buffer_prepare(struct vb2_buffer *vb) | |||
354 | static void buffer_cleanup(struct vb2_buffer *vb) | 354 | static void buffer_cleanup(struct vb2_buffer *vb) |
355 | { | 355 | { |
356 | struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); | 356 | struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); |
357 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 357 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
358 | struct atmel_isi *isi = ici->priv; | 358 | struct atmel_isi *isi = ici->priv; |
359 | struct frame_buffer *buf = container_of(vb, struct frame_buffer, vb); | 359 | struct frame_buffer *buf = container_of(vb, struct frame_buffer, vb); |
360 | 360 | ||
@@ -374,7 +374,7 @@ static void start_dma(struct atmel_isi *isi, struct frame_buffer *buffer) | |||
374 | 374 | ||
375 | /* Check if already in a frame */ | 375 | /* Check if already in a frame */ |
376 | if (isi_readl(isi, ISI_STATUS) & ISI_CTRL_CDC) { | 376 | if (isi_readl(isi, ISI_STATUS) & ISI_CTRL_CDC) { |
377 | dev_err(isi->icd->dev.parent, "Already in frame handling.\n"); | 377 | dev_err(isi->icd->parent, "Already in frame handling.\n"); |
378 | return; | 378 | return; |
379 | } | 379 | } |
380 | 380 | ||
@@ -394,7 +394,7 @@ static void start_dma(struct atmel_isi *isi, struct frame_buffer *buffer) | |||
394 | static void buffer_queue(struct vb2_buffer *vb) | 394 | static void buffer_queue(struct vb2_buffer *vb) |
395 | { | 395 | { |
396 | struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); | 396 | struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); |
397 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 397 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
398 | struct atmel_isi *isi = ici->priv; | 398 | struct atmel_isi *isi = ici->priv; |
399 | struct frame_buffer *buf = container_of(vb, struct frame_buffer, vb); | 399 | struct frame_buffer *buf = container_of(vb, struct frame_buffer, vb); |
400 | unsigned long flags = 0; | 400 | unsigned long flags = 0; |
@@ -412,7 +412,7 @@ static void buffer_queue(struct vb2_buffer *vb) | |||
412 | static int start_streaming(struct vb2_queue *vq) | 412 | static int start_streaming(struct vb2_queue *vq) |
413 | { | 413 | { |
414 | struct soc_camera_device *icd = soc_camera_from_vb2q(vq); | 414 | struct soc_camera_device *icd = soc_camera_from_vb2q(vq); |
415 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 415 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
416 | struct atmel_isi *isi = ici->priv; | 416 | struct atmel_isi *isi = ici->priv; |
417 | 417 | ||
418 | u32 sr = 0; | 418 | u32 sr = 0; |
@@ -427,7 +427,7 @@ static int start_streaming(struct vb2_queue *vq) | |||
427 | isi_writel(isi, ISI_CTRL, ISI_CTRL_EN); | 427 | isi_writel(isi, ISI_CTRL, ISI_CTRL_EN); |
428 | spin_unlock_irq(&isi->lock); | 428 | spin_unlock_irq(&isi->lock); |
429 | 429 | ||
430 | dev_dbg(icd->dev.parent, "Waiting for SOF\n"); | 430 | dev_dbg(icd->parent, "Waiting for SOF\n"); |
431 | ret = wait_event_interruptible(isi->vsync_wq, | 431 | ret = wait_event_interruptible(isi->vsync_wq, |
432 | isi->state != ISI_STATE_IDLE); | 432 | isi->state != ISI_STATE_IDLE); |
433 | if (ret) | 433 | if (ret) |
@@ -448,7 +448,7 @@ static int start_streaming(struct vb2_queue *vq) | |||
448 | static int stop_streaming(struct vb2_queue *vq) | 448 | static int stop_streaming(struct vb2_queue *vq) |
449 | { | 449 | { |
450 | struct soc_camera_device *icd = soc_camera_from_vb2q(vq); | 450 | struct soc_camera_device *icd = soc_camera_from_vb2q(vq); |
451 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 451 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
452 | struct atmel_isi *isi = ici->priv; | 452 | struct atmel_isi *isi = ici->priv; |
453 | struct frame_buffer *buf, *node; | 453 | struct frame_buffer *buf, *node; |
454 | int ret = 0; | 454 | int ret = 0; |
@@ -470,7 +470,7 @@ static int stop_streaming(struct vb2_queue *vq) | |||
470 | msleep(1); | 470 | msleep(1); |
471 | 471 | ||
472 | if (time_after(jiffies, timeout)) { | 472 | if (time_after(jiffies, timeout)) { |
473 | dev_err(icd->dev.parent, | 473 | dev_err(icd->parent, |
474 | "Timeout waiting for finishing codec request\n"); | 474 | "Timeout waiting for finishing codec request\n"); |
475 | return -ETIMEDOUT; | 475 | return -ETIMEDOUT; |
476 | } | 476 | } |
@@ -482,7 +482,7 @@ static int stop_streaming(struct vb2_queue *vq) | |||
482 | /* Disable ISI and wait for it is done */ | 482 | /* Disable ISI and wait for it is done */ |
483 | ret = atmel_isi_wait_status(isi, WAIT_ISI_DISABLE); | 483 | ret = atmel_isi_wait_status(isi, WAIT_ISI_DISABLE); |
484 | if (ret < 0) | 484 | if (ret < 0) |
485 | dev_err(icd->dev.parent, "Disable ISI timed out\n"); | 485 | dev_err(icd->parent, "Disable ISI timed out\n"); |
486 | 486 | ||
487 | return ret; | 487 | return ret; |
488 | } | 488 | } |
@@ -518,7 +518,7 @@ static int isi_camera_init_videobuf(struct vb2_queue *q, | |||
518 | static int isi_camera_set_fmt(struct soc_camera_device *icd, | 518 | static int isi_camera_set_fmt(struct soc_camera_device *icd, |
519 | struct v4l2_format *f) | 519 | struct v4l2_format *f) |
520 | { | 520 | { |
521 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 521 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
522 | struct atmel_isi *isi = ici->priv; | 522 | struct atmel_isi *isi = ici->priv; |
523 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 523 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
524 | const struct soc_camera_format_xlate *xlate; | 524 | const struct soc_camera_format_xlate *xlate; |
@@ -528,12 +528,12 @@ static int isi_camera_set_fmt(struct soc_camera_device *icd, | |||
528 | 528 | ||
529 | xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); | 529 | xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); |
530 | if (!xlate) { | 530 | if (!xlate) { |
531 | dev_warn(icd->dev.parent, "Format %x not found\n", | 531 | dev_warn(icd->parent, "Format %x not found\n", |
532 | pix->pixelformat); | 532 | pix->pixelformat); |
533 | return -EINVAL; | 533 | return -EINVAL; |
534 | } | 534 | } |
535 | 535 | ||
536 | dev_dbg(icd->dev.parent, "Plan to set format %dx%d\n", | 536 | dev_dbg(icd->parent, "Plan to set format %dx%d\n", |
537 | pix->width, pix->height); | 537 | pix->width, pix->height); |
538 | 538 | ||
539 | mf.width = pix->width; | 539 | mf.width = pix->width; |
@@ -559,7 +559,7 @@ static int isi_camera_set_fmt(struct soc_camera_device *icd, | |||
559 | pix->colorspace = mf.colorspace; | 559 | pix->colorspace = mf.colorspace; |
560 | icd->current_fmt = xlate; | 560 | icd->current_fmt = xlate; |
561 | 561 | ||
562 | dev_dbg(icd->dev.parent, "Finally set format %dx%d\n", | 562 | dev_dbg(icd->parent, "Finally set format %dx%d\n", |
563 | pix->width, pix->height); | 563 | pix->width, pix->height); |
564 | 564 | ||
565 | return ret; | 565 | return ret; |
@@ -577,7 +577,7 @@ static int isi_camera_try_fmt(struct soc_camera_device *icd, | |||
577 | 577 | ||
578 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); | 578 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); |
579 | if (pixfmt && !xlate) { | 579 | if (pixfmt && !xlate) { |
580 | dev_warn(icd->dev.parent, "Format %x not found\n", pixfmt); | 580 | dev_warn(icd->parent, "Format %x not found\n", pixfmt); |
581 | return -EINVAL; | 581 | return -EINVAL; |
582 | } | 582 | } |
583 | 583 | ||
@@ -609,7 +609,7 @@ static int isi_camera_try_fmt(struct soc_camera_device *icd, | |||
609 | case V4L2_FIELD_NONE: | 609 | case V4L2_FIELD_NONE: |
610 | break; | 610 | break; |
611 | default: | 611 | default: |
612 | dev_err(icd->dev.parent, "Field type %d unsupported.\n", | 612 | dev_err(icd->parent, "Field type %d unsupported.\n", |
613 | mf.field); | 613 | mf.field); |
614 | ret = -EINVAL; | 614 | ret = -EINVAL; |
615 | } | 615 | } |
@@ -670,7 +670,7 @@ static unsigned long make_bus_param(struct atmel_isi *isi) | |||
670 | static int isi_camera_try_bus_param(struct soc_camera_device *icd, | 670 | static int isi_camera_try_bus_param(struct soc_camera_device *icd, |
671 | unsigned char buswidth) | 671 | unsigned char buswidth) |
672 | { | 672 | { |
673 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 673 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
674 | struct atmel_isi *isi = ici->priv; | 674 | struct atmel_isi *isi = ici->priv; |
675 | unsigned long camera_flags; | 675 | unsigned long camera_flags; |
676 | int ret; | 676 | int ret; |
@@ -702,7 +702,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd, | |||
702 | 702 | ||
703 | fmt = soc_mbus_get_fmtdesc(code); | 703 | fmt = soc_mbus_get_fmtdesc(code); |
704 | if (!fmt) { | 704 | if (!fmt) { |
705 | dev_err(icd->dev.parent, | 705 | dev_err(icd->parent, |
706 | "Invalid format code #%u: %d\n", idx, code); | 706 | "Invalid format code #%u: %d\n", idx, code); |
707 | return 0; | 707 | return 0; |
708 | } | 708 | } |
@@ -710,7 +710,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd, | |||
710 | /* This also checks support for the requested bits-per-sample */ | 710 | /* This also checks support for the requested bits-per-sample */ |
711 | ret = isi_camera_try_bus_param(icd, fmt->bits_per_sample); | 711 | ret = isi_camera_try_bus_param(icd, fmt->bits_per_sample); |
712 | if (ret < 0) { | 712 | if (ret < 0) { |
713 | dev_err(icd->dev.parent, | 713 | dev_err(icd->parent, |
714 | "Fail to try the bus parameters.\n"); | 714 | "Fail to try the bus parameters.\n"); |
715 | return 0; | 715 | return 0; |
716 | } | 716 | } |
@@ -725,7 +725,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd, | |||
725 | xlate->host_fmt = &isi_camera_formats[0]; | 725 | xlate->host_fmt = &isi_camera_formats[0]; |
726 | xlate->code = code; | 726 | xlate->code = code; |
727 | xlate++; | 727 | xlate++; |
728 | dev_dbg(icd->dev.parent, "Providing format %s using code %d\n", | 728 | dev_dbg(icd->parent, "Providing format %s using code %d\n", |
729 | isi_camera_formats[0].name, code); | 729 | isi_camera_formats[0].name, code); |
730 | } | 730 | } |
731 | break; | 731 | break; |
@@ -733,7 +733,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd, | |||
733 | if (!isi_camera_packing_supported(fmt)) | 733 | if (!isi_camera_packing_supported(fmt)) |
734 | return 0; | 734 | return 0; |
735 | if (xlate) | 735 | if (xlate) |
736 | dev_dbg(icd->dev.parent, | 736 | dev_dbg(icd->parent, |
737 | "Providing format %s in pass-through mode\n", | 737 | "Providing format %s in pass-through mode\n", |
738 | fmt->name); | 738 | fmt->name); |
739 | } | 739 | } |
@@ -752,7 +752,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd, | |||
752 | /* Called with .video_lock held */ | 752 | /* Called with .video_lock held */ |
753 | static int isi_camera_add_device(struct soc_camera_device *icd) | 753 | static int isi_camera_add_device(struct soc_camera_device *icd) |
754 | { | 754 | { |
755 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 755 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
756 | struct atmel_isi *isi = ici->priv; | 756 | struct atmel_isi *isi = ici->priv; |
757 | int ret; | 757 | int ret; |
758 | 758 | ||
@@ -764,14 +764,14 @@ static int isi_camera_add_device(struct soc_camera_device *icd) | |||
764 | return ret; | 764 | return ret; |
765 | 765 | ||
766 | isi->icd = icd; | 766 | isi->icd = icd; |
767 | dev_dbg(icd->dev.parent, "Atmel ISI Camera driver attached to camera %d\n", | 767 | dev_dbg(icd->parent, "Atmel ISI Camera driver attached to camera %d\n", |
768 | icd->devnum); | 768 | icd->devnum); |
769 | return 0; | 769 | return 0; |
770 | } | 770 | } |
771 | /* Called with .video_lock held */ | 771 | /* Called with .video_lock held */ |
772 | static void isi_camera_remove_device(struct soc_camera_device *icd) | 772 | static void isi_camera_remove_device(struct soc_camera_device *icd) |
773 | { | 773 | { |
774 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 774 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
775 | struct atmel_isi *isi = ici->priv; | 775 | struct atmel_isi *isi = ici->priv; |
776 | 776 | ||
777 | BUG_ON(icd != isi->icd); | 777 | BUG_ON(icd != isi->icd); |
@@ -779,7 +779,7 @@ static void isi_camera_remove_device(struct soc_camera_device *icd) | |||
779 | clk_disable(isi->pclk); | 779 | clk_disable(isi->pclk); |
780 | isi->icd = NULL; | 780 | isi->icd = NULL; |
781 | 781 | ||
782 | dev_dbg(icd->dev.parent, "Atmel ISI Camera driver detached from camera %d\n", | 782 | dev_dbg(icd->parent, "Atmel ISI Camera driver detached from camera %d\n", |
783 | icd->devnum); | 783 | icd->devnum); |
784 | } | 784 | } |
785 | 785 | ||
@@ -802,7 +802,7 @@ static int isi_camera_querycap(struct soc_camera_host *ici, | |||
802 | 802 | ||
803 | static int isi_camera_set_bus_param(struct soc_camera_device *icd, u32 pixfmt) | 803 | static int isi_camera_set_bus_param(struct soc_camera_device *icd, u32 pixfmt) |
804 | { | 804 | { |
805 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 805 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
806 | struct atmel_isi *isi = ici->priv; | 806 | struct atmel_isi *isi = ici->priv; |
807 | unsigned long bus_flags, camera_flags, common_flags; | 807 | unsigned long bus_flags, camera_flags, common_flags; |
808 | int ret; | 808 | int ret; |
@@ -812,7 +812,7 @@ static int isi_camera_set_bus_param(struct soc_camera_device *icd, u32 pixfmt) | |||
812 | 812 | ||
813 | bus_flags = make_bus_param(isi); | 813 | bus_flags = make_bus_param(isi); |
814 | common_flags = soc_camera_bus_param_compatible(camera_flags, bus_flags); | 814 | common_flags = soc_camera_bus_param_compatible(camera_flags, bus_flags); |
815 | dev_dbg(icd->dev.parent, "Flags cam: 0x%lx host: 0x%lx common: 0x%lx\n", | 815 | dev_dbg(icd->parent, "Flags cam: 0x%lx host: 0x%lx common: 0x%lx\n", |
816 | camera_flags, bus_flags, common_flags); | 816 | camera_flags, bus_flags, common_flags); |
817 | if (!common_flags) | 817 | if (!common_flags) |
818 | return -EINVAL; | 818 | return -EINVAL; |
@@ -844,7 +844,7 @@ static int isi_camera_set_bus_param(struct soc_camera_device *icd, u32 pixfmt) | |||
844 | 844 | ||
845 | ret = icd->ops->set_bus_param(icd, common_flags); | 845 | ret = icd->ops->set_bus_param(icd, common_flags); |
846 | if (ret < 0) { | 846 | if (ret < 0) { |
847 | dev_dbg(icd->dev.parent, "Camera set_bus_param(%lx) returned %d\n", | 847 | dev_dbg(icd->parent, "Camera set_bus_param(%lx) returned %d\n", |
848 | common_flags, ret); | 848 | common_flags, ret); |
849 | return ret; | 849 | return ret; |
850 | } | 850 | } |
diff --git a/drivers/media/video/mt9m001.c b/drivers/media/video/mt9m001.c index e2bbd8c35c9..4da9cca939c 100644 --- a/drivers/media/video/mt9m001.c +++ b/drivers/media/video/mt9m001.c | |||
@@ -603,13 +603,9 @@ static int mt9m001_video_probe(struct soc_camera_device *icd, | |||
603 | unsigned long flags; | 603 | unsigned long flags; |
604 | int ret; | 604 | int ret; |
605 | 605 | ||
606 | /* | 606 | /* We must have a parent by now. And it cannot be a wrong one. */ |
607 | * We must have a parent by now. And it cannot be a wrong one. | 607 | BUG_ON(!icd->parent || |
608 | * So this entire test is completely redundant. | 608 | to_soc_camera_host(icd->parent)->nr != icd->iface); |
609 | */ | ||
610 | if (!icd->dev.parent || | ||
611 | to_soc_camera_host(icd->dev.parent)->nr != icd->iface) | ||
612 | return -ENODEV; | ||
613 | 609 | ||
614 | /* Enable the chip */ | 610 | /* Enable the chip */ |
615 | data = reg_write(client, MT9M001_CHIP_ENABLE, 1); | 611 | data = reg_write(client, MT9M001_CHIP_ENABLE, 1); |
@@ -675,8 +671,8 @@ static void mt9m001_video_remove(struct soc_camera_device *icd) | |||
675 | { | 671 | { |
676 | struct soc_camera_link *icl = to_soc_camera_link(icd); | 672 | struct soc_camera_link *icl = to_soc_camera_link(icd); |
677 | 673 | ||
678 | dev_dbg(&icd->dev, "Video removed: %p, %p\n", | 674 | dev_dbg(icd->pdev, "Video removed: %p, %p\n", |
679 | icd->dev.parent, icd->vdev); | 675 | icd->parent, icd->vdev); |
680 | if (icl->free_bus) | 676 | if (icl->free_bus) |
681 | icl->free_bus(icl); | 677 | icl->free_bus(icl); |
682 | } | 678 | } |
diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c index 7962334a386..cbccc869c7e 100644 --- a/drivers/media/video/mt9m111.c +++ b/drivers/media/video/mt9m111.c | |||
@@ -960,13 +960,9 @@ static int mt9m111_video_probe(struct soc_camera_device *icd, | |||
960 | s32 data; | 960 | s32 data; |
961 | int ret; | 961 | int ret; |
962 | 962 | ||
963 | /* | 963 | /* We must have a parent by now. And it cannot be a wrong one. */ |
964 | * We must have a parent by now. And it cannot be a wrong one. | 964 | BUG_ON(!icd->parent || |
965 | * So this entire test is completely redundant. | 965 | to_soc_camera_host(icd->parent)->nr != icd->iface); |
966 | */ | ||
967 | if (!icd->dev.parent || | ||
968 | to_soc_camera_host(icd->dev.parent)->nr != icd->iface) | ||
969 | return -ENODEV; | ||
970 | 966 | ||
971 | mt9m111->autoexposure = 1; | 967 | mt9m111->autoexposure = 1; |
972 | mt9m111->autowhitebalance = 1; | 968 | mt9m111->autowhitebalance = 1; |
diff --git a/drivers/media/video/mt9t031.c b/drivers/media/video/mt9t031.c index 7ce279c3751..30547cc3f89 100644 --- a/drivers/media/video/mt9t031.c +++ b/drivers/media/video/mt9t031.c | |||
@@ -700,8 +700,7 @@ static int mt9t031_runtime_suspend(struct device *dev) | |||
700 | static int mt9t031_runtime_resume(struct device *dev) | 700 | static int mt9t031_runtime_resume(struct device *dev) |
701 | { | 701 | { |
702 | struct video_device *vdev = to_video_device(dev); | 702 | struct video_device *vdev = to_video_device(dev); |
703 | struct soc_camera_device *icd = container_of(vdev->parent, | 703 | struct soc_camera_device *icd = dev_get_drvdata(vdev->parent); |
704 | struct soc_camera_device, dev); | ||
705 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 704 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
706 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 705 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
707 | struct mt9t031 *mt9t031 = to_mt9t031(client); | 706 | struct mt9t031 *mt9t031 = to_mt9t031(client); |
diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c index bffa9ee1096..d2e0a50063a 100644 --- a/drivers/media/video/mt9t112.c +++ b/drivers/media/video/mt9t112.c | |||
@@ -1057,13 +1057,9 @@ static int mt9t112_camera_probe(struct soc_camera_device *icd, | |||
1057 | const char *devname; | 1057 | const char *devname; |
1058 | int chipid; | 1058 | int chipid; |
1059 | 1059 | ||
1060 | /* | 1060 | /* We must have a parent by now. And it cannot be a wrong one. */ |
1061 | * We must have a parent by now. And it cannot be a wrong one. | 1061 | BUG_ON(!icd->parent || |
1062 | * So this entire test is completely redundant. | 1062 | to_soc_camera_host(icd->parent)->nr != icd->iface); |
1063 | */ | ||
1064 | if (!icd->dev.parent || | ||
1065 | to_soc_camera_host(icd->dev.parent)->nr != icd->iface) | ||
1066 | return -ENODEV; | ||
1067 | 1063 | ||
1068 | /* | 1064 | /* |
1069 | * check and show chip ID | 1065 | * check and show chip ID |
diff --git a/drivers/media/video/mt9v022.c b/drivers/media/video/mt9v022.c index fc76ed1c08e..51b0fccbfe7 100644 --- a/drivers/media/video/mt9v022.c +++ b/drivers/media/video/mt9v022.c | |||
@@ -728,9 +728,9 @@ static int mt9v022_video_probe(struct soc_camera_device *icd, | |||
728 | int ret; | 728 | int ret; |
729 | unsigned long flags; | 729 | unsigned long flags; |
730 | 730 | ||
731 | if (!icd->dev.parent || | 731 | /* We must have a parent by now. And it cannot be a wrong one. */ |
732 | to_soc_camera_host(icd->dev.parent)->nr != icd->iface) | 732 | BUG_ON(!icd->parent || |
733 | return -ENODEV; | 733 | to_soc_camera_host(icd->parent)->nr != icd->iface); |
734 | 734 | ||
735 | /* Read out the chip version register */ | 735 | /* Read out the chip version register */ |
736 | data = reg_read(client, MT9V022_CHIP_VERSION); | 736 | data = reg_read(client, MT9V022_CHIP_VERSION); |
@@ -809,8 +809,8 @@ static void mt9v022_video_remove(struct soc_camera_device *icd) | |||
809 | { | 809 | { |
810 | struct soc_camera_link *icl = to_soc_camera_link(icd); | 810 | struct soc_camera_link *icl = to_soc_camera_link(icd); |
811 | 811 | ||
812 | dev_dbg(&icd->dev, "Video removed: %p, %p\n", | 812 | dev_dbg(icd->pdev, "Video removed: %p, %p\n", |
813 | icd->dev.parent, icd->vdev); | 813 | icd->parent, icd->vdev); |
814 | if (icl->free_bus) | 814 | if (icl->free_bus) |
815 | icl->free_bus(icl); | 815 | icl->free_bus(icl); |
816 | } | 816 | } |
diff --git a/drivers/media/video/mx1_camera.c b/drivers/media/video/mx1_camera.c index 30a1364675c..087db12a3a6 100644 --- a/drivers/media/video/mx1_camera.c +++ b/drivers/media/video/mx1_camera.c | |||
@@ -141,7 +141,7 @@ static int mx1_videobuf_setup(struct videobuf_queue *vq, unsigned int *count, | |||
141 | if (*size * *count > MAX_VIDEO_MEM * 1024 * 1024) | 141 | if (*size * *count > MAX_VIDEO_MEM * 1024 * 1024) |
142 | *count = (MAX_VIDEO_MEM * 1024 * 1024) / *size; | 142 | *count = (MAX_VIDEO_MEM * 1024 * 1024) / *size; |
143 | 143 | ||
144 | dev_dbg(icd->dev.parent, "count=%d, size=%d\n", *count, *size); | 144 | dev_dbg(icd->parent, "count=%d, size=%d\n", *count, *size); |
145 | 145 | ||
146 | return 0; | 146 | return 0; |
147 | } | 147 | } |
@@ -153,7 +153,7 @@ static void free_buffer(struct videobuf_queue *vq, struct mx1_buffer *buf) | |||
153 | 153 | ||
154 | BUG_ON(in_interrupt()); | 154 | BUG_ON(in_interrupt()); |
155 | 155 | ||
156 | dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, | 156 | dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, |
157 | vb, vb->baddr, vb->bsize); | 157 | vb, vb->baddr, vb->bsize); |
158 | 158 | ||
159 | /* | 159 | /* |
@@ -178,7 +178,7 @@ static int mx1_videobuf_prepare(struct videobuf_queue *vq, | |||
178 | if (bytes_per_line < 0) | 178 | if (bytes_per_line < 0) |
179 | return bytes_per_line; | 179 | return bytes_per_line; |
180 | 180 | ||
181 | dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, | 181 | dev_dbg(icd->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 | /* Added list head initialization on alloc */ | 184 | /* Added list head initialization on alloc */ |
@@ -231,7 +231,7 @@ out: | |||
231 | static int mx1_camera_setup_dma(struct mx1_camera_dev *pcdev) | 231 | static int mx1_camera_setup_dma(struct mx1_camera_dev *pcdev) |
232 | { | 232 | { |
233 | struct videobuf_buffer *vbuf = &pcdev->active->vb; | 233 | struct videobuf_buffer *vbuf = &pcdev->active->vb; |
234 | struct device *dev = pcdev->icd->dev.parent; | 234 | struct device *dev = pcdev->icd->parent; |
235 | int ret; | 235 | int ret; |
236 | 236 | ||
237 | if (unlikely(!pcdev->active)) { | 237 | if (unlikely(!pcdev->active)) { |
@@ -255,11 +255,11 @@ static void mx1_videobuf_queue(struct videobuf_queue *vq, | |||
255 | struct videobuf_buffer *vb) | 255 | struct videobuf_buffer *vb) |
256 | { | 256 | { |
257 | struct soc_camera_device *icd = vq->priv_data; | 257 | struct soc_camera_device *icd = vq->priv_data; |
258 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 258 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
259 | struct mx1_camera_dev *pcdev = ici->priv; | 259 | struct mx1_camera_dev *pcdev = ici->priv; |
260 | struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb); | 260 | struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb); |
261 | 261 | ||
262 | dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, | 262 | dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, |
263 | vb, vb->baddr, vb->bsize); | 263 | vb, vb->baddr, vb->bsize); |
264 | 264 | ||
265 | list_add_tail(&vb->queue, &pcdev->capture); | 265 | list_add_tail(&vb->queue, &pcdev->capture); |
@@ -286,7 +286,7 @@ static void mx1_videobuf_release(struct videobuf_queue *vq, | |||
286 | struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb); | 286 | struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb); |
287 | #ifdef DEBUG | 287 | #ifdef DEBUG |
288 | struct soc_camera_device *icd = vq->priv_data; | 288 | struct soc_camera_device *icd = vq->priv_data; |
289 | struct device *dev = icd->dev.parent; | 289 | struct device *dev = icd->parent; |
290 | 290 | ||
291 | dev_dbg(dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, | 291 | dev_dbg(dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, |
292 | vb, vb->baddr, vb->bsize); | 292 | vb, vb->baddr, vb->bsize); |
@@ -342,7 +342,7 @@ static void mx1_camera_wakeup(struct mx1_camera_dev *pcdev, | |||
342 | static void mx1_camera_dma_irq(int channel, void *data) | 342 | static void mx1_camera_dma_irq(int channel, void *data) |
343 | { | 343 | { |
344 | struct mx1_camera_dev *pcdev = data; | 344 | struct mx1_camera_dev *pcdev = data; |
345 | struct device *dev = pcdev->icd->dev.parent; | 345 | struct device *dev = pcdev->icd->parent; |
346 | struct mx1_buffer *buf; | 346 | struct mx1_buffer *buf; |
347 | struct videobuf_buffer *vb; | 347 | struct videobuf_buffer *vb; |
348 | unsigned long flags; | 348 | unsigned long flags; |
@@ -377,10 +377,10 @@ static struct videobuf_queue_ops mx1_videobuf_ops = { | |||
377 | static void mx1_camera_init_videobuf(struct videobuf_queue *q, | 377 | static void mx1_camera_init_videobuf(struct videobuf_queue *q, |
378 | struct soc_camera_device *icd) | 378 | struct soc_camera_device *icd) |
379 | { | 379 | { |
380 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 380 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
381 | struct mx1_camera_dev *pcdev = ici->priv; | 381 | struct mx1_camera_dev *pcdev = ici->priv; |
382 | 382 | ||
383 | videobuf_queue_dma_contig_init(q, &mx1_videobuf_ops, icd->dev.parent, | 383 | videobuf_queue_dma_contig_init(q, &mx1_videobuf_ops, icd->parent, |
384 | &pcdev->lock, V4L2_BUF_TYPE_VIDEO_CAPTURE, | 384 | &pcdev->lock, V4L2_BUF_TYPE_VIDEO_CAPTURE, |
385 | V4L2_FIELD_NONE, | 385 | V4L2_FIELD_NONE, |
386 | sizeof(struct mx1_buffer), icd, &icd->video_lock); | 386 | sizeof(struct mx1_buffer), icd, &icd->video_lock); |
@@ -400,7 +400,7 @@ static int mclk_get_divisor(struct mx1_camera_dev *pcdev) | |||
400 | */ | 400 | */ |
401 | div = (lcdclk + 2 * mclk - 1) / (2 * mclk) - 1; | 401 | div = (lcdclk + 2 * mclk - 1) / (2 * mclk) - 1; |
402 | 402 | ||
403 | dev_dbg(pcdev->icd->dev.parent, | 403 | dev_dbg(pcdev->icd->parent, |
404 | "System clock %lukHz, target freq %dkHz, divisor %lu\n", | 404 | "System clock %lukHz, target freq %dkHz, divisor %lu\n", |
405 | lcdclk / 1000, mclk / 1000, div); | 405 | lcdclk / 1000, mclk / 1000, div); |
406 | 406 | ||
@@ -411,7 +411,7 @@ static void mx1_camera_activate(struct mx1_camera_dev *pcdev) | |||
411 | { | 411 | { |
412 | unsigned int csicr1 = CSICR1_EN; | 412 | unsigned int csicr1 = CSICR1_EN; |
413 | 413 | ||
414 | dev_dbg(pcdev->icd->dev.parent, "Activate device\n"); | 414 | dev_dbg(pcdev->icd->parent, "Activate device\n"); |
415 | 415 | ||
416 | clk_enable(pcdev->clk); | 416 | clk_enable(pcdev->clk); |
417 | 417 | ||
@@ -427,7 +427,7 @@ static void mx1_camera_activate(struct mx1_camera_dev *pcdev) | |||
427 | 427 | ||
428 | static void mx1_camera_deactivate(struct mx1_camera_dev *pcdev) | 428 | static void mx1_camera_deactivate(struct mx1_camera_dev *pcdev) |
429 | { | 429 | { |
430 | dev_dbg(pcdev->icd->dev.parent, "Deactivate device\n"); | 430 | dev_dbg(pcdev->icd->parent, "Deactivate device\n"); |
431 | 431 | ||
432 | /* Disable all CSI interface */ | 432 | /* Disable all CSI interface */ |
433 | __raw_writel(0x00, pcdev->base + CSICR1); | 433 | __raw_writel(0x00, pcdev->base + CSICR1); |
@@ -441,13 +441,13 @@ static void mx1_camera_deactivate(struct mx1_camera_dev *pcdev) | |||
441 | */ | 441 | */ |
442 | static int mx1_camera_add_device(struct soc_camera_device *icd) | 442 | static int mx1_camera_add_device(struct soc_camera_device *icd) |
443 | { | 443 | { |
444 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 444 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
445 | struct mx1_camera_dev *pcdev = ici->priv; | 445 | struct mx1_camera_dev *pcdev = ici->priv; |
446 | 446 | ||
447 | if (pcdev->icd) | 447 | if (pcdev->icd) |
448 | return -EBUSY; | 448 | return -EBUSY; |
449 | 449 | ||
450 | dev_info(icd->dev.parent, "MX1 Camera driver attached to camera %d\n", | 450 | dev_info(icd->parent, "MX1 Camera driver attached to camera %d\n", |
451 | icd->devnum); | 451 | icd->devnum); |
452 | 452 | ||
453 | mx1_camera_activate(pcdev); | 453 | mx1_camera_activate(pcdev); |
@@ -459,7 +459,7 @@ static int mx1_camera_add_device(struct soc_camera_device *icd) | |||
459 | 459 | ||
460 | static void mx1_camera_remove_device(struct soc_camera_device *icd) | 460 | static void mx1_camera_remove_device(struct soc_camera_device *icd) |
461 | { | 461 | { |
462 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 462 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
463 | struct mx1_camera_dev *pcdev = ici->priv; | 463 | struct mx1_camera_dev *pcdev = ici->priv; |
464 | unsigned int csicr1; | 464 | unsigned int csicr1; |
465 | 465 | ||
@@ -472,7 +472,7 @@ static void mx1_camera_remove_device(struct soc_camera_device *icd) | |||
472 | /* Stop DMA engine */ | 472 | /* Stop DMA engine */ |
473 | imx_dma_disable(pcdev->dma_chan); | 473 | imx_dma_disable(pcdev->dma_chan); |
474 | 474 | ||
475 | dev_info(icd->dev.parent, "MX1 Camera driver detached from camera %d\n", | 475 | dev_info(icd->parent, "MX1 Camera driver detached from camera %d\n", |
476 | icd->devnum); | 476 | icd->devnum); |
477 | 477 | ||
478 | mx1_camera_deactivate(pcdev); | 478 | mx1_camera_deactivate(pcdev); |
@@ -490,7 +490,7 @@ static int mx1_camera_set_crop(struct soc_camera_device *icd, | |||
490 | 490 | ||
491 | static int mx1_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) | 491 | static int mx1_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) |
492 | { | 492 | { |
493 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 493 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
494 | struct mx1_camera_dev *pcdev = ici->priv; | 494 | struct mx1_camera_dev *pcdev = ici->priv; |
495 | unsigned long camera_flags, common_flags; | 495 | unsigned long camera_flags, common_flags; |
496 | unsigned int csicr1; | 496 | unsigned int csicr1; |
@@ -561,14 +561,14 @@ static int mx1_camera_set_fmt(struct soc_camera_device *icd, | |||
561 | 561 | ||
562 | xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); | 562 | xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); |
563 | if (!xlate) { | 563 | if (!xlate) { |
564 | dev_warn(icd->dev.parent, "Format %x not found\n", | 564 | dev_warn(icd->parent, "Format %x not found\n", |
565 | pix->pixelformat); | 565 | pix->pixelformat); |
566 | return -EINVAL; | 566 | return -EINVAL; |
567 | } | 567 | } |
568 | 568 | ||
569 | buswidth = xlate->host_fmt->bits_per_sample; | 569 | buswidth = xlate->host_fmt->bits_per_sample; |
570 | if (buswidth > 8) { | 570 | if (buswidth > 8) { |
571 | dev_warn(icd->dev.parent, | 571 | dev_warn(icd->parent, |
572 | "bits-per-sample %d for format %x unsupported\n", | 572 | "bits-per-sample %d for format %x unsupported\n", |
573 | buswidth, pix->pixelformat); | 573 | buswidth, pix->pixelformat); |
574 | return -EINVAL; | 574 | return -EINVAL; |
@@ -608,7 +608,7 @@ static int mx1_camera_try_fmt(struct soc_camera_device *icd, | |||
608 | 608 | ||
609 | xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); | 609 | xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); |
610 | if (!xlate) { | 610 | if (!xlate) { |
611 | dev_warn(icd->dev.parent, "Format %x not found\n", | 611 | dev_warn(icd->parent, "Format %x not found\n", |
612 | pix->pixelformat); | 612 | pix->pixelformat); |
613 | return -EINVAL; | 613 | return -EINVAL; |
614 | } | 614 | } |
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c index 55d48442c2e..ec2410c0c80 100644 --- a/drivers/media/video/mx2_camera.c +++ b/drivers/media/video/mx2_camera.c | |||
@@ -277,7 +277,7 @@ static void mx2_camera_deactivate(struct mx2_camera_dev *pcdev) | |||
277 | */ | 277 | */ |
278 | static int mx2_camera_add_device(struct soc_camera_device *icd) | 278 | static int mx2_camera_add_device(struct soc_camera_device *icd) |
279 | { | 279 | { |
280 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 280 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
281 | struct mx2_camera_dev *pcdev = ici->priv; | 281 | struct mx2_camera_dev *pcdev = ici->priv; |
282 | int ret; | 282 | int ret; |
283 | u32 csicr1; | 283 | u32 csicr1; |
@@ -302,7 +302,7 @@ static int mx2_camera_add_device(struct soc_camera_device *icd) | |||
302 | 302 | ||
303 | pcdev->icd = icd; | 303 | pcdev->icd = icd; |
304 | 304 | ||
305 | dev_info(icd->dev.parent, "Camera driver attached to camera %d\n", | 305 | dev_info(icd->parent, "Camera driver attached to camera %d\n", |
306 | icd->devnum); | 306 | icd->devnum); |
307 | 307 | ||
308 | return 0; | 308 | return 0; |
@@ -310,12 +310,12 @@ static int mx2_camera_add_device(struct soc_camera_device *icd) | |||
310 | 310 | ||
311 | static void mx2_camera_remove_device(struct soc_camera_device *icd) | 311 | static void mx2_camera_remove_device(struct soc_camera_device *icd) |
312 | { | 312 | { |
313 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 313 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
314 | struct mx2_camera_dev *pcdev = ici->priv; | 314 | struct mx2_camera_dev *pcdev = ici->priv; |
315 | 315 | ||
316 | BUG_ON(icd != pcdev->icd); | 316 | BUG_ON(icd != pcdev->icd); |
317 | 317 | ||
318 | dev_info(icd->dev.parent, "Camera driver detached from camera %d\n", | 318 | dev_info(icd->parent, "Camera driver detached from camera %d\n", |
319 | icd->devnum); | 319 | icd->devnum); |
320 | 320 | ||
321 | mx2_camera_deactivate(pcdev); | 321 | mx2_camera_deactivate(pcdev); |
@@ -436,7 +436,7 @@ static int mx2_videobuf_setup(struct videobuf_queue *vq, unsigned int *count, | |||
436 | int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, | 436 | int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, |
437 | icd->current_fmt->host_fmt); | 437 | icd->current_fmt->host_fmt); |
438 | 438 | ||
439 | dev_dbg(&icd->dev, "count=%d, size=%d\n", *count, *size); | 439 | dev_dbg(icd->parent, "count=%d, size=%d\n", *count, *size); |
440 | 440 | ||
441 | if (bytes_per_line < 0) | 441 | if (bytes_per_line < 0) |
442 | return bytes_per_line; | 442 | return bytes_per_line; |
@@ -456,7 +456,7 @@ static void free_buffer(struct videobuf_queue *vq, struct mx2_buffer *buf) | |||
456 | struct soc_camera_device *icd = vq->priv_data; | 456 | struct soc_camera_device *icd = vq->priv_data; |
457 | struct videobuf_buffer *vb = &buf->vb; | 457 | struct videobuf_buffer *vb = &buf->vb; |
458 | 458 | ||
459 | dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, | 459 | dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, |
460 | vb, vb->baddr, vb->bsize); | 460 | vb, vb->baddr, vb->bsize); |
461 | 461 | ||
462 | /* | 462 | /* |
@@ -466,7 +466,7 @@ static void free_buffer(struct videobuf_queue *vq, struct mx2_buffer *buf) | |||
466 | videobuf_waiton(vq, vb, 0, 0); | 466 | videobuf_waiton(vq, vb, 0, 0); |
467 | 467 | ||
468 | videobuf_dma_contig_free(vq, vb); | 468 | videobuf_dma_contig_free(vq, vb); |
469 | dev_dbg(&icd->dev, "%s freed\n", __func__); | 469 | dev_dbg(icd->parent, "%s freed\n", __func__); |
470 | 470 | ||
471 | vb->state = VIDEOBUF_NEEDS_INIT; | 471 | vb->state = VIDEOBUF_NEEDS_INIT; |
472 | } | 472 | } |
@@ -480,7 +480,7 @@ static int mx2_videobuf_prepare(struct videobuf_queue *vq, | |||
480 | icd->current_fmt->host_fmt); | 480 | icd->current_fmt->host_fmt); |
481 | int ret = 0; | 481 | int ret = 0; |
482 | 482 | ||
483 | dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, | 483 | dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, |
484 | vb, vb->baddr, vb->bsize); | 484 | vb, vb->baddr, vb->bsize); |
485 | 485 | ||
486 | if (bytes_per_line < 0) | 486 | if (bytes_per_line < 0) |
@@ -532,12 +532,12 @@ static void mx2_videobuf_queue(struct videobuf_queue *vq, | |||
532 | { | 532 | { |
533 | struct soc_camera_device *icd = vq->priv_data; | 533 | struct soc_camera_device *icd = vq->priv_data; |
534 | struct soc_camera_host *ici = | 534 | struct soc_camera_host *ici = |
535 | to_soc_camera_host(icd->dev.parent); | 535 | to_soc_camera_host(icd->parent); |
536 | struct mx2_camera_dev *pcdev = ici->priv; | 536 | struct mx2_camera_dev *pcdev = ici->priv; |
537 | struct mx2_buffer *buf = container_of(vb, struct mx2_buffer, vb); | 537 | struct mx2_buffer *buf = container_of(vb, struct mx2_buffer, vb); |
538 | unsigned long flags; | 538 | unsigned long flags; |
539 | 539 | ||
540 | dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, | 540 | dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, |
541 | vb, vb->baddr, vb->bsize); | 541 | vb, vb->baddr, vb->bsize); |
542 | 542 | ||
543 | spin_lock_irqsave(&pcdev->lock, flags); | 543 | spin_lock_irqsave(&pcdev->lock, flags); |
@@ -610,27 +610,27 @@ static void mx2_videobuf_release(struct videobuf_queue *vq, | |||
610 | struct videobuf_buffer *vb) | 610 | struct videobuf_buffer *vb) |
611 | { | 611 | { |
612 | struct soc_camera_device *icd = vq->priv_data; | 612 | struct soc_camera_device *icd = vq->priv_data; |
613 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 613 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
614 | struct mx2_camera_dev *pcdev = ici->priv; | 614 | struct mx2_camera_dev *pcdev = ici->priv; |
615 | struct mx2_buffer *buf = container_of(vb, struct mx2_buffer, vb); | 615 | struct mx2_buffer *buf = container_of(vb, struct mx2_buffer, vb); |
616 | unsigned long flags; | 616 | unsigned long flags; |
617 | 617 | ||
618 | #ifdef DEBUG | 618 | #ifdef DEBUG |
619 | dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, | 619 | dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, |
620 | vb, vb->baddr, vb->bsize); | 620 | vb, vb->baddr, vb->bsize); |
621 | 621 | ||
622 | switch (vb->state) { | 622 | switch (vb->state) { |
623 | case VIDEOBUF_ACTIVE: | 623 | case VIDEOBUF_ACTIVE: |
624 | dev_info(&icd->dev, "%s (active)\n", __func__); | 624 | dev_info(icd->parent, "%s (active)\n", __func__); |
625 | break; | 625 | break; |
626 | case VIDEOBUF_QUEUED: | 626 | case VIDEOBUF_QUEUED: |
627 | dev_info(&icd->dev, "%s (queued)\n", __func__); | 627 | dev_info(icd->parent, "%s (queued)\n", __func__); |
628 | break; | 628 | break; |
629 | case VIDEOBUF_PREPARED: | 629 | case VIDEOBUF_PREPARED: |
630 | dev_info(&icd->dev, "%s (prepared)\n", __func__); | 630 | dev_info(icd->parent, "%s (prepared)\n", __func__); |
631 | break; | 631 | break; |
632 | default: | 632 | default: |
633 | dev_info(&icd->dev, "%s (unknown) %d\n", __func__, | 633 | dev_info(icd->parent, "%s (unknown) %d\n", __func__, |
634 | vb->state); | 634 | vb->state); |
635 | break; | 635 | break; |
636 | } | 636 | } |
@@ -677,7 +677,7 @@ static struct videobuf_queue_ops mx2_videobuf_ops = { | |||
677 | static void mx2_camera_init_videobuf(struct videobuf_queue *q, | 677 | static void mx2_camera_init_videobuf(struct videobuf_queue *q, |
678 | struct soc_camera_device *icd) | 678 | struct soc_camera_device *icd) |
679 | { | 679 | { |
680 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 680 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
681 | struct mx2_camera_dev *pcdev = ici->priv; | 681 | struct mx2_camera_dev *pcdev = ici->priv; |
682 | 682 | ||
683 | videobuf_queue_dma_contig_init(q, &mx2_videobuf_ops, pcdev->dev, | 683 | 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 | int bytesperline) | 718 | int bytesperline) |
719 | { | 719 | { |
720 | struct soc_camera_host *ici = | 720 | struct soc_camera_host *ici = |
721 | to_soc_camera_host(icd->dev.parent); | 721 | to_soc_camera_host(icd->parent); |
722 | struct mx2_camera_dev *pcdev = ici->priv; | 722 | struct mx2_camera_dev *pcdev = ici->priv; |
723 | 723 | ||
724 | writel(pcdev->discard_buffer_dma, | 724 | writel(pcdev->discard_buffer_dma, |
@@ -771,7 +771,7 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd, | |||
771 | __u32 pixfmt) | 771 | __u32 pixfmt) |
772 | { | 772 | { |
773 | struct soc_camera_host *ici = | 773 | struct soc_camera_host *ici = |
774 | to_soc_camera_host(icd->dev.parent); | 774 | to_soc_camera_host(icd->parent); |
775 | struct mx2_camera_dev *pcdev = ici->priv; | 775 | struct mx2_camera_dev *pcdev = ici->priv; |
776 | unsigned long camera_flags, common_flags; | 776 | unsigned long camera_flags, common_flags; |
777 | int ret = 0; | 777 | int ret = 0; |
@@ -890,7 +890,7 @@ static int mx2_camera_set_crop(struct soc_camera_device *icd, | |||
890 | if (ret < 0) | 890 | if (ret < 0) |
891 | return ret; | 891 | return ret; |
892 | 892 | ||
893 | dev_dbg(icd->dev.parent, "Sensor cropped %dx%d\n", | 893 | dev_dbg(icd->parent, "Sensor cropped %dx%d\n", |
894 | mf.width, mf.height); | 894 | mf.width, mf.height); |
895 | 895 | ||
896 | icd->user_width = mf.width; | 896 | icd->user_width = mf.width; |
@@ -910,7 +910,7 @@ static int mx2_camera_set_fmt(struct soc_camera_device *icd, | |||
910 | 910 | ||
911 | xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); | 911 | xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); |
912 | if (!xlate) { | 912 | if (!xlate) { |
913 | dev_warn(icd->dev.parent, "Format %x not found\n", | 913 | dev_warn(icd->parent, "Format %x not found\n", |
914 | pix->pixelformat); | 914 | pix->pixelformat); |
915 | return -EINVAL; | 915 | return -EINVAL; |
916 | } | 916 | } |
@@ -950,7 +950,7 @@ static int mx2_camera_try_fmt(struct soc_camera_device *icd, | |||
950 | 950 | ||
951 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); | 951 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); |
952 | if (pixfmt && !xlate) { | 952 | if (pixfmt && !xlate) { |
953 | dev_warn(icd->dev.parent, "Format %x not found\n", pixfmt); | 953 | dev_warn(icd->parent, "Format %x not found\n", pixfmt); |
954 | return -EINVAL; | 954 | return -EINVAL; |
955 | } | 955 | } |
956 | 956 | ||
@@ -1000,7 +1000,7 @@ static int mx2_camera_try_fmt(struct soc_camera_device *icd, | |||
1000 | if (mf.field == V4L2_FIELD_ANY) | 1000 | if (mf.field == V4L2_FIELD_ANY) |
1001 | mf.field = V4L2_FIELD_NONE; | 1001 | mf.field = V4L2_FIELD_NONE; |
1002 | if (mf.field != V4L2_FIELD_NONE) { | 1002 | if (mf.field != V4L2_FIELD_NONE) { |
1003 | dev_err(icd->dev.parent, "Field type %d unsupported.\n", | 1003 | dev_err(icd->parent, "Field type %d unsupported.\n", |
1004 | mf.field); | 1004 | mf.field); |
1005 | return -EINVAL; | 1005 | return -EINVAL; |
1006 | } | 1006 | } |
diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c index cdb7dad05c1..c045b47803a 100644 --- a/drivers/media/video/mx3_camera.c +++ b/drivers/media/video/mx3_camera.c | |||
@@ -194,7 +194,7 @@ static int mx3_videobuf_setup(struct vb2_queue *vq, | |||
194 | unsigned long sizes[], void *alloc_ctxs[]) | 194 | unsigned long sizes[], void *alloc_ctxs[]) |
195 | { | 195 | { |
196 | struct soc_camera_device *icd = soc_camera_from_vb2q(vq); | 196 | struct soc_camera_device *icd = soc_camera_from_vb2q(vq); |
197 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 197 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
198 | struct mx3_camera_dev *mx3_cam = ici->priv; | 198 | struct mx3_camera_dev *mx3_cam = ici->priv; |
199 | int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, | 199 | int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, |
200 | icd->current_fmt->host_fmt); | 200 | icd->current_fmt->host_fmt); |
@@ -223,7 +223,7 @@ static int mx3_videobuf_setup(struct vb2_queue *vq, | |||
223 | static int mx3_videobuf_prepare(struct vb2_buffer *vb) | 223 | static int mx3_videobuf_prepare(struct vb2_buffer *vb) |
224 | { | 224 | { |
225 | struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); | 225 | struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); |
226 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 226 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
227 | struct mx3_camera_dev *mx3_cam = ici->priv; | 227 | struct mx3_camera_dev *mx3_cam = ici->priv; |
228 | struct idmac_channel *ichan = mx3_cam->idmac_channel[0]; | 228 | struct idmac_channel *ichan = mx3_cam->idmac_channel[0]; |
229 | struct scatterlist *sg; | 229 | struct scatterlist *sg; |
@@ -241,7 +241,7 @@ static int mx3_videobuf_prepare(struct vb2_buffer *vb) | |||
241 | new_size = bytes_per_line * icd->user_height; | 241 | new_size = bytes_per_line * icd->user_height; |
242 | 242 | ||
243 | if (vb2_plane_size(vb, 0) < new_size) { | 243 | if (vb2_plane_size(vb, 0) < new_size) { |
244 | dev_err(icd->dev.parent, "Buffer too small (%lu < %zu)\n", | 244 | dev_err(icd->parent, "Buffer too small (%lu < %zu)\n", |
245 | vb2_plane_size(vb, 0), new_size); | 245 | vb2_plane_size(vb, 0), new_size); |
246 | return -ENOBUFS; | 246 | return -ENOBUFS; |
247 | } | 247 | } |
@@ -283,7 +283,7 @@ static enum pixel_fmt fourcc_to_ipu_pix(__u32 fourcc) | |||
283 | static void mx3_videobuf_queue(struct vb2_buffer *vb) | 283 | static void mx3_videobuf_queue(struct vb2_buffer *vb) |
284 | { | 284 | { |
285 | struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); | 285 | struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); |
286 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 286 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
287 | struct mx3_camera_dev *mx3_cam = ici->priv; | 287 | struct mx3_camera_dev *mx3_cam = ici->priv; |
288 | struct mx3_camera_buffer *buf = to_mx3_vb(vb); | 288 | struct mx3_camera_buffer *buf = to_mx3_vb(vb); |
289 | struct dma_async_tx_descriptor *txd = buf->txd; | 289 | struct dma_async_tx_descriptor *txd = buf->txd; |
@@ -336,7 +336,7 @@ static void mx3_videobuf_queue(struct vb2_buffer *vb) | |||
336 | spin_unlock_irq(&mx3_cam->lock); | 336 | spin_unlock_irq(&mx3_cam->lock); |
337 | 337 | ||
338 | cookie = txd->tx_submit(txd); | 338 | cookie = txd->tx_submit(txd); |
339 | dev_dbg(icd->dev.parent, "Submitted cookie %d DMA 0x%08x\n", | 339 | dev_dbg(icd->parent, "Submitted cookie %d DMA 0x%08x\n", |
340 | cookie, sg_dma_address(&buf->sg)); | 340 | cookie, sg_dma_address(&buf->sg)); |
341 | 341 | ||
342 | if (cookie >= 0) | 342 | if (cookie >= 0) |
@@ -357,13 +357,13 @@ static void mx3_videobuf_queue(struct vb2_buffer *vb) | |||
357 | static void mx3_videobuf_release(struct vb2_buffer *vb) | 357 | static void mx3_videobuf_release(struct vb2_buffer *vb) |
358 | { | 358 | { |
359 | struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); | 359 | struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); |
360 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 360 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
361 | struct mx3_camera_dev *mx3_cam = ici->priv; | 361 | struct mx3_camera_dev *mx3_cam = ici->priv; |
362 | struct mx3_camera_buffer *buf = to_mx3_vb(vb); | 362 | struct mx3_camera_buffer *buf = to_mx3_vb(vb); |
363 | struct dma_async_tx_descriptor *txd = buf->txd; | 363 | struct dma_async_tx_descriptor *txd = buf->txd; |
364 | unsigned long flags; | 364 | unsigned long flags; |
365 | 365 | ||
366 | dev_dbg(icd->dev.parent, | 366 | dev_dbg(icd->parent, |
367 | "Release%s DMA 0x%08x, queue %sempty\n", | 367 | "Release%s DMA 0x%08x, queue %sempty\n", |
368 | mx3_cam->active == buf ? " active" : "", sg_dma_address(&buf->sg), | 368 | mx3_cam->active == buf ? " active" : "", sg_dma_address(&buf->sg), |
369 | list_empty(&buf->queue) ? "" : "not "); | 369 | list_empty(&buf->queue) ? "" : "not "); |
@@ -402,7 +402,7 @@ static int mx3_videobuf_init(struct vb2_buffer *vb) | |||
402 | static int mx3_stop_streaming(struct vb2_queue *q) | 402 | static int mx3_stop_streaming(struct vb2_queue *q) |
403 | { | 403 | { |
404 | struct soc_camera_device *icd = soc_camera_from_vb2q(q); | 404 | struct soc_camera_device *icd = soc_camera_from_vb2q(q); |
405 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 405 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
406 | struct mx3_camera_dev *mx3_cam = ici->priv; | 406 | struct mx3_camera_dev *mx3_cam = ici->priv; |
407 | struct idmac_channel *ichan = mx3_cam->idmac_channel[0]; | 407 | struct idmac_channel *ichan = mx3_cam->idmac_channel[0]; |
408 | struct dma_chan *chan; | 408 | struct dma_chan *chan; |
@@ -498,7 +498,7 @@ static void mx3_camera_activate(struct mx3_camera_dev *mx3_cam, | |||
498 | 498 | ||
499 | clk_enable(mx3_cam->clk); | 499 | clk_enable(mx3_cam->clk); |
500 | rate = clk_round_rate(mx3_cam->clk, mx3_cam->mclk); | 500 | rate = clk_round_rate(mx3_cam->clk, mx3_cam->mclk); |
501 | dev_dbg(icd->dev.parent, "Set SENS_CONF to %x, rate %ld\n", conf, rate); | 501 | dev_dbg(icd->parent, "Set SENS_CONF to %x, rate %ld\n", conf, rate); |
502 | if (rate) | 502 | if (rate) |
503 | clk_set_rate(mx3_cam->clk, rate); | 503 | clk_set_rate(mx3_cam->clk, rate); |
504 | } | 504 | } |
@@ -506,7 +506,7 @@ static void mx3_camera_activate(struct mx3_camera_dev *mx3_cam, | |||
506 | /* Called with .video_lock held */ | 506 | /* Called with .video_lock held */ |
507 | static int mx3_camera_add_device(struct soc_camera_device *icd) | 507 | static int mx3_camera_add_device(struct soc_camera_device *icd) |
508 | { | 508 | { |
509 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 509 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
510 | struct mx3_camera_dev *mx3_cam = ici->priv; | 510 | struct mx3_camera_dev *mx3_cam = ici->priv; |
511 | 511 | ||
512 | if (mx3_cam->icd) | 512 | if (mx3_cam->icd) |
@@ -516,7 +516,7 @@ static int mx3_camera_add_device(struct soc_camera_device *icd) | |||
516 | 516 | ||
517 | mx3_cam->icd = icd; | 517 | mx3_cam->icd = icd; |
518 | 518 | ||
519 | dev_info(icd->dev.parent, "MX3 Camera driver attached to camera %d\n", | 519 | dev_info(icd->parent, "MX3 Camera driver attached to camera %d\n", |
520 | icd->devnum); | 520 | icd->devnum); |
521 | 521 | ||
522 | return 0; | 522 | return 0; |
@@ -525,7 +525,7 @@ static int mx3_camera_add_device(struct soc_camera_device *icd) | |||
525 | /* Called with .video_lock held */ | 525 | /* Called with .video_lock held */ |
526 | static void mx3_camera_remove_device(struct soc_camera_device *icd) | 526 | static void mx3_camera_remove_device(struct soc_camera_device *icd) |
527 | { | 527 | { |
528 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 528 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
529 | struct mx3_camera_dev *mx3_cam = ici->priv; | 529 | struct mx3_camera_dev *mx3_cam = ici->priv; |
530 | struct idmac_channel **ichan = &mx3_cam->idmac_channel[0]; | 530 | struct idmac_channel **ichan = &mx3_cam->idmac_channel[0]; |
531 | 531 | ||
@@ -540,7 +540,7 @@ static void mx3_camera_remove_device(struct soc_camera_device *icd) | |||
540 | 540 | ||
541 | mx3_cam->icd = NULL; | 541 | mx3_cam->icd = NULL; |
542 | 542 | ||
543 | dev_info(icd->dev.parent, "MX3 Camera driver detached from camera %d\n", | 543 | dev_info(icd->parent, "MX3 Camera driver detached from camera %d\n", |
544 | icd->devnum); | 544 | icd->devnum); |
545 | } | 545 | } |
546 | 546 | ||
@@ -607,12 +607,12 @@ static int test_platform_param(struct mx3_camera_dev *mx3_cam, | |||
607 | static int mx3_camera_try_bus_param(struct soc_camera_device *icd, | 607 | static int mx3_camera_try_bus_param(struct soc_camera_device *icd, |
608 | const unsigned int depth) | 608 | const unsigned int depth) |
609 | { | 609 | { |
610 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 610 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
611 | struct mx3_camera_dev *mx3_cam = ici->priv; | 611 | struct mx3_camera_dev *mx3_cam = ici->priv; |
612 | unsigned long bus_flags, camera_flags; | 612 | unsigned long bus_flags, camera_flags; |
613 | int ret = test_platform_param(mx3_cam, depth, &bus_flags); | 613 | int ret = test_platform_param(mx3_cam, depth, &bus_flags); |
614 | 614 | ||
615 | dev_dbg(icd->dev.parent, "request bus width %d bit: %d\n", depth, ret); | 615 | dev_dbg(icd->parent, "request bus width %d bit: %d\n", depth, ret); |
616 | 616 | ||
617 | if (ret < 0) | 617 | if (ret < 0) |
618 | return ret; | 618 | return ret; |
@@ -621,7 +621,7 @@ static int mx3_camera_try_bus_param(struct soc_camera_device *icd, | |||
621 | 621 | ||
622 | ret = soc_camera_bus_param_compatible(camera_flags, bus_flags); | 622 | ret = soc_camera_bus_param_compatible(camera_flags, bus_flags); |
623 | if (ret < 0) | 623 | if (ret < 0) |
624 | dev_warn(icd->dev.parent, | 624 | dev_warn(icd->parent, |
625 | "Flags incompatible: camera %lx, host %lx\n", | 625 | "Flags incompatible: camera %lx, host %lx\n", |
626 | camera_flags, bus_flags); | 626 | camera_flags, bus_flags); |
627 | 627 | ||
@@ -675,7 +675,7 @@ static int mx3_camera_get_formats(struct soc_camera_device *icd, unsigned int id | |||
675 | struct soc_camera_format_xlate *xlate) | 675 | struct soc_camera_format_xlate *xlate) |
676 | { | 676 | { |
677 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 677 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
678 | struct device *dev = icd->dev.parent; | 678 | struct device *dev = icd->parent; |
679 | int formats = 0, ret; | 679 | int formats = 0, ret; |
680 | enum v4l2_mbus_pixelcode code; | 680 | enum v4l2_mbus_pixelcode code; |
681 | const struct soc_mbus_pixelfmt *fmt; | 681 | 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 | 687 | ||
688 | fmt = soc_mbus_get_fmtdesc(code); | 688 | fmt = soc_mbus_get_fmtdesc(code); |
689 | if (!fmt) { | 689 | if (!fmt) { |
690 | dev_warn(icd->dev.parent, | 690 | dev_warn(icd->parent, |
691 | "Unsupported format code #%u: %d\n", idx, code); | 691 | "Unsupported format code #%u: %d\n", idx, code); |
692 | return 0; | 692 | return 0; |
693 | } | 693 | } |
@@ -815,7 +815,7 @@ static int mx3_camera_set_crop(struct soc_camera_device *icd, | |||
815 | struct v4l2_crop *a) | 815 | struct v4l2_crop *a) |
816 | { | 816 | { |
817 | struct v4l2_rect *rect = &a->c; | 817 | struct v4l2_rect *rect = &a->c; |
818 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 818 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
819 | struct mx3_camera_dev *mx3_cam = ici->priv; | 819 | struct mx3_camera_dev *mx3_cam = ici->priv; |
820 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 820 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
821 | struct v4l2_mbus_framefmt mf; | 821 | struct v4l2_mbus_framefmt mf; |
@@ -848,7 +848,7 @@ static int mx3_camera_set_crop(struct soc_camera_device *icd, | |||
848 | configure_geometry(mx3_cam, mf.width, mf.height, | 848 | configure_geometry(mx3_cam, mf.width, mf.height, |
849 | icd->current_fmt->host_fmt); | 849 | icd->current_fmt->host_fmt); |
850 | 850 | ||
851 | dev_dbg(icd->dev.parent, "Sensor cropped %dx%d\n", | 851 | dev_dbg(icd->parent, "Sensor cropped %dx%d\n", |
852 | mf.width, mf.height); | 852 | mf.width, mf.height); |
853 | 853 | ||
854 | icd->user_width = mf.width; | 854 | icd->user_width = mf.width; |
@@ -860,7 +860,7 @@ static int mx3_camera_set_crop(struct soc_camera_device *icd, | |||
860 | static int mx3_camera_set_fmt(struct soc_camera_device *icd, | 860 | static int mx3_camera_set_fmt(struct soc_camera_device *icd, |
861 | struct v4l2_format *f) | 861 | struct v4l2_format *f) |
862 | { | 862 | { |
863 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 863 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
864 | struct mx3_camera_dev *mx3_cam = ici->priv; | 864 | struct mx3_camera_dev *mx3_cam = ici->priv; |
865 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 865 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
866 | const struct soc_camera_format_xlate *xlate; | 866 | const struct soc_camera_format_xlate *xlate; |
@@ -870,13 +870,13 @@ static int mx3_camera_set_fmt(struct soc_camera_device *icd, | |||
870 | 870 | ||
871 | xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); | 871 | xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); |
872 | if (!xlate) { | 872 | if (!xlate) { |
873 | dev_warn(icd->dev.parent, "Format %x not found\n", | 873 | dev_warn(icd->parent, "Format %x not found\n", |
874 | pix->pixelformat); | 874 | pix->pixelformat); |
875 | return -EINVAL; | 875 | return -EINVAL; |
876 | } | 876 | } |
877 | 877 | ||
878 | stride_align(&pix->width); | 878 | stride_align(&pix->width); |
879 | dev_dbg(icd->dev.parent, "Set format %dx%d\n", pix->width, pix->height); | 879 | dev_dbg(icd->parent, "Set format %dx%d\n", pix->width, pix->height); |
880 | 880 | ||
881 | /* | 881 | /* |
882 | * Might have to perform a complete interface initialisation like in | 882 | * 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 | pix->colorspace = mf.colorspace; | 912 | pix->colorspace = mf.colorspace; |
913 | icd->current_fmt = xlate; | 913 | icd->current_fmt = xlate; |
914 | 914 | ||
915 | dev_dbg(icd->dev.parent, "Sensor set %dx%d\n", pix->width, pix->height); | 915 | dev_dbg(icd->parent, "Sensor set %dx%d\n", pix->width, pix->height); |
916 | 916 | ||
917 | return ret; | 917 | return ret; |
918 | } | 918 | } |
@@ -929,7 +929,7 @@ static int mx3_camera_try_fmt(struct soc_camera_device *icd, | |||
929 | 929 | ||
930 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); | 930 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); |
931 | if (pixfmt && !xlate) { | 931 | if (pixfmt && !xlate) { |
932 | dev_warn(icd->dev.parent, "Format %x not found\n", pixfmt); | 932 | dev_warn(icd->parent, "Format %x not found\n", pixfmt); |
933 | return -EINVAL; | 933 | return -EINVAL; |
934 | } | 934 | } |
935 | 935 | ||
@@ -961,7 +961,7 @@ static int mx3_camera_try_fmt(struct soc_camera_device *icd, | |||
961 | case V4L2_FIELD_NONE: | 961 | case V4L2_FIELD_NONE: |
962 | break; | 962 | break; |
963 | default: | 963 | default: |
964 | dev_err(icd->dev.parent, "Field type %d unsupported.\n", | 964 | dev_err(icd->parent, "Field type %d unsupported.\n", |
965 | mf.field); | 965 | mf.field); |
966 | ret = -EINVAL; | 966 | ret = -EINVAL; |
967 | } | 967 | } |
@@ -994,7 +994,7 @@ static int mx3_camera_querycap(struct soc_camera_host *ici, | |||
994 | 994 | ||
995 | static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) | 995 | static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) |
996 | { | 996 | { |
997 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 997 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
998 | struct mx3_camera_dev *mx3_cam = ici->priv; | 998 | struct mx3_camera_dev *mx3_cam = ici->priv; |
999 | unsigned long bus_flags, camera_flags, common_flags; | 999 | unsigned long bus_flags, camera_flags, common_flags; |
1000 | u32 dw, sens_conf; | 1000 | u32 dw, sens_conf; |
@@ -1002,7 +1002,7 @@ static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) | |||
1002 | int buswidth; | 1002 | int buswidth; |
1003 | int ret; | 1003 | int ret; |
1004 | const struct soc_camera_format_xlate *xlate; | 1004 | const struct soc_camera_format_xlate *xlate; |
1005 | struct device *dev = icd->dev.parent; | 1005 | struct device *dev = icd->parent; |
1006 | 1006 | ||
1007 | fmt = soc_mbus_get_fmtdesc(icd->current_fmt->code); | 1007 | fmt = soc_mbus_get_fmtdesc(icd->current_fmt->code); |
1008 | if (!fmt) | 1008 | if (!fmt) |
diff --git a/drivers/media/video/omap1_camera.c b/drivers/media/video/omap1_camera.c index 9bfe4c121a5..8a947e603ac 100644 --- a/drivers/media/video/omap1_camera.c +++ b/drivers/media/video/omap1_camera.c | |||
@@ -207,7 +207,7 @@ static int omap1_videobuf_setup(struct videobuf_queue *vq, unsigned int *count, | |||
207 | struct soc_camera_device *icd = vq->priv_data; | 207 | struct soc_camera_device *icd = vq->priv_data; |
208 | int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, | 208 | int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, |
209 | icd->current_fmt->host_fmt); | 209 | icd->current_fmt->host_fmt); |
210 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 210 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
211 | struct omap1_cam_dev *pcdev = ici->priv; | 211 | struct omap1_cam_dev *pcdev = ici->priv; |
212 | 212 | ||
213 | if (bytes_per_line < 0) | 213 | if (bytes_per_line < 0) |
@@ -221,7 +221,7 @@ static int omap1_videobuf_setup(struct videobuf_queue *vq, unsigned int *count, | |||
221 | if (*size * *count > MAX_VIDEO_MEM * 1024 * 1024) | 221 | if (*size * *count > MAX_VIDEO_MEM * 1024 * 1024) |
222 | *count = (MAX_VIDEO_MEM * 1024 * 1024) / *size; | 222 | *count = (MAX_VIDEO_MEM * 1024 * 1024) / *size; |
223 | 223 | ||
224 | dev_dbg(icd->dev.parent, | 224 | dev_dbg(icd->parent, |
225 | "%s: count=%d, size=%d\n", __func__, *count, *size); | 225 | "%s: count=%d, size=%d\n", __func__, *count, *size); |
226 | 226 | ||
227 | return 0; | 227 | return 0; |
@@ -240,7 +240,7 @@ static void free_buffer(struct videobuf_queue *vq, struct omap1_cam_buf *buf, | |||
240 | videobuf_dma_contig_free(vq, vb); | 240 | videobuf_dma_contig_free(vq, vb); |
241 | } else { | 241 | } else { |
242 | struct soc_camera_device *icd = vq->priv_data; | 242 | struct soc_camera_device *icd = vq->priv_data; |
243 | struct device *dev = icd->dev.parent; | 243 | struct device *dev = icd->parent; |
244 | struct videobuf_dmabuf *dma = videobuf_to_dma(vb); | 244 | struct videobuf_dmabuf *dma = videobuf_to_dma(vb); |
245 | 245 | ||
246 | videobuf_dma_unmap(dev, dma); | 246 | videobuf_dma_unmap(dev, dma); |
@@ -257,7 +257,7 @@ static int omap1_videobuf_prepare(struct videobuf_queue *vq, | |||
257 | struct omap1_cam_buf *buf = container_of(vb, struct omap1_cam_buf, vb); | 257 | struct omap1_cam_buf *buf = container_of(vb, struct omap1_cam_buf, vb); |
258 | int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, | 258 | int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, |
259 | icd->current_fmt->host_fmt); | 259 | icd->current_fmt->host_fmt); |
260 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 260 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
261 | struct omap1_cam_dev *pcdev = ici->priv; | 261 | struct omap1_cam_dev *pcdev = ici->priv; |
262 | int ret; | 262 | int ret; |
263 | 263 | ||
@@ -489,7 +489,7 @@ static void omap1_videobuf_queue(struct videobuf_queue *vq, | |||
489 | struct videobuf_buffer *vb) | 489 | struct videobuf_buffer *vb) |
490 | { | 490 | { |
491 | struct soc_camera_device *icd = vq->priv_data; | 491 | struct soc_camera_device *icd = vq->priv_data; |
492 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 492 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
493 | struct omap1_cam_dev *pcdev = ici->priv; | 493 | struct omap1_cam_dev *pcdev = ici->priv; |
494 | struct omap1_cam_buf *buf; | 494 | struct omap1_cam_buf *buf; |
495 | u32 mode; | 495 | u32 mode; |
@@ -518,7 +518,7 @@ static void omap1_videobuf_queue(struct videobuf_queue *vq, | |||
518 | pcdev->active = buf; | 518 | pcdev->active = buf; |
519 | pcdev->ready = NULL; | 519 | pcdev->ready = NULL; |
520 | 520 | ||
521 | dev_dbg(icd->dev.parent, | 521 | dev_dbg(icd->parent, |
522 | "%s: capture not active, setup FIFO, start DMA\n", __func__); | 522 | "%s: capture not active, setup FIFO, start DMA\n", __func__); |
523 | mode = CAM_READ_CACHE(pcdev, MODE) & ~THRESHOLD_MASK; | 523 | mode = CAM_READ_CACHE(pcdev, MODE) & ~THRESHOLD_MASK; |
524 | mode |= THRESHOLD_LEVEL(pcdev->vb_mode) << THRESHOLD_SHIFT; | 524 | mode |= THRESHOLD_LEVEL(pcdev->vb_mode) << THRESHOLD_SHIFT; |
@@ -542,8 +542,8 @@ static void omap1_videobuf_release(struct videobuf_queue *vq, | |||
542 | struct omap1_cam_buf *buf = | 542 | struct omap1_cam_buf *buf = |
543 | container_of(vb, struct omap1_cam_buf, vb); | 543 | container_of(vb, struct omap1_cam_buf, vb); |
544 | struct soc_camera_device *icd = vq->priv_data; | 544 | struct soc_camera_device *icd = vq->priv_data; |
545 | struct device *dev = icd->dev.parent; | 545 | struct device *dev = icd->parent; |
546 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 546 | struct soc_camera_host *ici = to_soc_camera_host(dev); |
547 | struct omap1_cam_dev *pcdev = ici->priv; | 547 | struct omap1_cam_dev *pcdev = ici->priv; |
548 | 548 | ||
549 | switch (vb->state) { | 549 | switch (vb->state) { |
@@ -572,7 +572,7 @@ static void videobuf_done(struct omap1_cam_dev *pcdev, | |||
572 | { | 572 | { |
573 | struct omap1_cam_buf *buf = pcdev->active; | 573 | struct omap1_cam_buf *buf = pcdev->active; |
574 | struct videobuf_buffer *vb; | 574 | struct videobuf_buffer *vb; |
575 | struct device *dev = pcdev->icd->dev.parent; | 575 | struct device *dev = pcdev->icd->parent; |
576 | 576 | ||
577 | if (WARN_ON(!buf)) { | 577 | if (WARN_ON(!buf)) { |
578 | suspend_capture(pcdev); | 578 | suspend_capture(pcdev); |
@@ -798,7 +798,7 @@ out: | |||
798 | static irqreturn_t cam_isr(int irq, void *data) | 798 | static irqreturn_t cam_isr(int irq, void *data) |
799 | { | 799 | { |
800 | struct omap1_cam_dev *pcdev = data; | 800 | struct omap1_cam_dev *pcdev = data; |
801 | struct device *dev = pcdev->icd->dev.parent; | 801 | struct device *dev = pcdev->icd->parent; |
802 | struct omap1_cam_buf *buf = pcdev->active; | 802 | struct omap1_cam_buf *buf = pcdev->active; |
803 | u32 it_status; | 803 | u32 it_status; |
804 | unsigned long flags; | 804 | unsigned long flags; |
@@ -908,7 +908,7 @@ static void sensor_reset(struct omap1_cam_dev *pcdev, bool reset) | |||
908 | */ | 908 | */ |
909 | static int omap1_cam_add_device(struct soc_camera_device *icd) | 909 | static int omap1_cam_add_device(struct soc_camera_device *icd) |
910 | { | 910 | { |
911 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 911 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
912 | struct omap1_cam_dev *pcdev = ici->priv; | 912 | struct omap1_cam_dev *pcdev = ici->priv; |
913 | u32 ctrlclock; | 913 | u32 ctrlclock; |
914 | 914 | ||
@@ -951,14 +951,14 @@ static int omap1_cam_add_device(struct soc_camera_device *icd) | |||
951 | 951 | ||
952 | pcdev->icd = icd; | 952 | pcdev->icd = icd; |
953 | 953 | ||
954 | dev_dbg(icd->dev.parent, "OMAP1 Camera driver attached to camera %d\n", | 954 | dev_dbg(icd->parent, "OMAP1 Camera driver attached to camera %d\n", |
955 | icd->devnum); | 955 | icd->devnum); |
956 | return 0; | 956 | return 0; |
957 | } | 957 | } |
958 | 958 | ||
959 | static void omap1_cam_remove_device(struct soc_camera_device *icd) | 959 | static void omap1_cam_remove_device(struct soc_camera_device *icd) |
960 | { | 960 | { |
961 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 961 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
962 | struct omap1_cam_dev *pcdev = ici->priv; | 962 | struct omap1_cam_dev *pcdev = ici->priv; |
963 | u32 ctrlclock; | 963 | u32 ctrlclock; |
964 | 964 | ||
@@ -984,7 +984,7 @@ static void omap1_cam_remove_device(struct soc_camera_device *icd) | |||
984 | 984 | ||
985 | pcdev->icd = NULL; | 985 | pcdev->icd = NULL; |
986 | 986 | ||
987 | dev_dbg(icd->dev.parent, | 987 | dev_dbg(icd->parent, |
988 | "OMAP1 Camera driver detached from camera %d\n", icd->devnum); | 988 | "OMAP1 Camera driver detached from camera %d\n", icd->devnum); |
989 | } | 989 | } |
990 | 990 | ||
@@ -1069,7 +1069,7 @@ static int omap1_cam_get_formats(struct soc_camera_device *icd, | |||
1069 | unsigned int idx, struct soc_camera_format_xlate *xlate) | 1069 | unsigned int idx, struct soc_camera_format_xlate *xlate) |
1070 | { | 1070 | { |
1071 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 1071 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
1072 | struct device *dev = icd->dev.parent; | 1072 | struct device *dev = icd->parent; |
1073 | int formats = 0, ret; | 1073 | int formats = 0, ret; |
1074 | enum v4l2_mbus_pixelcode code; | 1074 | enum v4l2_mbus_pixelcode code; |
1075 | const struct soc_mbus_pixelfmt *fmt; | 1075 | const struct soc_mbus_pixelfmt *fmt; |
@@ -1221,9 +1221,9 @@ static int omap1_cam_set_crop(struct soc_camera_device *icd, | |||
1221 | struct v4l2_rect *rect = &crop->c; | 1221 | struct v4l2_rect *rect = &crop->c; |
1222 | const struct soc_camera_format_xlate *xlate = icd->current_fmt; | 1222 | const struct soc_camera_format_xlate *xlate = icd->current_fmt; |
1223 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 1223 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
1224 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 1224 | struct device *dev = icd->parent; |
1225 | struct soc_camera_host *ici = to_soc_camera_host(dev); | ||
1225 | struct omap1_cam_dev *pcdev = ici->priv; | 1226 | struct omap1_cam_dev *pcdev = ici->priv; |
1226 | struct device *dev = icd->dev.parent; | ||
1227 | struct v4l2_mbus_framefmt mf; | 1227 | struct v4l2_mbus_framefmt mf; |
1228 | int ret; | 1228 | int ret; |
1229 | 1229 | ||
@@ -1269,8 +1269,8 @@ static int omap1_cam_set_fmt(struct soc_camera_device *icd, | |||
1269 | { | 1269 | { |
1270 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 1270 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
1271 | const struct soc_camera_format_xlate *xlate; | 1271 | const struct soc_camera_format_xlate *xlate; |
1272 | struct device *dev = icd->dev.parent; | 1272 | struct device *dev = icd->parent; |
1273 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 1273 | struct soc_camera_host *ici = to_soc_camera_host(dev); |
1274 | struct omap1_cam_dev *pcdev = ici->priv; | 1274 | struct omap1_cam_dev *pcdev = ici->priv; |
1275 | struct v4l2_pix_format *pix = &f->fmt.pix; | 1275 | struct v4l2_pix_format *pix = &f->fmt.pix; |
1276 | struct v4l2_mbus_framefmt mf; | 1276 | struct v4l2_mbus_framefmt mf; |
@@ -1325,7 +1325,7 @@ static int omap1_cam_try_fmt(struct soc_camera_device *icd, | |||
1325 | 1325 | ||
1326 | xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); | 1326 | xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); |
1327 | if (!xlate) { | 1327 | if (!xlate) { |
1328 | dev_warn(icd->dev.parent, "Format %#x not found\n", | 1328 | dev_warn(icd->parent, "Format %#x not found\n", |
1329 | pix->pixelformat); | 1329 | pix->pixelformat); |
1330 | return -EINVAL; | 1330 | return -EINVAL; |
1331 | } | 1331 | } |
@@ -1361,7 +1361,7 @@ static int omap1_cam_mmap_mapper(struct videobuf_queue *q, | |||
1361 | struct vm_area_struct *vma) | 1361 | struct vm_area_struct *vma) |
1362 | { | 1362 | { |
1363 | struct soc_camera_device *icd = q->priv_data; | 1363 | struct soc_camera_device *icd = q->priv_data; |
1364 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 1364 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
1365 | struct omap1_cam_dev *pcdev = ici->priv; | 1365 | struct omap1_cam_dev *pcdev = ici->priv; |
1366 | int ret; | 1366 | int ret; |
1367 | 1367 | ||
@@ -1376,17 +1376,17 @@ static int omap1_cam_mmap_mapper(struct videobuf_queue *q, | |||
1376 | static void omap1_cam_init_videobuf(struct videobuf_queue *q, | 1376 | static void omap1_cam_init_videobuf(struct videobuf_queue *q, |
1377 | struct soc_camera_device *icd) | 1377 | struct soc_camera_device *icd) |
1378 | { | 1378 | { |
1379 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 1379 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
1380 | struct omap1_cam_dev *pcdev = ici->priv; | 1380 | struct omap1_cam_dev *pcdev = ici->priv; |
1381 | 1381 | ||
1382 | if (!sg_mode) | 1382 | if (!sg_mode) |
1383 | videobuf_queue_dma_contig_init(q, &omap1_videobuf_ops, | 1383 | videobuf_queue_dma_contig_init(q, &omap1_videobuf_ops, |
1384 | icd->dev.parent, &pcdev->lock, | 1384 | icd->parent, &pcdev->lock, |
1385 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, | 1385 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, |
1386 | sizeof(struct omap1_cam_buf), icd, &icd->video_lock); | 1386 | sizeof(struct omap1_cam_buf), icd, &icd->video_lock); |
1387 | else | 1387 | else |
1388 | videobuf_queue_sg_init(q, &omap1_videobuf_ops, | 1388 | videobuf_queue_sg_init(q, &omap1_videobuf_ops, |
1389 | icd->dev.parent, &pcdev->lock, | 1389 | icd->parent, &pcdev->lock, |
1390 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, | 1390 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, |
1391 | sizeof(struct omap1_cam_buf), icd, &icd->video_lock); | 1391 | sizeof(struct omap1_cam_buf), icd, &icd->video_lock); |
1392 | 1392 | ||
@@ -1438,9 +1438,9 @@ static int omap1_cam_querycap(struct soc_camera_host *ici, | |||
1438 | static int omap1_cam_set_bus_param(struct soc_camera_device *icd, | 1438 | static int omap1_cam_set_bus_param(struct soc_camera_device *icd, |
1439 | __u32 pixfmt) | 1439 | __u32 pixfmt) |
1440 | { | 1440 | { |
1441 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 1441 | struct device *dev = icd->parent; |
1442 | struct soc_camera_host *ici = to_soc_camera_host(dev); | ||
1442 | struct omap1_cam_dev *pcdev = ici->priv; | 1443 | struct omap1_cam_dev *pcdev = ici->priv; |
1443 | struct device *dev = icd->dev.parent; | ||
1444 | const struct soc_camera_format_xlate *xlate; | 1444 | const struct soc_camera_format_xlate *xlate; |
1445 | const struct soc_mbus_pixelfmt *fmt; | 1445 | const struct soc_mbus_pixelfmt *fmt; |
1446 | unsigned long camera_flags, common_flags; | 1446 | unsigned long camera_flags, common_flags; |
diff --git a/drivers/media/video/ov2640.c b/drivers/media/video/ov2640.c index 0cea0cf3667..9ce2fa037b9 100644 --- a/drivers/media/video/ov2640.c +++ b/drivers/media/video/ov2640.c | |||
@@ -1031,16 +1031,9 @@ static int ov2640_video_probe(struct soc_camera_device *icd, | |||
1031 | const char *devname; | 1031 | const char *devname; |
1032 | int ret; | 1032 | int ret; |
1033 | 1033 | ||
1034 | /* | 1034 | /* We must have a parent by now. And it cannot be a wrong one. */ |
1035 | * we must have a parent by now. And it cannot be a wrong one. | 1035 | BUG_ON(!icd->parent || |
1036 | * So this entire test is completely redundant. | 1036 | to_soc_camera_host(icd->parent)->nr != icd->iface); |
1037 | */ | ||
1038 | if (!icd->dev.parent || | ||
1039 | to_soc_camera_host(icd->dev.parent)->nr != icd->iface) { | ||
1040 | dev_err(&client->dev, "Parent missing or invalid!\n"); | ||
1041 | ret = -ENODEV; | ||
1042 | goto err; | ||
1043 | } | ||
1044 | 1037 | ||
1045 | /* | 1038 | /* |
1046 | * check and show product ID and manufacturer ID | 1039 | * check and show product ID and manufacturer ID |
diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c index 48895ef863f..397870f076c 100644 --- a/drivers/media/video/ov772x.c +++ b/drivers/media/video/ov772x.c | |||
@@ -1032,13 +1032,9 @@ static int ov772x_video_probe(struct soc_camera_device *icd, | |||
1032 | u8 pid, ver; | 1032 | u8 pid, ver; |
1033 | const char *devname; | 1033 | const char *devname; |
1034 | 1034 | ||
1035 | /* | 1035 | /* We must have a parent by now. And it cannot be a wrong one. */ |
1036 | * We must have a parent by now. And it cannot be a wrong one. | 1036 | BUG_ON(!icd->parent || |
1037 | * So this entire test is completely redundant. | 1037 | to_soc_camera_host(icd->parent)->nr != icd->iface); |
1038 | */ | ||
1039 | if (!icd->dev.parent || | ||
1040 | to_soc_camera_host(icd->dev.parent)->nr != icd->iface) | ||
1041 | return -ENODEV; | ||
1042 | 1038 | ||
1043 | /* | 1039 | /* |
1044 | * check and show product ID and manufacturer ID | 1040 | * check and show product ID and manufacturer ID |
diff --git a/drivers/media/video/ov9640.c b/drivers/media/video/ov9640.c index 5173ac449dd..3681a6ff081 100644 --- a/drivers/media/video/ov9640.c +++ b/drivers/media/video/ov9640.c | |||
@@ -657,16 +657,9 @@ static int ov9640_video_probe(struct soc_camera_device *icd, | |||
657 | const char *devname; | 657 | const char *devname; |
658 | int ret = 0; | 658 | int ret = 0; |
659 | 659 | ||
660 | /* | 660 | /* We must have a parent by now. And it cannot be a wrong one. */ |
661 | * We must have a parent by now. And it cannot be a wrong one. | 661 | BUG_ON(!icd->parent || |
662 | * So this entire test is completely redundant. | 662 | to_soc_camera_host(icd->parent)->nr != icd->iface); |
663 | */ | ||
664 | if (!icd->dev.parent || | ||
665 | to_soc_camera_host(icd->dev.parent)->nr != icd->iface) { | ||
666 | dev_err(&client->dev, "Parent missing or invalid!\n"); | ||
667 | ret = -ENODEV; | ||
668 | goto err; | ||
669 | } | ||
670 | 663 | ||
671 | /* | 664 | /* |
672 | * check and show product ID and manufacturer ID | 665 | * check and show product ID and manufacturer ID |
diff --git a/drivers/media/video/ov9740.c b/drivers/media/video/ov9740.c index ede48f2ed70..edd1ffcca30 100644 --- a/drivers/media/video/ov9740.c +++ b/drivers/media/video/ov9740.c | |||
@@ -898,16 +898,9 @@ static int ov9740_video_probe(struct soc_camera_device *icd, | |||
898 | u8 modelhi, modello; | 898 | u8 modelhi, modello; |
899 | int ret; | 899 | int ret; |
900 | 900 | ||
901 | /* | 901 | /* We must have a parent by now. And it cannot be a wrong one. */ |
902 | * We must have a parent by now. And it cannot be a wrong one. | 902 | BUG_ON(!icd->parent || |
903 | * So this entire test is completely redundant. | 903 | to_soc_camera_host(icd->parent)->nr != icd->iface); |
904 | */ | ||
905 | if (!icd->dev.parent || | ||
906 | to_soc_camera_host(icd->dev.parent)->nr != icd->iface) { | ||
907 | dev_err(&client->dev, "Parent missing or invalid!\n"); | ||
908 | ret = -ENODEV; | ||
909 | goto err; | ||
910 | } | ||
911 | 904 | ||
912 | /* | 905 | /* |
913 | * check and show product ID and manufacturer ID | 906 | * check and show product ID and manufacturer ID |
diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c index 020de529b95..d07df22a5ec 100644 --- a/drivers/media/video/pxa_camera.c +++ b/drivers/media/video/pxa_camera.c | |||
@@ -246,7 +246,7 @@ static int pxa_videobuf_setup(struct videobuf_queue *vq, unsigned int *count, | |||
246 | if (bytes_per_line < 0) | 246 | if (bytes_per_line < 0) |
247 | return bytes_per_line; | 247 | return bytes_per_line; |
248 | 248 | ||
249 | dev_dbg(icd->dev.parent, "count=%d, size=%d\n", *count, *size); | 249 | dev_dbg(icd->parent, "count=%d, size=%d\n", *count, *size); |
250 | 250 | ||
251 | *size = bytes_per_line * icd->user_height; | 251 | *size = bytes_per_line * icd->user_height; |
252 | 252 | ||
@@ -261,13 +261,13 @@ static int pxa_videobuf_setup(struct videobuf_queue *vq, unsigned int *count, | |||
261 | static void free_buffer(struct videobuf_queue *vq, struct pxa_buffer *buf) | 261 | static void free_buffer(struct videobuf_queue *vq, struct pxa_buffer *buf) |
262 | { | 262 | { |
263 | struct soc_camera_device *icd = vq->priv_data; | 263 | struct soc_camera_device *icd = vq->priv_data; |
264 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 264 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
265 | struct videobuf_dmabuf *dma = videobuf_to_dma(&buf->vb); | 265 | struct videobuf_dmabuf *dma = videobuf_to_dma(&buf->vb); |
266 | int i; | 266 | int i; |
267 | 267 | ||
268 | BUG_ON(in_interrupt()); | 268 | BUG_ON(in_interrupt()); |
269 | 269 | ||
270 | dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, | 270 | dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, |
271 | &buf->vb, buf->vb.baddr, buf->vb.bsize); | 271 | &buf->vb, buf->vb.baddr, buf->vb.bsize); |
272 | 272 | ||
273 | /* | 273 | /* |
@@ -428,7 +428,7 @@ static int pxa_videobuf_prepare(struct videobuf_queue *vq, | |||
428 | struct videobuf_buffer *vb, enum v4l2_field field) | 428 | struct videobuf_buffer *vb, enum v4l2_field field) |
429 | { | 429 | { |
430 | struct soc_camera_device *icd = vq->priv_data; | 430 | struct soc_camera_device *icd = vq->priv_data; |
431 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 431 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
432 | struct pxa_camera_dev *pcdev = ici->priv; | 432 | struct pxa_camera_dev *pcdev = ici->priv; |
433 | struct device *dev = pcdev->soc_host.v4l2_dev.dev; | 433 | struct device *dev = pcdev->soc_host.v4l2_dev.dev; |
434 | struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb); | 434 | 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 | struct videobuf_buffer *vb) | 635 | struct videobuf_buffer *vb) |
636 | { | 636 | { |
637 | struct soc_camera_device *icd = vq->priv_data; | 637 | struct soc_camera_device *icd = vq->priv_data; |
638 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 638 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
639 | struct pxa_camera_dev *pcdev = ici->priv; | 639 | struct pxa_camera_dev *pcdev = ici->priv; |
640 | struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb); | 640 | struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb); |
641 | 641 | ||
642 | dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d active=%p\n", | 642 | dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d active=%p\n", |
643 | __func__, vb, vb->baddr, vb->bsize, pcdev->active); | 643 | __func__, vb, vb->baddr, vb->bsize, pcdev->active); |
644 | 644 | ||
645 | list_add_tail(&vb->queue, &pcdev->capture); | 645 | list_add_tail(&vb->queue, &pcdev->capture); |
@@ -657,7 +657,7 @@ static void pxa_videobuf_release(struct videobuf_queue *vq, | |||
657 | struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb); | 657 | struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb); |
658 | #ifdef DEBUG | 658 | #ifdef DEBUG |
659 | struct soc_camera_device *icd = vq->priv_data; | 659 | struct soc_camera_device *icd = vq->priv_data; |
660 | struct device *dev = icd->dev.parent; | 660 | struct device *dev = icd->parent; |
661 | 661 | ||
662 | dev_dbg(dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, | 662 | dev_dbg(dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, |
663 | vb, vb->baddr, vb->bsize); | 663 | vb, vb->baddr, vb->bsize); |
@@ -842,7 +842,7 @@ static struct videobuf_queue_ops pxa_videobuf_ops = { | |||
842 | static void pxa_camera_init_videobuf(struct videobuf_queue *q, | 842 | static void pxa_camera_init_videobuf(struct videobuf_queue *q, |
843 | struct soc_camera_device *icd) | 843 | struct soc_camera_device *icd) |
844 | { | 844 | { |
845 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 845 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
846 | struct pxa_camera_dev *pcdev = ici->priv; | 846 | struct pxa_camera_dev *pcdev = ici->priv; |
847 | 847 | ||
848 | /* | 848 | /* |
@@ -971,7 +971,7 @@ static irqreturn_t pxa_camera_irq(int irq, void *data) | |||
971 | */ | 971 | */ |
972 | static int pxa_camera_add_device(struct soc_camera_device *icd) | 972 | static int pxa_camera_add_device(struct soc_camera_device *icd) |
973 | { | 973 | { |
974 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 974 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
975 | struct pxa_camera_dev *pcdev = ici->priv; | 975 | struct pxa_camera_dev *pcdev = ici->priv; |
976 | 976 | ||
977 | if (pcdev->icd) | 977 | if (pcdev->icd) |
@@ -981,7 +981,7 @@ static int pxa_camera_add_device(struct soc_camera_device *icd) | |||
981 | 981 | ||
982 | pcdev->icd = icd; | 982 | pcdev->icd = icd; |
983 | 983 | ||
984 | dev_info(icd->dev.parent, "PXA Camera driver attached to camera %d\n", | 984 | dev_info(icd->parent, "PXA Camera driver attached to camera %d\n", |
985 | icd->devnum); | 985 | icd->devnum); |
986 | 986 | ||
987 | return 0; | 987 | return 0; |
@@ -990,12 +990,12 @@ static int pxa_camera_add_device(struct soc_camera_device *icd) | |||
990 | /* Called with .video_lock held */ | 990 | /* Called with .video_lock held */ |
991 | static void pxa_camera_remove_device(struct soc_camera_device *icd) | 991 | static void pxa_camera_remove_device(struct soc_camera_device *icd) |
992 | { | 992 | { |
993 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 993 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
994 | struct pxa_camera_dev *pcdev = ici->priv; | 994 | struct pxa_camera_dev *pcdev = ici->priv; |
995 | 995 | ||
996 | BUG_ON(icd != pcdev->icd); | 996 | BUG_ON(icd != pcdev->icd); |
997 | 997 | ||
998 | dev_info(icd->dev.parent, "PXA Camera driver detached from camera %d\n", | 998 | dev_info(icd->parent, "PXA Camera driver detached from camera %d\n", |
999 | icd->devnum); | 999 | icd->devnum); |
1000 | 1000 | ||
1001 | /* disable capture, disable interrupts */ | 1001 | /* disable capture, disable interrupts */ |
@@ -1056,7 +1056,7 @@ static int test_platform_param(struct pxa_camera_dev *pcdev, | |||
1056 | static void pxa_camera_setup_cicr(struct soc_camera_device *icd, | 1056 | static void pxa_camera_setup_cicr(struct soc_camera_device *icd, |
1057 | unsigned long flags, __u32 pixfmt) | 1057 | unsigned long flags, __u32 pixfmt) |
1058 | { | 1058 | { |
1059 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 1059 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
1060 | struct pxa_camera_dev *pcdev = ici->priv; | 1060 | struct pxa_camera_dev *pcdev = ici->priv; |
1061 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 1061 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
1062 | unsigned long dw, bpp; | 1062 | unsigned long dw, bpp; |
@@ -1151,7 +1151,7 @@ static void pxa_camera_setup_cicr(struct soc_camera_device *icd, | |||
1151 | 1151 | ||
1152 | static int pxa_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) | 1152 | static int pxa_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) |
1153 | { | 1153 | { |
1154 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 1154 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
1155 | struct pxa_camera_dev *pcdev = ici->priv; | 1155 | struct pxa_camera_dev *pcdev = ici->priv; |
1156 | unsigned long bus_flags, camera_flags, common_flags; | 1156 | unsigned long bus_flags, camera_flags, common_flags; |
1157 | int ret; | 1157 | int ret; |
@@ -1209,7 +1209,7 @@ static int pxa_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) | |||
1209 | static int pxa_camera_try_bus_param(struct soc_camera_device *icd, | 1209 | static int pxa_camera_try_bus_param(struct soc_camera_device *icd, |
1210 | unsigned char buswidth) | 1210 | unsigned char buswidth) |
1211 | { | 1211 | { |
1212 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 1212 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
1213 | struct pxa_camera_dev *pcdev = ici->priv; | 1213 | struct pxa_camera_dev *pcdev = ici->priv; |
1214 | unsigned long bus_flags, camera_flags; | 1214 | unsigned long bus_flags, camera_flags; |
1215 | int ret = test_platform_param(pcdev, buswidth, &bus_flags); | 1215 | 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 | struct soc_camera_format_xlate *xlate) | 1246 | struct soc_camera_format_xlate *xlate) |
1247 | { | 1247 | { |
1248 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 1248 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
1249 | struct device *dev = icd->dev.parent; | 1249 | struct device *dev = icd->parent; |
1250 | int formats = 0, ret; | 1250 | int formats = 0, ret; |
1251 | struct pxa_cam *cam; | 1251 | struct pxa_cam *cam; |
1252 | enum v4l2_mbus_pixelcode code; | 1252 | enum v4l2_mbus_pixelcode code; |
@@ -1334,9 +1334,9 @@ static int pxa_camera_set_crop(struct soc_camera_device *icd, | |||
1334 | struct v4l2_crop *a) | 1334 | struct v4l2_crop *a) |
1335 | { | 1335 | { |
1336 | struct v4l2_rect *rect = &a->c; | 1336 | struct v4l2_rect *rect = &a->c; |
1337 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 1337 | struct device *dev = icd->parent; |
1338 | struct soc_camera_host *ici = to_soc_camera_host(dev); | ||
1338 | struct pxa_camera_dev *pcdev = ici->priv; | 1339 | struct pxa_camera_dev *pcdev = ici->priv; |
1339 | struct device *dev = icd->dev.parent; | ||
1340 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 1340 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
1341 | struct soc_camera_sense sense = { | 1341 | struct soc_camera_sense sense = { |
1342 | .master_clock = pcdev->mclk, | 1342 | .master_clock = pcdev->mclk, |
@@ -1378,7 +1378,7 @@ static int pxa_camera_set_crop(struct soc_camera_device *icd, | |||
1378 | return ret; | 1378 | return ret; |
1379 | 1379 | ||
1380 | if (pxa_camera_check_frame(mf.width, mf.height)) { | 1380 | if (pxa_camera_check_frame(mf.width, mf.height)) { |
1381 | dev_warn(icd->dev.parent, | 1381 | dev_warn(icd->parent, |
1382 | "Inconsistent state. Use S_FMT to repair\n"); | 1382 | "Inconsistent state. Use S_FMT to repair\n"); |
1383 | return -EINVAL; | 1383 | return -EINVAL; |
1384 | } | 1384 | } |
@@ -1405,9 +1405,9 @@ static int pxa_camera_set_crop(struct soc_camera_device *icd, | |||
1405 | static int pxa_camera_set_fmt(struct soc_camera_device *icd, | 1405 | static int pxa_camera_set_fmt(struct soc_camera_device *icd, |
1406 | struct v4l2_format *f) | 1406 | struct v4l2_format *f) |
1407 | { | 1407 | { |
1408 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 1408 | struct device *dev = icd->parent; |
1409 | struct soc_camera_host *ici = to_soc_camera_host(dev); | ||
1409 | struct pxa_camera_dev *pcdev = ici->priv; | 1410 | struct pxa_camera_dev *pcdev = ici->priv; |
1410 | struct device *dev = icd->dev.parent; | ||
1411 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 1411 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
1412 | const struct soc_camera_format_xlate *xlate = NULL; | 1412 | const struct soc_camera_format_xlate *xlate = NULL; |
1413 | struct soc_camera_sense sense = { | 1413 | struct soc_camera_sense sense = { |
@@ -1484,7 +1484,7 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd, | |||
1484 | 1484 | ||
1485 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); | 1485 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); |
1486 | if (!xlate) { | 1486 | if (!xlate) { |
1487 | dev_warn(icd->dev.parent, "Format %x not found\n", pixfmt); | 1487 | dev_warn(icd->parent, "Format %x not found\n", pixfmt); |
1488 | return -EINVAL; | 1488 | return -EINVAL; |
1489 | } | 1489 | } |
1490 | 1490 | ||
@@ -1521,7 +1521,7 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd, | |||
1521 | break; | 1521 | break; |
1522 | default: | 1522 | default: |
1523 | /* TODO: support interlaced at least in pass-through mode */ | 1523 | /* TODO: support interlaced at least in pass-through mode */ |
1524 | dev_err(icd->dev.parent, "Field type %d unsupported.\n", | 1524 | dev_err(icd->parent, "Field type %d unsupported.\n", |
1525 | mf.field); | 1525 | mf.field); |
1526 | return -EINVAL; | 1526 | return -EINVAL; |
1527 | } | 1527 | } |
diff --git a/drivers/media/video/rj54n1cb0c.c b/drivers/media/video/rj54n1cb0c.c index 57e11b6f19f..847ccc067e8 100644 --- a/drivers/media/video/rj54n1cb0c.c +++ b/drivers/media/video/rj54n1cb0c.c | |||
@@ -1364,10 +1364,9 @@ static int rj54n1_video_probe(struct soc_camera_device *icd, | |||
1364 | int data1, data2; | 1364 | int data1, data2; |
1365 | int ret; | 1365 | int ret; |
1366 | 1366 | ||
1367 | /* This could be a BUG_ON() or a WARN_ON(), or remove it completely */ | 1367 | /* We must have a parent by now. And it cannot be a wrong one. */ |
1368 | if (!icd->dev.parent || | 1368 | BUG_ON(!icd->parent || |
1369 | to_soc_camera_host(icd->dev.parent)->nr != icd->iface) | 1369 | to_soc_camera_host(icd->parent)->nr != icd->iface); |
1370 | return -ENODEV; | ||
1371 | 1370 | ||
1372 | /* Read out the chip version register */ | 1371 | /* Read out the chip version register */ |
1373 | data1 = reg_read(client, RJ54N1_DEV_CODE); | 1372 | data1 = reg_read(client, RJ54N1_DEV_CODE); |
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c index 152a6599328..f86550703f8 100644 --- a/drivers/media/video/sh_mobile_ceu_camera.c +++ b/drivers/media/video/sh_mobile_ceu_camera.c | |||
@@ -206,7 +206,7 @@ static int sh_mobile_ceu_soft_reset(struct sh_mobile_ceu_dev *pcdev) | |||
206 | 206 | ||
207 | 207 | ||
208 | if (2 != success) { | 208 | if (2 != success) { |
209 | dev_warn(&icd->dev, "soft reset time out\n"); | 209 | dev_warn(icd->pdev, "soft reset time out\n"); |
210 | return -EIO; | 210 | return -EIO; |
211 | } | 211 | } |
212 | 212 | ||
@@ -221,7 +221,7 @@ static int sh_mobile_ceu_videobuf_setup(struct vb2_queue *vq, | |||
221 | unsigned long sizes[], void *alloc_ctxs[]) | 221 | unsigned long sizes[], void *alloc_ctxs[]) |
222 | { | 222 | { |
223 | struct soc_camera_device *icd = container_of(vq, struct soc_camera_device, vb2_vidq); | 223 | struct soc_camera_device *icd = container_of(vq, struct soc_camera_device, vb2_vidq); |
224 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 224 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
225 | struct sh_mobile_ceu_dev *pcdev = ici->priv; | 225 | struct sh_mobile_ceu_dev *pcdev = ici->priv; |
226 | int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, | 226 | int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, |
227 | icd->current_fmt->host_fmt); | 227 | icd->current_fmt->host_fmt); |
@@ -243,7 +243,7 @@ static int sh_mobile_ceu_videobuf_setup(struct vb2_queue *vq, | |||
243 | *count = pcdev->video_limit / PAGE_ALIGN(sizes[0]); | 243 | *count = pcdev->video_limit / PAGE_ALIGN(sizes[0]); |
244 | } | 244 | } |
245 | 245 | ||
246 | dev_dbg(icd->dev.parent, "count=%d, size=%lu\n", *count, sizes[0]); | 246 | dev_dbg(icd->parent, "count=%d, size=%lu\n", *count, sizes[0]); |
247 | 247 | ||
248 | return 0; | 248 | return 0; |
249 | } | 249 | } |
@@ -352,7 +352,7 @@ static int sh_mobile_ceu_videobuf_prepare(struct vb2_buffer *vb) | |||
352 | 352 | ||
353 | buf = to_ceu_vb(vb); | 353 | buf = to_ceu_vb(vb); |
354 | 354 | ||
355 | dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%p %lu\n", __func__, | 355 | dev_dbg(icd->parent, "%s (vb=0x%p) 0x%p %lu\n", __func__, |
356 | vb, vb2_plane_vaddr(vb, 0), vb2_get_plane_payload(vb, 0)); | 356 | vb, vb2_plane_vaddr(vb, 0), vb2_get_plane_payload(vb, 0)); |
357 | 357 | ||
358 | /* Added list head initialization on alloc */ | 358 | /* Added list head initialization on alloc */ |
@@ -372,7 +372,7 @@ static int sh_mobile_ceu_videobuf_prepare(struct vb2_buffer *vb) | |||
372 | size = icd->user_height * bytes_per_line; | 372 | size = icd->user_height * bytes_per_line; |
373 | 373 | ||
374 | if (vb2_plane_size(vb, 0) < size) { | 374 | if (vb2_plane_size(vb, 0) < size) { |
375 | dev_err(icd->dev.parent, "Buffer too small (%lu < %lu)\n", | 375 | dev_err(icd->parent, "Buffer too small (%lu < %lu)\n", |
376 | vb2_plane_size(vb, 0), size); | 376 | vb2_plane_size(vb, 0), size); |
377 | return -ENOBUFS; | 377 | return -ENOBUFS; |
378 | } | 378 | } |
@@ -385,11 +385,11 @@ static int sh_mobile_ceu_videobuf_prepare(struct vb2_buffer *vb) | |||
385 | static void sh_mobile_ceu_videobuf_queue(struct vb2_buffer *vb) | 385 | static void sh_mobile_ceu_videobuf_queue(struct vb2_buffer *vb) |
386 | { | 386 | { |
387 | struct soc_camera_device *icd = container_of(vb->vb2_queue, struct soc_camera_device, vb2_vidq); | 387 | struct soc_camera_device *icd = container_of(vb->vb2_queue, struct soc_camera_device, vb2_vidq); |
388 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 388 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
389 | struct sh_mobile_ceu_dev *pcdev = ici->priv; | 389 | struct sh_mobile_ceu_dev *pcdev = ici->priv; |
390 | struct sh_mobile_ceu_buffer *buf = to_ceu_vb(vb); | 390 | struct sh_mobile_ceu_buffer *buf = to_ceu_vb(vb); |
391 | 391 | ||
392 | dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%p %lu\n", __func__, | 392 | dev_dbg(icd->parent, "%s (vb=0x%p) 0x%p %lu\n", __func__, |
393 | vb, vb2_plane_vaddr(vb, 0), vb2_get_plane_payload(vb, 0)); | 393 | vb, vb2_plane_vaddr(vb, 0), vb2_get_plane_payload(vb, 0)); |
394 | 394 | ||
395 | spin_lock_irq(&pcdev->lock); | 395 | spin_lock_irq(&pcdev->lock); |
@@ -410,7 +410,7 @@ static void sh_mobile_ceu_videobuf_queue(struct vb2_buffer *vb) | |||
410 | static void sh_mobile_ceu_videobuf_release(struct vb2_buffer *vb) | 410 | static void sh_mobile_ceu_videobuf_release(struct vb2_buffer *vb) |
411 | { | 411 | { |
412 | struct soc_camera_device *icd = container_of(vb->vb2_queue, struct soc_camera_device, vb2_vidq); | 412 | struct soc_camera_device *icd = container_of(vb->vb2_queue, struct soc_camera_device, vb2_vidq); |
413 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 413 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
414 | struct sh_mobile_ceu_buffer *buf = to_ceu_vb(vb); | 414 | struct sh_mobile_ceu_buffer *buf = to_ceu_vb(vb); |
415 | struct sh_mobile_ceu_dev *pcdev = ici->priv; | 415 | struct sh_mobile_ceu_dev *pcdev = ici->priv; |
416 | 416 | ||
@@ -438,7 +438,7 @@ static int sh_mobile_ceu_videobuf_init(struct vb2_buffer *vb) | |||
438 | static int sh_mobile_ceu_stop_streaming(struct vb2_queue *q) | 438 | static int sh_mobile_ceu_stop_streaming(struct vb2_queue *q) |
439 | { | 439 | { |
440 | struct soc_camera_device *icd = container_of(q, struct soc_camera_device, vb2_vidq); | 440 | struct soc_camera_device *icd = container_of(q, struct soc_camera_device, vb2_vidq); |
441 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 441 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
442 | struct sh_mobile_ceu_dev *pcdev = ici->priv; | 442 | struct sh_mobile_ceu_dev *pcdev = ici->priv; |
443 | struct list_head *buf_head, *tmp; | 443 | struct list_head *buf_head, *tmp; |
444 | 444 | ||
@@ -517,7 +517,7 @@ static struct v4l2_subdev *find_csi2(struct sh_mobile_ceu_dev *pcdev) | |||
517 | /* Called with .video_lock held */ | 517 | /* Called with .video_lock held */ |
518 | static int sh_mobile_ceu_add_device(struct soc_camera_device *icd) | 518 | static int sh_mobile_ceu_add_device(struct soc_camera_device *icd) |
519 | { | 519 | { |
520 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 520 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
521 | struct sh_mobile_ceu_dev *pcdev = ici->priv; | 521 | struct sh_mobile_ceu_dev *pcdev = ici->priv; |
522 | struct v4l2_subdev *csi2_sd; | 522 | struct v4l2_subdev *csi2_sd; |
523 | int ret; | 523 | int ret; |
@@ -525,7 +525,7 @@ static int sh_mobile_ceu_add_device(struct soc_camera_device *icd) | |||
525 | if (pcdev->icd) | 525 | if (pcdev->icd) |
526 | return -EBUSY; | 526 | return -EBUSY; |
527 | 527 | ||
528 | dev_info(icd->dev.parent, | 528 | dev_info(icd->parent, |
529 | "SuperH Mobile CEU driver attached to camera %d\n", | 529 | "SuperH Mobile CEU driver attached to camera %d\n", |
530 | icd->devnum); | 530 | icd->devnum); |
531 | 531 | ||
@@ -549,7 +549,7 @@ static int sh_mobile_ceu_add_device(struct soc_camera_device *icd) | |||
549 | /* Called with .video_lock held */ | 549 | /* Called with .video_lock held */ |
550 | static void sh_mobile_ceu_remove_device(struct soc_camera_device *icd) | 550 | static void sh_mobile_ceu_remove_device(struct soc_camera_device *icd) |
551 | { | 551 | { |
552 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 552 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
553 | struct sh_mobile_ceu_dev *pcdev = ici->priv; | 553 | struct sh_mobile_ceu_dev *pcdev = ici->priv; |
554 | struct v4l2_subdev *csi2_sd = find_csi2(pcdev); | 554 | struct v4l2_subdev *csi2_sd = find_csi2(pcdev); |
555 | 555 | ||
@@ -571,7 +571,7 @@ static void sh_mobile_ceu_remove_device(struct soc_camera_device *icd) | |||
571 | 571 | ||
572 | pm_runtime_put_sync(ici->v4l2_dev.dev); | 572 | pm_runtime_put_sync(ici->v4l2_dev.dev); |
573 | 573 | ||
574 | dev_info(icd->dev.parent, | 574 | dev_info(icd->parent, |
575 | "SuperH Mobile CEU driver detached from camera %d\n", | 575 | "SuperH Mobile CEU driver detached from camera %d\n", |
576 | icd->devnum); | 576 | icd->devnum); |
577 | 577 | ||
@@ -611,14 +611,14 @@ static u16 calc_scale(unsigned int src, unsigned int *dst) | |||
611 | /* rect is guaranteed to not exceed the scaled camera rectangle */ | 611 | /* rect is guaranteed to not exceed the scaled camera rectangle */ |
612 | static void sh_mobile_ceu_set_rect(struct soc_camera_device *icd) | 612 | static void sh_mobile_ceu_set_rect(struct soc_camera_device *icd) |
613 | { | 613 | { |
614 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 614 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
615 | struct sh_mobile_ceu_cam *cam = icd->host_priv; | 615 | struct sh_mobile_ceu_cam *cam = icd->host_priv; |
616 | struct sh_mobile_ceu_dev *pcdev = ici->priv; | 616 | struct sh_mobile_ceu_dev *pcdev = ici->priv; |
617 | unsigned int height, width, cdwdr_width, in_width, in_height; | 617 | unsigned int height, width, cdwdr_width, in_width, in_height; |
618 | unsigned int left_offset, top_offset; | 618 | unsigned int left_offset, top_offset; |
619 | u32 camor; | 619 | u32 camor; |
620 | 620 | ||
621 | dev_geo(icd->dev.parent, "Crop %ux%u@%u:%u\n", | 621 | dev_geo(icd->parent, "Crop %ux%u@%u:%u\n", |
622 | icd->user_width, icd->user_height, cam->ceu_left, cam->ceu_top); | 622 | icd->user_width, icd->user_height, cam->ceu_left, cam->ceu_top); |
623 | 623 | ||
624 | left_offset = cam->ceu_left; | 624 | left_offset = cam->ceu_left; |
@@ -675,7 +675,7 @@ static void sh_mobile_ceu_set_rect(struct soc_camera_device *icd) | |||
675 | /* Set CAMOR, CAPWR, CFSZR, take care of CDWDR */ | 675 | /* Set CAMOR, CAPWR, CFSZR, take care of CDWDR */ |
676 | camor = left_offset | (top_offset << 16); | 676 | camor = left_offset | (top_offset << 16); |
677 | 677 | ||
678 | dev_geo(icd->dev.parent, | 678 | dev_geo(icd->parent, |
679 | "CAMOR 0x%x, CAPWR 0x%x, CFSZR 0x%x, CDWDR 0x%x\n", camor, | 679 | "CAMOR 0x%x, CAPWR 0x%x, CFSZR 0x%x, CDWDR 0x%x\n", camor, |
680 | (in_height << 16) | in_width, (height << 16) | width, | 680 | (in_height << 16) | in_width, (height << 16) | width, |
681 | cdwdr_width); | 681 | cdwdr_width); |
@@ -723,7 +723,7 @@ static void capture_restore(struct sh_mobile_ceu_dev *pcdev, u32 capsr) | |||
723 | static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd, | 723 | static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd, |
724 | __u32 pixfmt) | 724 | __u32 pixfmt) |
725 | { | 725 | { |
726 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 726 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
727 | struct sh_mobile_ceu_dev *pcdev = ici->priv; | 727 | struct sh_mobile_ceu_dev *pcdev = ici->priv; |
728 | int ret; | 728 | int ret; |
729 | unsigned long camera_flags, common_flags, value; | 729 | 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 | sh_mobile_ceu_set_rect(icd); | 832 | sh_mobile_ceu_set_rect(icd); |
833 | mdelay(1); | 833 | mdelay(1); |
834 | 834 | ||
835 | dev_geo(icd->dev.parent, "CFLCR 0x%x\n", pcdev->cflcr); | 835 | dev_geo(icd->parent, "CFLCR 0x%x\n", pcdev->cflcr); |
836 | ceu_write(pcdev, CFLCR, pcdev->cflcr); | 836 | ceu_write(pcdev, CFLCR, pcdev->cflcr); |
837 | 837 | ||
838 | /* | 838 | /* |
@@ -855,7 +855,7 @@ static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd, | |||
855 | ceu_write(pcdev, CDOCR, value); | 855 | ceu_write(pcdev, CDOCR, value); |
856 | ceu_write(pcdev, CFWCR, 0); /* keep "datafetch firewall" disabled */ | 856 | ceu_write(pcdev, CFWCR, 0); /* keep "datafetch firewall" disabled */ |
857 | 857 | ||
858 | dev_dbg(icd->dev.parent, "S_FMT successful for %c%c%c%c %ux%u\n", | 858 | dev_dbg(icd->parent, "S_FMT successful for %c%c%c%c %ux%u\n", |
859 | pixfmt & 0xff, (pixfmt >> 8) & 0xff, | 859 | pixfmt & 0xff, (pixfmt >> 8) & 0xff, |
860 | (pixfmt >> 16) & 0xff, (pixfmt >> 24) & 0xff, | 860 | (pixfmt >> 16) & 0xff, (pixfmt >> 24) & 0xff, |
861 | icd->user_width, icd->user_height); | 861 | icd->user_width, icd->user_height); |
@@ -869,7 +869,7 @@ static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd, | |||
869 | static int sh_mobile_ceu_try_bus_param(struct soc_camera_device *icd, | 869 | static int sh_mobile_ceu_try_bus_param(struct soc_camera_device *icd, |
870 | unsigned char buswidth) | 870 | unsigned char buswidth) |
871 | { | 871 | { |
872 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 872 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
873 | struct sh_mobile_ceu_dev *pcdev = ici->priv; | 873 | struct sh_mobile_ceu_dev *pcdev = ici->priv; |
874 | unsigned long camera_flags, common_flags; | 874 | unsigned long camera_flags, common_flags; |
875 | 875 | ||
@@ -927,7 +927,7 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, unsigned int | |||
927 | struct soc_camera_format_xlate *xlate) | 927 | struct soc_camera_format_xlate *xlate) |
928 | { | 928 | { |
929 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 929 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
930 | struct device *dev = icd->dev.parent; | 930 | struct device *dev = icd->parent; |
931 | struct soc_camera_host *ici = to_soc_camera_host(dev); | 931 | struct soc_camera_host *ici = to_soc_camera_host(dev); |
932 | struct sh_mobile_ceu_dev *pcdev = ici->priv; | 932 | struct sh_mobile_ceu_dev *pcdev = ici->priv; |
933 | int ret, k, n; | 933 | int ret, k, n; |
@@ -1270,7 +1270,7 @@ static int client_s_fmt(struct soc_camera_device *icd, | |||
1270 | { | 1270 | { |
1271 | struct sh_mobile_ceu_cam *cam = icd->host_priv; | 1271 | struct sh_mobile_ceu_cam *cam = icd->host_priv; |
1272 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 1272 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
1273 | struct device *dev = icd->dev.parent; | 1273 | struct device *dev = icd->parent; |
1274 | unsigned int width = mf->width, height = mf->height, tmp_w, tmp_h; | 1274 | unsigned int width = mf->width, height = mf->height, tmp_w, tmp_h; |
1275 | unsigned int max_width, max_height; | 1275 | unsigned int max_width, max_height; |
1276 | struct v4l2_cropcap cap; | 1276 | struct v4l2_cropcap cap; |
@@ -1339,7 +1339,7 @@ static int client_scale(struct soc_camera_device *icd, | |||
1339 | bool ceu_can_scale) | 1339 | bool ceu_can_scale) |
1340 | { | 1340 | { |
1341 | struct sh_mobile_ceu_cam *cam = icd->host_priv; | 1341 | struct sh_mobile_ceu_cam *cam = icd->host_priv; |
1342 | struct device *dev = icd->dev.parent; | 1342 | struct device *dev = icd->parent; |
1343 | struct v4l2_mbus_framefmt mf_tmp = *mf; | 1343 | struct v4l2_mbus_framefmt mf_tmp = *mf; |
1344 | unsigned int scale_h, scale_v; | 1344 | unsigned int scale_h, scale_v; |
1345 | int ret; | 1345 | int ret; |
@@ -1389,13 +1389,13 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd, | |||
1389 | struct v4l2_crop *a) | 1389 | struct v4l2_crop *a) |
1390 | { | 1390 | { |
1391 | struct v4l2_rect *rect = &a->c; | 1391 | struct v4l2_rect *rect = &a->c; |
1392 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 1392 | struct device *dev = icd->parent; |
1393 | struct soc_camera_host *ici = to_soc_camera_host(dev); | ||
1393 | struct sh_mobile_ceu_dev *pcdev = ici->priv; | 1394 | struct sh_mobile_ceu_dev *pcdev = ici->priv; |
1394 | struct v4l2_crop cam_crop; | 1395 | struct v4l2_crop cam_crop; |
1395 | struct sh_mobile_ceu_cam *cam = icd->host_priv; | 1396 | struct sh_mobile_ceu_cam *cam = icd->host_priv; |
1396 | struct v4l2_rect *cam_rect = &cam_crop.c; | 1397 | struct v4l2_rect *cam_rect = &cam_crop.c; |
1397 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 1398 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
1398 | struct device *dev = icd->dev.parent; | ||
1399 | struct v4l2_mbus_framefmt mf; | 1399 | struct v4l2_mbus_framefmt mf; |
1400 | unsigned int scale_cam_h, scale_cam_v, scale_ceu_h, scale_ceu_v, | 1400 | unsigned int scale_cam_h, scale_cam_v, scale_ceu_h, scale_ceu_v, |
1401 | out_width, out_height; | 1401 | out_width, out_height; |
@@ -1537,7 +1537,7 @@ static void calculate_client_output(struct soc_camera_device *icd, | |||
1537 | struct v4l2_pix_format *pix, struct v4l2_mbus_framefmt *mf) | 1537 | struct v4l2_pix_format *pix, struct v4l2_mbus_framefmt *mf) |
1538 | { | 1538 | { |
1539 | struct sh_mobile_ceu_cam *cam = icd->host_priv; | 1539 | struct sh_mobile_ceu_cam *cam = icd->host_priv; |
1540 | struct device *dev = icd->dev.parent; | 1540 | struct device *dev = icd->parent; |
1541 | struct v4l2_rect *cam_subrect = &cam->subrect; | 1541 | struct v4l2_rect *cam_subrect = &cam->subrect; |
1542 | unsigned int scale_v, scale_h; | 1542 | unsigned int scale_v, scale_h; |
1543 | 1543 | ||
@@ -1581,12 +1581,12 @@ static void calculate_client_output(struct soc_camera_device *icd, | |||
1581 | static int sh_mobile_ceu_set_fmt(struct soc_camera_device *icd, | 1581 | static int sh_mobile_ceu_set_fmt(struct soc_camera_device *icd, |
1582 | struct v4l2_format *f) | 1582 | struct v4l2_format *f) |
1583 | { | 1583 | { |
1584 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 1584 | struct device *dev = icd->parent; |
1585 | struct soc_camera_host *ici = to_soc_camera_host(dev); | ||
1585 | struct sh_mobile_ceu_dev *pcdev = ici->priv; | 1586 | struct sh_mobile_ceu_dev *pcdev = ici->priv; |
1586 | struct sh_mobile_ceu_cam *cam = icd->host_priv; | 1587 | struct sh_mobile_ceu_cam *cam = icd->host_priv; |
1587 | struct v4l2_pix_format *pix = &f->fmt.pix; | 1588 | struct v4l2_pix_format *pix = &f->fmt.pix; |
1588 | struct v4l2_mbus_framefmt mf; | 1589 | struct v4l2_mbus_framefmt mf; |
1589 | struct device *dev = icd->dev.parent; | ||
1590 | __u32 pixfmt = pix->pixelformat; | 1590 | __u32 pixfmt = pix->pixelformat; |
1591 | const struct soc_camera_format_xlate *xlate; | 1591 | const struct soc_camera_format_xlate *xlate; |
1592 | /* Keep Compiler Happy */ | 1592 | /* Keep Compiler Happy */ |
@@ -1710,12 +1710,12 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, | |||
1710 | int width, height; | 1710 | int width, height; |
1711 | int ret; | 1711 | int ret; |
1712 | 1712 | ||
1713 | dev_geo(icd->dev.parent, "TRY_FMT(pix=0x%x, %ux%u)\n", | 1713 | dev_geo(icd->parent, "TRY_FMT(pix=0x%x, %ux%u)\n", |
1714 | pixfmt, pix->width, pix->height); | 1714 | pixfmt, pix->width, pix->height); |
1715 | 1715 | ||
1716 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); | 1716 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); |
1717 | if (!xlate) { | 1717 | if (!xlate) { |
1718 | dev_warn(icd->dev.parent, "Format %x not found\n", pixfmt); | 1718 | dev_warn(icd->parent, "Format %x not found\n", pixfmt); |
1719 | return -EINVAL; | 1719 | return -EINVAL; |
1720 | } | 1720 | } |
1721 | 1721 | ||
@@ -1762,7 +1762,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, | |||
1762 | try_mbus_fmt, &mf); | 1762 | try_mbus_fmt, &mf); |
1763 | if (ret < 0) { | 1763 | if (ret < 0) { |
1764 | /* Shouldn't actually happen... */ | 1764 | /* Shouldn't actually happen... */ |
1765 | dev_err(icd->dev.parent, | 1765 | dev_err(icd->parent, |
1766 | "FIXME: client try_fmt() = %d\n", ret); | 1766 | "FIXME: client try_fmt() = %d\n", ret); |
1767 | return ret; | 1767 | return ret; |
1768 | } | 1768 | } |
@@ -1774,7 +1774,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, | |||
1774 | pix->height = height; | 1774 | pix->height = height; |
1775 | } | 1775 | } |
1776 | 1776 | ||
1777 | dev_geo(icd->dev.parent, "%s(): return %d, fmt 0x%x, %ux%u\n", | 1777 | dev_geo(icd->parent, "%s(): return %d, fmt 0x%x, %ux%u\n", |
1778 | __func__, ret, pix->pixelformat, pix->width, pix->height); | 1778 | __func__, ret, pix->pixelformat, pix->width, pix->height); |
1779 | 1779 | ||
1780 | return ret; | 1780 | return ret; |
@@ -1784,7 +1784,7 @@ static int sh_mobile_ceu_set_livecrop(struct soc_camera_device *icd, | |||
1784 | struct v4l2_crop *a) | 1784 | struct v4l2_crop *a) |
1785 | { | 1785 | { |
1786 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 1786 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
1787 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 1787 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
1788 | struct sh_mobile_ceu_dev *pcdev = ici->priv; | 1788 | struct sh_mobile_ceu_dev *pcdev = ici->priv; |
1789 | u32 out_width = icd->user_width, out_height = icd->user_height; | 1789 | u32 out_width = icd->user_width, out_height = icd->user_height; |
1790 | int ret; | 1790 | int ret; |
@@ -1796,13 +1796,13 @@ static int sh_mobile_ceu_set_livecrop(struct soc_camera_device *icd, | |||
1796 | /* Stop the client */ | 1796 | /* Stop the client */ |
1797 | ret = v4l2_subdev_call(sd, video, s_stream, 0); | 1797 | ret = v4l2_subdev_call(sd, video, s_stream, 0); |
1798 | if (ret < 0) | 1798 | if (ret < 0) |
1799 | dev_warn(icd->dev.parent, | 1799 | dev_warn(icd->parent, |
1800 | "Client failed to stop the stream: %d\n", ret); | 1800 | "Client failed to stop the stream: %d\n", ret); |
1801 | else | 1801 | else |
1802 | /* Do the crop, if it fails, there's nothing more we can do */ | 1802 | /* Do the crop, if it fails, there's nothing more we can do */ |
1803 | sh_mobile_ceu_set_crop(icd, a); | 1803 | sh_mobile_ceu_set_crop(icd, a); |
1804 | 1804 | ||
1805 | dev_geo(icd->dev.parent, "Output after crop: %ux%u\n", icd->user_width, icd->user_height); | 1805 | dev_geo(icd->parent, "Output after crop: %ux%u\n", icd->user_width, icd->user_height); |
1806 | 1806 | ||
1807 | if (icd->user_width != out_width || icd->user_height != out_height) { | 1807 | if (icd->user_width != out_width || icd->user_height != out_height) { |
1808 | struct v4l2_format f = { | 1808 | struct v4l2_format f = { |
@@ -1868,7 +1868,7 @@ static int sh_mobile_ceu_init_videobuf(struct vb2_queue *q, | |||
1868 | static int sh_mobile_ceu_get_ctrl(struct soc_camera_device *icd, | 1868 | static int sh_mobile_ceu_get_ctrl(struct soc_camera_device *icd, |
1869 | struct v4l2_control *ctrl) | 1869 | struct v4l2_control *ctrl) |
1870 | { | 1870 | { |
1871 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 1871 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
1872 | struct sh_mobile_ceu_dev *pcdev = ici->priv; | 1872 | struct sh_mobile_ceu_dev *pcdev = ici->priv; |
1873 | u32 val; | 1873 | u32 val; |
1874 | 1874 | ||
@@ -1884,7 +1884,7 @@ static int sh_mobile_ceu_get_ctrl(struct soc_camera_device *icd, | |||
1884 | static int sh_mobile_ceu_set_ctrl(struct soc_camera_device *icd, | 1884 | static int sh_mobile_ceu_set_ctrl(struct soc_camera_device *icd, |
1885 | struct v4l2_control *ctrl) | 1885 | struct v4l2_control *ctrl) |
1886 | { | 1886 | { |
1887 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 1887 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
1888 | struct sh_mobile_ceu_dev *pcdev = ici->priv; | 1888 | struct sh_mobile_ceu_dev *pcdev = ici->priv; |
1889 | 1889 | ||
1890 | switch (ctrl->id) { | 1890 | switch (ctrl->id) { |
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index 0df31b54e90..5bdfe7e16bc 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c | |||
@@ -60,14 +60,14 @@ static int soc_camera_power_set(struct soc_camera_device *icd, | |||
60 | ret = regulator_bulk_enable(icl->num_regulators, | 60 | ret = regulator_bulk_enable(icl->num_regulators, |
61 | icl->regulators); | 61 | icl->regulators); |
62 | if (ret < 0) { | 62 | if (ret < 0) { |
63 | dev_err(&icd->dev, "Cannot enable regulators\n"); | 63 | dev_err(icd->pdev, "Cannot enable regulators\n"); |
64 | return ret; | 64 | return ret; |
65 | } | 65 | } |
66 | 66 | ||
67 | if (icl->power) | 67 | if (icl->power) |
68 | ret = icl->power(icd->pdev, power_on); | 68 | ret = icl->power(icd->pdev, power_on); |
69 | if (ret < 0) { | 69 | if (ret < 0) { |
70 | dev_err(&icd->dev, | 70 | dev_err(icd->pdev, |
71 | "Platform failed to power-on the camera.\n"); | 71 | "Platform failed to power-on the camera.\n"); |
72 | 72 | ||
73 | regulator_bulk_disable(icl->num_regulators, | 73 | regulator_bulk_disable(icl->num_regulators, |
@@ -79,7 +79,7 @@ static int soc_camera_power_set(struct soc_camera_device *icd, | |||
79 | if (icl->power) | 79 | if (icl->power) |
80 | ret = icl->power(icd->pdev, 0); | 80 | ret = icl->power(icd->pdev, 0); |
81 | if (ret < 0) { | 81 | if (ret < 0) { |
82 | dev_err(&icd->dev, | 82 | dev_err(icd->pdev, |
83 | "Platform failed to power-off the camera.\n"); | 83 | "Platform failed to power-off the camera.\n"); |
84 | return ret; | 84 | return ret; |
85 | } | 85 | } |
@@ -87,7 +87,7 @@ static int soc_camera_power_set(struct soc_camera_device *icd, | |||
87 | ret = regulator_bulk_disable(icl->num_regulators, | 87 | ret = regulator_bulk_disable(icl->num_regulators, |
88 | icl->regulators); | 88 | icl->regulators); |
89 | if (ret < 0) { | 89 | if (ret < 0) { |
90 | dev_err(&icd->dev, "Cannot disable regulators\n"); | 90 | dev_err(icd->pdev, "Cannot disable regulators\n"); |
91 | return ret; | 91 | return ret; |
92 | } | 92 | } |
93 | } | 93 | } |
@@ -147,11 +147,11 @@ EXPORT_SYMBOL(soc_camera_apply_sensor_flags); | |||
147 | static int soc_camera_try_fmt(struct soc_camera_device *icd, | 147 | static int soc_camera_try_fmt(struct soc_camera_device *icd, |
148 | struct v4l2_format *f) | 148 | struct v4l2_format *f) |
149 | { | 149 | { |
150 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 150 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
151 | struct v4l2_pix_format *pix = &f->fmt.pix; | 151 | struct v4l2_pix_format *pix = &f->fmt.pix; |
152 | int ret; | 152 | int ret; |
153 | 153 | ||
154 | dev_dbg(&icd->dev, "TRY_FMT(%c%c%c%c, %ux%u)\n", | 154 | dev_dbg(icd->pdev, "TRY_FMT(%c%c%c%c, %ux%u)\n", |
155 | pixfmtstr(pix->pixelformat), pix->width, pix->height); | 155 | pixfmtstr(pix->pixelformat), pix->width, pix->height); |
156 | 156 | ||
157 | pix->bytesperline = 0; | 157 | pix->bytesperline = 0; |
@@ -237,7 +237,7 @@ static int soc_camera_enum_fsizes(struct file *file, void *fh, | |||
237 | struct v4l2_frmsizeenum *fsize) | 237 | struct v4l2_frmsizeenum *fsize) |
238 | { | 238 | { |
239 | struct soc_camera_device *icd = file->private_data; | 239 | struct soc_camera_device *icd = file->private_data; |
240 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 240 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
241 | 241 | ||
242 | return ici->ops->enum_fsizes(icd, fsize); | 242 | return ici->ops->enum_fsizes(icd, fsize); |
243 | } | 243 | } |
@@ -247,7 +247,7 @@ static int soc_camera_reqbufs(struct file *file, void *priv, | |||
247 | { | 247 | { |
248 | int ret; | 248 | int ret; |
249 | struct soc_camera_device *icd = file->private_data; | 249 | struct soc_camera_device *icd = file->private_data; |
250 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 250 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
251 | 251 | ||
252 | WARN_ON(priv != file->private_data); | 252 | WARN_ON(priv != file->private_data); |
253 | 253 | ||
@@ -274,7 +274,7 @@ static int soc_camera_querybuf(struct file *file, void *priv, | |||
274 | struct v4l2_buffer *p) | 274 | struct v4l2_buffer *p) |
275 | { | 275 | { |
276 | struct soc_camera_device *icd = file->private_data; | 276 | struct soc_camera_device *icd = file->private_data; |
277 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 277 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
278 | 278 | ||
279 | WARN_ON(priv != file->private_data); | 279 | WARN_ON(priv != file->private_data); |
280 | 280 | ||
@@ -288,7 +288,7 @@ static int soc_camera_qbuf(struct file *file, void *priv, | |||
288 | struct v4l2_buffer *p) | 288 | struct v4l2_buffer *p) |
289 | { | 289 | { |
290 | struct soc_camera_device *icd = file->private_data; | 290 | struct soc_camera_device *icd = file->private_data; |
291 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 291 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
292 | 292 | ||
293 | WARN_ON(priv != file->private_data); | 293 | WARN_ON(priv != file->private_data); |
294 | 294 | ||
@@ -305,7 +305,7 @@ static int soc_camera_dqbuf(struct file *file, void *priv, | |||
305 | struct v4l2_buffer *p) | 305 | struct v4l2_buffer *p) |
306 | { | 306 | { |
307 | struct soc_camera_device *icd = file->private_data; | 307 | struct soc_camera_device *icd = file->private_data; |
308 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 308 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
309 | 309 | ||
310 | WARN_ON(priv != file->private_data); | 310 | WARN_ON(priv != file->private_data); |
311 | 311 | ||
@@ -322,7 +322,7 @@ static int soc_camera_dqbuf(struct file *file, void *priv, | |||
322 | static int soc_camera_init_user_formats(struct soc_camera_device *icd) | 322 | static int soc_camera_init_user_formats(struct soc_camera_device *icd) |
323 | { | 323 | { |
324 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 324 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
325 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 325 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
326 | unsigned int i, fmts = 0, raw_fmts = 0; | 326 | unsigned int i, fmts = 0, raw_fmts = 0; |
327 | int ret; | 327 | int ret; |
328 | enum v4l2_mbus_pixelcode code; | 328 | enum v4l2_mbus_pixelcode code; |
@@ -356,7 +356,7 @@ static int soc_camera_init_user_formats(struct soc_camera_device *icd) | |||
356 | if (!icd->user_formats) | 356 | if (!icd->user_formats) |
357 | return -ENOMEM; | 357 | return -ENOMEM; |
358 | 358 | ||
359 | dev_dbg(&icd->dev, "Found %d supported formats.\n", fmts); | 359 | dev_dbg(icd->pdev, "Found %d supported formats.\n", fmts); |
360 | 360 | ||
361 | /* Second pass - actually fill data formats */ | 361 | /* Second pass - actually fill data formats */ |
362 | fmts = 0; | 362 | fmts = 0; |
@@ -388,7 +388,7 @@ egfmt: | |||
388 | /* Always entered with .video_lock held */ | 388 | /* Always entered with .video_lock held */ |
389 | static void soc_camera_free_user_formats(struct soc_camera_device *icd) | 389 | static void soc_camera_free_user_formats(struct soc_camera_device *icd) |
390 | { | 390 | { |
391 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 391 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
392 | 392 | ||
393 | if (ici->ops->put_formats) | 393 | if (ici->ops->put_formats) |
394 | ici->ops->put_formats(icd); | 394 | ici->ops->put_formats(icd); |
@@ -402,11 +402,11 @@ static void soc_camera_free_user_formats(struct soc_camera_device *icd) | |||
402 | static int soc_camera_set_fmt(struct soc_camera_device *icd, | 402 | static int soc_camera_set_fmt(struct soc_camera_device *icd, |
403 | struct v4l2_format *f) | 403 | struct v4l2_format *f) |
404 | { | 404 | { |
405 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 405 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
406 | struct v4l2_pix_format *pix = &f->fmt.pix; | 406 | struct v4l2_pix_format *pix = &f->fmt.pix; |
407 | int ret; | 407 | int ret; |
408 | 408 | ||
409 | dev_dbg(&icd->dev, "S_FMT(%c%c%c%c, %ux%u)\n", | 409 | dev_dbg(icd->pdev, "S_FMT(%c%c%c%c, %ux%u)\n", |
410 | pixfmtstr(pix->pixelformat), pix->width, pix->height); | 410 | pixfmtstr(pix->pixelformat), pix->width, pix->height); |
411 | 411 | ||
412 | /* We always call try_fmt() before set_fmt() or set_crop() */ | 412 | /* We always call try_fmt() before set_fmt() or set_crop() */ |
@@ -419,7 +419,7 @@ static int soc_camera_set_fmt(struct soc_camera_device *icd, | |||
419 | return ret; | 419 | return ret; |
420 | } else if (!icd->current_fmt || | 420 | } else if (!icd->current_fmt || |
421 | icd->current_fmt->host_fmt->fourcc != pix->pixelformat) { | 421 | icd->current_fmt->host_fmt->fourcc != pix->pixelformat) { |
422 | dev_err(&icd->dev, | 422 | dev_err(icd->pdev, |
423 | "Host driver hasn't set up current format correctly!\n"); | 423 | "Host driver hasn't set up current format correctly!\n"); |
424 | return -EINVAL; | 424 | return -EINVAL; |
425 | } | 425 | } |
@@ -433,7 +433,7 @@ static int soc_camera_set_fmt(struct soc_camera_device *icd, | |||
433 | if (ici->ops->init_videobuf) | 433 | if (ici->ops->init_videobuf) |
434 | icd->vb_vidq.field = pix->field; | 434 | icd->vb_vidq.field = pix->field; |
435 | 435 | ||
436 | dev_dbg(&icd->dev, "set width: %d height: %d\n", | 436 | dev_dbg(icd->pdev, "set width: %d height: %d\n", |
437 | icd->user_width, icd->user_height); | 437 | icd->user_width, icd->user_height); |
438 | 438 | ||
439 | /* set physical bus parameters */ | 439 | /* set physical bus parameters */ |
@@ -443,9 +443,7 @@ static int soc_camera_set_fmt(struct soc_camera_device *icd, | |||
443 | static int soc_camera_open(struct file *file) | 443 | static int soc_camera_open(struct file *file) |
444 | { | 444 | { |
445 | struct video_device *vdev = video_devdata(file); | 445 | struct video_device *vdev = video_devdata(file); |
446 | struct soc_camera_device *icd = container_of(vdev->parent, | 446 | struct soc_camera_device *icd = dev_get_drvdata(vdev->parent); |
447 | struct soc_camera_device, | ||
448 | dev); | ||
449 | struct soc_camera_link *icl = to_soc_camera_link(icd); | 447 | struct soc_camera_link *icl = to_soc_camera_link(icd); |
450 | struct soc_camera_host *ici; | 448 | struct soc_camera_host *ici; |
451 | int ret; | 449 | int ret; |
@@ -454,10 +452,10 @@ static int soc_camera_open(struct file *file) | |||
454 | /* No device driver attached */ | 452 | /* No device driver attached */ |
455 | return -ENODEV; | 453 | return -ENODEV; |
456 | 454 | ||
457 | ici = to_soc_camera_host(icd->dev.parent); | 455 | ici = to_soc_camera_host(icd->parent); |
458 | 456 | ||
459 | if (!try_module_get(ici->ops->owner)) { | 457 | if (!try_module_get(ici->ops->owner)) { |
460 | dev_err(&icd->dev, "Couldn't lock capture bus driver.\n"); | 458 | dev_err(icd->pdev, "Couldn't lock capture bus driver.\n"); |
461 | return -EINVAL; | 459 | return -EINVAL; |
462 | } | 460 | } |
463 | 461 | ||
@@ -488,7 +486,7 @@ static int soc_camera_open(struct file *file) | |||
488 | 486 | ||
489 | ret = ici->ops->add(icd); | 487 | ret = ici->ops->add(icd); |
490 | if (ret < 0) { | 488 | if (ret < 0) { |
491 | dev_err(&icd->dev, "Couldn't activate the camera: %d\n", ret); | 489 | dev_err(icd->pdev, "Couldn't activate the camera: %d\n", ret); |
492 | goto eiciadd; | 490 | goto eiciadd; |
493 | } | 491 | } |
494 | 492 | ||
@@ -517,7 +515,7 @@ static int soc_camera_open(struct file *file) | |||
517 | } | 515 | } |
518 | 516 | ||
519 | file->private_data = icd; | 517 | file->private_data = icd; |
520 | dev_dbg(&icd->dev, "camera device open\n"); | 518 | dev_dbg(icd->pdev, "camera device open\n"); |
521 | 519 | ||
522 | return 0; | 520 | return 0; |
523 | 521 | ||
@@ -542,7 +540,7 @@ epower: | |||
542 | static int soc_camera_close(struct file *file) | 540 | static int soc_camera_close(struct file *file) |
543 | { | 541 | { |
544 | struct soc_camera_device *icd = file->private_data; | 542 | struct soc_camera_device *icd = file->private_data; |
545 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 543 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
546 | 544 | ||
547 | icd->use_count--; | 545 | icd->use_count--; |
548 | if (!icd->use_count) { | 546 | if (!icd->use_count) { |
@@ -563,7 +561,7 @@ static int soc_camera_close(struct file *file) | |||
563 | 561 | ||
564 | module_put(ici->ops->owner); | 562 | module_put(ici->ops->owner); |
565 | 563 | ||
566 | dev_dbg(&icd->dev, "camera device close\n"); | 564 | dev_dbg(icd->pdev, "camera device close\n"); |
567 | 565 | ||
568 | return 0; | 566 | return 0; |
569 | } | 567 | } |
@@ -574,7 +572,7 @@ static ssize_t soc_camera_read(struct file *file, char __user *buf, | |||
574 | struct soc_camera_device *icd = file->private_data; | 572 | struct soc_camera_device *icd = file->private_data; |
575 | int err = -EINVAL; | 573 | int err = -EINVAL; |
576 | 574 | ||
577 | dev_err(&icd->dev, "camera device read not implemented\n"); | 575 | dev_err(icd->pdev, "camera device read not implemented\n"); |
578 | 576 | ||
579 | return err; | 577 | return err; |
580 | } | 578 | } |
@@ -582,10 +580,10 @@ static ssize_t soc_camera_read(struct file *file, char __user *buf, | |||
582 | static int soc_camera_mmap(struct file *file, struct vm_area_struct *vma) | 580 | static int soc_camera_mmap(struct file *file, struct vm_area_struct *vma) |
583 | { | 581 | { |
584 | struct soc_camera_device *icd = file->private_data; | 582 | struct soc_camera_device *icd = file->private_data; |
585 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 583 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
586 | int err; | 584 | int err; |
587 | 585 | ||
588 | dev_dbg(&icd->dev, "mmap called, vma=0x%08lx\n", (unsigned long)vma); | 586 | dev_dbg(icd->pdev, "mmap called, vma=0x%08lx\n", (unsigned long)vma); |
589 | 587 | ||
590 | if (icd->streamer != file) | 588 | if (icd->streamer != file) |
591 | return -EBUSY; | 589 | return -EBUSY; |
@@ -595,7 +593,7 @@ static int soc_camera_mmap(struct file *file, struct vm_area_struct *vma) | |||
595 | else | 593 | else |
596 | err = vb2_mmap(&icd->vb2_vidq, vma); | 594 | err = vb2_mmap(&icd->vb2_vidq, vma); |
597 | 595 | ||
598 | dev_dbg(&icd->dev, "vma start=0x%08lx, size=%ld, ret=%d\n", | 596 | dev_dbg(icd->pdev, "vma start=0x%08lx, size=%ld, ret=%d\n", |
599 | (unsigned long)vma->vm_start, | 597 | (unsigned long)vma->vm_start, |
600 | (unsigned long)vma->vm_end - (unsigned long)vma->vm_start, | 598 | (unsigned long)vma->vm_end - (unsigned long)vma->vm_start, |
601 | err); | 599 | err); |
@@ -606,13 +604,13 @@ static int soc_camera_mmap(struct file *file, struct vm_area_struct *vma) | |||
606 | static unsigned int soc_camera_poll(struct file *file, poll_table *pt) | 604 | static unsigned int soc_camera_poll(struct file *file, poll_table *pt) |
607 | { | 605 | { |
608 | struct soc_camera_device *icd = file->private_data; | 606 | struct soc_camera_device *icd = file->private_data; |
609 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 607 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
610 | 608 | ||
611 | if (icd->streamer != file) | 609 | if (icd->streamer != file) |
612 | return -EBUSY; | 610 | return -EBUSY; |
613 | 611 | ||
614 | if (ici->ops->init_videobuf && list_empty(&icd->vb_vidq.stream)) { | 612 | if (ici->ops->init_videobuf && list_empty(&icd->vb_vidq.stream)) { |
615 | dev_err(&icd->dev, "Trying to poll with no queued buffers!\n"); | 613 | dev_err(icd->pdev, "Trying to poll with no queued buffers!\n"); |
616 | return POLLERR; | 614 | return POLLERR; |
617 | } | 615 | } |
618 | 616 | ||
@@ -652,15 +650,15 @@ static int soc_camera_s_fmt_vid_cap(struct file *file, void *priv, | |||
652 | WARN_ON(priv != file->private_data); | 650 | WARN_ON(priv != file->private_data); |
653 | 651 | ||
654 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { | 652 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { |
655 | dev_warn(&icd->dev, "Wrong buf-type %d\n", f->type); | 653 | dev_warn(icd->pdev, "Wrong buf-type %d\n", f->type); |
656 | return -EINVAL; | 654 | return -EINVAL; |
657 | } | 655 | } |
658 | 656 | ||
659 | if (icd->streamer && icd->streamer != file) | 657 | if (icd->streamer && icd->streamer != file) |
660 | return -EBUSY; | 658 | return -EBUSY; |
661 | 659 | ||
662 | if (is_streaming(to_soc_camera_host(icd->dev.parent), icd)) { | 660 | if (is_streaming(to_soc_camera_host(icd->parent), icd)) { |
663 | dev_err(&icd->dev, "S_FMT denied: queue initialised\n"); | 661 | dev_err(icd->pdev, "S_FMT denied: queue initialised\n"); |
664 | return -EBUSY; | 662 | return -EBUSY; |
665 | } | 663 | } |
666 | 664 | ||
@@ -709,7 +707,7 @@ static int soc_camera_g_fmt_vid_cap(struct file *file, void *priv, | |||
709 | pix->field = icd->field; | 707 | pix->field = icd->field; |
710 | pix->pixelformat = icd->current_fmt->host_fmt->fourcc; | 708 | pix->pixelformat = icd->current_fmt->host_fmt->fourcc; |
711 | pix->colorspace = icd->colorspace; | 709 | pix->colorspace = icd->colorspace; |
712 | dev_dbg(&icd->dev, "current_fmt->fourcc: 0x%08x\n", | 710 | dev_dbg(icd->pdev, "current_fmt->fourcc: 0x%08x\n", |
713 | icd->current_fmt->host_fmt->fourcc); | 711 | icd->current_fmt->host_fmt->fourcc); |
714 | return 0; | 712 | return 0; |
715 | } | 713 | } |
@@ -718,7 +716,7 @@ static int soc_camera_querycap(struct file *file, void *priv, | |||
718 | struct v4l2_capability *cap) | 716 | struct v4l2_capability *cap) |
719 | { | 717 | { |
720 | struct soc_camera_device *icd = file->private_data; | 718 | struct soc_camera_device *icd = file->private_data; |
721 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 719 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
722 | 720 | ||
723 | WARN_ON(priv != file->private_data); | 721 | WARN_ON(priv != file->private_data); |
724 | 722 | ||
@@ -730,7 +728,7 @@ static int soc_camera_streamon(struct file *file, void *priv, | |||
730 | enum v4l2_buf_type i) | 728 | enum v4l2_buf_type i) |
731 | { | 729 | { |
732 | struct soc_camera_device *icd = file->private_data; | 730 | struct soc_camera_device *icd = file->private_data; |
733 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 731 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
734 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 732 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
735 | int ret; | 733 | int ret; |
736 | 734 | ||
@@ -759,7 +757,7 @@ static int soc_camera_streamoff(struct file *file, void *priv, | |||
759 | { | 757 | { |
760 | struct soc_camera_device *icd = file->private_data; | 758 | struct soc_camera_device *icd = file->private_data; |
761 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 759 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
762 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 760 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
763 | 761 | ||
764 | WARN_ON(priv != file->private_data); | 762 | WARN_ON(priv != file->private_data); |
765 | 763 | ||
@@ -787,7 +785,7 @@ static int soc_camera_queryctrl(struct file *file, void *priv, | |||
787 | struct v4l2_queryctrl *qc) | 785 | struct v4l2_queryctrl *qc) |
788 | { | 786 | { |
789 | struct soc_camera_device *icd = file->private_data; | 787 | struct soc_camera_device *icd = file->private_data; |
790 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 788 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
791 | int i; | 789 | int i; |
792 | 790 | ||
793 | WARN_ON(priv != file->private_data); | 791 | WARN_ON(priv != file->private_data); |
@@ -818,7 +816,7 @@ static int soc_camera_g_ctrl(struct file *file, void *priv, | |||
818 | struct v4l2_control *ctrl) | 816 | struct v4l2_control *ctrl) |
819 | { | 817 | { |
820 | struct soc_camera_device *icd = file->private_data; | 818 | struct soc_camera_device *icd = file->private_data; |
821 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 819 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
822 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 820 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
823 | int ret; | 821 | int ret; |
824 | 822 | ||
@@ -837,7 +835,7 @@ static int soc_camera_s_ctrl(struct file *file, void *priv, | |||
837 | struct v4l2_control *ctrl) | 835 | struct v4l2_control *ctrl) |
838 | { | 836 | { |
839 | struct soc_camera_device *icd = file->private_data; | 837 | struct soc_camera_device *icd = file->private_data; |
840 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 838 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
841 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 839 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
842 | int ret; | 840 | int ret; |
843 | 841 | ||
@@ -856,7 +854,7 @@ static int soc_camera_cropcap(struct file *file, void *fh, | |||
856 | struct v4l2_cropcap *a) | 854 | struct v4l2_cropcap *a) |
857 | { | 855 | { |
858 | struct soc_camera_device *icd = file->private_data; | 856 | struct soc_camera_device *icd = file->private_data; |
859 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 857 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
860 | 858 | ||
861 | return ici->ops->cropcap(icd, a); | 859 | return ici->ops->cropcap(icd, a); |
862 | } | 860 | } |
@@ -865,7 +863,7 @@ static int soc_camera_g_crop(struct file *file, void *fh, | |||
865 | struct v4l2_crop *a) | 863 | struct v4l2_crop *a) |
866 | { | 864 | { |
867 | struct soc_camera_device *icd = file->private_data; | 865 | struct soc_camera_device *icd = file->private_data; |
868 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 866 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
869 | int ret; | 867 | int ret; |
870 | 868 | ||
871 | ret = ici->ops->get_crop(icd, a); | 869 | ret = ici->ops->get_crop(icd, a); |
@@ -882,7 +880,7 @@ static int soc_camera_s_crop(struct file *file, void *fh, | |||
882 | struct v4l2_crop *a) | 880 | struct v4l2_crop *a) |
883 | { | 881 | { |
884 | struct soc_camera_device *icd = file->private_data; | 882 | struct soc_camera_device *icd = file->private_data; |
885 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 883 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
886 | struct v4l2_rect *rect = &a->c; | 884 | struct v4l2_rect *rect = &a->c; |
887 | struct v4l2_crop current_crop; | 885 | struct v4l2_crop current_crop; |
888 | int ret; | 886 | int ret; |
@@ -890,7 +888,7 @@ static int soc_camera_s_crop(struct file *file, void *fh, | |||
890 | if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 888 | if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
891 | return -EINVAL; | 889 | return -EINVAL; |
892 | 890 | ||
893 | dev_dbg(&icd->dev, "S_CROP(%ux%u@%u:%u)\n", | 891 | dev_dbg(icd->pdev, "S_CROP(%ux%u@%u:%u)\n", |
894 | rect->width, rect->height, rect->left, rect->top); | 892 | rect->width, rect->height, rect->left, rect->top); |
895 | 893 | ||
896 | /* If get_crop fails, we'll let host and / or client drivers decide */ | 894 | /* If get_crop fails, we'll let host and / or client drivers decide */ |
@@ -898,7 +896,7 @@ static int soc_camera_s_crop(struct file *file, void *fh, | |||
898 | 896 | ||
899 | /* Prohibit window size change with initialised buffers */ | 897 | /* Prohibit window size change with initialised buffers */ |
900 | if (ret < 0) { | 898 | if (ret < 0) { |
901 | dev_err(&icd->dev, | 899 | dev_err(icd->pdev, |
902 | "S_CROP denied: getting current crop failed\n"); | 900 | "S_CROP denied: getting current crop failed\n"); |
903 | } else if ((a->c.width == current_crop.c.width && | 901 | } else if ((a->c.width == current_crop.c.width && |
904 | a->c.height == current_crop.c.height) || | 902 | a->c.height == current_crop.c.height) || |
@@ -908,7 +906,7 @@ static int soc_camera_s_crop(struct file *file, void *fh, | |||
908 | } else if (ici->ops->set_livecrop) { | 906 | } else if (ici->ops->set_livecrop) { |
909 | ret = ici->ops->set_livecrop(icd, a); | 907 | ret = ici->ops->set_livecrop(icd, a); |
910 | } else { | 908 | } else { |
911 | dev_err(&icd->dev, | 909 | dev_err(icd->pdev, |
912 | "S_CROP denied: queue initialised and sizes differ\n"); | 910 | "S_CROP denied: queue initialised and sizes differ\n"); |
913 | ret = -EBUSY; | 911 | ret = -EBUSY; |
914 | } | 912 | } |
@@ -920,7 +918,7 @@ static int soc_camera_g_parm(struct file *file, void *fh, | |||
920 | struct v4l2_streamparm *a) | 918 | struct v4l2_streamparm *a) |
921 | { | 919 | { |
922 | struct soc_camera_device *icd = file->private_data; | 920 | struct soc_camera_device *icd = file->private_data; |
923 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 921 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
924 | 922 | ||
925 | if (ici->ops->get_parm) | 923 | if (ici->ops->get_parm) |
926 | return ici->ops->get_parm(icd, a); | 924 | return ici->ops->get_parm(icd, a); |
@@ -932,7 +930,7 @@ static int soc_camera_s_parm(struct file *file, void *fh, | |||
932 | struct v4l2_streamparm *a) | 930 | struct v4l2_streamparm *a) |
933 | { | 931 | { |
934 | struct soc_camera_device *icd = file->private_data; | 932 | struct soc_camera_device *icd = file->private_data; |
935 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 933 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
936 | 934 | ||
937 | if (ici->ops->set_parm) | 935 | if (ici->ops->set_parm) |
938 | return ici->ops->set_parm(icd, a); | 936 | return ici->ops->set_parm(icd, a); |
@@ -969,6 +967,8 @@ static int soc_camera_s_register(struct file *file, void *fh, | |||
969 | } | 967 | } |
970 | #endif | 968 | #endif |
971 | 969 | ||
970 | static int soc_camera_probe(struct soc_camera_device *icd); | ||
971 | |||
972 | /* So far this function cannot fail */ | 972 | /* So far this function cannot fail */ |
973 | static void scan_add_host(struct soc_camera_host *ici) | 973 | static void scan_add_host(struct soc_camera_host *ici) |
974 | { | 974 | { |
@@ -979,15 +979,9 @@ static void scan_add_host(struct soc_camera_host *ici) | |||
979 | list_for_each_entry(icd, &devices, list) { | 979 | list_for_each_entry(icd, &devices, list) { |
980 | if (icd->iface == ici->nr) { | 980 | if (icd->iface == ici->nr) { |
981 | int ret; | 981 | int ret; |
982 | icd->dev.parent = ici->v4l2_dev.dev; | 982 | |
983 | dev_set_name(&icd->dev, "%u-%u", icd->iface, | 983 | icd->parent = ici->v4l2_dev.dev; |
984 | icd->devnum); | 984 | ret = soc_camera_probe(icd); |
985 | ret = device_register(&icd->dev); | ||
986 | if (ret < 0) { | ||
987 | icd->dev.parent = NULL; | ||
988 | dev_err(&icd->dev, | ||
989 | "Cannot register device: %d\n", ret); | ||
990 | } | ||
991 | } | 985 | } |
992 | } | 986 | } |
993 | 987 | ||
@@ -999,12 +993,12 @@ static int soc_camera_init_i2c(struct soc_camera_device *icd, | |||
999 | struct soc_camera_link *icl) | 993 | struct soc_camera_link *icl) |
1000 | { | 994 | { |
1001 | struct i2c_client *client; | 995 | struct i2c_client *client; |
1002 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 996 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
1003 | struct i2c_adapter *adap = i2c_get_adapter(icl->i2c_adapter_id); | 997 | struct i2c_adapter *adap = i2c_get_adapter(icl->i2c_adapter_id); |
1004 | struct v4l2_subdev *subdev; | 998 | struct v4l2_subdev *subdev; |
1005 | 999 | ||
1006 | if (!adap) { | 1000 | if (!adap) { |
1007 | dev_err(&icd->dev, "Cannot get I2C adapter #%d. No driver?\n", | 1001 | dev_err(icd->pdev, "Cannot get I2C adapter #%d. No driver?\n", |
1008 | icl->i2c_adapter_id); | 1002 | icl->i2c_adapter_id); |
1009 | goto ei2cga; | 1003 | goto ei2cga; |
1010 | } | 1004 | } |
@@ -1019,7 +1013,7 @@ static int soc_camera_init_i2c(struct soc_camera_device *icd, | |||
1019 | client = v4l2_get_subdevdata(subdev); | 1013 | client = v4l2_get_subdevdata(subdev); |
1020 | 1014 | ||
1021 | /* Use to_i2c_client(dev) to recover the i2c client */ | 1015 | /* Use to_i2c_client(dev) to recover the i2c client */ |
1022 | dev_set_drvdata(&icd->dev, &client->dev); | 1016 | icd->control = &client->dev; |
1023 | 1017 | ||
1024 | return 0; | 1018 | return 0; |
1025 | ei2cnd: | 1019 | ei2cnd: |
@@ -1033,7 +1027,8 @@ static void soc_camera_free_i2c(struct soc_camera_device *icd) | |||
1033 | struct i2c_client *client = | 1027 | struct i2c_client *client = |
1034 | to_i2c_client(to_soc_camera_control(icd)); | 1028 | to_i2c_client(to_soc_camera_control(icd)); |
1035 | struct i2c_adapter *adap = client->adapter; | 1029 | struct i2c_adapter *adap = client->adapter; |
1036 | dev_set_drvdata(&icd->dev, NULL); | 1030 | |
1031 | icd->control = NULL; | ||
1037 | v4l2_device_unregister_subdev(i2c_get_clientdata(client)); | 1032 | v4l2_device_unregister_subdev(i2c_get_clientdata(client)); |
1038 | i2c_unregister_device(client); | 1033 | i2c_unregister_device(client); |
1039 | i2c_put_adapter(adap); | 1034 | i2c_put_adapter(adap); |
@@ -1046,17 +1041,16 @@ static void soc_camera_free_i2c(struct soc_camera_device *icd) | |||
1046 | static int soc_camera_video_start(struct soc_camera_device *icd); | 1041 | static int soc_camera_video_start(struct soc_camera_device *icd); |
1047 | static int video_dev_create(struct soc_camera_device *icd); | 1042 | static int video_dev_create(struct soc_camera_device *icd); |
1048 | /* Called during host-driver probe */ | 1043 | /* Called during host-driver probe */ |
1049 | static int soc_camera_probe(struct device *dev) | 1044 | static int soc_camera_probe(struct soc_camera_device *icd) |
1050 | { | 1045 | { |
1051 | struct soc_camera_device *icd = to_soc_camera_dev(dev); | 1046 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
1052 | struct soc_camera_host *ici = to_soc_camera_host(dev->parent); | ||
1053 | struct soc_camera_link *icl = to_soc_camera_link(icd); | 1047 | struct soc_camera_link *icl = to_soc_camera_link(icd); |
1054 | struct device *control = NULL; | 1048 | struct device *control = NULL; |
1055 | struct v4l2_subdev *sd; | 1049 | struct v4l2_subdev *sd; |
1056 | struct v4l2_mbus_framefmt mf; | 1050 | struct v4l2_mbus_framefmt mf; |
1057 | int ret; | 1051 | int ret; |
1058 | 1052 | ||
1059 | dev_info(dev, "Probing %s\n", dev_name(dev)); | 1053 | dev_info(icd->pdev, "Probing %s\n", dev_name(icd->pdev)); |
1060 | 1054 | ||
1061 | ret = regulator_bulk_get(icd->pdev, icl->num_regulators, | 1055 | ret = regulator_bulk_get(icd->pdev, icl->num_regulators, |
1062 | icl->regulators); | 1056 | icl->regulators); |
@@ -1092,7 +1086,7 @@ static int soc_camera_probe(struct device *dev) | |||
1092 | if (icl->module_name) | 1086 | if (icl->module_name) |
1093 | ret = request_module(icl->module_name); | 1087 | ret = request_module(icl->module_name); |
1094 | 1088 | ||
1095 | ret = icl->add_device(icl, &icd->dev); | 1089 | ret = icl->add_device(icd); |
1096 | if (ret < 0) | 1090 | if (ret < 0) |
1097 | goto eadddev; | 1091 | goto eadddev; |
1098 | 1092 | ||
@@ -1103,7 +1097,7 @@ static int soc_camera_probe(struct device *dev) | |||
1103 | control = to_soc_camera_control(icd); | 1097 | control = to_soc_camera_control(icd); |
1104 | if (!control || !control->driver || !dev_get_drvdata(control) || | 1098 | if (!control || !control->driver || !dev_get_drvdata(control) || |
1105 | !try_module_get(control->driver->owner)) { | 1099 | !try_module_get(control->driver->owner)) { |
1106 | icl->del_device(icl); | 1100 | icl->del_device(icd); |
1107 | goto enodrv; | 1101 | goto enodrv; |
1108 | } | 1102 | } |
1109 | } | 1103 | } |
@@ -1137,11 +1131,6 @@ static int soc_camera_probe(struct device *dev) | |||
1137 | icd->field = mf.field; | 1131 | icd->field = mf.field; |
1138 | } | 1132 | } |
1139 | 1133 | ||
1140 | /* Do we have to sysfs_remove_link() before device_unregister()? */ | ||
1141 | if (sysfs_create_link(&icd->dev.kobj, &to_soc_camera_control(icd)->kobj, | ||
1142 | "control")) | ||
1143 | dev_warn(&icd->dev, "Failed creating the control symlink\n"); | ||
1144 | |||
1145 | ici->ops->remove(icd); | 1134 | ici->ops->remove(icd); |
1146 | 1135 | ||
1147 | soc_camera_power_set(icd, icl, 0); | 1136 | soc_camera_power_set(icd, icl, 0); |
@@ -1157,7 +1146,7 @@ eiufmt: | |||
1157 | if (icl->board_info) { | 1146 | if (icl->board_info) { |
1158 | soc_camera_free_i2c(icd); | 1147 | soc_camera_free_i2c(icd); |
1159 | } else { | 1148 | } else { |
1160 | icl->del_device(icl); | 1149 | icl->del_device(icd); |
1161 | module_put(control->driver->owner); | 1150 | module_put(control->driver->owner); |
1162 | } | 1151 | } |
1163 | enodrv: | 1152 | enodrv: |
@@ -1177,13 +1166,12 @@ ereg: | |||
1177 | * This is called on device_unregister, which only means we have to disconnect | 1166 | * This is called on device_unregister, which only means we have to disconnect |
1178 | * from the host, but not remove ourselves from the device list | 1167 | * from the host, but not remove ourselves from the device list |
1179 | */ | 1168 | */ |
1180 | static int soc_camera_remove(struct device *dev) | 1169 | static int soc_camera_remove(struct soc_camera_device *icd) |
1181 | { | 1170 | { |
1182 | struct soc_camera_device *icd = to_soc_camera_dev(dev); | ||
1183 | struct soc_camera_link *icl = to_soc_camera_link(icd); | 1171 | struct soc_camera_link *icl = to_soc_camera_link(icd); |
1184 | struct video_device *vdev = icd->vdev; | 1172 | struct video_device *vdev = icd->vdev; |
1185 | 1173 | ||
1186 | BUG_ON(!dev->parent); | 1174 | BUG_ON(!icd->parent); |
1187 | 1175 | ||
1188 | if (vdev) { | 1176 | if (vdev) { |
1189 | video_unregister_device(vdev); | 1177 | video_unregister_device(vdev); |
@@ -1193,10 +1181,9 @@ static int soc_camera_remove(struct device *dev) | |||
1193 | if (icl->board_info) { | 1181 | if (icl->board_info) { |
1194 | soc_camera_free_i2c(icd); | 1182 | soc_camera_free_i2c(icd); |
1195 | } else { | 1183 | } else { |
1196 | struct device_driver *drv = to_soc_camera_control(icd) ? | 1184 | struct device_driver *drv = to_soc_camera_control(icd)->driver; |
1197 | to_soc_camera_control(icd)->driver : NULL; | ||
1198 | if (drv) { | 1185 | if (drv) { |
1199 | icl->del_device(icl); | 1186 | icl->del_device(icd); |
1200 | module_put(drv->owner); | 1187 | module_put(drv->owner); |
1201 | } | 1188 | } |
1202 | } | 1189 | } |
@@ -1207,22 +1194,6 @@ static int soc_camera_remove(struct device *dev) | |||
1207 | return 0; | 1194 | return 0; |
1208 | } | 1195 | } |
1209 | 1196 | ||
1210 | static struct bus_type soc_camera_bus_type = { | ||
1211 | .name = "soc-camera", | ||
1212 | .probe = soc_camera_probe, | ||
1213 | .remove = soc_camera_remove, | ||
1214 | }; | ||
1215 | |||
1216 | static struct device_driver ic_drv = { | ||
1217 | .name = "camera", | ||
1218 | .bus = &soc_camera_bus_type, | ||
1219 | .owner = THIS_MODULE, | ||
1220 | }; | ||
1221 | |||
1222 | static void dummy_release(struct device *dev) | ||
1223 | { | ||
1224 | } | ||
1225 | |||
1226 | static int default_cropcap(struct soc_camera_device *icd, | 1197 | static int default_cropcap(struct soc_camera_device *icd, |
1227 | struct v4l2_cropcap *a) | 1198 | struct v4l2_cropcap *a) |
1228 | { | 1199 | { |
@@ -1281,13 +1252,6 @@ static int default_enum_fsizes(struct soc_camera_device *icd, | |||
1281 | return 0; | 1252 | return 0; |
1282 | } | 1253 | } |
1283 | 1254 | ||
1284 | static void soc_camera_device_init(struct device *dev, void *pdata) | ||
1285 | { | ||
1286 | dev->platform_data = pdata; | ||
1287 | dev->bus = &soc_camera_bus_type; | ||
1288 | dev->release = dummy_release; | ||
1289 | } | ||
1290 | |||
1291 | int soc_camera_host_register(struct soc_camera_host *ici) | 1255 | int soc_camera_host_register(struct soc_camera_host *ici) |
1292 | { | 1256 | { |
1293 | struct soc_camera_host *ix; | 1257 | struct soc_camera_host *ix; |
@@ -1353,24 +1317,9 @@ void soc_camera_host_unregister(struct soc_camera_host *ici) | |||
1353 | mutex_lock(&list_lock); | 1317 | mutex_lock(&list_lock); |
1354 | 1318 | ||
1355 | list_del(&ici->list); | 1319 | list_del(&ici->list); |
1356 | 1320 | list_for_each_entry(icd, &devices, list) | |
1357 | list_for_each_entry(icd, &devices, list) { | 1321 | if (icd->iface == ici->nr && to_soc_camera_control(icd)) |
1358 | if (icd->iface == ici->nr) { | 1322 | soc_camera_remove(icd); |
1359 | void *pdata = icd->dev.platform_data; | ||
1360 | /* The bus->remove will be called */ | ||
1361 | device_unregister(&icd->dev); | ||
1362 | /* | ||
1363 | * Not before device_unregister(), .remove | ||
1364 | * needs parent to call ici->ops->remove(). | ||
1365 | * If the host module is loaded again, device_register() | ||
1366 | * would complain "already initialised," since 2.6.32 | ||
1367 | * this is also needed to prevent use-after-free of the | ||
1368 | * device private data. | ||
1369 | */ | ||
1370 | memset(&icd->dev, 0, sizeof(icd->dev)); | ||
1371 | soc_camera_device_init(&icd->dev, pdata); | ||
1372 | } | ||
1373 | } | ||
1374 | 1323 | ||
1375 | mutex_unlock(&list_lock); | 1324 | mutex_unlock(&list_lock); |
1376 | 1325 | ||
@@ -1412,11 +1361,6 @@ static int soc_camera_device_register(struct soc_camera_device *icd) | |||
1412 | return 0; | 1361 | return 0; |
1413 | } | 1362 | } |
1414 | 1363 | ||
1415 | static void soc_camera_device_unregister(struct soc_camera_device *icd) | ||
1416 | { | ||
1417 | list_del(&icd->list); | ||
1418 | } | ||
1419 | |||
1420 | static const struct v4l2_ioctl_ops soc_camera_ioctl_ops = { | 1364 | static const struct v4l2_ioctl_ops soc_camera_ioctl_ops = { |
1421 | .vidioc_querycap = soc_camera_querycap, | 1365 | .vidioc_querycap = soc_camera_querycap, |
1422 | .vidioc_g_fmt_vid_cap = soc_camera_g_fmt_vid_cap, | 1366 | .vidioc_g_fmt_vid_cap = soc_camera_g_fmt_vid_cap, |
@@ -1451,7 +1395,7 @@ static const struct v4l2_ioctl_ops soc_camera_ioctl_ops = { | |||
1451 | 1395 | ||
1452 | static int video_dev_create(struct soc_camera_device *icd) | 1396 | static int video_dev_create(struct soc_camera_device *icd) |
1453 | { | 1397 | { |
1454 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 1398 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
1455 | struct video_device *vdev = video_device_alloc(); | 1399 | struct video_device *vdev = video_device_alloc(); |
1456 | 1400 | ||
1457 | if (!vdev) | 1401 | if (!vdev) |
@@ -1459,7 +1403,7 @@ static int video_dev_create(struct soc_camera_device *icd) | |||
1459 | 1403 | ||
1460 | strlcpy(vdev->name, ici->drv_name, sizeof(vdev->name)); | 1404 | strlcpy(vdev->name, ici->drv_name, sizeof(vdev->name)); |
1461 | 1405 | ||
1462 | vdev->parent = &icd->dev; | 1406 | vdev->parent = icd->pdev; |
1463 | vdev->current_norm = V4L2_STD_UNKNOWN; | 1407 | vdev->current_norm = V4L2_STD_UNKNOWN; |
1464 | vdev->fops = &soc_camera_fops; | 1408 | vdev->fops = &soc_camera_fops; |
1465 | vdev->ioctl_ops = &soc_camera_ioctl_ops; | 1409 | vdev->ioctl_ops = &soc_camera_ioctl_ops; |
@@ -1480,7 +1424,7 @@ static int soc_camera_video_start(struct soc_camera_device *icd) | |||
1480 | const struct device_type *type = icd->vdev->dev.type; | 1424 | const struct device_type *type = icd->vdev->dev.type; |
1481 | int ret; | 1425 | int ret; |
1482 | 1426 | ||
1483 | if (!icd->dev.parent) | 1427 | if (!icd->parent) |
1484 | return -ENODEV; | 1428 | return -ENODEV; |
1485 | 1429 | ||
1486 | if (!icd->ops || | 1430 | if (!icd->ops || |
@@ -1490,7 +1434,7 @@ static int soc_camera_video_start(struct soc_camera_device *icd) | |||
1490 | 1434 | ||
1491 | ret = video_register_device(icd->vdev, VFL_TYPE_GRABBER, -1); | 1435 | ret = video_register_device(icd->vdev, VFL_TYPE_GRABBER, -1); |
1492 | if (ret < 0) { | 1436 | if (ret < 0) { |
1493 | dev_err(&icd->dev, "video_register_device failed: %d\n", ret); | 1437 | dev_err(icd->pdev, "video_register_device failed: %d\n", ret); |
1494 | return ret; | 1438 | return ret; |
1495 | } | 1439 | } |
1496 | 1440 | ||
@@ -1514,6 +1458,7 @@ static int __devinit soc_camera_pdrv_probe(struct platform_device *pdev) | |||
1514 | return -ENOMEM; | 1458 | return -ENOMEM; |
1515 | 1459 | ||
1516 | icd->iface = icl->bus_id; | 1460 | icd->iface = icl->bus_id; |
1461 | icd->link = icl; | ||
1517 | icd->pdev = &pdev->dev; | 1462 | icd->pdev = &pdev->dev; |
1518 | platform_set_drvdata(pdev, icd); | 1463 | platform_set_drvdata(pdev, icd); |
1519 | 1464 | ||
@@ -1521,8 +1466,6 @@ static int __devinit soc_camera_pdrv_probe(struct platform_device *pdev) | |||
1521 | if (ret < 0) | 1466 | if (ret < 0) |
1522 | goto escdevreg; | 1467 | goto escdevreg; |
1523 | 1468 | ||
1524 | soc_camera_device_init(&icd->dev, icl); | ||
1525 | |||
1526 | icd->user_width = DEFAULT_WIDTH; | 1469 | icd->user_width = DEFAULT_WIDTH; |
1527 | icd->user_height = DEFAULT_HEIGHT; | 1470 | icd->user_height = DEFAULT_HEIGHT; |
1528 | 1471 | ||
@@ -1546,7 +1489,7 @@ static int __devexit soc_camera_pdrv_remove(struct platform_device *pdev) | |||
1546 | if (!icd) | 1489 | if (!icd) |
1547 | return -EINVAL; | 1490 | return -EINVAL; |
1548 | 1491 | ||
1549 | soc_camera_device_unregister(icd); | 1492 | list_del(&icd->list); |
1550 | 1493 | ||
1551 | kfree(icd); | 1494 | kfree(icd); |
1552 | 1495 | ||
@@ -1563,31 +1506,12 @@ static struct platform_driver __refdata soc_camera_pdrv = { | |||
1563 | 1506 | ||
1564 | static int __init soc_camera_init(void) | 1507 | static int __init soc_camera_init(void) |
1565 | { | 1508 | { |
1566 | int ret = bus_register(&soc_camera_bus_type); | 1509 | return platform_driver_probe(&soc_camera_pdrv, soc_camera_pdrv_probe); |
1567 | if (ret) | ||
1568 | return ret; | ||
1569 | ret = driver_register(&ic_drv); | ||
1570 | if (ret) | ||
1571 | goto edrvr; | ||
1572 | |||
1573 | ret = platform_driver_probe(&soc_camera_pdrv, soc_camera_pdrv_probe); | ||
1574 | if (ret) | ||
1575 | goto epdr; | ||
1576 | |||
1577 | return 0; | ||
1578 | |||
1579 | epdr: | ||
1580 | driver_unregister(&ic_drv); | ||
1581 | edrvr: | ||
1582 | bus_unregister(&soc_camera_bus_type); | ||
1583 | return ret; | ||
1584 | } | 1510 | } |
1585 | 1511 | ||
1586 | static void __exit soc_camera_exit(void) | 1512 | static void __exit soc_camera_exit(void) |
1587 | { | 1513 | { |
1588 | platform_driver_unregister(&soc_camera_pdrv); | 1514 | platform_driver_unregister(&soc_camera_pdrv); |
1589 | driver_unregister(&ic_drv); | ||
1590 | bus_unregister(&soc_camera_bus_type); | ||
1591 | } | 1515 | } |
1592 | 1516 | ||
1593 | module_init(soc_camera_init); | 1517 | module_init(soc_camera_init); |
diff --git a/drivers/media/video/soc_camera_platform.c b/drivers/media/video/soc_camera_platform.c index bf406e89c99..8069cd6bc5e 100644 --- a/drivers/media/video/soc_camera_platform.c +++ b/drivers/media/video/soc_camera_platform.c | |||
@@ -146,7 +146,7 @@ static int soc_camera_platform_probe(struct platform_device *pdev) | |||
146 | if (!p) | 146 | if (!p) |
147 | return -EINVAL; | 147 | return -EINVAL; |
148 | 148 | ||
149 | if (!p->dev) { | 149 | if (!p->icd) { |
150 | dev_err(&pdev->dev, | 150 | dev_err(&pdev->dev, |
151 | "Platform has not set soc_camera_device pointer!\n"); | 151 | "Platform has not set soc_camera_device pointer!\n"); |
152 | return -EINVAL; | 152 | return -EINVAL; |
@@ -156,16 +156,16 @@ static int soc_camera_platform_probe(struct platform_device *pdev) | |||
156 | if (!priv) | 156 | if (!priv) |
157 | return -ENOMEM; | 157 | return -ENOMEM; |
158 | 158 | ||
159 | icd = to_soc_camera_dev(p->dev); | 159 | icd = p->icd; |
160 | 160 | ||
161 | /* soc-camera convention: control's drvdata points to the subdev */ | 161 | /* soc-camera convention: control's drvdata points to the subdev */ |
162 | platform_set_drvdata(pdev, &priv->subdev); | 162 | platform_set_drvdata(pdev, &priv->subdev); |
163 | /* Set the control device reference */ | 163 | /* Set the control device reference */ |
164 | dev_set_drvdata(&icd->dev, &pdev->dev); | 164 | icd->control = &pdev->dev; |
165 | 165 | ||
166 | icd->ops = &soc_camera_platform_ops; | 166 | icd->ops = &soc_camera_platform_ops; |
167 | 167 | ||
168 | ici = to_soc_camera_host(icd->dev.parent); | 168 | ici = to_soc_camera_host(icd->parent); |
169 | 169 | ||
170 | v4l2_subdev_init(&priv->subdev, &platform_subdev_ops); | 170 | v4l2_subdev_init(&priv->subdev, &platform_subdev_ops); |
171 | v4l2_set_subdevdata(&priv->subdev, p); | 171 | v4l2_set_subdevdata(&priv->subdev, p); |
@@ -188,7 +188,7 @@ static int soc_camera_platform_remove(struct platform_device *pdev) | |||
188 | { | 188 | { |
189 | struct soc_camera_platform_priv *priv = get_priv(pdev); | 189 | struct soc_camera_platform_priv *priv = get_priv(pdev); |
190 | struct soc_camera_platform_info *p = pdev->dev.platform_data; | 190 | struct soc_camera_platform_info *p = pdev->dev.platform_data; |
191 | struct soc_camera_device *icd = to_soc_camera_dev(p->dev); | 191 | struct soc_camera_device *icd = p->icd; |
192 | 192 | ||
193 | v4l2_device_unregister_subdev(&priv->subdev); | 193 | v4l2_device_unregister_subdev(&priv->subdev); |
194 | icd->ops = NULL; | 194 | icd->ops = NULL; |
diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c index a722f66c3f2..742482e3001 100644 --- a/drivers/media/video/tw9910.c +++ b/drivers/media/video/tw9910.c | |||
@@ -836,13 +836,9 @@ static int tw9910_video_probe(struct soc_camera_device *icd, | |||
836 | struct tw9910_priv *priv = to_tw9910(client); | 836 | struct tw9910_priv *priv = to_tw9910(client); |
837 | s32 id; | 837 | s32 id; |
838 | 838 | ||
839 | /* | 839 | /* We must have a parent by now. And it cannot be a wrong one. */ |
840 | * We must have a parent by now. And it cannot be a wrong one. | 840 | BUG_ON(!icd->parent || |
841 | * So this entire test is completely redundant. | 841 | to_soc_camera_host(icd->parent)->nr != icd->iface); |
842 | */ | ||
843 | if (!icd->dev.parent || | ||
844 | to_soc_camera_host(icd->dev.parent)->nr != icd->iface) | ||
845 | return -ENODEV; | ||
846 | 842 | ||
847 | /* | 843 | /* |
848 | * tw9910 only use 8 or 16 bit bus width | 844 | * tw9910 only use 8 or 16 bit bus width |