[media] s5p-fimc: Move scaler details handling to the register API file
authorSylwester Nawrocki <s.nawrocki@samsung.com>
Tue, 28 Dec 2010 14:37:55 +0000 (11:37 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 21 Mar 2011 23:31:39 +0000 (20:31 -0300)
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/s5p-fimc/fimc-capture.c
drivers/media/video/s5p-fimc/fimc-core.c
drivers/media/video/s5p-fimc/fimc-core.h
drivers/media/video/s5p-fimc/fimc-reg.c

index 91304eef812b8787a90431f82cb44a9ddeb4cbc8..2b03c956d0f698e0636d1fceb5f69a3fa5888513 100644 (file)
@@ -237,7 +237,6 @@ static int start_streaming(struct vb2_queue *q)
        struct fimc_ctx *ctx = q->drv_priv;
        struct fimc_dev *fimc = ctx->fimc_dev;
        struct s5p_fimc_isp_info *isp_info;
-       struct samsung_fimc_variant *variant = ctx->fimc_dev->variant;
        int ret;
 
        ret = v4l2_subdev_call(fimc->vid_cap.sd, video, s_stream, 1);
@@ -261,10 +260,7 @@ static int start_streaming(struct vb2_queue *q)
                }
                fimc_hw_set_input_path(ctx);
                fimc_hw_set_prescaler(ctx);
-               if (variant->has_mainscaler_ext)
-                       fimc_hw_set_mainscaler_ext(ctx);
-               else
-                       fimc_hw_set_mainscaler(ctx);
+               fimc_hw_set_mainscaler(ctx);
                fimc_hw_set_target_format(ctx);
                fimc_hw_set_rotation(ctx);
                fimc_hw_set_effect(ctx);
index 59fa5126fc2d00555ec5d8e7fbda089ce82d186e..09bfac45ea32b2275a4a441a582ae79b8f6296ef 100644 (file)
@@ -578,7 +578,6 @@ static void fimc_dma_run(void *priv)
 {
        struct fimc_ctx *ctx = priv;
        struct fimc_dev *fimc;
-       struct samsung_fimc_variant *variant = ctx->fimc_dev->variant;
        unsigned long flags;
        u32 ret;
 
@@ -613,10 +612,7 @@ static void fimc_dma_run(void *priv)
                }
 
                fimc_hw_set_prescaler(ctx);
-               if (variant->has_mainscaler_ext)
-                       fimc_hw_set_mainscaler_ext(ctx);
-               else
-                       fimc_hw_set_mainscaler(ctx);
+               fimc_hw_set_mainscaler(ctx);
                fimc_hw_set_target_format(ctx);
                fimc_hw_set_rotation(ctx);
                fimc_hw_set_effect(ctx);
index 8aee9e3207f9a83c38f6c915c440247a03bb0b8d..1c15358b43b61ddf7f22c2c3d1cd2d3539a155ef 100644 (file)
@@ -574,7 +574,6 @@ void fimc_hw_en_lastirq(struct fimc_dev *fimc, int enable);
 void fimc_hw_en_irq(struct fimc_dev *fimc, int enable);
 void fimc_hw_set_prescaler(struct fimc_ctx *ctx);
 void fimc_hw_set_mainscaler(struct fimc_ctx *ctx);
-void fimc_hw_set_mainscaler_ext(struct fimc_ctx *ctx);
 void fimc_hw_en_capture(struct fimc_ctx *ctx);
 void fimc_hw_set_effect(struct fimc_ctx *ctx);
 void fimc_hw_set_in_dma(struct fimc_ctx *ctx);
index 064fa0a8b893b78d3e1a9f68cf95433c80ea9b66..8e5a0bbae580edd568acb2c1b5bcacba3bd5b7d3 100644 (file)
@@ -314,6 +314,7 @@ static void fimc_hw_set_scaler(struct fimc_ctx *ctx)
 void fimc_hw_set_mainscaler(struct fimc_ctx *ctx)
 {
        struct fimc_dev *dev = ctx->fimc_dev;
+       struct samsung_fimc_variant *variant = dev->variant;
        struct fimc_scaler *sc = &ctx->scaler;
        u32 cfg;
 
@@ -323,40 +324,26 @@ void fimc_hw_set_mainscaler(struct fimc_ctx *ctx)
        fimc_hw_set_scaler(ctx);
 
        cfg = readl(dev->regs + S5P_CISCCTRL);
-       cfg &= ~S5P_CISCCTRL_MHRATIO_MASK;
-       cfg &= ~S5P_CISCCTRL_MVRATIO_MASK;
-       cfg |= S5P_CISCCTRL_MHRATIO(sc->main_hratio);
-       cfg |= S5P_CISCCTRL_MVRATIO(sc->main_vratio);
 
-       writel(cfg, dev->regs + S5P_CISCCTRL);
-}
+       if (variant->has_mainscaler_ext) {
+               cfg &= ~(S5P_CISCCTRL_MHRATIO_MASK | S5P_CISCCTRL_MVRATIO_MASK);
+               cfg |= S5P_CISCCTRL_MHRATIO_EXT(sc->main_hratio);
+               cfg |= S5P_CISCCTRL_MVRATIO_EXT(sc->main_vratio);
+               writel(cfg, dev->regs + S5P_CISCCTRL);
 
-void fimc_hw_set_mainscaler_ext(struct fimc_ctx *ctx)
-{
-       struct fimc_dev *dev = ctx->fimc_dev;
-       struct fimc_scaler *sc = &ctx->scaler;
-       u32 cfg, cfg_ext;
+               cfg = readl(dev->regs + S5P_CIEXTEN);
 
-       dbg("main_hratio= 0x%X  main_vratio= 0x%X",
-               sc->main_hratio, sc->main_vratio);
-
-       fimc_hw_set_scaler(ctx);
-
-       cfg = readl(dev->regs + S5P_CISCCTRL);
-       cfg &= ~S5P_CISCCTRL_MHRATIO_MASK;
-       cfg &= ~S5P_CISCCTRL_MVRATIO_MASK;
-       cfg |= S5P_CISCCTRL_MHRATIO_EXT(sc->main_hratio);
-       cfg |= S5P_CISCCTRL_MVRATIO_EXT(sc->main_vratio);
-
-       writel(cfg, dev->regs + S5P_CISCCTRL);
-
-       cfg_ext = readl(dev->regs + S5P_CIEXTEN);
-       cfg_ext &= ~S5P_CIEXTEN_MHRATIO_EXT_MASK;
-       cfg_ext &= ~S5P_CIEXTEN_MVRATIO_EXT_MASK;
-       cfg_ext |= S5P_CIEXTEN_MHRATIO_EXT(sc->main_hratio);
-       cfg_ext |= S5P_CIEXTEN_MVRATIO_EXT(sc->main_vratio);
-
-       writel(cfg_ext, dev->regs + S5P_CIEXTEN);
+               cfg &= ~(S5P_CIEXTEN_MVRATIO_EXT_MASK |
+                        S5P_CIEXTEN_MHRATIO_EXT_MASK);
+               cfg |= S5P_CIEXTEN_MHRATIO_EXT(sc->main_hratio);
+               cfg |= S5P_CIEXTEN_MVRATIO_EXT(sc->main_vratio);
+               writel(cfg, dev->regs + S5P_CIEXTEN);
+       } else {
+               cfg &= ~(S5P_CISCCTRL_MHRATIO_MASK | S5P_CISCCTRL_MVRATIO_MASK);
+               cfg |= S5P_CISCCTRL_MHRATIO(sc->main_hratio);
+               cfg |= S5P_CISCCTRL_MVRATIO(sc->main_vratio);
+               writel(cfg, dev->regs + S5P_CISCCTRL);
+       }
 }
 
 void fimc_hw_en_capture(struct fimc_ctx *ctx)