diff options
Diffstat (limited to 'drivers/media/video/s5p-fimc/fimc-reg.c')
-rw-r--r-- | drivers/media/video/s5p-fimc/fimc-reg.c | 53 |
1 files changed, 41 insertions, 12 deletions
diff --git a/drivers/media/video/s5p-fimc/fimc-reg.c b/drivers/media/video/s5p-fimc/fimc-reg.c index 44f5c2d1920b..15466d0529c1 100644 --- a/drivers/media/video/s5p-fimc/fimc-reg.c +++ b/drivers/media/video/s5p-fimc/fimc-reg.c | |||
@@ -117,7 +117,7 @@ void fimc_hw_set_target_format(struct fimc_ctx *ctx) | |||
117 | S5P_CITRGFMT_VSIZE_MASK); | 117 | S5P_CITRGFMT_VSIZE_MASK); |
118 | 118 | ||
119 | switch (frame->fmt->color) { | 119 | switch (frame->fmt->color) { |
120 | case S5P_FIMC_RGB565...S5P_FIMC_RGB888: | 120 | case S5P_FIMC_RGB444...S5P_FIMC_RGB888: |
121 | cfg |= S5P_CITRGFMT_RGB; | 121 | cfg |= S5P_CITRGFMT_RGB; |
122 | break; | 122 | break; |
123 | case S5P_FIMC_YCBCR420: | 123 | case S5P_FIMC_YCBCR420: |
@@ -175,6 +175,7 @@ void fimc_hw_set_out_dma(struct fimc_ctx *ctx) | |||
175 | struct fimc_dev *dev = ctx->fimc_dev; | 175 | struct fimc_dev *dev = ctx->fimc_dev; |
176 | struct fimc_frame *frame = &ctx->d_frame; | 176 | struct fimc_frame *frame = &ctx->d_frame; |
177 | struct fimc_dma_offset *offset = &frame->dma_offset; | 177 | struct fimc_dma_offset *offset = &frame->dma_offset; |
178 | struct fimc_fmt *fmt = frame->fmt; | ||
178 | 179 | ||
179 | /* Set the input dma offsets. */ | 180 | /* Set the input dma offsets. */ |
180 | cfg = 0; | 181 | cfg = 0; |
@@ -198,15 +199,22 @@ void fimc_hw_set_out_dma(struct fimc_ctx *ctx) | |||
198 | cfg = readl(dev->regs + S5P_CIOCTRL); | 199 | cfg = readl(dev->regs + S5P_CIOCTRL); |
199 | 200 | ||
200 | cfg &= ~(S5P_CIOCTRL_ORDER2P_MASK | S5P_CIOCTRL_ORDER422_MASK | | 201 | cfg &= ~(S5P_CIOCTRL_ORDER2P_MASK | S5P_CIOCTRL_ORDER422_MASK | |
201 | S5P_CIOCTRL_YCBCR_PLANE_MASK); | 202 | S5P_CIOCTRL_YCBCR_PLANE_MASK | S5P_CIOCTRL_RGB16FMT_MASK); |
202 | 203 | ||
203 | if (frame->fmt->colplanes == 1) | 204 | if (fmt->colplanes == 1) |
204 | cfg |= ctx->out_order_1p; | 205 | cfg |= ctx->out_order_1p; |
205 | else if (frame->fmt->colplanes == 2) | 206 | else if (fmt->colplanes == 2) |
206 | cfg |= ctx->out_order_2p | S5P_CIOCTRL_YCBCR_2PLANE; | 207 | cfg |= ctx->out_order_2p | S5P_CIOCTRL_YCBCR_2PLANE; |
207 | else if (frame->fmt->colplanes == 3) | 208 | else if (fmt->colplanes == 3) |
208 | cfg |= S5P_CIOCTRL_YCBCR_3PLANE; | 209 | cfg |= S5P_CIOCTRL_YCBCR_3PLANE; |
209 | 210 | ||
211 | if (fmt->color == S5P_FIMC_RGB565) | ||
212 | cfg |= S5P_CIOCTRL_RGB565; | ||
213 | else if (fmt->color == S5P_FIMC_RGB555) | ||
214 | cfg |= S5P_CIOCTRL_ARGB1555; | ||
215 | else if (fmt->color == S5P_FIMC_RGB444) | ||
216 | cfg |= S5P_CIOCTRL_ARGB4444; | ||
217 | |||
210 | writel(cfg, dev->regs + S5P_CIOCTRL); | 218 | writel(cfg, dev->regs + S5P_CIOCTRL); |
211 | } | 219 | } |
212 | 220 | ||
@@ -278,22 +286,28 @@ static void fimc_hw_set_scaler(struct fimc_ctx *ctx) | |||
278 | if (sc->copy_mode) | 286 | if (sc->copy_mode) |
279 | cfg |= S5P_CISCCTRL_ONE2ONE; | 287 | cfg |= S5P_CISCCTRL_ONE2ONE; |
280 | 288 | ||
281 | |||
282 | if (ctx->in_path == FIMC_DMA) { | 289 | if (ctx->in_path == FIMC_DMA) { |
283 | if (src_frame->fmt->color == S5P_FIMC_RGB565) | 290 | switch (src_frame->fmt->color) { |
291 | case S5P_FIMC_RGB565: | ||
284 | cfg |= S5P_CISCCTRL_INRGB_FMT_RGB565; | 292 | cfg |= S5P_CISCCTRL_INRGB_FMT_RGB565; |
285 | else if (src_frame->fmt->color == S5P_FIMC_RGB666) | 293 | break; |
294 | case S5P_FIMC_RGB666: | ||
286 | cfg |= S5P_CISCCTRL_INRGB_FMT_RGB666; | 295 | cfg |= S5P_CISCCTRL_INRGB_FMT_RGB666; |
287 | else if (src_frame->fmt->color == S5P_FIMC_RGB888) | 296 | break; |
297 | case S5P_FIMC_RGB888: | ||
288 | cfg |= S5P_CISCCTRL_INRGB_FMT_RGB888; | 298 | cfg |= S5P_CISCCTRL_INRGB_FMT_RGB888; |
299 | break; | ||
300 | } | ||
289 | } | 301 | } |
290 | 302 | ||
291 | if (ctx->out_path == FIMC_DMA) { | 303 | if (ctx->out_path == FIMC_DMA) { |
292 | if (dst_frame->fmt->color == S5P_FIMC_RGB565) | 304 | u32 color = dst_frame->fmt->color; |
305 | |||
306 | if (color >= S5P_FIMC_RGB444 && color <= S5P_FIMC_RGB565) | ||
293 | cfg |= S5P_CISCCTRL_OUTRGB_FMT_RGB565; | 307 | cfg |= S5P_CISCCTRL_OUTRGB_FMT_RGB565; |
294 | else if (dst_frame->fmt->color == S5P_FIMC_RGB666) | 308 | else if (color == S5P_FIMC_RGB666) |
295 | cfg |= S5P_CISCCTRL_OUTRGB_FMT_RGB666; | 309 | cfg |= S5P_CISCCTRL_OUTRGB_FMT_RGB666; |
296 | else if (dst_frame->fmt->color == S5P_FIMC_RGB888) | 310 | else if (color == S5P_FIMC_RGB888) |
297 | cfg |= S5P_CISCCTRL_OUTRGB_FMT_RGB888; | 311 | cfg |= S5P_CISCCTRL_OUTRGB_FMT_RGB888; |
298 | } else { | 312 | } else { |
299 | cfg |= S5P_CISCCTRL_OUTRGB_FMT_RGB888; | 313 | cfg |= S5P_CISCCTRL_OUTRGB_FMT_RGB888; |
@@ -379,6 +393,21 @@ void fimc_hw_set_effect(struct fimc_ctx *ctx, bool active) | |||
379 | writel(cfg, dev->regs + S5P_CIIMGEFF); | 393 | writel(cfg, dev->regs + S5P_CIIMGEFF); |
380 | } | 394 | } |
381 | 395 | ||
396 | void fimc_hw_set_rgb_alpha(struct fimc_ctx *ctx) | ||
397 | { | ||
398 | struct fimc_dev *dev = ctx->fimc_dev; | ||
399 | struct fimc_frame *frame = &ctx->d_frame; | ||
400 | u32 cfg; | ||
401 | |||
402 | if (!(frame->fmt->flags & FMT_HAS_ALPHA)) | ||
403 | return; | ||
404 | |||
405 | cfg = readl(dev->regs + S5P_CIOCTRL); | ||
406 | cfg &= ~S5P_CIOCTRL_ALPHA_OUT_MASK; | ||
407 | cfg |= (frame->alpha << 4); | ||
408 | writel(cfg, dev->regs + S5P_CIOCTRL); | ||
409 | } | ||
410 | |||
382 | static void fimc_hw_set_in_dma_size(struct fimc_ctx *ctx) | 411 | static void fimc_hw_set_in_dma_size(struct fimc_ctx *ctx) |
383 | { | 412 | { |
384 | struct fimc_dev *dev = ctx->fimc_dev; | 413 | struct fimc_dev *dev = ctx->fimc_dev; |