aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/omap3isp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/omap3isp')
-rw-r--r--drivers/media/video/omap3isp/isp.c30
-rw-r--r--drivers/media/video/omap3isp/isp.h2
-rw-r--r--drivers/media/video/omap3isp/ispccdc.c20
-rw-r--r--drivers/media/video/omap3isp/ispstat.c10
-rw-r--r--drivers/media/video/omap3isp/ispvideo.c5
5 files changed, 23 insertions, 44 deletions
diff --git a/drivers/media/video/omap3isp/isp.c b/drivers/media/video/omap3isp/isp.c
index b818cacf420..d4c48ef227f 100644
--- a/drivers/media/video/omap3isp/isp.c
+++ b/drivers/media/video/omap3isp/isp.c
@@ -80,13 +80,6 @@
80#include "isph3a.h" 80#include "isph3a.h"
81#include "isphist.h" 81#include "isphist.h"
82 82
83/*
84 * this is provided as an interim solution until omap3isp doesn't need
85 * any omap-specific iommu API
86 */
87#define to_iommu(dev) \
88 (struct omap_iommu *)platform_get_drvdata(to_platform_device(dev))
89
90static unsigned int autoidle; 83static unsigned int autoidle;
91module_param(autoidle, int, 0444); 84module_param(autoidle, int, 0444);
92MODULE_PARM_DESC(autoidle, "Enable OMAP3ISP AUTOIDLE support"); 85MODULE_PARM_DESC(autoidle, "Enable OMAP3ISP AUTOIDLE support");
@@ -1114,8 +1107,7 @@ isp_restore_context(struct isp_device *isp, struct isp_reg *reg_list)
1114static void isp_save_ctx(struct isp_device *isp) 1107static void isp_save_ctx(struct isp_device *isp)
1115{ 1108{
1116 isp_save_context(isp, isp_reg_list); 1109 isp_save_context(isp, isp_reg_list);
1117 if (isp->iommu) 1110 omap_iommu_save_ctx(isp->dev);
1118 omap_iommu_save_ctx(isp->iommu);
1119} 1111}
1120 1112
1121/* 1113/*
@@ -1128,8 +1120,7 @@ static void isp_save_ctx(struct isp_device *isp)
1128static void isp_restore_ctx(struct isp_device *isp) 1120static void isp_restore_ctx(struct isp_device *isp)
1129{ 1121{
1130 isp_restore_context(isp, isp_reg_list); 1122 isp_restore_context(isp, isp_reg_list);
1131 if (isp->iommu) 1123 omap_iommu_restore_ctx(isp->dev);
1132 omap_iommu_restore_ctx(isp->iommu);
1133 omap3isp_ccdc_restore_context(isp); 1124 omap3isp_ccdc_restore_context(isp);
1134 omap3isp_preview_restore_context(isp); 1125 omap3isp_preview_restore_context(isp);
1135} 1126}
@@ -1983,7 +1974,7 @@ static int isp_remove(struct platform_device *pdev)
1983 isp_cleanup_modules(isp); 1974 isp_cleanup_modules(isp);
1984 1975
1985 omap3isp_get(isp); 1976 omap3isp_get(isp);
1986 iommu_detach_device(isp->domain, isp->iommu_dev); 1977 iommu_detach_device(isp->domain, &pdev->dev);
1987 iommu_domain_free(isp->domain); 1978 iommu_domain_free(isp->domain);
1988 omap3isp_put(isp); 1979 omap3isp_put(isp);
1989 1980
@@ -2131,17 +2122,6 @@ static int isp_probe(struct platform_device *pdev)
2131 } 2122 }
2132 } 2123 }
2133 2124
2134 /* IOMMU */
2135 isp->iommu_dev = omap_find_iommu_device("isp");
2136 if (!isp->iommu_dev) {
2137 dev_err(isp->dev, "omap_find_iommu_device failed\n");
2138 ret = -ENODEV;
2139 goto error_isp;
2140 }
2141
2142 /* to be removed once iommu migration is complete */
2143 isp->iommu = to_iommu(isp->iommu_dev);
2144
2145 isp->domain = iommu_domain_alloc(pdev->dev.bus); 2125 isp->domain = iommu_domain_alloc(pdev->dev.bus);
2146 if (!isp->domain) { 2126 if (!isp->domain) {
2147 dev_err(isp->dev, "can't alloc iommu domain\n"); 2127 dev_err(isp->dev, "can't alloc iommu domain\n");
@@ -2149,7 +2129,7 @@ static int isp_probe(struct platform_device *pdev)
2149 goto error_isp; 2129 goto error_isp;
2150 } 2130 }
2151 2131
2152 ret = iommu_attach_device(isp->domain, isp->iommu_dev); 2132 ret = iommu_attach_device(isp->domain, &pdev->dev);
2153 if (ret) { 2133 if (ret) {
2154 dev_err(&pdev->dev, "can't attach iommu device: %d\n", ret); 2134 dev_err(&pdev->dev, "can't attach iommu device: %d\n", ret);
2155 goto free_domain; 2135 goto free_domain;
@@ -2188,7 +2168,7 @@ error_modules:
2188error_irq: 2168error_irq:
2189 free_irq(isp->irq_num, isp); 2169 free_irq(isp->irq_num, isp);
2190detach_dev: 2170detach_dev:
2191 iommu_detach_device(isp->domain, isp->iommu_dev); 2171 iommu_detach_device(isp->domain, &pdev->dev);
2192free_domain: 2172free_domain:
2193 iommu_domain_free(isp->domain); 2173 iommu_domain_free(isp->domain);
2194error_isp: 2174error_isp:
diff --git a/drivers/media/video/omap3isp/isp.h b/drivers/media/video/omap3isp/isp.h
index 705946ef4d6..d96603eb0d1 100644
--- a/drivers/media/video/omap3isp/isp.h
+++ b/drivers/media/video/omap3isp/isp.h
@@ -212,9 +212,7 @@ struct isp_device {
212 unsigned int sbl_resources; 212 unsigned int sbl_resources;
213 unsigned int subclk_resources; 213 unsigned int subclk_resources;
214 214
215 struct omap_iommu *iommu;
216 struct iommu_domain *domain; 215 struct iommu_domain *domain;
217 struct device *iommu_dev;
218 216
219 struct isp_platform_callback platform_cb; 217 struct isp_platform_callback platform_cb;
220}; 218};
diff --git a/drivers/media/video/omap3isp/ispccdc.c b/drivers/media/video/omap3isp/ispccdc.c
index b0b0fa5a357..d341ba12593 100644
--- a/drivers/media/video/omap3isp/ispccdc.c
+++ b/drivers/media/video/omap3isp/ispccdc.c
@@ -366,7 +366,7 @@ static void ccdc_lsc_free_request(struct isp_ccdc_device *ccdc,
366 dma_unmap_sg(isp->dev, req->iovm->sgt->sgl, 366 dma_unmap_sg(isp->dev, req->iovm->sgt->sgl,
367 req->iovm->sgt->nents, DMA_TO_DEVICE); 367 req->iovm->sgt->nents, DMA_TO_DEVICE);
368 if (req->table) 368 if (req->table)
369 omap_iommu_vfree(isp->domain, isp->iommu, req->table); 369 omap_iommu_vfree(isp->domain, isp->dev, req->table);
370 kfree(req); 370 kfree(req);
371} 371}
372 372
@@ -438,7 +438,7 @@ static int ccdc_lsc_config(struct isp_ccdc_device *ccdc,
438 438
439 req->enable = 1; 439 req->enable = 1;
440 440
441 req->table = omap_iommu_vmalloc(isp->domain, isp->iommu, 0, 441 req->table = omap_iommu_vmalloc(isp->domain, isp->dev, 0,
442 req->config.size, IOMMU_FLAG); 442 req->config.size, IOMMU_FLAG);
443 if (IS_ERR_VALUE(req->table)) { 443 if (IS_ERR_VALUE(req->table)) {
444 req->table = 0; 444 req->table = 0;
@@ -446,7 +446,7 @@ static int ccdc_lsc_config(struct isp_ccdc_device *ccdc,
446 goto done; 446 goto done;
447 } 447 }
448 448
449 req->iovm = omap_find_iovm_area(isp->iommu, req->table); 449 req->iovm = omap_find_iovm_area(isp->dev, req->table);
450 if (req->iovm == NULL) { 450 if (req->iovm == NULL) {
451 ret = -ENOMEM; 451 ret = -ENOMEM;
452 goto done; 452 goto done;
@@ -462,7 +462,7 @@ static int ccdc_lsc_config(struct isp_ccdc_device *ccdc,
462 dma_sync_sg_for_cpu(isp->dev, req->iovm->sgt->sgl, 462 dma_sync_sg_for_cpu(isp->dev, req->iovm->sgt->sgl,
463 req->iovm->sgt->nents, DMA_TO_DEVICE); 463 req->iovm->sgt->nents, DMA_TO_DEVICE);
464 464
465 table = omap_da_to_va(isp->iommu, req->table); 465 table = omap_da_to_va(isp->dev, req->table);
466 if (copy_from_user(table, config->lsc, req->config.size)) { 466 if (copy_from_user(table, config->lsc, req->config.size)) {
467 ret = -EFAULT; 467 ret = -EFAULT;
468 goto done; 468 goto done;
@@ -734,15 +734,15 @@ static int ccdc_config(struct isp_ccdc_device *ccdc,
734 * already done by omap_iommu_vmalloc(). 734 * already done by omap_iommu_vmalloc().
735 */ 735 */
736 size = ccdc->fpc.fpnum * 4; 736 size = ccdc->fpc.fpnum * 4;
737 table_new = omap_iommu_vmalloc(isp->domain, isp->iommu, 737 table_new = omap_iommu_vmalloc(isp->domain, isp->dev,
738 0, size, IOMMU_FLAG); 738 0, size, IOMMU_FLAG);
739 if (IS_ERR_VALUE(table_new)) 739 if (IS_ERR_VALUE(table_new))
740 return -ENOMEM; 740 return -ENOMEM;
741 741
742 if (copy_from_user(omap_da_to_va(isp->iommu, table_new), 742 if (copy_from_user(omap_da_to_va(isp->dev, table_new),
743 (__force void __user *) 743 (__force void __user *)
744 ccdc->fpc.fpcaddr, size)) { 744 ccdc->fpc.fpcaddr, size)) {
745 omap_iommu_vfree(isp->domain, isp->iommu, 745 omap_iommu_vfree(isp->domain, isp->dev,
746 table_new); 746 table_new);
747 return -EFAULT; 747 return -EFAULT;
748 } 748 }
@@ -753,7 +753,7 @@ static int ccdc_config(struct isp_ccdc_device *ccdc,
753 753
754 ccdc_configure_fpc(ccdc); 754 ccdc_configure_fpc(ccdc);
755 if (table_old != 0) 755 if (table_old != 0)
756 omap_iommu_vfree(isp->domain, isp->iommu, table_old); 756 omap_iommu_vfree(isp->domain, isp->dev, table_old);
757 } 757 }
758 758
759 return ccdc_lsc_config(ccdc, ccdc_struct); 759 return ccdc_lsc_config(ccdc, ccdc_struct);
@@ -1408,7 +1408,7 @@ static void ccdc_hs_vs_isr(struct isp_ccdc_device *ccdc)
1408{ 1408{
1409 struct isp_pipeline *pipe = 1409 struct isp_pipeline *pipe =
1410 to_isp_pipeline(&ccdc->video_out.video.entity); 1410 to_isp_pipeline(&ccdc->video_out.video.entity);
1411 struct video_device *vdev = &ccdc->subdev.devnode; 1411 struct video_device *vdev = ccdc->subdev.devnode;
1412 struct v4l2_event event; 1412 struct v4l2_event event;
1413 1413
1414 memset(&event, 0, sizeof(event)); 1414 memset(&event, 0, sizeof(event));
@@ -2309,7 +2309,7 @@ void omap3isp_ccdc_cleanup(struct isp_device *isp)
2309 ccdc_lsc_free_queue(ccdc, &ccdc->lsc.free_queue); 2309 ccdc_lsc_free_queue(ccdc, &ccdc->lsc.free_queue);
2310 2310
2311 if (ccdc->fpc.fpcaddr != 0) 2311 if (ccdc->fpc.fpcaddr != 0)
2312 omap_iommu_vfree(isp->domain, isp->iommu, ccdc->fpc.fpcaddr); 2312 omap_iommu_vfree(isp->domain, isp->dev, ccdc->fpc.fpcaddr);
2313 2313
2314 mutex_destroy(&ccdc->ioctl_lock); 2314 mutex_destroy(&ccdc->ioctl_lock);
2315} 2315}
diff --git a/drivers/media/video/omap3isp/ispstat.c b/drivers/media/video/omap3isp/ispstat.c
index 68d539456c5..11871ecc6d2 100644
--- a/drivers/media/video/omap3isp/ispstat.c
+++ b/drivers/media/video/omap3isp/ispstat.c
@@ -366,7 +366,7 @@ static void isp_stat_bufs_free(struct ispstat *stat)
366 dma_unmap_sg(isp->dev, buf->iovm->sgt->sgl, 366 dma_unmap_sg(isp->dev, buf->iovm->sgt->sgl,
367 buf->iovm->sgt->nents, 367 buf->iovm->sgt->nents,
368 DMA_FROM_DEVICE); 368 DMA_FROM_DEVICE);
369 omap_iommu_vfree(isp->domain, isp->iommu, 369 omap_iommu_vfree(isp->domain, isp->dev,
370 buf->iommu_addr); 370 buf->iommu_addr);
371 } else { 371 } else {
372 if (!buf->virt_addr) 372 if (!buf->virt_addr)
@@ -400,7 +400,7 @@ static int isp_stat_bufs_alloc_iommu(struct ispstat *stat, unsigned int size)
400 struct iovm_struct *iovm; 400 struct iovm_struct *iovm;
401 401
402 WARN_ON(buf->dma_addr); 402 WARN_ON(buf->dma_addr);
403 buf->iommu_addr = omap_iommu_vmalloc(isp->domain, isp->iommu, 0, 403 buf->iommu_addr = omap_iommu_vmalloc(isp->domain, isp->dev, 0,
404 size, IOMMU_FLAG); 404 size, IOMMU_FLAG);
405 if (IS_ERR((void *)buf->iommu_addr)) { 405 if (IS_ERR((void *)buf->iommu_addr)) {
406 dev_err(stat->isp->dev, 406 dev_err(stat->isp->dev,
@@ -410,7 +410,7 @@ static int isp_stat_bufs_alloc_iommu(struct ispstat *stat, unsigned int size)
410 return -ENOMEM; 410 return -ENOMEM;
411 } 411 }
412 412
413 iovm = omap_find_iovm_area(isp->iommu, buf->iommu_addr); 413 iovm = omap_find_iovm_area(isp->dev, buf->iommu_addr);
414 if (!iovm || 414 if (!iovm ||
415 !dma_map_sg(isp->dev, iovm->sgt->sgl, iovm->sgt->nents, 415 !dma_map_sg(isp->dev, iovm->sgt->sgl, iovm->sgt->nents,
416 DMA_FROM_DEVICE)) { 416 DMA_FROM_DEVICE)) {
@@ -419,7 +419,7 @@ static int isp_stat_bufs_alloc_iommu(struct ispstat *stat, unsigned int size)
419 } 419 }
420 buf->iovm = iovm; 420 buf->iovm = iovm;
421 421
422 buf->virt_addr = omap_da_to_va(stat->isp->iommu, 422 buf->virt_addr = omap_da_to_va(stat->isp->dev,
423 (u32)buf->iommu_addr); 423 (u32)buf->iommu_addr);
424 buf->empty = 1; 424 buf->empty = 1;
425 dev_dbg(stat->isp->dev, "%s: buffer[%d] allocated." 425 dev_dbg(stat->isp->dev, "%s: buffer[%d] allocated."
@@ -496,7 +496,7 @@ static int isp_stat_bufs_alloc(struct ispstat *stat, u32 size)
496 496
497static void isp_stat_queue_event(struct ispstat *stat, int err) 497static void isp_stat_queue_event(struct ispstat *stat, int err)
498{ 498{
499 struct video_device *vdev = &stat->subdev.devnode; 499 struct video_device *vdev = stat->subdev.devnode;
500 struct v4l2_event event; 500 struct v4l2_event event;
501 struct omap3isp_stat_event_status *status = (void *)event.u.data; 501 struct omap3isp_stat_event_status *status = (void *)event.u.data;
502 502
diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c
index d1000723c5a..bd3aebafafa 100644
--- a/drivers/media/video/omap3isp/ispvideo.c
+++ b/drivers/media/video/omap3isp/ispvideo.c
@@ -26,6 +26,7 @@
26#include <asm/cacheflush.h> 26#include <asm/cacheflush.h>
27#include <linux/clk.h> 27#include <linux/clk.h>
28#include <linux/mm.h> 28#include <linux/mm.h>
29#include <linux/module.h>
29#include <linux/pagemap.h> 30#include <linux/pagemap.h>
30#include <linux/scatterlist.h> 31#include <linux/scatterlist.h>
31#include <linux/sched.h> 32#include <linux/sched.h>
@@ -452,7 +453,7 @@ ispmmu_vmap(struct isp_device *isp, const struct scatterlist *sglist, int sglen)
452 sgt->nents = sglen; 453 sgt->nents = sglen;
453 sgt->orig_nents = sglen; 454 sgt->orig_nents = sglen;
454 455
455 da = omap_iommu_vmap(isp->domain, isp->iommu, 0, sgt, IOMMU_FLAG); 456 da = omap_iommu_vmap(isp->domain, isp->dev, 0, sgt, IOMMU_FLAG);
456 if (IS_ERR_VALUE(da)) 457 if (IS_ERR_VALUE(da))
457 kfree(sgt); 458 kfree(sgt);
458 459
@@ -468,7 +469,7 @@ static void ispmmu_vunmap(struct isp_device *isp, dma_addr_t da)
468{ 469{
469 struct sg_table *sgt; 470 struct sg_table *sgt;
470 471
471 sgt = omap_iommu_vunmap(isp->domain, isp->iommu, (u32)da); 472 sgt = omap_iommu_vunmap(isp->domain, isp->dev, (u32)da);
472 kfree(sgt); 473 kfree(sgt);
473} 474}
474 475