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/pxa_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/pxa_camera.c')
-rw-r--r-- | drivers/media/video/pxa_camera.c | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c index 4bc2a4f81f79..1fd6ef392a54 100644 --- a/drivers/media/video/pxa_camera.c +++ b/drivers/media/video/pxa_camera.c | |||
@@ -237,7 +237,7 @@ static int pxa_videobuf_setup(struct videobuf_queue *vq, unsigned int *count, | |||
237 | { | 237 | { |
238 | struct soc_camera_device *icd = vq->priv_data; | 238 | struct soc_camera_device *icd = vq->priv_data; |
239 | 239 | ||
240 | dev_dbg(&icd->dev, "count=%d, size=%d\n", *count, *size); | 240 | dev_dbg(icd->dev.parent, "count=%d, size=%d\n", *count, *size); |
241 | 241 | ||
242 | *size = roundup(icd->rect_current.width * icd->rect_current.height * | 242 | *size = roundup(icd->rect_current.width * icd->rect_current.height * |
243 | ((icd->current_fmt->depth + 7) >> 3), 8); | 243 | ((icd->current_fmt->depth + 7) >> 3), 8); |
@@ -259,7 +259,7 @@ static void free_buffer(struct videobuf_queue *vq, struct pxa_buffer *buf) | |||
259 | 259 | ||
260 | BUG_ON(in_interrupt()); | 260 | BUG_ON(in_interrupt()); |
261 | 261 | ||
262 | dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, | 262 | dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, |
263 | &buf->vb, buf->vb.baddr, buf->vb.bsize); | 263 | &buf->vb, buf->vb.baddr, buf->vb.bsize); |
264 | 264 | ||
265 | /* This waits until this buffer is out of danger, i.e., until it is no | 265 | /* This waits until this buffer is out of danger, i.e., until it is no |
@@ -540,7 +540,8 @@ static void pxa_dma_start_channels(struct pxa_camera_dev *pcdev) | |||
540 | active = pcdev->active; | 540 | active = pcdev->active; |
541 | 541 | ||
542 | for (i = 0; i < pcdev->channels; i++) { | 542 | for (i = 0; i < pcdev->channels; i++) { |
543 | dev_dbg(pcdev->soc_host.v4l2_dev.dev, "%s (channel=%d) ddadr=%08x\n", __func__, | 543 | dev_dbg(pcdev->soc_host.v4l2_dev.dev, |
544 | "%s (channel=%d) ddadr=%08x\n", __func__, | ||
544 | i, active->dmas[i].sg_dma); | 545 | i, active->dmas[i].sg_dma); |
545 | DDADR(pcdev->dma_chans[i]) = active->dmas[i].sg_dma; | 546 | DDADR(pcdev->dma_chans[i]) = active->dmas[i].sg_dma; |
546 | DCSR(pcdev->dma_chans[i]) = DCSR_RUN; | 547 | DCSR(pcdev->dma_chans[i]) = DCSR_RUN; |
@@ -552,7 +553,8 @@ static void pxa_dma_stop_channels(struct pxa_camera_dev *pcdev) | |||
552 | int i; | 553 | int i; |
553 | 554 | ||
554 | for (i = 0; i < pcdev->channels; i++) { | 555 | for (i = 0; i < pcdev->channels; i++) { |
555 | dev_dbg(pcdev->soc_host.v4l2_dev.dev, "%s (channel=%d)\n", __func__, i); | 556 | dev_dbg(pcdev->soc_host.v4l2_dev.dev, |
557 | "%s (channel=%d)\n", __func__, i); | ||
556 | DCSR(pcdev->dma_chans[i]) = 0; | 558 | DCSR(pcdev->dma_chans[i]) = 0; |
557 | } | 559 | } |
558 | } | 560 | } |
@@ -620,8 +622,8 @@ static void pxa_videobuf_queue(struct videobuf_queue *vq, | |||
620 | struct pxa_camera_dev *pcdev = ici->priv; | 622 | struct pxa_camera_dev *pcdev = ici->priv; |
621 | struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb); | 623 | struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb); |
622 | 624 | ||
623 | dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d active=%p\n", __func__, | 625 | dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d active=%p\n", |
624 | vb, vb->baddr, vb->bsize, pcdev->active); | 626 | __func__, vb, vb->baddr, vb->bsize, pcdev->active); |
625 | 627 | ||
626 | list_add_tail(&vb->queue, &pcdev->capture); | 628 | list_add_tail(&vb->queue, &pcdev->capture); |
627 | 629 | ||
@@ -638,22 +640,23 @@ static void pxa_videobuf_release(struct videobuf_queue *vq, | |||
638 | struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb); | 640 | struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb); |
639 | #ifdef DEBUG | 641 | #ifdef DEBUG |
640 | struct soc_camera_device *icd = vq->priv_data; | 642 | struct soc_camera_device *icd = vq->priv_data; |
643 | struct device *dev = icd->dev.parent; | ||
641 | 644 | ||
642 | dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, | 645 | dev_dbg(dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, |
643 | vb, vb->baddr, vb->bsize); | 646 | vb, vb->baddr, vb->bsize); |
644 | 647 | ||
645 | switch (vb->state) { | 648 | switch (vb->state) { |
646 | case VIDEOBUF_ACTIVE: | 649 | case VIDEOBUF_ACTIVE: |
647 | dev_dbg(&icd->dev, "%s (active)\n", __func__); | 650 | dev_dbg(dev, "%s (active)\n", __func__); |
648 | break; | 651 | break; |
649 | case VIDEOBUF_QUEUED: | 652 | case VIDEOBUF_QUEUED: |
650 | dev_dbg(&icd->dev, "%s (queued)\n", __func__); | 653 | dev_dbg(dev, "%s (queued)\n", __func__); |
651 | break; | 654 | break; |
652 | case VIDEOBUF_PREPARED: | 655 | case VIDEOBUF_PREPARED: |
653 | dev_dbg(&icd->dev, "%s (prepared)\n", __func__); | 656 | dev_dbg(dev, "%s (prepared)\n", __func__); |
654 | break; | 657 | break; |
655 | default: | 658 | default: |
656 | dev_dbg(&icd->dev, "%s (unknown)\n", __func__); | 659 | dev_dbg(dev, "%s (unknown)\n", __func__); |
657 | break; | 660 | break; |
658 | } | 661 | } |
659 | #endif | 662 | #endif |
@@ -924,7 +927,8 @@ static irqreturn_t pxa_camera_irq(int irq, void *data) | |||
924 | struct videobuf_buffer *vb; | 927 | struct videobuf_buffer *vb; |
925 | 928 | ||
926 | status = __raw_readl(pcdev->base + CISR); | 929 | status = __raw_readl(pcdev->base + CISR); |
927 | dev_dbg(pcdev->soc_host.v4l2_dev.dev, "Camera interrupt status 0x%lx\n", status); | 930 | dev_dbg(pcdev->soc_host.v4l2_dev.dev, |
931 | "Camera interrupt status 0x%lx\n", status); | ||
928 | 932 | ||
929 | if (!status) | 933 | if (!status) |
930 | return IRQ_NONE; | 934 | return IRQ_NONE; |
@@ -964,7 +968,7 @@ static int pxa_camera_add_device(struct soc_camera_device *icd) | |||
964 | 968 | ||
965 | pcdev->icd = icd; | 969 | pcdev->icd = icd; |
966 | 970 | ||
967 | dev_info(&icd->dev, "PXA Camera driver attached to camera %d\n", | 971 | dev_info(icd->dev.parent, "PXA Camera driver attached to camera %d\n", |
968 | icd->devnum); | 972 | icd->devnum); |
969 | 973 | ||
970 | return 0; | 974 | return 0; |
@@ -978,7 +982,7 @@ static void pxa_camera_remove_device(struct soc_camera_device *icd) | |||
978 | 982 | ||
979 | BUG_ON(icd != pcdev->icd); | 983 | BUG_ON(icd != pcdev->icd); |
980 | 984 | ||
981 | dev_info(&icd->dev, "PXA Camera driver detached from camera %d\n", | 985 | dev_info(icd->dev.parent, "PXA Camera driver detached from camera %d\n", |
982 | icd->devnum); | 986 | icd->devnum); |
983 | 987 | ||
984 | /* disable capture, disable interrupts */ | 988 | /* disable capture, disable interrupts */ |
@@ -1224,7 +1228,7 @@ static int required_buswidth(const struct soc_camera_data_format *fmt) | |||
1224 | static int pxa_camera_get_formats(struct soc_camera_device *icd, int idx, | 1228 | static int pxa_camera_get_formats(struct soc_camera_device *icd, int idx, |
1225 | struct soc_camera_format_xlate *xlate) | 1229 | struct soc_camera_format_xlate *xlate) |
1226 | { | 1230 | { |
1227 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 1231 | struct device *dev = icd->dev.parent; |
1228 | int formats = 0, buswidth, ret; | 1232 | int formats = 0, buswidth, ret; |
1229 | 1233 | ||
1230 | buswidth = required_buswidth(icd->formats + idx); | 1234 | buswidth = required_buswidth(icd->formats + idx); |
@@ -1244,7 +1248,7 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, int idx, | |||
1244 | xlate->cam_fmt = icd->formats + idx; | 1248 | xlate->cam_fmt = icd->formats + idx; |
1245 | xlate->buswidth = buswidth; | 1249 | xlate->buswidth = buswidth; |
1246 | xlate++; | 1250 | xlate++; |
1247 | dev_dbg(ici->v4l2_dev.dev, "Providing format %s using %s\n", | 1251 | dev_dbg(dev, "Providing format %s using %s\n", |
1248 | pxa_camera_formats[0].name, | 1252 | pxa_camera_formats[0].name, |
1249 | icd->formats[idx].name); | 1253 | icd->formats[idx].name); |
1250 | } | 1254 | } |
@@ -1259,7 +1263,7 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, int idx, | |||
1259 | xlate->cam_fmt = icd->formats + idx; | 1263 | xlate->cam_fmt = icd->formats + idx; |
1260 | xlate->buswidth = buswidth; | 1264 | xlate->buswidth = buswidth; |
1261 | xlate++; | 1265 | xlate++; |
1262 | dev_dbg(ici->v4l2_dev.dev, "Providing format %s packed\n", | 1266 | dev_dbg(dev, "Providing format %s packed\n", |
1263 | icd->formats[idx].name); | 1267 | icd->formats[idx].name); |
1264 | } | 1268 | } |
1265 | break; | 1269 | break; |
@@ -1271,7 +1275,7 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, int idx, | |||
1271 | xlate->cam_fmt = icd->formats + idx; | 1275 | xlate->cam_fmt = icd->formats + idx; |
1272 | xlate->buswidth = icd->formats[idx].depth; | 1276 | xlate->buswidth = icd->formats[idx].depth; |
1273 | xlate++; | 1277 | xlate++; |
1274 | dev_dbg(ici->v4l2_dev.dev, | 1278 | dev_dbg(dev, |
1275 | "Providing format %s in pass-through mode\n", | 1279 | "Providing format %s in pass-through mode\n", |
1276 | icd->formats[idx].name); | 1280 | icd->formats[idx].name); |
1277 | } | 1281 | } |
@@ -1286,6 +1290,7 @@ static int pxa_camera_set_crop(struct soc_camera_device *icd, | |||
1286 | struct v4l2_rect *rect = &a->c; | 1290 | struct v4l2_rect *rect = &a->c; |
1287 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 1291 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); |
1288 | struct pxa_camera_dev *pcdev = ici->priv; | 1292 | struct pxa_camera_dev *pcdev = ici->priv; |
1293 | struct device *dev = icd->dev.parent; | ||
1289 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 1294 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
1290 | struct soc_camera_sense sense = { | 1295 | struct soc_camera_sense sense = { |
1291 | .master_clock = pcdev->mclk, | 1296 | .master_clock = pcdev->mclk, |
@@ -1302,11 +1307,11 @@ static int pxa_camera_set_crop(struct soc_camera_device *icd, | |||
1302 | icd->sense = NULL; | 1307 | icd->sense = NULL; |
1303 | 1308 | ||
1304 | if (ret < 0) { | 1309 | if (ret < 0) { |
1305 | dev_warn(ici->v4l2_dev.dev, "Failed to crop to %ux%u@%u:%u\n", | 1310 | dev_warn(dev, "Failed to crop to %ux%u@%u:%u\n", |
1306 | rect->width, rect->height, rect->left, rect->top); | 1311 | rect->width, rect->height, rect->left, rect->top); |
1307 | } else if (sense.flags & SOCAM_SENSE_PCLK_CHANGED) { | 1312 | } else if (sense.flags & SOCAM_SENSE_PCLK_CHANGED) { |
1308 | if (sense.pixel_clock > sense.pixel_clock_max) { | 1313 | if (sense.pixel_clock > sense.pixel_clock_max) { |
1309 | dev_err(ici->v4l2_dev.dev, | 1314 | dev_err(dev, |
1310 | "pixel clock %lu set by the camera too high!", | 1315 | "pixel clock %lu set by the camera too high!", |
1311 | sense.pixel_clock); | 1316 | sense.pixel_clock); |
1312 | return -EIO; | 1317 | return -EIO; |
@@ -1322,6 +1327,7 @@ static int pxa_camera_set_fmt(struct soc_camera_device *icd, | |||
1322 | { | 1327 | { |
1323 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 1328 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); |
1324 | struct pxa_camera_dev *pcdev = ici->priv; | 1329 | struct pxa_camera_dev *pcdev = ici->priv; |
1330 | struct device *dev = icd->dev.parent; | ||
1325 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 1331 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
1326 | const struct soc_camera_data_format *cam_fmt = NULL; | 1332 | const struct soc_camera_data_format *cam_fmt = NULL; |
1327 | const struct soc_camera_format_xlate *xlate = NULL; | 1333 | const struct soc_camera_format_xlate *xlate = NULL; |
@@ -1335,7 +1341,7 @@ static int pxa_camera_set_fmt(struct soc_camera_device *icd, | |||
1335 | 1341 | ||
1336 | xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); | 1342 | xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); |
1337 | if (!xlate) { | 1343 | if (!xlate) { |
1338 | dev_warn(ici->v4l2_dev.dev, "Format %x not found\n", pix->pixelformat); | 1344 | dev_warn(dev, "Format %x not found\n", pix->pixelformat); |
1339 | return -EINVAL; | 1345 | return -EINVAL; |
1340 | } | 1346 | } |
1341 | 1347 | ||
@@ -1351,11 +1357,11 @@ static int pxa_camera_set_fmt(struct soc_camera_device *icd, | |||
1351 | icd->sense = NULL; | 1357 | icd->sense = NULL; |
1352 | 1358 | ||
1353 | if (ret < 0) { | 1359 | if (ret < 0) { |
1354 | dev_warn(ici->v4l2_dev.dev, "Failed to configure for format %x\n", | 1360 | dev_warn(dev, "Failed to configure for format %x\n", |
1355 | pix->pixelformat); | 1361 | pix->pixelformat); |
1356 | } else if (sense.flags & SOCAM_SENSE_PCLK_CHANGED) { | 1362 | } else if (sense.flags & SOCAM_SENSE_PCLK_CHANGED) { |
1357 | if (sense.pixel_clock > sense.pixel_clock_max) { | 1363 | if (sense.pixel_clock > sense.pixel_clock_max) { |
1358 | dev_err(ici->v4l2_dev.dev, | 1364 | dev_err(dev, |
1359 | "pixel clock %lu set by the camera too high!", | 1365 | "pixel clock %lu set by the camera too high!", |
1360 | sense.pixel_clock); | 1366 | sense.pixel_clock); |
1361 | return -EIO; | 1367 | return -EIO; |
@@ -1413,7 +1419,7 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd, | |||
1413 | if (field == V4L2_FIELD_ANY) { | 1419 | if (field == V4L2_FIELD_ANY) { |
1414 | pix->field = V4L2_FIELD_NONE; | 1420 | pix->field = V4L2_FIELD_NONE; |
1415 | } else if (field != V4L2_FIELD_NONE) { | 1421 | } else if (field != V4L2_FIELD_NONE) { |
1416 | dev_err(&icd->dev, "Field type %d unsupported.\n", field); | 1422 | dev_err(icd->dev.parent, "Field type %d unsupported.\n", field); |
1417 | return -EINVAL; | 1423 | return -EINVAL; |
1418 | } | 1424 | } |
1419 | 1425 | ||