[PATCH v3] [media] s5p-mfc: add init buffer cmd to MFCV6

2014-05-14 Thread Arun Kumar K
From: avnd kiran avnd.ki...@samsung.com

Latest MFC v6 firmware requires tile mode and loop filter
setting to be done as part of Init buffer command, in sync
with v7. Since there are two versions of v6 firmware with
different interfaces, it is differenciated using the version
number read back from firmware which is a hexadecimal value
based on the firmware date.

Signed-off-by: avnd kiran avnd.ki...@samsung.com
Signed-off-by: Arun Kumar K arun...@samsung.com
---
Changes from v2
- Addressed Kamil's comment
  https://patchwork.linuxtv.org/patch/22989/
Changes from v1
- Check for v6 firmware date for differenciating old and new firmware
  as per comments from Kamil and Sylwester.
---
 drivers/media/platform/s5p-mfc/regs-mfc-v6.h|1 +
 drivers/media/platform/s5p-mfc/regs-mfc-v7.h|2 --
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h |2 ++
 drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c   |8 
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |   21 ++---
 5 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v6.h 
b/drivers/media/platform/s5p-mfc/regs-mfc-v6.h
index 8d0b686..b47567c 100644
--- a/drivers/media/platform/s5p-mfc/regs-mfc-v6.h
+++ b/drivers/media/platform/s5p-mfc/regs-mfc-v6.h
@@ -132,6 +132,7 @@
 #define S5P_FIMV_D_METADATA_BUFFER_ADDR_V6 0xf448
 #define S5P_FIMV_D_METADATA_BUFFER_SIZE_V6 0xf44c
 #define S5P_FIMV_D_NUM_MV_V6   0xf478
+#define S5P_FIMV_D_INIT_BUFFER_OPTIONS_V6  0xf47c
 #define S5P_FIMV_D_CPB_BUFFER_ADDR_V6  0xf4b0
 #define S5P_FIMV_D_CPB_BUFFER_SIZE_V6  0xf4b4
 
diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v7.h 
b/drivers/media/platform/s5p-mfc/regs-mfc-v7.h
index ea5ec2a..82c96fa 100644
--- a/drivers/media/platform/s5p-mfc/regs-mfc-v7.h
+++ b/drivers/media/platform/s5p-mfc/regs-mfc-v7.h
@@ -18,8 +18,6 @@
 #define S5P_FIMV_CODEC_VP8_ENC_V7  25
 
 /* Additional registers for v7 */
-#define S5P_FIMV_D_INIT_BUFFER_OPTIONS_V7  0xf47c
-
 #define S5P_FIMV_E_SOURCE_FIRST_ADDR_V70xf9e0
 #define S5P_FIMV_E_SOURCE_SECOND_ADDR_V7   0xf9e4
 #define S5P_FIMV_E_SOURCE_THIRD_ADDR_V70xf9e8
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h 
b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
index 4d17df9..f5404a6 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
@@ -287,6 +287,7 @@ struct s5p_mfc_priv_buf {
  * @warn_start:hardware error code from which warnings start
  * @mfc_ops:   ops structure holding HW operation function pointers
  * @mfc_cmds:  cmd structure holding HW commands function pointers
+ * @ver:   firmware sub version
  *
  */
 struct s5p_mfc_dev {
@@ -330,6 +331,7 @@ struct s5p_mfc_dev {
int warn_start;
struct s5p_mfc_hw_ops *mfc_ops;
struct s5p_mfc_hw_cmds *mfc_cmds;
+   int ver;
 };
 
 /**
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
index ee05f2d..b86744f 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
@@ -238,7 +238,6 @@ static inline void s5p_mfc_clear_cmds(struct s5p_mfc_dev 
*dev)
 /* Initialize hardware */
 int s5p_mfc_init_hw(struct s5p_mfc_dev *dev)
 {
-   unsigned int ver;
int ret;
 
mfc_debug_enter();
@@ -300,12 +299,13 @@ int s5p_mfc_init_hw(struct s5p_mfc_dev *dev)
return -EIO;
}
if (IS_MFCV6_PLUS(dev))
-   ver = mfc_read(dev, S5P_FIMV_FW_VERSION_V6);
+   dev-ver = mfc_read(dev, S5P_FIMV_FW_VERSION_V6);
else
-   ver = mfc_read(dev, S5P_FIMV_FW_VERSION);
+   dev-ver = mfc_read(dev, S5P_FIMV_FW_VERSION);
 
mfc_debug(2, MFC F/W version : %02xyy, %02xmm, %02xdd\n,
-   (ver  16)  0xFF, (ver  8)  0xFF, ver  0xFF);
+   (dev-ver  16)  0xFF, (dev-ver  8)  0xFF,
+   dev-ver  0xFF);
s5p_mfc_clock_off();
mfc_debug_leave();
return 0;
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
index 90edb19..444f0e8 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
@@ -48,6 +48,9 @@
 #define OFFSETA(x) (((x) - dev-port_a)  S5P_FIMV_MEM_OFFSET)
 #define OFFSETB(x) (((x) - dev-port_b)  S5P_FIMV_MEM_OFFSET)
 
+/* v2 interface version date of MFCv6 firmware */
+#define MFC_V6_FIRMWARE_INTERFACE_V2 0x120629
+
 /* Allocate temporary buffers for decoding */
 static int s5p_mfc_alloc_dec_temp_buffers_v6(struct s5p_mfc_ctx *ctx)
 {
@@ -1269,6 +1272,18 @@ static int s5p_mfc_set_enc_params_vp8(struct s5p_mfc_ctx 
*ctx)
return 0;
 }
 
+/* Check if newer v6 firmware with changed init 

[PATCH v2] [media] s5p-mfc: Don't allocate codec buffers on STREAMON.

2014-05-14 Thread Arun Kumar K
From: Pawel Osciak posc...@chromium.org

Currently, we allocate private codec buffers on STREAMON, which may fail
if we are out of memory. We don't check for failure though, which will
make us crash with the codec accessing random memory.

We shouldn't be failing STREAMON with out of memory errors though. So move
the allocation of private codec buffers to REQBUFS for OUTPUT queue. Also,
move MFC instance opening and closing to REQBUFS as well, as it's tied to
allocation and deallocation of private codec buffers.

Signed-off-by: Pawel Osciak posc...@chromium.org
Signed-off-by: Arun Kumar K arun...@samsung.com
---
Posting only patch 3/3 of the patchset -
MFC cleanup of reqbuf, streamon, open and close
addressing a minor comment from Kamil.
Other dependent patches are:
s5p-mfc: Extract open/close MFC instance commands.
s5p-mfc: Fixes for decode REQBUFS.

Changes from v1
- Addressed review comment from Kamil
  https://patchwork.linuxtv.org/patch/23162/
---
 drivers/media/platform/s5p-mfc/s5p_mfc.c  |8 +++
 drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c |1 +
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c  |   30 +++--
 3 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index 2faf7e6..aa08aa2 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -650,6 +650,7 @@ static irqreturn_t s5p_mfc_irq(int irq, void *priv)
 
case S5P_MFC_R2H_CMD_CLOSE_INSTANCE_RET:
clear_work_bit(ctx);
+   ctx-inst_no = MFC_NO_INSTANCE_SET;
ctx-state = MFCINST_FREE;
wake_up(ctx-queue);
goto irq_cleanup_hw;
@@ -770,7 +771,7 @@ static int s5p_mfc_open(struct file *file)
goto err_bad_node;
}
ctx-fh.ctrl_handler = ctx-ctrl_handler;
-   ctx-inst_no = -1;
+   ctx-inst_no = MFC_NO_INSTANCE_SET;
/* Load firmware if this is the first instance */
if (dev-num_inst == 1) {
dev-watchdog_timer.expires = jiffies +
@@ -880,12 +881,11 @@ static int s5p_mfc_release(struct file *file)
vb2_queue_release(ctx-vq_dst);
/* Mark context as idle */
clear_work_bit_irqsave(ctx);
-   /* If instance was initialised then
+   /* If instance was initialised and not yet freed,
 * return instance and free resources */
-   if (ctx-inst_no != MFC_NO_INSTANCE_SET) {
+   if (ctx-state != MFCINST_FREE  ctx-state != MFCINST_INIT) {
mfc_debug(2, Has to free instance\n);
s5p_mfc_close_mfc_inst(dev, ctx);
-   ctx-inst_no = MFC_NO_INSTANCE_SET;
}
/* hardware locking scheme */
if (dev-curr_ctx == ctx-num)
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
index 84d4f9d..2001a75 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
@@ -459,5 +459,6 @@ void s5p_mfc_close_mfc_inst(struct s5p_mfc_dev *dev, struct 
s5p_mfc_ctx *ctx)
if (ctx-type == MFCINST_DECODER)
s5p_mfc_hw_call(dev-mfc_ops, release_dec_desc_buffer, ctx);
 
+   ctx-inst_no = MFC_NO_INSTANCE_SET;
ctx-state = MFCINST_FREE;
 }
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
index efc78ae..4586186 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
@@ -475,11 +475,11 @@ static int reqbufs_output(struct s5p_mfc_dev *dev, struct 
s5p_mfc_ctx *ctx,
ret = vb2_reqbufs(ctx-vq_src, reqbufs);
if (ret)
goto out;
+   s5p_mfc_close_mfc_inst(dev, ctx);
ctx-src_bufs_cnt = 0;
+   ctx-output_state = QUEUE_FREE;
} else if (ctx-output_state == QUEUE_FREE) {
-   /* Can only request buffers after the instance
-* has been opened.
-*/
+   /* Can only request buffers when we have a valid format set. */
WARN_ON(ctx-src_bufs_cnt != 0);
if (ctx-state != MFCINST_INIT) {
mfc_err(Reqbufs called in an invalid state\n);
@@ -493,6 +493,13 @@ static int reqbufs_output(struct s5p_mfc_dev *dev, struct 
s5p_mfc_ctx *ctx,
if (ret)
goto out;
 
+   ret = s5p_mfc_open_mfc_inst(dev, ctx);
+   if (ret) {
+   reqbufs-count = 0;
+   vb2_reqbufs(ctx-vq_src, reqbufs);
+   goto out;
+   }
+
ctx-output_state = QUEUE_BUFS_REQUESTED;
} else {
mfc_err(Buffers have already been requested\n);
@@ -594,7 +601,7 @@ static int vidioc_querybuf(struct file *file, void *priv,
   

[PATCH v2] [media] s5p-mfc: Dequeue sequence header after STREAMON

2014-05-14 Thread Arun Kumar K
MFCv6 encoder needs specific minimum number of buffers to
be queued in the CAPTURE plane. This minimum number will
be known only when the sequence header is generated.
So we used to allow STREAMON on the CAPTURE plane only after
sequence header is generated and checked with the minimum
buffer requirement.

But this causes a problem that we call a vb2_buffer_done
for the sequence header buffer before doing a STREAON on the
CAPTURE plane. This used to still work fine until this patch
was merged -
b3379c6 : vb2: only call start_streaming if sufficient buffers are queued

This problem should also come in earlier MFC firmware versions
if the application calls STREAMON on CAPTURE with some delay
after doing STREAMON on OUTPUT.

So this patch keeps the header buffer until the other frame
buffers are ready and dequeues it just before the first frame
is ready.

Signed-off-by: Arun Kumar K arun...@samsung.com
---
Changes from v1
- Addressed review comments from Sachin
  https://patchwork.linuxtv.org/patch/23839/
---
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h |2 ++
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c|6 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h 
b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
index f5404a6..cc2b96e 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
@@ -523,6 +523,7 @@ struct s5p_mfc_codec_ops {
  * @output_state:  state of the output buffers queue
  * @src_bufs:  information on allocated source buffers
  * @dst_bufs:  information on allocated destination buffers
+ * @header_mb: buffer pointer of the encoded sequence header
  * @sequence:  counter for the sequence number for v4l2
  * @dec_dst_flag:  flags for buffers queued in the hardware
  * @dec_src_buf_size:  size of the buffer for source buffers in decoding
@@ -607,6 +608,7 @@ struct s5p_mfc_ctx {
int src_bufs_cnt;
struct s5p_mfc_buf dst_bufs[MFC_MAX_BUFFERS];
int dst_bufs_cnt;
+   struct s5p_mfc_buf *header_mb;
 
unsigned int sequence;
unsigned long dec_dst_flag;
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
index f8c7053..0c8d593e 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
@@ -787,7 +787,7 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx)
ctx-dst_queue_cnt--;
vb2_set_plane_payload(dst_mb-b, 0,
s5p_mfc_hw_call(dev-mfc_ops, get_enc_strm_size, dev));
-   vb2_buffer_done(dst_mb-b, VB2_BUF_STATE_DONE);
+   ctx-header_mb = dst_mb;
spin_unlock_irqrestore(dev-irqlock, flags);
}
 
@@ -845,6 +845,10 @@ static int enc_post_frame_start(struct s5p_mfc_ctx *ctx)
unsigned int strm_size;
unsigned long flags;
 
+   if (ctx-header_mb) {
+   vb2_buffer_done(ctx-header_mb-b, VB2_BUF_STATE_DONE);
+   ctx-header_mb = NULL;
+   }
slice_type = s5p_mfc_hw_call(dev-mfc_ops, get_enc_slice_type, dev);
strm_size = s5p_mfc_hw_call(dev-mfc_ops, get_enc_strm_size, dev);
mfc_debug(2, Encoded slice type: %d\n, slice_type);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [media] s5p-mfc: Update scratch buffer size for MPEG4

2014-05-14 Thread Arun Kumar K
Update the MPEG4 decoder scratch buffer size as per the
new v6 firmware. This updation is increasing the size and so
is backward compatible with older v6 firmwares.

Signed-off-by: Arun Kumar K arun...@samsung.com
---
 drivers/media/platform/s5p-mfc/regs-mfc-v6.h |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v6.h 
b/drivers/media/platform/s5p-mfc/regs-mfc-v6.h
index b47567c..fd04f84 100644
--- a/drivers/media/platform/s5p-mfc/regs-mfc-v6.h
+++ b/drivers/media/platform/s5p-mfc/regs-mfc-v6.h
@@ -382,8 +382,7 @@
 (DIV_ROUND_UP((mbw) * (mbh), 32) * 16))
 #define S5P_FIMV_SCRATCH_BUF_SIZE_H264_DEC_V6(w, h)(((w) * 192) + 64)
 #define S5P_FIMV_SCRATCH_BUF_SIZE_MPEG4_DEC_V6(w, h) \
-   ((w) * ((h) * 64 + 144) + (2048/16 * (h) * 64) + \
-(2048/16 * 256 + 8320))
+   ((w) * 144 + 8192 * (h) + 49216 + 1048576)
 #define S5P_FIMV_SCRATCH_BUF_SIZE_VC1_DEC_V6(w, h) \
(2096 * ((w) + (h) + 1))
 #define S5P_FIMV_SCRATCH_BUF_SIZE_H263_DEC_V6(w, h)((w) * 400)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 0/4] Add MFCv8 support

2014-05-14 Thread Arun Kumar K
This patchset adds MFCv8 support to the s5p-mfc driver.
MFCv8 has the same operation sequence as that of v6+, but
there is some shuffling of the registers happened. So to
re-use the exisiting code, register access uses context
variables instead of macros.
The patchset modifies opr_v6 file to use register variables
and is tested on mfc v5, v6, v7 and v8 based boards.

The patchset is based on the following set of patches
posted for MFC which are currently under review:

s5p-mfc: Update scratch buffer size for MPEG4
s5p-mfc: Add support for resolution change event
v4l: Add source change event
s5p-mfc: Don't try to resubmit VP8 bitstream buffer for decode.
s5p-mfc: Update scratch buffer size for VP8 encoder
s5p-mfc: Dequeue sequence header after STREAMON
s5p-mfc: Don't allocate codec buffers on STREAMON.
s5p-mfc: Extract open/close MFC instance commands.
s5p-mfc: Fixes for decode REQBUFS.
s5p-mfc: Copy timestamps only when a frame is produced.
s5p-mfc: add init buffer cmd to MFCV6
s5p-mfc: Add a control for IVF format for VP8 encoder

Changes from v1
- Included encoder support for v8 patch
- Addressed review comments from Kamil  Sachin
  https://patchwork.linuxtv.org/patch/23770/
  https://patchwork.linuxtv.org/patch/23768/

Arun Kumar K (1):
  [media] s5p-mfc: Rename IS_MFCV7 macro

Kiran AVND (3):
  [media] s5p-mfc: Add variants to access mfc registers
  [media] s5p-mfc: Core support to add v8 decoder
  [media] s5p-mfc: Core support for v8 encoder

 .../devicetree/bindings/media/s5p-mfc.txt  |3 +-
 drivers/media/platform/s5p-mfc/regs-mfc-v8.h   |  124 +++
 drivers/media/platform/s5p-mfc/s5p_mfc.c   |   33 +
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h|7 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c   |4 +
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c   |2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_opr.c   |6 +
 drivers/media/platform/s5p-mfc/s5p_mfc_opr.h   |  254 ++
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c|  849 +---
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.h|7 +-
 10 files changed, 1007 insertions(+), 282 deletions(-)
 create mode 100644 drivers/media/platform/s5p-mfc/regs-mfc-v8.h

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 4/4] [media] s5p-mfc: Core support for v8 encoder

2014-05-14 Thread Arun Kumar K
From: Kiran AVND avnd.ki...@samsung.com

This patch adds core support for v8 encoder. This
patch also adds register definitions and buffer size
requirements for H264  VP8 encoding, needed for new
firmware version v8 for MFC

Signed-off-by: Kiran AVND avnd.ki...@samsung.com
Signed-off-by: Pawel Osciak posc...@chromium.org
Signed-off-by: Arun Kumar K arun...@samsung.com
---
 drivers/media/platform/s5p-mfc/regs-mfc-v8.h|   30 +++
 drivers/media/platform/s5p-mfc/s5p_mfc.c|2 +
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |   61 +++
 3 files changed, 83 insertions(+), 10 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v8.h 
b/drivers/media/platform/s5p-mfc/regs-mfc-v8.h
index c84d120..cc7cbec 100644
--- a/drivers/media/platform/s5p-mfc/regs-mfc-v8.h
+++ b/drivers/media/platform/s5p-mfc/regs-mfc-v8.h
@@ -72,16 +72,46 @@
 /* SEI related information */
 #define S5P_FIMV_D_FRAME_PACK_SEI_AVAIL_V8 0xf6dc
 
+/* Encoder Registers */
+#define S5P_FIMV_E_FIXED_PICTURE_QP_V8 0xf794
+#define S5P_FIMV_E_RC_CONFIG_V80xf798
+#define S5P_FIMV_E_RC_QP_BOUND_V8  0xf79c
+#define S5P_FIMV_E_RC_RPARAM_V80xf7a4
+#define S5P_FIMV_E_MB_RC_CONFIG_V8 0xf7a8
+#define S5P_FIMV_E_PADDING_CTRL_V8 0xf7ac
+#define S5P_FIMV_E_MV_HOR_RANGE_V8 0xf7b4
+#define S5P_FIMV_E_MV_VER_RANGE_V8 0xf7b8
+
+#define S5P_FIMV_E_VBV_BUFFER_SIZE_V8  0xf78c
+#define S5P_FIMV_E_VBV_INIT_DELAY_V8   0xf790
+
+#define S5P_FIMV_E_ASPECT_RATIO_V8 0xfb4c
+#define S5P_FIMV_E_EXTENDED_SAR_V8 0xfb50
+#define S5P_FIMV_E_H264_OPTIONS_V8 0xfb54
+
 /* MFCv8 Context buffer sizes */
 #define MFC_CTX_BUF_SIZE_V8(30 * SZ_1K)/*  30KB */
 #define MFC_H264_DEC_CTX_BUF_SIZE_V8   (2 * SZ_1M) /*  2MB */
 #define MFC_OTHER_DEC_CTX_BUF_SIZE_V8  (20 * SZ_1K)/*  20KB */
+#define MFC_H264_ENC_CTX_BUF_SIZE_V8   (100 * SZ_1K)   /* 100KB */
+#define MFC_OTHER_ENC_CTX_BUF_SIZE_V8  (10 * SZ_1K)/*  10KB */
 
 /* Buffer size defines */
+#define S5P_FIMV_TMV_BUFFER_SIZE_V8(w, h)  (((w) + 1) * ((h) + 1) * 8)
+
 #define S5P_FIMV_SCRATCH_BUF_SIZE_H264_DEC_V8(w, h)(((w) * 704) + 2176)
 #define S5P_FIMV_SCRATCH_BUF_SIZE_VP8_DEC_V8(w, h) \
(((w) * 576 + (h) * 128)  + 4128)
 
+#define S5P_FIMV_SCRATCH_BUF_SIZE_H264_ENC_V8(w, h) \
+   (((w) * 592) + 2336)
+#define S5P_FIMV_SCRATCH_BUF_SIZE_VP8_ENC_V8(w, h) \
+   (((w) * 576) + 10512 + \
+   ((w) * 16) * ((h) * 16)) * 3) / 2) * 4))
+#define S5P_FIMV_ME_BUFFER_SIZE_V8(imw, imh, mbw, mbh) \
+   ((DIV_ROUND_UP((mbw * 16), 64) *  DIV_ROUND_UP((mbh * 16), 64) * 256) \
++ (DIV_ROUND_UP((mbw) * (mbh), 32) * 16))
+
 /* BUffer alignment defines */
 #define S5P_FIMV_D_ALIGN_PLANE_SIZE_V8 64
 
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index c8d7ba0..ea72502 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -1441,6 +1441,8 @@ struct s5p_mfc_buf_size_v6 mfc_buf_size_v8 = {
.dev_ctx= MFC_CTX_BUF_SIZE_V8,
.h264_dec_ctx   = MFC_H264_DEC_CTX_BUF_SIZE_V8,
.other_dec_ctx  = MFC_OTHER_DEC_CTX_BUF_SIZE_V8,
+   .h264_enc_ctx   = MFC_H264_ENC_CTX_BUF_SIZE_V8,
+   .other_enc_ctx  = MFC_OTHER_ENC_CTX_BUF_SIZE_V8,
 };
 
 struct s5p_mfc_buf_size buf_size_v8 = {
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
index eeaf122..43d0bb8 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
@@ -80,7 +80,12 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx 
*ctx)
  ctx-luma_size, ctx-chroma_size, ctx-mv_size);
mfc_debug(2, Totals bufs: %d\n, ctx-total_dpb_count);
} else if (ctx-type == MFCINST_ENCODER) {
-   ctx-tmv_buffer_size = S5P_FIMV_NUM_TMV_BUFFERS_V6 *
+   if (IS_MFCV8(dev))
+   ctx-tmv_buffer_size = S5P_FIMV_NUM_TMV_BUFFERS_V6 *
+   ALIGN(S5P_FIMV_TMV_BUFFER_SIZE_V8(mb_width, mb_height),
+   S5P_FIMV_TMV_BUFFER_ALIGN_V6);
+   else
+   ctx-tmv_buffer_size = S5P_FIMV_NUM_TMV_BUFFERS_V6 *
ALIGN(S5P_FIMV_TMV_BUFFER_SIZE_V6(mb_width, mb_height),
S5P_FIMV_TMV_BUFFER_ALIGN_V6);
 
@@ -90,10 +95,16 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct 
s5p_mfc_ctx *ctx)
ctx-chroma_dpb_size = ALIGN((mb_width * mb_height) *
S5P_FIMV_CHROMA_MB_TO_PIXEL_V6,
S5P_FIMV_CHROMA_DPB_BUFFER_ALIGN_V6);
-   ctx-me_buffer_size = ALIGN(S5P_FIMV_ME_BUFFER_SIZE_V6(
-   

[PATCH v2 2/4] [media] s5p-mfc: Rename IS_MFCV7 macro

2014-05-14 Thread Arun Kumar K
Renaming the IS_MFCV7 macro to IS_MFCV7_PLUS for the
addition of MFCv8 support which reuses the v7 code.

Signed-off-by: Arun Kumar K arun...@samsung.com
---
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h |2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c|2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |   14 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h 
b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
index 8d85590..7b7053d 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
@@ -706,6 +706,6 @@ void set_work_bit_irqsave(struct s5p_mfc_ctx *ctx);
(dev-variant-port_num ? 1 : 0) : 0) : 0)
 #define IS_TWOPORT(dev)(dev-variant-port_num == 2 ? 1 : 0)
 #define IS_MFCV6_PLUS(dev) (dev-variant-version = 0x60 ? 1 : 0)
-#define IS_MFCV7(dev)  (dev-variant-version = 0x70 ? 1 : 0)
+#define IS_MFCV7_PLUS(dev) (dev-variant-version = 0x70 ? 1 : 0)
 
 #endif /* S5P_MFC_COMMON_H_ */
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
index 0c8d593e..e7dddb0 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
@@ -1049,7 +1049,7 @@ static int vidioc_try_fmt(struct file *file, void *priv, 
struct v4l2_format *f)
return -EINVAL;
}
 
-   if (!IS_MFCV7(dev)  (fmt-fourcc == V4L2_PIX_FMT_VP8)) {
+   if (!IS_MFCV7_PLUS(dev)  (fmt-fourcc == V4L2_PIX_FMT_VP8)) {
mfc_err(VP8 is supported only in MFC v7\n);
return -EINVAL;
}
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
index 47890e8..9a503ca 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
@@ -116,7 +116,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct 
s5p_mfc_ctx *ctx)
(ctx-mv_count * ctx-mv_size);
break;
case S5P_MFC_CODEC_MPEG4_DEC:
-   if (IS_MFCV7(dev)) {
+   if (IS_MFCV7_PLUS(dev)) {
ctx-scratch_buf_size =
S5P_FIMV_SCRATCH_BUF_SIZE_MPEG4_DEC_V7(
mb_width,
@@ -357,7 +357,7 @@ static void s5p_mfc_enc_calc_src_size_v6(struct s5p_mfc_ctx 
*ctx)
ctx-chroma_size = ALIGN((mb_width * mb_height) * 128, 256);
 
/* MFCv7 needs pad bytes for Luma and Chroma */
-   if (IS_MFCV7(ctx-dev)) {
+   if (IS_MFCV7_PLUS(ctx-dev)) {
ctx-luma_size += MFC_LUMA_PAD_BYTES_V7;
ctx-chroma_size += MFC_CHROMA_PAD_BYTES_V7;
}
@@ -1283,7 +1283,7 @@ static int s5p_mfc_set_enc_params_vp8(struct s5p_mfc_ctx 
*ctx)
 /* Check if newer v6 firmware with changed init buffer interface */
 static bool s5p_mfc_is_v6_fw_v2(struct s5p_mfc_dev *dev)
 {
-   if (IS_MFCV7(dev))
+   if (IS_MFCV7_PLUS(dev))
return false;
/*
 * FW date is in BCD format xx120629. So checking for
@@ -1320,7 +1320,7 @@ static int s5p_mfc_init_decode_v6(struct s5p_mfc_ctx *ctx)
WRITEL(ctx-display_delay, mfc_regs-d_display_delay);
}
 
-   if (IS_MFCV7(dev) || s5p_mfc_is_v6_fw_v2(dev)) {
+   if (IS_MFCV7_PLUS(dev) || s5p_mfc_is_v6_fw_v2(dev)) {
WRITEL(reg, mfc_regs-d_dec_options);
reg = 0;
}
@@ -1335,7 +1335,7 @@ static int s5p_mfc_init_decode_v6(struct s5p_mfc_ctx *ctx)
if (ctx-dst_fmt-fourcc == V4L2_PIX_FMT_NV12MT_16X16)
reg |= (0x1  S5P_FIMV_D_OPT_TILE_MODE_SHIFT_V6);
 
-   if (IS_MFCV7(dev) || s5p_mfc_is_v6_fw_v2(dev))
+   if (IS_MFCV7_PLUS(dev) || s5p_mfc_is_v6_fw_v2(dev))
WRITEL(reg, mfc_regs-d_init_buffer_options);
else
WRITEL(reg, mfc_regs-d_dec_options);
@@ -1423,7 +1423,7 @@ static int s5p_mfc_init_encode_v6(struct s5p_mfc_ctx *ctx)
}
 
/* Set stride lengths for v7  above */
-   if (IS_MFCV7(dev)) {
+   if (IS_MFCV7_PLUS(dev)) {
WRITEL(ctx-img_width, mfc_regs-e_source_first_plane_stride);
WRITEL(ctx-img_width, mfc_regs-e_source_second_plane_stride);
}
@@ -2165,7 +2165,7 @@ const struct s5p_mfc_regs 
*s5p_mfc_init_regs_v6_plus(struct s5p_mfc_dev *dev)
R(e_h264_frame_packing_sei_info,
S5P_FIMV_E_H264_FRAME_PACKING_SEI_INFO_V6);
 
-   if (!IS_MFCV7(dev))
+   if (!IS_MFCV7_PLUS(dev))
goto done;
 
/* Initialize registers used in MFC v7 */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  

[PATCH v5 0/2] Add resolution change event

2014-05-14 Thread Arun Kumar K
This patchset adds a source_change event to the v4l2-events.
This can be used for notifying the userspace about runtime
format changes happening on video nodes / pads like resolution
change in video decoder.

Changes from v4
--
- Addressed comments from Hans
  https://patchwork.linuxtv.org/patch/23892/
  https://patchwork.linuxtv.org/patch/23893/

Changes from v3
--
- Addressed comments from Laurent / Hans
  https://patchwork.kernel.org/patch/4135731/

Changes from v2
---
- Event can be subscribed on specific pad / port as
  suggested by Hans.

Changes from v1
---
- Addressed review comments from Hans and Laurent
  https://patchwork.kernel.org/patch/4000951/

Arun Kumar K (1):
  [media] v4l: Add source change event

Pawel Osciak (1):
  [media] s5p-mfc: Add support for resolution change event

 Documentation/DocBook/media/v4l/vidioc-dqevent.xml |   33 ++
 .../DocBook/media/v4l/vidioc-subscribe-event.xml   |   20 +++
 drivers/media/platform/s5p-mfc/s5p_mfc.c   |8 +
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c   |2 ++
 drivers/media/v4l2-core/v4l2-event.c   |   36 
 include/media/v4l2-event.h |4 +++
 include/uapi/linux/videodev2.h |8 +
 7 files changed, 111 insertions(+)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 1/2] [media] v4l: Add source change event

2014-05-14 Thread Arun Kumar K
This event indicates that the video device has encountered
a source parameter change during runtime. This can typically be a
resolution change detected by a video decoder OR a format change
detected by an input connector.

This needs to be nofified to the userspace and the application may
be expected to reallocate buffers before proceeding. The application
can subscribe to events on a specific pad or input port which
it is interested in.

Signed-off-by: Arun Kumar K arun...@samsung.com
---
 Documentation/DocBook/media/v4l/vidioc-dqevent.xml |   33 ++
 .../DocBook/media/v4l/vidioc-subscribe-event.xml   |   20 +++
 drivers/media/v4l2-core/v4l2-event.c   |   36 
 include/media/v4l2-event.h |4 +++
 include/uapi/linux/videodev2.h |8 +
 5 files changed, 101 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml 
b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
index 89891ad..820f86e 100644
--- a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
@@ -242,6 +242,22 @@
   /tgroup
 /table
 
+table frame=none pgwide=1 id=v4l2-event-src-change
+  titlestruct structnamev4l2_event_src_change/structname/title
+  tgroup cols=3
+   cs-str;
+   tbody valign=top
+ row
+   entry__u32/entry
+   entrystructfieldchanges/structfield/entry
+   entry
+ A bitmask that tells what has changed. See xref 
linkend=src-changes-flags /.
+   /entry
+ /row
+   /tbody
+  /tgroup
+/table
+
 table pgwide=1 frame=none id=changes-flags
   titleChanges/title
   tgroup cols=3
@@ -270,6 +286,23 @@
/tbody
   /tgroup
 /table
+
+table pgwide=1 frame=none id=src-changes-flags
+  titleSource Changes/title
+  tgroup cols=3
+   cs-def;
+   tbody valign=top
+ row
+   entryconstantV4L2_EVENT_SRC_CH_RESOLUTION/constant/entry
+   entry0x0001/entry
+   entryThis event gets triggered when a resolution change is
+   detected at an input. This can come from an input connector or
+   from a video decoder.
+   /entry
+ /row
+   /tbody
+  /tgroup
+/table
   /refsect1
   refsect1
 return-value;
diff --git a/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml 
b/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml
index 5c70b61..f016254 100644
--- a/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml
@@ -155,6 +155,26 @@
/entry
  /row
  row
+   entryconstantV4L2_EVENT_SOURCE_CHANGE/constant/entry
+   entry5/entry
+   entry
+ paraThis event is triggered when a source parameter change is
+  detected during runtime by the video device. It can be a
+  runtime resolution change triggered by a video decoder or the
+  format change happening on an input connector.
+  This event requires that the structfieldid/structfield
+  matches the input index (when used with a video device node)
+  or the pad index (when used with a subdevice node) from which
+  you want to receive events./para
+
+  paraThis event has a v4l2-event-source-change; associated
+ with it. The structfieldchanges/structfield bitfield denotes
+ what has changed for the subscribed pad. If multiple events
+ occurred before application could dequeue them, then the changes
+ will have the ORed value of all the events generated./para
+   /entry
+ /row
+ row
entryconstantV4L2_EVENT_PRIVATE_START/constant/entry
entry0x0800/entry
entryBase event number for driver-private events./entry
diff --git a/drivers/media/v4l2-core/v4l2-event.c 
b/drivers/media/v4l2-core/v4l2-event.c
index 86dcb54..8761aab 100644
--- a/drivers/media/v4l2-core/v4l2-event.c
+++ b/drivers/media/v4l2-core/v4l2-event.c
@@ -318,3 +318,39 @@ int v4l2_event_subdev_unsubscribe(struct v4l2_subdev *sd, 
struct v4l2_fh *fh,
return v4l2_event_unsubscribe(fh, sub);
 }
 EXPORT_SYMBOL_GPL(v4l2_event_subdev_unsubscribe);
+
+static void v4l2_event_src_replace(struct v4l2_event *old,
+   const struct v4l2_event *new)
+{
+   u32 old_changes = old-u.src_change.changes;
+
+   old-u.src_change = new-u.src_change;
+   old-u.src_change.changes |= old_changes;
+}
+
+static void v4l2_event_src_merge(const struct v4l2_event *old,
+   struct v4l2_event *new)
+{
+   new-u.src_change.changes |= old-u.src_change.changes;
+}
+
+static const struct v4l2_subscribed_event_ops v4l2_event_src_ch_ops = {
+   .replace = 

[PATCH v5 2/2] [media] s5p-mfc: Add support for resolution change event

2014-05-14 Thread Arun Kumar K
From: Pawel Osciak posc...@chromium.org

When a resolution change point is reached, queue an event to signal the
userspace that a new set of buffers is required before decoding can
continue.

Signed-off-by: Pawel Osciak posc...@chromium.org
Signed-off-by: Arun Kumar K arun...@samsung.com
---
 drivers/media/platform/s5p-mfc/s5p_mfc.c |8 
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c |2 ++
 2 files changed, 10 insertions(+)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index 6b04f17..f3a4576 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -349,8 +349,16 @@ static void s5p_mfc_handle_frame(struct s5p_mfc_ctx *ctx,
/* All frames remaining in the buffer have been extracted  */
if (dst_frame_status == S5P_FIMV_DEC_STATUS_DECODING_EMPTY) {
if (ctx-state == MFCINST_RES_CHANGE_FLUSH) {
+   static const struct v4l2_event ev_src_ch = {
+   .type = V4L2_EVENT_SOURCE_CHANGE,
+   .u.src_change.changes =
+   V4L2_EVENT_SRC_CH_RESOLUTION,
+   };
+
s5p_mfc_handle_frame_all_extracted(ctx);
ctx-state = MFCINST_RES_CHANGE_END;
+   v4l2_event_queue_fh(ctx-fh, ev_src_ch);
+
goto leave_handle_frame;
} else {
s5p_mfc_handle_frame_all_extracted(ctx);
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
index 4586186..326d8db 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
@@ -851,6 +851,8 @@ static int vidioc_subscribe_event(struct v4l2_fh *fh,
switch (sub-type) {
case V4L2_EVENT_EOS:
return v4l2_event_subscribe(fh, sub, 2, NULL);
+   case V4L2_EVENT_SOURCE_CHANGE:
+   return v4l2_src_change_event_subscribe(fh, sub);
default:
return -EINVAL;
}
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] [media] s5p-mfc: Dequeue sequence header after STREAMON

2014-05-14 Thread Hans Verkuil
On 05/14/2014 08:29 AM, Arun Kumar K wrote:
 MFCv6 encoder needs specific minimum number of buffers to
 be queued in the CAPTURE plane. This minimum number will
 be known only when the sequence header is generated.
 So we used to allow STREAMON on the CAPTURE plane only after
 sequence header is generated and checked with the minimum
 buffer requirement.
 
 But this causes a problem that we call a vb2_buffer_done
 for the sequence header buffer before doing a STREAON on the
 CAPTURE plane. 

How could this ever have worked? Buffers aren't queued to the driver until
STREAMON is called, and calling vb2_buffer_done for a buffer that is not queued
first to the driver will mess up internal data (q-queued_count for one).

 This used to still work fine until this patch
 was merged -
 b3379c6 : vb2: only call start_streaming if sufficient buffers are queued

Are you testing with CONFIG_VIDEO_ADV_DEBUG set? If not, you should do so. That
will check whether all the vb2 calls are balanced.

BTW, that's a small typo in s5p_mfc_enc.c (search for 'inavlid').

 This problem should also come in earlier MFC firmware versions
 if the application calls STREAMON on CAPTURE with some delay
 after doing STREAMON on OUTPUT.

You can also play around with the min_buffers_needed field. My rule-of-thumb is 
that
when start_streaming is called everything should be ready to stream. It is 
painful
for drivers to have to keep track of the 'do I have enough buffers' status.

For that reason I introduced the min_buffers_needed field. What I believe you 
can
do here is to set it initially to a large value, preventing start_streaming from
being called, and once you really know the minimum number of buffers that you 
need
it can be updated again to the actual value.

I don't know this driver well enough to tell whether that works here or not, but
it is worth looking at IMHO.

Regards,

Hans

 So this patch keeps the header buffer until the other frame
 buffers are ready and dequeues it just before the first frame
 is ready.
 
 Signed-off-by: Arun Kumar K arun...@samsung.com
 ---
 Changes from v1
 - Addressed review comments from Sachin
   https://patchwork.linuxtv.org/patch/23839/
 ---
  drivers/media/platform/s5p-mfc/s5p_mfc_common.h |2 ++
  drivers/media/platform/s5p-mfc/s5p_mfc_enc.c|6 +-
  2 files changed, 7 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h 
 b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
 index f5404a6..cc2b96e 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
 @@ -523,6 +523,7 @@ struct s5p_mfc_codec_ops {
   * @output_state:state of the output buffers queue
   * @src_bufs:information on allocated source buffers
   * @dst_bufs:information on allocated destination buffers
 + * @header_mb:   buffer pointer of the encoded sequence header
   * @sequence:counter for the sequence number for v4l2
   * @dec_dst_flag:flags for buffers queued in the hardware
   * @dec_src_buf_size:size of the buffer for source buffers in 
 decoding
 @@ -607,6 +608,7 @@ struct s5p_mfc_ctx {
   int src_bufs_cnt;
   struct s5p_mfc_buf dst_bufs[MFC_MAX_BUFFERS];
   int dst_bufs_cnt;
 + struct s5p_mfc_buf *header_mb;
  
   unsigned int sequence;
   unsigned long dec_dst_flag;
 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c 
 b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 index f8c7053..0c8d593e 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 @@ -787,7 +787,7 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx)
   ctx-dst_queue_cnt--;
   vb2_set_plane_payload(dst_mb-b, 0,
   s5p_mfc_hw_call(dev-mfc_ops, get_enc_strm_size, dev));
 - vb2_buffer_done(dst_mb-b, VB2_BUF_STATE_DONE);
 + ctx-header_mb = dst_mb;
   spin_unlock_irqrestore(dev-irqlock, flags);
   }
  
 @@ -845,6 +845,10 @@ static int enc_post_frame_start(struct s5p_mfc_ctx *ctx)
   unsigned int strm_size;
   unsigned long flags;
  
 + if (ctx-header_mb) {
 + vb2_buffer_done(ctx-header_mb-b, VB2_BUF_STATE_DONE);
 + ctx-header_mb = NULL;
 + }
   slice_type = s5p_mfc_hw_call(dev-mfc_ops, get_enc_slice_type, dev);
   strm_size = s5p_mfc_hw_call(dev-mfc_ops, get_enc_strm_size, dev);
   mfc_debug(2, Encoded slice type: %d\n, slice_type);
 

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 0/2] Add resolution change event

2014-05-14 Thread Hans Verkuil
On 05/14/2014 08:59 AM, Arun Kumar K wrote:
 This patchset adds a source_change event to the v4l2-events.
 This can be used for notifying the userspace about runtime
 format changes happening on video nodes / pads like resolution
 change in video decoder.

Looks good. I'll merge this after the weekend if there are no more comments.

Regards,

Hans

 
 Changes from v4
 --
 - Addressed comments from Hans
   https://patchwork.linuxtv.org/patch/23892/
   https://patchwork.linuxtv.org/patch/23893/
 
 Changes from v3
 --
 - Addressed comments from Laurent / Hans
   https://patchwork.kernel.org/patch/4135731/
 
 Changes from v2
 ---
 - Event can be subscribed on specific pad / port as
   suggested by Hans.
 
 Changes from v1
 ---
 - Addressed review comments from Hans and Laurent
   https://patchwork.kernel.org/patch/4000951/
 
 Arun Kumar K (1):
   [media] v4l: Add source change event
 
 Pawel Osciak (1):
   [media] s5p-mfc: Add support for resolution change event
 
  Documentation/DocBook/media/v4l/vidioc-dqevent.xml |   33 ++
  .../DocBook/media/v4l/vidioc-subscribe-event.xml   |   20 +++
  drivers/media/platform/s5p-mfc/s5p_mfc.c   |8 +
  drivers/media/platform/s5p-mfc/s5p_mfc_dec.c   |2 ++
  drivers/media/v4l2-core/v4l2-event.c   |   36 
 
  include/media/v4l2-event.h |4 +++
  include/uapi/linux/videodev2.h |8 +
  7 files changed, 111 insertions(+)
 

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 3/3] ARM: sunxi: Add IR controller support in DT on A20

2014-05-14 Thread Maxime Ripard
On Wed, May 14, 2014 at 12:39:02AM +0600, Alexander Bersenev wrote:
 This patch adds IR controller in A20 Device-Tree:
 - Two IR devices found in A20 user manual
 - Pins for two devices
 - One IR device physically found on Cubieboard 2
 - One IR device physically found on Cubietruck
 
 Signed-off-by: Alexander Bersenev b...@hackerdom.ru
 Signed-off-by: Alexsey Shestacov wingr...@linux-sunxi.org
 ---
  arch/arm/boot/dts/sun7i-a20-cubieboard2.dts |  6 ++
  arch/arm/boot/dts/sun7i-a20-cubietruck.dts  |  6 ++
  arch/arm/boot/dts/sun7i-a20.dtsi| 31 
 +
  3 files changed, 43 insertions(+)
 
 diff --git a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts 
 b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
 index feeff64..2564e8c 100644
 --- a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
 +++ b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
 @@ -164,6 +164,12 @@
   reg = 1;
   };
   };
 +
 + ir0: ir@01c21800 {
 + pinctrl-names = default;
 + pinctrl-0 = ir0_pins_a;
 + status = okay;
 + };
   };
  
   leds {
 diff --git a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts 
 b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
 index e288562..e375e89 100644
 --- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
 +++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
 @@ -232,6 +232,12 @@
   reg = 1;
   };
   };
 +
 + ir0: ir@01c21800 {
 + pinctrl-names = default;
 + pinctrl-0 = ir0_pins_a;
 + status = okay;
 + };
   };
  
   leds {

Please make these two changes a separate patch.

 diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi 
 b/arch/arm/boot/dts/sun7i-a20.dtsi
 index 0ae2b77..40ded74 100644
 --- a/arch/arm/boot/dts/sun7i-a20.dtsi
 +++ b/arch/arm/boot/dts/sun7i-a20.dtsi
 @@ -724,6 +724,19 @@
   allwinner,drive = 2;
   allwinner,pull = 0;
   };
 +
 + ir0_pins_a: ir0@0 {
 + allwinner,pins = PB3,PB4;
 + allwinner,function = ir0;
 + allwinner,drive = 0;
 + allwinner,pull = 0;
 + };

Extra line

 + ir1_pins_a: ir1@0 {
 + allwinner,pins = PB22,PB23;
 + allwinner,function = ir1;
 + allwinner,drive = 0;
 + allwinner,pull = 0;
 + };
   };

Do you use ir1_pins_a at all?

I also prefer whenever such additions are in a patch of their own.

   timer@01c20c00 {
 @@ -937,5 +950,23 @@
   #interrupt-cells = 3;
   interrupts = 1 9 0xf04;
   };
 +
 + ir0: ir@01c21800 {
 + compatible = allwinner,sun7i-a20-ir;
 + clocks = apb0_gates 6, ir0_clk;
 + clock-names = apb, ir;
 + interrupts = 0 5 4;
 + reg = 0x01c21800 0x40;
 + status = disabled;
 + };
 +
 + ir1: ir@01c21c00 {
 + compatible = allwinner,sun7i-a20-ir;
 + clocks = apb0_gates 7, ir1_clk;
 + clock-names = apb, ir;
 + interrupts = 0 6 4;
 + reg = 0x01C21c00 0x40;

You're mixing upper and lower case letters here, please make it lower
case.

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature


Re: [PATCH v2] [media] s5p-mfc: Dequeue sequence header after STREAMON

2014-05-14 Thread Arun Kumar K
Hi Hans,

On 05/14/14 12:39, Hans Verkuil wrote:
 On 05/14/2014 08:29 AM, Arun Kumar K wrote:
 MFCv6 encoder needs specific minimum number of buffers to
 be queued in the CAPTURE plane. This minimum number will
 be known only when the sequence header is generated.
 So we used to allow STREAMON on the CAPTURE plane only after
 sequence header is generated and checked with the minimum
 buffer requirement.

 But this causes a problem that we call a vb2_buffer_done
 for the sequence header buffer before doing a STREAON on the
 CAPTURE plane. 
 
 How could this ever have worked? Buffers aren't queued to the driver until
 STREAMON is called, and calling vb2_buffer_done for a buffer that is not 
 queued
 first to the driver will mess up internal data (q-queued_count for one).
 

This worked till now because __enqueue_in_driver is called first and
then start_streaming qop is called. In MFCv6, the start_streaming driver
callback used to wait till sequence header interrupt is received and it
used to do vb2_buffer_done in that interrupt context. So it happened
after buffers are enqueued in driver and before completing the vb2_streamon.

 This used to still work fine until this patch
 was merged -
 b3379c6 : vb2: only call start_streaming if sufficient buffers are queued
 
 Are you testing with CONFIG_VIDEO_ADV_DEBUG set? If not, you should do so. 
 That
 will check whether all the vb2 calls are balanced.
 
 BTW, that's a small typo in s5p_mfc_enc.c (search for 'inavlid').
 

I got it. Will post a patch fixing them. Thanks for spotting this.

 This problem should also come in earlier MFC firmware versions
 if the application calls STREAMON on CAPTURE with some delay
 after doing STREAMON on OUTPUT.
 
 You can also play around with the min_buffers_needed field. My rule-of-thumb 
 is that
 when start_streaming is called everything should be ready to stream. It is 
 painful
 for drivers to have to keep track of the 'do I have enough buffers' status.
 
 For that reason I introduced the min_buffers_needed field. What I believe you 
 can
 do here is to set it initially to a large value, preventing start_streaming 
 from
 being called, and once you really know the minimum number of buffers that you 
 need
 it can be updated again to the actual value.

If a large value is kept in min_buffers_needed, there will be some
unnecessary memory initialization needed for say 16 full HD raw YUV
buffers when actual needed is only 4. And once the encoding is started,
updating the min_buffers_needed to actual value doesnt give any
advantage as nobody checks for it after that.
So the whole idea is to not enforce a worst case buffer allocation
requirement beforehand itself. I hope the current scheme of things works
well for the requirement.

Regards
Arun

 
 I don't know this driver well enough to tell whether that works here or not, 
 but
 it is worth looking at IMHO.
 
 Regards,
 
   Hans
 
 So this patch keeps the header buffer until the other frame
 buffers are ready and dequeues it just before the first frame
 is ready.

 Signed-off-by: Arun Kumar K arun...@samsung.com
 ---
 Changes from v1
 - Addressed review comments from Sachin
   https://patchwork.linuxtv.org/patch/23839/
 ---
  drivers/media/platform/s5p-mfc/s5p_mfc_common.h |2 ++
  drivers/media/platform/s5p-mfc/s5p_mfc_enc.c|6 +-
  2 files changed, 7 insertions(+), 1 deletion(-)

 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h 
 b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
 index f5404a6..cc2b96e 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
 @@ -523,6 +523,7 @@ struct s5p_mfc_codec_ops {
   * @output_state:   state of the output buffers queue
   * @src_bufs:   information on allocated source buffers
   * @dst_bufs:   information on allocated destination buffers
 + * @header_mb:  buffer pointer of the encoded sequence header
   * @sequence:   counter for the sequence number for v4l2
   * @dec_dst_flag:   flags for buffers queued in the hardware
   * @dec_src_buf_size:   size of the buffer for source buffers in 
 decoding
 @@ -607,6 +608,7 @@ struct s5p_mfc_ctx {
  int src_bufs_cnt;
  struct s5p_mfc_buf dst_bufs[MFC_MAX_BUFFERS];
  int dst_bufs_cnt;
 +struct s5p_mfc_buf *header_mb;
  
  unsigned int sequence;
  unsigned long dec_dst_flag;
 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c 
 b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 index f8c7053..0c8d593e 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 @@ -787,7 +787,7 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx)
  ctx-dst_queue_cnt--;
  vb2_set_plane_payload(dst_mb-b, 0,
  s5p_mfc_hw_call(dev-mfc_ops, get_enc_strm_size, dev));
 -vb2_buffer_done(dst_mb-b, VB2_BUF_STATE_DONE);
 +

Re: [PATCH v5 2/2] [media] s5p-mfc: Add support for resolution change event

2014-05-14 Thread Sylwester Nawrocki
On 14/05/14 08:59, Arun Kumar K wrote:
 From: Pawel Osciak posc...@chromium.org
 
 When a resolution change point is reached, queue an event to signal the
 userspace that a new set of buffers is required before decoding can
 continue.
 
 Signed-off-by: Pawel Osciak posc...@chromium.org
 Signed-off-by: Arun Kumar K arun...@samsung.com

Acked-by: Sylwester Nawrocki s.nawro...@samsung.com

 ---
  drivers/media/platform/s5p-mfc/s5p_mfc.c |8 
  drivers/media/platform/s5p-mfc/s5p_mfc_dec.c |2 ++
  2 files changed, 10 insertions(+)
 
 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c 
 b/drivers/media/platform/s5p-mfc/s5p_mfc.c
 index 6b04f17..f3a4576 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
 @@ -349,8 +349,16 @@ static void s5p_mfc_handle_frame(struct s5p_mfc_ctx *ctx,
   /* All frames remaining in the buffer have been extracted  */
   if (dst_frame_status == S5P_FIMV_DEC_STATUS_DECODING_EMPTY) {
   if (ctx-state == MFCINST_RES_CHANGE_FLUSH) {
 + static const struct v4l2_event ev_src_ch = {
 + .type = V4L2_EVENT_SOURCE_CHANGE,
 + .u.src_change.changes =
 + V4L2_EVENT_SRC_CH_RESOLUTION,
 + };
 +
   s5p_mfc_handle_frame_all_extracted(ctx);
   ctx-state = MFCINST_RES_CHANGE_END;
 + v4l2_event_queue_fh(ctx-fh, ev_src_ch);
 +
   goto leave_handle_frame;
   } else {
   s5p_mfc_handle_frame_all_extracted(ctx);
 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c 
 b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
 index 4586186..326d8db 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
 @@ -851,6 +851,8 @@ static int vidioc_subscribe_event(struct v4l2_fh *fh,
   switch (sub-type) {
   case V4L2_EVENT_EOS:
   return v4l2_event_subscribe(fh, sub, 2, NULL);
 + case V4L2_EVENT_SOURCE_CHANGE:
 + return v4l2_src_change_event_subscribe(fh, sub);
   default:
   return -EINVAL;
   }
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v5 2/2] [media] s5p-mfc: Add support for resolution change event

2014-05-14 Thread Kamil Debski
Hi,

Thank you for this patch.

 From: Arun Kumar K [mailto:arunkk.sams...@gmail.com] On Behalf Of Arun
 Kumar K
 Sent: Wednesday, May 14, 2014 9:00 AM
 To: linux-media@vger.kernel.org; linux-samsung-...@vger.kernel.org
 Cc: k.deb...@samsung.com; s.nawro...@samsung.com; hverk...@xs4all.nl;
 laurent.pinch...@ideasonboard.com; posc...@chromium.org;
 arunkk.sams...@gmail.com
 Subject: [PATCH v5 2/2] [media] s5p-mfc: Add support for resolution
 change event
 
 From: Pawel Osciak posc...@chromium.org
 
 When a resolution change point is reached, queue an event to signal the
 userspace that a new set of buffers is required before decoding can
 continue.
 
 Signed-off-by: Pawel Osciak posc...@chromium.org
 Signed-off-by: Arun Kumar K arun...@samsung.com

Acked-by: Kamil Debski k.deb...@samsung.com

 ---
  drivers/media/platform/s5p-mfc/s5p_mfc.c |8 
  drivers/media/platform/s5p-mfc/s5p_mfc_dec.c |2 ++
  2 files changed, 10 insertions(+)
 
 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c
 b/drivers/media/platform/s5p-mfc/s5p_mfc.c
 index 6b04f17..f3a4576 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
 @@ -349,8 +349,16 @@ static void s5p_mfc_handle_frame(struct
 s5p_mfc_ctx *ctx,
   /* All frames remaining in the buffer have been extracted  */
   if (dst_frame_status == S5P_FIMV_DEC_STATUS_DECODING_EMPTY) {
   if (ctx-state == MFCINST_RES_CHANGE_FLUSH) {
 + static const struct v4l2_event ev_src_ch = {
 + .type = V4L2_EVENT_SOURCE_CHANGE,
 + .u.src_change.changes =
 + V4L2_EVENT_SRC_CH_RESOLUTION,
 + };
 +
   s5p_mfc_handle_frame_all_extracted(ctx);
   ctx-state = MFCINST_RES_CHANGE_END;
 + v4l2_event_queue_fh(ctx-fh, ev_src_ch);
 +
   goto leave_handle_frame;
   } else {
   s5p_mfc_handle_frame_all_extracted(ctx);
 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
 b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
 index 4586186..326d8db 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
 @@ -851,6 +851,8 @@ static int vidioc_subscribe_event(struct v4l2_fh
 *fh,
   switch (sub-type) {
   case V4L2_EVENT_EOS:
   return v4l2_event_subscribe(fh, sub, 2, NULL);
 + case V4L2_EVENT_SOURCE_CHANGE:
 + return v4l2_src_change_event_subscribe(fh, sub);
   default:
   return -EINVAL;
   }
 --
 1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[linuxtv-media:master 499/499] powercap_sys.c:undefined reference to `__media_device_register'

2014-05-14 Thread Fengguang Wu
Hi Mauro,

It's probably a bug fix that unveils the link errors.

tree:   git://linuxtv.org/media_tree.git master
head:   ba0d342ecc21fbbe2f6c178f4479944d1fb34f3b
commit: ba0d342ecc21fbbe2f6c178f4479944d1fb34f3b [499/499] saa7134-alsa: 
include vmalloc.h
config: make ARCH=arm allmodconfig

All error/warnings:

   drivers/built-in.o: In function `iss_unregister_entities':
   powercap_sys.c:(.text+0x142ef0): undefined reference to 
`v4l2_device_unregister'
   powercap_sys.c:(.text+0x142ef8): undefined reference to 
`media_device_unregister'
   drivers/built-in.o: In function `iss_initialize_modules':
   powercap_sys.c:(.text+0x143550): undefined reference to 
`media_entity_create_link'
   powercap_sys.c:(.text+0x143574): undefined reference to 
`media_entity_create_link'
   powercap_sys.c:(.text+0x14359c): undefined reference to 
`media_entity_create_link'
   powercap_sys.c:(.text+0x1435c4): undefined reference to 
`media_entity_create_link'
   powercap_sys.c:(.text+0x1435e4): undefined reference to 
`media_entity_create_link'
   drivers/built-in.o: In function `iss_register_subdev_group':
   powercap_sys.c:(.text+0x1436a8): undefined reference to 
`v4l2_i2c_new_subdev_board'
   drivers/built-in.o: In function `iss_register_entities':
 powercap_sys.c:(.text+0x143754): undefined reference to 
 `__media_device_register'
   powercap_sys.c:(.text+0x143784): undefined reference to 
`v4l2_device_register'
   powercap_sys.c:(.text+0x143878): undefined reference to 
`media_entity_create_link'
   powercap_sys.c:(.text+0x1438a0): undefined reference to 
`v4l2_device_register_subdev_nodes'
   drivers/built-in.o: In function `iss_pipeline_pm_use_count':
   powercap_sys.c:(.text+0x1438fc): undefined reference to 
`media_entity_graph_walk_start'
   powercap_sys.c:(.text+0x143920): undefined reference to 
`media_entity_graph_walk_next'
   drivers/built-in.o: In function `iss_pipeline_pm_power':
   powercap_sys.c:(.text+0x143a94): undefined reference to 
`media_entity_graph_walk_start'
   powercap_sys.c:(.text+0x143ac0): undefined reference to 
`media_entity_graph_walk_next'
   powercap_sys.c:(.text+0x143adc): undefined reference to 
`media_entity_graph_walk_start'
   powercap_sys.c:(.text+0x143b04): undefined reference to 
`media_entity_graph_walk_next'
   drivers/built-in.o: In function `iss_pipeline_disable':
   powercap_sys.c:(.text+0x143e40): undefined reference to 
`media_entity_remote_pad'
   drivers/built-in.o: In function `iss_pipeline_enable':
   powercap_sys.c:(.text+0x143f60): undefined reference to 
`media_entity_remote_pad'
   drivers/built-in.o: In function `omap4iss_get_external_info':
   powercap_sys.c:(.text+0x144234): undefined reference to `v4l2_ctrl_find'
   powercap_sys.c:(.text+0x144258): undefined reference to 
`v4l2_ctrl_g_ctrl_int64'
   drivers/built-in.o: In function `omap4iss_module_sync_idle':
   powercap_sys.c:(.text+0x1444c4): undefined reference to 
`media_entity_remote_pad'
   drivers/built-in.o: In function `csi2_link_validate':
   powercap_sys.c:(.text+0x144d0c): undefined reference to 
`v4l2_subdev_link_validate_default'
   drivers/built-in.o: In function `csi2_init_entities':
   powercap_sys.c:(.text+0x146014): undefined reference to `v4l2_subdev_init'
   powercap_sys.c:(.text+0x14607c): undefined reference to `media_entity_init'
   powercap_sys.c:(.text+0x1460f4): undefined reference to 
`media_entity_create_link'
   powercap_sys.c:(.text+0x146110): undefined reference to 
`media_entity_cleanup'
   drivers/built-in.o: In function `csi2_configure':
   powercap_sys.c:(.text+0x146414): undefined reference to 
`media_entity_remote_pad'
   drivers/built-in.o: In function `omap4iss_csi2_unregister_entities':
   powercap_sys.c:(.text+0x146ac0): undefined reference to 
`v4l2_device_unregister_subdev'
   drivers/built-in.o: In function `omap4iss_csi2_register_entities':
   powercap_sys.c:(.text+0x146af4): undefined reference to 
`v4l2_device_register_subdev'
   drivers/built-in.o: In function `omap4iss_csi2_cleanup':
   powercap_sys.c:(.text+0x146c40): undefined reference to 
`media_entity_cleanup'
   powercap_sys.c:(.text+0x146c54): undefined reference to 
`media_entity_cleanup'
   drivers/built-in.o: In function `ipipeif_init_entities':
   powercap_sys.c:(.text+0x1483fc): undefined reference to `v4l2_subdev_init'
   powercap_sys.c:(.text+0x148458): undefined reference to `media_entity_init'
   powercap_sys.c:(.text+0x1484cc): undefined reference to 
`media_entity_create_link'
   drivers/built-in.o: In function `omap4iss_ipipeif_unregister_entities':
   powercap_sys.c:(.text+0x1485f0): undefined reference to 
`media_entity_cleanup'
   powercap_sys.c:(.text+0x1485f8): undefined reference to 
`v4l2_device_unregister_subdev'
   drivers/built-in.o: In function `omap4iss_ipipeif_register_entities':
   powercap_sys.c:(.text+0x14862c): undefined reference to 
`v4l2_device_register_subdev'
   drivers/built-in.o: In function `omap4iss_ipipe_unregister_entities':
   powercap_sys.c:(.text+0x149220): 

Re: [PATCH 3/3] media: mx2-emmaprp: Add devicetree support

2014-05-14 Thread Sylwester Nawrocki
On 13/05/14 19:23, Alexander Shiyan wrote:
 Tue, 13 May 2014 19:09:30 +0200 от Sylwester Nawrocki 
 s.nawro...@samsung.com:
  Hi,
  
  On 02/05/14 09:18, Alexander Shiyan wrote:
   This patch adds devicetree support for the Freescale enhanced Multimedia
   Accelerator (eMMA) video Pre-processor (PrP).
   
   Signed-off-by: Alexander Shiyan shc_w...@mail.ru
   ---
.../devicetree/bindings/media/fsl-imx-emmaprp.txt | 19 
   +++
drivers/media/platform/mx2_emmaprp.c  |  8 
2 files changed, 27 insertions(+)
create mode 100644 
   Documentation/devicetree/bindings/media/fsl-imx-emmaprp.txt
   
   diff --git 
   a/Documentation/devicetree/bindings/media/fsl-imx-emmaprp.txt 
   b/Documentation/devicetree/bindings/media/fsl-imx-emmaprp.txt
   new file mode 100644
   index 000..9e8238f
   --- /dev/null
   +++ b/Documentation/devicetree/bindings/media/fsl-imx-emmaprp.txt
   @@ -0,0 +1,19 @@
   +* Freescale enhanced Multimedia Accelerator (eMMA) video Pre-processor 
   (PrP)
   +  for i.MX.
   +
   +Required properties:
   +- compatible : Shall contain fsl,imx21-emmaprp.
   +- reg: Offset and length of the register set for the device.
   +- interrupts : Should contain eMMA PrP interrupt number.
   +- clocks : Should contain the ahb and ipg clocks, in the order
   +   determined by the clock-names property.
   +- clock-names: Should be ahb, ipg.
   +
   +Example:
   +   emmaprp: emmaprp@10026400 {
   +   compatible = fsl,imx27-emmaprp, fsl,imx21-emmaprp;
  
  Is fsl,imx27-emmaprp compatible documented somewhere ?

 The overall structure of the eMMA module is slightly different.
 As for the part of the PrP, according to the datasheet they are compatible.

Then can we please have all the valid compatible strings listed at the
'compatible' property's description above ? I think it is useful to have
an indication to which SoC each of them apply in documentation of the
binding.

--
Thanks,
Sylwester
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


regression: firmware loading for dvico dual digital 4

2014-05-14 Thread Vincent McIntyre
Hi,

Antti asked me to report this.

I built the latest media_build git on Ubuntu 12.04, with 3.8.0 kernel,
using './build --main-git'.
The attached tarball has the relvant info.

Without the media_build modules, firmware loads fine (file dmesg.1)
Once I build and install the media_build modules, the firmware no
longer loads. (dmesg.2)

The firmware loading issue appears to have been reported to ubuntu (a
later kernel, 3.11)  with a possible fix proposed, see
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1291459

I can post lspci etc details if people want.

Kind regards
VInce


dmesg.tar.xz
Description: Binary data


Re: regression: firmware loading for dvico dual digital 4

2014-05-14 Thread Antti Palosaari

Mauro,

Bug is that:
kernel: [ 37.360226] cxusb: i2c wr: len=64 is too big!

I suspect that this is coming from your dynamic stack allocation patch 
set - as there has been very many similar looking bug reports earlier. 
Didn't analyzed it any deeply.


regards
Antti


On 05/14/2014 02:30 PM, Vincent McIntyre wrote:

Hi,

Antti asked me to report this.

I built the latest media_build git on Ubuntu 12.04, with 3.8.0 kernel,
using './build --main-git'.
The attached tarball has the relvant info.

Without the media_build modules, firmware loads fine (file dmesg.1)
Once I build and install the media_build modules, the firmware no
longer loads. (dmesg.2)

The firmware loading issue appears to have been reported to ubuntu (a
later kernel, 3.11)  with a possible fix proposed, see
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1291459

I can post lspci etc details if people want.

Kind regards
VInce




--
http://palosaari.fi/
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 3/3] ARM: sunxi: Add IR controller support in DT on A20

2014-05-14 Thread Hans de Goede
Hi,

snip

On 05/13/2014 08:39 PM, Alexander Bersenev wrote:
 diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi 
 b/arch/arm/boot/dts/sun7i-a20.dtsi
 index 0ae2b77..40ded74 100644
 --- a/arch/arm/boot/dts/sun7i-a20.dtsi
 +++ b/arch/arm/boot/dts/sun7i-a20.dtsi
 @@ -724,6 +724,19 @@
   allwinner,drive = 2;
   allwinner,pull = 0;
   };
 +
 + ir0_pins_a: ir0@0 {
 + allwinner,pins = PB3,PB4;
 + allwinner,function = ir0;
 + allwinner,drive = 0;
 + allwinner,pull = 0;
 + };
 + ir1_pins_a: ir1@0 {
 + allwinner,pins = PB22,PB23;
 + allwinner,function = ir1;
 + allwinner,drive = 0;
 + allwinner,pull = 0;
 + };
   };
  
   timer@01c20c00 {
 @@ -937,5 +950,23 @@
   #interrupt-cells = 3;
   interrupts = 1 9 0xf04;
   };
 +
 + ir0: ir@01c21800 {
 + compatible = allwinner,sun7i-a20-ir;
 + clocks = apb0_gates 6, ir0_clk;
 + clock-names = apb, ir;
 + interrupts = 0 5 4;
 + reg = 0x01c21800 0x40;
 + status = disabled;
 + };
 +
 + ir1: ir@01c21c00 {
 + compatible = allwinner,sun7i-a20-ir;
 + clocks = apb0_gates 7, ir1_clk;
 + clock-names = apb, ir;
 + interrupts = 0 6 4;
 + reg = 0x01C21c00 0x40;
 + status = disabled;
 + };
   };
  };
 

The entries in the soc block are sorted by register address, so please
don't add these at the end, instead keep things sorted.

Regards,

Hans
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] [media] s5p-mfc: Add a control for IVF format for VP8 encoder

2014-05-14 Thread Kamil Debski
Hi Pawel, Hans,

I think we talked some time ago on IRC about this patch.
If I remember correctly, the conclusion was that it would be better to use
a specific pixel formats for this kind of out codec output.

Akin to:
V4L2_PIX_FMT_H264   'H264'  H264 video elementary stream
with start codes.
V4L2_PIX_FMT_H264_NO_SC 'AVC1'  H264 video elementary stream without
start codes.

Could you confirm this?

Best wishes,
-- 
Kamil Debski
Samsung RD Institute Poland


 -Original Message-
 From: Arun Kumar K [mailto:arunkk.sams...@gmail.com] On Behalf Of Arun
 Kumar K
 Sent: Thursday, March 06, 2014 7:04 AM
 To: linux-media@vger.kernel.org; linux-samsung-...@vger.kernel.org
 Cc: k.deb...@samsung.com; s.nawro...@samsung.com; posc...@chromium.org;
 arunkk.sams...@gmail.com
 Subject: [PATCH] [media] s5p-mfc: Add a control for IVF format for VP8
 encoder
 
 From: Pawel Osciak posc...@chromium.org
 
 Add a control to enable/disable IVF output stream format for VP8 encode.
 Set the IVF format output to disabled as default.
 
 Signed-off-by: Pawel Osciak posc...@chromium.org
 Signed-off-by: Arun Kumar K arun...@samsung.com
 ---
  Documentation/DocBook/media/v4l/controls.xml|8 
  drivers/media/platform/s5p-mfc/s5p_mfc_common.h |1 +
  drivers/media/platform/s5p-mfc/s5p_mfc_enc.c|   11 +++
  drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |2 ++
  drivers/media/v4l2-core/v4l2-ctrls.c|1 +
  include/uapi/linux/v4l2-controls.h  |1 +
  6 files changed, 24 insertions(+)
 
 diff --git a/Documentation/DocBook/media/v4l/controls.xml
 b/Documentation/DocBook/media/v4l/controls.xml
 index 0e1770c..07fb64a 100644
 --- a/Documentation/DocBook/media/v4l/controls.xml
 +++ b/Documentation/DocBook/media/v4l/controls.xml
 @@ -3222,6 +3222,14 @@ V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD
 as a golden frame./entry  Acceptable values are 0, 1, 2 and 3
 corresponding to encoder profiles 0, 1, 2 and 3./entry
 /row
 
 +   rowentry/entry/row
 +   row
 + entry
 spanname=idconstantV4L2_CID_MPEG_VIDEO_VPX_IVF_FORMAT/constantn
 bsp;/entry
 + entryboolean/entry
 +   /row
 +   rowentry spanname=descrOutputs the VP8 encoded stream
 in IVF file format./entry
 +   /row
 +
rowentry/entry/row
  /tbody
/tgroup
 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
 b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
 index 5c28cc3..4d17df9 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
 @@ -418,6 +418,7 @@ struct s5p_mfc_vp8_enc_params {
   u8 rc_frame_qp;
   u8 rc_p_frame_qp;
   u8 profile;
 + bool ivf;
  };
 
  /**
 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 index df83cd1..a67913e 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 @@ -676,6 +676,14 @@ static struct mfc_control controls[] = {
   .step = 1,
   .default_value = 0,
   },
 + {
 + .id = V4L2_CID_MPEG_VIDEO_VPX_IVF_FORMAT,
 + .type = V4L2_CTRL_TYPE_BOOLEAN,
 + .minimum = 0,
 + .maximum = 1,
 + .step = 1,
 + .default_value = 0,
 + },
  };
 
  #define NUM_CTRLS ARRAY_SIZE(controls)
 @@ -1636,6 +1644,9 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl
 *ctrl)
   case V4L2_CID_MPEG_VIDEO_VPX_PROFILE:
   p-codec.vp8.profile = ctrl-val;
   break;
 + case V4L2_CID_MPEG_VIDEO_VPX_IVF_FORMAT:
 + p-codec.vp8.ivf = ctrl-val;
 + break;
   default:
   v4l2_err(dev-v4l2_dev, Invalid control, id=%d, val=%d\n,
   ctrl-id,
ctrl-val);
 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
 b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
 index f64621a..90edb19 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
 @@ -1243,6 +1243,8 @@ static int s5p_mfc_set_enc_params_vp8(struct
 s5p_mfc_ctx *ctx)
 
   /* VP8 specific params */
   reg = 0;
 + /* Bit set to 1 disables IVF stream format. */
 + reg |= p_vp8-ivf ? 0 : (0x1  12);
   reg |= (p_vp8-imd_4x4  0x1)  10;
   switch (p_vp8-num_partitions) {
   case V4L2_CID_MPEG_VIDEO_VPX_1_PARTITION:
 diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-
 core/v4l2-ctrls.c
 index e9e12c4..19e78df 100644
 --- a/drivers/media/v4l2-core/v4l2-ctrls.c
 +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
 @@ -752,6 +752,7 @@ const char *v4l2_ctrl_get_name(u32 id)
   case V4L2_CID_MPEG_VIDEO_VPX_I_FRAME_QP:return VPX
I-
 Frame QP Value;
   case V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP:return VPX
P-

[PATCH] v4l: Fix documentation of V4L2_PIX_FMT_H264_MVC and VP8 pixel formats

2014-05-14 Thread Kamil Debski
The 'Code' column in the documentation should provide the real fourcc
code that is used. Changed the documentation to provide the fourcc
defined in videodev2.h

Signed-off-by: Kamil Debski k.deb...@samsung.com
---
 Documentation/DocBook/media/v4l/pixfmt.xml |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml 
b/Documentation/DocBook/media/v4l/pixfmt.xml
index ea514d6..91dcbc8 100644
--- a/Documentation/DocBook/media/v4l/pixfmt.xml
+++ b/Documentation/DocBook/media/v4l/pixfmt.xml
@@ -772,7 +772,7 @@ extended control 
constantV4L2_CID_MPEG_STREAM_TYPE/constant, see
  /row
  row id=V4L2-PIX-FMT-H264-MVC
entryconstantV4L2_PIX_FMT_H264_MVC/constant/entry
-   entry'MVC'/entry
+   entry'M264'/entry
entryH264 MVC video elementary stream./entry
  /row
  row id=V4L2-PIX-FMT-H263
@@ -812,7 +812,7 @@ extended control 
constantV4L2_CID_MPEG_STREAM_TYPE/constant, see
  /row
  row id=V4L2-PIX-FMT-VP8
entryconstantV4L2_PIX_FMT_VP8/constant/entry
-   entry'VP8'/entry
+   entry'VP80'/entry
entryVP8 video elementary stream./entry
  /row
/tbody
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] v4l: Fix documentation of V4L2_PIX_FMT_H264_MVC and VP8 pixel formats

2014-05-14 Thread Sylwester Nawrocki
On 14/05/14 16:31, Kamil Debski wrote:
 The 'Code' column in the documentation should provide the real fourcc
 code that is used. Changed the documentation to provide the fourcc
 defined in videodev2.h
 
 Signed-off-by: Kamil Debski k.deb...@samsung.com

Acked-by: Sylwester Nawrocki s.nawro...@samsung.com

 ---
  Documentation/DocBook/media/v4l/pixfmt.xml |4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml 
 b/Documentation/DocBook/media/v4l/pixfmt.xml
 index ea514d6..91dcbc8 100644
 --- a/Documentation/DocBook/media/v4l/pixfmt.xml
 +++ b/Documentation/DocBook/media/v4l/pixfmt.xml
 @@ -772,7 +772,7 @@ extended control 
 constantV4L2_CID_MPEG_STREAM_TYPE/constant, see
 /row
 row id=V4L2-PIX-FMT-H264-MVC
   entryconstantV4L2_PIX_FMT_H264_MVC/constant/entry
 - entry'MVC'/entry
 + entry'M264'/entry
   entryH264 MVC video elementary stream./entry
 /row
 row id=V4L2-PIX-FMT-H263
 @@ -812,7 +812,7 @@ extended control 
 constantV4L2_CID_MPEG_STREAM_TYPE/constant, see
 /row
 row id=V4L2-PIX-FMT-VP8
   entryconstantV4L2_PIX_FMT_VP8/constant/entry
 - entry'VP8'/entry
 + entry'VP80'/entry
   entryVP8 video elementary stream./entry
 /row
   /tbody
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PULL for 3.16] ti-vpe patches

2014-05-14 Thread Kamil Debski
The following changes since commit ba0d342ecc21fbbe2f6c178f4479944d1fb34f3b:

  saa7134-alsa: include vmalloc.h (2014-05-13 23:05:15 -0300)

are available in the git repository at:

  git://linuxtv.org/kdebski/media_tree_2.git for-3.16

for you to fetch changes up to 61b2123701c3568fcf8a07e69fe1c2854f640a4e:

  v4l: ti-vpe: Rename csc memory resource name (2014-05-14 15:53:39 +0200)


Archit Taneja (5):
  v4l: ti-vpe: register video device only when firmware is loaded
  v4l: ti-vpe: Allow DMABUF buffer type support
  v4l: ti-vpe: Fix some params in VPE data descriptors
  v4l: ti-vpe: Add selection API in VPE driver
  v4l: ti-vpe: Rename csc memory resource name

 drivers/media/platform/ti-vpe/csc.c   |2 +-
 drivers/media/platform/ti-vpe/vpdma.c |   68 +++---
 drivers/media/platform/ti-vpe/vpdma.h |   17 ++-
 drivers/media/platform/ti-vpe/vpe.c   |  227
-
 4 files changed, 258 insertions(+), 56 deletions(-)

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/3] media: mx2-emmaprp: Add devicetree support

2014-05-14 Thread Alexander Shiyan
Wed, 14 May 2014 12:49:03 +0200 от Sylwester Nawrocki s.nawro...@samsung.com:
 On 13/05/14 19:23, Alexander Shiyan wrote:
  Tue, 13 May 2014 19:09:30 +0200 от Sylwester Nawrocki 
  s.nawro...@samsung.com:
   Hi,
   
   On 02/05/14 09:18, Alexander Shiyan wrote:
This patch adds devicetree support for the Freescale enhanced 
Multimedia
Accelerator (eMMA) video Pre-processor (PrP).

Signed-off-by: Alexander Shiyan shc_w...@mail.ru
---
 .../devicetree/bindings/media/fsl-imx-emmaprp.txt | 19 
+++
 drivers/media/platform/mx2_emmaprp.c  |  8 
 2 files changed, 27 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/media/fsl-imx-emmaprp.txt

diff --git 
a/Documentation/devicetree/bindings/media/fsl-imx-emmaprp.txt 
b/Documentation/devicetree/bindings/media/fsl-imx-emmaprp.txt
new file mode 100644
index 000..9e8238f
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/fsl-imx-emmaprp.txt
@@ -0,0 +1,19 @@
+* Freescale enhanced Multimedia Accelerator (eMMA) video 
Pre-processor (PrP)
+  for i.MX.
+
+Required properties:
+- compatible : Shall contain fsl,imx21-emmaprp.
+- reg: Offset and length of the register set for the device.
+- interrupts : Should contain eMMA PrP interrupt number.
+- clocks : Should contain the ahb and ipg clocks, in the order
+   determined by the clock-names property.
+- clock-names: Should be ahb, ipg.
+
+Example:
+ emmaprp: emmaprp@10026400 {
+ compatible = fsl,imx27-emmaprp, fsl,imx21-emmaprp;
   
   Is fsl,imx27-emmaprp compatible documented somewhere ?
 
  The overall structure of the eMMA module is slightly different.
  As for the part of the PrP, according to the datasheet they are compatible.
 
 Then can we please have all the valid compatible strings listed at the
 'compatible' property's description above ? I think it is useful to have
 an indication to which SoC each of them apply in documentation of the
 binding.

Traditionally, i.MX drivers uses youngest chip for compatibility string.
The best example of this: drivers/bus/imx-weim.c

---



Re: [PATCH v4 1/2] media: davinci: vpif capture: upgrade the driver with v4l offerings

2014-05-14 Thread Prabhakar Lad
Hi Hans,

Thanks for the review.

On Mon, May 12, 2014 at 3:20 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 Hi Prabhakar,

 Thanks for the patch, but I have a few comments...

 On 05/12/2014 10:58 AM, Lad, Prabhakar wrote:
 From: Lad, Prabhakar prabhakar.cse...@gmail.com

 This patch upgrades the vpif display driver with
 v4l helpers, this patch does the following,

 1: initialize the vb2 queue and context at the time of probe
 and removes context at remove() callback.
 2: uses vb2_ioctl_*() helpers.
 3: uses vb2_fop_*() helpers.
 4: uses SIMPLE_DEV_PM_OPS.
 5: uses vb2_ioctl_*() helpers.
 6: vidioc_g/s_priority is now handled by v4l core.
 7: removed driver specific fh and now using one provided by v4l.
 8: fixes checkpatch warnings.

 This really packs too much in one patch. At the very least 1, 4, 6 and
 8 can be done in separate patches. 2 and 5 are duplicates, BTW. The way
 it is now makes this hard to review. So it would be much appreciated if
 you can split it up.

Ok, I have started working on splitting them up.


 Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
 ---

 root@da850-omapl138-evm:/usr# ./v4l2-compliance -d /dev/video0 -i -s -v
 Driver Info:
 Driver name   : vpif_capture
 vpif_capture vpif_capture: =  START STATUS  =

 Bus info  : platform:vpif_capture
 Drivervpif_capture vpif_capture: ==  END STATUS  
 ==
  version: 3.15.0
 Capabilities  : 0x8401
 Video Capture
 Streaming
 Device Capabilities
 Device Caps   : 0x0401
 Video Capture
 Streaming

 Compliance test for device /dev/video0 (not using libv4l2):

 Required ioctls:
 test VIDIOC_QUERYCAP: OK

 Allow for multiple opens:
 test second video open: OK
 test VIDIOC_QUERYCAP: OK
 test VIDIOC_G/S_PRIORITY: OK

 Debug ioctls:
 test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
 test VIDIOC_LOG_STATUS: OK

 Input ioctls:
 test VIDIOC_G/S_TUNER: OK (Not Supported)
 test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
 test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
 test VIDIOC_ENUMAUDIO: OK (Not Supported)
 test VIDIOC_G/S/ENUMINPUT: OK
 test VIDIOC_G/S_AUDIO: OK (Not Supported)
 Inputs: 1 Audio Inputs: 0 Tuners: 0

 Output ioctls:
 test VIDIOC_G/S_MODULATOR: OK (Not Supported)
 test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
 test VIDIOC_ENUMAUDOUT: OK (Not Supported)
 test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
 test VIDIOC_G/S_AUDOUT: OK (Not Supported)
 Outputs: 0 Audio Outputs: 0 Modulators: 0

 Input/Output configuration ioctls:
 test VIDIOC_ENUM/G/S/QUERY_STD: OK
 test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
 test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
 test VIDIOC_G/S_EDID: OK (Not Supported)

 Test input 0:

 Control ioctls:
 test VIDIOC_QUERYCTRL/MENU: OK (Not Supported)
 test VIDIOC_G/S_CTRL: OK (Not Supported)
 test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported)
 test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported)
 test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
 Standard Controls: 0 Private Controls: 0

 Format ioctls:
 info: found 1 formats for buftype 1
 test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
 fail: v4l2-test-formats.cpp(1003): cap-readbuffers

 Just set readbuffers to the minimum number of buffers that queue_setup uses.


OK.

 test VIDIOC_G/S_PARM: FAIL
 test VIDIOC_G_FBUF: OK (Not Supported)
 fail: v4l2-test-formats.cpp(405): !pix.sizeimage

 Highly dubious. You need to investigate this!

Fixed it.

 test VIDIOC_G_FMT: FAIL
 test VIDIOC_TRY_FMT: OK (Not Supported)
 test VIDIOC_S_FMT: OK (Not Supported)
 test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)

 Codec ioctls:
 test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
 test VIDIOC_G_ENC_INDEX: OK (Not Supported)
 test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

 Buffer ioctls:
 test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
 fail: v4l2-test-buffers.cpp(506): q.has_expbuf()

 This is weird. I'm not sure why this happens since you seem to have 
 VB2_DMABUF set
 and also vb2_ioctl_expbuf.

 test VIDIOC_EXPBUF: FAIL

 Total: 38, Succeeded: 35, Failed: 3, Warnings: 0

 Also test with 'v4l2-compliance -s' (streaming). The '-i' option is available 
 to
 test streaming from a specific input.

BTW the output is with -s option set.

Thanks,
--Prabhakar Lad
--
To unsubscribe from this list: send the line unsubscribe linux-media 

Re: [PATCH v4 1/2] media: davinci: vpif capture: upgrade the driver with v4l offerings

2014-05-14 Thread Hans Verkuil
On 05/14/2014 07:28 PM, Prabhakar Lad wrote:
 Hi Hans,
 
 Thanks for the review.
 
 On Mon, May 12, 2014 at 3:20 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 Hi Prabhakar,

 Thanks for the patch, but I have a few comments...

 On 05/12/2014 10:58 AM, Lad, Prabhakar wrote:
 Buffer ioctls:
 test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
 fail: v4l2-test-buffers.cpp(506): q.has_expbuf()

 This is weird. I'm not sure why this happens since you seem to have 
 VB2_DMABUF set
 and also vb2_ioctl_expbuf.

 test VIDIOC_EXPBUF: FAIL

 Total: 38, Succeeded: 35, Failed: 3, Warnings: 0

 Also test with 'v4l2-compliance -s' (streaming). The '-i' option is 
 available to
 test streaming from a specific input.

 BTW the output is with -s option set.

Something is wrong. With -s you should see something like this:

Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
test VIDIOC_EXPBUF: OK (Not Supported)
test read/write: OK
test MMAP: OK 
test USERPTR: OK  
test DMABUF: Cannot test, specify --expbuf-device

Regards,

Hans

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Bug#746404: dtv-scan-tables: /usr/share/dvb/dvb-t/fr-all file : invalid enum and no DVB-T services found

2014-05-14 Thread Olliver Schinagl

Hey Fred,

On 05/14/2014 06:50 PM, fredbob...@free.fr wrote:

Thank you guys for your support !

Olliver,
thank you for your commit I tested it and the parsing 1) is now good.

However problem 2) is still there : no services are found at the end of the 
scan.

I mean when doing :
scan dtv-scan-tables/dvb-t/fr-All

the end result is :
ERROR: initial tuning failed
dumping lists (0 services)
Done.


Digging further I think the problem is due to FEC, QAM and Guard Interval 
parameters consistency.

Indeed in France it seems there are 2 schemes for DVB-T services depending on where 
you live (I'm not quite 100% sure as I could only find very few official  
reliable information) :
FEC 3/4, QAM64, Guard Interval 1/8
FEC 2/3, QAM16, Guard Interval 1/32

Whereas in the file we have :
FEC 2/3, QAM64, Guard Interval 1/32
Have you tried wscan? wscan is able to generate a 'initial scanning 
file' which should result in a proper file. See, the thing is, I don't 
know what is right and what is from for the entirety of France, I don't 
have the range nor the lingustic skill to read the dvb-t sites from 
French providers about the proper parameters. We are kind of Dependant 
on people who live in an area to submit the proper scan files.


If you think or know that identical frequencies are used with different 
parameters in different regions, then that is something that needs to be 
explored. If the auto setting works well, we could use that. But try to 
do a wscan and generate an initial scan file from it and see what it 
says, I'd be very curious indeed.


Olliver

However I think this scheme may be OK depending on your HW frontend tolerance. 
Unfortunately it doesn't work with my Hauppauge NOVA-TD-500.

I propose 2 options :
A) rely on the the AUTO capability and use FEC AUTO, QAM AUTO, GI AUTO in the 
frequency file (please refer to attached file fr-All-optionA)
B) double the file with both schemes for each frequency (please refer to 
attached file fr-All-optionB) : the drawback is that the scan is twice longer.

I sucessfully managed to scan services with both A  B. I've attached both 
tests outputs for your reference.
= But I only have TV channels with the first scheme in my area.

Do you have an opinion about A or B ?

Thank you.

Cheers,
Fred





- Original Message -
From: Olliver Schinagl oli...@schinagl.nl
Cc: fredboboss fredbob...@free.fr
Sent: Monday, May 12, 2014 11:16:18 PM
Subject: Re: Fwd: Bug#746404: dtv-scan-tables: /usr/share/dvb/dvb-t/fr-all file 
: invalid enum and no DVB-T services found

Apologies to all involved, I overlooked this e-mail. I patched it to fix
the casing as suggested in the e-mail and pushed it upstream. Can you
please test it?

Olliver

On 04/29/2014 11:57 PM, Jonathan McCrohan wrote:

Hi Oliver,

Please find Debian bug report from fredboboss regarding
dtv-scan-tables below.

Thanks,
Jon

On Tue, 29 Apr 2014 19:50:57 +0200, fredboboss wrote:

Package: dtv-scan-tables
Version: 0+git20140326.cfc2975-1
Severity: normal
1246b27f8b45f84c1824925060ad931530542f2e
Dear Maintainer,

Dear Debian Maintainer,

when performing a DVB-T frequency scan with the /usr/bin/scan utility (dvb-apps 
package) and the /usr/share/dvb/dvb-t/fr-All frequency file (dtv-scan-tables 
packages) the following 2 problems occur :

1) file parsing error :
ERROR: invalid enum value '8MHZ'
ERROR: invalid enum value '8K'

2) in the end no DVB-T services are found with a Hauppauge NOVA-TD-500 DVB-T 
card.

Those problems seem to come from the /usr/share/dvb/dvb-t/fr-All file.

The following changes are proposed in this file :

For 1) :
- 8MHZ changed by 8MHz
- 8K changed by 8k

For 2) :
- change FEC_HI parameter by AUTO

Thus the 1st frequency line of the file would be changed like that :
-T 47400 8MHZ 2/3 NONE QAM64 8K 1/32 NONE #Channel UHF 21
+T 47400 8MHz AUTO NONE QAM64 8k 1/32 NONE #Channel UHF 21

(Please refer to the end of the mail for the complete modified file).

Thanks to those modifications I successfully performed a DVB-T scan with the 
NOVA TD-500 card.

In case more information is needed don't hesitate to contact me.

Best regards,
Fred

-- System Information:
Debian Release: jessie/sid
APT prefers testing-updates
APT policy: (500, 'testing-updates'), (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 3.13-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

-- no debconf information

Modified file :
# France ALL (All channel 21 to 60)
# T freq bw fec_hi fec_lo mod transmission-mode guard-interval hierarchy
T 47400 8MHz AUTO NONE QAM64 8k 1/32 NONE #Channel UHF 21
T 48200 8MHz AUTO NONE QAM64 8k 1/32 NONE #Channel UHF 22
T 49000 8MHz AUTO NONE QAM64 8k 1/32 NONE #Channel UHF 23
T 49800 8MHz AUTO NONE QAM64 8k 1/32 NONE #Channel UHF 24
T 50600 8MHz AUTO NONE QAM64 8k 1/32 NONE #Channel UHF 25
T 51400 8MHz AUTO NONE QAM64 8k 1/32 NONE #Channel UHF 26
T 52200 8MHz AUTO NONE QAM64 8k 

[PATCH v7 3/3] ARM: sunxi: Add IR controller support in DT on A20

2014-05-14 Thread Alexander Bersenev
This patch adds IR controller in A20 Device-Tree:
- Two IR devices found in A20 user manual
- Pins for two devices
- One IR device physically found on Cubieboard 2
- One IR device physically found on Cubietruck

Signed-off-by: Alexander Bersenev b...@hackerdom.ru
Signed-off-by: Alexsey Shestacov wingr...@linux-sunxi.org
---
 arch/arm/boot/dts/sun7i-a20-cubieboard2.dts |  6 ++
 arch/arm/boot/dts/sun7i-a20-cubietruck.dts  |  6 ++
 arch/arm/boot/dts/sun7i-a20.dtsi| 32 +
 3 files changed, 44 insertions(+)

diff --git a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts 
b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
index feeff64..b44d61b 100644
--- a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
+++ b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
@@ -65,6 +65,12 @@
};
};
 
+   ir0: ir@01c21800 {
+   pinctrl-names = default;
+   pinctrl-0 = ir0_pins_a;
+   status = okay;
+   };
+
uart0: serial@01c28000 {
pinctrl-names = default;
pinctrl-0 = uart0_pins_a;
diff --git a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts 
b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
index e288562..5f5c31d 100644
--- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
+++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
@@ -121,6 +121,12 @@
};
};
 
+   ir0: ir@01c21800 {
+   pinctrl-names = default;
+   pinctrl-0 = ir0_pins_a;
+   status = okay;
+   };
+
uart0: serial@01c28000 {
pinctrl-names = default;
pinctrl-0 = uart0_pins_a;
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 0ae2b77..fe1f8ff 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -724,6 +724,20 @@
allwinner,drive = 2;
allwinner,pull = 0;
};
+
+   ir0_pins_a: ir0@0 {
+   allwinner,pins = PB3,PB4;
+   allwinner,function = ir0;
+   allwinner,drive = 0;
+   allwinner,pull = 0;
+   };
+
+   ir1_pins_a: ir1@0 {
+   allwinner,pins = PB22,PB23;
+   allwinner,function = ir1;
+   allwinner,drive = 0;
+   allwinner,pull = 0;
+   };
};
 
timer@01c20c00 {
@@ -749,6 +763,24 @@
interrupts = 0 24 4;
};
 
+   ir0: ir@01c21800 {
+   compatible = allwinner,sun7i-a20-ir;
+   clocks = apb0_gates 6, ir0_clk;
+   clock-names = apb, ir;
+   interrupts = 0 5 4;
+   reg = 0x01c21800 0x40;
+   status = disabled;
+   };
+
+   ir1: ir@01c21c00 {
+   compatible = allwinner,sun7i-a20-ir;
+   clocks = apb0_gates 7, ir1_clk;
+   clock-names = apb, ir;
+   interrupts = 0 6 4;
+   reg = 0x01c21c00 0x40;
+   status = disabled;
+   };
+
lradc: lradc@01c22800 {
compatible = allwinner,sun4i-lradc-keys;
reg = 0x01c22800 0x100;
-- 
1.9.3

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7 0/3] ARM: sunxi: Add support for consumer infrared devices

2014-05-14 Thread Alexander Bersenev
This patch introduces Consumer IR(CIR) support for sunxi boards.

This is based on Alexsey Shestacov's work based on the original driver 
supplied by Allwinner.

Signed-off-by: Alexander Bersenev b...@hackerdom.ru
Signed-off-by: Alexsey Shestacov wingr...@linux-sunxi.org

---
Changes since version 1: 
 - Fix timer memory leaks 
 - Fix race condition when driver unloads while interrupt handler is active
 - Support Cubieboard 2(need testing)

Changes since version 2:
- More reliable keydown events
- Documentation fixes
- Rename registers accurding to A20 user manual
- Remove some includes, order includes alphabetically
- Use BIT macro
- Typo fixes

Changes since version 3:
- Split the patch on smaller parts
- More documentation fixes
- Add clock-names in DT
- Use devm_clk_get function to get the clocks
- Removed gpios property from ir's DT
- Changed compatible from allwinner,sunxi-ir to allwinner,sun7i-a20-ir in DT
- Use spin_lock_irq instead spin_lock_irqsave in interrupt handler
- Add myself in the copyright ;)
- Coding style and indentation fixes

Changes since version 4:
- Try to fix indentation errors by sending patches with git send-mail

Changes since version 5:
- More indentation fixes
- Make patches pass checkpatch with --strict option
- Replaced magic numbers with defines(patch by Priit Laes)
- Fixed oops on loading(patch by Hans de Goede)

Changes since version 6:
- Removed constants from code
- Better errrors handling on loading
- Renamed sunxi-ir.c to sunxi-cir.c
- Changed description of second commit
- Order entries in dts and dtsi by register address
- Code style fixes


Alexander Bersenev (3):
  ARM: sunxi: Add documentation for sunxi consumer infrared devices
  [media] rc: add sunxi-ir driver
  ARM: sunxi: Add IR controller support in DT on A20

 .../devicetree/bindings/media/sunxi-ir.txt |  23 ++
 arch/arm/boot/dts/sun7i-a20-cubieboard2.dts|   6 +
 arch/arm/boot/dts/sun7i-a20-cubietruck.dts |   6 +
 arch/arm/boot/dts/sun7i-a20.dtsi   |  32 ++
 drivers/media/rc/Kconfig   |  10 +
 drivers/media/rc/Makefile  |   1 +
 drivers/media/rc/sunxi-cir.c   | 334 +
 7 files changed, 412 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/sunxi-ir.txt
 create mode 100644 drivers/media/rc/sunxi-cir.c

-- 
1.9.3
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7 1/3] ARM: sunxi: Add documentation for sunxi consumer infrared devices

2014-05-14 Thread Alexander Bersenev
This patch adds documentation for Device-Tree bindings for sunxi IR
controller.

Signed-off-by: Alexander Bersenev b...@hackerdom.ru
Signed-off-by: Alexsey Shestacov wingr...@linux-sunxi.org
---
 .../devicetree/bindings/media/sunxi-ir.txt | 23 ++
 1 file changed, 23 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/sunxi-ir.txt

diff --git a/Documentation/devicetree/bindings/media/sunxi-ir.txt 
b/Documentation/devicetree/bindings/media/sunxi-ir.txt
new file mode 100644
index 000..014dd8b
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/sunxi-ir.txt
@@ -0,0 +1,23 @@
+Device-Tree bindings for SUNXI IR controller found in sunXi SoC family
+
+Required properties:
+- compatible   : should be allwinner,sun7i-a20-ir;
+- clocks   : list of clock specifiers, corresponding to
+ entries in clock-names property;
+- clock-names  : should contain apb and ir entries;
+- interrupts   : should contain IR IRQ number;
+- reg  : should contain IO map address for IR.
+
+Optional properties:
+- linux,rc-map-name : Remote control map name.
+
+Example:
+
+ir0: ir@01c21800 {
+   compatible = allwinner,sun7i-a20-ir;
+   clocks = apb0_gates 6, ir0_clk;
+   clock-names = apb, ir;
+   interrupts = 0 5 1;
+   reg = 0x01C21800 0x40;
+   linux,rc-map-name = rc-rc6-mce;
+};
-- 
1.9.3

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7 2/3] [media] rc: add sunxi-ir driver

2014-05-14 Thread Alexander Bersenev
This patch adds driver for sunxi IR controller.
It is based on Alexsey Shestacov's work based on the original driver
supplied by Allwinner.

Signed-off-by: Alexander Bersenev b...@hackerdom.ru
Signed-off-by: Alexsey Shestacov wingr...@linux-sunxi.org
---
 drivers/media/rc/Kconfig |  10 ++
 drivers/media/rc/Makefile|   1 +
 drivers/media/rc/sunxi-cir.c | 334 +++
 3 files changed, 345 insertions(+)
 create mode 100644 drivers/media/rc/sunxi-cir.c

diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig
index 8fbd377..9427fad 100644
--- a/drivers/media/rc/Kconfig
+++ b/drivers/media/rc/Kconfig
@@ -343,4 +343,14 @@ config RC_ST
 
 If you're not sure, select N here.
 
+config IR_SUNXI
+tristate SUNXI IR remote control
+depends on RC_CORE
+depends on ARCH_SUNXI
+---help---
+  Say Y if you want to use sunXi internal IR Controller
+
+  To compile this driver as a module, choose M here: the module will
+  be called sunxi-ir.
+
 endif #RC_DEVICES
diff --git a/drivers/media/rc/Makefile b/drivers/media/rc/Makefile
index f8b54ff..9ee9ee7 100644
--- a/drivers/media/rc/Makefile
+++ b/drivers/media/rc/Makefile
@@ -32,4 +32,5 @@ obj-$(CONFIG_IR_GPIO_CIR) += gpio-ir-recv.o
 obj-$(CONFIG_IR_IGUANA) += iguanair.o
 obj-$(CONFIG_IR_TTUSBIR) += ttusbir.o
 obj-$(CONFIG_RC_ST) += st_rc.o
+obj-$(CONFIG_IR_SUNXI) += sunxi-cir.o
 obj-$(CONFIG_IR_IMG) += img-ir/
diff --git a/drivers/media/rc/sunxi-cir.c b/drivers/media/rc/sunxi-cir.c
new file mode 100644
index 000..25eb175
--- /dev/null
+++ b/drivers/media/rc/sunxi-cir.c
@@ -0,0 +1,334 @@
+/*
+ * Driver for Allwinner sunXi IR controller
+ *
+ * Copyright (C) 2014 Alexsey Shestacov wingr...@linux-sunxi.org
+ * Copyright (C) 2014 Alexander Bersenev b...@hackerdom.ru
+ *
+ * Based on sun5i-ir.c:
+ * Copyright (C) 2007-2012 Daniel Wang
+ * Allwinner Technology Co., Ltd. www.allwinnertech.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include linux/clk.h
+#include linux/interrupt.h
+#include linux/module.h
+#include linux/of_platform.h
+#include media/rc-core.h
+
+#define SUNXI_IR_DEV sunxi-ir
+
+/* Registers */
+/* IR Control */
+#define SUNXI_IR_CTL_REG  0x00
+/* Rx Config */
+#define SUNXI_IR_RXCTL_REG0x10
+/* Rx Data */
+#define SUNXI_IR_RXFIFO_REG   0x20
+/* Rx Interrupt Enable */
+#define SUNXI_IR_RXINT_REG0x2C
+/* Rx Interrupt Status */
+#define SUNXI_IR_RXSTA_REG0x30
+/* IR Sample Config */
+#define SUNXI_IR_CIR_REG  0x34
+
+/* Global Enable for IR_CTL Register */
+#define REG_CTL_GEN   BIT(0)
+/* RX block enable for IR_CTL Register */
+#define REG_CTL_RXEN  BIT(1)
+/* CIR mode for IR_CTL Register */
+#define REG_CTL_MD(BIT(4)|BIT(5))
+
+/* IR_RXCTL_REG Register Receiver Pulse Polarity Invert flag */
+#define REG_RXCTL_RPPIBIT(2)
+
+/* IR_RXINT_REG Register fields */
+#define REG_RXINT_ROI_EN  BIT(0) /* Rx FIFO Overflow */
+#define REG_RXINT_RPEI_EN BIT(1) /* Rx Packet End */
+#define REG_RXINT_RAI_EN  BIT(4) /* Rx FIFO Data Available */
+/* Rx FIFO available byte level */
+#define REG_RXINT_RAL__MASK   (BIT(8)|BIT(9)|BIT(10)|BIT(11))
+#define REG_RXINT_RAL__SHIFT  8
+static inline uint32_t REG_RXINT_RAL(uint16_t val)
+{
+   return (val  REG_RXINT_RAL__SHIFT)  REG_RXINT_RAL__MASK;
+}
+
+/* CIR_REG register noise threshold */
+#define REG_CIR_NTHR__MASK   (BIT(2)|BIT(3)|BIT(4)|BIT(5)|BIT(6)|BIT(7))
+#define REG_CIR_NTHR__SHIFT  2
+static inline uint32_t REG_CIR_NTHR(uint16_t val)
+{
+   return (val  REG_CIR_NTHR__SHIFT)  REG_CIR_NTHR__MASK;
+}
+/* CIR_REG register idle threshold */
+#define REG_CIR_ITHR__MASK   (BIT(8)|BIT(9)|BIT(10)|BIT(11)|BIT(12)|BIT(13) \
+|BIT(14)|BIT(15))
+#define REG_CIR_ITHR__SHIFT  8
+static inline uint32_t REG_CIR_ITHR(uint16_t val)
+{
+   return (val  REG_CIR_ITHR__SHIFT)  REG_CIR_ITHR__MASK;
+}
+
+/* RXSTA_REG Register RX FIFO Available Counter */
+#define REG_RXSTA_RAC__SHIFT  8
+#define REG_RXSTA_RAC__MASK   0x3f
+
+/* Clear all interrupt status value */
+#define REG_RXSTA_CLEARALL0xff
+
+/* Hardware supported fifo size */
+#define SUNXI_IR_FIFO_SIZE16
+/* How many messages in FIFO trigger IRQ */
+#define TRIGGER_LEVEL 8
+/* Required frequency for IR0 or IR1 clock in CIR mode */
+#define SUNXI_IR_BASE_CLK 800
+/* Frequency after IR internal divider  */
+#define SUNXI_IR_CLK  (SUNXI_IR_BASE_CLK / 64)
+/* Sample period in ns */
+#define 

Re: [PATCH 3/3] media: mx2-emmaprp: Add devicetree support

2014-05-14 Thread Shawn Guo
On Wed, May 14, 2014 at 08:59:54PM +0400, Alexander Shiyan wrote:
 Wed, 14 May 2014 12:49:03 +0200 от Sylwester Nawrocki 
 s.nawro...@samsung.com:
  On 13/05/14 19:23, Alexander Shiyan wrote:
   Tue, 13 May 2014 19:09:30 +0200 от Sylwester Nawrocki 
   s.nawro...@samsung.com:
Hi,

On 02/05/14 09:18, Alexander Shiyan wrote:
 This patch adds devicetree support for the Freescale enhanced 
 Multimedia
 Accelerator (eMMA) video Pre-processor (PrP).
 
 Signed-off-by: Alexander Shiyan shc_w...@mail.ru
 ---
  .../devicetree/bindings/media/fsl-imx-emmaprp.txt | 19 
 +++
  drivers/media/platform/mx2_emmaprp.c  |  8 
  2 files changed, 27 insertions(+)
  create mode 100644 
 Documentation/devicetree/bindings/media/fsl-imx-emmaprp.txt
 
 diff --git 
 a/Documentation/devicetree/bindings/media/fsl-imx-emmaprp.txt 
 b/Documentation/devicetree/bindings/media/fsl-imx-emmaprp.txt
 new file mode 100644
 index 000..9e8238f
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/media/fsl-imx-emmaprp.txt
 @@ -0,0 +1,19 @@
 +* Freescale enhanced Multimedia Accelerator (eMMA) video 
 Pre-processor (PrP)
 +  for i.MX.
 +
 +Required properties:
 +- compatible : Shall contain fsl,imx21-emmaprp.
 +- reg: Offset and length of the register set for the 
 device.
 +- interrupts : Should contain eMMA PrP interrupt number.
 +- clocks : Should contain the ahb and ipg clocks, in the order
 +   determined by the clock-names property.
 +- clock-names: Should be ahb, ipg.
 +
 +Example:
 +   emmaprp: emmaprp@10026400 {
 +   compatible = fsl,imx27-emmaprp, fsl,imx21-emmaprp;

Is fsl,imx27-emmaprp compatible documented somewhere ?
  
   The overall structure of the eMMA module is slightly different.
   As for the part of the PrP, according to the datasheet they are 
   compatible.
  
  Then can we please have all the valid compatible strings listed at the
  'compatible' property's description above ? I think it is useful to have
  an indication to which SoC each of them apply in documentation of the
  binding.
 
 Traditionally, i.MX drivers uses youngest chip for compatibility string.
 The best example of this: drivers/bus/imx-weim.c

I guess Sylwester's point is either fsl,imx27-emmaprp is documented in
the bindings or it shouldn't be used anywhere.

Shawn
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


cron job: media_tree daily build: OK

2014-05-14 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:   Thu May 15 04:00:15 CEST 2014
git branch: test
git hash:   ba0d342ecc21fbbe2f6c178f4479944d1fb34f3b
gcc version:i686-linux-gcc (GCC) 4.8.2
sparse version: v0.5.0-11-g38d1124
host hardware:  x86_64
host os:3.14-1.slh.1-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.31.14-i686: OK
linux-2.6.32.27-i686: OK
linux-2.6.33.7-i686: OK
linux-2.6.34.7-i686: OK
linux-2.6.35.9-i686: OK
linux-2.6.36.4-i686: OK
linux-2.6.37.6-i686: OK
linux-2.6.38.8-i686: OK
linux-2.6.39.4-i686: OK
linux-3.0.60-i686: OK
linux-3.1.10-i686: OK
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: OK
linux-3.7.4-i686: OK
linux-3.8-i686: OK
linux-3.9.2-i686: OK
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12-i686: OK
linux-3.13-i686: OK
linux-3.14-i686: OK
linux-3.15-rc1-i686: OK
linux-2.6.31.14-x86_64: OK
linux-2.6.32.27-x86_64: OK
linux-2.6.33.7-x86_64: OK
linux-2.6.34.7-x86_64: OK
linux-2.6.35.9-x86_64: OK
linux-2.6.36.4-x86_64: OK
linux-2.6.37.6-x86_64: OK
linux-2.6.38.8-x86_64: OK
linux-2.6.39.4-x86_64: OK
linux-3.0.60-x86_64: OK
linux-3.1.10-x86_64: OK
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: OK
linux-3.9.2-x86_64: OK
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12-x86_64: OK
linux-3.13-x86_64: OK
linux-3.14-x86_64: OK
linux-3.15-rc1-x86_64: OK
apps: OK
spec-git: OK
sparse version: v0.5.0-11-g38d1124
sparse: ERRORS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Thursday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Thursday.tar.bz2

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/media.html
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] hdpvr: fix interrupted recording

2014-05-14 Thread Keith Pyle



On 05/12/14 07:41, Hans Verkuil wrote:

Ryley, Keith, can you test this one more time and if it works reply with
a 'Tested-by' tag that I can add to the patch?

Thanks!

Hans


This issue was reported by Ryley Angus:

quote
I record from my satellite set top box using component video and optical
audio input. I basically use cat /dev/video0  ~/video.ts” or use dd. The
box is set to output audio as AC-3 over optical, but most channels are
actually output as stereo PCM. When the channel is changed between a PCM
channel and (typically to a movie channel) to a channel utilising AC-3,
the HD-PVR stops the recording as the set top box momentarily outputs no
audio. Changing between PCM channels doesn't cause any issues.

My main problem was that when this happens, cat/dd doesn't actually exit.
When going through the hdpvr driver source and the dmesg output, I found
the hdpvr driver wasn't actually shutting down the device properly until
I manually killed cat/dd.

I've seen references to this issue being a hardware issue from as far back
as 
2010:http://forums.gbpvr.com/showthread.php?46429-HD-PVR-drops-recording-on-channel-change-Hauppauge-says-too-bad
  .

I tracked my issue to the file hdpvr-video.c. Specifically:
if (wait_event_interruptible(dev-wait_data, buf-status = BUFSTAT_READY)) {
(line ~450). The device seems to get stuck waiting for the buffer to become
ready. But as far as I can tell, when the channel is changed between a PCM
and AC-3 broadcast the buffer status will never actually become ready.
/quote

Angus provided a hack to fix this, which I've rewritten.

Signed-off-by: Hans Verkuilhans.verk...@cisco.com
Reported-by: Ryley Angusryleyjan...@gmail.com
---
  drivers/media/usb/hdpvr/hdpvr-video.c | 20 +---
  1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c 
b/drivers/media/usb/hdpvr/hdpvr-video.c
index 0500c417..44227da 100644
--- a/drivers/media/usb/hdpvr/hdpvr-video.c
+++ b/drivers/media/usb/hdpvr/hdpvr-video.c
@@ -454,6 +454,8 @@ static ssize_t hdpvr_read(struct file *file, char __user 
*buffer, size_t count,
  
  		if (buf-status != BUFSTAT_READY 

dev-status != STATUS_DISCONNECTED) {
+   int err;
+
/* return nonblocking */
if (file-f_flags  O_NONBLOCK) {
if (!ret)
@@ -461,11 +463,23 @@ static ssize_t hdpvr_read(struct file *file, char __user 
*buffer, size_t count,
goto err;
}
  
-			if (wait_event_interruptible(dev-wait_data,

- buf-status == BUFSTAT_READY)) {
-   ret = -ERESTARTSYS;
+   err = wait_event_interruptible_timeout(dev-wait_data,
+ buf-status == BUFSTAT_READY,
+ msecs_to_jiffies(3000));
+   if (err  0) {
+   ret = err;
goto err;
}
+   if (!err) {
+   v4l2_dbg(MSG_INFO, hdpvr_debug, dev-v4l2_dev,
+   timeout: restart streaming\n);
+   hdpvr_stop_streaming(dev);
+   err = hdpvr_start_streaming(dev);
+   if (err) {
+   ret = err;
+   goto err;
+   }
+   }
}
  
  		if (buf-status != BUFSTAT_READY)
Unfortunately, 2 of my 3 tests failed.  The new code correctly detected 
the loss of signal and generated the timeout message for all three 
tests.  For tests 1  3, the HD-PVR did not restart streaming.  Test 1 
gave a 'Resource temporarily unavailable' error.  Test 3 did not produce 
an error message.


I believe I understand the problem.  In my user-space code that (mostly) 
deals with this problem, my algorithm differs slightly from that in 
Hans' code.  The proposed patch has this flow:


1. watch for time-out on read for 3 seconds
2. if no data is received in time-out period, close streaming on HD-PVR
3. immediately re-open streaming from the HD-PVR


In my testing last year, I found that the HD-PVR is sensitive to being 
re-opened too soon.  The HD-PVR firmware seems to take a few seconds to 
reset itself after a close and be ready to accept a new open.  So, my 
flow is:


1. watch for time-out on read for 1 second
2. if no data received in timeout period, close the HD-PVR device
3. sleep for 4 seconds
4. re-open the HD-PVR device


I believe that Hans' patch fails my tests because there is no delay 
between the stop and start streaming calls in his patch. The minimum 
reliable time between such actions on my HD-PVR is 3 seconds.   I 
established this value by