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/media/video/mx3_camera.c | |
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/media/video/mx3_camera.c')
-rw-r--r-- | drivers/media/video/mx3_camera.c | 40 |
1 files changed, 20 insertions, 20 deletions
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 | ||