Merge branch 'camera-2.6.29'
* 'camera-2.6.29' of git://dev.omapzoom.org/pub/scm/dcurran/android-2.6.29-camera:
Revert "omap3isp: Drop temp buffer for ISP revision 2.1"
Revert "omap3isp: resz: Fix cropping for MEM vs PREV input"
diff --git a/drivers/media/video/isp/isp.c b/drivers/media/video/isp/isp.c
index f0980f4..ad4de88 100644
--- a/drivers/media/video/isp/isp.c
+++ b/drivers/media/video/isp/isp.c
@@ -1123,16 +1123,10 @@
* isp_tmp_buf_alloc - To allocate a 10MB memory
*
**/
-static u32 isp_tmp_buf_alloc(struct device *dev, struct isp_pipeline *pipe)
+static u32 isp_tmp_buf_alloc(struct device *dev, size_t size)
{
struct isp_device *isp = dev_get_drvdata(dev);
u32 da;
- size_t size = PAGE_ALIGN(isp->pipeline.prv_out_w *
- isp->pipeline.prv_out_h *
- ISP_BYTES_PER_PIXEL);
-
- if (isp->tmp_buf_size < size)
- return 0;
isp_tmp_buf_free(dev);
@@ -1145,9 +1139,7 @@
isp->tmp_buf_size = size;
isppreview_set_outaddr(&isp->isp_prev, isp->tmp_buf);
- ispresizer_set_inaddr(&isp->isp_res, isp->tmp_buf, 0);
- ispresizer_config_inlineoffset(&isp->isp_res,
- pipe->prv_out_w * ISP_BYTES_PER_PIXEL);
+ ispresizer_set_inaddr(&isp->isp_res, isp->tmp_buf);
return 0;
}
@@ -1347,13 +1339,8 @@
pipe->ccdc_in = CCDC_RAW_GBRG;
pipe->ccdc_out = CCDC_OTHERS_VP;
pipe->prv_in = PRV_RAW_CCDC;
- if (isp->revision <= ISP_REVISION_2_0) {
- pipe->prv_out = PREVIEW_MEM;
- pipe->rsz_in = RSZ_MEM_YUV;
- } else {
- pipe->prv_out = PREVIEW_RSZ;
- pipe->rsz_in = RSZ_OTFLY_YUV;
- }
+ pipe->prv_out = PREVIEW_MEM;
+ pipe->rsz_in = RSZ_MEM_YUV;
} else {
pipe->modules = OMAP_ISP_CCDC;
if (pix_input->pixelformat == V4L2_PIX_FMT_SGRBG10 ||
@@ -1683,10 +1670,13 @@
unsigned int *cnt, unsigned int *size)
{
struct isp_device *isp = dev_get_drvdata(dev);
+ size_t tmp_size = PAGE_ALIGN(isp->pipeline.prv_out_w
+ * isp->pipeline.prv_out_h
+ * ISP_BYTES_PER_PIXEL);
if (CCDC_PREV_RESZ_CAPTURE(isp) &&
- isp->revision <= ISP_REVISION_2_0)
- return isp_tmp_buf_alloc(dev, &isp->pipeline);
+ isp->tmp_buf_size < tmp_size)
+ return isp_tmp_buf_alloc(dev, tmp_size);
return 0;
}
@@ -2312,8 +2302,7 @@
if (isp->ref_count) {
if (--isp->ref_count == 0) {
isp_save_ctx(&pdev->dev);
- if (isp->revision <= ISP_REVISION_2_0)
- isp_tmp_buf_free(&pdev->dev);
+ isp_tmp_buf_free(&pdev->dev);
isp_release_resources(&pdev->dev);
isp_disable_clocks(&pdev->dev);
}
diff --git a/drivers/media/video/isp/ispresizer.c b/drivers/media/video/isp/ispresizer.c
index 3b1ffea..44bba7d 100644
--- a/drivers/media/video/isp/ispresizer.c
+++ b/drivers/media/video/isp/ispresizer.c
@@ -262,7 +262,7 @@
case RSZ_OTFLY_YUV:
cnt &= ~ISPRSZ_CNT_INPTYP;
cnt &= ~ISPRSZ_CNT_INPSRC;
- ispresizer_set_inaddr(isp_res, 0, 0);
+ ispresizer_set_inaddr(isp_res, 0);
ispresizer_config_inlineoffset(isp_res, 0);
break;
case RSZ_MEM_YUV:
@@ -480,12 +480,15 @@
int i, j;
u32 res;
int rval;
- struct isp_device *isp = dev_get_drvdata(dev);
rval = ispresizer_config_datapath(isp_res, pipe);
if (rval)
return rval;
+ /* Set Resizer input address and offset adderss */
+ ispresizer_config_inlineoffset(isp_res,
+ pipe->prv_out_w * ISP_BYTES_PER_PIXEL);
+
res = isp_reg_readl(dev, OMAP3_ISP_IOMEM_RESZ, ISPRSZ_CNT) &
~(ISPRSZ_CNT_HSTPH_MASK | ISPRSZ_CNT_VSTPH_MASK);
isp_reg_writel(dev, res |
@@ -494,29 +497,9 @@
OMAP3_ISP_IOMEM_RESZ,
ISPRSZ_CNT);
- /* Set Resizer input address and offset adderss */
- if (pipe->rsz_in == RSZ_OTFLY_YUV) {
- /* Set the fractional part of the starting address.*/
- isp_reg_writel(dev,
- (isp->pipeline.rsz_crop.left <<
- ISPRSZ_IN_START_HORZ_ST_SHIFT) |
- (isp->pipeline.rsz_crop.top <<
- ISPRSZ_IN_START_VERT_ST_SHIFT),
- OMAP3_ISP_IOMEM_RESZ, ISPRSZ_IN_START);
- } else {
- /* Set start address for cropping */
- ispresizer_set_inaddr(isp_res, isp_res->in_buf_addr,
- ISP_BYTES_PER_PIXEL *
- ((isp->pipeline.rsz_crop.left & ~0xf) +
- isp->pipeline.prv_out_w *
- isp->pipeline.rsz_crop.top));
-
- /* Set the fractional part of the starting address.*/
- isp_reg_writel(dev, ((isp->pipeline.rsz_crop.left & 0xf) <<
- ISPRSZ_IN_START_HORZ_ST_SHIFT) |
- (0x00 << ISPRSZ_IN_START_VERT_ST_SHIFT),
- OMAP3_ISP_IOMEM_RESZ, ISPRSZ_IN_START);
- }
+ /* Set start address for cropping */
+ ispresizer_set_inaddr(isp_res,
+ isp_res->tmp_buf + isp_get_buf_offset(dev));
isp_reg_writel(dev,
(pipe->rsz_crop.width << ISPRSZ_IN_SIZE_HORZ_SHIFT) |
@@ -787,25 +770,31 @@
/**
* ispresizer_set_inaddr - Sets the memory address of the input frame.
* @addr: 32bit memory address aligned on 32byte boundary.
- * @offset: Starting offset.
*
* Returns 0 if successful, or -EINVAL if address is not 32 bits aligned.
**/
-int ispresizer_set_inaddr(struct isp_res_device *isp_res, u32 addr, u32 offset)
+int ispresizer_set_inaddr(struct isp_res_device *isp_res, u32 addr)
{
struct isp_device *isp = to_isp_device(isp_res);
struct device *dev = to_device(isp_res);
DPRINTK_ISPRESZ("ispresizer_set_inaddr()+\n");
- if ((addr + offset) % 32)
+ if (addr % 32)
return -EINVAL;
-
- isp_res->in_buf_addr = addr;
- isp_res->in_buf_addr_off = offset;
-
- isp_reg_writel(dev, (addr + offset),
- OMAP3_ISP_IOMEM_RESZ, ISPRSZ_SDR_INADD);
+ isp_res->tmp_buf = addr;
+ /* FIXME: is this the right place to put crop-related junk? */
+ isp_reg_writel(dev,
+ isp_res->tmp_buf + ISP_BYTES_PER_PIXEL
+ * ((isp->pipeline.rsz_crop.left & ~0xf) +
+ isp->pipeline.prv_out_w
+ * isp->pipeline.rsz_crop.top),
+ OMAP3_ISP_IOMEM_RESZ, ISPRSZ_SDR_INADD);
+ /* Set the fractional part of the starting address. Needed for crop */
+ isp_reg_writel(dev, ((isp->pipeline.rsz_crop.left & 0xf) <<
+ ISPRSZ_IN_START_HORZ_ST_SHIFT) |
+ (0x00 << ISPRSZ_IN_START_VERT_ST_SHIFT),
+ OMAP3_ISP_IOMEM_RESZ, ISPRSZ_IN_START);
DPRINTK_ISPRESZ("ispresizer_set_inaddr()-\n");
return 0;
diff --git a/drivers/media/video/isp/ispresizer.h b/drivers/media/video/isp/ispresizer.h
index 47100e4..64538f5 100644
--- a/drivers/media/video/isp/ispresizer.h
+++ b/drivers/media/video/isp/ispresizer.h
@@ -134,8 +134,7 @@
u16 h_resz;
u16 v_resz;
u8 algo;
- dma_addr_t in_buf_addr;
- dma_addr_t in_buf_addr_off;
+ dma_addr_t tmp_buf;
struct isprsz_coef coeflist;
struct mutex ispres_mutex; /* For checking/modifying res_inuse */
struct isprsz_yenh defaultyenh;
@@ -171,7 +170,7 @@
int ispresizer_config_inlineoffset(struct isp_res_device *isp_res, u32 offset);
-int ispresizer_set_inaddr(struct isp_res_device *isp_res, u32 addr, u32 offset);
+int ispresizer_set_inaddr(struct isp_res_device *isp_res, u32 addr);
int ispresizer_config_outlineoffset(struct isp_res_device *isp_res, u32 offset);