diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2009-08-25 10:47:00 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-09-18 23:19:15 -0400 |
commit | 0166b74374cae3fa8bff0caef726a3d960a9a50a (patch) | |
tree | b09ce8c3211f86dd3ff79baae5648c10711697ea /drivers/media/video/mx3_camera.c | |
parent | 2aa58db47f5c70635ea278f6a5ff9e1e920bfe6a (diff) |
V4L/DVB (12533): soc-camera: Use video device object for output in host drivers
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/mx3_camera.c')
-rw-r--r-- | drivers/media/video/mx3_camera.c | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c index f7888f30da51..d5b51e9900bb 100644 --- a/drivers/media/video/mx3_camera.c +++ b/drivers/media/video/mx3_camera.c | |||
@@ -178,7 +178,7 @@ static void free_buffer(struct videobuf_queue *vq, struct mx3_camera_buffer *buf | |||
178 | 178 | ||
179 | BUG_ON(in_interrupt()); | 179 | BUG_ON(in_interrupt()); |
180 | 180 | ||
181 | dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, | 181 | dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, |
182 | vb, vb->baddr, vb->bsize); | 182 | vb, vb->baddr, vb->bsize); |
183 | 183 | ||
184 | /* | 184 | /* |
@@ -375,7 +375,8 @@ static void mx3_videobuf_queue(struct videobuf_queue *vq, | |||
375 | spin_unlock_irq(&mx3_cam->lock); | 375 | spin_unlock_irq(&mx3_cam->lock); |
376 | 376 | ||
377 | cookie = txd->tx_submit(txd); | 377 | cookie = txd->tx_submit(txd); |
378 | dev_dbg(&icd->dev, "Submitted cookie %d DMA 0x%08x\n", cookie, sg_dma_address(&buf->sg)); | 378 | dev_dbg(icd->dev.parent, "Submitted cookie %d DMA 0x%08x\n", |
379 | cookie, sg_dma_address(&buf->sg)); | ||
379 | 380 | ||
380 | spin_lock_irq(&mx3_cam->lock); | 381 | spin_lock_irq(&mx3_cam->lock); |
381 | 382 | ||
@@ -402,9 +403,10 @@ static void mx3_videobuf_release(struct videobuf_queue *vq, | |||
402 | container_of(vb, struct mx3_camera_buffer, vb); | 403 | container_of(vb, struct mx3_camera_buffer, vb); |
403 | unsigned long flags; | 404 | unsigned long flags; |
404 | 405 | ||
405 | dev_dbg(&icd->dev, "Release%s DMA 0x%08x (state %d), queue %sempty\n", | 406 | dev_dbg(icd->dev.parent, |
407 | "Release%s DMA 0x%08x (state %d), queue %sempty\n", | ||
406 | mx3_cam->active == buf ? " active" : "", sg_dma_address(&buf->sg), | 408 | mx3_cam->active == buf ? " active" : "", sg_dma_address(&buf->sg), |
407 | vb->state, list_empty(&vb->queue) ? "" : "not "); | 409 | vb->state, list_empty(&vb->queue) ? "" : "not "); |
408 | spin_lock_irqsave(&mx3_cam->lock, flags); | 410 | spin_lock_irqsave(&mx3_cam->lock, flags); |
409 | if ((vb->state == VIDEOBUF_ACTIVE || vb->state == VIDEOBUF_QUEUED) && | 411 | if ((vb->state == VIDEOBUF_ACTIVE || vb->state == VIDEOBUF_QUEUED) && |
410 | !list_empty(&vb->queue)) { | 412 | !list_empty(&vb->queue)) { |
@@ -484,7 +486,7 @@ static void mx3_camera_activate(struct mx3_camera_dev *mx3_cam, | |||
484 | 486 | ||
485 | clk_enable(mx3_cam->clk); | 487 | clk_enable(mx3_cam->clk); |
486 | rate = clk_round_rate(mx3_cam->clk, mx3_cam->mclk); | 488 | rate = clk_round_rate(mx3_cam->clk, mx3_cam->mclk); |
487 | dev_dbg(&icd->dev, "Set SENS_CONF to %x, rate %ld\n", conf, rate); | 489 | dev_dbg(icd->dev.parent, "Set SENS_CONF to %x, rate %ld\n", conf, rate); |
488 | if (rate) | 490 | if (rate) |
489 | clk_set_rate(mx3_cam->clk, rate); | 491 | clk_set_rate(mx3_cam->clk, rate); |
490 | } | 492 | } |
@@ -502,7 +504,7 @@ static int mx3_camera_add_device(struct soc_camera_device *icd) | |||
502 | 504 | ||
503 | mx3_cam->icd = icd; | 505 | mx3_cam->icd = icd; |
504 | 506 | ||
505 | dev_info(&icd->dev, "MX3 Camera driver attached to camera %d\n", | 507 | dev_info(icd->dev.parent, "MX3 Camera driver attached to camera %d\n", |
506 | icd->devnum); | 508 | icd->devnum); |
507 | 509 | ||
508 | return 0; | 510 | return 0; |
@@ -526,7 +528,7 @@ static void mx3_camera_remove_device(struct soc_camera_device *icd) | |||
526 | 528 | ||
527 | mx3_cam->icd = NULL; | 529 | mx3_cam->icd = NULL; |
528 | 530 | ||
529 | dev_info(&icd->dev, "MX3 Camera driver detached from camera %d\n", | 531 | dev_info(icd->dev.parent, "MX3 Camera driver detached from camera %d\n", |
530 | icd->devnum); | 532 | icd->devnum); |
531 | } | 533 | } |
532 | 534 | ||
@@ -603,7 +605,8 @@ static int mx3_camera_try_bus_param(struct soc_camera_device *icd, | |||
603 | unsigned long bus_flags, camera_flags; | 605 | unsigned long bus_flags, camera_flags; |
604 | int ret = test_platform_param(mx3_cam, depth, &bus_flags); | 606 | int ret = test_platform_param(mx3_cam, depth, &bus_flags); |
605 | 607 | ||
606 | dev_dbg(icd->dev.parent, "requested bus width %d bit: %d\n", depth, ret); | 608 | dev_dbg(icd->dev.parent, "requested bus width %d bit: %d\n", |
609 | depth, ret); | ||
607 | 610 | ||
608 | if (ret < 0) | 611 | if (ret < 0) |
609 | return ret; | 612 | return ret; |
@@ -612,7 +615,8 @@ static int mx3_camera_try_bus_param(struct soc_camera_device *icd, | |||
612 | 615 | ||
613 | ret = soc_camera_bus_param_compatible(camera_flags, bus_flags); | 616 | ret = soc_camera_bus_param_compatible(camera_flags, bus_flags); |
614 | if (ret < 0) | 617 | if (ret < 0) |
615 | dev_warn(&icd->dev, "Flags incompatible: camera %lx, host %lx\n", | 618 | dev_warn(icd->dev.parent, |
619 | "Flags incompatible: camera %lx, host %lx\n", | ||
616 | camera_flags, bus_flags); | 620 | camera_flags, bus_flags); |
617 | 621 | ||
618 | return ret; | 622 | return ret; |
@@ -686,7 +690,8 @@ static int mx3_camera_get_formats(struct soc_camera_device *icd, int idx, | |||
686 | xlate->cam_fmt = icd->formats + idx; | 690 | xlate->cam_fmt = icd->formats + idx; |
687 | xlate->buswidth = buswidth; | 691 | xlate->buswidth = buswidth; |
688 | xlate++; | 692 | xlate++; |
689 | dev_dbg(icd->dev.parent, "Providing format %s using %s\n", | 693 | dev_dbg(icd->dev.parent, |
694 | "Providing format %s using %s\n", | ||
690 | mx3_camera_formats[0].name, | 695 | mx3_camera_formats[0].name, |
691 | icd->formats[idx].name); | 696 | icd->formats[idx].name); |
692 | } | 697 | } |
@@ -698,7 +703,8 @@ static int mx3_camera_get_formats(struct soc_camera_device *icd, int idx, | |||
698 | xlate->cam_fmt = icd->formats + idx; | 703 | xlate->cam_fmt = icd->formats + idx; |
699 | xlate->buswidth = buswidth; | 704 | xlate->buswidth = buswidth; |
700 | xlate++; | 705 | xlate++; |
701 | dev_dbg(icd->dev.parent, "Providing format %s using %s\n", | 706 | dev_dbg(icd->dev.parent, |
707 | "Providing format %s using %s\n", | ||
702 | mx3_camera_formats[0].name, | 708 | mx3_camera_formats[0].name, |
703 | icd->formats[idx].name); | 709 | icd->formats[idx].name); |
704 | } | 710 | } |
@@ -821,7 +827,8 @@ static int mx3_camera_set_fmt(struct soc_camera_device *icd, | |||
821 | 827 | ||
822 | xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); | 828 | xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); |
823 | if (!xlate) { | 829 | if (!xlate) { |
824 | dev_warn(icd->dev.parent, "Format %x not found\n", pix->pixelformat); | 830 | dev_warn(icd->dev.parent, "Format %x not found\n", |
831 | pix->pixelformat); | ||
825 | return -EINVAL; | 832 | return -EINVAL; |
826 | } | 833 | } |
827 | 834 | ||
@@ -883,7 +890,7 @@ static int mx3_camera_try_fmt(struct soc_camera_device *icd, | |||
883 | if (field == V4L2_FIELD_ANY) { | 890 | if (field == V4L2_FIELD_ANY) { |
884 | pix->field = V4L2_FIELD_NONE; | 891 | pix->field = V4L2_FIELD_NONE; |
885 | } else if (field != V4L2_FIELD_NONE) { | 892 | } else if (field != V4L2_FIELD_NONE) { |
886 | dev_err(&icd->dev, "Field type %d unsupported.\n", field); | 893 | dev_err(icd->dev.parent, "Field type %d unsupported.\n", field); |
887 | return -EINVAL; | 894 | return -EINVAL; |
888 | } | 895 | } |
889 | 896 | ||
@@ -922,14 +929,15 @@ static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) | |||
922 | u32 dw, sens_conf; | 929 | u32 dw, sens_conf; |
923 | int ret = test_platform_param(mx3_cam, icd->buswidth, &bus_flags); | 930 | int ret = test_platform_param(mx3_cam, icd->buswidth, &bus_flags); |
924 | const struct soc_camera_format_xlate *xlate; | 931 | const struct soc_camera_format_xlate *xlate; |
932 | struct device *dev = icd->dev.parent; | ||
925 | 933 | ||
926 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); | 934 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); |
927 | if (!xlate) { | 935 | if (!xlate) { |
928 | dev_warn(icd->dev.parent, "Format %x not found\n", pixfmt); | 936 | dev_warn(dev, "Format %x not found\n", pixfmt); |
929 | return -EINVAL; | 937 | return -EINVAL; |
930 | } | 938 | } |
931 | 939 | ||
932 | dev_dbg(icd->dev.parent, "requested bus width %d bit: %d\n", | 940 | dev_dbg(dev, "requested bus width %d bit: %d\n", |
933 | icd->buswidth, ret); | 941 | icd->buswidth, ret); |
934 | 942 | ||
935 | if (ret < 0) | 943 | if (ret < 0) |
@@ -938,10 +946,10 @@ static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) | |||
938 | camera_flags = icd->ops->query_bus_param(icd); | 946 | camera_flags = icd->ops->query_bus_param(icd); |
939 | 947 | ||
940 | common_flags = soc_camera_bus_param_compatible(camera_flags, bus_flags); | 948 | common_flags = soc_camera_bus_param_compatible(camera_flags, bus_flags); |
941 | dev_dbg(icd->dev.parent, "Flags cam: 0x%lx host: 0x%lx common: 0x%lx\n", | 949 | dev_dbg(dev, "Flags cam: 0x%lx host: 0x%lx common: 0x%lx\n", |
942 | camera_flags, bus_flags, common_flags); | 950 | camera_flags, bus_flags, common_flags); |
943 | if (!common_flags) { | 951 | if (!common_flags) { |
944 | dev_dbg(icd->dev.parent, "no common flags"); | 952 | dev_dbg(dev, "no common flags"); |
945 | return -EINVAL; | 953 | return -EINVAL; |
946 | } | 954 | } |
947 | 955 | ||
@@ -995,7 +1003,7 @@ static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) | |||
995 | 1003 | ||
996 | ret = icd->ops->set_bus_param(icd, common_flags); | 1004 | ret = icd->ops->set_bus_param(icd, common_flags); |
997 | if (ret < 0) { | 1005 | if (ret < 0) { |
998 | dev_dbg(icd->dev.parent, "camera set_bus_param(%lx) returned %d\n", | 1006 | dev_dbg(dev, "camera set_bus_param(%lx) returned %d\n", |
999 | common_flags, ret); | 1007 | common_flags, ret); |
1000 | return ret; | 1008 | return ret; |
1001 | } | 1009 | } |
@@ -1050,7 +1058,7 @@ static int mx3_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt) | |||
1050 | 1058 | ||
1051 | csi_reg_write(mx3_cam, sens_conf | dw, CSI_SENS_CONF); | 1059 | csi_reg_write(mx3_cam, sens_conf | dw, CSI_SENS_CONF); |
1052 | 1060 | ||
1053 | dev_dbg(icd->dev.parent, "Set SENS_CONF to %x\n", sens_conf | dw); | 1061 | dev_dbg(dev, "Set SENS_CONF to %x\n", sens_conf | dw); |
1054 | 1062 | ||
1055 | return 0; | 1063 | return 0; |
1056 | } | 1064 | } |