Re: [RFC PATCH 1/5] v4l2: add matrix support.

2013-07-08 Thread Hans Verkuil
On Sun July 7 2013 23:50:51 Sylwester Nawrocki wrote:
 On 06/28/2013 02:27 PM, Hans Verkuil wrote:
  From: Hans Verkuilhans.verk...@cisco.com
 
  This patch adds core support for matrices: querying, getting and setting.
 
  Two initial matrix types are defined for motion detection (defining regions
  and thresholds).
 
  Signed-off-by: Hans Verkuilhans.verk...@cisco.com
  ---
drivers/media/v4l2-core/v4l2-dev.c   |  3 ++
drivers/media/v4l2-core/v4l2-ioctl.c | 23 -
include/media/v4l2-ioctl.h   |  8 +
include/uapi/linux/videodev2.h   | 64 
  
4 files changed, 97 insertions(+), 1 deletion(-)
 
 [...]
 
  diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
  index e0b74a4..7e4538e 100644
  --- a/include/media/v4l2-ioctl.h
  +++ b/include/media/v4l2-ioctl.h
  @@ -271,6 +271,14 @@ struct v4l2_ioctl_ops {
  int (*vidioc_unsubscribe_event)(struct v4l2_fh *fh,
  const struct v4l2_event_subscription 
  *sub);
 
  +   /* Matrix ioctls */
  +   int (*vidioc_query_matrix) (struct file *file, void *fh,
  +   struct v4l2_query_matrix *qmatrix);
  +   int (*vidioc_g_matrix) (struct file *file, void *fh,
  +   struct v4l2_matrix *matrix);
  +   int (*vidioc_s_matrix) (struct file *file, void *fh,
  +   struct v4l2_matrix *matrix);
  +
  /* For other private ioctls */
  long (*vidioc_default) (struct file *file, void *fh,
  bool valid_prio, unsigned int cmd, void 
  *arg);
  diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
  index 95ef455..5cbe815 100644
  --- a/include/uapi/linux/videodev2.h
  +++ b/include/uapi/linux/videodev2.h
  @@ -1838,6 +1838,64 @@ struct v4l2_create_buffers {
  __u32   reserved[8];
};
 
  +/* Define to which motion detection region each element belongs.
  + * Each element is a __u8. */
  +#define V4L2_MATRIX_TYPE_MD_REGION (1)
  +/* Define the motion detection threshold for each element.
  + * Each element is a __u16. */
  +#define V4L2_MATRIX_TYPE_MD_THRESHOLD  (2)
  +
  +/**
  + * struct v4l2_query_matrix - VIDIOC_QUERY_MATRIX argument
  + * @type:  matrix type
  + * @ref:   reference to some object (if any) owning the matrix
  + * @columns:   number of columns in the matrix
  + * @rows:  number of rows in the matrix
  + * @elem_min:  minimum matrix element value
  + * @elem_max:  maximum matrix element value
  + * @elem_size: size in bytes each matrix element
  + * @reserved:  future extensions, applications and drivers must zero 
  this.
  + */
  +struct v4l2_query_matrix {
  +   __u32 type;
  +   union {
  +   __u32 reserved[4];
  +   } ref;
  +   __u32 columns;
  +   __u32 rows;
  +   union {
  +   __s64 val;
  +   __u64 uval;
  +   __u32 reserved[4];
  +   } elem_min;
  +   union {
  +   __s64 val;
  +   __u64 uval;
  +   __u32 reserved[4];
  +   } elem_max;
  +   __u32 elem_size;
 
 How about reordering it to something like:
 
   struct {
   union {
   __s64 val;
   __u64 uval;
   __u32 reserved[4];
   } min;
   union {
   __s64 val;
   __u64 uval;
   __u32 reserved[4];
   } max;
   __u32 size;
   } element;
 
 ?

Makes sense, although I prefer 'elem' over the longer 'element'. Would that
be OK with you?

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: [RFC PATCH 0/5] Matrix and Motion Detection support

2013-07-08 Thread Hans Verkuil
On Sun July 7 2013 23:50:30 Sylwester Nawrocki wrote:
 Hi Hans,
 
 On 06/28/2013 02:27 PM, Hans Verkuil wrote:
  This patch series adds support for matrices and motion detection and
  converts the solo6x10 driver to use these new APIs.
 
  See the RFCv2 for details on the motion detection API:
 
  http://www.mail-archive.com/linux-media@vger.kernel.org/msg62085.html
 
  And this RFC for details on the matrix API (which superseeds the 
  v4l2_md_blocks
  in the RFC above):
 
  http://permalink.gmane.org/gmane.linux.drivers.video-input-infrastructure/65195
 
  I have tested this with the solo card, both global motion detection and
  regional motion detection, and it works well.
 
  There is no documentation for the new APIs yet (other than the RFCs). I 
  would
  like to know what others think of this proposal before I start work on the
  DocBook documentation.
 
 These 3 ioctls look pretty generic and will likely allow us to handle wide
 range of functionalities, similarly to what the controls framework does 
 today.
 
 What I don't like in the current trend of the V4L2 API development 
 though is
 that we have seemingly separate APIs for configuring integers, rectangles,
 matrices, etc. And interactions between those APIs sometimes happen to be
 not well defined.
 
 I'm not opposed to having this matrix API, but I would _much_ more like to
 see it as a starting point of a more powerful API, that would allow to 
 model
 dependencies between parameters being configured and the objects more
 explicitly and freely (e.g. case of the per buffer controls), that would
 allow to pass a list of commands to the hardware for atomic 
 re-configurations,
 that would allow to create hardware configuration contexts, etc., etc.
 
 But it's all song of future, requires lots of effort, founding and takes
 engineers with significant experience.
 
 As it likely won't happen soon I guess we can proceed with the matrix API
 for now.

Do you attend the LPC in New Orleans? I would like to discuss this further,
but it is easier to do so face-to-face with a whiteboard. Alternatively, we
could set up a brainstorm session somewhere. This discussion keeps cropping
up time and again, perhaps we should start to do something about it :-)

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 v3 7/8] [media] V4L: Add VP8 encoder controls

2013-07-08 Thread Arun Kumar K
Hi Hans

On Fri, Jun 28, 2013 at 7:55 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 Hi Arun,

 As promised, here is my review.


Thank you :). Sorry for the delay in response.

 I have been thinking a bit more about whether or not a VPX control class
 should be added, and in my opinion it shouldn't. These controls should be
 part of the MPEG control class, as the VPX encoder shares a lot of general
 encoding parameters, just like h264 and mpeg4.

 It is unfortunate that all the defines contain the MPEG name, and I take
 the blame for that since I came up with these defines originally.

 That said, there are some things that can be done to make it less confusing:

 - Clearly state in v4l2-controls.h and v4l2-ctrls.c that the MPEG controls
   are really Codec Controls, so not MPEG specific, and that the 'MPEG' part of
   the define is historical.

Ok will do that.


 - Currently the V4L2_CID_MPEG_CLASS name in v4l2-ctrls.c is MPEG Encoder 
 Controls.
   This should be changed to Codec Controls, since the controls in this 
 class are
   neither MPEG specific, nor are they encoder specific as there are also 
 controls
   related to the decoder.

 - Update the DocBook section for the MPEG controls accordingly: change 'MPEG' 
 in
   the text to 'Codec' and add a note explaining why all the defines are 
 prefixed
   with V4L2_CID_MPEG/V4L2_MPEG instead of _CODEC.


Ok will do these changes.

 I did toy with the idea of adding aliases in v4l2-controls.h replacing MPEG 
 with
 CODEC, but that really is too messy. I think if you can take care of the three
 points mentioned above we should be OK.

 This also means that in this patch the V4L2_CID_VPX_ prefix changes to
 V4L2_CID_MPEG_VIDEO_VPX_ as that is consistent with the current naming 
 convention
 in v4l2-controls.h: V4L2_CID_MPEG_VIDEO_H264_ASO, 
 V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL.


Ok.

 Enums use V4L2_MPEG_VIDEO_VPX_ prefix.

 Yes, I know, this will make the names quite a bit longer, but it is important 
 for
 consistency. Codecs are likely to have lots of controls since there are lots 
 of
 knobs you can tweak. So using a systematic naming scheme will prevent it from
 descending into chaos...

 On Tue June 25 2013 12:57:14 Arun Kumar K wrote:
 This patch adds new V4L controls for VP8 encoding.

 Signed-off-by: Kiran AVND avnd.ki...@samsung.com
 Signed-off-by: Arun Kumar K arun...@samsung.com
 ---
  Documentation/DocBook/media/v4l/controls.xml |  150 
 ++
  drivers/media/v4l2-core/v4l2-ctrls.c |   33 ++
  include/uapi/linux/v4l2-controls.h   |   29 -
  3 files changed, 210 insertions(+), 2 deletions(-)

 diff --git a/Documentation/DocBook/media/v4l/controls.xml 
 b/Documentation/DocBook/media/v4l/controls.xml
 index 8d7a779..736c991 100644
 --- a/Documentation/DocBook/media/v4l/controls.xml
 +++ b/Documentation/DocBook/media/v4l/controls.xml
 @@ -3009,6 +3009,156 @@ in by the application. 0 = do not insert, 1 = insert 
 packets./entry
 /tgroup
   /table
/section
 +
 +section
 +  titleVPX Control Reference/title
 +
 +  paraThe VPX controls include controls for encoding parameters
 +  of VPx video codec./para
 +
 +  table pgwide=1 frame=none id=vpx-control-id
 +  titleVPX Control IDs/title
 +
 +  tgroup cols=4
 +colspec colname=c1 colwidth=1* /
 +colspec colname=c2 colwidth=6* /
 +colspec colname=c3 colwidth=2* /
 +colspec colname=c4 colwidth=6* /
 +spanspec namest=c1 nameend=c2 spanname=id /
 +spanspec namest=c2 nameend=c4 spanname=descr /
 +thead
 +  row
 +entry spanname=id align=leftID/entry
 +entry align=leftType/entry
 +  /rowrow rowsep=1entry spanname=descr 
 align=leftDescription/entry
 +  /row
 +/thead
 +tbody valign=top
 +  rowentry/entry/row
 +
 +   rowentry/entry/row
 +   row id=v4l2-vpx-num-partitions
 + entry 
 spanname=idconstantV4L2_CID_VPX_NUM_PARTITIONS/constant/entry
 + entryenum v4l2_vp8_num_partitions/entry
 +   /row
 +   rowentry spanname=descrThe number of token partitions to 
 use in VP8 encoder.
 +Possible values are:/entry
 +   /row
 +   row
 + entrytbl spanname=descr cols=2
 +   tbody valign=top
 + row
 +   entryconstantV4L2_VPX_1_PARTITION/constant/entry
 +   entry1 coefficient partition/entry
 + /row
 + row
 +   entryconstantV4L2_VPX_2_PARTITIONS/constant/entry
 +   entry2 partitions/entry

 Add 'coefficient' for the other cases as well in the description. At least, I 
 think
 this should be '2 coefficient partitions'.


Ok.

 + /row
 + row
 +   entryconstantV4L2_VPX_4_PARTITIONS/constant/entry
 +   entry4 partitions/entry
 + /row
 + 

[BRAINSTORM] Controls, matrices and properties

2013-07-08 Thread Hans Verkuil
Hi all,

I have been working on support for passing matrices to/from drivers using a
new matrix API. See this earlier thread for more background information:

http://comments.gmane.org/gmane.linux.drivers.video-input-infrastructure/66200

The basic feedback is that, yes, matrices are useful, but it is yet another
control-like API.

My problem with using the control API for things like this is that the control
API has been designed for use with GUIs: e.g. the controls are elements that
the end-user can modify through a GUI. Things like a matrix or some really
low-level driver property are either hard to model in a GUI or too advanced
and obscure for an end-user.

On the other hand, the control framework has all the desirable properties that
you would want: atomicity (as far as is allowed by the hardware), the ability
to get/set multiple controls in one ioctl, efficient, inheritance of subdev
controls in bridge devices, events, etc.

I'm wondering whether we cannot tweak the control API a bit to make it possible
to use it for matrices and general 'properties' as well. The main requirement
for me is that when applications enumerate over controls such properties should
never turn up in the enumerations: only controls suitable for a GUI should
appear. After all, an application would have no idea what to do with a matrix
of e.g. 200x300 elements.

While it is possible to extend queryctrl to e.g. enumerate only properties
instead of controls, it is probably better to create a new VIDIOC_QUERYPROP
ioctl. Also because the v4l2_queryctrl is pretty full and has no support to set
the minimum/maximum values of a 64 bit value. In addition, the name field is not
needed for a property, I think. Currently the name is there for the GUI, not
for identification purposes.

For setting/getting controls the existing extended control API can be used,
although I would be inclined to go for VIDIOC_G/S/TRY_PROPS ioctls as well.
For example, when I set a matrix property it is very desirable to pass only
a subset of the matrix along instead of a full matrix. In my original matrix
proposal I had a v4l2_rect struct that defined that. But there is no space
in struct v4l2_ext_control to store such information.

In general, implementing properties requires more variation since the GUI
restriction has been lifted. Also, properties can be assigned to specific
internal objects (e.g. buffer specific properties), so you need fields to
tell the kernel with which object the property is associated.

However, although the public API is different from the control API, there
is no reason not to use the internal control framework for both.

Internally controls and properties work pretty much the same way and can all
be handled by the control framework. Only supporting e.g. per-buffer controls
would take work since that is currently not implemented.

At the moment this is just an idea and I don't want to spend time on creating
a detailed RFC if people don't like it. So comments are welcome!

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


[PATCH v4 0/8] Add support for MFC v7 firmware

2013-07-08 Thread Arun Kumar K
This patch series adds MFC v7 firmware support to the Exynos
MFC driver. MFC v7 is present in 5420 SoC which has support
for VP8 encoding and many other features.

Changes from v3:
- Addressed review comments from Hans
http://www.mail-archive.com/linux-media@vger.kernel.org/msg63893.html
http://www.mail-archive.com/linux-media@vger.kernel.org/msg63905.html
- Addressed comments from Kamil
http://www.mail-archive.com/linux-media@vger.kernel.org/msg63747.html

Changes from v2:
- Addressed review comments from Sylwester
http://www.mail-archive.com/linux-media@vger.kernel.org/msg63676.html
http://www.mail-archive.com/linux-media@vger.kernel.org/msg63677.html

Changes from v1:
- Addressed review comments from Hans and Sylwester
http://www.mail-archive.com/linux-media@vger.kernel.org/msg63148.html
http://www.mail-archive.com/linux-media@vger.kernel.org/msg63311.html
- Modified IS_MFCV6 macro to IS_MFCV6_PLUS to include v7 also

Arun Kumar K (7):
  [media] s5p-mfc: Update v6 encoder buffer sizes
  [media] s5p-mfc: Rename IS_MFCV6 macro
  [media] s5p-mfc: Add register definition file for MFC v7
  [media] s5p-mfc: Core support for MFC v7
  [media] s5p-mfc: Update driver for v7 firmware
  [media] V4L: Add VP8 encoder controls
  [media] s5p-mfc: Add support for VP8 encoder

Sylwester Nawrocki (1):
  [media] V4L: Add support for integer menu controls with standard menu
items

 Documentation/DocBook/media/v4l/controls.xml   |  168 +++-
 .../devicetree/bindings/media/s5p-mfc.txt  |1 +
 Documentation/video4linux/v4l2-controls.txt|   21 +--
 drivers/media/platform/s5p-mfc/regs-mfc-v6.h   |4 +-
 drivers/media/platform/s5p-mfc/regs-mfc-v7.h   |   61 +++
 drivers/media/platform/s5p-mfc/s5p_mfc.c   |   32 
 drivers/media/platform/s5p-mfc/s5p_mfc_cmd.c   |2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c|3 +
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h|   23 ++-
 drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c  |   12 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c   |   18 ++-
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c   |  107 -
 drivers/media/platform/s5p-mfc/s5p_mfc_opr.c   |2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c|  149 +++--
 drivers/media/v4l2-core/v4l2-ctrls.c   |   67 +++-
 include/uapi/linux/v4l2-controls.h |   33 +++-
 16 files changed, 643 insertions(+), 60 deletions(-)
 create mode 100644 drivers/media/platform/s5p-mfc/regs-mfc-v7.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 v4 6/8] [media] V4L: Add support for integer menu controls with standard menu items

2013-07-08 Thread Arun Kumar K
From: Sylwester Nawrocki s.nawro...@samsung.com

The patch modifies the helper function v4l2_ctrl_new_std_menu
to accept integer menu controls with standard menu items.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Arun Kumar K arun...@samsung.com
Acked-by: Hans Verkuil hans.verk...@cisco.com
---
 Documentation/video4linux/v4l2-controls.txt |   21 ++--
 drivers/media/v4l2-core/v4l2-ctrls.c|   28 ---
 2 files changed, 36 insertions(+), 13 deletions(-)

diff --git a/Documentation/video4linux/v4l2-controls.txt 
b/Documentation/video4linux/v4l2-controls.txt
index 676f873..06cf3ac 100644
--- a/Documentation/video4linux/v4l2-controls.txt
+++ b/Documentation/video4linux/v4l2-controls.txt
@@ -124,26 +124,27 @@ You add non-menu controls by calling v4l2_ctrl_new_std:
const struct v4l2_ctrl_ops *ops,
u32 id, s32 min, s32 max, u32 step, s32 def);
 
-Menu controls are added by calling v4l2_ctrl_new_std_menu:
+Menu and integer menu controls are added by calling v4l2_ctrl_new_std_menu:
 
struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
const struct v4l2_ctrl_ops *ops,
u32 id, s32 max, s32 skip_mask, s32 def);
 
-Or alternatively for integer menu controls, by calling v4l2_ctrl_new_int_menu:
+Menu controls with a driver specific menu are added by calling
+v4l2_ctrl_new_std_menu_items:
+
+   struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(
+   struct v4l2_ctrl_handler *hdl,
+   const struct v4l2_ctrl_ops *ops, u32 id, s32 max,
+   s32 skip_mask, s32 def, const char * const *qmenu);
+
+Integer menu controls with a driver specific menu can be added by calling
+v4l2_ctrl_new_int_menu:
 
struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl,
const struct v4l2_ctrl_ops *ops,
u32 id, s32 max, s32 def, const s64 *qmenu_int);
 
-Standard menu controls with a driver specific menu are added by calling
-v4l2_ctrl_new_std_menu_items:
-
-   struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(
-   struct v4l2_ctrl_handler *hdl,
-   const struct v4l2_ctrl_ops *ops, u32 id, s32 max,
-   s32 skip_mask, s32 def, const char * const *qmenu);
-
 These functions are typically called right after the v4l2_ctrl_handler_init:
 
static const s64 exp_bias_qmenu[] = {
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index fccd08b..e03a2e8 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -552,6 +552,20 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
 }
 EXPORT_SYMBOL(v4l2_ctrl_get_menu);
 
+/*
+ * Returns NULL or an s64 type array containing the menu for given
+ * control ID. The total number of the menu items is returned in @len.
+ */
+const s64 const *v4l2_ctrl_get_int_menu(u32 id, u32 *len)
+{
+   switch (id) {
+   default:
+   *len = 0;
+   return NULL;
+   };
+}
+EXPORT_SYMBOL(v4l2_ctrl_get_int_menu);
+
 /* Return the control name. */
 const char *v4l2_ctrl_get_name(u32 id)
 {
@@ -1712,20 +1726,28 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct 
v4l2_ctrl_handler *hdl,
const struct v4l2_ctrl_ops *ops,
u32 id, s32 max, s32 mask, s32 def)
 {
-   const char * const *qmenu = v4l2_ctrl_get_menu(id);
+   const char * const *qmenu = NULL;
+   const s64 *qmenu_int = NULL;
const char *name;
enum v4l2_ctrl_type type;
+   unsigned int qmenu_int_len;
s32 min;
s32 step;
u32 flags;
 
v4l2_ctrl_fill(id, name, type, min, max, step, def, flags);
-   if (type != V4L2_CTRL_TYPE_MENU) {
+
+   if (type == V4L2_CTRL_TYPE_MENU)
+   qmenu = v4l2_ctrl_get_menu(id);
+   else if (type == V4L2_CTRL_TYPE_INTEGER_MENU)
+   qmenu_int = v4l2_ctrl_get_int_menu(id, qmenu_int_len);
+
+   if ((!qmenu  !qmenu_int) || (qmenu_int  max  qmenu_int_len)) {
handler_set_err(hdl, -EINVAL);
return NULL;
}
return v4l2_ctrl_new(hdl, ops, id, name, type,
-0, max, mask, def, flags, qmenu, NULL, NULL);
+0, max, mask, def, flags, qmenu, qmenu_int, NULL);
 }
 EXPORT_SYMBOL(v4l2_ctrl_new_std_menu);
 
-- 
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 v4 8/8] [media] s5p-mfc: Add support for VP8 encoder

2013-07-08 Thread Arun Kumar K
MFC v7 supports VP8 encoding and this patch adds support
for it in the driver.

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

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
index 5708fc3..db796c8 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
@@ -108,6 +108,9 @@ static int s5p_mfc_open_inst_cmd_v6(struct s5p_mfc_ctx *ctx)
case S5P_MFC_CODEC_H263_ENC:
codec_type = S5P_FIMV_CODEC_H263_ENC_V6;
break;
+   case S5P_MFC_CODEC_VP8_ENC:
+   codec_type = S5P_FIMV_CODEC_VP8_ENC_V7;
+   break;
default:
codec_type = S5P_FIMV_CODEC_NONE_V6;
};
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h 
b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
index 17545d7..6920b54 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
@@ -65,7 +65,7 @@ static inline dma_addr_t s5p_mfc_mem_cookie(void *a, void *b)
 #define MFC_ENC_CAP_PLANE_COUNT1
 #define MFC_ENC_OUT_PLANE_COUNT2
 #define STUFF_BYTE 4
-#define MFC_MAX_CTRLS  70
+#define MFC_MAX_CTRLS  77
 
 #define S5P_MFC_CODEC_NONE -1
 #define S5P_MFC_CODEC_H264_DEC 0
@@ -81,6 +81,7 @@ static inline dma_addr_t s5p_mfc_mem_cookie(void *a, void *b)
 #define S5P_MFC_CODEC_H264_MVC_ENC 21
 #define S5P_MFC_CODEC_MPEG4_ENC22
 #define S5P_MFC_CODEC_H263_ENC 23
+#define S5P_MFC_CODEC_VP8_ENC  24
 
 #define S5P_MFC_R2H_CMD_EMPTY  0
 #define S5P_MFC_R2H_CMD_SYS_INIT_RET   1
@@ -409,6 +410,21 @@ struct s5p_mfc_mpeg4_enc_params {
 };
 
 /**
+ * struct s5p_mfc_vp8_enc_params - encoding parameters for vp8
+ */
+struct s5p_mfc_vp8_enc_params {
+   u8 imd_4x4;
+   enum v4l2_vp8_num_partitions num_partitions;
+   enum v4l2_vp8_num_ref_frames num_ref;
+   u8 filter_level;
+   u8 filter_sharpness;
+   u32 golden_frame_ref_period;
+   enum v4l2_vp8_golden_frame_sel golden_frame_sel;
+   u8 hier_layer;
+   u8 hier_layer_qp[3];
+};
+
+/**
  * struct s5p_mfc_enc_params - general encoding parameters
  */
 struct s5p_mfc_enc_params {
@@ -442,6 +458,7 @@ struct s5p_mfc_enc_params {
struct {
struct s5p_mfc_h264_enc_params h264;
struct s5p_mfc_mpeg4_enc_params mpeg4;
+   struct s5p_mfc_vp8_enc_params vp8;
} codec;
 
 };
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
index 6dafe96..fb077b3 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
@@ -84,6 +84,13 @@ static struct s5p_mfc_fmt formats[] = {
.type   = MFC_FMT_ENC,
.num_planes = 1,
},
+   {
+   .name   = VP8 Encoded Stream,
+   .fourcc = V4L2_PIX_FMT_VP8,
+   .codec_mode = S5P_MFC_CODEC_VP8_ENC,
+   .type   = MFC_FMT_ENC,
+   .num_planes = 1,
+   },
 };
 
 #define NUM_FORMATS ARRAY_SIZE(formats)
@@ -557,6 +564,60 @@ static struct mfc_control controls[] = {
.step = 1,
.default_value = 0,
},
+   {
+   .id = V4L2_CID_MPEG_VIDEO_VPX_NUM_PARTITIONS,
+   .type = V4L2_CTRL_TYPE_INTEGER_MENU,
+   .maximum = V4L2_CID_MPEG_VIDEO_VPX_8_PARTITIONS,
+   .default_value = V4L2_CID_MPEG_VIDEO_VPX_1_PARTITION,
+   .menu_skip_mask = 0,
+   },
+   {
+   .id = V4L2_CID_MPEG_VIDEO_VPX_IMD_DISABLE_4X4,
+   .type = V4L2_CTRL_TYPE_BOOLEAN,
+   .minimum = 0,
+   .maximum = 1,
+   .step = 1,
+   .default_value = 0,
+   },
+   {
+   .id = V4L2_CID_MPEG_VIDEO_VPX_NUM_REF_FRAMES,
+   .type = V4L2_CTRL_TYPE_INTEGER_MENU,
+   .maximum = V4L2_CID_MPEG_VIDEO_VPX_2_REF_FRAME,
+   .default_value = V4L2_CID_MPEG_VIDEO_VPX_1_REF_FRAME,
+   .menu_skip_mask = 0,
+   },
+   {
+   .id = V4L2_CID_MPEG_VIDEO_VPX_FILTER_LEVEL,
+   .type = V4L2_CTRL_TYPE_INTEGER,
+   .minimum = 0,
+   .maximum = 63,
+   .step = 1,
+   .default_value = 0,
+   },
+   {
+   .id = V4L2_CID_MPEG_VIDEO_VPX_FILTER_SHARPNESS,
+   .type = 

[PATCH v4 3/8] [media] s5p-mfc: Add register definition file for MFC v7

2013-07-08 Thread Arun Kumar K
The patch adds the register definition file for new firmware
version v7 for MFC. New firmware supports VP8 encoding along with
many other features.

Signed-off-by: Arun Kumar K arun...@samsung.com
---
 drivers/media/platform/s5p-mfc/regs-mfc-v7.h |   58 ++
 1 file changed, 58 insertions(+)
 create mode 100644 drivers/media/platform/s5p-mfc/regs-mfc-v7.h

diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v7.h 
b/drivers/media/platform/s5p-mfc/regs-mfc-v7.h
new file mode 100644
index 000..24dba69
--- /dev/null
+++ b/drivers/media/platform/s5p-mfc/regs-mfc-v7.h
@@ -0,0 +1,58 @@
+/*
+ * Register definition file for Samsung MFC V7.x Interface (FIMV) driver
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _REGS_MFC_V7_H
+#define _REGS_MFC_V7_H
+
+#include regs-mfc-v6.h
+
+/* Additional features of v7 */
+#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
+#define S5P_FIMV_E_SOURCE_FIRST_STRIDE_V7  0xf9ec
+#define S5P_FIMV_E_SOURCE_SECOND_STRIDE_V7 0xf9f0
+#define S5P_FIMV_E_SOURCE_THIRD_STRIDE_V7  0xf9f4
+
+#define S5P_FIMV_E_ENCODED_SOURCE_FIRST_ADDR_V70xfa70
+#define S5P_FIMV_E_ENCODED_SOURCE_SECOND_ADDR_V7   0xfa74
+
+#define S5P_FIMV_E_VP8_OPTIONS_V7  0xfdb0
+#define S5P_FIMV_E_VP8_FILTER_OPTIONS_V7   0xfdb4
+#define S5P_FIMV_E_VP8_GOLDEN_FRAME_OPTION_V7  0xfdb8
+#define S5P_FIMV_E_VP8_NUM_T_LAYER_V7  0xfdc4
+
+/* MFCv7 variant defines */
+#define MAX_FW_SIZE_V7 (SZ_1M) /* 1MB */
+#define MAX_CPB_SIZE_V7(3 * SZ_1M) /* 3MB */
+#define MFC_VERSION_V7 0x72
+#define MFC_NUM_PORTS_V7   1
+
+/* MFCv7 Context buffer sizes */
+#define MFC_CTX_BUF_SIZE_V7(30 * SZ_1K)/*  30KB */
+#define MFC_H264_DEC_CTX_BUF_SIZE_V7   (2 * SZ_1M) /*  2MB */
+#define MFC_OTHER_DEC_CTX_BUF_SIZE_V7  (20 * SZ_1K)/*  20KB */
+#define MFC_H264_ENC_CTX_BUF_SIZE_V7   (100 * SZ_1K)   /* 100KB */
+#define MFC_OTHER_ENC_CTX_BUF_SIZE_V7  (10 * SZ_1K)/*  10KB */
+
+/* Buffer size defines */
+#define S5P_FIMV_SCRATCH_BUF_SIZE_MPEG4_DEC_V7(w, h) \
+   (SZ_1M + ((w) * 144) + (8192 * (h)) + 49216)
+
+#define S5P_FIMV_SCRATCH_BUF_SIZE_VP8_ENC_V7(w, h) \
+   (((w) * 48) + (((w) + 1) / 2 * 128) + 144 + 8192)
+
+#endif /*_REGS_MFC_V7_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 v4 5/8] [media] s5p-mfc: Update driver for v7 firmware

2013-07-08 Thread Arun Kumar K
Firmware version v7 is mostly similar to v6 in terms
of hardware specific controls and commands. So the hardware
specific opr_v6 and cmd_v6 are re-used for v7 also. This patch
updates the v6 files to handle v7 version also.

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

diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v7.h 
b/drivers/media/platform/s5p-mfc/regs-mfc-v7.h
index 24dba69..ea5ec2a 100644
--- a/drivers/media/platform/s5p-mfc/regs-mfc-v7.h
+++ b/drivers/media/platform/s5p-mfc/regs-mfc-v7.h
@@ -41,6 +41,9 @@
 #define MFC_VERSION_V7 0x72
 #define MFC_NUM_PORTS_V7   1
 
+#define MFC_LUMA_PAD_BYTES_V7  256
+#define MFC_CHROMA_PAD_BYTES_V7128
+
 /* MFCv7 Context buffer sizes */
 #define MFC_CTX_BUF_SIZE_V7(30 * SZ_1K)/*  30KB */
 #define MFC_H264_DEC_CTX_BUF_SIZE_V7   (2 * SZ_1M) /*  2MB */
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
index f734ccc..6dafe96 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
@@ -1665,6 +1665,7 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq,
 
psize[0] = ctx-luma_size;
psize[1] = ctx-chroma_size;
+
if (IS_MFCV6_PLUS(dev)) {
allocators[0] =
ctx-dev-alloc_ctx[MFC_BANK1_ALLOC_CTX];
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 7d4c5e1..3440317 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
@@ -80,6 +80,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx 
*ctx)
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);
+
ctx-luma_dpb_size = ALIGN((mb_width * mb_height) *
S5P_FIMV_LUMA_MB_TO_PIXEL_V6,
S5P_FIMV_LUMA_DPB_BUFFER_ALIGN_V6);
@@ -112,10 +113,18 @@ 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:
-   ctx-scratch_buf_size =
-   S5P_FIMV_SCRATCH_BUF_SIZE_MPEG4_DEC_V6(
-   mb_width,
-   mb_height);
+   if (IS_MFCV7(dev)) {
+   ctx-scratch_buf_size =
+   S5P_FIMV_SCRATCH_BUF_SIZE_MPEG4_DEC_V7(
+   mb_width,
+   mb_height);
+   } else {
+   ctx-scratch_buf_size =
+   S5P_FIMV_SCRATCH_BUF_SIZE_MPEG4_DEC_V6(
+   mb_width,
+   mb_height);
+   }
+
ctx-scratch_buf_size = ALIGN(ctx-scratch_buf_size,
S5P_FIMV_SCRATCH_BUFFER_ALIGN_V6);
ctx-bank1.size = ctx-scratch_buf_size;
@@ -329,6 +338,12 @@ static void s5p_mfc_enc_calc_src_size_v6(struct 
s5p_mfc_ctx *ctx)
ctx-buf_width = ALIGN(ctx-img_width, S5P_FIMV_NV12M_HALIGN_V6);
ctx-luma_size = ALIGN((mb_width * mb_height) * 256, 256);
ctx-chroma_size = ALIGN((mb_width * mb_height) * 128, 256);
+
+   /* MFCv7 needs pad bytes for Luma and Chroma */
+   if (IS_MFCV7(ctx-dev)) {
+   ctx-luma_size += MFC_LUMA_PAD_BYTES_V7;
+   ctx-chroma_size += MFC_CHROMA_PAD_BYTES_V7;
+   }
 }
 
 /* Set registers for decoding stream buffer */
@@ -453,8 +468,13 @@ static void s5p_mfc_set_enc_frame_buffer_v6(struct 
s5p_mfc_ctx *ctx,
 {
struct s5p_mfc_dev *dev = ctx-dev;
 
-   WRITEL(y_addr, S5P_FIMV_E_SOURCE_LUMA_ADDR_V6); /* 256B align */
-   WRITEL(c_addr, S5P_FIMV_E_SOURCE_CHROMA_ADDR_V6);
+   if (IS_MFCV7(dev)) {
+   WRITEL(y_addr, S5P_FIMV_E_SOURCE_FIRST_ADDR_V7);
+   WRITEL(c_addr, S5P_FIMV_E_SOURCE_SECOND_ADDR_V7);
+   } else {
+   WRITEL(y_addr, S5P_FIMV_E_SOURCE_LUMA_ADDR_V6);
+   WRITEL(c_addr, S5P_FIMV_E_SOURCE_CHROMA_ADDR_V6);
+   }
 
mfc_debug(2, enc src y buf addr: 0x%08lx\n, y_addr);
mfc_debug(2, enc src c buf addr: 0x%08lx\n, c_addr);
@@ -466,8 +486,13 @@ static void s5p_mfc_get_enc_frame_buffer_v6(struct 
s5p_mfc_ctx *ctx,
struct s5p_mfc_dev *dev = ctx-dev;
  

[PATCH v4 1/8] [media] s5p-mfc: Update v6 encoder buffer sizes

2013-07-08 Thread Arun Kumar K
The patch updates few encoder buffer sizes for MFC v6.5
as per the udpdated user manual. The same buffer sizes
holds good for v7 firmware also.

Signed-off-by: Arun Kumar K arun...@samsung.com
Signed-off-by: Kiran AVND avnd.ki...@samsung.com
---
 drivers/media/platform/s5p-mfc/regs-mfc-v6.h |4 ++--
 1 file changed, 2 insertions(+), 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 363a97c..2398cdf 100644
--- a/drivers/media/platform/s5p-mfc/regs-mfc-v6.h
+++ b/drivers/media/platform/s5p-mfc/regs-mfc-v6.h
@@ -374,9 +374,9 @@
 #define S5P_FIMV_NUM_PIXELS_IN_MB_COL_V6   16
 
 /* Buffer size requirements defined by hardware */
-#define S5P_FIMV_TMV_BUFFER_SIZE_V6(w, h)  (((w) + 1) * ((h) + 1) * 8)
+#define S5P_FIMV_TMV_BUFFER_SIZE_V6(w, h)  (((w) + 1) * ((h) + 3) * 8)
 #define S5P_FIMV_ME_BUFFER_SIZE_V6(imw, imh, mbw, mbh) \
-   ((DIV_ROUND_UP(imw, 64) *  DIV_ROUND_UP(imh, 64) * 256) + \
+   (imw + 127) / 64) * 16) *  DIV_ROUND_UP(imh, 64) * 256) + \
 (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) \
-- 
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 v4 7/8] [media] V4L: Add VP8 encoder controls

2013-07-08 Thread Arun Kumar K
This patch adds new V4L controls for VP8 encoding.

Signed-off-by: Kiran AVND avnd.ki...@samsung.com
Signed-off-by: Arun Kumar K arun...@samsung.com
---
 Documentation/DocBook/media/v4l/controls.xml |  168 +-
 drivers/media/v4l2-core/v4l2-ctrls.c |   39 +-
 include/uapi/linux/v4l2-controls.h   |   33 -
 3 files changed, 230 insertions(+), 10 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index 8d7a779..4bcedbf 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -722,17 +722,22 @@ for more details./para
 /section
 
 section id=mpeg-controls
-  titleMPEG Control Reference/title
+  titleCodec Control Reference/title
 
-  paraBelow all controls within the MPEG control class are
+  paraBelow all controls within the Codec control class are
 described. First the generic controls, then controls specific for
 certain hardware./para
 
+  paraNote: These controls are applicable all codecs and
+not just MPEG. The defines are prefixed with V4L2_CID_MPEG/V4L2_MPEG
+as the controls were originally made for MPEG class and later
+extended to cover all encoding formats./para
+
   section
-   titleGeneric MPEG Controls/title
+   titleGeneric Codec Controls/title
 
table pgwide=1 frame=none id=mpeg-control-id
- titleMPEG Control IDs/title
+ titleCodec Control IDs/title
  tgroup cols=4
colspec colname=c1 colwidth=1* /
colspec colname=c2 colwidth=6* /
@@ -752,7 +757,7 @@ certain hardware./para
  row
entry 
spanname=idconstantV4L2_CID_MPEG_CLASS/constantnbsp;/entry
entryclass/entry
- /rowrowentry spanname=descrThe MPEG class
+ /rowrowentry spanname=descrThe Codec class
 descriptor. Calling VIDIOC-QUERYCTRL; for this control will return a
 description of this control class. This description can be used as the
 caption of a Tab page in a GUI, for example./entry
@@ -3009,6 +3014,159 @@ in by the application. 0 = do not insert, 1 = insert 
packets./entry
  /tgroup
/table
   /section
+
+section
+  titleVPX Control Reference/title
+
+  paraThe VPX controls include controls for encoding parameters
+  of VPx video codec./para
+
+  table pgwide=1 frame=none id=vpx-control-id
+  titleVPX Control IDs/title
+
+  tgroup cols=4
+colspec colname=c1 colwidth=1* /
+colspec colname=c2 colwidth=6* /
+colspec colname=c3 colwidth=2* /
+colspec colname=c4 colwidth=6* /
+spanspec namest=c1 nameend=c2 spanname=id /
+spanspec namest=c2 nameend=c4 spanname=descr /
+thead
+  row
+entry spanname=id align=leftID/entry
+entry align=leftType/entry
+  /rowrow rowsep=1entry spanname=descr 
align=leftDescription/entry
+  /row
+/thead
+tbody valign=top
+  rowentry/entry/row
+
+ rowentry/entry/row
+ row id=v4l2-vpx-num-partitions
+   entry 
spanname=idconstantV4L2_CID_MPEG_VIDEO_VPX_NUM_PARTITIONS/constant/entry
+   entryenum v4l2_vp8_num_partitions/entry
+ /row
+ rowentry spanname=descrThe number of token partitions to 
use in VP8 encoder.
+Possible values are:/entry
+ /row
+ row
+   entrytbl spanname=descr cols=2
+ tbody valign=top
+   row
+ 
entryconstantV4L2_CID_MPEG_VIDEO_VPX_1_PARTITION/constant/entry
+ entry1 coefficient partition/entry
+   /row
+   row
+ 
entryconstantV4L2_CID_MPEG_VIDEO_VPX_2_PARTITIONS/constant/entry
+ entry2 coefficient partitions/entry
+   /row
+   row
+ 
entryconstantV4L2_CID_MPEG_VIDEO_VPX_4_PARTITIONS/constant/entry
+ entry4 coefficient partitions/entry
+   /row
+   row
+ 
entryconstantV4L2_CID_MPEG_VIDEO_VPX_8_PARTITIONS/constant/entry
+ entry8 coefficient partitions/entry
+   /row
+  /tbody
+   /entrytbl
+ /row
+
+ rowentry/entry/row
+ row
+   entry 
spanname=idconstantV4L2_CID_MPEG_VIDEO_VPX_IMD_DISABLE_4X4/constant/entry
+   entryboolean/entry
+ /row
+ rowentry spanname=descrSetting this prevents intra 4x4 mode 
in the intra mode decision./entry
+ /row
+
+ rowentry/entry/row
+ row id=v4l2-vpx-num-ref-frames
+   entry 
spanname=idconstantV4L2_CID_MPEG_VIDEO_VPX_NUM_REF_FRAMES/constant/entry
+   entryenum v4l2_vp8_num_ref_frames/entry
+   

[PATCH v4 2/8] [media] s5p-mfc: Rename IS_MFCV6 macro

2013-07-08 Thread Arun Kumar K
The MFC v6 specific code holds good for MFC v7 also as
the v7 version is a superset of v6 and the HW interface
remains more or less similar. This patch renames the macro
IS_MFCV6() to IS_MFCV6_PLUS() so that it can be used
for v7 also.

Signed-off-by: Arun Kumar K arun...@samsung.com
---
 drivers/media/platform/s5p-mfc/s5p_mfc_cmd.c|2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h |2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c   |   12 ++--
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c|   18 ++
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c|   16 +---
 drivers/media/platform/s5p-mfc/s5p_mfc_opr.c|2 +-
 6 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd.c
index f0a41c9..242c033 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd.c
@@ -20,7 +20,7 @@ static struct s5p_mfc_hw_cmds *s5p_mfc_cmds;
 
 void s5p_mfc_init_hw_cmds(struct s5p_mfc_dev *dev)
 {
-   if (IS_MFCV6(dev))
+   if (IS_MFCV6_PLUS(dev))
s5p_mfc_cmds = s5p_mfc_init_hw_cmds_v6();
else
s5p_mfc_cmds = s5p_mfc_init_hw_cmds_v5();
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h 
b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
index ef4074c..d47016d 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
@@ -683,6 +683,6 @@ void set_work_bit_irqsave(struct s5p_mfc_ctx *ctx);
 #define HAS_PORTNUM(dev)   (dev ? (dev-variant ? \
(dev-variant-port_num ? 1 : 0) : 0) : 0)
 #define IS_TWOPORT(dev)(dev-variant-port_num == 2 ? 1 : 0)
-#define IS_MFCV6(dev)  (dev-variant-version = 0x60 ? 1 : 0)
+#define IS_MFCV6_PLUS(dev) (dev-variant-version = 0x60 ? 1 : 0)
 
 #endif /* S5P_MFC_COMMON_H_ */
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
index dc1fc94..7cab684 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
@@ -164,7 +164,7 @@ int s5p_mfc_reset(struct s5p_mfc_dev *dev)
 
mfc_debug_enter();
 
-   if (IS_MFCV6(dev)) {
+   if (IS_MFCV6_PLUS(dev)) {
/* Reset IP */
/*  except RISC, reset */
mfc_write(dev, 0xFEE, S5P_FIMV_MFC_RESET_V6);
@@ -213,7 +213,7 @@ int s5p_mfc_reset(struct s5p_mfc_dev *dev)
 
 static inline void s5p_mfc_init_memctrl(struct s5p_mfc_dev *dev)
 {
-   if (IS_MFCV6(dev)) {
+   if (IS_MFCV6_PLUS(dev)) {
mfc_write(dev, dev-bank1, S5P_FIMV_RISC_BASE_ADDRESS_V6);
mfc_debug(2, Base Address : %08x\n, dev-bank1);
} else {
@@ -226,7 +226,7 @@ static inline void s5p_mfc_init_memctrl(struct s5p_mfc_dev 
*dev)
 
 static inline void s5p_mfc_clear_cmds(struct s5p_mfc_dev *dev)
 {
-   if (IS_MFCV6(dev)) {
+   if (IS_MFCV6_PLUS(dev)) {
/* Zero initialization should be done before RESET.
 * Nothing to do here. */
} else {
@@ -264,7 +264,7 @@ int s5p_mfc_init_hw(struct s5p_mfc_dev *dev)
s5p_mfc_clear_cmds(dev);
/* 3. Release reset signal to the RISC */
s5p_mfc_clean_dev_int_flags(dev);
-   if (IS_MFCV6(dev))
+   if (IS_MFCV6_PLUS(dev))
mfc_write(dev, 0x1, S5P_FIMV_RISC_ON_V6);
else
mfc_write(dev, 0x3ff, S5P_FIMV_SW_RESET);
@@ -301,7 +301,7 @@ int s5p_mfc_init_hw(struct s5p_mfc_dev *dev)
s5p_mfc_clock_off();
return -EIO;
}
-   if (IS_MFCV6(dev))
+   if (IS_MFCV6_PLUS(dev))
ver = mfc_read(dev, S5P_FIMV_FW_VERSION_V6);
else
ver = mfc_read(dev, S5P_FIMV_FW_VERSION);
@@ -380,7 +380,7 @@ int s5p_mfc_wakeup(struct s5p_mfc_dev *dev)
return ret;
}
/* 4. Release reset signal to the RISC */
-   if (IS_MFCV6(dev))
+   if (IS_MFCV6_PLUS(dev))
mfc_write(dev, 0x1, S5P_FIMV_RISC_ON_V6);
else
mfc_write(dev, 0x3ff, S5P_FIMV_SW_RESET);
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
index 00b0703..56a1d3b 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
@@ -382,7 +382,7 @@ static int vidioc_try_fmt(struct file *file, void *priv, 
struct v4l2_format *f)
mfc_err(Unsupported format for source.\n);
return -EINVAL;
}
-   if (!IS_MFCV6(dev)  (fmt-fourcc == V4L2_PIX_FMT_VP8)) {
+   if (!IS_MFCV6_PLUS(dev)  (fmt-fourcc == V4L2_PIX_FMT_VP8)) {
mfc_err(Not supported format.\n);
return -EINVAL;
}
@@ 

[PATCH v4 4/8] [media] s5p-mfc: Core support for MFC v7

2013-07-08 Thread Arun Kumar K
Adds variant data and core support for the MFC v7 firmware

Signed-off-by: Arun Kumar K arun...@samsung.com
---
 .../devicetree/bindings/media/s5p-mfc.txt  |1 +
 drivers/media/platform/s5p-mfc/s5p_mfc.c   |   32 
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h|2 ++
 3 files changed, 35 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/s5p-mfc.txt 
b/Documentation/devicetree/bindings/media/s5p-mfc.txt
index 67ec3d4..cb9c5bc 100644
--- a/Documentation/devicetree/bindings/media/s5p-mfc.txt
+++ b/Documentation/devicetree/bindings/media/s5p-mfc.txt
@@ -10,6 +10,7 @@ Required properties:
   - compatible : value should be either one among the following
(a) samsung,mfc-v5 for MFC v5 present in Exynos4 SoCs
(b) samsung,mfc-v6 for MFC v6 present in Exynos5 SoCs
+   (b) samsung,mfc-v7 for MFC v7 present in Exynos5420 SoC
 
   - reg : Physical base address of the IP registers and length of memory
  mapped region.
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index d12faa6..d6be52f 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -1391,6 +1391,32 @@ static struct s5p_mfc_variant mfc_drvdata_v6 = {
.fw_name= s5p-mfc-v6.fw,
 };
 
+struct s5p_mfc_buf_size_v6 mfc_buf_size_v7 = {
+   .dev_ctx= MFC_CTX_BUF_SIZE_V7,
+   .h264_dec_ctx   = MFC_H264_DEC_CTX_BUF_SIZE_V7,
+   .other_dec_ctx  = MFC_OTHER_DEC_CTX_BUF_SIZE_V7,
+   .h264_enc_ctx   = MFC_H264_ENC_CTX_BUF_SIZE_V7,
+   .other_enc_ctx  = MFC_OTHER_ENC_CTX_BUF_SIZE_V7,
+};
+
+struct s5p_mfc_buf_size buf_size_v7 = {
+   .fw = MAX_FW_SIZE_V7,
+   .cpb= MAX_CPB_SIZE_V7,
+   .priv   = mfc_buf_size_v7,
+};
+
+struct s5p_mfc_buf_align mfc_buf_align_v7 = {
+   .base = 0,
+};
+
+static struct s5p_mfc_variant mfc_drvdata_v7 = {
+   .version= MFC_VERSION_V7,
+   .port_num   = MFC_NUM_PORTS_V7,
+   .buf_size   = buf_size_v7,
+   .buf_align  = mfc_buf_align_v7,
+   .fw_name= s5p-mfc-v7.fw,
+};
+
 static struct platform_device_id mfc_driver_ids[] = {
{
.name = s5p-mfc,
@@ -1401,6 +1427,9 @@ static struct platform_device_id mfc_driver_ids[] = {
}, {
.name = s5p-mfc-v6,
.driver_data = (unsigned long)mfc_drvdata_v6,
+   }, {
+   .name = s5p-mfc-v7,
+   .driver_data = (unsigned long)mfc_drvdata_v7,
},
{},
 };
@@ -1413,6 +1442,9 @@ static const struct of_device_id exynos_mfc_match[] = {
}, {
.compatible = samsung,mfc-v6,
.data = mfc_drvdata_v6,
+   }, {
+   .compatible = samsung,mfc-v7,
+   .data = mfc_drvdata_v7,
},
{},
 };
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h 
b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
index d47016d..17545d7 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
@@ -24,6 +24,7 @@
 #include media/videobuf2-core.h
 #include regs-mfc.h
 #include regs-mfc-v6.h
+#include regs-mfc-v7.h
 
 /* Definitions related to MFC memory */
 
@@ -684,5 +685,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)
 
 #endif /* S5P_MFC_COMMON_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


Re: [PATCH v4 7/8] [media] V4L: Add VP8 encoder controls

2013-07-08 Thread Hans Verkuil
Hi Arun,

A few small comments below. After fixing that you can add my:

Acked-by: Hans Verkuil hans.verk...@cisco.com

for this patch.

On Mon July 8 2013 14:30:35 Arun Kumar K wrote:
 This patch adds new V4L controls for VP8 encoding.
 
 Signed-off-by: Kiran AVND avnd.ki...@samsung.com
 Signed-off-by: Arun Kumar K arun...@samsung.com
 ---
  Documentation/DocBook/media/v4l/controls.xml |  168 
 +-
  drivers/media/v4l2-core/v4l2-ctrls.c |   39 +-
  include/uapi/linux/v4l2-controls.h   |   33 -
  3 files changed, 230 insertions(+), 10 deletions(-)
 
 diff --git a/Documentation/DocBook/media/v4l/controls.xml 
 b/Documentation/DocBook/media/v4l/controls.xml
 index 8d7a779..4bcedbf 100644
 --- a/Documentation/DocBook/media/v4l/controls.xml
 +++ b/Documentation/DocBook/media/v4l/controls.xml
 @@ -722,17 +722,22 @@ for more details./para
  /section
  
  section id=mpeg-controls
 -  titleMPEG Control Reference/title
 +  titleCodec Control Reference/title
  
 -  paraBelow all controls within the MPEG control class are
 +  paraBelow all controls within the Codec control class are
  described. First the generic controls, then controls specific for
  certain hardware./para
  
 +  paraNote: These controls are applicable all codecs and

s/all/to all/

 +not just MPEG. The defines are prefixed with V4L2_CID_MPEG/V4L2_MPEG
 +as the controls were originally made for MPEG class and later

s/class/codecs/

 +extended to cover all encoding formats./para
 +
section
 - titleGeneric MPEG Controls/title
 + titleGeneric Codec Controls/title
  
   table pgwide=1 frame=none id=mpeg-control-id
 -   titleMPEG Control IDs/title
 +   titleCodec Control IDs/title
 tgroup cols=4
   colspec colname=c1 colwidth=1* /
   colspec colname=c2 colwidth=6* /
 @@ -752,7 +757,7 @@ certain hardware./para
 row
   entry 
 spanname=idconstantV4L2_CID_MPEG_CLASS/constantnbsp;/entry
   entryclass/entry
 -   /rowrowentry spanname=descrThe MPEG class
 +   /rowrowentry spanname=descrThe Codec class
  descriptor. Calling VIDIOC-QUERYCTRL; for this control will return a
  description of this control class. This description can be used as the
  caption of a Tab page in a GUI, for example./entry
 @@ -3009,6 +3014,159 @@ in by the application. 0 = do not insert, 1 = insert 
 packets./entry
 /tgroup
   /table
/section
 +
 +section
 +  titleVPX Control Reference/title
 +
 +  paraThe VPX controls include controls for encoding parameters
 +  of VPx video codec./para
 +
 +  table pgwide=1 frame=none id=vpx-control-id
 +  titleVPX Control IDs/title
 +
 +  tgroup cols=4
 +colspec colname=c1 colwidth=1* /
 +colspec colname=c2 colwidth=6* /
 +colspec colname=c3 colwidth=2* /
 +colspec colname=c4 colwidth=6* /
 +spanspec namest=c1 nameend=c2 spanname=id /
 +spanspec namest=c2 nameend=c4 spanname=descr /
 +thead
 +  row
 +entry spanname=id align=leftID/entry
 +entry align=leftType/entry
 +  /rowrow rowsep=1entry spanname=descr 
 align=leftDescription/entry
 +  /row
 +/thead
 +tbody valign=top
 +  rowentry/entry/row
 +
 +   rowentry/entry/row
 +   row id=v4l2-vpx-num-partitions
 + entry 
 spanname=idconstantV4L2_CID_MPEG_VIDEO_VPX_NUM_PARTITIONS/constant/entry
 + entryenum v4l2_vp8_num_partitions/entry
 +   /row
 +   rowentry spanname=descrThe number of token partitions to 
 use in VP8 encoder.
 +Possible values are:/entry
 +   /row
 +   row
 + entrytbl spanname=descr cols=2
 +   tbody valign=top
 + row
 +   
 entryconstantV4L2_CID_MPEG_VIDEO_VPX_1_PARTITION/constant/entry
 +   entry1 coefficient partition/entry
 + /row
 + row
 +   
 entryconstantV4L2_CID_MPEG_VIDEO_VPX_2_PARTITIONS/constant/entry
 +   entry2 coefficient partitions/entry
 + /row
 + row
 +   
 entryconstantV4L2_CID_MPEG_VIDEO_VPX_4_PARTITIONS/constant/entry
 +   entry4 coefficient partitions/entry
 + /row
 + row
 +   
 entryconstantV4L2_CID_MPEG_VIDEO_VPX_8_PARTITIONS/constant/entry
 +   entry8 coefficient partitions/entry
 + /row
 +  /tbody
 + /entrytbl
 +   /row
 +
 +   rowentry/entry/row
 +   row
 + entry 
 spanname=idconstantV4L2_CID_MPEG_VIDEO_VPX_IMD_DISABLE_4X4/constant/entry
 + entryboolean/entry
 +   /row
 +   rowentry spanname=descrSetting this prevents intra 4x4 mode 
 in the intra mode decision./entry
 +

cron job: media_tree daily build: WARNINGS

2013-07-08 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:   Mon Jul  8 19:00:22 CEST 2013
git branch: test
git hash:   1c26190a8d492adadac4711fe5762d46204b18b0
gcc version:i686-linux-gcc (GCC) 4.8.1
sparse version: v0.4.5-rc1
host hardware:  x86_64
host os:3.9-7.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: WARNINGS
linux-2.6.32.27-i686: WARNINGS
linux-2.6.33.7-i686: WARNINGS
linux-2.6.34.7-i686: WARNINGS
linux-2.6.35.9-i686: WARNINGS
linux-2.6.36.4-i686: WARNINGS
linux-2.6.37.6-i686: WARNINGS
linux-2.6.38.8-i686: WARNINGS
linux-2.6.39.4-i686: WARNINGS
linux-3.0.60-i686: OK
linux-3.10-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: WARNINGS
linux-3.5.7-i686: WARNINGS
linux-3.6.11-i686: WARNINGS
linux-3.7.4-i686: WARNINGS
linux-3.8-i686: WARNINGS
linux-3.9.2-i686: WARNINGS
linux-2.6.31.14-x86_64: WARNINGS
linux-2.6.32.27-x86_64: WARNINGS
linux-2.6.33.7-x86_64: WARNINGS
linux-2.6.34.7-x86_64: WARNINGS
linux-2.6.35.9-x86_64: WARNINGS
linux-2.6.36.4-x86_64: WARNINGS
linux-2.6.37.6-x86_64: WARNINGS
linux-2.6.38.8-x86_64: WARNINGS
linux-2.6.39.4-x86_64: WARNINGS
linux-3.0.60-x86_64: OK
linux-3.10-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: WARNINGS
linux-3.5.7-x86_64: WARNINGS
linux-3.6.11-x86_64: WARNINGS
linux-3.7.4-x86_64: WARNINGS
linux-3.8-x86_64: WARNINGS
linux-3.9.2-x86_64: WARNINGS
apps: WARNINGS
spec-git: OK
sparse version: v0.4.5-rc1
sparse: ERRORS

Detailed results are available here:

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

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Monday.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


[PATCH] [media] redrat3: errors on unplug

2013-07-08 Thread Sean Young
In an usb disconnect handler, the urbs have already been cancelled so the
attempt to disable the IR receiver just results in errors:

[  899.638862] redrat3 7-2:1.0: redrat3_send_cmd: Error sending rr3 cmd res 
-110, data 0
[  899.638870] redrat3 7-2:1.0: redrat3_disable_detector: detector status: 251, 
should be 0

Signed-off-by: Sean Young s...@mess.org
---
 drivers/media/rc/redrat3.c | 27 ---
 1 file changed, 27 deletions(-)

diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c
index 12167a6..3749443 100644
--- a/drivers/media/rc/redrat3.c
+++ b/drivers/media/rc/redrat3.c
@@ -206,8 +206,6 @@ struct redrat3_dev {
struct timer_list rx_timeout;
u32 hw_timeout;
 
-   /* is the detector enabled*/
-   bool det_enabled;
/* Is the device currently transmitting?*/
bool transmitting;
 
@@ -472,32 +470,11 @@ static int redrat3_enable_detector(struct redrat3_dev 
*rr3)
return -EIO;
}
 
-   rr3-det_enabled = true;
redrat3_issue_async(rr3);
 
return 0;
 }
 
-/* Disables the rr3 long range detector */
-static void redrat3_disable_detector(struct redrat3_dev *rr3)
-{
-   struct device *dev = rr3-dev;
-   u8 ret;
-
-   rr3_ftr(dev, Entering %s\n, __func__);
-
-   ret = redrat3_send_cmd(RR3_RC_DET_DISABLE, rr3);
-   if (ret != 0)
-   dev_err(dev, %s: failure!\n, __func__);
-
-   ret = redrat3_send_cmd(RR3_RC_DET_STATUS, rr3);
-   if (ret != 0)
-   dev_warn(dev, %s: detector status: %d, should be 0\n,
-__func__, ret);
-
-   rr3-det_enabled = false;
-}
-
 static inline void redrat3_delete(struct redrat3_dev *rr3,
  struct usb_device *udev)
 {
@@ -788,7 +765,6 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, 
unsigned *txbuf,
count = min_t(unsigned, count, RR3_MAX_SIG_SIZE - RR3_TX_TRAILER_LEN);
 
/* rr3 will disable rc detector on transmit */
-   rr3-det_enabled = false;
rr3-transmitting = true;
 
sample_lens = kzalloc(sizeof(int) * RR3_DRIVER_MAXLENS, GFP_KERNEL);
@@ -868,7 +844,6 @@ out:
 
rr3-transmitting = false;
/* rr3 re-enables rc detector because it was enabled before */
-   rr3-det_enabled = true;
 
return ret;
 }
@@ -1048,8 +1023,6 @@ static void redrat3_dev_disconnect(struct usb_interface 
*intf)
if (!rr3)
return;
 
-   redrat3_disable_detector(rr3);
-
usb_set_intfdata(intf, NULL);
rc_unregister_device(rr3-rc);
del_timer_sync(rr3-rx_timeout);
-- 
1.8.3.1

--
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] lirc: validate transmission ir data

2013-07-08 Thread Sean Young
The lirc interface allows 255 u32 spaces and pulses, which are usec. If
the driver can handle this (e.g. winbond-cir) you can produce hours of
meaningless IR data and there is no method of interrupting it.

Signed-off-by: Sean Young s...@mess.org
---
 drivers/media/rc/ir-lirc-codec.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c
index e456126..e5be920 100644
--- a/drivers/media/rc/ir-lirc-codec.c
+++ b/drivers/media/rc/ir-lirc-codec.c
@@ -140,11 +140,20 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, 
const char __user *buf,
goto out;
}
 
+   for (i = 0; i  count; i++) {
+   if (txbuf[i]  IR_MAX_DURATION / 1000 - duration || !txbuf[i]) {
+   ret = -EINVAL;
+   goto out;
+   }
+
+   duration += txbuf[i];
+   }
+
ret = dev-tx_ir(dev, txbuf, count);
if (ret  0)
goto out;
 
-   for (i = 0; i  ret; i++)
+   for (duration = i = 0; i  ret; i++)
duration += txbuf[i];
 
ret *= sizeof(unsigned int);
-- 
1.8.3.1

--
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] lirc: make transmit interface consistent

2013-07-08 Thread Sean Young
All lirc drivers that can transmit, return EINVAL when they are passed
more than IR data than they can send. That is, except for two drivers
which I touched.

Signed-off-by: Sean Young s...@mess.org
---
 Documentation/DocBook/media/v4l/lirc_device_interface.xml | 4 +++-
 drivers/media/rc/iguanair.c   | 4 ++--
 drivers/media/rc/redrat3.c| 7 ---
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/lirc_device_interface.xml 
b/Documentation/DocBook/media/v4l/lirc_device_interface.xml
index 8d7eb6b..34cada2 100644
--- a/Documentation/DocBook/media/v4l/lirc_device_interface.xml
+++ b/Documentation/DocBook/media/v4l/lirc_device_interface.xml
@@ -46,7 +46,9 @@ describing an IR signal are read from the chardev./para
 values. Pulses and spaces are only marked implicitly by their position. The
 data must start and end with a pulse, therefore, the data must always include
 an uneven number of samples. The write function must block until the data has
-been transmitted by the hardware./para
+been transmitted by the hardware. If more data is provided than the hardware
+can send, the driver returns EINVAL./para
+
 /section
 
 section id=lirc_ioctl
diff --git a/drivers/media/rc/iguanair.c b/drivers/media/rc/iguanair.c
index a4ab2e6..19632b1 100644
--- a/drivers/media/rc/iguanair.c
+++ b/drivers/media/rc/iguanair.c
@@ -364,8 +364,8 @@ static int iguanair_tx(struct rc_dev *dev, unsigned *txbuf, 
unsigned count)
periods = DIV_ROUND_CLOSEST(txbuf[i] * ir-carrier, 100);
bytes = DIV_ROUND_UP(periods, 127);
if (size + bytes  ir-bufsize) {
-   count = i;
-   break;
+   rc = -EINVAL;
+   goto out;
}
while (periods  127) {
ir-packet-payload[size++] = 127 | space;
diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c
index 3749443..0042367 100644
--- a/drivers/media/rc/redrat3.c
+++ b/drivers/media/rc/redrat3.c
@@ -762,7 +762,8 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, 
unsigned *txbuf,
return -EAGAIN;
}
 
-   count = min_t(unsigned, count, RR3_MAX_SIG_SIZE - RR3_TX_TRAILER_LEN);
+   if (count  RR3_MAX_SIG_SIZE - RR3_TX_TRAILER_LEN)
+   return -EINVAL;
 
/* rr3 will disable rc detector on transmit */
rr3-transmitting = true;
@@ -801,8 +802,8 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, 
unsigned *txbuf,
irdata-lens[curlencheck]);
curlencheck++;
} else {
-   count = i - 1;
-   break;
+   ret = -EINVAL;
+   goto out;
}
}
irdata-sigdata[i] = lencheck;
-- 
1.8.3.1

--
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] rc: allowed_protos now is a bit field

2013-07-08 Thread Sean Young
This one must have missed the conversion c003ab1b [media] rc-core:
add separate defines for protocol bitmaps and numbers.

Signed-off-by: Sean Young s...@mess.org
---
 drivers/media/usb/dvb-usb/m920x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb/m920x.c 
b/drivers/media/usb/dvb-usb/m920x.c
index c2b635d..0306cb7 100644
--- a/drivers/media/usb/dvb-usb/m920x.c
+++ b/drivers/media/usb/dvb-usb/m920x.c
@@ -1212,7 +1212,7 @@ static struct dvb_usb_device_properties vp7049_properties 
= {
.rc_interval= 150,
.rc_codes   = RC_MAP_TWINHAN_VP1027_DVBS,
.rc_query   = m920x_rc_core_query,
-   .allowed_protos = RC_TYPE_UNKNOWN,
+   .allowed_protos = RC_BIT_UNKNOWN,
},
 
.size_of_priv = sizeof(struct m920x_state),
-- 
1.8.3.1

--
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: lgdt3304

2013-07-08 Thread Carl-Fredrik Sundstrom
Need some advice and pointers.
I have gotten both adapters/frontends of the VerMedia AVerTVHD Duet PCTV
tuner (A188) A188-AF card to register.

[ 6251.073357] DVB: registering new adapter (SAA716x dvb adapter)
[ 6251.217817] tda18271 1-0060: creating new instance
[ 6251.219671] TDA18271HD/C2 detected @ 1-0060
[ 6251.484794] SAA716x Budget :04:00.0: DVB: registering adapter 0
frontend 0 (LG Electronics LGDT3304 VSB/QAM Frontend)...
[ 6251.485084] DVB: registering new adapter (SAA716x dvb adapter)
[ 6251.601649] tda18271 0-0060: creating new instance
[ 6251.603615] TDA18271HD/C2 detected @ 0-0060
[ 6251.868787] SAA716x Budget :04:00.0: DVB: registering adapter 1
frontend 0 (LG Electronics LGDT3304 VSB/QAM Frontend)...


The card only has one RF input hence I believe the two TDA18271 tuners are
setup in master/slave configuration.
When I try to set them up as master slave the slave fails to detect as seen
in below log. If I configure both as master 
both are detected 

[ 5410.137358] DVB: registering new adapter (SAA716x dvb adapter)
[ 5410.281839] tda18271 1-0060: creating new instance
[ 5410.283694] TDA18271HD/C2 detected @ 1-0060
[ 5410.548784] SAA716x Budget :04:00.0: DVB: registering adapter 0
frontend 0 (LG Electronics LGDT3304 VSB/QAM Frontend)...
[ 5410.549081] DVB: registering new adapter (SAA716x dvb adapter)
[ 5410.665649] tda18271 0-0060: creating new instance
[ 5410.669264] Unknown device (0) detected @ 0-0060, device not supported.
[ 5410.669269] tda18271_attach: [0-0060|S] error -22 on line 1285
[ 5410.669272] tda18271 0-0060: destroying instance
[ 5410.704784] SAA716x Budget :04:00.0: DVB: registering adapter 1
frontend 0 (LG Electronics LGDT3304 VSB/QAM Frontend)...

When I try to tune I get the following on all stations.

using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
 tune to: 57028615:8VSB
WARNING:  tuning failed!!!
 tune to: 57028615:8VSB (tuning failed)

Sometimes I also get 
WARNING: filter timeout pid
This happens mostly on frequencies I know have stations in my dfw area.

Any pointers would be much appreciated, especially how to find out which
tda18271 is master and how to setup 
the configuration struct's for ATSC , master, slave . 

Thanks /// Carl

/*when both tda18271 are configured with below struct they are both found */

/*if I remove .gate and .role comments it fails to detect the tda18271 on
the first i2c bus */
static struct tda18271_config averduet_tda_config_master = {
.std_map   = averduet_std_map,
//.gate  = TDA18271_GATE_DIGITAL,
//.role  = TDA18271_MASTER,
};

static struct tda18271_config averduet_tda_config_slave = {
.std_map   = averduet_std_map,
.gate  = TDA18271_GATE_DIGITAL,
.role  = TDA18271_SLAVE,
.output_opt= TDA18271_OUTPUT_LT_OFF,
.rf_cal_on_startup = 1,
};

static struct lgdt3305_config averduet_lgdt3304_dev = {
.i2c_addr   = 0x0e, /*0x0e, 0x59 these are the only two
possible values*/
.demod_chip = LGDT3304,
.spectral_inversion = 1,
.deny_i2c_rptr  = 0, /*1,*/
.mpeg_mode  = LGDT3305_MPEG_PARALLEL,
.tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE,
.tpvalid_polarity   = LGDT3305_TP_VALID_HIGH,
.vsb_if_khz = 3250,
.qam_if_khz = 4000,
};




tridentsx@tridentsx-P5K-E:~/media_build/media$ lsmod
Module  Size  Used by
tda18271   40860  2
lgdt3305   22788  2
saa716x_budget 18162  0
mb86a1627023  1 saa716x_budget
saa716x_core   68492  1 saa716x_budget
stv090x57159  1 saa716x_budget
dvb_core   90348  3 saa716x_core,saa716x_budget,lgdt3305
vesafb 13500  1
snd_hda_codec_analog75266  1
parport_pc 27504  0
ppdev  12817  0
bnep   17669  2
rfcomm 37420  0
bluetooth 202069  10 bnep,rfcomm
snd_hda_intel  38307  2
coretemp   13131  0
binfmt_misc17260  1
kvm_intel 126842  0
snd_hda_codec 117580  2 snd_hda_intel,snd_hda_codec_analog
snd_hwdep  13272  1 snd_hda_codec
kvm   376505  1 kvm_intel
snd_pcm80890  2 snd_hda_codec,snd_hda_intel
snd_page_alloc 14230  2 snd_pcm,snd_hda_intel
gpio_ich   13236  0
snd_seq_midi   13132  0
snd_seq_midi_event 14475  1 snd_seq_midi
snd_rawmidi25114  1 snd_seq_midi
snd_seq51280  2 snd_seq_midi_event,snd_seq_midi
nvidia   7108000  24
snd_seq_device 14137  3 snd_seq,snd_rawmidi,snd_seq_midi
snd_timer  24411  2 snd_pcm,snd_seq
microcode  18286  0
lpc_ich16925  0
serio_raw  13031  0
snd56485  13

Re: [PATCH v4 7/8] [media] V4L: Add VP8 encoder controls

2013-07-08 Thread Arun Kumar K
Hi Hans,

On Mon, Jul 8, 2013 at 6:21 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 Hi Arun,

 A few small comments below. After fixing that you can add my:

 Acked-by: Hans Verkuil hans.verk...@cisco.com

 for this patch.


Thank you for your review. Will post the updated patch with your ack.

Regards
Arun
--
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/8] [media] s5p-mfc: Update v6 encoder buffer sizes

2013-07-08 Thread Arun Kumar K
The patch updates few encoder buffer sizes for MFC v6.5
as per the udpdated user manual. The same buffer sizes
holds good for v7 firmware also.

Signed-off-by: Kiran AVND avnd.ki...@samsung.com
Signed-off-by: Arun Kumar K arun...@samsung.com
---
 drivers/media/platform/s5p-mfc/regs-mfc-v6.h |4 ++--
 1 file changed, 2 insertions(+), 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 363a97c..2398cdf 100644
--- a/drivers/media/platform/s5p-mfc/regs-mfc-v6.h
+++ b/drivers/media/platform/s5p-mfc/regs-mfc-v6.h
@@ -374,9 +374,9 @@
 #define S5P_FIMV_NUM_PIXELS_IN_MB_COL_V6   16
 
 /* Buffer size requirements defined by hardware */
-#define S5P_FIMV_TMV_BUFFER_SIZE_V6(w, h)  (((w) + 1) * ((h) + 1) * 8)
+#define S5P_FIMV_TMV_BUFFER_SIZE_V6(w, h)  (((w) + 1) * ((h) + 3) * 8)
 #define S5P_FIMV_ME_BUFFER_SIZE_V6(imw, imh, mbw, mbh) \
-   ((DIV_ROUND_UP(imw, 64) *  DIV_ROUND_UP(imh, 64) * 256) + \
+   (imw + 127) / 64) * 16) *  DIV_ROUND_UP(imh, 64) * 256) + \
 (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) \
-- 
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 2/8] [media] s5p-mfc: Rename IS_MFCV6 macro

2013-07-08 Thread Arun Kumar K
The MFC v6 specific code holds good for MFC v7 also as
the v7 version is a superset of v6 and the HW interface
remains more or less similar. This patch renames the macro
IS_MFCV6() to IS_MFCV6_PLUS() so that it can be used
for v7 also.

Signed-off-by: Arun Kumar K arun...@samsung.com
---
 drivers/media/platform/s5p-mfc/s5p_mfc_cmd.c|2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h |2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c   |   12 ++--
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c|   18 ++
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c|   16 +---
 drivers/media/platform/s5p-mfc/s5p_mfc_opr.c|2 +-
 6 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd.c
index f0a41c9..242c033 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd.c
@@ -20,7 +20,7 @@ static struct s5p_mfc_hw_cmds *s5p_mfc_cmds;
 
 void s5p_mfc_init_hw_cmds(struct s5p_mfc_dev *dev)
 {
-   if (IS_MFCV6(dev))
+   if (IS_MFCV6_PLUS(dev))
s5p_mfc_cmds = s5p_mfc_init_hw_cmds_v6();
else
s5p_mfc_cmds = s5p_mfc_init_hw_cmds_v5();
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h 
b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
index ef4074c..d47016d 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
@@ -683,6 +683,6 @@ void set_work_bit_irqsave(struct s5p_mfc_ctx *ctx);
 #define HAS_PORTNUM(dev)   (dev ? (dev-variant ? \
(dev-variant-port_num ? 1 : 0) : 0) : 0)
 #define IS_TWOPORT(dev)(dev-variant-port_num == 2 ? 1 : 0)
-#define IS_MFCV6(dev)  (dev-variant-version = 0x60 ? 1 : 0)
+#define IS_MFCV6_PLUS(dev) (dev-variant-version = 0x60 ? 1 : 0)
 
 #endif /* S5P_MFC_COMMON_H_ */
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
index dc1fc94..7cab684 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
@@ -164,7 +164,7 @@ int s5p_mfc_reset(struct s5p_mfc_dev *dev)
 
mfc_debug_enter();
 
-   if (IS_MFCV6(dev)) {
+   if (IS_MFCV6_PLUS(dev)) {
/* Reset IP */
/*  except RISC, reset */
mfc_write(dev, 0xFEE, S5P_FIMV_MFC_RESET_V6);
@@ -213,7 +213,7 @@ int s5p_mfc_reset(struct s5p_mfc_dev *dev)
 
 static inline void s5p_mfc_init_memctrl(struct s5p_mfc_dev *dev)
 {
-   if (IS_MFCV6(dev)) {
+   if (IS_MFCV6_PLUS(dev)) {
mfc_write(dev, dev-bank1, S5P_FIMV_RISC_BASE_ADDRESS_V6);
mfc_debug(2, Base Address : %08x\n, dev-bank1);
} else {
@@ -226,7 +226,7 @@ static inline void s5p_mfc_init_memctrl(struct s5p_mfc_dev 
*dev)
 
 static inline void s5p_mfc_clear_cmds(struct s5p_mfc_dev *dev)
 {
-   if (IS_MFCV6(dev)) {
+   if (IS_MFCV6_PLUS(dev)) {
/* Zero initialization should be done before RESET.
 * Nothing to do here. */
} else {
@@ -264,7 +264,7 @@ int s5p_mfc_init_hw(struct s5p_mfc_dev *dev)
s5p_mfc_clear_cmds(dev);
/* 3. Release reset signal to the RISC */
s5p_mfc_clean_dev_int_flags(dev);
-   if (IS_MFCV6(dev))
+   if (IS_MFCV6_PLUS(dev))
mfc_write(dev, 0x1, S5P_FIMV_RISC_ON_V6);
else
mfc_write(dev, 0x3ff, S5P_FIMV_SW_RESET);
@@ -301,7 +301,7 @@ int s5p_mfc_init_hw(struct s5p_mfc_dev *dev)
s5p_mfc_clock_off();
return -EIO;
}
-   if (IS_MFCV6(dev))
+   if (IS_MFCV6_PLUS(dev))
ver = mfc_read(dev, S5P_FIMV_FW_VERSION_V6);
else
ver = mfc_read(dev, S5P_FIMV_FW_VERSION);
@@ -380,7 +380,7 @@ int s5p_mfc_wakeup(struct s5p_mfc_dev *dev)
return ret;
}
/* 4. Release reset signal to the RISC */
-   if (IS_MFCV6(dev))
+   if (IS_MFCV6_PLUS(dev))
mfc_write(dev, 0x1, S5P_FIMV_RISC_ON_V6);
else
mfc_write(dev, 0x3ff, S5P_FIMV_SW_RESET);
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
index 00b0703..56a1d3b 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
@@ -382,7 +382,7 @@ static int vidioc_try_fmt(struct file *file, void *priv, 
struct v4l2_format *f)
mfc_err(Unsupported format for source.\n);
return -EINVAL;
}
-   if (!IS_MFCV6(dev)  (fmt-fourcc == V4L2_PIX_FMT_VP8)) {
+   if (!IS_MFCV6_PLUS(dev)  (fmt-fourcc == V4L2_PIX_FMT_VP8)) {
mfc_err(Not supported format.\n);
return -EINVAL;
}
@@ 

[PATCH v5 3/8] [media] s5p-mfc: Add register definition file for MFC v7

2013-07-08 Thread Arun Kumar K
The patch adds the register definition file for new firmware
version v7 for MFC. New firmware supports VP8 encoding along with
many other features.

Signed-off-by: Arun Kumar K arun...@samsung.com
---
 drivers/media/platform/s5p-mfc/regs-mfc-v7.h |   58 ++
 1 file changed, 58 insertions(+)
 create mode 100644 drivers/media/platform/s5p-mfc/regs-mfc-v7.h

diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v7.h 
b/drivers/media/platform/s5p-mfc/regs-mfc-v7.h
new file mode 100644
index 000..24dba69
--- /dev/null
+++ b/drivers/media/platform/s5p-mfc/regs-mfc-v7.h
@@ -0,0 +1,58 @@
+/*
+ * Register definition file for Samsung MFC V7.x Interface (FIMV) driver
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _REGS_MFC_V7_H
+#define _REGS_MFC_V7_H
+
+#include regs-mfc-v6.h
+
+/* Additional features of v7 */
+#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
+#define S5P_FIMV_E_SOURCE_FIRST_STRIDE_V7  0xf9ec
+#define S5P_FIMV_E_SOURCE_SECOND_STRIDE_V7 0xf9f0
+#define S5P_FIMV_E_SOURCE_THIRD_STRIDE_V7  0xf9f4
+
+#define S5P_FIMV_E_ENCODED_SOURCE_FIRST_ADDR_V70xfa70
+#define S5P_FIMV_E_ENCODED_SOURCE_SECOND_ADDR_V7   0xfa74
+
+#define S5P_FIMV_E_VP8_OPTIONS_V7  0xfdb0
+#define S5P_FIMV_E_VP8_FILTER_OPTIONS_V7   0xfdb4
+#define S5P_FIMV_E_VP8_GOLDEN_FRAME_OPTION_V7  0xfdb8
+#define S5P_FIMV_E_VP8_NUM_T_LAYER_V7  0xfdc4
+
+/* MFCv7 variant defines */
+#define MAX_FW_SIZE_V7 (SZ_1M) /* 1MB */
+#define MAX_CPB_SIZE_V7(3 * SZ_1M) /* 3MB */
+#define MFC_VERSION_V7 0x72
+#define MFC_NUM_PORTS_V7   1
+
+/* MFCv7 Context buffer sizes */
+#define MFC_CTX_BUF_SIZE_V7(30 * SZ_1K)/*  30KB */
+#define MFC_H264_DEC_CTX_BUF_SIZE_V7   (2 * SZ_1M) /*  2MB */
+#define MFC_OTHER_DEC_CTX_BUF_SIZE_V7  (20 * SZ_1K)/*  20KB */
+#define MFC_H264_ENC_CTX_BUF_SIZE_V7   (100 * SZ_1K)   /* 100KB */
+#define MFC_OTHER_ENC_CTX_BUF_SIZE_V7  (10 * SZ_1K)/*  10KB */
+
+/* Buffer size defines */
+#define S5P_FIMV_SCRATCH_BUF_SIZE_MPEG4_DEC_V7(w, h) \
+   (SZ_1M + ((w) * 144) + (8192 * (h)) + 49216)
+
+#define S5P_FIMV_SCRATCH_BUF_SIZE_VP8_ENC_V7(w, h) \
+   (((w) * 48) + (((w) + 1) / 2 * 128) + 144 + 8192)
+
+#endif /*_REGS_MFC_V7_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 v5 0/8] Add support for MFC v7 firmware

2013-07-08 Thread Arun Kumar K
This patch series adds MFC v7 firmware support to the Exynos
MFC driver. MFC v7 is present in 5420 SoC which has support
for VP8 encoding and many other features.

Changes from v4:
- Addressed review comments from Hans and added ack
http://www.mail-archive.com/linux-media@vger.kernel.org/msg64101.html

Changes from v3:
- Addressed review comments from Hans
http://www.mail-archive.com/linux-media@vger.kernel.org/msg63893.html
http://www.mail-archive.com/linux-media@vger.kernel.org/msg63905.html
- Addressed comments from Kamil
http://www.mail-archive.com/linux-media@vger.kernel.org/msg63747.html

Changes from v2:
- Addressed review comments from Sylwester
http://www.mail-archive.com/linux-media@vger.kernel.org/msg63676.html
http://www.mail-archive.com/linux-media@vger.kernel.org/msg63677.html

Changes from v1:
- Addressed review comments from Hans and Sylwester
http://www.mail-archive.com/linux-media@vger.kernel.org/msg63148.html
http://www.mail-archive.com/linux-media@vger.kernel.org/msg63311.html
- Modified IS_MFCV6 macro to IS_MFCV6_PLUS to include v7 also

Arun Kumar K (7):
  [media] s5p-mfc: Update v6 encoder buffer sizes
  [media] s5p-mfc: Rename IS_MFCV6 macro
  [media] s5p-mfc: Add register definition file for MFC v7
  [media] s5p-mfc: Core support for MFC v7
  [media] s5p-mfc: Update driver for v7 firmware
  [media] V4L: Add VP8 encoder controls
  [media] s5p-mfc: Add support for VP8 encoder

Sylwester Nawrocki (1):
  [media] V4L: Add support for integer menu controls with standard menu
items

 Documentation/DocBook/media/v4l/controls.xml   |  168 +++-
 .../devicetree/bindings/media/s5p-mfc.txt  |1 +
 Documentation/video4linux/v4l2-controls.txt|   21 +--
 drivers/media/platform/s5p-mfc/regs-mfc-v6.h   |4 +-
 drivers/media/platform/s5p-mfc/regs-mfc-v7.h   |   61 +++
 drivers/media/platform/s5p-mfc/s5p_mfc.c   |   32 
 drivers/media/platform/s5p-mfc/s5p_mfc_cmd.c   |2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c|3 +
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h|   23 ++-
 drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c  |   12 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c   |   18 ++-
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c   |  107 -
 drivers/media/platform/s5p-mfc/s5p_mfc_opr.c   |2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c|  149 +++--
 drivers/media/v4l2-core/v4l2-ctrls.c   |   67 +++-
 include/uapi/linux/v4l2-controls.h |   29 
 16 files changed, 642 insertions(+), 57 deletions(-)
 create mode 100644 drivers/media/platform/s5p-mfc/regs-mfc-v7.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 v5 5/8] [media] s5p-mfc: Update driver for v7 firmware

2013-07-08 Thread Arun Kumar K
Firmware version v7 is mostly similar to v6 in terms
of hardware specific controls and commands. So the hardware
specific opr_v6 and cmd_v6 are re-used for v7 also. This patch
updates the v6 files to handle v7 version also.

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

diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v7.h 
b/drivers/media/platform/s5p-mfc/regs-mfc-v7.h
index 24dba69..ea5ec2a 100644
--- a/drivers/media/platform/s5p-mfc/regs-mfc-v7.h
+++ b/drivers/media/platform/s5p-mfc/regs-mfc-v7.h
@@ -41,6 +41,9 @@
 #define MFC_VERSION_V7 0x72
 #define MFC_NUM_PORTS_V7   1
 
+#define MFC_LUMA_PAD_BYTES_V7  256
+#define MFC_CHROMA_PAD_BYTES_V7128
+
 /* MFCv7 Context buffer sizes */
 #define MFC_CTX_BUF_SIZE_V7(30 * SZ_1K)/*  30KB */
 #define MFC_H264_DEC_CTX_BUF_SIZE_V7   (2 * SZ_1M) /*  2MB */
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
index f734ccc..6dafe96 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
@@ -1665,6 +1665,7 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq,
 
psize[0] = ctx-luma_size;
psize[1] = ctx-chroma_size;
+
if (IS_MFCV6_PLUS(dev)) {
allocators[0] =
ctx-dev-alloc_ctx[MFC_BANK1_ALLOC_CTX];
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 7d4c5e1..3440317 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
@@ -80,6 +80,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx 
*ctx)
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);
+
ctx-luma_dpb_size = ALIGN((mb_width * mb_height) *
S5P_FIMV_LUMA_MB_TO_PIXEL_V6,
S5P_FIMV_LUMA_DPB_BUFFER_ALIGN_V6);
@@ -112,10 +113,18 @@ 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:
-   ctx-scratch_buf_size =
-   S5P_FIMV_SCRATCH_BUF_SIZE_MPEG4_DEC_V6(
-   mb_width,
-   mb_height);
+   if (IS_MFCV7(dev)) {
+   ctx-scratch_buf_size =
+   S5P_FIMV_SCRATCH_BUF_SIZE_MPEG4_DEC_V7(
+   mb_width,
+   mb_height);
+   } else {
+   ctx-scratch_buf_size =
+   S5P_FIMV_SCRATCH_BUF_SIZE_MPEG4_DEC_V6(
+   mb_width,
+   mb_height);
+   }
+
ctx-scratch_buf_size = ALIGN(ctx-scratch_buf_size,
S5P_FIMV_SCRATCH_BUFFER_ALIGN_V6);
ctx-bank1.size = ctx-scratch_buf_size;
@@ -329,6 +338,12 @@ static void s5p_mfc_enc_calc_src_size_v6(struct 
s5p_mfc_ctx *ctx)
ctx-buf_width = ALIGN(ctx-img_width, S5P_FIMV_NV12M_HALIGN_V6);
ctx-luma_size = ALIGN((mb_width * mb_height) * 256, 256);
ctx-chroma_size = ALIGN((mb_width * mb_height) * 128, 256);
+
+   /* MFCv7 needs pad bytes for Luma and Chroma */
+   if (IS_MFCV7(ctx-dev)) {
+   ctx-luma_size += MFC_LUMA_PAD_BYTES_V7;
+   ctx-chroma_size += MFC_CHROMA_PAD_BYTES_V7;
+   }
 }
 
 /* Set registers for decoding stream buffer */
@@ -453,8 +468,13 @@ static void s5p_mfc_set_enc_frame_buffer_v6(struct 
s5p_mfc_ctx *ctx,
 {
struct s5p_mfc_dev *dev = ctx-dev;
 
-   WRITEL(y_addr, S5P_FIMV_E_SOURCE_LUMA_ADDR_V6); /* 256B align */
-   WRITEL(c_addr, S5P_FIMV_E_SOURCE_CHROMA_ADDR_V6);
+   if (IS_MFCV7(dev)) {
+   WRITEL(y_addr, S5P_FIMV_E_SOURCE_FIRST_ADDR_V7);
+   WRITEL(c_addr, S5P_FIMV_E_SOURCE_SECOND_ADDR_V7);
+   } else {
+   WRITEL(y_addr, S5P_FIMV_E_SOURCE_LUMA_ADDR_V6);
+   WRITEL(c_addr, S5P_FIMV_E_SOURCE_CHROMA_ADDR_V6);
+   }
 
mfc_debug(2, enc src y buf addr: 0x%08lx\n, y_addr);
mfc_debug(2, enc src c buf addr: 0x%08lx\n, c_addr);
@@ -466,8 +486,13 @@ static void s5p_mfc_get_enc_frame_buffer_v6(struct 
s5p_mfc_ctx *ctx,
struct s5p_mfc_dev *dev = ctx-dev;
  

[PATCH v5 8/8] [media] s5p-mfc: Add support for VP8 encoder

2013-07-08 Thread Arun Kumar K
MFC v7 supports VP8 encoding and this patch adds support
for it in the driver.

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

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
index 5708fc3..db796c8 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
@@ -108,6 +108,9 @@ static int s5p_mfc_open_inst_cmd_v6(struct s5p_mfc_ctx *ctx)
case S5P_MFC_CODEC_H263_ENC:
codec_type = S5P_FIMV_CODEC_H263_ENC_V6;
break;
+   case S5P_MFC_CODEC_VP8_ENC:
+   codec_type = S5P_FIMV_CODEC_VP8_ENC_V7;
+   break;
default:
codec_type = S5P_FIMV_CODEC_NONE_V6;
};
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h 
b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
index 17545d7..6920b54 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
@@ -65,7 +65,7 @@ static inline dma_addr_t s5p_mfc_mem_cookie(void *a, void *b)
 #define MFC_ENC_CAP_PLANE_COUNT1
 #define MFC_ENC_OUT_PLANE_COUNT2
 #define STUFF_BYTE 4
-#define MFC_MAX_CTRLS  70
+#define MFC_MAX_CTRLS  77
 
 #define S5P_MFC_CODEC_NONE -1
 #define S5P_MFC_CODEC_H264_DEC 0
@@ -81,6 +81,7 @@ static inline dma_addr_t s5p_mfc_mem_cookie(void *a, void *b)
 #define S5P_MFC_CODEC_H264_MVC_ENC 21
 #define S5P_MFC_CODEC_MPEG4_ENC22
 #define S5P_MFC_CODEC_H263_ENC 23
+#define S5P_MFC_CODEC_VP8_ENC  24
 
 #define S5P_MFC_R2H_CMD_EMPTY  0
 #define S5P_MFC_R2H_CMD_SYS_INIT_RET   1
@@ -409,6 +410,21 @@ struct s5p_mfc_mpeg4_enc_params {
 };
 
 /**
+ * struct s5p_mfc_vp8_enc_params - encoding parameters for vp8
+ */
+struct s5p_mfc_vp8_enc_params {
+   u8 imd_4x4;
+   enum v4l2_vp8_num_partitions num_partitions;
+   enum v4l2_vp8_num_ref_frames num_ref;
+   u8 filter_level;
+   u8 filter_sharpness;
+   u32 golden_frame_ref_period;
+   enum v4l2_vp8_golden_frame_sel golden_frame_sel;
+   u8 hier_layer;
+   u8 hier_layer_qp[3];
+};
+
+/**
  * struct s5p_mfc_enc_params - general encoding parameters
  */
 struct s5p_mfc_enc_params {
@@ -442,6 +458,7 @@ struct s5p_mfc_enc_params {
struct {
struct s5p_mfc_h264_enc_params h264;
struct s5p_mfc_mpeg4_enc_params mpeg4;
+   struct s5p_mfc_vp8_enc_params vp8;
} codec;
 
 };
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
index 6dafe96..fb077b3 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
@@ -84,6 +84,13 @@ static struct s5p_mfc_fmt formats[] = {
.type   = MFC_FMT_ENC,
.num_planes = 1,
},
+   {
+   .name   = VP8 Encoded Stream,
+   .fourcc = V4L2_PIX_FMT_VP8,
+   .codec_mode = S5P_MFC_CODEC_VP8_ENC,
+   .type   = MFC_FMT_ENC,
+   .num_planes = 1,
+   },
 };
 
 #define NUM_FORMATS ARRAY_SIZE(formats)
@@ -557,6 +564,60 @@ static struct mfc_control controls[] = {
.step = 1,
.default_value = 0,
},
+   {
+   .id = V4L2_CID_MPEG_VIDEO_VPX_NUM_PARTITIONS,
+   .type = V4L2_CTRL_TYPE_INTEGER_MENU,
+   .maximum = V4L2_CID_MPEG_VIDEO_VPX_8_PARTITIONS,
+   .default_value = V4L2_CID_MPEG_VIDEO_VPX_1_PARTITION,
+   .menu_skip_mask = 0,
+   },
+   {
+   .id = V4L2_CID_MPEG_VIDEO_VPX_IMD_DISABLE_4X4,
+   .type = V4L2_CTRL_TYPE_BOOLEAN,
+   .minimum = 0,
+   .maximum = 1,
+   .step = 1,
+   .default_value = 0,
+   },
+   {
+   .id = V4L2_CID_MPEG_VIDEO_VPX_NUM_REF_FRAMES,
+   .type = V4L2_CTRL_TYPE_INTEGER_MENU,
+   .maximum = V4L2_CID_MPEG_VIDEO_VPX_2_REF_FRAME,
+   .default_value = V4L2_CID_MPEG_VIDEO_VPX_1_REF_FRAME,
+   .menu_skip_mask = 0,
+   },
+   {
+   .id = V4L2_CID_MPEG_VIDEO_VPX_FILTER_LEVEL,
+   .type = V4L2_CTRL_TYPE_INTEGER,
+   .minimum = 0,
+   .maximum = 63,
+   .step = 1,
+   .default_value = 0,
+   },
+   {
+   .id = V4L2_CID_MPEG_VIDEO_VPX_FILTER_SHARPNESS,
+   .type = 

[PATCH v5 6/8] [media] V4L: Add support for integer menu controls with standard menu items

2013-07-08 Thread Arun Kumar K
From: Sylwester Nawrocki s.nawro...@samsung.com

The patch modifies the helper function v4l2_ctrl_new_std_menu
to accept integer menu controls with standard menu items.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Arun Kumar K arun...@samsung.com
Acked-by: Hans Verkuil hans.verk...@cisco.com
---
 Documentation/video4linux/v4l2-controls.txt |   21 ++--
 drivers/media/v4l2-core/v4l2-ctrls.c|   28 ---
 2 files changed, 36 insertions(+), 13 deletions(-)

diff --git a/Documentation/video4linux/v4l2-controls.txt 
b/Documentation/video4linux/v4l2-controls.txt
index 676f873..06cf3ac 100644
--- a/Documentation/video4linux/v4l2-controls.txt
+++ b/Documentation/video4linux/v4l2-controls.txt
@@ -124,26 +124,27 @@ You add non-menu controls by calling v4l2_ctrl_new_std:
const struct v4l2_ctrl_ops *ops,
u32 id, s32 min, s32 max, u32 step, s32 def);
 
-Menu controls are added by calling v4l2_ctrl_new_std_menu:
+Menu and integer menu controls are added by calling v4l2_ctrl_new_std_menu:
 
struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
const struct v4l2_ctrl_ops *ops,
u32 id, s32 max, s32 skip_mask, s32 def);
 
-Or alternatively for integer menu controls, by calling v4l2_ctrl_new_int_menu:
+Menu controls with a driver specific menu are added by calling
+v4l2_ctrl_new_std_menu_items:
+
+   struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(
+   struct v4l2_ctrl_handler *hdl,
+   const struct v4l2_ctrl_ops *ops, u32 id, s32 max,
+   s32 skip_mask, s32 def, const char * const *qmenu);
+
+Integer menu controls with a driver specific menu can be added by calling
+v4l2_ctrl_new_int_menu:
 
struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl,
const struct v4l2_ctrl_ops *ops,
u32 id, s32 max, s32 def, const s64 *qmenu_int);
 
-Standard menu controls with a driver specific menu are added by calling
-v4l2_ctrl_new_std_menu_items:
-
-   struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(
-   struct v4l2_ctrl_handler *hdl,
-   const struct v4l2_ctrl_ops *ops, u32 id, s32 max,
-   s32 skip_mask, s32 def, const char * const *qmenu);
-
 These functions are typically called right after the v4l2_ctrl_handler_init:
 
static const s64 exp_bias_qmenu[] = {
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index fccd08b..e03a2e8 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -552,6 +552,20 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
 }
 EXPORT_SYMBOL(v4l2_ctrl_get_menu);
 
+/*
+ * Returns NULL or an s64 type array containing the menu for given
+ * control ID. The total number of the menu items is returned in @len.
+ */
+const s64 const *v4l2_ctrl_get_int_menu(u32 id, u32 *len)
+{
+   switch (id) {
+   default:
+   *len = 0;
+   return NULL;
+   };
+}
+EXPORT_SYMBOL(v4l2_ctrl_get_int_menu);
+
 /* Return the control name. */
 const char *v4l2_ctrl_get_name(u32 id)
 {
@@ -1712,20 +1726,28 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct 
v4l2_ctrl_handler *hdl,
const struct v4l2_ctrl_ops *ops,
u32 id, s32 max, s32 mask, s32 def)
 {
-   const char * const *qmenu = v4l2_ctrl_get_menu(id);
+   const char * const *qmenu = NULL;
+   const s64 *qmenu_int = NULL;
const char *name;
enum v4l2_ctrl_type type;
+   unsigned int qmenu_int_len;
s32 min;
s32 step;
u32 flags;
 
v4l2_ctrl_fill(id, name, type, min, max, step, def, flags);
-   if (type != V4L2_CTRL_TYPE_MENU) {
+
+   if (type == V4L2_CTRL_TYPE_MENU)
+   qmenu = v4l2_ctrl_get_menu(id);
+   else if (type == V4L2_CTRL_TYPE_INTEGER_MENU)
+   qmenu_int = v4l2_ctrl_get_int_menu(id, qmenu_int_len);
+
+   if ((!qmenu  !qmenu_int) || (qmenu_int  max  qmenu_int_len)) {
handler_set_err(hdl, -EINVAL);
return NULL;
}
return v4l2_ctrl_new(hdl, ops, id, name, type,
-0, max, mask, def, flags, qmenu, NULL, NULL);
+0, max, mask, def, flags, qmenu, qmenu_int, NULL);
 }
 EXPORT_SYMBOL(v4l2_ctrl_new_std_menu);
 
-- 
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 7/8] [media] V4L: Add VP8 encoder controls

2013-07-08 Thread Arun Kumar K
This patch adds new V4L controls for VP8 encoding.

Signed-off-by: Kiran AVND avnd.ki...@samsung.com
Signed-off-by: Arun Kumar K arun...@samsung.com
Acked-by: Hans Verkuil hans.verk...@cisco.com
---
 Documentation/DocBook/media/v4l/controls.xml |  168 +-
 drivers/media/v4l2-core/v4l2-ctrls.c |   39 +-
 include/uapi/linux/v4l2-controls.h   |   29 +
 3 files changed, 229 insertions(+), 7 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index 8d7a779..74314da 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -722,17 +722,22 @@ for more details./para
 /section
 
 section id=mpeg-controls
-  titleMPEG Control Reference/title
+  titleCodec Control Reference/title
 
-  paraBelow all controls within the MPEG control class are
+  paraBelow all controls within the Codec control class are
 described. First the generic controls, then controls specific for
 certain hardware./para
 
+  paraNote: These controls are applicable to all codecs and
+not just MPEG. The defines are prefixed with V4L2_CID_MPEG/V4L2_MPEG
+as the controls were originally made for MPEG codecs and later
+extended to cover all encoding formats./para
+
   section
-   titleGeneric MPEG Controls/title
+   titleGeneric Codec Controls/title
 
table pgwide=1 frame=none id=mpeg-control-id
- titleMPEG Control IDs/title
+ titleCodec Control IDs/title
  tgroup cols=4
colspec colname=c1 colwidth=1* /
colspec colname=c2 colwidth=6* /
@@ -752,7 +757,7 @@ certain hardware./para
  row
entry 
spanname=idconstantV4L2_CID_MPEG_CLASS/constantnbsp;/entry
entryclass/entry
- /rowrowentry spanname=descrThe MPEG class
+ /rowrowentry spanname=descrThe Codec class
 descriptor. Calling VIDIOC-QUERYCTRL; for this control will return a
 description of this control class. This description can be used as the
 caption of a Tab page in a GUI, for example./entry
@@ -3009,6 +3014,159 @@ in by the application. 0 = do not insert, 1 = insert 
packets./entry
  /tgroup
/table
   /section
+
+section
+  titleVPX Control Reference/title
+
+  paraThe VPX controls include controls for encoding parameters
+  of VPx video codec./para
+
+  table pgwide=1 frame=none id=vpx-control-id
+  titleVPX Control IDs/title
+
+  tgroup cols=4
+colspec colname=c1 colwidth=1* /
+colspec colname=c2 colwidth=6* /
+colspec colname=c3 colwidth=2* /
+colspec colname=c4 colwidth=6* /
+spanspec namest=c1 nameend=c2 spanname=id /
+spanspec namest=c2 nameend=c4 spanname=descr /
+thead
+  row
+entry spanname=id align=leftID/entry
+entry align=leftType/entry
+  /rowrow rowsep=1entry spanname=descr 
align=leftDescription/entry
+  /row
+/thead
+tbody valign=top
+  rowentry/entry/row
+
+ rowentry/entry/row
+ row id=v4l2-vpx-num-partitions
+   entry 
spanname=idconstantV4L2_CID_MPEG_VIDEO_VPX_NUM_PARTITIONS/constant/entry
+   entryenum v4l2_vp8_num_partitions/entry
+ /row
+ rowentry spanname=descrThe number of token partitions to 
use in VP8 encoder.
+Possible values are:/entry
+ /row
+ row
+   entrytbl spanname=descr cols=2
+ tbody valign=top
+   row
+ 
entryconstantV4L2_CID_MPEG_VIDEO_VPX_1_PARTITION/constant/entry
+ entry1 coefficient partition/entry
+   /row
+   row
+ 
entryconstantV4L2_CID_MPEG_VIDEO_VPX_2_PARTITIONS/constant/entry
+ entry2 coefficient partitions/entry
+   /row
+   row
+ 
entryconstantV4L2_CID_MPEG_VIDEO_VPX_4_PARTITIONS/constant/entry
+ entry4 coefficient partitions/entry
+   /row
+   row
+ 
entryconstantV4L2_CID_MPEG_VIDEO_VPX_8_PARTITIONS/constant/entry
+ entry8 coefficient partitions/entry
+   /row
+  /tbody
+   /entrytbl
+ /row
+
+ rowentry/entry/row
+ row
+   entry 
spanname=idconstantV4L2_CID_MPEG_VIDEO_VPX_IMD_DISABLE_4X4/constant/entry
+   entryboolean/entry
+ /row
+ rowentry spanname=descrSetting this prevents intra 4x4 mode 
in the intra mode decision./entry
+ /row
+
+ rowentry/entry/row
+ row id=v4l2-vpx-num-ref-frames
+   entry 
spanname=idconstantV4L2_CID_MPEG_VIDEO_VPX_NUM_REF_FRAMES/constant/entry
+   

[PATCH v5 4/8] [media] s5p-mfc: Core support for MFC v7

2013-07-08 Thread Arun Kumar K
Adds variant data and core support for the MFC v7 firmware

Signed-off-by: Arun Kumar K arun...@samsung.com
---
 .../devicetree/bindings/media/s5p-mfc.txt  |1 +
 drivers/media/platform/s5p-mfc/s5p_mfc.c   |   32 
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h|2 ++
 3 files changed, 35 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/s5p-mfc.txt 
b/Documentation/devicetree/bindings/media/s5p-mfc.txt
index 67ec3d4..cb9c5bc 100644
--- a/Documentation/devicetree/bindings/media/s5p-mfc.txt
+++ b/Documentation/devicetree/bindings/media/s5p-mfc.txt
@@ -10,6 +10,7 @@ Required properties:
   - compatible : value should be either one among the following
(a) samsung,mfc-v5 for MFC v5 present in Exynos4 SoCs
(b) samsung,mfc-v6 for MFC v6 present in Exynos5 SoCs
+   (b) samsung,mfc-v7 for MFC v7 present in Exynos5420 SoC
 
   - reg : Physical base address of the IP registers and length of memory
  mapped region.
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index d12faa6..d6be52f 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -1391,6 +1391,32 @@ static struct s5p_mfc_variant mfc_drvdata_v6 = {
.fw_name= s5p-mfc-v6.fw,
 };
 
+struct s5p_mfc_buf_size_v6 mfc_buf_size_v7 = {
+   .dev_ctx= MFC_CTX_BUF_SIZE_V7,
+   .h264_dec_ctx   = MFC_H264_DEC_CTX_BUF_SIZE_V7,
+   .other_dec_ctx  = MFC_OTHER_DEC_CTX_BUF_SIZE_V7,
+   .h264_enc_ctx   = MFC_H264_ENC_CTX_BUF_SIZE_V7,
+   .other_enc_ctx  = MFC_OTHER_ENC_CTX_BUF_SIZE_V7,
+};
+
+struct s5p_mfc_buf_size buf_size_v7 = {
+   .fw = MAX_FW_SIZE_V7,
+   .cpb= MAX_CPB_SIZE_V7,
+   .priv   = mfc_buf_size_v7,
+};
+
+struct s5p_mfc_buf_align mfc_buf_align_v7 = {
+   .base = 0,
+};
+
+static struct s5p_mfc_variant mfc_drvdata_v7 = {
+   .version= MFC_VERSION_V7,
+   .port_num   = MFC_NUM_PORTS_V7,
+   .buf_size   = buf_size_v7,
+   .buf_align  = mfc_buf_align_v7,
+   .fw_name= s5p-mfc-v7.fw,
+};
+
 static struct platform_device_id mfc_driver_ids[] = {
{
.name = s5p-mfc,
@@ -1401,6 +1427,9 @@ static struct platform_device_id mfc_driver_ids[] = {
}, {
.name = s5p-mfc-v6,
.driver_data = (unsigned long)mfc_drvdata_v6,
+   }, {
+   .name = s5p-mfc-v7,
+   .driver_data = (unsigned long)mfc_drvdata_v7,
},
{},
 };
@@ -1413,6 +1442,9 @@ static const struct of_device_id exynos_mfc_match[] = {
}, {
.compatible = samsung,mfc-v6,
.data = mfc_drvdata_v6,
+   }, {
+   .compatible = samsung,mfc-v7,
+   .data = mfc_drvdata_v7,
},
{},
 };
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h 
b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
index d47016d..17545d7 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
@@ -24,6 +24,7 @@
 #include media/videobuf2-core.h
 #include regs-mfc.h
 #include regs-mfc-v6.h
+#include regs-mfc-v7.h
 
 /* Definitions related to MFC memory */
 
@@ -684,5 +685,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)
 
 #endif /* S5P_MFC_COMMON_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