aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/platform/marvell-ccic/mcam-core.c30
-rw-r--r--drivers/media/platform/marvell-ccic/mcam-core.h9
2 files changed, 22 insertions, 17 deletions
diff --git a/drivers/media/platform/marvell-ccic/mcam-core.c b/drivers/media/platform/marvell-ccic/mcam-core.c
index ce2b7b4788d6..7012913f34a2 100644
--- a/drivers/media/platform/marvell-ccic/mcam-core.c
+++ b/drivers/media/platform/marvell-ccic/mcam-core.c
@@ -30,13 +30,6 @@
30 30
31#include "mcam-core.h" 31#include "mcam-core.h"
32 32
33/*
34 * Basic frame stats - to be deleted shortly
35 */
36static int frames;
37static int singles;
38static int delivered;
39
40#ifdef MCAM_MODE_VMALLOC 33#ifdef MCAM_MODE_VMALLOC
41/* 34/*
42 * Internal DMA buffer management. Since the controller cannot do S/G I/O, 35 * Internal DMA buffer management. Since the controller cannot do S/G I/O,
@@ -367,10 +360,10 @@ static void mcam_frame_tasklet(unsigned long data)
367 if (!test_bit(bufno, &cam->flags)) 360 if (!test_bit(bufno, &cam->flags))
368 continue; 361 continue;
369 if (list_empty(&cam->buffers)) { 362 if (list_empty(&cam->buffers)) {
370 singles++; 363 cam->frame_state.singles++;
371 break; /* Leave it valid, hope for better later */ 364 break; /* Leave it valid, hope for better later */
372 } 365 }
373 delivered++; 366 cam->frame_state.delivered++;
374 clear_bit(bufno, &cam->flags); 367 clear_bit(bufno, &cam->flags);
375 buf = list_first_entry(&cam->buffers, struct mcam_vb_buffer, 368 buf = list_first_entry(&cam->buffers, struct mcam_vb_buffer,
376 queue); 369 queue);
@@ -452,7 +445,7 @@ static void mcam_set_contig_buffer(struct mcam_camera *cam, int frame)
452 mcam_reg_write(cam, frame == 0 ? REG_Y0BAR : REG_Y1BAR, 445 mcam_reg_write(cam, frame == 0 ? REG_Y0BAR : REG_Y1BAR,
453 vb2_dma_contig_plane_dma_addr(&buf->vb_buf, 0)); 446 vb2_dma_contig_plane_dma_addr(&buf->vb_buf, 0));
454 set_bit(CF_SINGLE_BUFFER, &cam->flags); 447 set_bit(CF_SINGLE_BUFFER, &cam->flags);
455 singles++; 448 cam->frame_state.singles++;
456 return; 449 return;
457 } 450 }
458 /* 451 /*
@@ -485,7 +478,7 @@ static void mcam_dma_contig_done(struct mcam_camera *cam, int frame)
485 struct mcam_vb_buffer *buf = cam->vb_bufs[frame]; 478 struct mcam_vb_buffer *buf = cam->vb_bufs[frame];
486 479
487 if (!test_bit(CF_SINGLE_BUFFER, &cam->flags)) { 480 if (!test_bit(CF_SINGLE_BUFFER, &cam->flags)) {
488 delivered++; 481 cam->frame_state.delivered++;
489 mcam_buffer_done(cam, frame, &buf->vb_buf); 482 mcam_buffer_done(cam, frame, &buf->vb_buf);
490 } 483 }
491 mcam_set_contig_buffer(cam, frame); 484 mcam_set_contig_buffer(cam, frame);
@@ -578,13 +571,13 @@ static void mcam_dma_sg_done(struct mcam_camera *cam, int frame)
578 */ 571 */
579 } else { 572 } else {
580 set_bit(CF_SG_RESTART, &cam->flags); 573 set_bit(CF_SG_RESTART, &cam->flags);
581 singles++; 574 cam->frame_state.singles++;
582 cam->vb_bufs[0] = NULL; 575 cam->vb_bufs[0] = NULL;
583 } 576 }
584 /* 577 /*
585 * Now we can give the completed frame back to user space. 578 * Now we can give the completed frame back to user space.
586 */ 579 */
587 delivered++; 580 cam->frame_state.delivered++;
588 mcam_buffer_done(cam, frame, &buf->vb_buf); 581 mcam_buffer_done(cam, frame, &buf->vb_buf);
589} 582}
590 583
@@ -1545,7 +1538,9 @@ static int mcam_v4l_open(struct file *filp)
1545 1538
1546 filp->private_data = cam; 1539 filp->private_data = cam;
1547 1540
1548 frames = singles = delivered = 0; 1541 cam->frame_state.frames = 0;
1542 cam->frame_state.singles = 0;
1543 cam->frame_state.delivered = 0;
1549 mutex_lock(&cam->s_mutex); 1544 mutex_lock(&cam->s_mutex);
1550 if (cam->users == 0) { 1545 if (cam->users == 0) {
1551 ret = mcam_setup_vb2(cam); 1546 ret = mcam_setup_vb2(cam);
@@ -1566,8 +1561,9 @@ static int mcam_v4l_release(struct file *filp)
1566{ 1561{
1567 struct mcam_camera *cam = filp->private_data; 1562 struct mcam_camera *cam = filp->private_data;
1568 1563
1569 cam_dbg(cam, "Release, %d frames, %d singles, %d delivered\n", frames, 1564 cam_dbg(cam, "Release, %d frames, %d singles, %d delivered\n",
1570 singles, delivered); 1565 cam->frame_state.frames, cam->frame_state.singles,
1566 cam->frame_state.delivered);
1571 mutex_lock(&cam->s_mutex); 1567 mutex_lock(&cam->s_mutex);
1572 (cam->users)--; 1568 (cam->users)--;
1573 if (cam->users == 0) { 1569 if (cam->users == 0) {
@@ -1660,7 +1656,7 @@ static void mcam_frame_complete(struct mcam_camera *cam, int frame)
1660 clear_bit(CF_DMA_ACTIVE, &cam->flags); 1656 clear_bit(CF_DMA_ACTIVE, &cam->flags);
1661 cam->next_buf = frame; 1657 cam->next_buf = frame;
1662 cam->buf_seq[frame] = ++(cam->sequence); 1658 cam->buf_seq[frame] = ++(cam->sequence);
1663 frames++; 1659 cam->frame_state.frames++;
1664 /* 1660 /*
1665 * "This should never happen" 1661 * "This should never happen"
1666 */ 1662 */
diff --git a/drivers/media/platform/marvell-ccic/mcam-core.h b/drivers/media/platform/marvell-ccic/mcam-core.h
index bd6acba9fb37..5e802c6b398e 100644
--- a/drivers/media/platform/marvell-ccic/mcam-core.h
+++ b/drivers/media/platform/marvell-ccic/mcam-core.h
@@ -73,6 +73,14 @@ static inline int mcam_buffer_mode_supported(enum mcam_buffer_mode mode)
73 } 73 }
74} 74}
75 75
76/*
77 * Basic frame states
78 */
79struct mcam_frame_state {
80 unsigned int frames;
81 unsigned int singles;
82 unsigned int delivered;
83};
76 84
77/* 85/*
78 * A description of one of our devices. 86 * A description of one of our devices.
@@ -108,6 +116,7 @@ struct mcam_camera {
108 unsigned long flags; /* Buffer status, mainly (dev_lock) */ 116 unsigned long flags; /* Buffer status, mainly (dev_lock) */
109 int users; /* How many open FDs */ 117 int users; /* How many open FDs */
110 118
119 struct mcam_frame_state frame_state; /* Frame state counter */
111 /* 120 /*
112 * Subsystem structures. 121 * Subsystem structures.
113 */ 122 */