diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2010-11-25 08:49:21 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-12-20 11:11:03 -0500 |
commit | 798174ab6257dc2ba2ee91e242e21491c3922355 (patch) | |
tree | d107cfea2214e273a17b074e39fe207f0af58d85 /drivers | |
parent | a8365fc205180209bfefaf9d454736bb44071a0f (diff) |
[media] s5p-fimc: Fix output DMA handling in S5PV310 IP revisions
FIMC IP in S5Pv310 series has extended DMA status registers
and some bit fields are marked as reserved comparing to S5PC100/110.
Use correct registers for getting DMA write pointer in each SoC variant
supported by the driver.
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/s5p-fimc/fimc-capture.c | 1 | ||||
-rw-r--r-- | drivers/media/video/s5p-fimc/fimc-core.c | 2 | ||||
-rw-r--r-- | drivers/media/video/s5p-fimc/fimc-core.h | 16 | ||||
-rw-r--r-- | drivers/media/video/s5p-fimc/regs-fimc.h | 3 |
4 files changed, 19 insertions, 3 deletions
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index 1f2009271540..2f500809f53d 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c | |||
@@ -522,6 +522,7 @@ static int fimc_cap_streamon(struct file *file, void *priv, | |||
522 | INIT_LIST_HEAD(&fimc->vid_cap.active_buf_q); | 522 | INIT_LIST_HEAD(&fimc->vid_cap.active_buf_q); |
523 | fimc->vid_cap.active_buf_cnt = 0; | 523 | fimc->vid_cap.active_buf_cnt = 0; |
524 | fimc->vid_cap.frame_count = 0; | 524 | fimc->vid_cap.frame_count = 0; |
525 | fimc->vid_cap.buf_index = fimc_hw_get_frame_index(fimc); | ||
525 | 526 | ||
526 | set_bit(ST_CAPT_PEND, &fimc->state); | 527 | set_bit(ST_CAPT_PEND, &fimc->state); |
527 | ret = videobuf_streamon(&fimc->vid_cap.vbq); | 528 | ret = videobuf_streamon(&fimc->vid_cap.vbq); |
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c index f538eb598c3d..bb99f2d805d3 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.c +++ b/drivers/media/video/s5p-fimc/fimc-core.c | |||
@@ -1746,6 +1746,7 @@ static struct samsung_fimc_variant fimc0_variant_s5pv310 = { | |||
1746 | .pix_hoff = 1, | 1746 | .pix_hoff = 1, |
1747 | .has_inp_rot = 1, | 1747 | .has_inp_rot = 1, |
1748 | .has_out_rot = 1, | 1748 | .has_out_rot = 1, |
1749 | .has_cistatus2 = 1, | ||
1749 | .min_inp_pixsize = 16, | 1750 | .min_inp_pixsize = 16, |
1750 | .min_out_pixsize = 16, | 1751 | .min_out_pixsize = 16, |
1751 | .hor_offs_align = 1, | 1752 | .hor_offs_align = 1, |
@@ -1755,6 +1756,7 @@ static struct samsung_fimc_variant fimc0_variant_s5pv310 = { | |||
1755 | 1756 | ||
1756 | static struct samsung_fimc_variant fimc2_variant_s5pv310 = { | 1757 | static struct samsung_fimc_variant fimc2_variant_s5pv310 = { |
1757 | .pix_hoff = 1, | 1758 | .pix_hoff = 1, |
1759 | .has_cistatus2 = 1, | ||
1758 | .min_inp_pixsize = 16, | 1760 | .min_inp_pixsize = 16, |
1759 | .min_out_pixsize = 16, | 1761 | .min_out_pixsize = 16, |
1760 | .hor_offs_align = 1, | 1762 | .hor_offs_align = 1, |
diff --git a/drivers/media/video/s5p-fimc/fimc-core.h b/drivers/media/video/s5p-fimc/fimc-core.h index 6137340ceb57..4f047d35f8ad 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.h +++ b/drivers/media/video/s5p-fimc/fimc-core.h | |||
@@ -371,6 +371,7 @@ struct fimc_pix_limit { | |||
371 | * @pix_hoff: indicate whether horizontal offset is in pixels or in bytes | 371 | * @pix_hoff: indicate whether horizontal offset is in pixels or in bytes |
372 | * @has_inp_rot: set if has input rotator | 372 | * @has_inp_rot: set if has input rotator |
373 | * @has_out_rot: set if has output rotator | 373 | * @has_out_rot: set if has output rotator |
374 | * @has_cistatus2: 1 if CISTATUS2 register is present in this IP revision | ||
374 | * @pix_limit: pixel size constraints for the scaler | 375 | * @pix_limit: pixel size constraints for the scaler |
375 | * @min_inp_pixsize: minimum input pixel size | 376 | * @min_inp_pixsize: minimum input pixel size |
376 | * @min_out_pixsize: minimum output pixel size | 377 | * @min_out_pixsize: minimum output pixel size |
@@ -381,6 +382,7 @@ struct samsung_fimc_variant { | |||
381 | unsigned int pix_hoff:1; | 382 | unsigned int pix_hoff:1; |
382 | unsigned int has_inp_rot:1; | 383 | unsigned int has_inp_rot:1; |
383 | unsigned int has_out_rot:1; | 384 | unsigned int has_out_rot:1; |
385 | unsigned int has_cistatus2:1; | ||
384 | struct fimc_pix_limit *pix_limit; | 386 | struct fimc_pix_limit *pix_limit; |
385 | u16 min_inp_pixsize; | 387 | u16 min_inp_pixsize; |
386 | u16 min_out_pixsize; | 388 | u16 min_out_pixsize; |
@@ -556,11 +558,19 @@ static inline struct fimc_frame *ctx_get_frame(struct fimc_ctx *ctx, | |||
556 | return frame; | 558 | return frame; |
557 | } | 559 | } |
558 | 560 | ||
561 | /* Return an index to the buffer actually being written. */ | ||
559 | static inline u32 fimc_hw_get_frame_index(struct fimc_dev *dev) | 562 | static inline u32 fimc_hw_get_frame_index(struct fimc_dev *dev) |
560 | { | 563 | { |
561 | u32 reg = readl(dev->regs + S5P_CISTATUS); | 564 | u32 reg; |
562 | return (reg & S5P_CISTATUS_FRAMECNT_MASK) >> | 565 | |
563 | S5P_CISTATUS_FRAMECNT_SHIFT; | 566 | if (dev->variant->has_cistatus2) { |
567 | reg = readl(dev->regs + S5P_CISTATUS2) & 0x3F; | ||
568 | return reg > 0 ? --reg : reg; | ||
569 | } else { | ||
570 | reg = readl(dev->regs + S5P_CISTATUS); | ||
571 | return (reg & S5P_CISTATUS_FRAMECNT_MASK) >> | ||
572 | S5P_CISTATUS_FRAMECNT_SHIFT; | ||
573 | } | ||
564 | } | 574 | } |
565 | 575 | ||
566 | /* -----------------------------------------------------*/ | 576 | /* -----------------------------------------------------*/ |
diff --git a/drivers/media/video/s5p-fimc/regs-fimc.h b/drivers/media/video/s5p-fimc/regs-fimc.h index a57daedb5b5c..57e33f84fcfa 100644 --- a/drivers/media/video/s5p-fimc/regs-fimc.h +++ b/drivers/media/video/s5p-fimc/regs-fimc.h | |||
@@ -165,6 +165,9 @@ | |||
165 | #define S5P_CISTATUS_VVALID_A (1 << 15) | 165 | #define S5P_CISTATUS_VVALID_A (1 << 15) |
166 | #define S5P_CISTATUS_VVALID_B (1 << 14) | 166 | #define S5P_CISTATUS_VVALID_B (1 << 14) |
167 | 167 | ||
168 | /* Indexes to the last and the currently processed buffer. */ | ||
169 | #define S5P_CISTATUS2 0x68 | ||
170 | |||
168 | /* Image capture control */ | 171 | /* Image capture control */ |
169 | #define S5P_CIIMGCPT 0xc0 | 172 | #define S5P_CIIMGCPT 0xc0 |
170 | #define S5P_CIIMGCPT_IMGCPTEN (1 << 31) | 173 | #define S5P_CIIMGCPT_IMGCPTEN (1 << 31) |