diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2009-04-24 11:55:48 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-06-16 17:20:43 -0400 |
commit | eff505fa1511b753b7cfb397a754b8ff4367cd55 (patch) | |
tree | 0e15a9094777bbebcfd1331b9e78f1aa6c6a5070 /drivers | |
parent | eb6c8558f7658b7f31ee022c7bea1d840eda33dc (diff) |
V4L/DVB (11609): soc-camera: remove an extra device generation from struct soc_camera_host
Make camera devices direct children of host platform devices, move the
inheritance management into the soc_camera.c core driver.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/mx1_camera.c | 35 | ||||
-rw-r--r-- | drivers/media/video/mx3_camera.c | 40 | ||||
-rw-r--r-- | drivers/media/video/pxa_camera.c | 97 | ||||
-rw-r--r-- | drivers/media/video/sh_mobile_ceu_camera.c | 21 | ||||
-rw-r--r-- | drivers/media/video/soc_camera.c | 35 |
5 files changed, 105 insertions, 123 deletions
diff --git a/drivers/media/video/mx1_camera.c b/drivers/media/video/mx1_camera.c index 48dd984dadff..2d075205bdfe 100644 --- a/drivers/media/video/mx1_camera.c +++ b/drivers/media/video/mx1_camera.c | |||
@@ -106,7 +106,6 @@ struct mx1_camera_dev { | |||
106 | struct soc_camera_device *icd; | 106 | struct soc_camera_device *icd; |
107 | struct mx1_camera_pdata *pdata; | 107 | struct mx1_camera_pdata *pdata; |
108 | struct mx1_buffer *active; | 108 | struct mx1_buffer *active; |
109 | struct device *dev; | ||
110 | struct resource *res; | 109 | struct resource *res; |
111 | struct clk *clk; | 110 | struct clk *clk; |
112 | struct list_head capture; | 111 | struct list_head capture; |
@@ -220,7 +219,7 @@ static int mx1_camera_setup_dma(struct mx1_camera_dev *pcdev) | |||
220 | int ret; | 219 | int ret; |
221 | 220 | ||
222 | if (unlikely(!pcdev->active)) { | 221 | if (unlikely(!pcdev->active)) { |
223 | dev_err(pcdev->dev, "DMA End IRQ with no active buffer\n"); | 222 | dev_err(pcdev->soc_host.dev, "DMA End IRQ with no active buffer\n"); |
224 | return -EFAULT; | 223 | return -EFAULT; |
225 | } | 224 | } |
226 | 225 | ||
@@ -230,7 +229,7 @@ static int mx1_camera_setup_dma(struct mx1_camera_dev *pcdev) | |||
230 | vbuf->size, pcdev->res->start + | 229 | vbuf->size, pcdev->res->start + |
231 | CSIRXR, DMA_MODE_READ); | 230 | CSIRXR, DMA_MODE_READ); |
232 | if (unlikely(ret)) | 231 | if (unlikely(ret)) |
233 | dev_err(pcdev->dev, "Failed to setup DMA sg list\n"); | 232 | dev_err(pcdev->soc_host.dev, "Failed to setup DMA sg list\n"); |
234 | 233 | ||
235 | return ret; | 234 | return ret; |
236 | } | 235 | } |
@@ -339,14 +338,14 @@ static void mx1_camera_dma_irq(int channel, void *data) | |||
339 | imx_dma_disable(channel); | 338 | imx_dma_disable(channel); |
340 | 339 | ||
341 | if (unlikely(!pcdev->active)) { | 340 | if (unlikely(!pcdev->active)) { |
342 | dev_err(pcdev->dev, "DMA End IRQ with no active buffer\n"); | 341 | dev_err(pcdev->soc_host.dev, "DMA End IRQ with no active buffer\n"); |
343 | goto out; | 342 | goto out; |
344 | } | 343 | } |
345 | 344 | ||
346 | vb = &pcdev->active->vb; | 345 | vb = &pcdev->active->vb; |
347 | buf = container_of(vb, struct mx1_buffer, vb); | 346 | buf = container_of(vb, struct mx1_buffer, vb); |
348 | WARN_ON(buf->inwork || list_empty(&vb->queue)); | 347 | WARN_ON(buf->inwork || list_empty(&vb->queue)); |
349 | dev_dbg(pcdev->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, | 348 | dev_dbg(pcdev->soc_host.dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, |
350 | vb, vb->baddr, vb->bsize); | 349 | vb, vb->baddr, vb->bsize); |
351 | 350 | ||
352 | mx1_camera_wakeup(pcdev, vb, buf); | 351 | mx1_camera_wakeup(pcdev, vb, buf); |
@@ -367,7 +366,7 @@ static void mx1_camera_init_videobuf(struct videobuf_queue *q, | |||
367 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 366 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); |
368 | struct mx1_camera_dev *pcdev = ici->priv; | 367 | struct mx1_camera_dev *pcdev = ici->priv; |
369 | 368 | ||
370 | videobuf_queue_dma_contig_init(q, &mx1_videobuf_ops, pcdev->dev, | 369 | videobuf_queue_dma_contig_init(q, &mx1_videobuf_ops, ici->dev, |
371 | &pcdev->lock, | 370 | &pcdev->lock, |
372 | V4L2_BUF_TYPE_VIDEO_CAPTURE, | 371 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
373 | V4L2_FIELD_NONE, | 372 | V4L2_FIELD_NONE, |
@@ -386,7 +385,7 @@ static int mclk_get_divisor(struct mx1_camera_dev *pcdev) | |||
386 | * they get a nice Oops */ | 385 | * they get a nice Oops */ |
387 | div = (lcdclk + 2 * mclk - 1) / (2 * mclk) - 1; | 386 | div = (lcdclk + 2 * mclk - 1) / (2 * mclk) - 1; |
388 | 387 | ||
389 | dev_dbg(pcdev->dev, "System clock %lukHz, target freq %dkHz, " | 388 | dev_dbg(pcdev->soc_host.dev, "System clock %lukHz, target freq %dkHz, " |
390 | "divisor %lu\n", lcdclk / 1000, mclk / 1000, div); | 389 | "divisor %lu\n", lcdclk / 1000, mclk / 1000, div); |
391 | 390 | ||
392 | return div; | 391 | return div; |
@@ -396,7 +395,7 @@ static void mx1_camera_activate(struct mx1_camera_dev *pcdev) | |||
396 | { | 395 | { |
397 | unsigned int csicr1 = CSICR1_EN; | 396 | unsigned int csicr1 = CSICR1_EN; |
398 | 397 | ||
399 | dev_dbg(pcdev->dev, "Activate device\n"); | 398 | dev_dbg(pcdev->soc_host.dev, "Activate device\n"); |
400 | 399 | ||
401 | clk_enable(pcdev->clk); | 400 | clk_enable(pcdev->clk); |
402 | 401 | ||
@@ -412,7 +411,7 @@ static void mx1_camera_activate(struct mx1_camera_dev *pcdev) | |||
412 | 411 | ||
413 | static void mx1_camera_deactivate(struct mx1_camera_dev *pcdev) | 412 | static void mx1_camera_deactivate(struct mx1_camera_dev *pcdev) |
414 | { | 413 | { |
415 | dev_dbg(pcdev->dev, "Deactivate device\n"); | 414 | dev_dbg(pcdev->soc_host.dev, "Deactivate device\n"); |
416 | 415 | ||
417 | /* Disable all CSI interface */ | 416 | /* Disable all CSI interface */ |
418 | __raw_writel(0x00, pcdev->base + CSICR1); | 417 | __raw_writel(0x00, pcdev->base + CSICR1); |
@@ -551,7 +550,7 @@ static int mx1_camera_set_fmt(struct soc_camera_device *icd, | |||
551 | 550 | ||
552 | xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); | 551 | xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); |
553 | if (!xlate) { | 552 | if (!xlate) { |
554 | dev_warn(&ici->dev, "Format %x not found\n", pix->pixelformat); | 553 | dev_warn(ici->dev, "Format %x not found\n", pix->pixelformat); |
555 | return -EINVAL; | 554 | return -EINVAL; |
556 | } | 555 | } |
557 | 556 | ||
@@ -668,7 +667,6 @@ static int __init mx1_camera_probe(struct platform_device *pdev) | |||
668 | goto exit_put_clk; | 667 | goto exit_put_clk; |
669 | } | 668 | } |
670 | 669 | ||
671 | platform_set_drvdata(pdev, pcdev); | ||
672 | pcdev->res = res; | 670 | pcdev->res = res; |
673 | pcdev->clk = clk; | 671 | pcdev->clk = clk; |
674 | 672 | ||
@@ -702,16 +700,15 @@ static int __init mx1_camera_probe(struct platform_device *pdev) | |||
702 | } | 700 | } |
703 | pcdev->irq = irq; | 701 | pcdev->irq = irq; |
704 | pcdev->base = base; | 702 | pcdev->base = base; |
705 | pcdev->dev = &pdev->dev; | ||
706 | 703 | ||
707 | /* request dma */ | 704 | /* request dma */ |
708 | pcdev->dma_chan = imx_dma_request_by_prio(DRIVER_NAME, DMA_PRIO_HIGH); | 705 | pcdev->dma_chan = imx_dma_request_by_prio(DRIVER_NAME, DMA_PRIO_HIGH); |
709 | if (pcdev->dma_chan < 0) { | 706 | if (pcdev->dma_chan < 0) { |
710 | dev_err(pcdev->dev, "Can't request DMA for MX1 CSI\n"); | 707 | dev_err(&pdev->dev, "Can't request DMA for MX1 CSI\n"); |
711 | err = -EBUSY; | 708 | err = -EBUSY; |
712 | goto exit_iounmap; | 709 | goto exit_iounmap; |
713 | } | 710 | } |
714 | dev_dbg(pcdev->dev, "got DMA channel %d\n", pcdev->dma_chan); | 711 | dev_dbg(&pdev->dev, "got DMA channel %d\n", pcdev->dma_chan); |
715 | 712 | ||
716 | imx_dma_setup_handlers(pcdev->dma_chan, mx1_camera_dma_irq, NULL, | 713 | imx_dma_setup_handlers(pcdev->dma_chan, mx1_camera_dma_irq, NULL, |
717 | pcdev); | 714 | pcdev); |
@@ -724,7 +721,7 @@ static int __init mx1_camera_probe(struct platform_device *pdev) | |||
724 | /* request irq */ | 721 | /* request irq */ |
725 | err = claim_fiq(&fh); | 722 | err = claim_fiq(&fh); |
726 | if (err) { | 723 | if (err) { |
727 | dev_err(pcdev->dev, "Camera interrupt register failed \n"); | 724 | dev_err(&pdev->dev, "Camera interrupt register failed \n"); |
728 | goto exit_free_dma; | 725 | goto exit_free_dma; |
729 | } | 726 | } |
730 | 727 | ||
@@ -744,7 +741,7 @@ static int __init mx1_camera_probe(struct platform_device *pdev) | |||
744 | pcdev->soc_host.drv_name = DRIVER_NAME; | 741 | pcdev->soc_host.drv_name = DRIVER_NAME; |
745 | pcdev->soc_host.ops = &mx1_soc_camera_host_ops; | 742 | pcdev->soc_host.ops = &mx1_soc_camera_host_ops; |
746 | pcdev->soc_host.priv = pcdev; | 743 | pcdev->soc_host.priv = pcdev; |
747 | pcdev->soc_host.dev.parent = &pdev->dev; | 744 | pcdev->soc_host.dev = &pdev->dev; |
748 | pcdev->soc_host.nr = pdev->id; | 745 | pcdev->soc_host.nr = pdev->id; |
749 | err = soc_camera_host_register(&pcdev->soc_host); | 746 | err = soc_camera_host_register(&pcdev->soc_host); |
750 | if (err) | 747 | if (err) |
@@ -774,7 +771,9 @@ exit: | |||
774 | 771 | ||
775 | static int __exit mx1_camera_remove(struct platform_device *pdev) | 772 | static int __exit mx1_camera_remove(struct platform_device *pdev) |
776 | { | 773 | { |
777 | struct mx1_camera_dev *pcdev = platform_get_drvdata(pdev); | 774 | struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev); |
775 | struct mx1_camera_dev *pcdev = container_of(soc_host, | ||
776 | struct mx1_camera_dev, soc_host); | ||
778 | struct resource *res; | 777 | struct resource *res; |
779 | 778 | ||
780 | imx_dma_free(pcdev->dma_chan); | 779 | imx_dma_free(pcdev->dma_chan); |
@@ -784,7 +783,7 @@ static int __exit mx1_camera_remove(struct platform_device *pdev) | |||
784 | 783 | ||
785 | clk_put(pcdev->clk); | 784 | clk_put(pcdev->clk); |
786 | 785 | ||
787 | soc_camera_host_unregister(&pcdev->soc_host); | 786 | soc_camera_host_unregister(soc_host); |
788 | 787 | ||
789 | iounmap(pcdev->base); | 788 | iounmap(pcdev->base); |
790 | 789 | ||
diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c index 3d187f966d61..4d47eeb14452 100644 --- a/drivers/media/video/mx3_camera.c +++ b/drivers/media/video/mx3_camera.c | |||
@@ -87,7 +87,6 @@ struct mx3_camera_buffer { | |||
87 | * @soc_host: embedded soc_host object | 87 | * @soc_host: embedded soc_host object |
88 | */ | 88 | */ |
89 | struct mx3_camera_dev { | 89 | struct mx3_camera_dev { |
90 | struct device *dev; | ||
91 | /* | 90 | /* |
92 | * i.MX3x is only supposed to handle one camera on its Camera Sensor | 91 | * i.MX3x is only supposed to handle one camera on its Camera Sensor |
93 | * Interface. If anyone ever builds hardware to enable more than one | 92 | * Interface. If anyone ever builds hardware to enable more than one |
@@ -431,7 +430,7 @@ static void mx3_camera_init_videobuf(struct videobuf_queue *q, | |||
431 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 430 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); |
432 | struct mx3_camera_dev *mx3_cam = ici->priv; | 431 | struct mx3_camera_dev *mx3_cam = ici->priv; |
433 | 432 | ||
434 | videobuf_queue_dma_contig_init(q, &mx3_videobuf_ops, mx3_cam->dev, | 433 | videobuf_queue_dma_contig_init(q, &mx3_videobuf_ops, ici->dev, |
435 | &mx3_cam->lock, | 434 | &mx3_cam->lock, |
436 | V4L2_BUF_TYPE_VIDEO_CAPTURE, | 435 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
437 | V4L2_FIELD_NONE, | 436 | V4L2_FIELD_NONE, |
@@ -599,7 +598,8 @@ static int test_platform_param(struct mx3_camera_dev *mx3_cam, | |||
599 | *flags |= SOCAM_DATAWIDTH_4; | 598 | *flags |= SOCAM_DATAWIDTH_4; |
600 | break; | 599 | break; |
601 | default: | 600 | default: |
602 | dev_info(mx3_cam->dev, "Unsupported bus width %d\n", buswidth); | 601 | dev_info(mx3_cam->soc_host.dev, "Unsupported bus width %d\n", |
602 | buswidth); | ||
603 | return -EINVAL; | 603 | return -EINVAL; |
604 | } | 604 | } |
605 | 605 | ||
@@ -614,7 +614,7 @@ static int mx3_camera_try_bus_param(struct soc_camera_device *icd, | |||
614 | unsigned long bus_flags, camera_flags; | 614 | unsigned long bus_flags, camera_flags; |
615 | int ret = test_platform_param(mx3_cam, depth, &bus_flags); | 615 | int ret = test_platform_param(mx3_cam, depth, &bus_flags); |
616 | 616 | ||
617 | dev_dbg(&ici->dev, "requested bus width %d bit: %d\n", depth, ret); | 617 | dev_dbg(ici->dev, "requested bus width %d bit: %d\n", depth, ret); |
618 | 618 | ||
619 | if (ret < 0) | 619 | if (ret < 0) |
620 | return ret; | 620 | return ret; |
@@ -637,7 +637,7 @@ static bool chan_filter(struct dma_chan *chan, void *arg) | |||
637 | if (!rq) | 637 | if (!rq) |
638 | return false; | 638 | return false; |
639 | 639 | ||
640 | pdata = rq->mx3_cam->dev->platform_data; | 640 | pdata = rq->mx3_cam->soc_host.dev->platform_data; |
641 | 641 | ||
642 | return rq->id == chan->chan_id && | 642 | return rq->id == chan->chan_id && |
643 | pdata->dma_dev == chan->device->dev; | 643 | pdata->dma_dev == chan->device->dev; |
@@ -697,7 +697,7 @@ static int mx3_camera_get_formats(struct soc_camera_device *icd, int idx, | |||
697 | xlate->cam_fmt = icd->formats + idx; | 697 | xlate->cam_fmt = icd->formats + idx; |
698 | xlate->buswidth = buswidth; | 698 | xlate->buswidth = buswidth; |
699 | xlate++; | 699 | xlate++; |
700 | dev_dbg(&ici->dev, "Providing format %s using %s\n", | 700 | dev_dbg(ici->dev, "Providing format %s using %s\n", |
701 | mx3_camera_formats[0].name, | 701 | mx3_camera_formats[0].name, |
702 | icd->formats[idx].name); | 702 | icd->formats[idx].name); |
703 | } | 703 | } |
@@ -709,7 +709,7 @@ static int mx3_camera_get_formats(struct soc_camera_device *icd, int idx, | |||
709 | xlate->cam_fmt = icd->formats + idx; | 709 | xlate->cam_fmt = icd->formats + idx; |
710 | xlate->buswidth = buswidth; | 710 | xlate->buswidth = buswidth; |
711 | xlate++; | 711 | xlate++; |
712 | dev_dbg(&ici->dev, "Providing format %s using %s\n", | 712 | dev_dbg(ici->dev, "Providing format %s using %s\n", |
713 | mx3_camera_formats[0].name, | 713 | mx3_camera_formats[0].name, |
714 | icd->formats[idx].name); | 714 | icd->formats[idx].name); |
715 | } | 715 | } |
@@ -722,7 +722,7 @@ passthrough: | |||
722 | xlate->cam_fmt = icd->formats + idx; | 722 | xlate->cam_fmt = icd->formats + idx; |
723 | xlate->buswidth = buswidth; | 723 | xlate->buswidth = buswidth; |
724 | xlate++; | 724 | xlate++; |
725 | dev_dbg(&ici->dev, | 725 | dev_dbg(ici->dev, |
726 | "Providing format %s in pass-through mode\n", | 726 | "Providing format %s in pass-through mode\n", |
727 | icd->formats[idx].name); | 727 | icd->formats[idx].name); |
728 | } | 728 | } |
@@ -829,7 +829,7 @@ static int mx3_camera_set_fmt(struct soc_camera_device *icd, | |||
829 | 829 | ||
830 | xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); | 830 | xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); |
831 | if (!xlate) { | 831 | if (!xlate) { |
832 | dev_warn(&ici->dev, "Format %x not found\n", pix->pixelformat); | 832 | dev_warn(ici->dev, "Format %x not found\n", pix->pixelformat); |
833 | return -EINVAL; | 833 | return -EINVAL; |
834 | } | 834 | } |
835 | 835 | ||
@@ -866,7 +866,7 @@ static int mx3_camera_try_fmt(struct soc_camera_device *icd, | |||
866 | 866 | ||
867 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); | 867 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); |
868 | if (pixfmt && !xlate) { | 868 | if (pixfmt && !xlate) { |
869 | dev_warn(&ici->dev, "Format %x not found\n", pixfmt); | 869 | dev_warn(ici->dev, "Format %x not found\n", pixfmt); |
870 | return -EINVAL; | 870 | return -EINVAL; |
871 | } | 871 | } |
872 | 872 | ||
@@ -933,11 +933,11 @@ static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) | |||
933 | 933 | ||
934 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); | 934 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); |
935 | if (!xlate) { | 935 | if (!xlate) { |
936 | dev_warn(&ici->dev, "Format %x not found\n", pixfmt); | 936 | dev_warn(ici->dev, "Format %x not found\n", pixfmt); |
937 | return -EINVAL; | 937 | return -EINVAL; |
938 | } | 938 | } |
939 | 939 | ||
940 | dev_dbg(&ici->dev, "requested bus width %d bit: %d\n", | 940 | dev_dbg(ici->dev, "requested bus width %d bit: %d\n", |
941 | icd->buswidth, ret); | 941 | icd->buswidth, ret); |
942 | 942 | ||
943 | if (ret < 0) | 943 | if (ret < 0) |
@@ -947,7 +947,7 @@ static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) | |||
947 | 947 | ||
948 | common_flags = soc_camera_bus_param_compatible(camera_flags, bus_flags); | 948 | common_flags = soc_camera_bus_param_compatible(camera_flags, bus_flags); |
949 | if (!common_flags) { | 949 | if (!common_flags) { |
950 | dev_dbg(&ici->dev, "no common flags: camera %lx, host %lx\n", | 950 | dev_dbg(ici->dev, "no common flags: camera %lx, host %lx\n", |
951 | camera_flags, bus_flags); | 951 | camera_flags, bus_flags); |
952 | return -EINVAL; | 952 | return -EINVAL; |
953 | } | 953 | } |
@@ -1054,7 +1054,7 @@ static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) | |||
1054 | 1054 | ||
1055 | csi_reg_write(mx3_cam, sens_conf | dw, CSI_SENS_CONF); | 1055 | csi_reg_write(mx3_cam, sens_conf | dw, CSI_SENS_CONF); |
1056 | 1056 | ||
1057 | dev_dbg(&ici->dev, "Set SENS_CONF to %x\n", sens_conf | dw); | 1057 | dev_dbg(ici->dev, "Set SENS_CONF to %x\n", sens_conf | dw); |
1058 | 1058 | ||
1059 | return 0; | 1059 | return 0; |
1060 | } | 1060 | } |
@@ -1102,8 +1102,6 @@ static int mx3_camera_probe(struct platform_device *pdev) | |||
1102 | goto eclkget; | 1102 | goto eclkget; |
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | platform_set_drvdata(pdev, mx3_cam); | ||
1106 | |||
1107 | mx3_cam->pdata = pdev->dev.platform_data; | 1105 | mx3_cam->pdata = pdev->dev.platform_data; |
1108 | mx3_cam->platform_flags = mx3_cam->pdata->flags; | 1106 | mx3_cam->platform_flags = mx3_cam->pdata->flags; |
1109 | if (!(mx3_cam->platform_flags & (MX3_CAMERA_DATAWIDTH_4 | | 1107 | if (!(mx3_cam->platform_flags & (MX3_CAMERA_DATAWIDTH_4 | |
@@ -1135,14 +1133,14 @@ static int mx3_camera_probe(struct platform_device *pdev) | |||
1135 | } | 1133 | } |
1136 | 1134 | ||
1137 | mx3_cam->base = base; | 1135 | mx3_cam->base = base; |
1138 | mx3_cam->dev = &pdev->dev; | ||
1139 | 1136 | ||
1140 | soc_host = &mx3_cam->soc_host; | 1137 | soc_host = &mx3_cam->soc_host; |
1141 | soc_host->drv_name = MX3_CAM_DRV_NAME; | 1138 | soc_host->drv_name = MX3_CAM_DRV_NAME; |
1142 | soc_host->ops = &mx3_soc_camera_host_ops; | 1139 | soc_host->ops = &mx3_soc_camera_host_ops; |
1143 | soc_host->priv = mx3_cam; | 1140 | soc_host->priv = mx3_cam; |
1144 | soc_host->dev.parent = &pdev->dev; | 1141 | soc_host->dev = &pdev->dev; |
1145 | soc_host->nr = pdev->id; | 1142 | soc_host->nr = pdev->id; |
1143 | |||
1146 | err = soc_camera_host_register(soc_host); | 1144 | err = soc_camera_host_register(soc_host); |
1147 | if (err) | 1145 | if (err) |
1148 | goto ecamhostreg; | 1146 | goto ecamhostreg; |
@@ -1165,11 +1163,13 @@ egetres: | |||
1165 | 1163 | ||
1166 | static int __devexit mx3_camera_remove(struct platform_device *pdev) | 1164 | static int __devexit mx3_camera_remove(struct platform_device *pdev) |
1167 | { | 1165 | { |
1168 | struct mx3_camera_dev *mx3_cam = platform_get_drvdata(pdev); | 1166 | struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev); |
1167 | struct mx3_camera_dev *mx3_cam = container_of(soc_host, | ||
1168 | struct mx3_camera_dev, soc_host); | ||
1169 | 1169 | ||
1170 | clk_put(mx3_cam->clk); | 1170 | clk_put(mx3_cam->clk); |
1171 | 1171 | ||
1172 | soc_camera_host_unregister(&mx3_cam->soc_host); | 1172 | soc_camera_host_unregister(soc_host); |
1173 | 1173 | ||
1174 | iounmap(mx3_cam->base); | 1174 | iounmap(mx3_cam->base); |
1175 | 1175 | ||
diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c index ad0d58c01bb9..2da5eef19b70 100644 --- a/drivers/media/video/pxa_camera.c +++ b/drivers/media/video/pxa_camera.c | |||
@@ -203,7 +203,6 @@ struct pxa_buffer { | |||
203 | 203 | ||
204 | struct pxa_camera_dev { | 204 | struct pxa_camera_dev { |
205 | struct soc_camera_host soc_host; | 205 | struct soc_camera_host soc_host; |
206 | struct device *dev; | ||
207 | /* PXA27x is only supposed to handle one camera on its Quick Capture | 206 | /* PXA27x is only supposed to handle one camera on its Quick Capture |
208 | * interface. If anyone ever builds hardware to enable more than | 207 | * interface. If anyone ever builds hardware to enable more than |
209 | * one camera, they will have to modify this driver too */ | 208 | * one camera, they will have to modify this driver too */ |
@@ -262,7 +261,6 @@ static void free_buffer(struct videobuf_queue *vq, struct pxa_buffer *buf) | |||
262 | { | 261 | { |
263 | struct soc_camera_device *icd = vq->priv_data; | 262 | struct soc_camera_device *icd = vq->priv_data; |
264 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 263 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); |
265 | struct pxa_camera_dev *pcdev = ici->priv; | ||
266 | struct videobuf_dmabuf *dma = videobuf_to_dma(&buf->vb); | 264 | struct videobuf_dmabuf *dma = videobuf_to_dma(&buf->vb); |
267 | int i; | 265 | int i; |
268 | 266 | ||
@@ -279,7 +277,7 @@ static void free_buffer(struct videobuf_queue *vq, struct pxa_buffer *buf) | |||
279 | 277 | ||
280 | for (i = 0; i < ARRAY_SIZE(buf->dmas); i++) { | 278 | for (i = 0; i < ARRAY_SIZE(buf->dmas); i++) { |
281 | if (buf->dmas[i].sg_cpu) | 279 | if (buf->dmas[i].sg_cpu) |
282 | dma_free_coherent(pcdev->dev, buf->dmas[i].sg_size, | 280 | dma_free_coherent(ici->dev, buf->dmas[i].sg_size, |
283 | buf->dmas[i].sg_cpu, | 281 | buf->dmas[i].sg_cpu, |
284 | buf->dmas[i].sg_dma); | 282 | buf->dmas[i].sg_dma); |
285 | buf->dmas[i].sg_cpu = NULL; | 283 | buf->dmas[i].sg_cpu = NULL; |
@@ -339,14 +337,14 @@ static int pxa_init_dma_channel(struct pxa_camera_dev *pcdev, | |||
339 | int dma_len = 0, xfer_len = 0; | 337 | int dma_len = 0, xfer_len = 0; |
340 | 338 | ||
341 | if (pxa_dma->sg_cpu) | 339 | if (pxa_dma->sg_cpu) |
342 | dma_free_coherent(pcdev->dev, pxa_dma->sg_size, | 340 | dma_free_coherent(pcdev->soc_host.dev, pxa_dma->sg_size, |
343 | pxa_dma->sg_cpu, pxa_dma->sg_dma); | 341 | pxa_dma->sg_cpu, pxa_dma->sg_dma); |
344 | 342 | ||
345 | sglen = calculate_dma_sglen(*sg_first, dma->sglen, | 343 | sglen = calculate_dma_sglen(*sg_first, dma->sglen, |
346 | *sg_first_ofs, size); | 344 | *sg_first_ofs, size); |
347 | 345 | ||
348 | pxa_dma->sg_size = (sglen + 1) * sizeof(struct pxa_dma_desc); | 346 | pxa_dma->sg_size = (sglen + 1) * sizeof(struct pxa_dma_desc); |
349 | pxa_dma->sg_cpu = dma_alloc_coherent(pcdev->dev, pxa_dma->sg_size, | 347 | pxa_dma->sg_cpu = dma_alloc_coherent(pcdev->soc_host.dev, pxa_dma->sg_size, |
350 | &pxa_dma->sg_dma, GFP_KERNEL); | 348 | &pxa_dma->sg_dma, GFP_KERNEL); |
351 | if (!pxa_dma->sg_cpu) | 349 | if (!pxa_dma->sg_cpu) |
352 | return -ENOMEM; | 350 | return -ENOMEM; |
@@ -354,7 +352,7 @@ static int pxa_init_dma_channel(struct pxa_camera_dev *pcdev, | |||
354 | pxa_dma->sglen = sglen; | 352 | pxa_dma->sglen = sglen; |
355 | offset = *sg_first_ofs; | 353 | offset = *sg_first_ofs; |
356 | 354 | ||
357 | dev_dbg(pcdev->dev, "DMA: sg_first=%p, sglen=%d, ofs=%d, dma.desc=%x\n", | 355 | dev_dbg(pcdev->soc_host.dev, "DMA: sg_first=%p, sglen=%d, ofs=%d, dma.desc=%x\n", |
358 | *sg_first, sglen, *sg_first_ofs, pxa_dma->sg_dma); | 356 | *sg_first, sglen, *sg_first_ofs, pxa_dma->sg_dma); |
359 | 357 | ||
360 | 358 | ||
@@ -377,7 +375,7 @@ static int pxa_init_dma_channel(struct pxa_camera_dev *pcdev, | |||
377 | pxa_dma->sg_cpu[i].ddadr = | 375 | pxa_dma->sg_cpu[i].ddadr = |
378 | pxa_dma->sg_dma + (i + 1) * sizeof(struct pxa_dma_desc); | 376 | pxa_dma->sg_dma + (i + 1) * sizeof(struct pxa_dma_desc); |
379 | 377 | ||
380 | dev_vdbg(pcdev->dev, "DMA: desc.%08x->@phys=0x%08x, len=%d\n", | 378 | dev_vdbg(pcdev->soc_host.dev, "DMA: desc.%08x->@phys=0x%08x, len=%d\n", |
381 | pxa_dma->sg_dma + i * sizeof(struct pxa_dma_desc), | 379 | pxa_dma->sg_dma + i * sizeof(struct pxa_dma_desc), |
382 | sg_dma_address(sg) + offset, xfer_len); | 380 | sg_dma_address(sg) + offset, xfer_len); |
383 | offset = 0; | 381 | offset = 0; |
@@ -489,7 +487,7 @@ static int pxa_videobuf_prepare(struct videobuf_queue *vq, | |||
489 | ret = pxa_init_dma_channel(pcdev, buf, dma, 0, CIBR0, size_y, | 487 | ret = pxa_init_dma_channel(pcdev, buf, dma, 0, CIBR0, size_y, |
490 | &sg, &next_ofs); | 488 | &sg, &next_ofs); |
491 | if (ret) { | 489 | if (ret) { |
492 | dev_err(pcdev->dev, | 490 | dev_err(pcdev->soc_host.dev, |
493 | "DMA initialization for Y/RGB failed\n"); | 491 | "DMA initialization for Y/RGB failed\n"); |
494 | goto fail; | 492 | goto fail; |
495 | } | 493 | } |
@@ -499,7 +497,7 @@ static int pxa_videobuf_prepare(struct videobuf_queue *vq, | |||
499 | ret = pxa_init_dma_channel(pcdev, buf, dma, 1, CIBR1, | 497 | ret = pxa_init_dma_channel(pcdev, buf, dma, 1, CIBR1, |
500 | size_u, &sg, &next_ofs); | 498 | size_u, &sg, &next_ofs); |
501 | if (ret) { | 499 | if (ret) { |
502 | dev_err(pcdev->dev, | 500 | dev_err(pcdev->soc_host.dev, |
503 | "DMA initialization for U failed\n"); | 501 | "DMA initialization for U failed\n"); |
504 | goto fail_u; | 502 | goto fail_u; |
505 | } | 503 | } |
@@ -509,7 +507,7 @@ static int pxa_videobuf_prepare(struct videobuf_queue *vq, | |||
509 | ret = pxa_init_dma_channel(pcdev, buf, dma, 2, CIBR2, | 507 | ret = pxa_init_dma_channel(pcdev, buf, dma, 2, CIBR2, |
510 | size_v, &sg, &next_ofs); | 508 | size_v, &sg, &next_ofs); |
511 | if (ret) { | 509 | if (ret) { |
512 | dev_err(pcdev->dev, | 510 | dev_err(pcdev->soc_host.dev, |
513 | "DMA initialization for V failed\n"); | 511 | "DMA initialization for V failed\n"); |
514 | goto fail_v; | 512 | goto fail_v; |
515 | } | 513 | } |
@@ -523,10 +521,10 @@ static int pxa_videobuf_prepare(struct videobuf_queue *vq, | |||
523 | return 0; | 521 | return 0; |
524 | 522 | ||
525 | fail_v: | 523 | fail_v: |
526 | dma_free_coherent(pcdev->dev, buf->dmas[1].sg_size, | 524 | dma_free_coherent(pcdev->soc_host.dev, buf->dmas[1].sg_size, |
527 | buf->dmas[1].sg_cpu, buf->dmas[1].sg_dma); | 525 | buf->dmas[1].sg_cpu, buf->dmas[1].sg_dma); |
528 | fail_u: | 526 | fail_u: |
529 | dma_free_coherent(pcdev->dev, buf->dmas[0].sg_size, | 527 | dma_free_coherent(pcdev->soc_host.dev, buf->dmas[0].sg_size, |
530 | buf->dmas[0].sg_cpu, buf->dmas[0].sg_dma); | 528 | buf->dmas[0].sg_cpu, buf->dmas[0].sg_dma); |
531 | fail: | 529 | fail: |
532 | free_buffer(vq, buf); | 530 | free_buffer(vq, buf); |
@@ -550,7 +548,7 @@ static void pxa_dma_start_channels(struct pxa_camera_dev *pcdev) | |||
550 | active = pcdev->active; | 548 | active = pcdev->active; |
551 | 549 | ||
552 | for (i = 0; i < pcdev->channels; i++) { | 550 | for (i = 0; i < pcdev->channels; i++) { |
553 | dev_dbg(pcdev->dev, "%s (channel=%d) ddadr=%08x\n", __func__, | 551 | dev_dbg(pcdev->soc_host.dev, "%s (channel=%d) ddadr=%08x\n", __func__, |
554 | i, active->dmas[i].sg_dma); | 552 | i, active->dmas[i].sg_dma); |
555 | DDADR(pcdev->dma_chans[i]) = active->dmas[i].sg_dma; | 553 | DDADR(pcdev->dma_chans[i]) = active->dmas[i].sg_dma; |
556 | DCSR(pcdev->dma_chans[i]) = DCSR_RUN; | 554 | DCSR(pcdev->dma_chans[i]) = DCSR_RUN; |
@@ -562,7 +560,7 @@ static void pxa_dma_stop_channels(struct pxa_camera_dev *pcdev) | |||
562 | int i; | 560 | int i; |
563 | 561 | ||
564 | for (i = 0; i < pcdev->channels; i++) { | 562 | for (i = 0; i < pcdev->channels; i++) { |
565 | dev_dbg(pcdev->dev, "%s (channel=%d)\n", __func__, i); | 563 | dev_dbg(pcdev->soc_host.dev, "%s (channel=%d)\n", __func__, i); |
566 | DCSR(pcdev->dma_chans[i]) = 0; | 564 | DCSR(pcdev->dma_chans[i]) = 0; |
567 | } | 565 | } |
568 | } | 566 | } |
@@ -598,7 +596,7 @@ static void pxa_camera_start_capture(struct pxa_camera_dev *pcdev) | |||
598 | { | 596 | { |
599 | unsigned long cicr0, cifr; | 597 | unsigned long cicr0, cifr; |
600 | 598 | ||
601 | dev_dbg(pcdev->dev, "%s\n", __func__); | 599 | dev_dbg(pcdev->soc_host.dev, "%s\n", __func__); |
602 | /* Reset the FIFOs */ | 600 | /* Reset the FIFOs */ |
603 | cifr = __raw_readl(pcdev->base + CIFR) | CIFR_RESET_F; | 601 | cifr = __raw_readl(pcdev->base + CIFR) | CIFR_RESET_F; |
604 | __raw_writel(cifr, pcdev->base + CIFR); | 602 | __raw_writel(cifr, pcdev->base + CIFR); |
@@ -618,7 +616,7 @@ static void pxa_camera_stop_capture(struct pxa_camera_dev *pcdev) | |||
618 | __raw_writel(cicr0, pcdev->base + CICR0); | 616 | __raw_writel(cicr0, pcdev->base + CICR0); |
619 | 617 | ||
620 | pcdev->active = NULL; | 618 | pcdev->active = NULL; |
621 | dev_dbg(pcdev->dev, "%s\n", __func__); | 619 | dev_dbg(pcdev->soc_host.dev, "%s\n", __func__); |
622 | } | 620 | } |
623 | 621 | ||
624 | static void pxa_videobuf_queue(struct videobuf_queue *vq, | 622 | static void pxa_videobuf_queue(struct videobuf_queue *vq, |
@@ -687,7 +685,7 @@ static void pxa_camera_wakeup(struct pxa_camera_dev *pcdev, | |||
687 | do_gettimeofday(&vb->ts); | 685 | do_gettimeofday(&vb->ts); |
688 | vb->field_count++; | 686 | vb->field_count++; |
689 | wake_up(&vb->done); | 687 | wake_up(&vb->done); |
690 | dev_dbg(pcdev->dev, "%s dequeud buffer (vb=0x%p)\n", __func__, vb); | 688 | dev_dbg(pcdev->soc_host.dev, "%s dequeud buffer (vb=0x%p)\n", __func__, vb); |
691 | 689 | ||
692 | if (list_empty(&pcdev->capture)) { | 690 | if (list_empty(&pcdev->capture)) { |
693 | pxa_camera_stop_capture(pcdev); | 691 | pxa_camera_stop_capture(pcdev); |
@@ -723,7 +721,7 @@ static void pxa_camera_check_link_miss(struct pxa_camera_dev *pcdev) | |||
723 | for (i = 0; i < pcdev->channels; i++) | 721 | for (i = 0; i < pcdev->channels; i++) |
724 | if (DDADR(pcdev->dma_chans[i]) != DDADR_STOP) | 722 | if (DDADR(pcdev->dma_chans[i]) != DDADR_STOP) |
725 | is_dma_stopped = 0; | 723 | is_dma_stopped = 0; |
726 | dev_dbg(pcdev->dev, "%s : top queued buffer=%p, dma_stopped=%d\n", | 724 | dev_dbg(pcdev->soc_host.dev, "%s : top queued buffer=%p, dma_stopped=%d\n", |
727 | __func__, pcdev->active, is_dma_stopped); | 725 | __func__, pcdev->active, is_dma_stopped); |
728 | if (pcdev->active && is_dma_stopped) | 726 | if (pcdev->active && is_dma_stopped) |
729 | pxa_camera_start_capture(pcdev); | 727 | pxa_camera_start_capture(pcdev); |
@@ -748,12 +746,12 @@ static void pxa_camera_dma_irq(int channel, struct pxa_camera_dev *pcdev, | |||
748 | overrun |= CISR_IFO_1 | CISR_IFO_2; | 746 | overrun |= CISR_IFO_1 | CISR_IFO_2; |
749 | 747 | ||
750 | if (status & DCSR_BUSERR) { | 748 | if (status & DCSR_BUSERR) { |
751 | dev_err(pcdev->dev, "DMA Bus Error IRQ!\n"); | 749 | dev_err(pcdev->soc_host.dev, "DMA Bus Error IRQ!\n"); |
752 | goto out; | 750 | goto out; |
753 | } | 751 | } |
754 | 752 | ||
755 | if (!(status & (DCSR_ENDINTR | DCSR_STARTINTR))) { | 753 | if (!(status & (DCSR_ENDINTR | DCSR_STARTINTR))) { |
756 | dev_err(pcdev->dev, "Unknown DMA IRQ source, " | 754 | dev_err(pcdev->soc_host.dev, "Unknown DMA IRQ source, " |
757 | "status: 0x%08x\n", status); | 755 | "status: 0x%08x\n", status); |
758 | goto out; | 756 | goto out; |
759 | } | 757 | } |
@@ -777,7 +775,7 @@ static void pxa_camera_dma_irq(int channel, struct pxa_camera_dev *pcdev, | |||
777 | buf = container_of(vb, struct pxa_buffer, vb); | 775 | buf = container_of(vb, struct pxa_buffer, vb); |
778 | WARN_ON(buf->inwork || list_empty(&vb->queue)); | 776 | WARN_ON(buf->inwork || list_empty(&vb->queue)); |
779 | 777 | ||
780 | dev_dbg(pcdev->dev, "%s channel=%d %s%s(vb=0x%p) dma.desc=%x\n", | 778 | dev_dbg(pcdev->soc_host.dev, "%s channel=%d %s%s(vb=0x%p) dma.desc=%x\n", |
781 | __func__, channel, status & DCSR_STARTINTR ? "SOF " : "", | 779 | __func__, channel, status & DCSR_STARTINTR ? "SOF " : "", |
782 | status & DCSR_ENDINTR ? "EOF " : "", vb, DDADR(channel)); | 780 | status & DCSR_ENDINTR ? "EOF " : "", vb, DDADR(channel)); |
783 | 781 | ||
@@ -788,7 +786,7 @@ static void pxa_camera_dma_irq(int channel, struct pxa_camera_dev *pcdev, | |||
788 | */ | 786 | */ |
789 | if (camera_status & overrun && | 787 | if (camera_status & overrun && |
790 | !list_is_last(pcdev->capture.next, &pcdev->capture)) { | 788 | !list_is_last(pcdev->capture.next, &pcdev->capture)) { |
791 | dev_dbg(pcdev->dev, "FIFO overrun! CISR: %x\n", | 789 | dev_dbg(pcdev->soc_host.dev, "FIFO overrun! CISR: %x\n", |
792 | camera_status); | 790 | camera_status); |
793 | pxa_camera_stop_capture(pcdev); | 791 | pxa_camera_stop_capture(pcdev); |
794 | pxa_camera_start_capture(pcdev); | 792 | pxa_camera_start_capture(pcdev); |
@@ -855,7 +853,7 @@ static u32 mclk_get_divisor(struct pxa_camera_dev *pcdev) | |||
855 | /* mclk <= ciclk / 4 (27.4.2) */ | 853 | /* mclk <= ciclk / 4 (27.4.2) */ |
856 | if (mclk > lcdclk / 4) { | 854 | if (mclk > lcdclk / 4) { |
857 | mclk = lcdclk / 4; | 855 | mclk = lcdclk / 4; |
858 | dev_warn(pcdev->dev, "Limiting master clock to %lu\n", mclk); | 856 | dev_warn(pcdev->soc_host.dev, "Limiting master clock to %lu\n", mclk); |
859 | } | 857 | } |
860 | 858 | ||
861 | /* We verify mclk != 0, so if anyone breaks it, here comes their Oops */ | 859 | /* We verify mclk != 0, so if anyone breaks it, here comes their Oops */ |
@@ -865,7 +863,7 @@ static u32 mclk_get_divisor(struct pxa_camera_dev *pcdev) | |||
865 | if (pcdev->platform_flags & PXA_CAMERA_MCLK_EN) | 863 | if (pcdev->platform_flags & PXA_CAMERA_MCLK_EN) |
866 | pcdev->mclk = lcdclk / (2 * (div + 1)); | 864 | pcdev->mclk = lcdclk / (2 * (div + 1)); |
867 | 865 | ||
868 | dev_dbg(pcdev->dev, "LCD clock %luHz, target freq %luHz, " | 866 | dev_dbg(pcdev->soc_host.dev, "LCD clock %luHz, target freq %luHz, " |
869 | "divisor %u\n", lcdclk, mclk, div); | 867 | "divisor %u\n", lcdclk, mclk, div); |
870 | 868 | ||
871 | return div; | 869 | return div; |
@@ -885,12 +883,12 @@ static void pxa_camera_activate(struct pxa_camera_dev *pcdev) | |||
885 | struct pxacamera_platform_data *pdata = pcdev->pdata; | 883 | struct pxacamera_platform_data *pdata = pcdev->pdata; |
886 | u32 cicr4 = 0; | 884 | u32 cicr4 = 0; |
887 | 885 | ||
888 | dev_dbg(pcdev->dev, "Registered platform device at %p data %p\n", | 886 | dev_dbg(pcdev->soc_host.dev, "Registered platform device at %p data %p\n", |
889 | pcdev, pdata); | 887 | pcdev, pdata); |
890 | 888 | ||
891 | if (pdata && pdata->init) { | 889 | if (pdata && pdata->init) { |
892 | dev_dbg(pcdev->dev, "%s: Init gpios\n", __func__); | 890 | dev_dbg(pcdev->soc_host.dev, "%s: Init gpios\n", __func__); |
893 | pdata->init(pcdev->dev); | 891 | pdata->init(pcdev->soc_host.dev); |
894 | } | 892 | } |
895 | 893 | ||
896 | /* disable all interrupts */ | 894 | /* disable all interrupts */ |
@@ -932,7 +930,7 @@ static irqreturn_t pxa_camera_irq(int irq, void *data) | |||
932 | struct videobuf_buffer *vb; | 930 | struct videobuf_buffer *vb; |
933 | 931 | ||
934 | status = __raw_readl(pcdev->base + CISR); | 932 | status = __raw_readl(pcdev->base + CISR); |
935 | dev_dbg(pcdev->dev, "Camera interrupt status 0x%lx\n", status); | 933 | dev_dbg(pcdev->soc_host.dev, "Camera interrupt status 0x%lx\n", status); |
936 | 934 | ||
937 | if (!status) | 935 | if (!status) |
938 | return IRQ_NONE; | 936 | return IRQ_NONE; |
@@ -1260,7 +1258,7 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, int idx, | |||
1260 | xlate->cam_fmt = icd->formats + idx; | 1258 | xlate->cam_fmt = icd->formats + idx; |
1261 | xlate->buswidth = buswidth; | 1259 | xlate->buswidth = buswidth; |
1262 | xlate++; | 1260 | xlate++; |
1263 | dev_dbg(&ici->dev, "Providing format %s using %s\n", | 1261 | dev_dbg(ici->dev, "Providing format %s using %s\n", |
1264 | pxa_camera_formats[0].name, | 1262 | pxa_camera_formats[0].name, |
1265 | icd->formats[idx].name); | 1263 | icd->formats[idx].name); |
1266 | } | 1264 | } |
@@ -1275,7 +1273,7 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, int idx, | |||
1275 | xlate->cam_fmt = icd->formats + idx; | 1273 | xlate->cam_fmt = icd->formats + idx; |
1276 | xlate->buswidth = buswidth; | 1274 | xlate->buswidth = buswidth; |
1277 | xlate++; | 1275 | xlate++; |
1278 | dev_dbg(&ici->dev, "Providing format %s packed\n", | 1276 | dev_dbg(ici->dev, "Providing format %s packed\n", |
1279 | icd->formats[idx].name); | 1277 | icd->formats[idx].name); |
1280 | } | 1278 | } |
1281 | break; | 1279 | break; |
@@ -1287,7 +1285,7 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, int idx, | |||
1287 | xlate->cam_fmt = icd->formats + idx; | 1285 | xlate->cam_fmt = icd->formats + idx; |
1288 | xlate->buswidth = icd->formats[idx].depth; | 1286 | xlate->buswidth = icd->formats[idx].depth; |
1289 | xlate++; | 1287 | xlate++; |
1290 | dev_dbg(&ici->dev, | 1288 | dev_dbg(ici->dev, |
1291 | "Providing format %s in pass-through mode\n", | 1289 | "Providing format %s in pass-through mode\n", |
1292 | icd->formats[idx].name); | 1290 | icd->formats[idx].name); |
1293 | } | 1291 | } |
@@ -1316,11 +1314,11 @@ static int pxa_camera_set_crop(struct soc_camera_device *icd, | |||
1316 | icd->sense = NULL; | 1314 | icd->sense = NULL; |
1317 | 1315 | ||
1318 | if (ret < 0) { | 1316 | if (ret < 0) { |
1319 | dev_warn(&ici->dev, "Failed to crop to %ux%u@%u:%u\n", | 1317 | dev_warn(ici->dev, "Failed to crop to %ux%u@%u:%u\n", |
1320 | rect->width, rect->height, rect->left, rect->top); | 1318 | rect->width, rect->height, rect->left, rect->top); |
1321 | } else if (sense.flags & SOCAM_SENSE_PCLK_CHANGED) { | 1319 | } else if (sense.flags & SOCAM_SENSE_PCLK_CHANGED) { |
1322 | if (sense.pixel_clock > sense.pixel_clock_max) { | 1320 | if (sense.pixel_clock > sense.pixel_clock_max) { |
1323 | dev_err(&ici->dev, | 1321 | dev_err(ici->dev, |
1324 | "pixel clock %lu set by the camera too high!", | 1322 | "pixel clock %lu set by the camera too high!", |
1325 | sense.pixel_clock); | 1323 | sense.pixel_clock); |
1326 | return -EIO; | 1324 | return -EIO; |
@@ -1348,7 +1346,7 @@ static int pxa_camera_set_fmt(struct soc_camera_device *icd, | |||
1348 | 1346 | ||
1349 | xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); | 1347 | xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); |
1350 | if (!xlate) { | 1348 | if (!xlate) { |
1351 | dev_warn(&ici->dev, "Format %x not found\n", pix->pixelformat); | 1349 | dev_warn(ici->dev, "Format %x not found\n", pix->pixelformat); |
1352 | return -EINVAL; | 1350 | return -EINVAL; |
1353 | } | 1351 | } |
1354 | 1352 | ||
@@ -1364,11 +1362,11 @@ static int pxa_camera_set_fmt(struct soc_camera_device *icd, | |||
1364 | icd->sense = NULL; | 1362 | icd->sense = NULL; |
1365 | 1363 | ||
1366 | if (ret < 0) { | 1364 | if (ret < 0) { |
1367 | dev_warn(&ici->dev, "Failed to configure for format %x\n", | 1365 | dev_warn(ici->dev, "Failed to configure for format %x\n", |
1368 | pix->pixelformat); | 1366 | pix->pixelformat); |
1369 | } else if (sense.flags & SOCAM_SENSE_PCLK_CHANGED) { | 1367 | } else if (sense.flags & SOCAM_SENSE_PCLK_CHANGED) { |
1370 | if (sense.pixel_clock > sense.pixel_clock_max) { | 1368 | if (sense.pixel_clock > sense.pixel_clock_max) { |
1371 | dev_err(&ici->dev, | 1369 | dev_err(ici->dev, |
1372 | "pixel clock %lu set by the camera too high!", | 1370 | "pixel clock %lu set by the camera too high!", |
1373 | sense.pixel_clock); | 1371 | sense.pixel_clock); |
1374 | return -EIO; | 1372 | return -EIO; |
@@ -1396,7 +1394,7 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd, | |||
1396 | 1394 | ||
1397 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); | 1395 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); |
1398 | if (!xlate) { | 1396 | if (!xlate) { |
1399 | dev_warn(&ici->dev, "Format %x not found\n", pixfmt); | 1397 | dev_warn(ici->dev, "Format %x not found\n", pixfmt); |
1400 | return -EINVAL; | 1398 | return -EINVAL; |
1401 | } | 1399 | } |
1402 | 1400 | ||
@@ -1581,7 +1579,6 @@ static int pxa_camera_probe(struct platform_device *pdev) | |||
1581 | goto exit_kfree; | 1579 | goto exit_kfree; |
1582 | } | 1580 | } |
1583 | 1581 | ||
1584 | platform_set_drvdata(pdev, pcdev); | ||
1585 | pcdev->res = res; | 1582 | pcdev->res = res; |
1586 | 1583 | ||
1587 | pcdev->pdata = pdev->dev.platform_data; | 1584 | pcdev->pdata = pdev->dev.platform_data; |
@@ -1602,7 +1599,6 @@ static int pxa_camera_probe(struct platform_device *pdev) | |||
1602 | pcdev->mclk = 20000000; | 1599 | pcdev->mclk = 20000000; |
1603 | } | 1600 | } |
1604 | 1601 | ||
1605 | pcdev->dev = &pdev->dev; | ||
1606 | pcdev->mclk_divisor = mclk_get_divisor(pcdev); | 1602 | pcdev->mclk_divisor = mclk_get_divisor(pcdev); |
1607 | 1603 | ||
1608 | INIT_LIST_HEAD(&pcdev->capture); | 1604 | INIT_LIST_HEAD(&pcdev->capture); |
@@ -1629,29 +1625,29 @@ static int pxa_camera_probe(struct platform_device *pdev) | |||
1629 | err = pxa_request_dma("CI_Y", DMA_PRIO_HIGH, | 1625 | err = pxa_request_dma("CI_Y", DMA_PRIO_HIGH, |
1630 | pxa_camera_dma_irq_y, pcdev); | 1626 | pxa_camera_dma_irq_y, pcdev); |
1631 | if (err < 0) { | 1627 | if (err < 0) { |
1632 | dev_err(pcdev->dev, "Can't request DMA for Y\n"); | 1628 | dev_err(&pdev->dev, "Can't request DMA for Y\n"); |
1633 | goto exit_iounmap; | 1629 | goto exit_iounmap; |
1634 | } | 1630 | } |
1635 | pcdev->dma_chans[0] = err; | 1631 | pcdev->dma_chans[0] = err; |
1636 | dev_dbg(pcdev->dev, "got DMA channel %d\n", pcdev->dma_chans[0]); | 1632 | dev_dbg(&pdev->dev, "got DMA channel %d\n", pcdev->dma_chans[0]); |
1637 | 1633 | ||
1638 | err = pxa_request_dma("CI_U", DMA_PRIO_HIGH, | 1634 | err = pxa_request_dma("CI_U", DMA_PRIO_HIGH, |
1639 | pxa_camera_dma_irq_u, pcdev); | 1635 | pxa_camera_dma_irq_u, pcdev); |
1640 | if (err < 0) { | 1636 | if (err < 0) { |
1641 | dev_err(pcdev->dev, "Can't request DMA for U\n"); | 1637 | dev_err(&pdev->dev, "Can't request DMA for U\n"); |
1642 | goto exit_free_dma_y; | 1638 | goto exit_free_dma_y; |
1643 | } | 1639 | } |
1644 | pcdev->dma_chans[1] = err; | 1640 | pcdev->dma_chans[1] = err; |
1645 | dev_dbg(pcdev->dev, "got DMA channel (U) %d\n", pcdev->dma_chans[1]); | 1641 | dev_dbg(&pdev->dev, "got DMA channel (U) %d\n", pcdev->dma_chans[1]); |
1646 | 1642 | ||
1647 | err = pxa_request_dma("CI_V", DMA_PRIO_HIGH, | 1643 | err = pxa_request_dma("CI_V", DMA_PRIO_HIGH, |
1648 | pxa_camera_dma_irq_v, pcdev); | 1644 | pxa_camera_dma_irq_v, pcdev); |
1649 | if (err < 0) { | 1645 | if (err < 0) { |
1650 | dev_err(pcdev->dev, "Can't request DMA for V\n"); | 1646 | dev_err(&pdev->dev, "Can't request DMA for V\n"); |
1651 | goto exit_free_dma_u; | 1647 | goto exit_free_dma_u; |
1652 | } | 1648 | } |
1653 | pcdev->dma_chans[2] = err; | 1649 | pcdev->dma_chans[2] = err; |
1654 | dev_dbg(pcdev->dev, "got DMA channel (V) %d\n", pcdev->dma_chans[2]); | 1650 | dev_dbg(&pdev->dev, "got DMA channel (V) %d\n", pcdev->dma_chans[2]); |
1655 | 1651 | ||
1656 | DRCMR(68) = pcdev->dma_chans[0] | DRCMR_MAPVLD; | 1652 | DRCMR(68) = pcdev->dma_chans[0] | DRCMR_MAPVLD; |
1657 | DRCMR(69) = pcdev->dma_chans[1] | DRCMR_MAPVLD; | 1653 | DRCMR(69) = pcdev->dma_chans[1] | DRCMR_MAPVLD; |
@@ -1661,15 +1657,16 @@ static int pxa_camera_probe(struct platform_device *pdev) | |||
1661 | err = request_irq(pcdev->irq, pxa_camera_irq, 0, PXA_CAM_DRV_NAME, | 1657 | err = request_irq(pcdev->irq, pxa_camera_irq, 0, PXA_CAM_DRV_NAME, |
1662 | pcdev); | 1658 | pcdev); |
1663 | if (err) { | 1659 | if (err) { |
1664 | dev_err(pcdev->dev, "Camera interrupt register failed \n"); | 1660 | dev_err(&pdev->dev, "Camera interrupt register failed \n"); |
1665 | goto exit_free_dma; | 1661 | goto exit_free_dma; |
1666 | } | 1662 | } |
1667 | 1663 | ||
1668 | pcdev->soc_host.drv_name = PXA_CAM_DRV_NAME; | 1664 | pcdev->soc_host.drv_name = PXA_CAM_DRV_NAME; |
1669 | pcdev->soc_host.ops = &pxa_soc_camera_host_ops; | 1665 | pcdev->soc_host.ops = &pxa_soc_camera_host_ops; |
1670 | pcdev->soc_host.priv = pcdev; | 1666 | pcdev->soc_host.priv = pcdev; |
1671 | pcdev->soc_host.dev.parent = &pdev->dev; | 1667 | pcdev->soc_host.dev = &pdev->dev; |
1672 | pcdev->soc_host.nr = pdev->id; | 1668 | pcdev->soc_host.nr = pdev->id; |
1669 | |||
1673 | err = soc_camera_host_register(&pcdev->soc_host); | 1670 | err = soc_camera_host_register(&pcdev->soc_host); |
1674 | if (err) | 1671 | if (err) |
1675 | goto exit_free_irq; | 1672 | goto exit_free_irq; |
@@ -1698,7 +1695,9 @@ exit: | |||
1698 | 1695 | ||
1699 | static int __devexit pxa_camera_remove(struct platform_device *pdev) | 1696 | static int __devexit pxa_camera_remove(struct platform_device *pdev) |
1700 | { | 1697 | { |
1701 | struct pxa_camera_dev *pcdev = platform_get_drvdata(pdev); | 1698 | struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev); |
1699 | struct pxa_camera_dev *pcdev = container_of(soc_host, | ||
1700 | struct pxa_camera_dev, soc_host); | ||
1702 | struct resource *res; | 1701 | struct resource *res; |
1703 | 1702 | ||
1704 | clk_put(pcdev->clk); | 1703 | clk_put(pcdev->clk); |
@@ -1708,7 +1707,7 @@ static int __devexit pxa_camera_remove(struct platform_device *pdev) | |||
1708 | pxa_free_dma(pcdev->dma_chans[2]); | 1707 | pxa_free_dma(pcdev->dma_chans[2]); |
1709 | free_irq(pcdev->irq, pcdev); | 1708 | free_irq(pcdev->irq, pcdev); |
1710 | 1709 | ||
1711 | soc_camera_host_unregister(&pcdev->soc_host); | 1710 | soc_camera_host_unregister(soc_host); |
1712 | 1711 | ||
1713 | iounmap(pcdev->base); | 1712 | iounmap(pcdev->base); |
1714 | 1713 | ||
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c index 8e4a8fca976c..d369e8409ab8 100644 --- a/drivers/media/video/sh_mobile_ceu_camera.c +++ b/drivers/media/video/sh_mobile_ceu_camera.c | |||
@@ -81,7 +81,6 @@ struct sh_mobile_ceu_buffer { | |||
81 | }; | 81 | }; |
82 | 82 | ||
83 | struct sh_mobile_ceu_dev { | 83 | struct sh_mobile_ceu_dev { |
84 | struct device *dev; | ||
85 | struct soc_camera_host ici; | 84 | struct soc_camera_host ici; |
86 | struct soc_camera_device *icd; | 85 | struct soc_camera_device *icd; |
87 | 86 | ||
@@ -617,7 +616,7 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, int idx, | |||
617 | xlate->cam_fmt = icd->formats + idx; | 616 | xlate->cam_fmt = icd->formats + idx; |
618 | xlate->buswidth = icd->formats[idx].depth; | 617 | xlate->buswidth = icd->formats[idx].depth; |
619 | xlate++; | 618 | xlate++; |
620 | dev_dbg(&ici->dev, "Providing format %s using %s\n", | 619 | dev_dbg(ici->dev, "Providing format %s using %s\n", |
621 | sh_mobile_ceu_formats[k].name, | 620 | sh_mobile_ceu_formats[k].name, |
622 | icd->formats[idx].name); | 621 | icd->formats[idx].name); |
623 | } | 622 | } |
@@ -630,7 +629,7 @@ add_single_format: | |||
630 | xlate->cam_fmt = icd->formats + idx; | 629 | xlate->cam_fmt = icd->formats + idx; |
631 | xlate->buswidth = icd->formats[idx].depth; | 630 | xlate->buswidth = icd->formats[idx].depth; |
632 | xlate++; | 631 | xlate++; |
633 | dev_dbg(&ici->dev, | 632 | dev_dbg(ici->dev, |
634 | "Providing format %s in pass-through mode\n", | 633 | "Providing format %s in pass-through mode\n", |
635 | icd->formats[idx].name); | 634 | icd->formats[idx].name); |
636 | } | 635 | } |
@@ -657,7 +656,7 @@ static int sh_mobile_ceu_set_fmt(struct soc_camera_device *icd, | |||
657 | 656 | ||
658 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); | 657 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); |
659 | if (!xlate) { | 658 | if (!xlate) { |
660 | dev_warn(&ici->dev, "Format %x not found\n", pixfmt); | 659 | dev_warn(ici->dev, "Format %x not found\n", pixfmt); |
661 | return -EINVAL; | 660 | return -EINVAL; |
662 | } | 661 | } |
663 | 662 | ||
@@ -684,7 +683,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, | |||
684 | 683 | ||
685 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); | 684 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); |
686 | if (!xlate) { | 685 | if (!xlate) { |
687 | dev_warn(&ici->dev, "Format %x not found\n", pixfmt); | 686 | dev_warn(ici->dev, "Format %x not found\n", pixfmt); |
688 | return -EINVAL; | 687 | return -EINVAL; |
689 | } | 688 | } |
690 | 689 | ||
@@ -782,7 +781,7 @@ static void sh_mobile_ceu_init_videobuf(struct videobuf_queue *q, | |||
782 | 781 | ||
783 | videobuf_queue_dma_contig_init(q, | 782 | videobuf_queue_dma_contig_init(q, |
784 | &sh_mobile_ceu_videobuf_ops, | 783 | &sh_mobile_ceu_videobuf_ops, |
785 | &ici->dev, &pcdev->lock, | 784 | ici->dev, &pcdev->lock, |
786 | V4L2_BUF_TYPE_VIDEO_CAPTURE, | 785 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
787 | pcdev->is_interlaced ? | 786 | pcdev->is_interlaced ? |
788 | V4L2_FIELD_INTERLACED : V4L2_FIELD_NONE, | 787 | V4L2_FIELD_INTERLACED : V4L2_FIELD_NONE, |
@@ -829,7 +828,6 @@ static int sh_mobile_ceu_probe(struct platform_device *pdev) | |||
829 | goto exit; | 828 | goto exit; |
830 | } | 829 | } |
831 | 830 | ||
832 | platform_set_drvdata(pdev, pcdev); | ||
833 | INIT_LIST_HEAD(&pcdev->capture); | 831 | INIT_LIST_HEAD(&pcdev->capture); |
834 | spin_lock_init(&pcdev->lock); | 832 | spin_lock_init(&pcdev->lock); |
835 | 833 | ||
@@ -850,7 +848,6 @@ static int sh_mobile_ceu_probe(struct platform_device *pdev) | |||
850 | pcdev->irq = irq; | 848 | pcdev->irq = irq; |
851 | pcdev->base = base; | 849 | pcdev->base = base; |
852 | pcdev->video_limit = 0; /* only enabled if second resource exists */ | 850 | pcdev->video_limit = 0; /* only enabled if second resource exists */ |
853 | pcdev->dev = &pdev->dev; | ||
854 | 851 | ||
855 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 852 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
856 | if (res) { | 853 | if (res) { |
@@ -885,7 +882,7 @@ static int sh_mobile_ceu_probe(struct platform_device *pdev) | |||
885 | } | 882 | } |
886 | 883 | ||
887 | pcdev->ici.priv = pcdev; | 884 | pcdev->ici.priv = pcdev; |
888 | pcdev->ici.dev.parent = &pdev->dev; | 885 | pcdev->ici.dev = &pdev->dev; |
889 | pcdev->ici.nr = pdev->id; | 886 | pcdev->ici.nr = pdev->id; |
890 | pcdev->ici.drv_name = dev_name(&pdev->dev); | 887 | pcdev->ici.drv_name = dev_name(&pdev->dev); |
891 | pcdev->ici.ops = &sh_mobile_ceu_host_ops; | 888 | pcdev->ici.ops = &sh_mobile_ceu_host_ops; |
@@ -913,9 +910,11 @@ exit: | |||
913 | 910 | ||
914 | static int sh_mobile_ceu_remove(struct platform_device *pdev) | 911 | static int sh_mobile_ceu_remove(struct platform_device *pdev) |
915 | { | 912 | { |
916 | struct sh_mobile_ceu_dev *pcdev = platform_get_drvdata(pdev); | 913 | struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev); |
914 | struct sh_mobile_ceu_dev *pcdev = container_of(soc_host, | ||
915 | struct sh_mobile_ceu_dev, ici); | ||
917 | 916 | ||
918 | soc_camera_host_unregister(&pcdev->ici); | 917 | soc_camera_host_unregister(soc_host); |
919 | clk_put(pcdev->clk); | 918 | clk_put(pcdev->clk); |
920 | free_irq(pcdev->irq, pcdev); | 919 | free_irq(pcdev->irq, pcdev); |
921 | if (platform_get_resource(pdev, IORESOURCE_MEM, 1)) | 920 | if (platform_get_resource(pdev, IORESOURCE_MEM, 1)) |
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index 0e890cc23377..2d341f537d54 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c | |||
@@ -279,7 +279,7 @@ static int soc_camera_set_fmt(struct soc_camera_file *icf, | |||
279 | return ret; | 279 | return ret; |
280 | } else if (!icd->current_fmt || | 280 | } else if (!icd->current_fmt || |
281 | icd->current_fmt->fourcc != pix->pixelformat) { | 281 | icd->current_fmt->fourcc != pix->pixelformat) { |
282 | dev_err(&ici->dev, | 282 | dev_err(ici->dev, |
283 | "Host driver hasn't set up current format correctly!\n"); | 283 | "Host driver hasn't set up current format correctly!\n"); |
284 | return -EINVAL; | 284 | return -EINVAL; |
285 | } | 285 | } |
@@ -794,7 +794,7 @@ static void scan_add_host(struct soc_camera_host *ici) | |||
794 | 794 | ||
795 | list_for_each_entry(icd, &devices, list) { | 795 | list_for_each_entry(icd, &devices, list) { |
796 | if (icd->iface == ici->nr) { | 796 | if (icd->iface == ici->nr) { |
797 | icd->dev.parent = &ici->dev; | 797 | icd->dev.parent = ici->dev; |
798 | device_register_link(icd); | 798 | device_register_link(icd); |
799 | } | 799 | } |
800 | } | 800 | } |
@@ -818,7 +818,7 @@ static int scan_add_device(struct soc_camera_device *icd) | |||
818 | list_for_each_entry(ici, &hosts, list) { | 818 | list_for_each_entry(ici, &hosts, list) { |
819 | if (icd->iface == ici->nr) { | 819 | if (icd->iface == ici->nr) { |
820 | ret = 1; | 820 | ret = 1; |
821 | icd->dev.parent = &ici->dev; | 821 | icd->dev.parent = ici->dev; |
822 | break; | 822 | break; |
823 | } | 823 | } |
824 | } | 824 | } |
@@ -952,7 +952,6 @@ static void dummy_release(struct device *dev) | |||
952 | 952 | ||
953 | int soc_camera_host_register(struct soc_camera_host *ici) | 953 | int soc_camera_host_register(struct soc_camera_host *ici) |
954 | { | 954 | { |
955 | int ret; | ||
956 | struct soc_camera_host *ix; | 955 | struct soc_camera_host *ix; |
957 | 956 | ||
958 | if (!ici || !ici->ops || | 957 | if (!ici || !ici->ops || |
@@ -965,12 +964,10 @@ int soc_camera_host_register(struct soc_camera_host *ici) | |||
965 | !ici->ops->reqbufs || | 964 | !ici->ops->reqbufs || |
966 | !ici->ops->add || | 965 | !ici->ops->add || |
967 | !ici->ops->remove || | 966 | !ici->ops->remove || |
968 | !ici->ops->poll) | 967 | !ici->ops->poll || |
968 | !ici->dev) | ||
969 | return -EINVAL; | 969 | return -EINVAL; |
970 | 970 | ||
971 | /* Number might be equal to the platform device ID */ | ||
972 | dev_set_name(&ici->dev, "camera_host%d", ici->nr); | ||
973 | |||
974 | mutex_lock(&list_lock); | 971 | mutex_lock(&list_lock); |
975 | list_for_each_entry(ix, &hosts, list) { | 972 | list_for_each_entry(ix, &hosts, list) { |
976 | if (ix->nr == ici->nr) { | 973 | if (ix->nr == ici->nr) { |
@@ -979,26 +976,14 @@ int soc_camera_host_register(struct soc_camera_host *ici) | |||
979 | } | 976 | } |
980 | } | 977 | } |
981 | 978 | ||
979 | dev_set_drvdata(ici->dev, ici); | ||
980 | |||
982 | list_add_tail(&ici->list, &hosts); | 981 | list_add_tail(&ici->list, &hosts); |
983 | mutex_unlock(&list_lock); | 982 | mutex_unlock(&list_lock); |
984 | 983 | ||
985 | ici->dev.release = dummy_release; | ||
986 | |||
987 | ret = device_register(&ici->dev); | ||
988 | |||
989 | if (ret) | ||
990 | goto edevr; | ||
991 | |||
992 | scan_add_host(ici); | 984 | scan_add_host(ici); |
993 | 985 | ||
994 | return 0; | 986 | return 0; |
995 | |||
996 | edevr: | ||
997 | mutex_lock(&list_lock); | ||
998 | list_del(&ici->list); | ||
999 | mutex_unlock(&list_lock); | ||
1000 | |||
1001 | return ret; | ||
1002 | } | 987 | } |
1003 | EXPORT_SYMBOL(soc_camera_host_register); | 988 | EXPORT_SYMBOL(soc_camera_host_register); |
1004 | 989 | ||
@@ -1012,7 +997,7 @@ void soc_camera_host_unregister(struct soc_camera_host *ici) | |||
1012 | list_del(&ici->list); | 997 | list_del(&ici->list); |
1013 | 998 | ||
1014 | list_for_each_entry(icd, &devices, list) { | 999 | list_for_each_entry(icd, &devices, list) { |
1015 | if (icd->dev.parent == &ici->dev) { | 1000 | if (icd->dev.parent == ici->dev) { |
1016 | device_unregister(&icd->dev); | 1001 | device_unregister(&icd->dev); |
1017 | /* Not before device_unregister(), .remove | 1002 | /* Not before device_unregister(), .remove |
1018 | * needs parent to call ici->ops->remove() */ | 1003 | * needs parent to call ici->ops->remove() */ |
@@ -1023,7 +1008,7 @@ void soc_camera_host_unregister(struct soc_camera_host *ici) | |||
1023 | 1008 | ||
1024 | mutex_unlock(&list_lock); | 1009 | mutex_unlock(&list_lock); |
1025 | 1010 | ||
1026 | device_unregister(&ici->dev); | 1011 | dev_set_drvdata(ici->dev, NULL); |
1027 | } | 1012 | } |
1028 | EXPORT_SYMBOL(soc_camera_host_unregister); | 1013 | EXPORT_SYMBOL(soc_camera_host_unregister); |
1029 | 1014 | ||
@@ -1130,7 +1115,7 @@ int soc_camera_video_start(struct soc_camera_device *icd) | |||
1130 | vdev = video_device_alloc(); | 1115 | vdev = video_device_alloc(); |
1131 | if (!vdev) | 1116 | if (!vdev) |
1132 | goto evidallocd; | 1117 | goto evidallocd; |
1133 | dev_dbg(&ici->dev, "Allocated video_device %p\n", vdev); | 1118 | dev_dbg(ici->dev, "Allocated video_device %p\n", vdev); |
1134 | 1119 | ||
1135 | strlcpy(vdev->name, ici->drv_name, sizeof(vdev->name)); | 1120 | strlcpy(vdev->name, ici->drv_name, sizeof(vdev->name)); |
1136 | 1121 | ||