aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/sh_mobile_ceu_camera.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-08-25 10:47:00 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-18 23:19:15 -0400
commit0166b74374cae3fa8bff0caef726a3d960a9a50a (patch)
treeb09ce8c3211f86dd3ff79baae5648c10711697ea /drivers/media/video/sh_mobile_ceu_camera.c
parent2aa58db47f5c70635ea278f6a5ff9e1e920bfe6a (diff)
V4L/DVB (12533): soc-camera: Use video device object for output in host drivers
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/sh_mobile_ceu_camera.c')
-rw-r--r--drivers/media/video/sh_mobile_ceu_camera.c61
1 files changed, 32 insertions, 29 deletions
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c
index 28c3affe8828..3457bababd36 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -167,7 +167,7 @@ static int sh_mobile_ceu_videobuf_setup(struct videobuf_queue *vq,
167 (*count)--; 167 (*count)--;
168 } 168 }
169 169
170 dev_dbg(&icd->dev, "count=%d, size=%d\n", *count, *size); 170 dev_dbg(icd->dev.parent, "count=%d, size=%d\n", *count, *size);
171 171
172 return 0; 172 return 0;
173} 173}
@@ -177,7 +177,7 @@ static void free_buffer(struct videobuf_queue *vq,
177{ 177{
178 struct soc_camera_device *icd = vq->priv_data; 178 struct soc_camera_device *icd = vq->priv_data;
179 179
180 dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %zd\n", __func__, 180 dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %zd\n", __func__,
181 &buf->vb, buf->vb.baddr, buf->vb.bsize); 181 &buf->vb, buf->vb.baddr, buf->vb.bsize);
182 182
183 if (in_interrupt()) 183 if (in_interrupt())
@@ -185,7 +185,7 @@ static void free_buffer(struct videobuf_queue *vq,
185 185
186 videobuf_waiton(&buf->vb, 0, 0); 186 videobuf_waiton(&buf->vb, 0, 0);
187 videobuf_dma_contig_free(vq, &buf->vb); 187 videobuf_dma_contig_free(vq, &buf->vb);
188 dev_dbg(&icd->dev, "%s freed\n", __func__); 188 dev_dbg(icd->dev.parent, "%s freed\n", __func__);
189 buf->vb.state = VIDEOBUF_NEEDS_INIT; 189 buf->vb.state = VIDEOBUF_NEEDS_INIT;
190} 190}
191 191
@@ -249,7 +249,7 @@ static int sh_mobile_ceu_videobuf_prepare(struct videobuf_queue *vq,
249 249
250 buf = container_of(vb, struct sh_mobile_ceu_buffer, vb); 250 buf = container_of(vb, struct sh_mobile_ceu_buffer, vb);
251 251
252 dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %zd\n", __func__, 252 dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %zd\n", __func__,
253 vb, vb->baddr, vb->bsize); 253 vb, vb->baddr, vb->bsize);
254 254
255 /* Added list head initialization on alloc */ 255 /* Added list head initialization on alloc */
@@ -302,7 +302,7 @@ static void sh_mobile_ceu_videobuf_queue(struct videobuf_queue *vq,
302 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); 302 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
303 struct sh_mobile_ceu_dev *pcdev = ici->priv; 303 struct sh_mobile_ceu_dev *pcdev = ici->priv;
304 304
305 dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %zd\n", __func__, 305 dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %zd\n", __func__,
306 vb, vb->baddr, vb->bsize); 306 vb, vb->baddr, vb->bsize);
307 307
308 vb->state = VIDEOBUF_QUEUED; 308 vb->state = VIDEOBUF_QUEUED;
@@ -391,7 +391,7 @@ static int sh_mobile_ceu_add_device(struct soc_camera_device *icd)
391 if (pcdev->icd) 391 if (pcdev->icd)
392 return -EBUSY; 392 return -EBUSY;
393 393
394 dev_info(&icd->dev, 394 dev_info(icd->dev.parent,
395 "SuperH Mobile CEU driver attached to camera %d\n", 395 "SuperH Mobile CEU driver attached to camera %d\n",
396 icd->devnum); 396 icd->devnum);
397 397
@@ -431,7 +431,7 @@ static void sh_mobile_ceu_remove_device(struct soc_camera_device *icd)
431 431
432 clk_disable(pcdev->clk); 432 clk_disable(pcdev->clk);
433 433
434 dev_info(&icd->dev, 434 dev_info(icd->dev.parent,
435 "SuperH Mobile CEU driver detached from camera %d\n", 435 "SuperH Mobile CEU driver detached from camera %d\n",
436 icd->devnum); 436 icd->devnum);
437 437
@@ -497,7 +497,7 @@ static void sh_mobile_ceu_set_rect(struct soc_camera_device *icd,
497 left = size_src(rect->left, hscale); 497 left = size_src(rect->left, hscale);
498 top = size_src(rect->top, vscale); 498 top = size_src(rect->top, vscale);
499 499
500 dev_dbg(&icd->dev, "Left %u * 0x%x = %u, top %u * 0x%x = %u\n", 500 dev_dbg(icd->dev.parent, "Left %u * 0x%x = %u, top %u * 0x%x = %u\n",
501 rect->left, hscale, left, rect->top, vscale, top); 501 rect->left, hscale, left, rect->top, vscale, top);
502 502
503 if (left > cam->camera_rect.left) { 503 if (left > cam->camera_rect.left) {
@@ -514,7 +514,7 @@ static void sh_mobile_ceu_set_rect(struct soc_camera_device *icd,
514 top = cam->camera_rect.top; 514 top = cam->camera_rect.top;
515 } 515 }
516 516
517 dev_dbg(&icd->dev, "New left %u, top %u, offsets %u:%u\n", 517 dev_dbg(icd->dev.parent, "New left %u, top %u, offsets %u:%u\n",
518 rect->left, rect->top, left_offset, top_offset); 518 rect->left, rect->top, left_offset, top_offset);
519 519
520 if (pcdev->image_mode) { 520 if (pcdev->image_mode) {
@@ -687,7 +687,7 @@ static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd,
687 ceu_write(pcdev, CDOCR, value); 687 ceu_write(pcdev, CDOCR, value);
688 ceu_write(pcdev, CFWCR, 0); /* keep "datafetch firewall" disabled */ 688 ceu_write(pcdev, CFWCR, 0); /* keep "datafetch firewall" disabled */
689 689
690 dev_dbg(&icd->dev, "S_FMT successful for %c%c%c%c %ux%u@%u:%u\n", 690 dev_dbg(icd->dev.parent, "S_FMT successful for %c%c%c%c %ux%u@%u:%u\n",
691 pixfmt & 0xff, (pixfmt >> 8) & 0xff, 691 pixfmt & 0xff, (pixfmt >> 8) & 0xff,
692 (pixfmt >> 16) & 0xff, (pixfmt >> 24) & 0xff, 692 (pixfmt >> 16) & 0xff, (pixfmt >> 24) & 0xff,
693 icd->rect_current.width, icd->rect_current.height, 693 icd->rect_current.width, icd->rect_current.height,
@@ -744,7 +744,6 @@ static const struct soc_camera_data_format sh_mobile_ceu_formats[] = {
744static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, int idx, 744static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, int idx,
745 struct soc_camera_format_xlate *xlate) 745 struct soc_camera_format_xlate *xlate)
746{ 746{
747 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
748 int ret, k, n; 747 int ret, k, n;
749 int formats = 0; 748 int formats = 0;
750 struct sh_mobile_ceu_cam *cam; 749 struct sh_mobile_ceu_cam *cam;
@@ -794,7 +793,8 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, int idx,
794 xlate->cam_fmt = icd->formats + idx; 793 xlate->cam_fmt = icd->formats + idx;
795 xlate->buswidth = icd->formats[idx].depth; 794 xlate->buswidth = icd->formats[idx].depth;
796 xlate++; 795 xlate++;
797 dev_dbg(ici->v4l2_dev.dev, "Providing format %s using %s\n", 796 dev_dbg(icd->dev.parent,
797 "Providing format %s using %s\n",
798 sh_mobile_ceu_formats[k].name, 798 sh_mobile_ceu_formats[k].name,
799 icd->formats[idx].name); 799 icd->formats[idx].name);
800 } 800 }
@@ -807,7 +807,7 @@ add_single_format:
807 xlate->cam_fmt = icd->formats + idx; 807 xlate->cam_fmt = icd->formats + idx;
808 xlate->buswidth = icd->formats[idx].depth; 808 xlate->buswidth = icd->formats[idx].depth;
809 xlate++; 809 xlate++;
810 dev_dbg(ici->v4l2_dev.dev, 810 dev_dbg(icd->dev.parent,
811 "Providing format %s in pass-through mode\n", 811 "Providing format %s in pass-through mode\n",
812 icd->formats[idx].name); 812 icd->formats[idx].name);
813 } 813 }
@@ -870,19 +870,21 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
870 target = *cam_rect; 870 target = *cam_rect;
871 871
872 capsr = capture_save_reset(pcdev); 872 capsr = capture_save_reset(pcdev);
873 dev_dbg(&icd->dev, "CAPSR 0x%x, CFLCR 0x%x\n", capsr, pcdev->cflcr); 873 dev_dbg(icd->dev.parent, "CAPSR 0x%x, CFLCR 0x%x\n",
874 capsr, pcdev->cflcr);
874 875
875 /* First attempt - see if the client can deliver a perfect result */ 876 /* First attempt - see if the client can deliver a perfect result */
876 ret = v4l2_subdev_call(sd, video, s_crop, &cam_crop); 877 ret = v4l2_subdev_call(sd, video, s_crop, &cam_crop);
877 if (!ret && !memcmp(&target, &cam_rect, sizeof(target))) { 878 if (!ret && !memcmp(&target, &cam_rect, sizeof(target))) {
878 dev_dbg(&icd->dev, "Camera S_CROP successful for %ux%u@%u:%u\n", 879 dev_dbg(icd->dev.parent,
880 "Camera S_CROP successful for %ux%u@%u:%u\n",
879 cam_rect->width, cam_rect->height, 881 cam_rect->width, cam_rect->height,
880 cam_rect->left, cam_rect->top); 882 cam_rect->left, cam_rect->top);
881 goto ceu_set_rect; 883 goto ceu_set_rect;
882 } 884 }
883 885
884 /* Try to fix cropping, that camera hasn't managed to do */ 886 /* Try to fix cropping, that camera hasn't managed to do */
885 dev_dbg(&icd->dev, "Fix camera S_CROP %d for %ux%u@%u:%u" 887 dev_dbg(icd->dev.parent, "Fix camera S_CROP %d for %ux%u@%u:%u"
886 " to %ux%u@%u:%u\n", 888 " to %ux%u@%u:%u\n",
887 ret, cam_rect->width, cam_rect->height, 889 ret, cam_rect->width, cam_rect->height,
888 cam_rect->left, cam_rect->top, 890 cam_rect->left, cam_rect->top,
@@ -933,7 +935,7 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
933 cam_rect->height, cam_max.top); 935 cam_rect->height, cam_max.top);
934 936
935 ret = v4l2_subdev_call(sd, video, s_crop, &cam_crop); 937 ret = v4l2_subdev_call(sd, video, s_crop, &cam_crop);
936 dev_dbg(&icd->dev, "Camera S_CROP %d for %ux%u@%u:%u\n", 938 dev_dbg(icd->dev.parent, "Camera S_CROP %d for %ux%u@%u:%u\n",
937 ret, cam_rect->width, cam_rect->height, 939 ret, cam_rect->width, cam_rect->height,
938 cam_rect->left, cam_rect->top); 940 cam_rect->left, cam_rect->top);
939 } 941 }
@@ -951,7 +953,8 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
951 */ 953 */
952 *cam_rect = cam_max; 954 *cam_rect = cam_max;
953 ret = v4l2_subdev_call(sd, video, s_crop, &cam_crop); 955 ret = v4l2_subdev_call(sd, video, s_crop, &cam_crop);
954 dev_dbg(&icd->dev, "Camera S_CROP %d for max %ux%u@%u:%u\n", 956 dev_dbg(icd->dev.parent,
957 "Camera S_CROP %d for max %ux%u@%u:%u\n",
955 ret, cam_rect->width, cam_rect->height, 958 ret, cam_rect->width, cam_rect->height,
956 cam_rect->left, cam_rect->top); 959 cam_rect->left, cam_rect->top);
957 if (ret < 0 && ret != -ENOIOCTLCMD) 960 if (ret < 0 && ret != -ENOIOCTLCMD)
@@ -979,7 +982,7 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
979 * last before last close() _user_ rectangle, which can be different 982 * last before last close() _user_ rectangle, which can be different
980 * from camera rectangle. 983 * from camera rectangle.
981 */ 984 */
982 dev_dbg(&icd->dev, 985 dev_dbg(icd->dev.parent,
983 "SH S_CROP from %ux%u@%u:%u to %ux%u@%u:%u, scale to %ux%u@%u:%u\n", 986 "SH S_CROP from %ux%u@%u:%u to %ux%u@%u:%u, scale to %ux%u@%u:%u\n",
984 cam_rect->width, cam_rect->height, cam_rect->left, cam_rect->top, 987 cam_rect->width, cam_rect->height, cam_rect->left, cam_rect->top,
985 target.width, target.height, target.left, target.top, 988 target.width, target.height, target.left, target.top,
@@ -1037,14 +1040,15 @@ static int sh_mobile_ceu_set_fmt(struct soc_camera_device *icd,
1037 1040
1038 xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); 1041 xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
1039 if (!xlate) { 1042 if (!xlate) {
1040 dev_warn(ici->v4l2_dev.dev, "Format %x not found\n", pixfmt); 1043 dev_warn(icd->dev.parent, "Format %x not found\n", pixfmt);
1041 return -EINVAL; 1044 return -EINVAL;
1042 } 1045 }
1043 1046
1044 pix->pixelformat = xlate->cam_fmt->fourcc; 1047 pix->pixelformat = xlate->cam_fmt->fourcc;
1045 ret = v4l2_subdev_call(sd, video, s_fmt, f); 1048 ret = v4l2_subdev_call(sd, video, s_fmt, f);
1046 pix->pixelformat = pixfmt; 1049 pix->pixelformat = pixfmt;
1047 dev_dbg(&icd->dev, "Camera %d fmt %ux%u, requested %ux%u, max %ux%u\n", 1050 dev_dbg(icd->dev.parent,
1051 "Camera %d fmt %ux%u, requested %ux%u, max %ux%u\n",
1048 ret, pix->width, pix->height, width, height, 1052 ret, pix->width, pix->height, width, height,
1049 icd->rect_max.width, icd->rect_max.height); 1053 icd->rect_max.width, icd->rect_max.height);
1050 if (ret < 0) 1054 if (ret < 0)
@@ -1084,12 +1088,12 @@ static int sh_mobile_ceu_set_fmt(struct soc_camera_device *icd,
1084 pix->pixelformat = xlate->cam_fmt->fourcc; 1088 pix->pixelformat = xlate->cam_fmt->fourcc;
1085 ret = v4l2_subdev_call(sd, video, s_fmt, f); 1089 ret = v4l2_subdev_call(sd, video, s_fmt, f);
1086 pix->pixelformat = pixfmt; 1090 pix->pixelformat = pixfmt;
1087 dev_dbg(&icd->dev, "Camera scaled to %ux%u\n", 1091 dev_dbg(icd->dev.parent, "Camera scaled to %ux%u\n",
1088 pix->width, pix->height); 1092 pix->width, pix->height);
1089 if (ret < 0) { 1093 if (ret < 0) {
1090 /* This shouldn't happen */ 1094 /* This shouldn't happen */
1091 dev_err(&icd->dev, "Client failed to set format: %d\n", 1095 dev_err(icd->dev.parent,
1092 ret); 1096 "Client failed to set format: %d\n", ret);
1093 return ret; 1097 return ret;
1094 } 1098 }
1095 } 1099 }
@@ -1105,7 +1109,7 @@ static int sh_mobile_ceu_set_fmt(struct soc_camera_device *icd,
1105 hscale = calc_scale(pix->width, &width); 1109 hscale = calc_scale(pix->width, &width);
1106 vscale = calc_scale(pix->height, &height); 1110 vscale = calc_scale(pix->height, &height);
1107 1111
1108 dev_dbg(&icd->dev, "W: %u : 0x%x = %u, H: %u : 0x%x = %u\n", 1112 dev_dbg(icd->dev.parent, "W: %u : 0x%x = %u, H: %u : 0x%x = %u\n",
1109 pix->width, hscale, width, pix->height, vscale, height); 1113 pix->width, hscale, width, pix->height, vscale, height);
1110 1114
1111out: 1115out:
@@ -1136,7 +1140,6 @@ out:
1136static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, 1140static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
1137 struct v4l2_format *f) 1141 struct v4l2_format *f)
1138{ 1142{
1139 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
1140 const struct soc_camera_format_xlate *xlate; 1143 const struct soc_camera_format_xlate *xlate;
1141 struct v4l2_pix_format *pix = &f->fmt.pix; 1144 struct v4l2_pix_format *pix = &f->fmt.pix;
1142 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); 1145 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
@@ -1146,7 +1149,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
1146 1149
1147 xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); 1150 xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
1148 if (!xlate) { 1151 if (!xlate) {
1149 dev_warn(ici->v4l2_dev.dev, "Format %x not found\n", pixfmt); 1152 dev_warn(icd->dev.parent, "Format %x not found\n", pixfmt);
1150 return -EINVAL; 1153 return -EINVAL;
1151 } 1154 }
1152 1155
@@ -1184,7 +1187,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
1184 ret = v4l2_subdev_call(sd, video, try_fmt, f); 1187 ret = v4l2_subdev_call(sd, video, try_fmt, f);
1185 if (ret < 0) { 1188 if (ret < 0) {
1186 /* Shouldn't actually happen... */ 1189 /* Shouldn't actually happen... */
1187 dev_err(&icd->dev, 1190 dev_err(icd->dev.parent,
1188 "FIXME: try_fmt() returned %d\n", ret); 1191 "FIXME: try_fmt() returned %d\n", ret);
1189 pix->width = tmp_w; 1192 pix->width = tmp_w;
1190 pix->height = tmp_h; 1193 pix->height = tmp_h;
@@ -1253,7 +1256,7 @@ static void sh_mobile_ceu_init_videobuf(struct videobuf_queue *q,
1253 1256
1254 videobuf_queue_dma_contig_init(q, 1257 videobuf_queue_dma_contig_init(q,
1255 &sh_mobile_ceu_videobuf_ops, 1258 &sh_mobile_ceu_videobuf_ops,
1256 ici->v4l2_dev.dev, &pcdev->lock, 1259 icd->dev.parent, &pcdev->lock,
1257 V4L2_BUF_TYPE_VIDEO_CAPTURE, 1260 V4L2_BUF_TYPE_VIDEO_CAPTURE,
1258 pcdev->is_interlaced ? 1261 pcdev->is_interlaced ?
1259 V4L2_FIELD_INTERLACED : V4L2_FIELD_NONE, 1262 V4L2_FIELD_INTERLACED : V4L2_FIELD_NONE,