aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pxa_camera.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-04-24 11:55:48 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-16 17:20:43 -0400
commiteff505fa1511b753b7cfb397a754b8ff4367cd55 (patch)
tree0e15a9094777bbebcfd1331b9e78f1aa6c6a5070 /drivers/media/video/pxa_camera.c
parenteb6c8558f7658b7f31ee022c7bea1d840eda33dc (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/pxa_camera.c')
-rw-r--r--drivers/media/video/pxa_camera.c97
1 files changed, 48 insertions, 49 deletions
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
204struct pxa_camera_dev { 204struct 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
525fail_v: 523fail_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);
528fail_u: 526fail_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);
531fail: 529fail:
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
624static void pxa_videobuf_queue(struct videobuf_queue *vq, 622static 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
1699static int __devexit pxa_camera_remove(struct platform_device *pdev) 1696static 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