Re: [RFCv2 PATCH 01/10] v4l2-controls: add motion detection controls.

2013-08-22 Thread Hans Verkuil
On 08/21/2013 11:36 PM, Laurent Pinchart wrote:
 Hi Hans,
 
 Thank you for the patch.
 
 On Monday 12 August 2013 12:58:24 Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com

 Add support for two motion detection controls and a 'detect control class'.

 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 ---
  drivers/media/v4l2-core/v4l2-ctrls.c | 33 +++--
 include/uapi/linux/v4l2-controls.h   | 14 ++
  2 files changed, 41 insertions(+), 6 deletions(-)

 diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c
 b/drivers/media/v4l2-core/v4l2-ctrls.c index fccd08b..89e7cfb 100644
 --- a/drivers/media/v4l2-core/v4l2-ctrls.c
 +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
 @@ -456,6 +456,12 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
  RGB full range (0-255),
  NULL,
  };
 +static const char * const detect_motion_mode[] = {
 +Disabled,
 +Global,
 +Regional,
 +NULL,
 +};


  switch (id) {
 @@ -545,6 +551,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
  case V4L2_CID_DV_TX_RGB_RANGE:
  case V4L2_CID_DV_RX_RGB_RANGE:
  return dv_rgb_range;
 +case V4L2_CID_DETECT_MOTION_MODE:
 +return detect_motion_mode;

  default:
  return NULL;
 @@ -557,7 +565,7 @@ const char *v4l2_ctrl_get_name(u32 id)
  {
  switch (id) {
  /* USER controls */
 -/* Keep the order of the 'case's the same as in videodev2.h! */
 +/* Keep the order of the 'case's the same as in v4l2-controls.h! */
 
 Maybe we could replace all the individual occurences of that comment with a 
 single one at the beginning of the switch ?

It's a pretty long switch, so I think it is good that this comment is repeated
every so often.

 
  case V4L2_CID_USER_CLASS:   return User Controls;
  case V4L2_CID_BRIGHTNESS:   return Brightness;
  case V4L2_CID_CONTRAST: return Contrast;
 @@ -601,7 +609,7 @@ const char *v4l2_ctrl_get_name(u32 id)
  case V4L2_CID_COLORFX_CBCR: return Color Effects, CbCr;

  /* MPEG controls */
 -/* Keep the order of the 'case's the same as in videodev2.h! */
 +/* Keep the order of the 'case's the same as in v4l2-controls.h! */
  case V4L2_CID_MPEG_CLASS:   return MPEG Encoder Controls;
  case V4L2_CID_MPEG_STREAM_TYPE: return Stream Type;
  case V4L2_CID_MPEG_STREAM_PID_PMT:  return Stream PMT Program ID;
 @@ -701,7 +709,7 @@ const char *v4l2_ctrl_get_name(u32 id)
  case V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER: return Repeat 
 Sequence
 Header;

  /* CAMERA controls */
 -/* Keep the order of the 'case's the same as in videodev2.h! */
 +/* Keep the order of the 'case's the same as in v4l2-controls.h! */
  case V4L2_CID_CAMERA_CLASS: return Camera Controls;
  case V4L2_CID_EXPOSURE_AUTO:return Auto Exposure;
  case V4L2_CID_EXPOSURE_ABSOLUTE:return Exposure Time, 
 Absolute;
 @@ -735,8 +743,8 @@ const char *v4l2_ctrl_get_name(u32 id)
  case V4L2_CID_AUTO_FOCUS_STATUS:return Auto Focus, Status;
  case V4L2_CID_AUTO_FOCUS_RANGE: return Auto Focus, Range;

 -/* FM Radio Modulator control */
 -/* Keep the order of the 'case's the same as in videodev2.h! */
 +/* FM Radio Modulator controls */
 +/* Keep the order of the 'case's the same as in v4l2-controls.h! */
  case V4L2_CID_FM_TX_CLASS:  return FM Radio Modulator 
 Controls;
  case V4L2_CID_RDS_TX_DEVIATION: return RDS Signal Deviation;
  case V4L2_CID_RDS_TX_PI:return RDS Program ID;
 @@ -759,6 +767,7 @@ const char *v4l2_ctrl_get_name(u32 id)
  case V4L2_CID_TUNE_ANTENNA_CAPACITOR:   return Tune Antenna Capacitor;

  /* Flash controls */
 +/* Keep the order of the 'case's the same as in v4l2-controls.h! */
  case V4L2_CID_FLASH_CLASS:  return Flash Controls;
  case V4L2_CID_FLASH_LED_MODE:   return LED Mode;
  case V4L2_CID_FLASH_STROBE_SOURCE:  return Strobe Source;
 @@ -774,7 +783,7 @@ const char *v4l2_ctrl_get_name(u32 id)
  case V4L2_CID_FLASH_READY:  return Ready to Strobe;

  /* JPEG encoder controls */
 -/* Keep the order of the 'case's the same as in videodev2.h! */
 +/* Keep the order of the 'case's the same as in v4l2-controls.h! */
  case V4L2_CID_JPEG_CLASS:   return JPEG Compression 
 Controls;
  case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:  return Chroma Subsampling;
  case V4L2_CID_JPEG_RESTART_INTERVAL:return Restart Interval;
 @@ -782,18 +791,21 @@ const char *v4l2_ctrl_get_name(u32 id)
  case V4L2_CID_JPEG_ACTIVE_MARKER:   return Active Markers;

  /* Image source controls */
 +/* Keep the order of the 'case's the same as in v4l2-controls.h! */
  case V4L2_CID_IMAGE_SOURCE_CLASS:   

Re: [RFCv2 PATCH 08/10] DocBook: document new v4l motion detection event.

2013-08-22 Thread Hans Verkuil
On 08/21/2013 11:41 PM, Laurent Pinchart wrote:
 Hi Hans,
 
 Thank you for the patch.
 
 On Monday 12 August 2013 12:58:31 Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com

 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 ---
  Documentation/DocBook/media/v4l/vidioc-dqevent.xml | 40 +++
  .../DocBook/media/v4l/vidioc-subscribe-event.xml   |  9 +
  2 files changed, 49 insertions(+)

 diff --git a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
 b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml index 89891ad..23ee1e3
 100644
 --- a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
 +++ b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
 @@ -94,6 +94,12 @@
/row
row
  entry/entry
 +entryv4l2-event-motion-det;/entry
 +entrystructfieldmotion_det/structfield/entry
 +entryEvent data for event V4L2_EVENT_MOTION_DET./entry
 +  /row
 +  row
 +entry/entry
  entry__u8/entry
  entrystructfielddata/structfield[64]/entry
  entryEvent data. Defined by the event type. The union
 @@ -242,6 +248,40 @@
/tgroup
  /table

 +table frame=none pgwide=1 id=v4l2-event-motion-det
 +  titlestruct structnamev4l2_event_motion_det/structname/title
 +  tgroup cols=3
 +cs-str;
 +tbody valign=top
 +  row
 +entry__u32/entry
 +entrystructfieldflags/structfield/entry
 +entry
 +  Currently only one flag is available: if
 constantV4L2_EVENT_MD_FL_HAVE_FRAME_SEQ/constant + is set, 
 then
 the structfieldframe_sequence/structfield field is valid, +   
 otherwise that field should be ignored.
 +/entry
 +  /row
 +  row
 +entry__u32/entry
 +entrystructfieldframe_sequence/structfield/entry
 +entry
 +  The sequence number of the frame being received. Only valid if the
 +  constantV4L2_EVENT_MD_FL_HAVE_FRAME_SEQ/constant flag was set.
 +/entry
 +  /row
 +  row
 +entry__u32/entry
 +entrystructfieldregion_mask/structfield/entry
 +entry
 +  The bitmask of the regions that reported motion. There is at least
 one
 +  region. If this field is 0, then no motion was detected at all.
 +/entry
 +  /row
 +/tbody
 +  /tgroup
 +/table
 +
  table pgwide=1 frame=none id=changes-flags
titleChanges/title
tgroup cols=3
 diff --git a/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml
 b/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml index
 5c70b61..d9c3e66 100644
 --- a/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml
 +++ b/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml
 @@ -155,6 +155,15 @@
  /entry
/row
row
 +entryconstantV4L2_EVENT_MOTION_DET/constant/entry
 +entry5/entry
 +entry
 +  paraTriggered whenever the motion detection state changes, i.e.
 +  whether motion is detected or not.
 
 Isn't the event also triggered when region_mask changes from a non-zero value 
 to a different non-zero value ? The second part of the sentence seems to 
 imply 
 that the even is only triggered when motion starts being detected or stops 
 being detected.

Good point. How about this:

Triggered whenever the motion detection state for one or more of the regions
changes.

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: [RFCv2 PATCH 03/10] v4l2-compat-ioctl32: add g/s_matrix support.

2013-08-22 Thread Hans Verkuil
On 08/22/2013 12:02 AM, Laurent Pinchart wrote:
 Hi Hans,
 
 Thank you for the patch.
 
 On Monday 12 August 2013 12:58:26 Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com

 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 ---
  drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 54 
  1 file changed, 54 insertions(+)

 diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
 b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c index 8f7a6a4..1d238da
 100644
 --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
 +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
 @@ -777,6 +777,43 @@ static int put_v4l2_subdev_edid32(struct
 v4l2_subdev_edid *kp, struct v4l2_subde return 0;
  }

 +struct v4l2_matrix32 {
 +__u32 type;
 +union {
 +__u32 raw[4];
 +} ref;
 +struct v4l2_rect rect;
 +compat_caddr_t matrix;
 +__u32 reserved[12];
 +} __attribute__ ((packed));
 +
 +static int get_v4l2_matrix32(struct v4l2_matrix *kp, struct v4l2_matrix32
 __user *up) +{
 +u32 tmp;
 +
 +if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_matrix32)) ||
 +get_user(kp-type, up-type) ||
 +copy_from_user(kp-ref, up-ref, sizeof(up-ref)) ||
 +copy_from_user(kp-rect, up-rect, sizeof(up-rect)) 
 ||
 +get_user(tmp, up-matrix) ||
 +copy_from_user(kp-reserved, up-reserved, 
 sizeof(kp-reserved)))
 
 Shouldn't you align all lines to the ! in the first line ?

Will change.

 
 +return -EFAULT;
 +kp-matrix = compat_ptr(tmp);
 +return 0;
 +}
 +
 +static int put_v4l2_matrix32(struct v4l2_matrix *kp, struct v4l2_matrix32
 __user *up) +{
 +u32 tmp = (u32)((unsigned long)kp-matrix);
 +
 +if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_matrix32)) ||
 +put_user(kp-type, up-type) ||
 +copy_to_user(kp-ref, up-ref, sizeof(kp-ref)) ||
 
 Are driver allowed to change the type and ref fields ? If not those two lines 
 could be removed.

Good point, I'll drop that. 'ref' goes away anyway after Sakari's comments.

 
 +copy_to_user(kp-rect, up-rect, sizeof(kp-rect)) ||
 +copy_to_user(kp-reserved, up-reserved, 
 sizeof(kp-reserved)))
 
 Same question regarding the alignment here.

Will change.

 
 +return -EFAULT;
 +return 0;
 +}

  #define VIDIOC_G_FMT32  _IOWR('V',  4, struct v4l2_format32)
  #define VIDIOC_S_FMT32  _IOWR('V',  5, struct v4l2_format32)
 @@ -796,6 +833,8 @@ static int put_v4l2_subdev_edid32(struct
 v4l2_subdev_edid *kp, struct v4l2_subde #define  VIDIOC_DQEVENT32
 _IOR ('V',
 89, struct v4l2_event32)
  #define VIDIOC_CREATE_BUFS32_IOWR('V', 92, struct 
 v4l2_create_buffers32)
  #define VIDIOC_PREPARE_BUF32_IOWR('V', 93, struct v4l2_buffer32)
 +#define VIDIOC_G_MATRIX32   _IOWR('V', 104, struct v4l2_matrix32)
 +#define VIDIOC_S_MATRIX32   _IOWR('V', 105, struct v4l2_matrix32)

  #define VIDIOC_OVERLAY32_IOW ('V', 14, s32)
  #define VIDIOC_STREAMON32   _IOW ('V', 18, s32)
 @@ -817,6 +856,7 @@ static long do_video_ioctl(struct file *file, unsigned
 int cmd, unsigned long ar struct v4l2_event v2ev;
  struct v4l2_create_buffers v2crt;
  struct v4l2_subdev_edid v2edid;
 +struct v4l2_matrix v2matrix;
  unsigned long vx;
  int vi;
  } karg;
 @@ -851,6 +891,8 @@ static long do_video_ioctl(struct file *file, unsigned
 int cmd, unsigned long ar case VIDIOC_PREPARE_BUF32: cmd =
 VIDIOC_PREPARE_BUF; break;
  case VIDIOC_SUBDEV_G_EDID32: cmd = VIDIOC_SUBDEV_G_EDID; break;
  case VIDIOC_SUBDEV_S_EDID32: cmd = VIDIOC_SUBDEV_S_EDID; break;
 +case VIDIOC_G_MATRIX32: cmd = VIDIOC_G_MATRIX; break;
 +case VIDIOC_S_MATRIX32: cmd = VIDIOC_S_MATRIX; break;
  }

  switch (cmd) {
 @@ -922,6 +964,12 @@ static long do_video_ioctl(struct file *file, unsigned
 int cmd, unsigned long ar case VIDIOC_DQEVENT:
  compatible_arg = 0;
  break;
 +
 +case VIDIOC_G_MATRIX:
 +case VIDIOC_S_MATRIX:
 +err = get_v4l2_matrix32(karg.v2matrix, up);
 +compatible_arg = 0;
 +break;
  }
  if (err)
  return err;
 @@ -994,6 +1042,11 @@ static long do_video_ioctl(struct file *file, unsigned
 int cmd, unsigned long ar case VIDIOC_ENUMINPUT:
  err = put_v4l2_input32(karg.v2i, up);
  break;
 +
 +case VIDIOC_G_MATRIX:
 +case VIDIOC_S_MATRIX:
 +err = put_v4l2_matrix32(karg.v2matrix, up);
 +break;
  }
  return err;
  }
 @@ -1089,6 +1142,7 @@ long v4l2_compat_ioctl32(struct file *file, unsigned
 int cmd, unsigned long arg) case VIDIOC_ENUM_FREQ_BANDS:
  case VIDIOC_SUBDEV_G_EDID32:
  case VIDIOC_SUBDEV_S_EDID32:
 +case VIDIOC_QUERY_MATRIX:
  ret = do_video_ioctl(file, cmd, arg);
 

Re: [RFCv2 PATCH 09/10] DocBook: document the new v4l2 matrix ioctls.

2013-08-22 Thread Hans Verkuil
On 08/21/2013 11:58 PM, Laurent Pinchart wrote:
 Hi Hans,
 
 Thank you for the patch.
 
 On Monday 12 August 2013 12:58:32 Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com

 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 ---
  Documentation/DocBook/media/v4l/v4l2.xml   |   2 +
  .../DocBook/media/v4l/vidioc-g-matrix.xml  | 115 +
  .../DocBook/media/v4l/vidioc-query-matrix.xml  | 178 ++
  3 files changed, 295 insertions(+)
  create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-matrix.xml
  create mode 100644 Documentation/DocBook/media/v4l/vidioc-query-matrix.xml
 
 [snip]
 
 diff --git a/Documentation/DocBook/media/v4l/vidioc-query-matrix.xml
 b/Documentation/DocBook/media/v4l/vidioc-query-matrix.xml new file mode
 100644
 index 000..c2845c7
 --- /dev/null
 +++ b/Documentation/DocBook/media/v4l/vidioc-query-matrix.xml
 @@ -0,0 +1,178 @@
 +refentry id=vidioc-query-matrix
 +  refmeta
 +refentrytitleioctl VIDIOC_QUERY_MATRIX/refentrytitle
 +manvol;
 +  /refmeta
 +
 +  refnamediv
 +refnameVIDIOC_QUERY_MATRIX/refname
 +refpurposeQuery the attributes of a matrix/refpurpose
 +  /refnamediv
 +
 +  refsynopsisdiv
 +funcsynopsis
 +  funcprototype
 +funcdefint functionioctl/function/funcdef
 +paramdefint parameterfd/parameter/paramdef
 +paramdefint parameterrequest/parameter/paramdef
 +paramdefstruct v4l2_query_matrix
 +*parameterargp/parameter/paramdef
 +  /funcprototype
 +/funcsynopsis
 +  /refsynopsisdiv
 +
 +  refsect1
 +titleArguments/title
 +
 +variablelist
 +  varlistentry
 +termparameterfd/parameter/term
 +listitem
 +  parafd;/para
 +/listitem
 +  /varlistentry
 +  varlistentry
 +termparameterrequest/parameter/term
 +listitem
 +  paraVIDIOC_QUERY_MATRIX/para
 +/listitem
 +  /varlistentry
 +  varlistentry
 +termparameterargp/parameter/term
 +listitem
 +  para/para
 +/listitem
 +  /varlistentry
 +/variablelist
 +  /refsect1
 +
 +  refsect1
 +titleDescription/title
 +
 +paraQuery the attributes of a matrix. The application fills in the
 +structfieldtype/structfield and optionally the
 structfieldref/structfield
 +fields of v4l2-query-matrix;. All other fields will be returned by the
 driver.
 +/para
 +
 +table frame=none pgwide=1 id=v4l2-query-matrix
 +  titlestruct structnamev4l2_query_matrix/structname/title
 +  tgroup cols=4
 +cs-str;
 +tbody valign=top
 +  row
 +entry__u32/entry
 +entrystructfieldtype/structfield/entry
 +entry/entry
 +entryType of the matrix, see xref linkend=v4l2-matrix-type
 /./entry +  /row
 +  row
 +entryunion/entry
 +entrystructfieldref/structfield/entry
 +entry/entry
 +entryThis union makes it possible to identify the object owning 
 the
 +matrix. Currently the only defined matrix types are identified
 through
 +the filehandle used to call the ioctl, so this union isn't used
 (yet)./entry
 +  /row
 +  row
 +entry__u32/entry
 +entrystructfieldcolumns/structfield/entry
 +entry/entry
 +entryNumber of columns in the matrix./entry
 +  /row
 +  row
 +entry__u32/entry
 +entrystructfieldrows/structfield/entry
 +entry/entry
 +entryNumber of rows in the matrix./entry
 +  /row
 +  row
 +entryunion/entry
 +entrystructfieldelem_min/structfield/entry
 +entry/entry
 +entry/entry
 +  /row
 +  row
 +entry/entry
 +entry__s64/entry
 +entrystructfieldval/structfield/entry
 +entryThe minimal signed value of each matrix element./entry
 +  /row
 +  row
 +entry/entry
 +entry__u64/entry
 +entrystructfielduval/structfield/entry
 +entryThe minimal unsigned value of each matrix
 element./entry
 +  /row
 +  row
 +entryunion/entry
 +entrystructfieldelem_max/structfield/entry
 +entry/entry
 +entry/entry
 +  /row
 +  row
 +entry/entry
 +entry__s64/entry
 +entrystructfieldval/structfield/entry
 +entryThe maximal signed value of each matrix element./entry
 +  /row
 +  row
 +entry/entry
 +entry__u64/entry
 +entrystructfielduval/structfield/entry
 +entryThe maximal unsigned value of each matrix
 element./entry
 +  /row
 +  row
 +entry__u32/entry
 +entrystructfieldelem_size/structfield/entry
 +entry/entry
 +entryThe size in bytes of a single matrix element.
 +The full matrix size will be structfieldcolumns/structfield *
 +structfieldrows/structfield *
 structfieldelem_size/structfield./entry
 +  /row
 +  row
 +entry__u32/entry
 +  

Re: OMAP3 ISP change image format

2013-08-22 Thread jean-philippe francois
It is my understanding that you should set up the format with
media-ctl, and only check
the result in your application. In other words, using G/S/TRY_FMT
ioctl on the video output
nodes won't work.

You can try the following pipeline :
ov3640 - ccdc - previewer - previewer V4L2 output

and set previewer sink pad to bayer and previewer src pad to yuv

I don't think you can output rgb565 however. It is only an input
format for the CCDC.
Anyway, when you use G/S/TRY_FMT ioctl, always check the returned format.


2013/8/20 Tom bassai_...@gmx.net:
 Hello,

 I try from my own application out to grab an image with a ov3640 sensor. For
 this I need to understand the media-api and the isp pipeline correctly.

 I had problems with the use of media-ctl so I implemented the functionality
 into my application and it seems to work fine. Without an error I grabbed an
 image, but it was black.

 So maybe my format settings are not correctly set. My Question is:

 For example I want to grab a rgb565 image from my camera sensor and display
 it on a webpage. my pipeline looks like this:

 ov3640-ccdc-memory

 Would it be enough to just set a raw bayer format on the source and sink
 pads and just the format of the video device (/dev/video2) as rgb565?

 Regards, Tom





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


RE: [PATCH v2 2/2] dma-buf: Add user interfaces for dmabuf sync support

2013-08-22 Thread Inki Dae
Thanks for your comments,
Inki Dae

 -Original Message-
 From: David Herrmann [mailto:dh.herrm...@gmail.com]
 Sent: Wednesday, August 21, 2013 10:17 PM
 To: Inki Dae
 Cc: dri-de...@lists.freedesktop.org; linux-fb...@vger.kernel.org; linux-
 arm-ker...@lists.infradead.org; linux-media@vger.kernel.org; linaro-
 ker...@lists.linaro.org; Maarten Lankhorst; Sumit Semwal;
 kyungmin.p...@samsung.com; myungjoo@samsung.com
 Subject: Re: [PATCH v2 2/2] dma-buf: Add user interfaces for dmabuf sync
 support
 
 Hi
 
 On Wed, Aug 21, 2013 at 12:33 PM, Inki Dae inki@samsung.com wrote:
  This patch adds lock and poll callbacks to dma buf file operations,
  and these callbacks will be called by fcntl and select system calls.
 
  fcntl and select system calls can be used to wait for the completion
  of DMA or CPU access to a shared dmabuf. The difference of them is
  fcntl system call takes a lock after the completion but select system
  call doesn't. So in case of fcntl system call, it's useful when a task
  wants to access a shared dmabuf without any broken. On the other hand,
  it's useful when a task wants to just wait for the completion.
 
 1)
 So how is that supposed to work in user-space? I don't want to block
 on a buffer, but get notified once I can lock it. So I do:
   select(..dmabuf..)
 Once it is finished, I want to use it:
   flock(..dmabuf..)
 However, how can I guarantee the flock will not block? Some other
 process might have locked it in between. So I do a non-blocking
 flock() and if it fails I wait again?

s/flock/fcntl

Yes, it does if you wanted to do a non-blocking fcntl. The fcntl() call will
return -EAGAIN if some other process have locked first. So user process
could retry to lock or do other work. This user process called fcntl() with
non-blocking mode so in this case, I think the user should consider two
things. One is that the fcntl() call couldn't be failed, and other is that
the call could take a lock successfully. Isn't fcntl() with a other fd also,
not dmabuf, take a same action?

Looks ugly and un-predictable.
 

So I think this is reasonable. However, for select system call, I'm not sure
that this system call is needed yet. So I can remove it if unnecessary.

 2)
 What do I do if some user-space program holds a lock and dead-locks?
 

I think fcntl call with a other fd also could lead same situation, and the
lock will be unlocked once the user-space program is killed because when the
process is killed, all file descriptors of the process are closed.

 3)
 How do we do modesetting in atomic-context in the kernel? There is no
 way to lock the object. But this is required for panic-handlers and
 more importantly the kdb debugging hooks.
 Ok, I can live with that being racy, but would still be nice to be
 considered.

Yes,  The lock shouldn't be called in the atomic-context. For this, will add
comments enough.

 
 4)
 Why do we need locks? Aren't fences enough? That is, in which
 situation is a lock really needed?
 If we assume we have two writers A and B (DMA, CPU, GPU, whatever) and
 they have no synchronization on their own. What do we win by
 synchronizing their writes? Ok, yeah, we end up with either A or B and
 not a mixture of both. But if we cannot predict whether we get A or B,
 I don't know why we care at all? It's random, so a mixture would be
 fine, too, wouldn't it?

I think not so. There are some cases that the mixture wouldn't be fine. For
this, will describe it at below.

 
 So if user-space doesn't have any synchronization on its own, I don't
 see why we need an implicit sync on a dma-buf. Could you describe a
 more elaborate use-case?

Ok, first, I think I described that enough though [PATCH 0/2]. For this, you
can refer to the below link,
http://lwn.net/Articles/564208/ 

Anyway, there are some cases that user-space process needs the
synchronization on its own. In case of Tizen platform[1], one is between X
Client and X Server; actually, Composite Manager. Other is between Web app
based on HTML5 and Web Browser.

Please, assume that X Client draws something in a window buffer using CPU,
and then the X Client requests SWAP to X Server. And then X Server notifies
a damage event to Composite Manager. And then Composite Manager composes the
window buffer with its own back buffer using GPU. In this case, Composite
Manager calls eglSwapBuffers; internally, flushing GL commands instead of
finishing them for more performance.

As you may know, the flushing doesn't wait for the complete event from GPU
driver. And at the same time, the X Client could do other work, and also
draw something in the same buffer again. At this time, The buffer could be
broken. Because the X Client can't aware of when GPU access to the buffer is
completed without out-of-band hand shaking; the out-of-band hand shaking is
quite big overhead. That is why we need user-space locking interface, fcntl
system call.

And also there is same issue in case of Web app: Web app draws something in
a 

RE

2013-08-22 Thread Wajeeha Ahmad
Ваш электронный идентификатор выиграл 1,000,000.00 фунтов от NOKIA 2013 КОНЕЦ 
ГОДА рисовать, состоявшемся на 2 августа 2013 ничьей с приложением номер 244. 
Вы должны связаться с нашим агентом претензии по этому e-mail: 
(nokiaclaim_d...@hotmail.co.uk) с, указанные ниже данные для претензий.

Полное имя:
Адрес:
Номер мобильного телефона:
Возраст:
Страна:

Контактное лицо: Mr.Harry Мур
Контактный адрес электронной почты: nokiaclaim_d...@hotmail.co.uk--
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


[RFCv3 PATCH 01/10] v4l2-controls: add motion detection controls.

2013-08-22 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Add support for two motion detection controls and a 'detect control class'.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/v4l2-core/v4l2-ctrls.c | 33 +++--
 include/uapi/linux/v4l2-controls.h   | 14 ++
 2 files changed, 41 insertions(+), 6 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index fccd08b..89e7cfb 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -456,6 +456,12 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
RGB full range (0-255),
NULL,
};
+   static const char * const detect_motion_mode[] = {
+   Disabled,
+   Global,
+   Regional,
+   NULL,
+   };
 
 
switch (id) {
@@ -545,6 +551,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
case V4L2_CID_DV_TX_RGB_RANGE:
case V4L2_CID_DV_RX_RGB_RANGE:
return dv_rgb_range;
+   case V4L2_CID_DETECT_MOTION_MODE:
+   return detect_motion_mode;
 
default:
return NULL;
@@ -557,7 +565,7 @@ const char *v4l2_ctrl_get_name(u32 id)
 {
switch (id) {
/* USER controls */
-   /* Keep the order of the 'case's the same as in videodev2.h! */
+   /* Keep the order of the 'case's the same as in v4l2-controls.h! */
case V4L2_CID_USER_CLASS:   return User Controls;
case V4L2_CID_BRIGHTNESS:   return Brightness;
case V4L2_CID_CONTRAST: return Contrast;
@@ -601,7 +609,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_COLORFX_CBCR: return Color Effects, CbCr;
 
/* MPEG controls */
-   /* Keep the order of the 'case's the same as in videodev2.h! */
+   /* Keep the order of the 'case's the same as in v4l2-controls.h! */
case V4L2_CID_MPEG_CLASS:   return MPEG Encoder Controls;
case V4L2_CID_MPEG_STREAM_TYPE: return Stream Type;
case V4L2_CID_MPEG_STREAM_PID_PMT:  return Stream PMT Program ID;
@@ -701,7 +709,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER: return Repeat 
Sequence Header;
 
/* CAMERA controls */
-   /* Keep the order of the 'case's the same as in videodev2.h! */
+   /* Keep the order of the 'case's the same as in v4l2-controls.h! */
case V4L2_CID_CAMERA_CLASS: return Camera Controls;
case V4L2_CID_EXPOSURE_AUTO:return Auto Exposure;
case V4L2_CID_EXPOSURE_ABSOLUTE:return Exposure Time, 
Absolute;
@@ -735,8 +743,8 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_AUTO_FOCUS_STATUS:return Auto Focus, Status;
case V4L2_CID_AUTO_FOCUS_RANGE: return Auto Focus, Range;
 
-   /* FM Radio Modulator control */
-   /* Keep the order of the 'case's the same as in videodev2.h! */
+   /* FM Radio Modulator controls */
+   /* Keep the order of the 'case's the same as in v4l2-controls.h! */
case V4L2_CID_FM_TX_CLASS:  return FM Radio Modulator 
Controls;
case V4L2_CID_RDS_TX_DEVIATION: return RDS Signal Deviation;
case V4L2_CID_RDS_TX_PI:return RDS Program ID;
@@ -759,6 +767,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_TUNE_ANTENNA_CAPACITOR:   return Tune Antenna Capacitor;
 
/* Flash controls */
+   /* Keep the order of the 'case's the same as in v4l2-controls.h! */
case V4L2_CID_FLASH_CLASS:  return Flash Controls;
case V4L2_CID_FLASH_LED_MODE:   return LED Mode;
case V4L2_CID_FLASH_STROBE_SOURCE:  return Strobe Source;
@@ -774,7 +783,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_FLASH_READY:  return Ready to Strobe;
 
/* JPEG encoder controls */
-   /* Keep the order of the 'case's the same as in videodev2.h! */
+   /* Keep the order of the 'case's the same as in v4l2-controls.h! */
case V4L2_CID_JPEG_CLASS:   return JPEG Compression 
Controls;
case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:  return Chroma Subsampling;
case V4L2_CID_JPEG_RESTART_INTERVAL:return Restart Interval;
@@ -782,18 +791,21 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_JPEG_ACTIVE_MARKER:   return Active Markers;
 
/* Image source controls */
+   /* Keep the order of the 'case's the same as in v4l2-controls.h! */
case V4L2_CID_IMAGE_SOURCE_CLASS:   return Image Source Controls;
case V4L2_CID_VBLANK:   return Vertical Blanking;
case V4L2_CID_HBLANK:   return Horizontal Blanking;
case V4L2_CID_ANALOGUE_GAIN:return Analogue Gain;
 
 

[RFCv3 PATCH 08/10] DocBook: document new v4l motion detection event.

2013-08-22 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 Documentation/DocBook/media/v4l/vidioc-dqevent.xml | 40 ++
 .../DocBook/media/v4l/vidioc-subscribe-event.xml   |  8 +
 2 files changed, 48 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml 
b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
index 89891ad..23ee1e3 100644
--- a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
@@ -94,6 +94,12 @@
  /row
  row
entry/entry
+   entryv4l2-event-motion-det;/entry
+entrystructfieldmotion_det/structfield/entry
+   entryEvent data for event V4L2_EVENT_MOTION_DET./entry
+ /row
+ row
+   entry/entry
entry__u8/entry
 entrystructfielddata/structfield[64]/entry
entryEvent data. Defined by the event type. The union
@@ -242,6 +248,40 @@
   /tgroup
 /table
 
+table frame=none pgwide=1 id=v4l2-event-motion-det
+  titlestruct structnamev4l2_event_motion_det/structname/title
+  tgroup cols=3
+   cs-str;
+   tbody valign=top
+ row
+   entry__u32/entry
+   entrystructfieldflags/structfield/entry
+   entry
+ Currently only one flag is available: if 
constantV4L2_EVENT_MD_FL_HAVE_FRAME_SEQ/constant
+ is set, then the structfieldframe_sequence/structfield field 
is valid,
+ otherwise that field should be ignored.
+   /entry
+ /row
+ row
+   entry__u32/entry
+   entrystructfieldframe_sequence/structfield/entry
+   entry
+ The sequence number of the frame being received. Only valid if the
+ constantV4L2_EVENT_MD_FL_HAVE_FRAME_SEQ/constant flag was set.
+   /entry
+ /row
+ row
+   entry__u32/entry
+   entrystructfieldregion_mask/structfield/entry
+   entry
+ The bitmask of the regions that reported motion. There is at 
least one
+ region. If this field is 0, then no motion was detected at all.
+   /entry
+ /row
+   /tbody
+  /tgroup
+/table
+
 table pgwide=1 frame=none id=changes-flags
   titleChanges/title
   tgroup cols=3
diff --git a/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml 
b/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml
index 5c70b61..9e68976 100644
--- a/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml
@@ -155,6 +155,14 @@
/entry
  /row
  row
+   entryconstantV4L2_EVENT_MOTION_DET/constant/entry
+   entry5/entry
+   entry
+ paraTriggered whenever the motion detection state for one or 
more of the regions
+ changes. This event has a v4l2-event-motion-det; associated with 
it./para
+   /entry
+ /row
+ row
entryconstantV4L2_EVENT_PRIVATE_START/constant/entry
entry0x0800/entry
entryBase event number for driver-private events./entry
-- 
1.8.3.2

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


[RFCv3 PATCH 06/10] solo6x10: implement motion detection events and controls.

2013-08-22 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c | 117 +
 drivers/staging/media/solo6x10/solo6x10.h  |   9 +-
 2 files changed, 74 insertions(+), 52 deletions(-)

diff --git a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c 
b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c
index 6858993..db5ce20 100644
--- a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c
+++ b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c
@@ -270,6 +270,8 @@ static int solo_enc_on(struct solo_enc_dev *solo_enc)
if (solo_enc-bw_weight  solo_dev-enc_bw_remain)
return -EBUSY;
solo_enc-sequence = 0;
+   solo_enc-motion_last_state = false;
+   solo_enc-frames_since_last_motion = 0;
solo_dev-enc_bw_remain -= solo_enc-bw_weight;
 
if (solo_enc-type == SOLO_ENC_TYPE_EXT)
@@ -510,15 +512,6 @@ static int solo_enc_fillbuf(struct solo_enc_dev *solo_enc,
struct vop_header *vh = enc_buf-vh;
int ret;
 
-   /* Check for motion flags */
-   vb-v4l2_buf.flags = ~(V4L2_BUF_FLAG_MOTION_ON |
-   V4L2_BUF_FLAG_MOTION_DETECTED);
-   if (solo_is_motion_on(solo_enc)) {
-   vb-v4l2_buf.flags |= V4L2_BUF_FLAG_MOTION_ON;
-   if (enc_buf-motion)
-   vb-v4l2_buf.flags |= V4L2_BUF_FLAG_MOTION_DETECTED;
-   }
-
switch (solo_enc-fmt) {
case V4L2_PIX_FMT_MPEG4:
case V4L2_PIX_FMT_H264:
@@ -530,9 +523,49 @@ static int solo_enc_fillbuf(struct solo_enc_dev *solo_enc,
}
 
if (!ret) {
+   bool send_event = false;
+
vb-v4l2_buf.sequence = solo_enc-sequence++;
vb-v4l2_buf.timestamp.tv_sec = vh-sec;
vb-v4l2_buf.timestamp.tv_usec = vh-usec;
+
+   /* Check for motion flags */
+   if (solo_is_motion_on(solo_enc)) {
+   /* It takes a few frames for the hardware to detect
+* motion. Once it does it clears the motion detection
+* register and it takes again a few frames before
+* motion is seen. This means in practice that when the
+* motion field is 1, it will go back to 0 for the next
+* frame. This leads to motion detection event being
+* sent all the time, which is not what we want.
+* Instead wait a few frames before deciding that the
+* motion has halted. After some experimentation it
+* turns out that waiting for 5 frames works well.
+*/
+   if (enc_buf-motion == 0 
+   solo_enc-motion_last_state 
+   solo_enc-frames_since_last_motion++  5)
+   send_event = true;
+   else if (enc_buf-motion) {
+   solo_enc-frames_since_last_motion = 0;
+   send_event = !solo_enc-motion_last_state;
+   }
+   }
+
+   if (send_event) {
+   struct v4l2_event ev = {
+   .type = V4L2_EVENT_MOTION_DET,
+   .u.motion_det = {
+   .flags = 
V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ,
+   .frame_sequence = vb-v4l2_buf.sequence,
+   .region_mask = enc_buf-motion ? 1 : 0,
+   },
+   };
+
+   solo_enc-motion_last_state = enc_buf-motion;
+   solo_enc-frames_since_last_motion = 0;
+   v4l2_event_queue(solo_enc-vfd, ev);
+   }
}
 
vb2_buffer_done(vb, ret ? VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE);
@@ -1145,14 +1178,15 @@ static int solo_s_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_MPEG_VIDEO_GOP_SIZE:
solo_enc-gop = ctrl-val;
return 0;
-   case V4L2_CID_MOTION_THRESHOLD:
-   solo_enc-motion_thresh = ctrl-val;
+   case V4L2_CID_DETECT_MOTION_THRESHOLD:
+   solo_enc-motion_thresh = ctrl-val  8;
if (!solo_enc-motion_global || !solo_enc-motion_enabled)
return 0;
-   return solo_set_motion_threshold(solo_dev, solo_enc-ch, 
ctrl-val);
-   case V4L2_CID_MOTION_MODE:
-   solo_enc-motion_global = ctrl-val == 1;
-   solo_enc-motion_enabled = ctrl-val  0;
+   return solo_set_motion_threshold(solo_dev, solo_enc-ch,
+   solo_enc-motion_thresh);
+   case V4L2_CID_DETECT_MOTION_MODE:
+   solo_enc-motion_global = ctrl-val == 

[RFCv3 PATCH 04/10] solo: implement the new matrix ioctls instead of the custom ones.

2013-08-22 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c | 102 ++---
 drivers/staging/media/solo6x10/solo6x10.h  |  10 +-
 2 files changed, 89 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c 
b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c
index a4c5896..6858993 100644
--- a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c
+++ b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c
@@ -1033,29 +1033,98 @@ static int solo_s_parm(struct file *file, void *priv,
return solo_g_parm(file, priv, sp);
 }
 
-static long solo_enc_default(struct file *file, void *fh,
-   bool valid_prio, unsigned int cmd, void *arg)
+static int solo_query_matrix(struct file *file, void *fh,
+   struct v4l2_query_matrix *qm)
+{
+   qm-columns = 45;
+   qm-rows = 36;
+   switch (qm-type) {
+   case V4L2_MATRIX_T_MD_REGION:
+   qm-elem_size = 1;
+   break;
+   case V4L2_MATRIX_T_MD_THRESHOLD:
+   qm-elem_max.val = 65535;
+   qm-elem_size = 2;
+   break;
+   default:
+   return -EINVAL;
+   }
+   return 0;
+}
+
+static int solo_g_matrix(struct file *file, void *fh,
+   struct v4l2_matrix *m)
+{
+   struct solo_enc_dev *solo_enc = video_drvdata(file);
+   int w = m-rect.width;
+   int h = m-rect.height;
+   u16 *mt;
+   int y;
+
+   if (m-rect.top  0 || m-rect.top + h  35 || h  0 || w  0 ||
+   m-rect.left  0 || m-rect.left + w = SOLO_MOTION_SZ)
+   return -EINVAL;
+   if (h == 0 || w == 0)
+   return 0;
+
+   switch (m-type) {
+   case V4L2_MATRIX_T_MD_REGION:
+   return clear_user(m-matrix, w * h);
+   case V4L2_MATRIX_T_MD_THRESHOLD:
+   mt = 
solo_enc-motion_thresholds.thresholds[m-rect.top][m-rect.left];
+   for (y = 0; y  h; y++, mt += SOLO_MOTION_SZ)
+   if (copy_to_user(m-matrix + y * w * 2, mt, w * 2))
+   return -EFAULT;
+   break;
+   default:
+   return -EINVAL;
+   }
+   return 0;
+}
+
+static int solo_s_matrix(struct file *file, void *fh,
+   struct v4l2_matrix *m)
 {
struct solo_enc_dev *solo_enc = video_drvdata(file);
struct solo_dev *solo_dev = solo_enc-solo_dev;
-   struct solo_motion_thresholds *thresholds = arg;
+   int w = m-rect.width;
+   int h = m-rect.height;
+   u16 *mt;
+   int y;
 
-   switch (cmd) {
-   case SOLO_IOC_G_MOTION_THRESHOLDS:
-   *thresholds = solo_enc-motion_thresholds;
+   if (m-rect.top  0 || m-rect.top + h  35 || h  0 || w  0 ||
+   m-rect.left  0 || m-rect.left + w = SOLO_MOTION_SZ)
+   return -EINVAL;
+   if (h == 0 || w == 0)
return 0;
 
-   case SOLO_IOC_S_MOTION_THRESHOLDS:
-   if (!valid_prio)
-   return -EBUSY;
-   solo_enc-motion_thresholds = *thresholds;
-   if (solo_enc-motion_enabled  !solo_enc-motion_global)
-   return solo_set_motion_block(solo_dev, solo_enc-ch,
-   solo_enc-motion_thresholds);
+   switch (m-type) {
+   case V4L2_MATRIX_T_MD_REGION:
+   /* Check that the region matrix is all zeroes */
+   for (y = 0; y  h; y++) {
+   u8 region[SOLO_MOTION_SZ];
+   static const u8 zeroes[SOLO_MOTION_SZ];
+
+   if (copy_from_user(region, m-matrix + y * w, w))
+   return -EFAULT;
+   if (memcmp(region, zeroes, w))
+   return -EINVAL;
+   }
return 0;
+   case V4L2_MATRIX_T_MD_THRESHOLD:
+   mt = 
solo_enc-motion_thresholds.thresholds[m-rect.top][m-rect.left];
+   for (y = 0; y  h; y++, mt += SOLO_MOTION_SZ)
+   if (copy_from_user(mt, m-matrix + y * w * 2, w * 2))
+   return -EFAULT;
+   break;
default:
-   return -ENOTTY;
+   return -EINVAL;
}
+
+   if (solo_enc-motion_enabled  !solo_enc-motion_global)
+   return solo_set_motion_block(solo_dev, solo_enc-ch,
+   solo_enc-motion_thresholds);
+   return 0;
 }
 
 static int solo_s_ctrl(struct v4l2_ctrl *ctrl)
@@ -1141,11 +1210,14 @@ static const struct v4l2_ioctl_ops solo_enc_ioctl_ops = 
{
/* Video capture parameters */
.vidioc_s_parm  = solo_s_parm,
.vidioc_g_parm  = solo_g_parm,
+   /* Motion Detection matrices */
+   .vidioc_query_matrix 

[RFCv3 PATCH 09/10] DocBook: document the new v4l2 matrix ioctls.

2013-08-22 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 Documentation/DocBook/media/v4l/v4l2.xml   |   2 +
 .../DocBook/media/v4l/vidioc-g-matrix.xml  | 108 +
 .../DocBook/media/v4l/vidioc-query-matrix.xml  | 180 +
 3 files changed, 290 insertions(+)
 create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-matrix.xml
 create mode 100644 Documentation/DocBook/media/v4l/vidioc-query-matrix.xml

diff --git a/Documentation/DocBook/media/v4l/v4l2.xml 
b/Documentation/DocBook/media/v4l/v4l2.xml
index 8469fe1..11687d5 100644
--- a/Documentation/DocBook/media/v4l/v4l2.xml
+++ b/Documentation/DocBook/media/v4l/v4l2.xml
@@ -584,6 +584,7 @@ and discussions on the V4L mailing list./revremark
 sub-g-frequency;
 sub-g-input;
 sub-g-jpegcomp;
+sub-g-matrix;
 sub-g-modulator;
 sub-g-output;
 sub-g-parm;
@@ -600,6 +601,7 @@ and discussions on the V4L mailing list./revremark
 sub-querycap;
 sub-queryctrl;
 sub-query-dv-timings;
+sub-query-matrix;
 sub-querystd;
 sub-reqbufs;
 sub-s-hw-freq-seek;
diff --git a/Documentation/DocBook/media/v4l/vidioc-g-matrix.xml 
b/Documentation/DocBook/media/v4l/vidioc-g-matrix.xml
new file mode 100644
index 000..9db30f1
--- /dev/null
+++ b/Documentation/DocBook/media/v4l/vidioc-g-matrix.xml
@@ -0,0 +1,108 @@
+refentry id=vidioc-g-matrix
+  refmeta
+refentrytitleioctl VIDIOC_G_MATRIX, VIDIOC_S_MATRIX/refentrytitle
+manvol;
+  /refmeta
+
+  refnamediv
+refnameVIDIOC_G_MATRIX/refname
+refnameVIDIOC_S_MATRIX/refname
+refpurposeGet or set a matrix/refpurpose
+  /refnamediv
+
+  refsynopsisdiv
+funcsynopsis
+  funcprototype
+   funcdefint functionioctl/function/funcdef
+   paramdefint parameterfd/parameter/paramdef
+   paramdefint parameterrequest/parameter/paramdef
+   paramdefstruct v4l2_matrix
+*parameterargp/parameter/paramdef
+  /funcprototype
+/funcsynopsis
+  /refsynopsisdiv
+
+  refsect1
+titleArguments/title
+
+variablelist
+  varlistentry
+   termparameterfd/parameter/term
+   listitem
+ parafd;/para
+   /listitem
+  /varlistentry
+  varlistentry
+   termparameterrequest/parameter/term
+   listitem
+ paraVIDIOC_G_MATRIX, VIDIOC_S_MATRIX/para
+   /listitem
+  /varlistentry
+  varlistentry
+   termparameterargp/parameter/term
+   listitem
+ para/para
+   /listitem
+  /varlistentry
+/variablelist
+  /refsect1
+
+  refsect1
+titleDescription/title
+
+paraGet or set the elements of a matrix. To get a matrix the application 
fills in the
+structfieldtype/structfield and zeroes the 
structfieldreserved/structfield
+field of v4l2-matrix;. All other fields will be returned by the driver.
+To set a matrix the application fills in all the fields of the structure 
and zeroes the
+structfieldreserved/structfield field.
+/para
+
+table frame=none pgwide=1 id=v4l2-matrix
+  titlestruct structnamev4l2_matrix/structname/title
+  tgroup cols=4
+   cs-str;
+   tbody valign=top
+ row
+   entry__u32/entry
+   entrystructfieldtype/structfield/entry
+entry/entry
+   entryType of the matrix, see xref linkend=v4l2-matrix-type 
/./entry
+ /row
+ row
+   entryv4l2-rect;/entry
+   entrystructfieldrect/structfield/entry
+entry/entry
+   entryThe subset of the matrix that you want to get or set. The 
rectangle
+   must fit within the total matrix dimensions, the top left element 
of the total
+   matrix is always (0, 0). To get/set the full matrix 
structfieldrect/structfield
+   should be set to (0, 0, structfieldcolumns/structfield, 
structfieldrows/structfield),
+   where structfieldcolumns/structfield and 
structfieldrows/structfield are
+   obtained from VIDIOC-QUERY-MATRIX;./entry
+ /row
+ row
+   entryvoid */entry
+   entrystructfieldmatrix/structfield/entry
+entry/entry
+   entryA pointer to the matrix. This matrix has size 
structfieldrect.width/structfield *
+   structfieldrect.height/structfield * 
structfieldelem_size/structfield.
+   The structfieldelem_size/structfield can be obtained via 
VIDIOC-QUERY-MATRIX;.
+   The elements are stored row-by-row in the matrix. The first element 
is element
+   (structfieldrect.top/structfield, 
structfieldrect.left/structfield) of the
+   full matrix./entry
+ /row
+ row
+   entry__u32/entry
+   entrystructfieldreserved/structfield[12]/entry
+entry/entry
+   entryReserved for future extensions. Drivers and applications 
must set
+   the array to zero./entry
+ /row
+   /tbody
+  /tgroup
+/table
+
+  /refsect1
+  

[RFCv3 PATCH 07/10] DocBook: add the new v4l detection class controls.

2013-08-22 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 Documentation/DocBook/media/v4l/controls.xml | 69 
 1 file changed, 69 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index c2fc9ec..dabc707 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -4772,4 +4772,73 @@ defines possible values for de-emphasis. Here they 
are:/entry
   /table
 
   /section
+
+section id=detect-controls
+  titleDetect Control Reference/title
+
+  paraThe Detect class includes controls for common features of
+  various motion or object detection capable devices./para
+
+  table pgwide=1 frame=none id=detect-control-id
+  titleDetect 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
+  row
+entry 
spanname=idconstantV4L2_CID_DETECT_CLASS/constantnbsp;/entry
+entryclass/entry
+  /rowrowentry spanname=descrThe Detect class
+descriptor. Calling VIDIOC-QUERYCTRL; for this control will return a
+description of this control class./entry
+  /row
+  row
+entry 
spanname=idconstantV4L2_CID_DETECT_MOTION_MODE/constantnbsp;/entry
+entrymenu/entry
+  /rowrowentry spanname=descrSets the motion detection 
mode./entry
+  /row
+ row
+   entrytbl spanname=descr cols=2
+ tbody valign=top
+   row
+ entryconstantV4L2_DETECT_MOTION_DISABLED/constant
+ /entryentryDisable motion detection./entry
+   /row
+   row
+ entryconstantV4L2_DETECT_MOTION_GLOBAL/constant
+ /entryentryUse a single motion detection 
threshold./entry
+   /row
+   row
+ entryconstantV4L2_DETECT_MOTION_REGIONAL/constant
+ /entryentryThe image is divided into regions, each with 
their own
+ motion detection threshold./entry
+   /row
+ /tbody
+   /entrytbl
+ /row
+  row
+   entry 
spanname=idconstantV4L2_CID_DETECT_MOTION_THRESHOLD/constantnbsp;/entry
+   entryinteger/entry
+ /row
+ rowentry spanname=descrSets the global motion detection 
threshold to be
+ used with the constantV4L2_DETECT_MOTION_GLOBAL/constant motion 
detection mode./entry
+  /row
+/tbody
+  /tgroup
+  /table
+
+  /section
 /section
-- 
1.8.3.2

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


[RFCv3 PATCH 02/10] v4l2: add matrix support.

2013-08-22 Thread Hans Verkuil
From: Hans Verkuil hans.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 Verkuil hans.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   | 58 
 4 files changed, 91 insertions(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/v4l2-dev.c 
b/drivers/media/v4l2-core/v4l2-dev.c
index c8859d6..5e58df6 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -598,6 +598,9 @@ static void determine_valid_ioctls(struct video_device 
*vdev)
SET_VALID_IOCTL(ops, VIDIOC_UNSUBSCRIBE_EVENT, 
vidioc_unsubscribe_event);
if (ops-vidioc_enum_freq_bands || ops-vidioc_g_tuner || 
ops-vidioc_g_modulator)
set_bit(_IOC_NR(VIDIOC_ENUM_FREQ_BANDS), valid_ioctls);
+   SET_VALID_IOCTL(ops, VIDIOC_QUERY_MATRIX, vidioc_query_matrix);
+   SET_VALID_IOCTL(ops, VIDIOC_G_MATRIX, vidioc_g_matrix);
+   SET_VALID_IOCTL(ops, VIDIOC_S_MATRIX, vidioc_s_matrix);
 
if (is_vid) {
/* video specific ioctls */
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c 
b/drivers/media/v4l2-core/v4l2-ioctl.c
index 68e6b5e..cdd5c77 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -549,7 +549,7 @@ static void v4l_print_cropcap(const void *arg, bool 
write_only)
const struct v4l2_cropcap *p = arg;
 
pr_cont(type=%s, bounds wxh=%dx%d, x,y=%d,%d, 
-   defrect wxh=%dx%d, x,y=%d,%d\n, 
+   defrect wxh=%dx%d, x,y=%d,%d, 
pixelaspect %d/%d\n,
prt_names(p-type, v4l2_type_names),
p-bounds.width, p-bounds.height,
@@ -831,6 +831,24 @@ static void v4l_print_freq_band(const void *arg, bool 
write_only)
p-rangehigh, p-modulation);
 }
 
+static void v4l_print_query_matrix(const void *arg, bool write_only)
+{
+   const struct v4l2_query_matrix *p = arg;
+
+   pr_cont(type=0x%x, columns=%u, rows=%u, elem_min=%lld, elem_max=%lld, 
elem_size=%u\n,
+   p-type, p-columns, p-rows,
+   p-elem_min.val, p-elem_max.val, p-elem_size);
+}
+
+static void v4l_print_matrix(const void *arg, bool write_only)
+{
+   const struct v4l2_matrix *p = arg;
+
+   pr_cont(type=0x%x, wxh=%dx%d, x,y=%d,%d, matrix=%p\n,
+   p-type, p-rect.width, p-rect.height,
+   p-rect.top, p-rect.left, p-matrix);
+}
+
 static void v4l_print_u32(const void *arg, bool write_only)
 {
pr_cont(value=%u\n, *(const u32 *)arg);
@@ -2055,6 +2073,9 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = {
IOCTL_INFO_STD(VIDIOC_DV_TIMINGS_CAP, vidioc_dv_timings_cap, 
v4l_print_dv_timings_cap, INFO_FL_CLEAR(v4l2_dv_timings_cap, type)),
IOCTL_INFO_FNC(VIDIOC_ENUM_FREQ_BANDS, v4l_enum_freq_bands, 
v4l_print_freq_band, 0),
IOCTL_INFO_FNC(VIDIOC_DBG_G_CHIP_INFO, v4l_dbg_g_chip_info, 
v4l_print_dbg_chip_info, INFO_FL_CLEAR(v4l2_dbg_chip_info, match)),
+   IOCTL_INFO_STD(VIDIOC_QUERY_MATRIX, vidioc_query_matrix, 
v4l_print_query_matrix, INFO_FL_CLEAR(v4l2_query_matrix, type)),
+   IOCTL_INFO_STD(VIDIOC_G_MATRIX, vidioc_g_matrix, v4l_print_matrix, 
INFO_FL_CLEAR(v4l2_matrix, matrix)),
+   IOCTL_INFO_STD(VIDIOC_S_MATRIX, vidioc_s_matrix, v4l_print_matrix, 
INFO_FL_PRIO | INFO_FL_CLEAR(v4l2_matrix, matrix)),
 };
 #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
 
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..cf13339 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -1838,6 +1838,58 @@ struct v4l2_create_buffers {
__u32   reserved[8];
 };
 
+/* 

[RFCv3 PATCH 00/10] Matrix and Motion Detection support

2013-08-22 Thread Hans Verkuil
This third patch series adds support for matrices and motion detection and
converts the solo6x10 and go7007 driver to use these new APIs.

See this 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 and go7007 boards, both global motion detection
and regional motion detection, and it works well. Although note the commit
message for patch 10 regarding some uncertainties regarding regional MD in
the go7007 driver.

Changes since the second RFC patch series:

- Removed the ref field as per Sakari's comment. The reserved fields must now
  be cleared by the application as well, otherwise we wouldn't be able to add
  a ref field later.
- Cleaned up the compat-ioctl32 code as suggested by Laurent.
- Improved the matrix documentation. The documentation on the region matrix
  type in particular was rather obscure as Laurent pointed out.

Changes since the first RFC patch series:

- document the new APIs
- implemented motion detection in the go7007 driver

I have adapted v4l2-ctl to support the new APIs:

http://git.linuxtv.org/hverkuil/v4l-utils.git/shortlog/refs/heads/matrix

If there are no more comments regarding this patch series, then I'll make
a pull request for this.

Once this is in, I can move the solo and go7007 drivers into the mainline
kernel, since the missing motion detection API is the only bit keeping
them in staging.

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


[RFCv3 PATCH 03/10] v4l2-compat-ioctl32: add g/s_matrix support.

2013-08-22 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 49 +++
 1 file changed, 49 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c 
b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
index 8f7a6a4..3e5a30f 100644
--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
+++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
@@ -777,6 +777,38 @@ static int put_v4l2_subdev_edid32(struct v4l2_subdev_edid 
*kp, struct v4l2_subde
return 0;
 }
 
+struct v4l2_matrix32 {
+   __u32 type;
+   union {
+   __u32 raw[4];
+   } ref;
+   struct v4l2_rect rect;
+   compat_caddr_t matrix;
+   __u32 reserved[12];
+} __attribute__ ((packed));
+
+static int get_v4l2_matrix32(struct v4l2_matrix *kp, struct v4l2_matrix32 
__user *up)
+{
+   u32 tmp;
+
+   if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_matrix32)) ||
+   get_user(kp-type, up-type) ||
+   copy_from_user(kp-rect, up-rect, sizeof(up-rect)) ||
+   get_user(tmp, up-matrix) ||
+   copy_from_user(kp-reserved, up-reserved, sizeof(kp-reserved)))
+   return -EFAULT;
+   kp-matrix = compat_ptr(tmp);
+   return 0;
+}
+
+static int put_v4l2_matrix32(struct v4l2_matrix *kp, struct v4l2_matrix32 
__user *up)
+{
+   if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_matrix32)) ||
+   copy_to_user(kp-rect, up-rect, sizeof(kp-rect)) ||
+   copy_to_user(kp-reserved, up-reserved, sizeof(kp-reserved)))
+   return -EFAULT;
+   return 0;
+}
 
 #define VIDIOC_G_FMT32 _IOWR('V',  4, struct v4l2_format32)
 #define VIDIOC_S_FMT32 _IOWR('V',  5, struct v4l2_format32)
@@ -796,6 +828,8 @@ static int put_v4l2_subdev_edid32(struct v4l2_subdev_edid 
*kp, struct v4l2_subde
 #defineVIDIOC_DQEVENT32_IOR ('V', 89, struct v4l2_event32)
 #define VIDIOC_CREATE_BUFS32   _IOWR('V', 92, struct v4l2_create_buffers32)
 #define VIDIOC_PREPARE_BUF32   _IOWR('V', 93, struct v4l2_buffer32)
+#define VIDIOC_G_MATRIX32  _IOWR('V', 104, struct v4l2_matrix32)
+#define VIDIOC_S_MATRIX32  _IOWR('V', 105, struct v4l2_matrix32)
 
 #define VIDIOC_OVERLAY32   _IOW ('V', 14, s32)
 #define VIDIOC_STREAMON32  _IOW ('V', 18, s32)
@@ -817,6 +851,7 @@ static long do_video_ioctl(struct file *file, unsigned int 
cmd, unsigned long ar
struct v4l2_event v2ev;
struct v4l2_create_buffers v2crt;
struct v4l2_subdev_edid v2edid;
+   struct v4l2_matrix v2matrix;
unsigned long vx;
int vi;
} karg;
@@ -851,6 +886,8 @@ static long do_video_ioctl(struct file *file, unsigned int 
cmd, unsigned long ar
case VIDIOC_PREPARE_BUF32: cmd = VIDIOC_PREPARE_BUF; break;
case VIDIOC_SUBDEV_G_EDID32: cmd = VIDIOC_SUBDEV_G_EDID; break;
case VIDIOC_SUBDEV_S_EDID32: cmd = VIDIOC_SUBDEV_S_EDID; break;
+   case VIDIOC_G_MATRIX32: cmd = VIDIOC_G_MATRIX; break;
+   case VIDIOC_S_MATRIX32: cmd = VIDIOC_S_MATRIX; break;
}
 
switch (cmd) {
@@ -922,6 +959,12 @@ static long do_video_ioctl(struct file *file, unsigned int 
cmd, unsigned long ar
case VIDIOC_DQEVENT:
compatible_arg = 0;
break;
+
+   case VIDIOC_G_MATRIX:
+   case VIDIOC_S_MATRIX:
+   err = get_v4l2_matrix32(karg.v2matrix, up);
+   compatible_arg = 0;
+   break;
}
if (err)
return err;
@@ -994,6 +1037,11 @@ static long do_video_ioctl(struct file *file, unsigned 
int cmd, unsigned long ar
case VIDIOC_ENUMINPUT:
err = put_v4l2_input32(karg.v2i, up);
break;
+
+   case VIDIOC_G_MATRIX:
+   case VIDIOC_S_MATRIX:
+   err = put_v4l2_matrix32(karg.v2matrix, up);
+   break;
}
return err;
 }
@@ -1089,6 +1137,7 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int 
cmd, unsigned long arg)
case VIDIOC_ENUM_FREQ_BANDS:
case VIDIOC_SUBDEV_G_EDID32:
case VIDIOC_SUBDEV_S_EDID32:
+   case VIDIOC_QUERY_MATRIX:
ret = do_video_ioctl(file, cmd, arg);
break;
 
-- 
1.8.3.2

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


[RFCv3 PATCH 10/10] go7007: add motion detection support.

2013-08-22 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

This patch adds motion detection support to the go7007 driver using the new
motion detection controls, events and matrices.

The global motion detection works fine, but the regional motion detection
support probably needs more work. There seems to be some interaction between
regions that makes setting correct thresholds difficult. The exact meaning of
the thresholds isn't entirely clear either.

I do not have any documentation, the only information I have is the custom code
in the driver and a modet.c application.

My suspicion is that the internal motion detection bitmap is only updated for
a region if motion is detected for that region. This means that additional work
has to be done to check if the motion bits for a region have changed, and if 
not,
then that region should be discarded from the region_mask.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/staging/media/go7007/go7007-driver.c  | 119 +---
 drivers/staging/media/go7007/go7007-fw.c  |  28 +-
 drivers/staging/media/go7007/go7007-priv.h|  16 ++
 drivers/staging/media/go7007/go7007-v4l2.c| 382 +++---
 drivers/staging/media/go7007/go7007.h |  40 ---
 drivers/staging/media/go7007/saa7134-go7007.c |   1 -
 6 files changed, 403 insertions(+), 183 deletions(-)
 delete mode 100644 drivers/staging/media/go7007/go7007.h

diff --git a/drivers/staging/media/go7007/go7007-driver.c 
b/drivers/staging/media/go7007/go7007-driver.c
index 3640df0..8e1a04f 100644
--- a/drivers/staging/media/go7007/go7007-driver.c
+++ b/drivers/staging/media/go7007/go7007-driver.c
@@ -33,6 +33,7 @@
 #include linux/videodev2.h
 #include media/tuner.h
 #include media/v4l2-common.h
+#include media/v4l2-event.h
 
 #include go7007-priv.h
 
@@ -333,20 +334,33 @@ EXPORT_SYMBOL(go7007_register_encoder);
 int go7007_start_encoder(struct go7007 *go)
 {
u8 *fw;
-   int fw_len, rv = 0, i;
+   int fw_len, rv = 0, i, x, y;
u16 intr_val, intr_data;
 
go-modet_enable = 0;
-   if (!go-dvd_mode)
-   for (i = 0; i  4; ++i) {
-   if (go-modet[i].enable) {
-   go-modet_enable = 1;
-   continue;
+   for (i = 0; i  4; i++)
+   go-modet[i].enable = 0;
+
+   switch (v4l2_ctrl_g_ctrl(go-modet_mode)) {
+   case V4L2_DETECT_MOTION_GLOBAL:
+   memset(go-modet_map, 0, sizeof(go-modet_map));
+   go-modet[0].enable = 1;
+   go-modet_enable = 1;
+   break;
+   case V4L2_DETECT_MOTION_REGIONAL:
+   for (y = 0; y  go-height / 16; y++) {
+   for (x = 0; x  go-width / 16; x++) {
+   int idx = y * go-width / 16 + x;
+
+   go-modet[go-modet_map[idx]].enable = 1;
}
-   go-modet[i].pixel_threshold = 32767;
-   go-modet[i].motion_threshold = 32767;
-   go-modet[i].mb_threshold = 32767;
}
+   go-modet_enable = 1;
+   break;
+   }
+
+   if (go-dvd_mode)
+   go-modet_enable = 0;
 
if (go7007_construct_fw_image(go, fw, fw_len)  0)
return -1;
@@ -385,43 +399,80 @@ static inline void store_byte(struct go7007_buffer *vb, 
u8 byte)
 }
 
 /*
- * Deliver the last video buffer and get a new one to start writing to.
+ * Determine regions with motion and send a motion detection event
+ * in case of changes.
  */
-static struct go7007_buffer *frame_boundary(struct go7007 *go, struct 
go7007_buffer *vb)
+static void go7007_motion_regions(struct go7007 *go, struct go7007_buffer *vb)
 {
-   struct go7007_buffer *vb_tmp = NULL;
u32 *bytesused = vb-vb.v4l2_planes[0].bytesused;
+   unsigned motion[4] = { 0, 0, 0, 0 };
+   u32 motion_regions = 0;
+   unsigned stride = (go-width + 7)  3;
+   unsigned x, y;
int i;
 
-   if (vb) {
-   if (vb-modet_active) {
-   if (*bytesused + 216  GO7007_BUF_SIZE) {
-   for (i = 0; i  216; ++i)
-   store_byte(vb, go-active_map[i]);
-   *bytesused -= 216;
-   } else
-   vb-modet_active = 0;
+   for (i = 0; i  216; ++i)
+   store_byte(vb, go-active_map[i]);
+   for (y = 0; y  go-height / 16; y++) {
+   for (x = 0; x  go-width / 16; x++) {
+   if (!(go-active_map[y * stride + (x  3)]  (1  (x 
 7
+   continue;
+   motion[go-modet_map[y * (go-width / 16) + x]]++;
}
-   vb-vb.v4l2_buf.sequence = go-next_seq++;
-   v4l2_get_timestamp(vb-vb.v4l2_buf.timestamp);
-   vb_tmp = vb;
+   }
+   

[RFCv3 PATCH 05/10] v4l2: add a motion detection event.

2013-08-22 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 include/uapi/linux/videodev2.h | 17 +
 1 file changed, 17 insertions(+)

diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index cf13339..52e5606 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -1721,6 +1721,7 @@ struct v4l2_streamparm {
 #define V4L2_EVENT_EOS 2
 #define V4L2_EVENT_CTRL3
 #define V4L2_EVENT_FRAME_SYNC  4
+#define V4L2_EVENT_MOTION_DET  5
 #define V4L2_EVENT_PRIVATE_START   0x0800
 
 /* Payload for V4L2_EVENT_VSYNC */
@@ -1752,12 +1753,28 @@ struct v4l2_event_frame_sync {
__u32 frame_sequence;
 };
 
+#define V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ(1  0)
+
+/**
+ * struct v4l2_event_motion_det - motion detection event
+ * @flags: if V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ is set, then the
+ * frame_sequence field is valid.
+ * @frame_sequence:the frame sequence number associated with this event.
+ * @region_mask:   which regions detected motion.
+ */
+struct v4l2_event_motion_det {
+   __u32 flags;
+   __u32 frame_sequence;
+   __u32 region_mask;
+};
+
 struct v4l2_event {
__u32   type;
union {
struct v4l2_event_vsync vsync;
struct v4l2_event_ctrl  ctrl;
struct v4l2_event_frame_syncframe_sync;
+   struct v4l2_event_motion_detmotion_det;
__u8data[64];
} u;
__u32   pending;
-- 
1.8.3.2

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


[RFCv3 PATCH 2/5] ad9389b: set is_private only after successfully creating all controls

2013-08-22 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

is_private was set right after creating each control, but the control pointer
might be NULL in case of an error. Set it after all controls were successfully
created, since that guarantees that all control pointers are non-NULL.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/ad9389b.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/media/i2c/ad9389b.c b/drivers/media/i2c/ad9389b.c
index 8369786..bb0c99d 100644
--- a/drivers/media/i2c/ad9389b.c
+++ b/drivers/media/i2c/ad9389b.c
@@ -1109,27 +1109,27 @@ static int ad9389b_probe(struct i2c_client *client, 
const struct i2c_device_id *
state-hdmi_mode_ctrl = v4l2_ctrl_new_std_menu(hdl, ad9389b_ctrl_ops,
V4L2_CID_DV_TX_MODE, V4L2_DV_TX_MODE_HDMI,
0, V4L2_DV_TX_MODE_DVI_D);
-   state-hdmi_mode_ctrl-is_private = true;
state-hotplug_ctrl = v4l2_ctrl_new_std(hdl, NULL,
V4L2_CID_DV_TX_HOTPLUG, 0, 1, 0, 0);
-   state-hotplug_ctrl-is_private = true;
state-rx_sense_ctrl = v4l2_ctrl_new_std(hdl, NULL,
V4L2_CID_DV_TX_RXSENSE, 0, 1, 0, 0);
-   state-rx_sense_ctrl-is_private = true;
state-have_edid0_ctrl = v4l2_ctrl_new_std(hdl, NULL,
V4L2_CID_DV_TX_EDID_PRESENT, 0, 1, 0, 0);
-   state-have_edid0_ctrl-is_private = true;
state-rgb_quantization_range_ctrl =
v4l2_ctrl_new_std_menu(hdl, ad9389b_ctrl_ops,
V4L2_CID_DV_TX_RGB_RANGE, V4L2_DV_RGB_RANGE_FULL,
0, V4L2_DV_RGB_RANGE_AUTO);
-   state-rgb_quantization_range_ctrl-is_private = true;
sd-ctrl_handler = hdl;
if (hdl-error) {
err = hdl-error;
 
goto err_hdl;
}
+   state-hdmi_mode_ctrl-is_private = true;
+   state-hotplug_ctrl-is_private = true;
+   state-rx_sense_ctrl-is_private = true;
+   state-have_edid0_ctrl-is_private = true;
+   state-rgb_quantization_range_ctrl-is_private = true;
 
state-pad.flags = MEDIA_PAD_FL_SINK;
err = media_entity_init(sd-entity, 1, state-pad, 0);
-- 
1.8.3.2

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


[RFCv3 PATCH 1/5] adv7604: set is_private only after successfully creating all controls

2013-08-22 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

is_private was set right after creating each control, but the control pointer
might be NULL in case of an error. Set it after all controls were successfully
created, since that guarantees that all control pointers are non-NULL.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7604.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 5b54ba1..fbfdd2f 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2021,29 +2021,30 @@ static int adv7604_probe(struct i2c_client *client,
/* private controls */
state-detect_tx_5v_ctrl = v4l2_ctrl_new_std(hdl, NULL,
V4L2_CID_DV_RX_POWER_PRESENT, 0, 1, 0, 0);
-   state-detect_tx_5v_ctrl-is_private = true;
state-rgb_quantization_range_ctrl =
v4l2_ctrl_new_std_menu(hdl, adv7604_ctrl_ops,
V4L2_CID_DV_RX_RGB_RANGE, V4L2_DV_RGB_RANGE_FULL,
0, V4L2_DV_RGB_RANGE_AUTO);
-   state-rgb_quantization_range_ctrl-is_private = true;
 
/* custom controls */
state-analog_sampling_phase_ctrl =
v4l2_ctrl_new_custom(hdl, adv7604_ctrl_analog_sampling_phase, 
NULL);
-   state-analog_sampling_phase_ctrl-is_private = true;
state-free_run_color_manual_ctrl =
v4l2_ctrl_new_custom(hdl, adv7604_ctrl_free_run_color_manual, 
NULL);
-   state-free_run_color_manual_ctrl-is_private = true;
state-free_run_color_ctrl =
v4l2_ctrl_new_custom(hdl, adv7604_ctrl_free_run_color, NULL);
-   state-free_run_color_ctrl-is_private = true;
 
sd-ctrl_handler = hdl;
if (hdl-error) {
err = hdl-error;
goto err_hdl;
}
+   state-detect_tx_5v_ctrl-is_private = true;
+   state-rgb_quantization_range_ctrl-is_private = true;
+   state-analog_sampling_phase_ctrl-is_private = true;
+   state-free_run_color_manual_ctrl-is_private = true;
+   state-free_run_color_ctrl-is_private = true;
+
if (adv7604_s_detect_tx_5v_ctrl(sd)) {
err = -ENODEV;
goto err_hdl;
-- 
1.8.3.2

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


[RFCv3 PATCH 5/5] MAINTAINERS: add entries for adv7511 and adv7842.

2013-08-22 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 MAINTAINERS | 12 
 1 file changed, 12 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index bf61e04..e50819b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -580,12 +580,24 @@ L:linux-media@vger.kernel.org
 S: Maintained
 F: drivers/media/i2c/ad9389b*
 
+ANALOG DEVICES INC ADV7511 DRIVER
+M: Hans Verkuil hans.verk...@cisco.com
+L: linux-media@vger.kernel.org
+S: Maintained
+F: drivers/media/i2c/adv7511*
+
 ANALOG DEVICES INC ADV7604 DRIVER
 M: Hans Verkuil hans.verk...@cisco.com
 L: linux-media@vger.kernel.org
 S: Maintained
 F: drivers/media/i2c/adv7604*
 
+ANALOG DEVICES INC ADV7842 DRIVER
+M: Hans Verkuil hans.verk...@cisco.com
+L: linux-media@vger.kernel.org
+S: Maintained
+F: drivers/media/i2c/adv7842*
+
 ANALOG DEVICES INC ASOC CODEC DRIVERS
 M: Lars-Peter Clausen l...@metafoo.de
 L: device-drivers-de...@blackfin.uclinux.org
-- 
1.8.3.2

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


[RFCv3 PATCH 4/5] adv7511: add new video encoder.

2013-08-22 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/Kconfig   |   11 +
 drivers/media/i2c/Makefile  |1 +
 drivers/media/i2c/adv7511.c | 1198 +++
 include/media/adv7511.h |   49 ++
 4 files changed, 1259 insertions(+)
 create mode 100644 drivers/media/i2c/adv7511.c
 create mode 100644 include/media/adv7511.h

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 847b711..d18be19 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -429,6 +429,17 @@ config VIDEO_ADV7393
  To compile this driver as a module, choose M here: the
  module will be called adv7393.
 
+config VIDEO_ADV7511
+   tristate Analog Devices ADV7511 encoder
+   depends on VIDEO_V4L2  I2C  VIDEO_V4L2_SUBDEV_API
+   ---help---
+ Support for the Analog Devices ADV7511 video encoder.
+
+ This is a Analog Devices HDMI transmitter.
+
+ To compile this driver as a module, choose M here: the
+ module will be called adv7511.
+
 config VIDEO_AD9389B
tristate Analog Devices AD9389B encoder
depends on VIDEO_V4L2  I2C  VIDEO_V4L2_SUBDEV_API
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index b4cf972..9f462df 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -28,6 +28,7 @@ obj-$(CONFIG_VIDEO_ADV7393) += adv7393.o
 obj-$(CONFIG_VIDEO_ADV7604) += adv7604.o
 obj-$(CONFIG_VIDEO_ADV7842) += adv7842.o
 obj-$(CONFIG_VIDEO_AD9389B) += ad9389b.o
+obj-$(CONFIG_VIDEO_ADV7511) += adv7511.o
 obj-$(CONFIG_VIDEO_VPX3220) += vpx3220.o
 obj-$(CONFIG_VIDEO_VS6624)  += vs6624.o
 obj-$(CONFIG_VIDEO_BT819) += bt819.o
diff --git a/drivers/media/i2c/adv7511.c b/drivers/media/i2c/adv7511.c
new file mode 100644
index 000..7a576097
--- /dev/null
+++ b/drivers/media/i2c/adv7511.c
@@ -0,0 +1,1198 @@
+/*
+ * Analog Devices ADV7511 HDMI Transmitter Device Driver
+ *
+ * Copyright 2013 Cisco Systems, Inc. and/or its affiliates. All rights 
reserved.
+ *
+ * This program is free software; you may redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+
+#include linux/kernel.h
+#include linux/module.h
+#include linux/slab.h
+#include linux/i2c.h
+#include linux/delay.h
+#include linux/videodev2.h
+#include linux/gpio.h
+#include linux/workqueue.h
+#include linux/v4l2-dv-timings.h
+#include media/v4l2-device.h
+#include media/v4l2-common.h
+#include media/v4l2-ctrls.h
+#include media/v4l2-dv-timings.h
+#include media/adv7511.h
+
+static int debug;
+module_param(debug, int, 0644);
+MODULE_PARM_DESC(debug, debug level (0-2));
+
+MODULE_DESCRIPTION(Analog Devices ADV7511 HDMI Transmitter Device Driver);
+MODULE_AUTHOR(Hans Verkuil);
+MODULE_LICENSE(GPL);
+
+#define MASK_ADV7511_EDID_RDY_INT   0x04
+#define MASK_ADV7511_MSEN_INT   0x40
+#define MASK_ADV7511_HPD_INT0x80
+
+#define MASK_ADV7511_HPD_DETECT 0x40
+#define MASK_ADV7511_MSEN_DETECT0x20
+#define MASK_ADV7511_EDID_RDY   0x10
+
+#define EDID_MAX_RETRIES (8)
+#define EDID_DELAY 250
+#define EDID_MAX_SEGM 8
+
+#define ADV7511_MAX_WIDTH 1920
+#define ADV7511_MAX_HEIGHT 1200
+#define ADV7511_MIN_PIXELCLOCK 2000
+#define ADV7511_MAX_PIXELCLOCK 22500
+
+/*
+**
+*
+*  Arrays with configuration parameters for the ADV7511
+*
+**
+*/
+
+struct i2c_reg_value {
+   unsigned char reg;
+   unsigned char value;
+};
+
+struct adv7511_state_edid {
+   /* total number of blocks */
+   u32 blocks;
+   /* Number of segments read */
+   u32 segments;
+   uint8_t data[EDID_MAX_SEGM * 256];
+   /* Number of EDID read retries left */
+   unsigned read_retries;
+   bool complete;
+};
+
+struct adv7511_state {
+   struct adv7511_platform_data pdata;
+   struct v4l2_subdev sd;
+   struct media_pad pad;
+   struct v4l2_ctrl_handler hdl;
+   int chip_revision;
+   uint8_t i2c_edid_addr;
+   uint8_t i2c_cec_addr;
+   /* Is the adv7511 powered on? */
+   bool power_on;
+   /* Did we receive hotplug and rx-sense signals? */
+   bool have_monitor;
+   /* timings from s_dv_timings */
+   struct v4l2_dv_timings dv_timings;
+   /* 

[RFCv3 PATCH 0/5] adv7604/ad9389b fixes and new adv7511/adv7842 drivers

2013-08-22 Thread Hans Verkuil
This RFCv3 is an update for patches 18-20 of the RFCv2 series:

http://www.spinics.net/lists/linux-media/msg67128.html

All the earlier patches are unchanged.

The changes since RFCv2 are:

- ad9389b/adv7604: set is_private only after you are sure all controls were
  created correctly, otherwise the struct v4l2_ctrl might be NULL.
- adv7511/adv7842: set is_private to true as well (was missing in the
  RFCv2 for these drivers).

If there are no more comments, then I'll make a pull request for the whole
series tomorrow.

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: [RFCv2 PATCH 09/10] DocBook: document the new v4l2 matrix ioctls.

2013-08-22 Thread Laurent Pinchart
Hi Hans,

On Thursday 22 August 2013 08:56:00 Hans Verkuil wrote:
 On 08/21/2013 11:58 PM, Laurent Pinchart wrote:
  On Monday 12 August 2013 12:58:32 Hans Verkuil wrote:
  From: Hans Verkuil hans.verk...@cisco.com
  
  Signed-off-by: Hans Verkuil hans.verk...@cisco.com
  ---
  
   Documentation/DocBook/media/v4l/v4l2.xml   |   2 +
   .../DocBook/media/v4l/vidioc-g-matrix.xml  | 115 +
   .../DocBook/media/v4l/vidioc-query-matrix.xml  | 178 +++
   3 files changed, 295 insertions(+)
   create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-matrix.xml
   create mode 100644
   Documentation/DocBook/media/v4l/vidioc-query-matrix.xml
  
  [snip]
  
  diff --git a/Documentation/DocBook/media/v4l/vidioc-query-matrix.xml
  b/Documentation/DocBook/media/v4l/vidioc-query-matrix.xml new file mode
  100644
  index 000..c2845c7
  --- /dev/null
  +++ b/Documentation/DocBook/media/v4l/vidioc-query-matrix.xml

[snip]

  +table pgwide=1 frame=none id=v4l2-matrix-type
  +  titleMatrix Types/title
  +  tgroup cols=2 align=left
  +  colspec colwidth=30* /
  +  colspec colwidth=55* /
  +  thead
  +row
  +  entryType/entry
  +  entryDescription/entry
  +/row
  +  /thead
  +  tbody valign=top
  +row
  +  entryconstantV4L2_MATRIX_T_MD_REGION/constant/entry
  +  entryHardware motion detection often divides the image into
  several
  +  regions, and each region can have its own motion detection
  thresholds.
  +  This matrix assigns a region number to each element. Each element
  is
  a __u8.
  +  Generally each element refers to a block of pixels in the image.
  
  From the description I have trouble understanding what the matrix type is
  for. Do you think we could make the explanation more detailed ?
 
 How about this:
 
 Hardware motion detection divides the image up into cells. If the image
 resolution is WxH and the matrix size is COLSxROWS, then each cell is a
 rectangle of (W/COLS)x(H/ROWS) pixels (approximately as there may be some
 rounding involved). Depending on the hardware each cell can have its own
 properties. This matrix type sets the 'region' property which is a __u8.
 Each region will typically have its own set of motion detection parameters
 such as a threshold that determines the motion detection sensitivity. By
 assigning each cell a region you can create regions with lower and regions
 with higher motion sensitivity.

That sounds good to me. One more question, however: if the hardware divides 
the sub-sampled image into regions, how do you configure per-region thresholds 
? The V4L2_MATRIX_T_MD_THRESHOLD matrix only configures per-cell thresholds.

   + /entry
   +   /row
   +   row
   + entryconstantV4L2_MATRIX_T_MD_THRESHOLD/constant/entry
   + entryHardware motion detection can assign motion detection
   threshold +   values to each element of an image. Each element is 
   a
   __u16. +   Generally each element refers to a block of pixels in
   the image.
 This would be improved as well along the same lines:
 
 Hardware motion detection divides the image up into cells. If the image
 resolution is WxH and the matrix size is COLSxROWS, then each cell is a
 rectangle of (W/COLS)x(H/ROWS) pixels (approximately as there may be some
 rounding involved). Depending on the hardware each cell can have its own
 motion detection sensitivity threshold. This matrix type sets the motion
 detection threshold property which is a __u16.
   + /entry
   +   /row
   + /tbody
   +  /tgroup
   +/table
   +
   +  /refsect1
   +  refsect1
   +return-value;
   +  /refsect1
   +/refentry

-- 
Regards,

Laurent Pinchart

--
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: [RFCv2 PATCH 08/10] DocBook: document new v4l motion detection event.

2013-08-22 Thread Laurent Pinchart
Hi Hans,

On Thursday 22 August 2013 08:38:59 Hans Verkuil wrote:
 On 08/21/2013 11:41 PM, Laurent Pinchart wrote:
  On Monday 12 August 2013 12:58:31 Hans Verkuil wrote:
  From: Hans Verkuil hans.verk...@cisco.com
  
  Signed-off-by: Hans Verkuil hans.verk...@cisco.com
  ---
  
   Documentation/DocBook/media/v4l/vidioc-dqevent.xml | 40 
   .../DocBook/media/v4l/vidioc-subscribe-event.xml   |  9 +
   2 files changed, 49 insertions(+)

[snip]

  diff --git a/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml
  b/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml index
  5c70b61..d9c3e66 100644
  --- a/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml
  +++ b/Documentation/DocBook/media/v4l/vidioc-subscribe-event.xml
  @@ -155,6 +155,15 @@
  
 /entry
   
   /row
   row
  
  +  entryconstantV4L2_EVENT_MOTION_DET/constant/entry
  +  entry5/entry
  +  entry
  +paraTriggered whenever the motion detection state changes, 
i.e.
  +whether motion is detected or not.
  
  Isn't the event also triggered when region_mask changes from a non-zero
  value to a different non-zero value ? The second part of the sentence
  seems to imply that the even is only triggered when motion starts being
  detected or stops being detected.
 
 Good point. How about this:
 
 Triggered whenever the motion detection state for one or more of the
 regions changes.

That sounds good to me.

-- 
Regards,

Laurent Pinchart

--
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: [RFCv2 PATCH 09/10] DocBook: document the new v4l2 matrix ioctls.

2013-08-22 Thread Hans Verkuil
On Thu 22 August 2013 12:34:56 Laurent Pinchart wrote:
 Hi Hans,
 
 On Thursday 22 August 2013 08:56:00 Hans Verkuil wrote:
  On 08/21/2013 11:58 PM, Laurent Pinchart wrote:
   On Monday 12 August 2013 12:58:32 Hans Verkuil wrote:
   From: Hans Verkuil hans.verk...@cisco.com
   
   Signed-off-by: Hans Verkuil hans.verk...@cisco.com
   ---
   
Documentation/DocBook/media/v4l/v4l2.xml   |   2 +
.../DocBook/media/v4l/vidioc-g-matrix.xml  | 115 +
.../DocBook/media/v4l/vidioc-query-matrix.xml  | 178 +++
3 files changed, 295 insertions(+)
create mode 100644 Documentation/DocBook/media/v4l/vidioc-g-matrix.xml
create mode 100644
Documentation/DocBook/media/v4l/vidioc-query-matrix.xml
   
   [snip]
   
   diff --git a/Documentation/DocBook/media/v4l/vidioc-query-matrix.xml
   b/Documentation/DocBook/media/v4l/vidioc-query-matrix.xml new file mode
   100644
   index 000..c2845c7
   --- /dev/null
   +++ b/Documentation/DocBook/media/v4l/vidioc-query-matrix.xml
 
 [snip]
 
   +table pgwide=1 frame=none id=v4l2-matrix-type
   +  titleMatrix Types/title
   +  tgroup cols=2 align=left
   +colspec colwidth=30* /
   +colspec colwidth=55* /
   +thead
   +  row
   +entryType/entry
   +entryDescription/entry
   +  /row
   +/thead
   +tbody valign=top
   +  row
   +entryconstantV4L2_MATRIX_T_MD_REGION/constant/entry
   +entryHardware motion detection often divides the image 
   into
   several
   +regions, and each region can have its own motion detection
   thresholds.
   +This matrix assigns a region number to each element. Each 
   element
   is
   a __u8.
   +Generally each element refers to a block of pixels in the 
   image.
   
   From the description I have trouble understanding what the matrix type is
   for. Do you think we could make the explanation more detailed ?
  
  How about this:
  
  Hardware motion detection divides the image up into cells. If the image
  resolution is WxH and the matrix size is COLSxROWS, then each cell is a
  rectangle of (W/COLS)x(H/ROWS) pixels (approximately as there may be some
  rounding involved). Depending on the hardware each cell can have its own
  properties. This matrix type sets the 'region' property which is a __u8.
  Each region will typically have its own set of motion detection parameters
  such as a threshold that determines the motion detection sensitivity. By
  assigning each cell a region you can create regions with lower and regions
  with higher motion sensitivity.
 
 That sounds good to me. One more question, however: if the hardware divides 
 the sub-sampled image into regions, how do you configure per-region 
 thresholds 
 ? The V4L2_MATRIX_T_MD_THRESHOLD matrix only configures per-cell thresholds.

That's hardware dependent. The go7007 has four different threshold parameters
per region, so that's a total of 16 controls for all four regions.

If we get more drivers doing motion detection in the future, then some of those
parameters might become standardized, but at the moment I have only one driver
and I don't want to standardize that as long as I don't know if it can be
standardized in the first place.

Regards,

Hans

 
+   /entry
+ /row
+ row
+   
entryconstantV4L2_MATRIX_T_MD_THRESHOLD/constant/entry
+   entryHardware motion detection can assign motion detection
threshold + values to each element of an image. Each element is 
a
__u16. +   Generally each element refers to a block of pixels in
the image.
  This would be improved as well along the same lines:
  
  Hardware motion detection divides the image up into cells. If the image
  resolution is WxH and the matrix size is COLSxROWS, then each cell is a
  rectangle of (W/COLS)x(H/ROWS) pixels (approximately as there may be some
  rounding involved). Depending on the hardware each cell can have its own
  motion detection sensitivity threshold. This matrix type sets the motion
  detection threshold property which is a __u16.
+   /entry
+ /row
+   /tbody
+  /tgroup
+/table
+
+  /refsect1
+  refsect1
+return-value;
+  /refsect1
+/refentry
 
 
--
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: [RFCv3 PATCH 02/10] v4l2: add matrix support.

2013-08-22 Thread Sakari Ailus
Hi Hans,

On Thu, Aug 22, 2013 at 12:14:16PM +0200, Hans Verkuil wrote:
 From: Hans Verkuil hans.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 Verkuil hans.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   | 58 
 
  4 files changed, 91 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/media/v4l2-core/v4l2-dev.c 
 b/drivers/media/v4l2-core/v4l2-dev.c
 index c8859d6..5e58df6 100644
 --- a/drivers/media/v4l2-core/v4l2-dev.c
 +++ b/drivers/media/v4l2-core/v4l2-dev.c
 @@ -598,6 +598,9 @@ static void determine_valid_ioctls(struct video_device 
 *vdev)
   SET_VALID_IOCTL(ops, VIDIOC_UNSUBSCRIBE_EVENT, 
 vidioc_unsubscribe_event);
   if (ops-vidioc_enum_freq_bands || ops-vidioc_g_tuner || 
 ops-vidioc_g_modulator)
   set_bit(_IOC_NR(VIDIOC_ENUM_FREQ_BANDS), valid_ioctls);
 + SET_VALID_IOCTL(ops, VIDIOC_QUERY_MATRIX, vidioc_query_matrix);
 + SET_VALID_IOCTL(ops, VIDIOC_G_MATRIX, vidioc_g_matrix);
 + SET_VALID_IOCTL(ops, VIDIOC_S_MATRIX, vidioc_s_matrix);
  
   if (is_vid) {
   /* video specific ioctls */
 diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c 
 b/drivers/media/v4l2-core/v4l2-ioctl.c
 index 68e6b5e..cdd5c77 100644
 --- a/drivers/media/v4l2-core/v4l2-ioctl.c
 +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
 @@ -549,7 +549,7 @@ static void v4l_print_cropcap(const void *arg, bool 
 write_only)
   const struct v4l2_cropcap *p = arg;
  
   pr_cont(type=%s, bounds wxh=%dx%d, x,y=%d,%d, 
 - defrect wxh=%dx%d, x,y=%d,%d\n, 
 + defrect wxh=%dx%d, x,y=%d,%d, 
   pixelaspect %d/%d\n,
   prt_names(p-type, v4l2_type_names),
   p-bounds.width, p-bounds.height,
 @@ -831,6 +831,24 @@ static void v4l_print_freq_band(const void *arg, bool 
 write_only)
   p-rangehigh, p-modulation);
  }
  
 +static void v4l_print_query_matrix(const void *arg, bool write_only)
 +{
 + const struct v4l2_query_matrix *p = arg;
 +
 + pr_cont(type=0x%x, columns=%u, rows=%u, elem_min=%lld, elem_max=%lld, 
 elem_size=%u\n,
 + p-type, p-columns, p-rows,
 + p-elem_min.val, p-elem_max.val, p-elem_size);
 +}
 +
 +static void v4l_print_matrix(const void *arg, bool write_only)
 +{
 + const struct v4l2_matrix *p = arg;
 +
 + pr_cont(type=0x%x, wxh=%dx%d, x,y=%d,%d, matrix=%p\n,
 + p-type, p-rect.width, p-rect.height,
 + p-rect.top, p-rect.left, p-matrix);
 +}
 +
  static void v4l_print_u32(const void *arg, bool write_only)
  {
   pr_cont(value=%u\n, *(const u32 *)arg);
 @@ -2055,6 +2073,9 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = {
   IOCTL_INFO_STD(VIDIOC_DV_TIMINGS_CAP, vidioc_dv_timings_cap, 
 v4l_print_dv_timings_cap, INFO_FL_CLEAR(v4l2_dv_timings_cap, type)),
   IOCTL_INFO_FNC(VIDIOC_ENUM_FREQ_BANDS, v4l_enum_freq_bands, 
 v4l_print_freq_band, 0),
   IOCTL_INFO_FNC(VIDIOC_DBG_G_CHIP_INFO, v4l_dbg_g_chip_info, 
 v4l_print_dbg_chip_info, INFO_FL_CLEAR(v4l2_dbg_chip_info, match)),
 + IOCTL_INFO_STD(VIDIOC_QUERY_MATRIX, vidioc_query_matrix, 
 v4l_print_query_matrix, INFO_FL_CLEAR(v4l2_query_matrix, type)),
 + IOCTL_INFO_STD(VIDIOC_G_MATRIX, vidioc_g_matrix, v4l_print_matrix, 
 INFO_FL_CLEAR(v4l2_matrix, matrix)),
 + IOCTL_INFO_STD(VIDIOC_S_MATRIX, vidioc_s_matrix, v4l_print_matrix, 
 INFO_FL_PRIO | INFO_FL_CLEAR(v4l2_matrix, matrix)),
  };
  #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
  
 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..cf13339 100644
 --- a/include/uapi/linux/videodev2.h
 +++ b/include/uapi/linux/videodev2.h
 @@ 

Re: [RFCv3 PATCH 02/10] v4l2: add matrix support.

2013-08-22 Thread Hans Verkuil
On Thu 22 August 2013 12:49:24 Sakari Ailus wrote:
 Hi Hans,
 
 On Thu, Aug 22, 2013 at 12:14:16PM +0200, Hans Verkuil wrote:
  From: Hans Verkuil hans.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 Verkuil hans.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   | 58 
  
   4 files changed, 91 insertions(+), 1 deletion(-)
  
  diff --git a/drivers/media/v4l2-core/v4l2-dev.c 
  b/drivers/media/v4l2-core/v4l2-dev.c
  index c8859d6..5e58df6 100644
  --- a/drivers/media/v4l2-core/v4l2-dev.c
  +++ b/drivers/media/v4l2-core/v4l2-dev.c
  @@ -598,6 +598,9 @@ static void determine_valid_ioctls(struct video_device 
  *vdev)
  SET_VALID_IOCTL(ops, VIDIOC_UNSUBSCRIBE_EVENT, 
  vidioc_unsubscribe_event);
  if (ops-vidioc_enum_freq_bands || ops-vidioc_g_tuner || 
  ops-vidioc_g_modulator)
  set_bit(_IOC_NR(VIDIOC_ENUM_FREQ_BANDS), valid_ioctls);
  +   SET_VALID_IOCTL(ops, VIDIOC_QUERY_MATRIX, vidioc_query_matrix);
  +   SET_VALID_IOCTL(ops, VIDIOC_G_MATRIX, vidioc_g_matrix);
  +   SET_VALID_IOCTL(ops, VIDIOC_S_MATRIX, vidioc_s_matrix);
   
  if (is_vid) {
  /* video specific ioctls */
  diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c 
  b/drivers/media/v4l2-core/v4l2-ioctl.c
  index 68e6b5e..cdd5c77 100644
  --- a/drivers/media/v4l2-core/v4l2-ioctl.c
  +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
  @@ -549,7 +549,7 @@ static void v4l_print_cropcap(const void *arg, bool 
  write_only)
  const struct v4l2_cropcap *p = arg;
   
  pr_cont(type=%s, bounds wxh=%dx%d, x,y=%d,%d, 
  -   defrect wxh=%dx%d, x,y=%d,%d\n, 
  +   defrect wxh=%dx%d, x,y=%d,%d, 
  pixelaspect %d/%d\n,
  prt_names(p-type, v4l2_type_names),
  p-bounds.width, p-bounds.height,
  @@ -831,6 +831,24 @@ static void v4l_print_freq_band(const void *arg, bool 
  write_only)
  p-rangehigh, p-modulation);
   }
   
  +static void v4l_print_query_matrix(const void *arg, bool write_only)
  +{
  +   const struct v4l2_query_matrix *p = arg;
  +
  +   pr_cont(type=0x%x, columns=%u, rows=%u, elem_min=%lld, elem_max=%lld, 
  elem_size=%u\n,
  +   p-type, p-columns, p-rows,
  +   p-elem_min.val, p-elem_max.val, p-elem_size);
  +}
  +
  +static void v4l_print_matrix(const void *arg, bool write_only)
  +{
  +   const struct v4l2_matrix *p = arg;
  +
  +   pr_cont(type=0x%x, wxh=%dx%d, x,y=%d,%d, matrix=%p\n,
  +   p-type, p-rect.width, p-rect.height,
  +   p-rect.top, p-rect.left, p-matrix);
  +}
  +
   static void v4l_print_u32(const void *arg, bool write_only)
   {
  pr_cont(value=%u\n, *(const u32 *)arg);
  @@ -2055,6 +2073,9 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = {
  IOCTL_INFO_STD(VIDIOC_DV_TIMINGS_CAP, vidioc_dv_timings_cap, 
  v4l_print_dv_timings_cap, INFO_FL_CLEAR(v4l2_dv_timings_cap, type)),
  IOCTL_INFO_FNC(VIDIOC_ENUM_FREQ_BANDS, v4l_enum_freq_bands, 
  v4l_print_freq_band, 0),
  IOCTL_INFO_FNC(VIDIOC_DBG_G_CHIP_INFO, v4l_dbg_g_chip_info, 
  v4l_print_dbg_chip_info, INFO_FL_CLEAR(v4l2_dbg_chip_info, match)),
  +   IOCTL_INFO_STD(VIDIOC_QUERY_MATRIX, vidioc_query_matrix, 
  v4l_print_query_matrix, INFO_FL_CLEAR(v4l2_query_matrix, type)),
  +   IOCTL_INFO_STD(VIDIOC_G_MATRIX, vidioc_g_matrix, v4l_print_matrix, 
  INFO_FL_CLEAR(v4l2_matrix, matrix)),
  +   IOCTL_INFO_STD(VIDIOC_S_MATRIX, vidioc_s_matrix, v4l_print_matrix, 
  INFO_FL_PRIO | INFO_FL_CLEAR(v4l2_matrix, matrix)),
   };
   #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
   
  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..cf13339 100644

Re: [PATCH RFC v4] media: added managed v4l2/i2c subdevice initialization

2013-08-22 Thread Hans Verkuil
This patch has been sitting around for quite some time now. Is there any reason
not to apply it?

Laurent, I see that these patches (part of the same patch set) are still pending
for you:

https://patchwork.linuxtv.org/patch/18447/
https://patchwork.linuxtv.org/patch/18449/

If you plan to apply those for 3.12, then it would make sense to apply this one
at the same time.

For this patch:

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

Regards,

Hans

On Wed 19 June 2013 16:10:54 Andrzej Hajda wrote:
 This patch adds managed version of initialization
 function for v4l2 i2c subdevices.
 
 Signed-off-by: Andrzej Hajda a.ha...@samsung.com
 Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
 v4:
   - added description to devm_v4l2_subdev_bind
 v3:
   - removed devm_v4l2_subdev_(init|free),
 v2:
   - changes of v4l2-ctrls.h moved to proper patch
 ---
  drivers/media/v4l2-core/v4l2-common.c | 10 ++
  drivers/media/v4l2-core/v4l2-subdev.c | 35 
 +++
  include/media/v4l2-common.h   |  2 ++
  include/media/v4l2-subdev.h   |  2 ++
  4 files changed, 49 insertions(+)
 
 diff --git a/drivers/media/v4l2-core/v4l2-common.c 
 b/drivers/media/v4l2-core/v4l2-common.c
 index 3fed63f..96aac931 100644
 --- a/drivers/media/v4l2-core/v4l2-common.c
 +++ b/drivers/media/v4l2-core/v4l2-common.c
 @@ -301,7 +301,17 @@ void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct 
 i2c_client *client,
  }
  EXPORT_SYMBOL_GPL(v4l2_i2c_subdev_init);
  
 +int devm_v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client 
 *client,
 +   const struct v4l2_subdev_ops *ops)
 +{
 + int ret;
  
 + ret = devm_v4l2_subdev_bind(client-dev, sd);
 + if (!ret)
 + v4l2_i2c_subdev_init(sd, client, ops);
 + return ret;
 +}
 +EXPORT_SYMBOL_GPL(devm_v4l2_i2c_subdev_init);
  
  /* Load an i2c sub-device. */
  struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev,
 diff --git a/drivers/media/v4l2-core/v4l2-subdev.c 
 b/drivers/media/v4l2-core/v4l2-subdev.c
 index 996c248..2242962 100644
 --- a/drivers/media/v4l2-core/v4l2-subdev.c
 +++ b/drivers/media/v4l2-core/v4l2-subdev.c
 @@ -474,3 +474,38 @@ void v4l2_subdev_init(struct v4l2_subdev *sd, const 
 struct v4l2_subdev_ops *ops)
  #endif
  }
  EXPORT_SYMBOL(v4l2_subdev_init);
 +
 +static void devm_v4l2_subdev_release(struct device *dev, void *res)
 +{
 + struct v4l2_subdev **sd = res;
 +
 + v4l2_device_unregister_subdev(*sd);
 +#if defined(CONFIG_MEDIA_CONTROLLER)
 + media_entity_cleanup((*sd)-entity);
 +#endif
 +}
 +
 +/**
 + * devm_v4l2_subdev_bind - Add subdevice to device managed resource list
 + * @dev: Device to bind subdev to
 + * @sd:  Subdevice to bind
 + *
 + * Function adds device managed release code to the subdev.
 + * If the function succeedes then on driver detach subdev will be 
 automatically
 + * unregistered and the media entity will be cleaned up. Function can be used
 + * with subdevs not initialized by devm_v4l2_i2c_subdev_init.
 + */
 +int devm_v4l2_subdev_bind(struct device *dev, struct v4l2_subdev *sd)
 +{
 + struct v4l2_subdev **dr;
 +
 + dr = devres_alloc(devm_v4l2_subdev_release, sizeof(*dr), GFP_KERNEL);
 + if (!dr)
 + return -ENOMEM;
 +
 + *dr = sd;
 + devres_add(dev, dr);
 +
 + return 0;
 +}
 +EXPORT_SYMBOL(devm_v4l2_subdev_bind);
 diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
 index 1d93c48..da62e2b 100644
 --- a/include/media/v4l2-common.h
 +++ b/include/media/v4l2-common.h
 @@ -136,6 +136,8 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct 
 v4l2_device *v4l2_dev,
  /* Initialize a v4l2_subdev with data from an i2c_client struct */
  void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client,
   const struct v4l2_subdev_ops *ops);
 +int devm_v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client 
 *client,
 + const struct v4l2_subdev_ops *ops);
  /* Return i2c client address of v4l2_subdev. */
  unsigned short v4l2_i2c_subdev_addr(struct v4l2_subdev *sd);
  
 diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
 index 5298d67..e086cfe 100644
 --- a/include/media/v4l2-subdev.h
 +++ b/include/media/v4l2-subdev.h
 @@ -657,6 +657,8 @@ int v4l2_subdev_link_validate(struct media_link *link);
  void v4l2_subdev_init(struct v4l2_subdev *sd,
 const struct v4l2_subdev_ops *ops);
  
 +int devm_v4l2_subdev_bind(struct device *dev, struct v4l2_subdev *sd);
 +
  /* Call an ops of a v4l2_subdev, doing the right checks against
 NULL pointers.
  
 
--
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: [RFCv3 PATCH 03/10] v4l2-compat-ioctl32: add g/s_matrix support.

2013-08-22 Thread Sakari Ailus

Hi Hans,

On Thu, Aug 22, 2013 at 12:14:17PM +0200, Hans Verkuil wrote:

From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 49 +++
 1 file changed, 49 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c 
b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
index 8f7a6a4..3e5a30f 100644
--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
+++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
@@ -777,6 +777,38 @@ static int put_v4l2_subdev_edid32(struct v4l2_subdev_edid 
*kp, struct v4l2_subde
return 0;
 }

+struct v4l2_matrix32 {
+   __u32 type;
+   union {
+   __u32 raw[4];
+   } ref;


I sense untested code here.


+   struct v4l2_rect rect;
+   compat_caddr_t matrix;
+   __u32 reserved[12];
+} __attribute__ ((packed));
+
+static int get_v4l2_matrix32(struct v4l2_matrix *kp, struct v4l2_matrix32 
__user *up)
+{
+   u32 tmp;
+
+   if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_matrix32)) ||
+   get_user(kp-type, up-type) ||
+   copy_from_user(kp-rect, up-rect, sizeof(up-rect)) ||
+   get_user(tmp, up-matrix) ||
+   copy_from_user(kp-reserved, up-reserved, sizeof(kp-reserved)))


Is it useful to copy the reserved fields?


+   return -EFAULT;
+   kp-matrix = compat_ptr(tmp);
+   return 0;
+}


--
Kind regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
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 RFC v4] media: added managed v4l2/i2c subdevice initialization

2013-08-22 Thread Sylwester Nawrocki
On 08/22/2013 01:10 PM, Hans Verkuil wrote:
 This patch has been sitting around for quite some time now. Is there any 
 reason
 not to apply it?

We wanted to merge those patches together with some users of them.
We have already prepared relevant patches but those depend on other
ones (conversion to v4l2-async/DT, some pending review) and I didn't
find enough time to post everything. I won't find time to take care
of this for 3.12, sorry. I guess it could be postponed to 3.13.

--
Regards,
Sylwester
 







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


Re: How to express planar formats with mediabus format code?

2013-08-22 Thread Laurent Pinchart
Hi Jiaquan,

On Wednesday 21 August 2013 18:14:50 Su Jiaquan wrote:
 On Tue, Aug 20, 2013 at 8:53 PM, Laurent Pinchart wrote:
  Hi Jiaquan,
  
  I'm not sure if that's needed here. Vendor-specific formats still need to
  be documented, so we could just create a custom YUV format for your case.
  Let's start with the beginning, could you describe what gets transmitted
  on the bus when that special format is selected ?
 
 For YUV420P format, the data format sent from IPC is similar to
 V4L2_MBUS_FMT_YUYV8_1_5X8, but the content for each line is different:
 For odd line, it's YYU YYU YYU... For even line, it's YYV YYV YYV...
 then DMA engine send them to RAM in planar format.
 
 For YUV420SP format, the data format sent from IPC is YYUV YYUV
 YYUV(maybe called V4L2_MBUS_FMT_YYUV8_2X8?), but DMA engine drop UV
 every other line, then send them to RAM as semi-planar.

V4L2_MBUS_FMT_YYUV8_2X8 looks good to me.

 Well, the first data format is too odd, I don't have a clue how to
 call it, do you have suggestion?

Maybe V4L2_MBUS_FMT_YU8_YV8_1_5X8 ? I've CC'ed Sakari Ailus, he's often pretty 
creative for these issues.

-- 
Regards,

Laurent Pinchart

--
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 v1 37/49] media: usb: cx231xx: prepare for enabling irq in complete()

2013-08-22 Thread Hans Verkuil
On Sat 17 August 2013 18:25:02 Ming Lei wrote:
 Complete() will be run with interrupt enabled, so change to
 spin_lock_irqsave().
 
 Cc: Mauro Carvalho Chehab mche...@redhat.com
 Cc: Hans Verkuil hans.verk...@cisco.com
 Cc: linux-media@vger.kernel.org
 Signed-off-by: Ming Lei ming@canonical.com

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

Regards,

Hans

 ---
  drivers/media/usb/cx231xx/cx231xx-audio.c |   10 ++
  drivers/media/usb/cx231xx/cx231xx-core.c  |   10 ++
  drivers/media/usb/cx231xx/cx231xx-vbi.c   |5 +++--
  3 files changed, 15 insertions(+), 10 deletions(-)
 
 diff --git a/drivers/media/usb/cx231xx/cx231xx-audio.c 
 b/drivers/media/usb/cx231xx/cx231xx-audio.c
 index 81a1d97..f6fa0af 100644
 --- a/drivers/media/usb/cx231xx/cx231xx-audio.c
 +++ b/drivers/media/usb/cx231xx/cx231xx-audio.c
 @@ -136,6 +136,7 @@ static void cx231xx_audio_isocirq(struct urb *urb)
   stride = runtime-frame_bits  3;
  
   for (i = 0; i  urb-number_of_packets; i++) {
 + unsigned long flags;
   int length = urb-iso_frame_desc[i].actual_length /
stride;
   cp = (unsigned char *)urb-transfer_buffer +
 @@ -158,7 +159,7 @@ static void cx231xx_audio_isocirq(struct urb *urb)
  length * stride);
   }
  
 - snd_pcm_stream_lock(substream);
 + snd_pcm_stream_lock_irqsave(substream, flags);
  
   dev-adev.hwptr_done_capture += length;
   if (dev-adev.hwptr_done_capture =
 @@ -173,7 +174,7 @@ static void cx231xx_audio_isocirq(struct urb *urb)
   runtime-period_size;
   period_elapsed = 1;
   }
 - snd_pcm_stream_unlock(substream);
 + snd_pcm_stream_unlock_irqrestore(substream, flags);
   }
   if (period_elapsed)
   snd_pcm_period_elapsed(substream);
 @@ -224,6 +225,7 @@ static void cx231xx_audio_bulkirq(struct urb *urb)
   stride = runtime-frame_bits  3;
  
   if (1) {
 + unsigned long flags;
   int length = urb-actual_length /
stride;
   cp = (unsigned char *)urb-transfer_buffer;
 @@ -242,7 +244,7 @@ static void cx231xx_audio_bulkirq(struct urb *urb)
  length * stride);
   }
  
 - snd_pcm_stream_lock(substream);
 + snd_pcm_stream_lock_irqsave(substream, flags);
  
   dev-adev.hwptr_done_capture += length;
   if (dev-adev.hwptr_done_capture =
 @@ -257,7 +259,7 @@ static void cx231xx_audio_bulkirq(struct urb *urb)
   runtime-period_size;
   period_elapsed = 1;
   }
 - snd_pcm_stream_unlock(substream);
 + snd_pcm_stream_unlock_irqrestore(substream,flags);
   }
   if (period_elapsed)
   snd_pcm_period_elapsed(substream);
 diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c 
 b/drivers/media/usb/cx231xx/cx231xx-core.c
 index 4ba3ce0..593b397 100644
 --- a/drivers/media/usb/cx231xx/cx231xx-core.c
 +++ b/drivers/media/usb/cx231xx/cx231xx-core.c
 @@ -798,6 +798,7 @@ static void cx231xx_isoc_irq_callback(struct urb *urb)
   container_of(dma_q, struct cx231xx_video_mode, vidq);
   struct cx231xx *dev = container_of(vmode, struct cx231xx, video_mode);
   int i;
 + unsigned long flags;
  
   switch (urb-status) {
   case 0: /* success */
 @@ -813,9 +814,9 @@ static void cx231xx_isoc_irq_callback(struct urb *urb)
   }
  
   /* Copy data from URB */
 - spin_lock(dev-video_mode.slock);
 + spin_lock_irqsave(dev-video_mode.slock, flags);
   dev-video_mode.isoc_ctl.isoc_copy(dev, urb);
 - spin_unlock(dev-video_mode.slock);
 + spin_unlock_irqrestore(dev-video_mode.slock, flags);
  
   /* Reset urb buffers */
   for (i = 0; i  urb-number_of_packets; i++) {
 @@ -842,6 +843,7 @@ static void cx231xx_bulk_irq_callback(struct urb *urb)
   struct cx231xx_video_mode *vmode =
   container_of(dma_q, struct cx231xx_video_mode, vidq);
   struct cx231xx *dev = container_of(vmode, struct cx231xx, video_mode);
 + unsigned long flags;
  
   switch (urb-status) {
   case 0: /* success */
 @@ -857,9 +859,9 @@ static void cx231xx_bulk_irq_callback(struct urb *urb)
   }
  
   /* Copy data from URB */
 - spin_lock(dev-video_mode.slock);
 + spin_lock_irqsave(dev-video_mode.slock, flags);
   dev-video_mode.bulk_ctl.bulk_copy(dev, urb);
 - 

Re: [PATCH v1 41/49] media: usb: tm6000: prepare for enabling irq in complete()

2013-08-22 Thread Hans Verkuil
On Sat 17 August 2013 18:25:06 Ming Lei wrote:
 Complete() will be run with interrupt enabled, so change to
 spin_lock_irqsave().
 
 Cc: Mauro Carvalho Chehab mche...@redhat.com
 Cc: linux-media@vger.kernel.org
 Signed-off-by: Ming Lei ming@canonical.com

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

Regards,

Hans

 ---
  drivers/media/usb/tm6000/tm6000-video.c |5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/media/usb/tm6000/tm6000-video.c 
 b/drivers/media/usb/tm6000/tm6000-video.c
 index cc1aa14..8bb440f 100644
 --- a/drivers/media/usb/tm6000/tm6000-video.c
 +++ b/drivers/media/usb/tm6000/tm6000-video.c
 @@ -434,6 +434,7 @@ static void tm6000_irq_callback(struct urb *urb)
   struct tm6000_dmaqueue  *dma_q = urb-context;
   struct tm6000_core *dev = container_of(dma_q, struct tm6000_core, vidq);
   int i;
 + unsigned long flags;
  
   switch (urb-status) {
   case 0:
 @@ -450,9 +451,9 @@ static void tm6000_irq_callback(struct urb *urb)
   break;
   }
  
 - spin_lock(dev-slock);
 + spin_lock_irqsave(dev-slock, flags);
   tm6000_isoc_copy(urb);
 - spin_unlock(dev-slock);
 + spin_unlock_irqrestore(dev-slock, flags);
  
   /* Reset urb buffers */
   for (i = 0; i  urb-number_of_packets; i++) {
 
--
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 v1 43/49] media: usb: em28xx: prepare for enabling irq in complete()

2013-08-22 Thread Hans Verkuil
On Sat 17 August 2013 18:25:08 Ming Lei wrote:
 Complete() will be run with interrupt enabled, so add local_irq_save()
 before acquiring the lock without irqsave().
 
 Cc: Mauro Carvalho Chehab mche...@redhat.com
 Cc: linux-media@vger.kernel.org
 Signed-off-by: Ming Lei ming@canonical.com

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

Regards,

Hans

 ---
  drivers/media/usb/em28xx/em28xx-audio.c |5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/media/usb/em28xx/em28xx-audio.c 
 b/drivers/media/usb/em28xx/em28xx-audio.c
 index 2fdb66e..7fd1b2a 100644
 --- a/drivers/media/usb/em28xx/em28xx-audio.c
 +++ b/drivers/media/usb/em28xx/em28xx-audio.c
 @@ -113,6 +113,7 @@ static void em28xx_audio_isocirq(struct urb *urb)
   stride = runtime-frame_bits  3;
  
   for (i = 0; i  urb-number_of_packets; i++) {
 + unsigned long flags;
   int length =
   urb-iso_frame_desc[i].actual_length / stride;
   cp = (unsigned char *)urb-transfer_buffer +
 @@ -134,7 +135,7 @@ static void em28xx_audio_isocirq(struct urb *urb)
  length * stride);
   }
  
 - snd_pcm_stream_lock(substream);
 + snd_pcm_stream_lock_irqsave(substream, flags);
  
   dev-adev.hwptr_done_capture += length;
   if (dev-adev.hwptr_done_capture =
 @@ -150,7 +151,7 @@ static void em28xx_audio_isocirq(struct urb *urb)
   period_elapsed = 1;
   }
  
 - snd_pcm_stream_unlock(substream);
 + snd_pcm_stream_unlock_irqrestore(substream, flags);
   }
   if (period_elapsed)
   snd_pcm_period_elapsed(substream);
 
--
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 v1 39/49] media: usb: sn9x102: prepare for enabling irq in complete()

2013-08-22 Thread Hans Verkuil
On Sat 17 August 2013 18:25:04 Ming Lei wrote:
 Complete() will be run with interrupt enabled, so change to
 spin_lock_irqsave().
 
 Cc: Mauro Carvalho Chehab mche...@redhat.com
 Cc: linux-media@vger.kernel.org
 Signed-off-by: Ming Lei ming@canonical.com

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

Regards,

Hans

 ---
  drivers/media/usb/sn9c102/sn9c102_core.c |7 +--
  1 file changed, 5 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/media/usb/sn9c102/sn9c102_core.c 
 b/drivers/media/usb/sn9c102/sn9c102_core.c
 index 2cb44de..33dc595 100644
 --- a/drivers/media/usb/sn9c102/sn9c102_core.c
 +++ b/drivers/media/usb/sn9c102/sn9c102_core.c
 @@ -784,12 +784,14 @@ end_of_frame:
 cam-sensor.pix_format.pixelformat ==
 V4L2_PIX_FMT_JPEG)  eof)) {
   u32 b;
 + unsigned long flags;
  
   b = (*f)-buf.bytesused;
   (*f)-state = F_DONE;
   (*f)-buf.sequence= ++cam-frame_count;
  
 - spin_lock(cam-queue_lock);
 + spin_lock_irqsave(cam-queue_lock,
 +   flags);
   list_move_tail((*f)-frame,
  cam-outqueue);
   if (!list_empty(cam-inqueue))
 @@ -799,7 +801,8 @@ end_of_frame:
   frame );
   else
   (*f) = NULL;
 - spin_unlock(cam-queue_lock);
 + spin_unlock_irqrestore(cam-queue_lock,
 +flags);
  
   memcpy(cam-sysfs.frame_header,
  cam-sof.header, soflen);
 
--
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 v1 40/49] media: usb: tlg2300: prepare for enabling irq in complete()

2013-08-22 Thread Hans Verkuil
On Sat 17 August 2013 18:25:05 Ming Lei wrote:
 Complete() will be run with interrupt enabled, so change to
 spin_lock_irqsave().
 
 Cc: Mauro Carvalho Chehab mche...@redhat.com
 Cc: linux-media@vger.kernel.org
 Signed-off-by: Ming Lei ming@canonical.com

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

Regards,

Hans

 ---
  drivers/media/usb/tlg2300/pd-alsa.c  |5 +++--
  drivers/media/usb/tlg2300/pd-video.c |5 +++--
  2 files changed, 6 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/media/usb/tlg2300/pd-alsa.c 
 b/drivers/media/usb/tlg2300/pd-alsa.c
 index 3f3e141..65c46a2 100644
 --- a/drivers/media/usb/tlg2300/pd-alsa.c
 +++ b/drivers/media/usb/tlg2300/pd-alsa.c
 @@ -141,6 +141,7 @@ static inline void handle_audio_data(struct urb *urb, int 
 *period_elapsed)
   int len = urb-actual_length / stride;
   unsigned char *cp   = urb-transfer_buffer;
   unsigned int oldptr = pa-rcv_position;
 + unsigned long flags;
  
   if (urb-actual_length == AUDIO_BUF_SIZE - 4)
   len -= (AUDIO_TRAILER_SIZE / stride);
 @@ -156,7 +157,7 @@ static inline void handle_audio_data(struct urb *urb, int 
 *period_elapsed)
   memcpy(runtime-dma_area + oldptr * stride, cp, len * stride);
  
   /* update the statas */
 - snd_pcm_stream_lock(pa-capture_pcm_substream);
 + snd_pcm_stream_lock_irqsave(pa-capture_pcm_substream, flags);
   pa-rcv_position+= len;
   if (pa-rcv_position = runtime-buffer_size)
   pa-rcv_position -= runtime-buffer_size;
 @@ -166,7 +167,7 @@ static inline void handle_audio_data(struct urb *urb, int 
 *period_elapsed)
   pa-copied_position -= runtime-period_size;
   *period_elapsed = 1;
   }
 - snd_pcm_stream_unlock(pa-capture_pcm_substream);
 + snd_pcm_stream_unlock_irqrestore(pa-capture_pcm_substream, flags);
  }
  
  static void complete_handler_audio(struct urb *urb)
 diff --git a/drivers/media/usb/tlg2300/pd-video.c 
 b/drivers/media/usb/tlg2300/pd-video.c
 index 8df668d..4e5bd07 100644
 --- a/drivers/media/usb/tlg2300/pd-video.c
 +++ b/drivers/media/usb/tlg2300/pd-video.c
 @@ -151,11 +151,12 @@ static void init_copy(struct video_data *video, bool 
 index)
  static bool get_frame(struct front_face *front, int *need_init)
  {
   struct videobuf_buffer *vb = front-curr_frame;
 + unsigned long flags;
  
   if (vb)
   return true;
  
 - spin_lock(front-queue_lock);
 + spin_lock_irqsave(front-queue_lock, flags);
   if (!list_empty(front-active)) {
   vb = list_entry(front-active.next,
  struct videobuf_buffer, queue);
 @@ -164,7 +165,7 @@ static bool get_frame(struct front_face *front, int 
 *need_init)
   front-curr_frame = vb;
   list_del_init(vb-queue);
   }
 - spin_unlock(front-queue_lock);
 + spin_unlock_irqrestore(front-queue_lock, flags);
  
   return !!vb;
  }
 
--
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 v1 38/49] media: usb: em28xx: prepare for enabling irq in complete()

2013-08-22 Thread Hans Verkuil
On Sat 17 August 2013 18:25:03 Ming Lei wrote:
 Complete() will be run with interrupt enabled, so change to
 spin_lock_irqsave().
 
 Cc: Mauro Carvalho Chehab mche...@redhat.com
 Cc: linux-media@vger.kernel.org
 Reviewed-by: Devin Heitmueller dheitmuel...@kernellabs.com
 Tested-by: Devin Heitmueller dheitmuel...@kernellabs.com
 Signed-off-by: Ming Lei ming@canonical.com

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

Regards,

Hans

 ---
  drivers/media/usb/em28xx/em28xx-core.c |5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/media/usb/em28xx/em28xx-core.c 
 b/drivers/media/usb/em28xx/em28xx-core.c
 index fc157af..0d698f9 100644
 --- a/drivers/media/usb/em28xx/em28xx-core.c
 +++ b/drivers/media/usb/em28xx/em28xx-core.c
 @@ -941,6 +941,7 @@ static void em28xx_irq_callback(struct urb *urb)
  {
   struct em28xx *dev = urb-context;
   int i;
 + unsigned long flags;
  
   switch (urb-status) {
   case 0: /* success */
 @@ -956,9 +957,9 @@ static void em28xx_irq_callback(struct urb *urb)
   }
  
   /* Copy data from URB */
 - spin_lock(dev-slock);
 + spin_lock_irqsave(dev-slock, flags);
   dev-usb_ctl.urb_data_copy(dev, urb);
 - spin_unlock(dev-slock);
 + spin_unlock_irqrestore(dev-slock, flags);
  
   /* Reset urb buffers */
   for (i = 0; i  urb-number_of_packets; i++) {
 
--
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 v1 42/49] media: dvb-core: prepare for enabling irq in complete()

2013-08-22 Thread Hans Verkuil
On Sat 17 August 2013 18:25:07 Ming Lei wrote:
 Complete() will be run with interrupt enabled, so change to
 spin_lock_irqsave().
 
 These functions may be called inside URB-complete(), so use
 spin_lock_irqsave().
 
 Cc: Mauro Carvalho Chehab mche...@redhat.com
 Cc: linux-media@vger.kernel.org
 Signed-off-by: Ming Lei ming@canonical.com

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

Note: Mauro needs to Ack this as well. It looks good to me, but I don't
maintain dvb code.

Regards,

Hans

 ---
  drivers/media/dvb-core/dvb_demux.c |   17 +++--
  1 file changed, 11 insertions(+), 6 deletions(-)
 
 diff --git a/drivers/media/dvb-core/dvb_demux.c 
 b/drivers/media/dvb-core/dvb_demux.c
 index 3485655..58de441 100644
 --- a/drivers/media/dvb-core/dvb_demux.c
 +++ b/drivers/media/dvb-core/dvb_demux.c
 @@ -476,7 +476,9 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux 
 *demux, const u8 *buf)
  void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf,
 size_t count)
  {
 - spin_lock(demux-lock);
 + unsigned long flags;
 +
 + spin_lock_irqsave(demux-lock, flags);
  
   while (count--) {
   if (buf[0] == 0x47)
 @@ -484,7 +486,7 @@ void dvb_dmx_swfilter_packets(struct dvb_demux *demux, 
 const u8 *buf,
   buf += 188;
   }
  
 - spin_unlock(demux-lock);
 + spin_unlock_irqrestore(demux-lock, flags);
  }
  
  EXPORT_SYMBOL(dvb_dmx_swfilter_packets);
 @@ -519,8 +521,9 @@ static inline void _dvb_dmx_swfilter(struct dvb_demux 
 *demux, const u8 *buf,
  {
   int p = 0, i, j;
   const u8 *q;
 + unsigned long flags;
  
 - spin_lock(demux-lock);
 + spin_lock_irqsave(demux-lock, flags);
  
   if (demux-tsbufp) { /* tsbuf[0] is now 0x47. */
   i = demux-tsbufp;
 @@ -564,7 +567,7 @@ static inline void _dvb_dmx_swfilter(struct dvb_demux 
 *demux, const u8 *buf,
   }
  
  bailout:
 - spin_unlock(demux-lock);
 + spin_unlock_irqrestore(demux-lock, flags);
  }
  
  void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count)
 @@ -581,11 +584,13 @@ EXPORT_SYMBOL(dvb_dmx_swfilter_204);
  
  void dvb_dmx_swfilter_raw(struct dvb_demux *demux, const u8 *buf, size_t 
 count)
  {
 - spin_lock(demux-lock);
 + unsigned long flags;
 +
 + spin_lock_irqsave(demux-lock, flags);
  
   demux-feed-cb.ts(buf, count, NULL, 0, demux-feed-feed.ts, DMX_OK);
  
 - spin_unlock(demux-lock);
 + spin_unlock_irqrestore(demux-lock, flags);
  }
  EXPORT_SYMBOL(dvb_dmx_swfilter_raw);
  
 
--
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: width and height of JPEG compressed images

2013-08-22 Thread Thomas Vajzovic
Hi,

On 21 August 2013 14:29, Laurent Pinchart wrote:
 On Wednesday 21 August 2013 16:17:37 Sakari Ailus wrote:
 On Wed, Aug 07, 2013 at 05:43:56PM +, Thomas Vajzovic wrote:
 It defines the exact size of the physical frame.  The JPEG data is
 padded to this size. The size of the JPEG before it was padded is
 also written into the last word of the physical frame.

That would require either using a custom pixel format and have userspace
reading the size from the buffer, or mapping the buffer in kernel space
and reading the size there. The latter is easier for userspace, but
might it hinder performances ?

I think it ought to be a custom format and handled in userspace,
otherwise the bridge driver would have to call a subdev function
each frame to get it to fix-up the used size each time, which is
quite ugly.

Regards,
Tom

--
Mr T. Vajzovic
Software Engineer
Infrared Integrated Systems Ltd
Visit us at www.irisys.co.uk
Disclaimer: This e-mail message is confidential and for use by the addressee 
only. If the message is received by anyone other than the addressee, please 
return the message to the sender by replying to it and then delete the original 
message and the sent message from your computer. Infrared Integrated Systems 
Limited Park Circle Tithe Barn Way Swan Valley Northampton NN4 9BG Registration 
Number: 3186364.
--
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 V3] i2c: move of helpers into the core

2013-08-22 Thread Wolfram Sang
I2C of helpers used to live in of_i2c.c but experience (from SPI) shows
that it is much cleaner to have this in the core. This also removes a
circular dependency between the helpers and the core, and so we can
finally register child nodes in the core instead of doing this manually
in each driver. So, fix the drivers and documentation, too.

Acked-by: Rob Herring rob.herr...@calxeda.com
Reviewed-by: Felipe Balbi ba...@ti.com
Acked-by: Rafael J. Wysocki rafael.j.wyso...@intel.com
Tested-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Wolfram Sang w...@the-dreams.de
---

V2-V3: Was trying to be too smart by only fixing includes needed.
Took a more general approach this time, converting of_i2c.h
to i2c.h in case i2c.h was not already there. Otherwise
remove it. Improved my build scripts and no build failures,
no complaints from buildbot as well.


 Documentation/acpi/enumeration.txt  |1 -
 arch/powerpc/platforms/44x/warp.c   |1 -
 drivers/gpu/drm/tilcdc/tilcdc_slave.c   |1 -
 drivers/gpu/drm/tilcdc/tilcdc_tfp410.c  |1 -
 drivers/gpu/host1x/drm/output.c |2 +-
 drivers/i2c/busses/i2c-at91.c   |3 -
 drivers/i2c/busses/i2c-cpm.c|6 --
 drivers/i2c/busses/i2c-davinci.c|2 -
 drivers/i2c/busses/i2c-designware-platdrv.c |2 -
 drivers/i2c/busses/i2c-gpio.c   |3 -
 drivers/i2c/busses/i2c-i801.c   |2 -
 drivers/i2c/busses/i2c-ibm_iic.c|4 -
 drivers/i2c/busses/i2c-imx.c|3 -
 drivers/i2c/busses/i2c-mpc.c|2 -
 drivers/i2c/busses/i2c-mv64xxx.c|3 -
 drivers/i2c/busses/i2c-mxs.c|3 -
 drivers/i2c/busses/i2c-nomadik.c|3 -
 drivers/i2c/busses/i2c-ocores.c |3 -
 drivers/i2c/busses/i2c-octeon.c |3 -
 drivers/i2c/busses/i2c-omap.c   |3 -
 drivers/i2c/busses/i2c-pnx.c|3 -
 drivers/i2c/busses/i2c-powermac.c   |9 +-
 drivers/i2c/busses/i2c-pxa.c|2 -
 drivers/i2c/busses/i2c-s3c2410.c|2 -
 drivers/i2c/busses/i2c-sh_mobile.c  |2 -
 drivers/i2c/busses/i2c-sirf.c   |3 -
 drivers/i2c/busses/i2c-stu300.c |2 -
 drivers/i2c/busses/i2c-tegra.c  |3 -
 drivers/i2c/busses/i2c-versatile.c  |2 -
 drivers/i2c/busses/i2c-wmt.c|3 -
 drivers/i2c/busses/i2c-xiic.c   |3 -
 drivers/i2c/i2c-core.c  |  109 +-
 drivers/i2c/i2c-mux.c   |3 -
 drivers/i2c/muxes/i2c-arb-gpio-challenge.c  |1 -
 drivers/i2c/muxes/i2c-mux-gpio.c|1 -
 drivers/i2c/muxes/i2c-mux-pinctrl.c |1 -
 drivers/media/platform/exynos4-is/fimc-is-i2c.c |4 +-
 drivers/media/platform/exynos4-is/fimc-is.c |2 +-
 drivers/media/platform/exynos4-is/media-dev.c   |1 -
 drivers/of/Kconfig  |6 --
 drivers/of/Makefile |1 -
 drivers/of/of_i2c.c |  114 ---
 drivers/staging/imx-drm/imx-tve.c   |2 +-
 include/linux/i2c.h |   20 
 include/linux/of_i2c.h  |   46 -
 sound/soc/fsl/imx-sgtl5000.c|2 +-
 sound/soc/fsl/imx-wm8962.c  |2 +-
 47 files changed, 138 insertions(+), 262 deletions(-)
 delete mode 100644 drivers/of/of_i2c.c
 delete mode 100644 include/linux/of_i2c.h

diff --git a/Documentation/acpi/enumeration.txt 
b/Documentation/acpi/enumeration.txt
index d9be7a9..958266e 100644
--- a/Documentation/acpi/enumeration.txt
+++ b/Documentation/acpi/enumeration.txt
@@ -238,7 +238,6 @@ An I2C bus (controller) driver does:
if (ret)
/* handle error */
 
-   of_i2c_register_devices(adapter);
/* Enumerate the slave devices behind this bus via ACPI */
acpi_i2c_register_devices(adapter);
 
diff --git a/arch/powerpc/platforms/44x/warp.c 
b/arch/powerpc/platforms/44x/warp.c
index 4cfa499..534574a 100644
--- a/arch/powerpc/platforms/44x/warp.c
+++ b/arch/powerpc/platforms/44x/warp.c
@@ -16,7 +16,6 @@
 #include linux/interrupt.h
 #include linux/delay.h
 #include linux/of_gpio.h
-#include linux/of_i2c.h
 #include linux/slab.h
 #include linux/export.h
 
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_slave.c 
b/drivers/gpu/drm/tilcdc/tilcdc_slave.c
index dfffaf0..a19f657 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_slave.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_slave.c
@@ -16,7 +16,6 @@
  */
 
 #include linux/i2c.h
-#include linux/of_i2c.h
 #include linux/pinctrl/pinmux.h
 #include 

RE: width and height of JPEG compressed images

2013-08-22 Thread Thomas Vajzovic
Hi,

On 21 August 2013 14:34, Sakari Ailus wrote:
 On Tue, Aug 06, 2013 at 04:26:56PM +, Thomas Vajzovic wrote:
 On 24 July 2013 10:30 Sylwester Nawrocki wrote:
 On 07/22/2013 10:40 AM, Thomas Vajzovic wrote:
 On 21 July 2013 21:38 Sylwester Nawrocki wrote:
 On 07/19/2013 10:28 PM, Sakari Ailus wrote:
 On Sat, Jul 06, 2013 at 09:58:23PM +0200, Sylwester Nawrocki wrote:
 On 07/05/2013 10:22 AM, Thomas Vajzovic wrote:

 The hardware reads AxB sensor pixels from its array, resamples
 them to CxD image pixels, and then compresses them to ExF bytes.

 If the sensor driver is only told the user's requested sizeimage,
 it can be made to factorize (ExF) into (E,F) itself, but then both
 the parallel interface and the 2D DMA peripheral need to be told
 the particular factorization that it has chosen.

 If the user requests sizeimage which cannot be satisfied (eg: a
 prime
 number) then it will need to return (E,F) to the bridge driver
 which does not multiply exactly to sizeimage.  Because of this the
 bridge driver must set the corrected value of sizeimage which it
 returns to userspace to the product ExF.

 Ok, let's consider following data structure describing the frame:

 struct v4l2_frame_desc_entry {
   u32 flags;
   u32 pixelcode;
   u32 samples_per_line;
   u32 num_lines;
   u32 size;
 };

 I think we could treat the frame descriptor to be at lower lever in
 the protocol stack than struct v4l2_mbus_framefmt.

 Then the bridge would set size and pixelcode and the subdev would
 return (E, F) in (samples_per_frame, num_lines) and adjust size if
 required. Number of bits per sample can be determined by pixelcode.

 It needs to be considered that for some sensor drivers it might not
 be immediately clear what samples_per_line, num_lines values are.
 In such case those fields could be left zeroed and bridge driver
 could signal such condition as a more or less critical error. In end
 of the day specific sensor driver would need to be updated to
 interwork with a bridge that requires samples_per_line, num_lines.

 I think we ought to try to consider the four cases:

 1D sensor and 1D bridge: already works

 2D sensor and 2D bridge: my use case

 1D sensor and 2D bridge, 2D sensor and 1D bridge:

 Are there any bridge devices that CANNOT receive 2D images? I've
 never seen any.

I meant bridge with 1D DMA.

 Perhaps both of these cases could be made to work by setting:
 num_lines = 1; samples_per_line = ((size * 8) / bpp);

 (Obviously this would also require the appropriate pull-up/down on the
 second sync input on a 2D bridge).

 And typically also 2D-only bridges have very limited maximum image
 width which is unsuitable for any decent images. I'd rather like to
 only support cases that we actually have right now.

That makes sense.  I would make a small change though:

I think your proposed structure and protocol has redundant data
which could lead to ambiguity.

Perhaps the structure should only have size and samples_per_line.
If the subdev supports 2D output of a compressed stream then it examines
size, and sets samples_per_line and adjusts size.  If not then it
may still adjust size but leaves samples_per_line zeroed.  As you said
if the bridge finds samples_per_line still zeroed and it needs it then
it will have to give up.  If it has a non-zero samples_per_line then it
can divide to find num_lines.

 Not sure if we need to add image width and height in pixels to the
 above structure. It wouldn't make much sensor when single frame
 carries multiple images, e.g. interleaved YUV and compressed image
 data at different resolutions.

 If image size were here then we are duplicating get_fmt/set_fmt.
 But then, by having pixelcode here we are already duplicating part of
 get_fmt/set_fmt.  If the bridge changes pixelcode and calls

 Pixelcode would be required to tell which other kind of data is
 produced by the device. But I agree in principle --- there could
 (theoretically) be multiple pixelcodes that you might want to
 configure on a sensor. We don't have a way to express that currently.

I wasn't thinking that set_frame_desc should be able to configure
currently unselected pixelcodes, quite the contrary, I would expect
that the pad should have a selected pixelcode, set by set_mbus_fmt,
so having pixelcode in frame_desc_entry is extra duplication, I don't
know why it is there.

 Do you have an example of something you'd like to set (or try) in frame
 descriptors outside struct v4l2_subdev_format?

I only have a need to try/set the buffersize which is tried/set by
userspace.


Best regards,
Tom

--
Mr T. Vajzovic
Software Engineer
Infrared Integrated Systems Ltd
Visit us at www.irisys.co.uk
Disclaimer: This e-mail message is confidential and for use by the addressee 
only. If the message is received by anyone other than the addressee, please 
return the message to the sender by replying to it and then delete the original 
message and the sent message from your computer. Infrared Integrated Systems 
Limited 

[patch] [media] snd_tea575x: precedence bug in fmr2_tea575x_get_pins()

2013-08-22 Thread Dan Carpenter
The | operation has higher precedence that ?: so this couldn't
return both flags set at once as intended.

Signed-off-by: Dan Carpenter dan.carpen...@oracle.com
---
Static checker stuff.  Untested.

diff --git a/drivers/media/radio/radio-sf16fmr2.c 
b/drivers/media/radio/radio-sf16fmr2.c
index 9c09904..72af59d 100644
--- a/drivers/media/radio/radio-sf16fmr2.c
+++ b/drivers/media/radio/radio-sf16fmr2.c
@@ -74,8 +74,8 @@ static u8 fmr2_tea575x_get_pins(struct snd_tea575x *tea)
struct fmr2 *fmr2 = tea-private_data;
u8 bits = inb(fmr2-io);
 
-   return  (bits  STR_DATA) ? TEA575X_DATA : 0 |
-   (bits  STR_MOST) ? TEA575X_MOST : 0;
+   return  ((bits  STR_DATA) ? TEA575X_DATA : 0) |
+   ((bits  STR_MOST) ? TEA575X_MOST : 0);
 }
 
 static void fmr2_tea575x_set_direction(struct snd_tea575x *tea, bool output)
--
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: dib8000 scanning not working on 3.10.3

2013-08-22 Thread Javier Búcar
Hello Mauro, we have the bad commit:

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=173a64cb3fcff1993b2aa8113e53fd379f6a968f

This is a very big commit. I don't known where to fix it. Can you help
me on fixing it
Thanks in advance
Javier

On Wed, Aug 7, 2013 at 3:48 PM, Luis Polasek lpola...@gmail.com wrote:
 Hi again Mauro, reverting both commits:

 *  59501bb792c66b85fb7fdbd740e788e3afc70bbd
 *  f45f513a9325b52a5f3e26ee8d15471e8b692947

 The problem still exists, I am unable to get any result, and also no
 error logs) :(

 What shall I do to try to fix this ? Do you need more info on my current 
 setup.

 Thanks in advance and best regards...

 On Mon, Aug 5, 2013 at 5:26 PM, Mauro Carvalho Chehab
 m.che...@samsung.com wrote:
 Em Mon, 05 Aug 2013 16:09:56 -0300
 Luis Polasek lpola...@gmail.com escreveu:

 Hi Mauro, I have tested using dvb5-scan, and the results are the same (no
 results, and no error logs) :(

  Do you have any clue why it is not working with this kernel version ?

 c/c Oliver and Patrick, who maintains this driver

 There were a recent change on this driver, in order to support some newer
 versions of this chipset. Perhaps those changes broke it for you.

 commit 59501bb792c66b85fb7fdbd740e788e3afc70bbd
 Author: Olivier Grenie olivier.gre...@parrot.com
 Date:   Mon Dec 31 09:51:17 2012 -0300

 [media] dib7090p: improve the support of the dib7090 and dib7790

 The intend of this patch is to improve the support of the dib7090 and
 dib7790. The AGC1 min value is set to 32768 by default. The actual AGC1 
 min
 and the external attenuation are controled depending on the received RF
 level.

 Signed-off-by: Olivier Grenie olivier.gre...@parrot.com
 Signed-off-by: Patrick Boettcher patrick.boettc...@parrot.com
 Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com

 commit f45f513a9325b52a5f3e26ee8d15471e8b692947
 Author: Olivier Grenie olivier.gre...@parrot.com
 Date:   Mon Dec 31 09:47:10 2012 -0300

 [media] dib7090p: remove the support for the dib7090E

 The intend of this patch is to remove the support for the dib7090E. The
 DiB7090E-package has never left prototype state and never made it to
 mass-prod-state.

 Signed-off-by: Olivier Grenie olivier.gre...@parrot.com
 Signed-off-by: Patrick Boettcher patrick.boettc...@parrot.com
 Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com

 Could you please revert those patches and see if they fix the issue?
 Please try to revert this one first:
 
 http://git.linuxtv.org/media_tree.git/commitdiff_plain/59501bb792c66b85fb7fdbd740e788e3afc70bbd

 If this doesn't solve, try to revert just this one:
 
 http://git.linuxtv.org/media_tree.git/commitdiff_plain/f45f513a9325b52a5f3e26ee8d15471e8b692947

 then, try to revert both.

 AFAIKT, those are the only changes that may be affecting isdb-t on dib8000
 driver.

 Thanks!
 Mauro


 Thanks and regards...


 On Thu, Aug 1, 2013 at 2:15 PM, Mauro Carvalho Chehab
 m.che...@samsung.comwrote:

  Em Thu, 1 Aug 2013 13:36:25 -0300
  Ezequiel Garcia ezequiel.gar...@free-electrons.com escreveu:
 
   Hi Luis,
  
   (I'm Ccing Mauro, who mantains this driver and might know what's going
  on).
  
   On Wed, Jul 31, 2013 at 03:47:10PM -0300, Luis Polasek wrote:
Hi, I just upgraded my kernel to 3.10.3, and dib8000 scanning does not
work anymore.
   
I tested using dvbscan (from dvb-apps/util/) and w_scan on a Prolink
Pixelview SBTVD (dib8000 module*).This tools worked very well on
version 3.9.9 , but now it does not produces any result, and also
there are no error messages in the logs (dmesg).
   
  
   Please run a git bisect and report your findings.
  
   Note that dibcom8000 shows just a handful of commit on 2013,
   so you could start reverting those and see what happens.
 
  Perhaps it is a failure at the DVBv3 emulation.
 
  Did it also break using dvbv5-scan (part of v4l-utils)?
 
  Regards,
  Mauro
  --
 
  Cheers,
  Mauro
 


 --

 Cheers,
 Mauro
--
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 0/2] Renesas VSP1 fixes

2013-08-22 Thread Laurent Pinchart
Hello,

Here's two fixes for the Renesas VSP1 driver. The first one reports the platform
device name through the media device bus_info field, allowing applications to
differentiate between VSP1 instances. The second one gets rid of a crash related
to missing clocks for the VSPR and VSPS instances.

I'd like to get those patches in v3.12-rc1 if possible.

Laurent Pinchart (2):
  v4l: vsp1: Initialize media device bus_info field
  v4l: vsp1: Add support for RT clock

 drivers/media/platform/vsp1/vsp1.h |  1 +
 drivers/media/platform/vsp1/vsp1_drv.c | 42 ++
 2 files changed, 38 insertions(+), 5 deletions(-)

-- 
Regards,

Laurent Pinchart

--
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 2/2] v4l: vsp1: Add support for RT clock

2013-08-22 Thread Laurent Pinchart
The VSPR and VSPS instances use two clocks, the VSP1 system clock and
the VSP1 realtime clock. Both of them need to be enabled to access the
VSP1 registers.

Add support for an optional RT clock and enable/disable it along with
the system clock.

Signed-off-by: Laurent Pinchart laurent.pinchart+rene...@ideasonboard.com
---
 drivers/media/platform/vsp1/vsp1.h |  1 +
 drivers/media/platform/vsp1/vsp1_drv.c | 40 +-
 2 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1.h 
b/drivers/media/platform/vsp1/vsp1.h
index 11ac94b..d6c6ecd 100644
--- a/drivers/media/platform/vsp1/vsp1.h
+++ b/drivers/media/platform/vsp1/vsp1.h
@@ -42,6 +42,7 @@ struct vsp1_device {
 
void __iomem *mmio;
struct clk *clock;
+   struct clk *rt_clock;
 
struct mutex lock;
int ref_count;
diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
b/drivers/media/platform/vsp1/vsp1_drv.c
index 291d20f..9abe101 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -290,6 +290,33 @@ static int vsp1_device_init(struct vsp1_device *vsp1)
return 0;
 }
 
+static int vsp1_clocks_enable(struct vsp1_device *vsp1)
+{
+   int ret;
+
+   ret = clk_prepare_enable(vsp1-clock);
+   if (ret  0)
+   return ret;
+
+   if (IS_ERR(vsp1-rt_clock))
+   return 0;
+
+   ret = clk_prepare_enable(vsp1-rt_clock);
+   if (ret  0) {
+   clk_disable_unprepare(vsp1-clock);
+   return ret;
+   }
+
+   return 0;
+}
+
+static void vsp1_clocks_disable(struct vsp1_device *vsp1)
+{
+   if (!IS_ERR(vsp1-rt_clock))
+   clk_disable_unprepare(vsp1-rt_clock);
+   clk_disable_unprepare(vsp1-clock);
+}
+
 /*
  * vsp1_device_get - Acquire the VSP1 device
  *
@@ -307,7 +334,7 @@ struct vsp1_device *vsp1_device_get(struct vsp1_device 
*vsp1)
if (vsp1-ref_count  0)
goto done;
 
-   ret = clk_prepare_enable(vsp1-clock);
+   ret = vsp1_clocks_enable(vsp1);
if (ret  0) {
__vsp1 = NULL;
goto done;
@@ -315,7 +342,7 @@ struct vsp1_device *vsp1_device_get(struct vsp1_device 
*vsp1)
 
ret = vsp1_device_init(vsp1);
if (ret  0) {
-   clk_disable_unprepare(vsp1-clock);
+   vsp1_clocks_disable(vsp1);
__vsp1 = NULL;
goto done;
}
@@ -339,7 +366,7 @@ void vsp1_device_put(struct vsp1_device *vsp1)
mutex_lock(vsp1-lock);
 
if (--vsp1-ref_count == 0)
-   clk_disable_unprepare(vsp1-clock);
+   vsp1_clocks_disable(vsp1);
 
mutex_unlock(vsp1-lock);
 }
@@ -358,7 +385,7 @@ static int vsp1_pm_suspend(struct device *dev)
if (vsp1-ref_count == 0)
return 0;
 
-   clk_disable_unprepare(vsp1-clock);
+   vsp1_clocks_disable(vsp1);
return 0;
 }
 
@@ -371,7 +398,7 @@ static int vsp1_pm_resume(struct device *dev)
if (vsp1-ref_count)
return 0;
 
-   return clk_prepare_enable(vsp1-clock);
+   return vsp1_clocks_enable(vsp1);
 }
 #endif
 
@@ -445,6 +472,9 @@ static int vsp1_probe(struct platform_device *pdev)
return PTR_ERR(vsp1-clock);
}
 
+   /* The RT clock is optional */
+   vsp1-rt_clock = devm_clk_get(pdev-dev, rt);
+
irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!irq) {
dev_err(pdev-dev, missing IRQ\n);
-- 
1.8.1.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 1/2] v4l: vsp1: Initialize media device bus_info field

2013-08-22 Thread Laurent Pinchart
Fill bus_info with the VSP1 platform device name

Signed-off-by: Laurent Pinchart laurent.pinchart+rene...@ideasonboard.com
---
 drivers/media/platform/vsp1/vsp1_drv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
b/drivers/media/platform/vsp1/vsp1_drv.c
index 8700842..291d20f 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -134,6 +134,8 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
 
mdev-dev = vsp1-dev;
strlcpy(mdev-model, VSP1, sizeof(mdev-model));
+   snprintf(mdev-bus_info, sizeof(mdev-bus_info), platform:%s,
+dev_name(mdev-dev));
ret = media_device_register(mdev);
if (ret  0) {
dev_err(vsp1-dev, media device registration failed (%d)\n,
-- 
1.8.1.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: dib8000 scanning not working on 3.10.3

2013-08-22 Thread Ezequiel Garcia
Mauro, Javier,

On Thu, Aug 22, 2013 at 02:47:33PM -0300, Javier Búcar wrote:
 
 http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=173a64cb3fcff1993b2aa8113e53fd379f6a968f
 
 This is a very big commit. I don't known where to fix it. Can you help

That's not a commit: that's a monster :-(

That should have been heavily splitted. Now a user (Javier and Luis)
is allegedly reporting a regression, but that commit is almost
impossible to understand, and probably very difficult to revert.

I hate to get grumpy, but this does not look nice!
Even the commit log sucks: what does dib8000: enhancement suppose to mean?

Javier/Luis: (for the second time) please try to avoid top-posting
in the future, it breaks the thread discussion.
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
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: dib8000 scanning not working on 3.10.3

2013-08-22 Thread Mauro Carvalho Chehab
Em Thu, 22 Aug 2013 14:47:33 -0300
Javier Búcar jbu...@lifia.info.unlp.edu.ar escreveu:

 Hello Mauro, we have the bad commit:
 
 http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=173a64cb3fcff1993b2aa8113e53fd379f6a968f
 
 This is a very big commit. I don't known where to fix it. Can you help
 me on fixing it

Hmm So, the error is on this patch?

author  Patrick Boettcher pboettc...@kernellabs.com   2013-04-22 
15:45:52 (GMT)
[media] dib8000: enhancement

The intend of this patch is to improve the support of the dib8000. 

Signed-off-by: Olivier Grenie olivier.gre...@parrot.com 
Signed-off-by: Patrick Boettcher patrick.boettc...@parrot.com 
Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com 

If so, then we need either Olivier or Patrick's help, as I don't have any
documentation about the dib8000 chips.

You can still take a look there at the code that checks for the
chipset version, like:
if (state-revision == 0x8090) {
some code for newer version
} else {
some code for the old version
}

If the code for the old version remains the same as before the patch.
Where it doesn't remains the same, then it could be the source of the
troubles.

I suggest you to check what state-revision shows on your specific device,
in order to do such analysis.

I'll try latter to do some tests with the devices I have, but this could
take some time, as I'm really busy those days.

Regards,
Mauro


 Thanks in advance
 Javier
 
 On Wed, Aug 7, 2013 at 3:48 PM, Luis Polasek lpola...@gmail.com wrote:
  Hi again Mauro, reverting both commits:
 
  *  59501bb792c66b85fb7fdbd740e788e3afc70bbd
  *  f45f513a9325b52a5f3e26ee8d15471e8b692947
 
  The problem still exists, I am unable to get any result, and also no
  error logs) :(
 
  What shall I do to try to fix this ? Do you need more info on my current 
  setup.
 
  Thanks in advance and best regards...
 
  On Mon, Aug 5, 2013 at 5:26 PM, Mauro Carvalho Chehab
  m.che...@samsung.com wrote:
  Em Mon, 05 Aug 2013 16:09:56 -0300
  Luis Polasek lpola...@gmail.com escreveu:
 
  Hi Mauro, I have tested using dvb5-scan, and the results are the same (no
  results, and no error logs) :(
 
   Do you have any clue why it is not working with this kernel version ?
 
  c/c Oliver and Patrick, who maintains this driver
 
  There were a recent change on this driver, in order to support some newer
  versions of this chipset. Perhaps those changes broke it for you.
 
  commit 59501bb792c66b85fb7fdbd740e788e3afc70bbd
  Author: Olivier Grenie olivier.gre...@parrot.com
  Date:   Mon Dec 31 09:51:17 2012 -0300
 
  [media] dib7090p: improve the support of the dib7090 and dib7790
 
  The intend of this patch is to improve the support of the dib7090 and
  dib7790. The AGC1 min value is set to 32768 by default. The actual 
  AGC1 min
  and the external attenuation are controled depending on the received RF
  level.
 
  Signed-off-by: Olivier Grenie olivier.gre...@parrot.com
  Signed-off-by: Patrick Boettcher patrick.boettc...@parrot.com
  Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com
 
  commit f45f513a9325b52a5f3e26ee8d15471e8b692947
  Author: Olivier Grenie olivier.gre...@parrot.com
  Date:   Mon Dec 31 09:47:10 2012 -0300
 
  [media] dib7090p: remove the support for the dib7090E
 
  The intend of this patch is to remove the support for the dib7090E. The
  DiB7090E-package has never left prototype state and never made it to
  mass-prod-state.
 
  Signed-off-by: Olivier Grenie olivier.gre...@parrot.com
  Signed-off-by: Patrick Boettcher patrick.boettc...@parrot.com
  Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com
 
  Could you please revert those patches and see if they fix the issue?
  Please try to revert this one first:
  
  http://git.linuxtv.org/media_tree.git/commitdiff_plain/59501bb792c66b85fb7fdbd740e788e3afc70bbd
 
  If this doesn't solve, try to revert just this one:
  
  http://git.linuxtv.org/media_tree.git/commitdiff_plain/f45f513a9325b52a5f3e26ee8d15471e8b692947
 
  then, try to revert both.
 
  AFAIKT, those are the only changes that may be affecting isdb-t on dib8000
  driver.
 
  Thanks!
  Mauro
 
 
  Thanks and regards...
 
 
  On Thu, Aug 1, 2013 at 2:15 PM, Mauro Carvalho Chehab
  m.che...@samsung.comwrote:
 
   Em Thu, 1 Aug 2013 13:36:25 -0300
   Ezequiel Garcia ezequiel.gar...@free-electrons.com escreveu:
  
Hi Luis,
   
(I'm Ccing Mauro, who mantains this driver and might know what's going
   on).
   
On Wed, Jul 31, 2013 at 03:47:10PM -0300, Luis Polasek wrote:
 Hi, I just upgraded my kernel to 3.10.3, and dib8000 scanning does 
 not
 work anymore.

 I tested using dvbscan (from dvb-apps/util/) and w_scan on a Prolink
 Pixelview SBTVD (dib8000 module*).This tools worked very well on
 version 3.9.9 , but now it does 

Re: [PATCH v7] s5k5baf: add camera sensor driver

2013-08-22 Thread Stephen Warren
On 08/21/2013 08:41 AM, Andrzej Hajda wrote:
 Driver for Samsung S5K5BAF UXGA 1/5 2M CMOS Image Sensor
 with embedded SoC ISP.
 The driver exposes the sensor as two V4L2 subdevices:
 - S5K5BAF-CIS - pure CMOS Image Sensor, fixed 1600x1200 format,
   no controls.
 - S5K5BAF-ISP - Image Signal Processor, formats up to 1600x1200,
   pre/post ISP cropping, downscaling via selection API, controls.

The binding,
Acked-by: Stephen Warren swar...@nvidia.com

(although it would be great if another DT binding maintainer gave it a
quick look-over to make sure I didn't miss anything!)
--
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


BDA-2875

2013-08-22 Thread Abel S.
Plugging plate with bda2875 chip does not seem to detect the kernel 
correctly (I think that is not in the list).

This is the message from kernel:


[17419.315987] usb 1-4: new high-speed USB device number 3 using ehci-pci
[17419.448607] usb 1-4: New USB device found, idVendor=eb1a, idProduct=2875
[17419.448615] usb 1-4: New USB device strings: Mfr=0, Product=1, 
SerialNumber=2

[17419.448621] usb 1-4: Product: USB 2875 Device
[17419.448626] usb 1-4: SerialNumber: 123456789ABCD
[17419.575625] em28xx: New device  USB 2875 Device @ 480 Mbps 
(eb1a:2875, interface 0, class 0)

[17419.575632] em28xx: DVB interface 0 found
[17419.575734] em28xx #0: chip ID is em2874
[17419.705441] em28xx #0: found i2c device @ 0xa0 [eeprom]
[17419.719924] em28xx #0: Your board has no unique USB ID.
[17419.719930] em28xx #0: A hint were successfully done, based on i2c 
devicelist hash.

[17419.719934] em28xx #0: This method is not 100% failproof.
[17419.719936] em28xx #0: If the board were missdetected, please email 
this log to:

[17419.719939] em28xx #0: V4L Mailing List linux-media@vger.kernel.org
[17419.719942] em28xx #0: Board detected as EM2874 Leadership ISDBT
[17419.823511] em28xx #0: Identified as EM2874 Leadership ISDBT (card=77)
[17419.823519] em28xx #0: v4l2 driver version 0.1.3
[17419.828468] em28xx #0: V4L2 video device registered as video1
[17419.828896] usbcore: registered new interface driver em28xx
[17419.938874] s921: s921_attach:
[17419.938882] DVB: registering new adapter (em28xx #0)
[17419.938893] usb 1-4: DVB: registering adapter 0 frontend 0 (Sharp 
S921)...

[17419.939834] em28xx #0: Successfully loaded em28xx-dvb
[17419.939842] Em28xx: Initialized (Em28xx dvb Extension) extension

___

When i load the module with card=0 the message is:


[18217.667516] em28xx: New device  USB 2875 Device @ 480 Mbps 
(eb1a:2875, interface 0, class 0)

[18217.667521] em28xx: DVB interface 0 found
[18217.667617] em28xx #0: chip ID is em2874
[18223.861181] em28xx #0: Your board has no unique USB ID and thus need 
a hint to be detected.
[18223.861186] em28xx #0: You may try to use card=n insmod option to 
workaround that.

[18223.861188] em28xx #0: Please send an email with this log to:
[18223.861189] em28xx #0: V4L Mailing List linux-media@vger.kernel.org
[18223.861191] em28xx #0: Board eeprom hash is 0x
[18223.861192] em28xx #0: Board i2c devicelist hash is 0x1b800080
[18223.861193] em28xx #0: Here is a list of valid choices for the 
card=n insmod option:

[18223.861195] em28xx #0: card=0 - Unknown EM2800 video grabber
[18223.861197] em28xx #0: card=1 - Unknown EM2750/28xx video grabber
[18223.861198] em28xx #0: card=2 - Terratec Cinergy 250 USB
[18223.861200] em28xx #0: card=3 - Pinnacle PCTV USB 2
[18223.861201] em28xx #0: card=4 - Hauppauge WinTV USB 2
[18223.861202] em28xx #0: card=5 - MSI VOX USB 2.0
[18223.861203] em28xx #0: card=6 - Terratec Cinergy 200 USB
[18223.861205] em28xx #0: card=7 - Leadtek Winfast USB II
[18223.861206] em28xx #0: card=8 - Kworld USB2800
[18223.861207] em28xx #0: card=9 - Pinnacle Dazzle DVC 
90/100/101/107 / Kaiser Baas Video to DVD maker / Kworld DVD Maker 2 / 
Plextor ConvertX PX-AV100U

[18223.861209] em28xx #0: card=10 - Hauppauge WinTV HVR 900
[18223.861210] em28xx #0: card=11 - Terratec Hybrid XS
[18223.861212] em28xx #0: card=12 - Kworld PVR TV 2800 RF
[18223.861213] em28xx #0: card=13 - Terratec Prodigy XS
[18223.861214] em28xx #0: card=14 - SIIG AVTuner-PVR / Pixelview 
Prolink PlayTV USB 2.0

[18223.861216] em28xx #0: card=15 - V-Gear PocketTV
[18223.861217] em28xx #0: card=16 - Hauppauge WinTV HVR 950
[18223.861218] em28xx #0: card=17 - Pinnacle PCTV HD Pro Stick
[18223.861219] em28xx #0: card=18 - Hauppauge WinTV HVR 900 (R2)
[18223.861221] em28xx #0: card=19 - EM2860/SAA711X Reference Design
[18223.861222] em28xx #0: card=20 - AMD ATI TV Wonder HD 600
[18223.861223] em28xx #0: card=21 - eMPIA Technology, Inc. 
GrabBeeX+ Video Encoder

[18223.861224] em28xx #0: card=22 - EM2710/EM2750/EM2751 webcam grabber
[18223.861226] em28xx #0: card=23 - Huaqi DLCW-130
[18223.861227] em28xx #0: card=24 - D-Link DUB-T210 TV Tuner
[18223.861228] em28xx #0: card=25 - Gadmei UTV310
[18223.861229] em28xx #0: card=26 - Hercules Smart TV USB 2.0
[18223.861231] em28xx #0: card=27 - Pinnacle PCTV USB 2 (Philips 
FM1216ME)

[18223.861232] em28xx #0: card=28 - Leadtek Winfast USB II Deluxe
[18223.861233] em28xx #0: card=29 - EM2860/TVP5150 Reference Design
[18223.861234] em28xx #0: card=30 - Videology 20K14XUSB USB2.0
[18223.861236] em28xx #0: card=31 - Usbgear VD204v9
[18223.861237] em28xx #0: card=32 - Supercomp USB 2.0 TV
[18223.861238] em28xx #0: card=33 - Elgato Video Capture
[18223.861239] em28xx #0: card=34 - Terratec Cinergy A Hybrid XS

[PATCH v4 0/3] R8A7779/Marzen R-Car VIN driver support

2013-08-22 Thread Sergei Shtylyov
Hello.

   Here's the set of 3 patches against the Mauro's 'media_tree.git' repo's
'master' branch. Here we add the VIN driver platform code for the R8A7779/Marzen
with ADV7180 I2C video decoder.

[1/3] ARM: shmobile: r8a7779: add VIN support
[2/3] ARM: shmobile: Marzen: add VIN and ADV7180 support
[3/3] ARM: shmobile: Marzen: enable VIN and ADV7180 in defconfig

Mauro has kindly agreed to merge this patchset thru his tree to resolve the
dependency on the driver's platform data header, provided that the maintainer
ACKs this. Simon, could you ACK the patchset ASAP -- Mauro expects to close his
tree for 3.12 this weekend or next Monday?

WBR, Sergei
--
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/3] R8A7779/Marzen R-Car VIN driver support

2013-08-22 Thread Sergei Shtylyov
Hello.

   [Resending with a real version #.]

   Here's the set of 3 patches against the Mauro's 'media_tree.git' repo's
'master' branch. Here we add the VIN driver platform code for the R8A7779/Marzen
with ADV7180 I2C video decoder.

[1/3] ARM: shmobile: r8a7779: add VIN support
[2/3] ARM: shmobile: Marzen: add VIN and ADV7180 support
[3/3] ARM: shmobile: Marzen: enable VIN and ADV7180 in defconfig

Mauro has kindly agreed to merge this patchset thru his tree to resolve the
dependency on the driver's platform data header, provided that the maintainer
ACKs this. Simon, could you ACK the patchset ASAP -- Mauro expects to close his
tree for 3.12 this weekend or next Monday?

WBR, Sergei
--
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/3] ARM: shmobile: r8a7779: add VIN support

2013-08-22 Thread Sergei Shtylyov
From: Vladimir Barinov vladimir.bari...@cogentembedded.com

Add VIN clocks and platform devices for R8A7779 SoC; add function to register
the VIN platform devices.

Signed-off-by: Vladimir Barinov vladimir.bari...@cogentembedded.com
[Sergei: added 'id' parameter check to r8a7779_add_vin_device(), used '*pdata'
in *sizeof* operator there, renamed some variables, annotated vin[0-3]_resources
[] and 'vin[0-3]_info' as '__initdata'.]
Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com

---
Changes since version 4:
- resolved reject.

Changes since version 3:
- changed the VIN platform device name to be R8A7779 specific; 
- used '*pdata' in *sizeof* operator in r8a7779_add_vin_device();
- resolved reject in mach/r8a7779.h due to USB patch rework.

Changes since version 2:
- annotated vin[0-3]_resources[] and 'vin[0-3]_info' as '__initdata' since they
  are kmemdup()'ed while registering the platform devices anyway;

Changes since the original posting:
- added 'id' parameter check to r8a7779_add_vin_device().

 arch/arm/mach-shmobile/clock-r8a7779.c|   10 +++
 arch/arm/mach-shmobile/include/mach/r8a7779.h |3 ++
 arch/arm/mach-shmobile/setup-r8a7779.c|   37 ++
 3 files changed, 50 insertions(+)

Index: media_tree/arch/arm/mach-shmobile/clock-r8a7779.c
===
--- media_tree.orig/arch/arm/mach-shmobile/clock-r8a7779.c
+++ media_tree/arch/arm/mach-shmobile/clock-r8a7779.c
@@ -112,7 +112,9 @@ static struct clk *main_clks[] = {
 };
 
 enum { MSTP323, MSTP322, MSTP321, MSTP320,
+   MSTP120,
MSTP116, MSTP115, MSTP114,
+   MSTP110, MSTP109, MSTP108,
MSTP103, MSTP101, MSTP100,
MSTP030,
MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, 
MSTP021,
@@ -125,9 +127,13 @@ static struct clk mstp_clks[MSTP_NR] = {
[MSTP322] = SH_CLK_MSTP32(clkp_clk, MSTPCR3, 22, 0), /* SDHI1 */
[MSTP321] = SH_CLK_MSTP32(clkp_clk, MSTPCR3, 21, 0), /* SDHI2 */
[MSTP320] = SH_CLK_MSTP32(clkp_clk, MSTPCR3, 20, 0), /* SDHI3 */
+   [MSTP120] = SH_CLK_MSTP32(clks_clk, MSTPCR1, 20, 0), /* VIN3 */
[MSTP116] = SH_CLK_MSTP32(clkp_clk, MSTPCR1, 16, 0), /* PCIe */
[MSTP115] = SH_CLK_MSTP32(clkp_clk, MSTPCR1, 15, 0), /* SATA */
[MSTP114] = SH_CLK_MSTP32(clkp_clk, MSTPCR1, 14, 0), /* Ether */
+   [MSTP110] = SH_CLK_MSTP32(clks_clk, MSTPCR1, 10, 0), /* VIN0 */
+   [MSTP109] = SH_CLK_MSTP32(clks_clk, MSTPCR1,  9, 0), /* VIN1 */
+   [MSTP108] = SH_CLK_MSTP32(clks_clk, MSTPCR1,  8, 0), /* VIN2 */
[MSTP103] = SH_CLK_MSTP32(clks_clk, MSTPCR1,  3, 0), /* DU */
[MSTP101] = SH_CLK_MSTP32(clkp_clk, MSTPCR1,  1, 0), /* USB2 */
[MSTP100] = SH_CLK_MSTP32(clkp_clk, MSTPCR1,  0, 0), /* USB0/1 */
@@ -162,10 +168,14 @@ static struct clk_lookup lookups[] = {
CLKDEV_CON_ID(peripheral_clk, clkp_clk),
 
/* MSTP32 clocks */
+   CLKDEV_DEV_ID(r8a7779-vin.3, mstp_clks[MSTP120]), /* VIN3 */
CLKDEV_DEV_ID(rcar-pcie, mstp_clks[MSTP116]), /* PCIe */
CLKDEV_DEV_ID(sata_rcar, mstp_clks[MSTP115]), /* SATA */
CLKDEV_DEV_ID(fc60.sata, mstp_clks[MSTP115]), /* SATA w/DT */
CLKDEV_DEV_ID(r8a777x-ether, mstp_clks[MSTP114]), /* Ether */
+   CLKDEV_DEV_ID(r8a7779-vin.0, mstp_clks[MSTP110]), /* VIN0 */
+   CLKDEV_DEV_ID(r8a7779-vin.1, mstp_clks[MSTP109]), /* VIN1 */
+   CLKDEV_DEV_ID(r8a7779-vin.2, mstp_clks[MSTP108]), /* VIN2 */
CLKDEV_DEV_ID(ehci-platform.1, mstp_clks[MSTP101]), /* USB EHCI 
port2 */
CLKDEV_DEV_ID(ohci-platform.1, mstp_clks[MSTP101]), /* USB OHCI 
port2 */
CLKDEV_DEV_ID(ehci-platform.0, mstp_clks[MSTP100]), /* USB EHCI 
port0/1 */
Index: media_tree/arch/arm/mach-shmobile/include/mach/r8a7779.h
===
--- media_tree.orig/arch/arm/mach-shmobile/include/mach/r8a7779.h
+++ media_tree/arch/arm/mach-shmobile/include/mach/r8a7779.h
@@ -5,6 +5,7 @@
 #include linux/pm_domain.h
 #include linux/sh_eth.h
 #include linux/platform_data/usb-rcar-phy.h
+#include linux/platform_data/camera-rcar.h
 
 struct platform_device;
 
@@ -35,6 +36,8 @@ extern void r8a7779_add_standard_devices
 extern void r8a7779_add_standard_devices_dt(void);
 extern void r8a7779_add_ether_device(struct sh_eth_plat_data *pdata);
 extern void r8a7779_add_usb_phy_device(struct rcar_phy_platform_data *pdata);
+extern void r8a7779_add_vin_device(int idx,
+  struct rcar_vin_platform_data *pdata);
 extern void r8a7779_init_late(void);
 extern void r8a7779_clock_init(void);
 extern void r8a7779_pinmux_init(void);
Index: media_tree/arch/arm/mach-shmobile/setup-r8a7779.c
===
--- media_tree.orig/arch/arm/mach-shmobile/setup-r8a7779.c
+++ media_tree/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -559,6 +559,33 @@ static struct 

[PATCH v5 2/3] ARM: shmobile: Marzen: add VIN and ADV7180 support

2013-08-22 Thread Sergei Shtylyov
From: Vladimir Barinov vladimir.bari...@cogentembedded.com

Add ADV7180 platform devices on the Marzen board, configure VIN1/3 pins, and
register VIN1/3 devices with the ADV7180 specific platform data.

Signed-off-by: Vladimir Barinov vladimir.bari...@cogentembedded.com
[Sergei: removed superfluous tabulation and inserted empty lines in the  macro
definition, updated the copyrights, annotated VIN platform data as '__initdata']
Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com

---
Changes since version 3:
- changed the VIN platform device names to be R8A7779 specific.

Changes since version 2:
- annotated 'vin_platform_data' as '__initdata' since they're kmemdup()'ed while
  registering the platform devices anyway.

Changes since the original posting:
- used a macro to define the camera platform devices;
- updated the copyrights;
- refreshed the patch.

 arch/arm/mach-shmobile/board-marzen.c |   44 +-
 1 file changed, 43 insertions(+), 1 deletion(-)

Index: media_tree/arch/arm/mach-shmobile/board-marzen.c
===
--- media_tree.orig/arch/arm/mach-shmobile/board-marzen.c
+++ media_tree/arch/arm/mach-shmobile/board-marzen.c
@@ -1,8 +1,9 @@
 /*
  * marzen board support
  *
- * Copyright (C) 2011  Renesas Solutions Corp.
+ * Copyright (C) 2011, 2013  Renesas Solutions Corp.
  * Copyright (C) 2011  Magnus Damm
+ * Copyright (C) 2013  Cogent Embedded, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -37,6 +38,7 @@
 #include linux/mmc/host.h
 #include linux/mmc/sh_mobile_sdhi.h
 #include linux/mfd/tmio.h
+#include media/soc_camera.h
 #include mach/hardware.h
 #include mach/r8a7779.h
 #include mach/common.h
@@ -178,12 +180,40 @@ static struct platform_device leds_devic
},
 };
 
+static struct rcar_vin_platform_data vin_platform_data __initdata = {
+   .flags  = RCAR_VIN_BT656,
+};
+
+#define MARZEN_CAMERA(idx) \
+static struct i2c_board_info camera##idx##_info = {\
+   I2C_BOARD_INFO(adv7180, 0x20 + (idx)),\
+}; \
+   \
+static struct soc_camera_link iclink##idx##_adv7180 = {\
+   .bus_id = 1 + 2 * (idx),\
+   .i2c_adapter_id = 0,\
+   .board_info = camera##idx##_info,  \
+}; \
+   \
+static struct platform_device camera##idx##_device = { \
+   .name   = soc-camera-pdrv,\
+   .id = idx,  \
+   .dev= { \
+   .platform_data  = iclink##idx##_adv7180,   \
+   },  \
+};
+
+MARZEN_CAMERA(0);
+MARZEN_CAMERA(1);
+
 static struct platform_device *marzen_devices[] __initdata = {
eth_device,
sdhi0_device,
thermal_device,
hspi_device,
leds_device,
+   camera0_device,
+   camera1_device,
 };
 
 static const struct pinctrl_map marzen_pinctrl_map[] = {
@@ -219,6 +249,16 @@ static const struct pinctrl_map marzen_p
/* USB2 */
PIN_MAP_MUX_GROUP_DEFAULT(ehci-platform.1, pfc-r8a7779,
  usb2, usb2),
+   /* VIN1 */
+   PIN_MAP_MUX_GROUP_DEFAULT(r8a7779-vin.1, pfc-r8a7779,
+ vin1_clk, vin1),
+   PIN_MAP_MUX_GROUP_DEFAULT(r8a7779-vin.1, pfc-r8a7779,
+ vin1_data8, vin1),
+   /* VIN3 */
+   PIN_MAP_MUX_GROUP_DEFAULT(r8a7779-vin.3, pfc-r8a7779,
+ vin3_clk, vin3),
+   PIN_MAP_MUX_GROUP_DEFAULT(r8a7779-vin.3, pfc-r8a7779,
+ vin3_data8, vin3),
 };
 
 static void __init marzen_init(void)
@@ -235,6 +275,8 @@ static void __init marzen_init(void)
 
r8a7779_add_standard_devices();
r8a7779_add_usb_phy_device(usb_phy_platform_data);
+   r8a7779_add_vin_device(1, vin_platform_data);
+   r8a7779_add_vin_device(3, vin_platform_data);
platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices));
 }
 
--
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 3/3] ARM: shmobile: Marzen: enable VIN and ADV7180 in defconfig

2013-08-22 Thread Sergei Shtylyov
From: Vladimir Barinov vladimir.bari...@cogentembedded.com

Add the VIN and ADV7180 drivers to 'marzen_defconfig'.

Signed-off-by: Vladimir Barinov vladimir.bari...@cogentembedded.com
Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com

---
 arch/arm/configs/marzen_defconfig |7 +++
 1 file changed, 7 insertions(+)

Index: media_tree/arch/arm/configs/marzen_defconfig
===
--- media_tree.orig/arch/arm/configs/marzen_defconfig
+++ media_tree/arch/arm/configs/marzen_defconfig
@@ -84,6 +84,13 @@ CONFIG_GPIO_RCAR=y
 CONFIG_THERMAL=y
 CONFIG_RCAR_THERMAL=y
 CONFIG_SSB=y
+CONFIG_MEDIA_SUPPORT=y
+CONFIG_MEDIA_CAMERA_SUPPORT=y
+CONFIG_V4L_PLATFORM_DRIVERS=y
+CONFIG_SOC_CAMERA=y
+CONFIG_VIDEO_RCAR_VIN=y
+# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set
+CONFIG_VIDEO_ADV7180=y
 CONFIG_USB=y
 CONFIG_USB_RCAR_PHY=y
 CONFIG_MMC=y
--
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 v6 1/3] ARM: shmobile: r8a7778: add VIN support

2013-08-22 Thread Sergei Shtylyov
From: Vladimir Barinov vladimir.bari...@cogentembedded.com

Add VIN clocks and platform devices on R8A7778 SoC; add function to register
the VIN platform devices.

Signed-off-by: Vladimir Barinov vladimir.bari...@cogentembedded.com
[Sergei: added 'id' parameter check to r8a7778_add_vin_device(), used '*pdata'
in *sizeof* operator, and added an empty line there; renamed some variables,
annotated 'vin[01]_info' and vin[01]_resources[] as '__initdata'.]
Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com

---
Changes since version 5:
- added an empty line in r8a7778_add_vin_device();
- resolved reject, refreshed the patch.

Changes since version 4:
- resolved reject, refreshed the patch.

Changes since version 3:
- changed the VIN platform device names to be R8A7778 specific; 
- resolved reject in mach/r8a7778.h  due to USB patch rework.

Changes from version 2:
- annotated 'vin[01]_info' and vin[01]_resources[] as '__initdata' since they're
  kmemdup()'ed while registering the platform devices anyway;
- refreshed the patch.

 arch/arm/mach-shmobile/clock-r8a7778.c|5 +++
 arch/arm/mach-shmobile/include/mach/r8a7778.h |3 ++
 arch/arm/mach-shmobile/setup-r8a7778.c|   34 ++
 3 files changed, 42 insertions(+)

Index: media_tree/arch/arm/mach-shmobile/clock-r8a7778.c
===
--- media_tree.orig/arch/arm/mach-shmobile/clock-r8a7778.c
+++ media_tree/arch/arm/mach-shmobile/clock-r8a7778.c
@@ -106,6 +106,7 @@ enum {
MSTP331,
MSTP323, MSTP322, MSTP321,
MSTP114,
+   MSTP110, MSTP109,
MSTP100,
MSTP030,
MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, 
MSTP021,
@@ -119,6 +120,8 @@ static struct clk mstp_clks[MSTP_NR] = {
[MSTP322] = SH_CLK_MSTP32(p_clk, MSTPCR3, 22, 0), /* SDHI1 */
[MSTP321] = SH_CLK_MSTP32(p_clk, MSTPCR3, 21, 0), /* SDHI2 */
[MSTP114] = SH_CLK_MSTP32(p_clk, MSTPCR1, 14, 0), /* Ether */
+   [MSTP110] = SH_CLK_MSTP32(s_clk, MSTPCR1, 10, 0), /* VIN0 */
+   [MSTP109] = SH_CLK_MSTP32(s_clk, MSTPCR1,  9, 0), /* VIN1 */
[MSTP100] = SH_CLK_MSTP32(p_clk, MSTPCR1,  0, 0), /* USB0/1 */
[MSTP030] = SH_CLK_MSTP32(p_clk, MSTPCR0, 30, 0), /* I2C0 */
[MSTP029] = SH_CLK_MSTP32(p_clk, MSTPCR0, 29, 0), /* I2C1 */
@@ -146,6 +149,8 @@ static struct clk_lookup lookups[] = {
CLKDEV_DEV_ID(sh_mobile_sdhi.1, mstp_clks[MSTP322]), /* SDHI1 */
CLKDEV_DEV_ID(sh_mobile_sdhi.2, mstp_clks[MSTP321]), /* SDHI2 */
CLKDEV_DEV_ID(r8a777x-ether, mstp_clks[MSTP114]), /* Ether */
+   CLKDEV_DEV_ID(r8a7778-vin.0, mstp_clks[MSTP110]), /* VIN0 */
+   CLKDEV_DEV_ID(r8a7778-vin.1, mstp_clks[MSTP109]), /* VIN1 */
CLKDEV_DEV_ID(ehci-platform, mstp_clks[MSTP100]), /* USB EHCI 
port0/1 */
CLKDEV_DEV_ID(ohci-platform, mstp_clks[MSTP100]), /* USB OHCI 
port0/1 */
CLKDEV_DEV_ID(i2c-rcar.0, mstp_clks[MSTP030]), /* I2C0 */
Index: media_tree/arch/arm/mach-shmobile/include/mach/r8a7778.h
===
--- media_tree.orig/arch/arm/mach-shmobile/include/mach/r8a7778.h
+++ media_tree/arch/arm/mach-shmobile/include/mach/r8a7778.h
@@ -22,6 +22,7 @@
 #include linux/mmc/sh_mobile_sdhi.h
 #include linux/sh_eth.h
 #include linux/platform_data/usb-rcar-phy.h
+#include linux/platform_data/camera-rcar.h
 
 extern void r8a7778_add_standard_devices(void);
 extern void r8a7778_add_standard_devices_dt(void);
@@ -30,6 +31,8 @@ extern void r8a7778_add_usb_phy_device(s
 extern void r8a7778_add_i2c_device(int id);
 extern void r8a7778_add_hspi_device(int id);
 extern void r8a7778_add_mmc_device(struct sh_mmcif_plat_data *info);
+extern void r8a7778_add_vin_device(int id,
+  struct rcar_vin_platform_data *pdata);
 
 extern void r8a7778_init_late(void);
 extern void r8a7778_init_delay(void);
Index: media_tree/arch/arm/mach-shmobile/setup-r8a7778.c
===
--- media_tree.orig/arch/arm/mach-shmobile/setup-r8a7778.c
+++ media_tree/arch/arm/mach-shmobile/setup-r8a7778.c
@@ -333,6 +333,40 @@ void __init r8a7778_add_mmc_device(struc
info, sizeof(*info));
 }
 
+/* VIN */
+#define R8A7778_VIN(idx)   \
+static struct resource vin##idx##_resources[] __initdata = {   \
+   DEFINE_RES_MEM(0xffc5 + 0x1000 * (idx), 0x1000),\
+   DEFINE_RES_IRQ(gic_iid(0x5a)),  \
+}; \
+   \
+static struct platform_device_info vin##idx##_info __initdata = {  \
+   .parent = platform_bus,\
+   .name   = r8a7778-vin,\
+   

[PATCH v6 2/3] ARM: shmobile: BOCK-W: add VIN and ML86V7667 support

2013-08-22 Thread Sergei Shtylyov
From: Vladimir Barinov vladimir.bari...@cogentembedded.com

Add ML86V7667 platform devices on BOCK-W board, configure VIN0/1 pins, and
register VIN0/1 devices with the ML86V7667 specific platform data.

Signed-off-by: Vladimir Barinov vladimir.bari...@cogentembedded.com
[Sergei: some macro/comment cleanup; updated the copyrights, removed duplicate
#include, annotated all platform data as '__initdata', added a сheck for the
'sh_eth' driver being enabled before registering VIN1 due to a pin conflict,
removed superfluous semicolon after iclink[01]_ml86v7667' initializer.]
Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com

---
Changes since version 5:
- resolved reject, refreshed the patch.

Changes since version 4:
- added a сheck for the 'sh_eth' driver being enabled before registering VIN1
  due  to a pin conflict;
- removed superfluous semicolon after iclink[01]_ml86v7667' initializer;
- resolved rejects, refreshed the patch.

Changes since version 3:
- changed the VIN platform device names to be R8A7778 specific; 
- resolved reject due to USB patch rework, refreshed the patch.

Changes since version 2:
- removed duplicate #include linux/pinctrl/machine.h;
- annotated all platform data as '__initdata' since they're kmemdup()'ed while
  registering the platform devices anyway;
- resolved rejects, refreshed the patch.

 arch/arm/mach-shmobile/board-bockw.c |   41 +++
 1 file changed, 41 insertions(+)

Index: media_tree/arch/arm/mach-shmobile/board-bockw.c
===
--- media_tree.orig/arch/arm/mach-shmobile/board-bockw.c
+++ media_tree/arch/arm/mach-shmobile/board-bockw.c
@@ -3,6 +3,7 @@
  *
  * Copyright (C) 2013  Renesas Solutions Corp.
  * Copyright (C) 2013  Kuninori Morimoto kuninori.morimoto...@renesas.com
+ * Copyright (C) 2013  Cogent Embedded, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -28,6 +29,7 @@
 #include linux/smsc911x.h
 #include linux/spi/spi.h
 #include linux/spi/flash.h
+#include media/soc_camera.h
 #include mach/common.h
 #include mach/irqs.h
 #include mach/r8a7778.h
@@ -143,6 +145,25 @@ static struct sh_mmcif_plat_data sh_mmci
  MMC_CAP_NEEDS_POLL,
 };
 
+static struct rcar_vin_platform_data vin_platform_data __initdata = {
+   .flags  = RCAR_VIN_BT656,
+};
+
+/* In the default configuration both decoders reside on I2C bus 0 */
+#define BOCKW_CAMERA(idx)  \
+static struct i2c_board_info camera##idx##_info = {\
+   I2C_BOARD_INFO(ml86v7667, 0x41 + 2 * (idx)),  \
+}; \
+   \
+static struct soc_camera_link iclink##idx##_ml86v7667 __initdata = {   \
+   .bus_id = idx,  \
+   .i2c_adapter_id = 0,\
+   .board_info = camera##idx##_info,  \
+}
+
+BOCKW_CAMERA(0);
+BOCKW_CAMERA(1);
+
 static const struct pinctrl_map bockw_pinctrl_map[] = {
/* Ether */
PIN_MAP_MUX_GROUP_DEFAULT(r8a777x-ether, pfc-r8a7778,
@@ -168,6 +189,16 @@ static const struct pinctrl_map bockw_pi
/* SDHI0 */
PIN_MAP_MUX_GROUP_DEFAULT(sh_mobile_sdhi.0, pfc-r8a7778,
  sdhi0, sdhi0),
+   /* VIN0 */
+   PIN_MAP_MUX_GROUP_DEFAULT(r8a7778-vin.0, pfc-r8a7778,
+ vin0_clk, vin0),
+   PIN_MAP_MUX_GROUP_DEFAULT(r8a7778-vin.0, pfc-r8a7778,
+ vin0_data8, vin0),
+   /* VIN1 */
+   PIN_MAP_MUX_GROUP_DEFAULT(r8a7778-vin.1, pfc-r8a7778,
+ vin1_clk, vin1),
+   PIN_MAP_MUX_GROUP_DEFAULT(r8a7778-vin.1, pfc-r8a7778,
+ vin1_data8, vin1),
 };
 
 #define FPGA   0x1820
@@ -186,6 +217,16 @@ static void __init bockw_init(void)
r8a7778_add_i2c_device(0);
r8a7778_add_hspi_device(0);
r8a7778_add_mmc_device(sh_mmcif_plat);
+   r8a7778_add_vin_device(0, vin_platform_data);
+   /* VIN1 has a pin conflict with Ether */
+   if (!IS_ENABLED(CONFIG_SH_ETH))
+   r8a7778_add_vin_device(1, vin_platform_data);
+   platform_device_register_data(platform_bus, soc-camera-pdrv, 0,
+ iclink0_ml86v7667,
+ sizeof(iclink0_ml86v7667));
+   platform_device_register_data(platform_bus, soc-camera-pdrv, 1,
+ iclink1_ml86v7667,
+ sizeof(iclink1_ml86v7667));
 
i2c_register_board_info(0, i2c0_devices,
ARRAY_SIZE(i2c0_devices));
--
To 

[PATCH v6 3/3] ARM: shmobile: BOCK-W: enable VIN and ML86V7667 in defconfig

2013-08-22 Thread Sergei Shtylyov
From: Vladimir Barinov vladimir.bari...@cogentembedded.com

Add the VIN and ML86V7667 drivers to 'bockw_defconfig'.

Signed-off-by: Vladimir Barinov vladimir.bari...@cogentembedded.com
Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com

---
Changes since version 4:
- resolved reject.

 arch/arm/configs/bockw_defconfig |7 +++
 1 file changed, 7 insertions(+)

Index: media_tree/arch/arm/configs/bockw_defconfig
===
--- media_tree.orig/arch/arm/configs/bockw_defconfig
+++ media_tree/arch/arm/configs/bockw_defconfig
@@ -82,6 +82,13 @@ CONFIG_SERIAL_SH_SCI_CONSOLE=y
 # CONFIG_HWMON is not set
 CONFIG_I2C=y
 CONFIG_I2C_RCAR=y
+CONFIG_MEDIA_SUPPORT=y
+CONFIG_MEDIA_CAMERA_SUPPORT=y
+CONFIG_V4L_PLATFORM_DRIVERS=y
+CONFIG_SOC_CAMERA=y
+CONFIG_VIDEO_RCAR_VIN=y
+# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set
+CONFIG_VIDEO_ML86V7667=y
 CONFIG_SPI=y
 CONFIG_SPI_SH_HSPI=y
 CONFIG_USB=y
--
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 RFC] soc_camera: sensors: make v4l2_clk optional

2013-08-22 Thread Frank Schäfer
Hi Laurent,

Am 21.08.2013 23:20, schrieb Laurent Pinchart:
 Hi Frank,

 On Wednesday 21 August 2013 22:45:17 Frank Schäfer wrote:
 commit 9aea470b soc-camera: switch I2C subdevice drivers to use v4l2-clk
 made a v4l2_clk mandatory for each sensor.
 While this isn't necessary, it also broke the em28xx driver in connection
 with ov2640 subdevices and maybe other drivers outside soc_camera as well.
 While this probably fixes the issue, I don't think it's the way to go.
Why do you want to force all users of these drivers to implement a
v4l2_clk ?
Please don't care about the soc_camera platform only.
Things like this should be optional unless there isn't a good reason to
force their usage.

 The em28xx driver should instead provide a clock.
Maybe. If it makes sense / has sufficient benefits, I'll be glad to
implement it.
But at the moment, I don't see any benefits for em28xx, just the
disadvantage of extra code and memory usage.
I've asked some questions about v4l2-clk with regards to the
em28xx+ov2640 scenario, but haven't got any answers yet. ;)
Can you convice me ?

 If we can fix that in time 
 reverting the patches until the next kernel version would have my preference.
I agree.

Regards,
Frank

 Signed-off-by: Frank Schäfer fschaefer@googlemail.com
 ---
  drivers/media/i2c/soc_camera/imx074.c |   12 ++--
  drivers/media/i2c/soc_camera/mt9m001.c|   13 ++---
  drivers/media/i2c/soc_camera/mt9m111.c|8 +---
  drivers/media/i2c/soc_camera/mt9t031.c|   13 ++---
  drivers/media/i2c/soc_camera/mt9t112.c|7 ---
  drivers/media/i2c/soc_camera/mt9v022.c|   13 ++---
  drivers/media/i2c/soc_camera/ov2640.c |   13 ++---
  drivers/media/i2c/soc_camera/ov5642.c |7 ---
  drivers/media/i2c/soc_camera/ov6650.c |   13 ++---
  drivers/media/i2c/soc_camera/ov772x.c |   13 ++---
  drivers/media/i2c/soc_camera/ov9640.c |   13 ++---
  drivers/media/i2c/soc_camera/ov9740.c |   13 ++---
  drivers/media/i2c/soc_camera/rj54n1cb0c.c |   13 ++---
  drivers/media/i2c/soc_camera/tw9910.c |7 ---
  14 Dateien geändert, 77 Zeilen hinzugefügt(+), 81 Zeilen entfernt(-)

 diff --git a/drivers/media/i2c/soc_camera/imx074.c
 b/drivers/media/i2c/soc_camera/imx074.c index 1d384a3..e7b6124 100644
 --- a/drivers/media/i2c/soc_camera/imx074.c
 +++ b/drivers/media/i2c/soc_camera/imx074.c
 @@ -438,10 +438,8 @@ static int imx074_probe(struct i2c_client *client,
  priv-fmt   = imx074_colour_fmts[0];

  priv-clk = v4l2_clk_get(client-dev, mclk);
 -if (IS_ERR(priv-clk)) {
 -dev_info(client-dev, Error %ld getting clock\n, 
 PTR_ERR(priv-
 clk));
 -return -EPROBE_DEFER;
 -}
 +if (IS_ERR(priv-clk))
 +priv-clk = NULL;

  ret = soc_camera_power_init(client-dev, ssdd);
  if (ret  0)
 @@ -455,7 +453,8 @@ static int imx074_probe(struct i2c_client *client,

  epwrinit:
  eprobe:
 -v4l2_clk_put(priv-clk);
 +if (priv-clk)
 +v4l2_clk_put(priv-clk);
  return ret;
  }

 @@ -465,7 +464,8 @@ static int imx074_remove(struct i2c_client *client)
  struct imx074 *priv = to_imx074(client);

  v4l2_async_unregister_subdev(priv-subdev);
 -v4l2_clk_put(priv-clk);
 +if (priv-clk)
 +v4l2_clk_put(priv-clk);

  if (ssdd-free_bus)
  ssdd-free_bus(ssdd);
 diff --git a/drivers/media/i2c/soc_camera/mt9m001.c
 b/drivers/media/i2c/soc_camera/mt9m001.c index df97033..07af1bc 100644
 --- a/drivers/media/i2c/soc_camera/mt9m001.c
 +++ b/drivers/media/i2c/soc_camera/mt9m001.c
 @@ -685,15 +685,13 @@ static int mt9m001_probe(struct i2c_client *client,
  mt9m001-rect.height= MT9M001_MAX_HEIGHT;

  mt9m001-clk = v4l2_clk_get(client-dev, mclk);
 -if (IS_ERR(mt9m001-clk)) {
 -ret = PTR_ERR(mt9m001-clk);
 -goto eclkget;
 -}
 +if (IS_ERR(mt9m001-clk))
 +mt9m001-clk = NULL;

  ret = mt9m001_video_probe(ssdd, client);
  if (ret) {
 -v4l2_clk_put(mt9m001-clk);
 -eclkget:
 +if (mt9m001-clk)
 +v4l2_clk_put(mt9m001-clk);
  v4l2_ctrl_handler_free(mt9m001-hdl);
  }

 @@ -705,7 +703,8 @@ static int mt9m001_remove(struct i2c_client *client)
  struct mt9m001 *mt9m001 = to_mt9m001(client);
  struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);

 -v4l2_clk_put(mt9m001-clk);
 +if (mt9m001-clk)
 +v4l2_clk_put(mt9m001-clk);
  v4l2_device_unregister_subdev(mt9m001-subdev);
  v4l2_ctrl_handler_free(mt9m001-hdl);
  mt9m001_video_remove(ssdd);
 diff --git a/drivers/media/i2c/soc_camera/mt9m111.c
 b/drivers/media/i2c/soc_camera/mt9m111.c index 6f40566..498f22e 100644
 --- a/drivers/media/i2c/soc_camera/mt9m111.c
 +++ b/drivers/media/i2c/soc_camera/mt9m111.c
 @@ -948,7 +948,7 @@ static int mt9m111_probe(struct i2c_client *client,

  

Re: em28xx + ov2640 and v4l2-clk

2013-08-22 Thread Frank Schäfer
Hi Sylwester,

Am 21.08.2013 23:42, schrieb Sylwester Nawrocki:
 Hi Frank,

 On 08/21/2013 10:39 PM, Frank Schäfer wrote:
 Am 20.08.2013 18:34, schrieb Frank Schäfer:
 Am 20.08.2013 15:38, schrieb Laurent Pinchart:
 Hi Mauro,

 On Sunday 18 August 2013 12:20:08 Mauro Carvalho Chehab wrote:
 Em Sun, 18 Aug 2013 13:40:25 +0200 Frank Schäfer escreveu:
 Am 17.08.2013 12:51, schrieb Guennadi Liakhovetski:
 Hi Frank,
 As I mentioned on the list, I'm currently on a holiday, so,
 replying
 briefly.
 Sorry, I missed that (can't read all mails on the list).

 Since em28xx is a USB device, I conclude, that it's supplying
 clock to
 its components including the ov2640 sensor. So, yes, I think the
 driver
 should export a V4L2 clock.
 Ok, so it's mandatory on purpose ?
 I'll take a deeper into the v4l2-clk code and the
 em28xx/ov2640/soc-camera interaction this week.
 Have a nice holiday !
 commit 9aea470b399d797e88be08985c489855759c6c60
 Author: Guennadi Liakhovetskig.liakhovet...@gmx.de
 Date:   Fri Dec 21 13:01:55 2012 -0300

  [media] soc-camera: switch I2C subdevice drivers to use v4l2-clk

  Instead of centrally enabling and disabling subdevice master
 clocks in
  soc-camera core, let subdevice drivers do that themselves,
 using the
  V4L2 clock API and soc-camera convenience wrappers.

  Signed-off-by: Guennadi Liakhovetskig.liakhovet...@gmx.de
  Acked-by: Hans Verkuilhans.verk...@cisco.com
  Acked-by: Laurent Pinchartlaurent.pinch...@ideasonboard.com
  Signed-off-by: Mauro Carvalho Chehabmche...@redhat.com

 (c/c the ones that acked with this broken changeset)

 We need to fix it ASAP or to revert the ov2640 changes, as some
 em28xx
 cameras are currently broken on 3.10.

 I'll also reject other ports to the async API if the drivers are
 used outside an embedded driver, as no PC driver currently defines
 any clock source. The same applies to regulators.

 Guennadi,

 Next time, please check if the i2c drivers are used outside
 soc_camera
 and apply the fixes where needed, as no regressions are allowed.
 We definitely need to check all users of our sensor drivers when
 making such a
 change. Mistakes happen, so let's fix them.

 Guennadi is on holidays until the end of this week. Would that be
 too late to
 fix the issue (given that 3.10 is already broken) ? The fix
 shouldn't be too
 complex, registering a dummy V4L2 clock in the em28xx driver should
 be enough.
 I would prefer either a) making the clock optional in the senor
 driver(s) or b) implementing a real V4L2 clock.

 Reading the soc-camera code, it looks like NULL-pointers for struct
 v4l2_clk are handled correctly. so a) should be pretty simple:

  priv-clk = v4l2_clk_get(client-dev, mclk);
 -   if (IS_ERR(priv-clk)) {
 -   ret = PTR_ERR(priv-clk);
 -   goto eclkget;
 -   }
 +   if (IS_ERR(priv-clk))
 +   priv-clk = NULL;

 Some additional NULL-pointer checks might be necessary, e.g. before
 calling v4l2_clk_put().

 Tested and that works.
 Patch follows.

 That patch breaks subdevs registration through the v4l2-async. See commit

 ef6672ea35b5bb64ab42e18c1a1ffc717c31588a
 [media] V4L2: mt9m111: switch to asynchronous subdevice probing

 Sensor probe() callback must return EPROBE_DEFER when the clock is not
 found. This cause the sensor's probe() callback to be called again by
 the driver core after some other driver has probed, e.g. the one that
 registers v4l2_clk. If specific error code is not returned from probe()
 the whole registration process breaks.
Urgh... great. :/
So the presence of a clock is used as indicator if the device is ready ?
Honestly, that sounds like a misuse... Is there no other way to check if
the device is ready ?
Please don't get me wrong, I noticed you've been working on the async
subdevice registration patches for quite a long time and I'm sure it
wasn't an easy task.

Btw: only 2 of the 14 drivers return -EPROBE_DEFER when no clock is
found: imx074, mt9m111m.
All others return the error code from v4l2_clk_get(), usually -ENODEV.


 Concerning b): I'm not yet sure if it is really needed/makes sense...
 Who is supposed to configure/enable/disable the clock in a
 constellation
 like em28xx+ov2640 ?
 For UXGA for example, the clock needs to be switched to 12MHz, while
 24MHz is used for smaller reolutions.
 But I'm not sure if it is a good idea to let the sensor driver do the
 switch (to define fixed bindings between resoultions and clock
 frequencies).
 Btw, what if a frequency is requested which isn't supported ? Set the
 clock to the next nearest supported frequency ?

 Regards,
 Frank

 I tried to implement a v4l2_clk for the em28xx driver (not yet beeing
 sure if it really makes sense) and I noticed the following problem:
 The ov2640 driver (as well as all other sensor drivers) seems to have
 specific expectations for the names of the clock.
 The name must me mclk and dev_name must be the device name of the i2c
 client device.
 Is mclk supposed to be a clock type ? 

Re: [PATCH v7] s5k5baf: add camera sensor driver

2013-08-22 Thread Tomasz Figa
Hi Andrzej,

Please see some minor comments inline.

On Wednesday 21 of August 2013 16:41:31 Andrzej Hajda wrote:
 Driver for Samsung S5K5BAF UXGA 1/5 2M CMOS Image Sensor
 with embedded SoC ISP.
 The driver exposes the sensor as two V4L2 subdevices:
 - S5K5BAF-CIS - pure CMOS Image Sensor, fixed 1600x1200 format,
   no controls.
 - S5K5BAF-ISP - Image Signal Processor, formats up to 1600x1200,
   pre/post ISP cropping, downscaling via selection API, controls.
 
 Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
 Signed-off-by: Andrzej Hajda a.ha...@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
 Hi,
 
 This patch incorporates Stephen's suggestions, thanks.
 
 Regards
 Andrzej
 
 v7
 - changed description of 'clock-frequency' DT property
 
 v6
 - endpoint node presence is now optional,
 - added asynchronous subdev registration support and clock
   handling,
 - use named gpios in DT bindings
 
 v5
 - removed hflip/vflip device tree properties
 
 v4
 - GPL changed to GPLv2,
 - bitfields replaced by u8,
 - cosmetic changes,
 - corrected s_stream flow,
 - gpio pins are no longer exported,
 - added I2C addresses to subdev names,
 - CIS subdev registration postponed after
   succesfull HW initialization,
 - added enums for pads,
 - selections are initialized only during probe,
 - default resolution changed to 1600x1200,
 - state-error pattern removed from few other functions,
 - entity link creation moved to registered callback.
 
 v3:
 - narrowed state-error usage to i2c and power errors,
 - private gain controls replaced by red/blue balance user controls,
 - added checks to devicetree gpio node parsing
 
 v2:
 - lower-cased driver name,
 - removed underscore from regulator names,
 - removed platform data code,
 - v4l controls grouped in anonymous structs,
 - added s5k5baf_clear_error function,
 - private controls definitions moved to uapi header file,
 - added v4l2-controls.h reservation for private controls,
 - corrected subdev registered/unregistered code,
 - .log_status sudbev op set to v4l2 helper,
 - moved entity link creation to probe routines,
 - added cleanup on error to probe function.
 ---
  .../devicetree/bindings/media/samsung-s5k5baf.txt  |   59 +
  MAINTAINERS|7 +
  drivers/media/i2c/Kconfig  |7 +
  drivers/media/i2c/Makefile |1 +
  drivers/media/i2c/s5k5baf.c| 2045
  5 files changed, 2119 insertions(+)
  create mode 100644
 Documentation/devicetree/bindings/media/samsung-s5k5baf.txt create mode
 100644 drivers/media/i2c/s5k5baf.c
 
 diff --git a/Documentation/devicetree/bindings/media/samsung-s5k5baf.txt
 b/Documentation/devicetree/bindings/media/samsung-s5k5baf.txt new file
 mode 100644
 index 000..d680d99
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/media/samsung-s5k5baf.txt
 @@ -0,0 +1,59 @@
 +Samsung S5K5BAF UXGA 1/5 2M CMOS Image Sensor with embedded SoC ISP
 +
 +
 +Required properties:
 +
 +- compatible   : samsung,s5k5baf;
 +- reg  : I2C slave address of the sensor;

Can this sensor have an aribitrary slave address or only a set of well 
known possible addresses (e.g. listed in documentation)?

 +- vdda-supply  : analog power supply 2.8V (2.6V to 3.0V);
 +- vddreg-supply: regulator input power supply 1.8V (1.7V to 
1.9V)
 + or 2.8V (2.6V to 3.0);
 +- vddio-supply : I/O power supply 1.8V (1.65V to 1.95V)
 + or 2.8V (2.5V to 3.1V);
 +- stbyn-gpios  : GPIO connected to STDBYN pin;
 +- rstn-gpios   : GPIO connected to RSTN pin;

Both GPIOs above have names suggesting that they are active low. I wonder 
how the GPIO flags cell is interpreted here, namely the polarity bit.

Otherwise the binding looks good.

Best regards,
Tomasz

--
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] v4l: vsp1: Fix mutex double lock at streamon time

2013-08-22 Thread Laurent Pinchart
A mutex_lock() was left when the driver was converted to use the vb2
ioctl helpers, resulting in a deadlock at streamon time. Fix it.

Signed-off-by: Laurent Pinchart laurent.pinchart+rene...@ideasonboard.com
---
 drivers/media/platform/vsp1/vsp1_video.c | 2 --
 1 file changed, 2 deletions(-)

Yet another v3.12 fix for the VSP1 driver. I'm not sure how I've managed to let
this bug slip in. This should hopefully be the last one, sorry for the noise :-/

diff --git a/drivers/media/platform/vsp1/vsp1_video.c 
b/drivers/media/platform/vsp1/vsp1_video.c
index f51f842..714c53e 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -839,8 +839,6 @@ vsp1_video_streamon(struct file *file, void *fh, enum 
v4l2_buf_type type)
struct vsp1_pipeline *pipe;
int ret;
 
-   mutex_lock(video-lock);
-
if (video-queue.owner  video-queue.owner != file-private_data)
return -EBUSY;
 
-- 
Regards,

Laurent Pinchart

--
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: [RFCv3 PATCH 03/10] v4l2-compat-ioctl32: add g/s_matrix support.

2013-08-22 Thread Sakari Ailus
Hi Hans,

On Thu, Aug 22, 2013 at 12:14:17PM +0200, Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 ---
  drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 49 
 +++
  1 file changed, 49 insertions(+)
 
 diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c 
 b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
 index 8f7a6a4..3e5a30f 100644
 --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
 +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
 @@ -777,6 +777,38 @@ static int put_v4l2_subdev_edid32(struct 
 v4l2_subdev_edid *kp, struct v4l2_subde
   return 0;
  }
  
 +struct v4l2_matrix32 {
 + __u32 type;
 + union {
 + __u32 raw[4];
 + } ref;

I sense untested code h(re. :-)

 + struct v4l2_rect rect;
 + compat_caddr_t matrix;
 + __u32 reserved[12];
 +} __attribute__ ((packed));

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 0/3] R8A7779/Marzen R-Car VIN driver support

2013-08-22 Thread Simon Horman
On Fri, Aug 23, 2013 at 01:19:13AM +0400, Sergei Shtylyov wrote:
 Hello.
 
[Resending with a real version #.]
 
Here's the set of 3 patches against the Mauro's 'media_tree.git' repo's
 'master' branch. Here we add the VIN driver platform code for the 
 R8A7779/Marzen
 with ADV7180 I2C video decoder.
 
 [1/3] ARM: shmobile: r8a7779: add VIN support
 [2/3] ARM: shmobile: Marzen: add VIN and ADV7180 support
 [3/3] ARM: shmobile: Marzen: enable VIN and ADV7180 in defconfig
 
 Mauro has kindly agreed to merge this patchset thru his tree to resolve 
 the
 dependency on the driver's platform data header, provided that the maintainer
 ACKs this. Simon, could you ACK the patchset ASAP -- Mauro expects to close 
 his
 tree for 3.12 this weekend or next Monday?

All three patches:

Acked-by: Simon Horman horms+rene...@verge.net.au

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


cron job: media_tree daily build: ERRORS

2013-08-22 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:   Fri Aug 23 04:00:24 CEST 2013
git branch: test
git hash:   5be789fc84a752946f6bdf263b053ed7d4a12a1c
gcc version:i686-linux-gcc (GCC) 4.8.1
sparse version: 0.4.5-rc1
host hardware:  x86_64
host os:3.10.1

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: ERRORS
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: ERRORS
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.31.14-i686: ERRORS
linux-2.6.32.27-i686: ERRORS
linux-2.6.33.7-i686: ERRORS
linux-2.6.34.7-i686: ERRORS
linux-2.6.35.9-i686: ERRORS
linux-2.6.36.4-i686: ERRORS
linux-2.6.37.6-i686: ERRORS
linux-2.6.38.8-i686: ERRORS
linux-2.6.39.4-i686: ERRORS
linux-3.0.60-i686: ERRORS
linux-3.10.1-i686: WARNINGS
linux-3.1.10-i686: ERRORS
linux-3.11-rc1-i686: WARNINGS
linux-3.2.37-i686: ERRORS
linux-3.3.8-i686: ERRORS
linux-3.4.27-i686: ERRORS
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: ERRORS
linux-2.6.32.27-x86_64: ERRORS
linux-2.6.33.7-x86_64: ERRORS
linux-2.6.34.7-x86_64: ERRORS
linux-2.6.35.9-x86_64: ERRORS
linux-2.6.36.4-x86_64: ERRORS
linux-2.6.37.6-x86_64: ERRORS
linux-2.6.38.8-x86_64: ERRORS
linux-2.6.39.4-x86_64: ERRORS
linux-3.0.60-x86_64: ERRORS
linux-3.10.1-x86_64: WARNINGS
linux-3.1.10-x86_64: ERRORS
linux-3.11-rc1-x86_64: WARNINGS
linux-3.2.37-x86_64: ERRORS
linux-3.3.8-x86_64: ERRORS
linux-3.4.27-x86_64: ERRORS
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: 0.4.5-rc1
sparse: ERRORS

Detailed results are available here:

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

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Friday.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 -next] [media] davinci: vpif_display: fix error return code in vpif_probe()

2013-08-22 Thread Wei Yongjun
From: Wei Yongjun yongjun_...@trendmicro.com.cn

Fix to return -ENODEV in the subdevice register error handling
case instead of 0, as done elsewhere in this function.

Introduce by commit 4b8a531e6bb0686203e9cf82a54dfe189de7d5c2.
([media] media: davinci: vpif: display: add V4L2-async support)

Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn
---
 drivers/media/platform/davinci/vpif_display.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/davinci/vpif_display.c 
b/drivers/media/platform/davinci/vpif_display.c
index 6336dfc..0e03b9a 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -1824,6 +1824,7 @@ static __init int vpif_probe(struct platform_device *pdev)
  NULL);
if (!vpif_obj.sd[i]) {
vpif_err(Error registering v4l2 subdevice\n);
+   err = -ENODEV;
goto probe_subdev_out;
}
 

--
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 -next] [media] davinci: vpif_capture: fix error return code in vpif_probe()

2013-08-22 Thread Wei Yongjun
From: Wei Yongjun yongjun_...@trendmicro.com.cn

Fix to return -ENODEV in the subdevice register error handling
case instead of 0, as done elsewhere in this function.

Introduced by commit 873229e4fdf34196aa5d707957c59ba54c25eaba
([media] media: davinci: vpif: capture: add V4L2-async support)

Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn
---
 drivers/media/platform/davinci/vpif_capture.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/davinci/vpif_capture.c 
b/drivers/media/platform/davinci/vpif_capture.c
index 7fbde6d..e4b6a26 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -2160,6 +2160,7 @@ static __init int vpif_probe(struct platform_device *pdev)
 
if (!vpif_obj.sd[i]) {
vpif_err(Error registering v4l2 subdevice\n);
+   err = -ENOMEM;
goto probe_subdev_out;
}
v4l2_info(vpif_obj.v4l2_dev,

--
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 -next] [media] davinci: vpif_display: fix error return code in vpif_probe()

2013-08-22 Thread Prabhakar Lad
Hi Wei,

On Fri, Aug 23, 2013 at 8:29 AM, Wei Yongjun weiyj...@gmail.com wrote:
 From: Wei Yongjun yongjun_...@trendmicro.com.cn

 Fix to return -ENODEV in the subdevice register error handling
 case instead of 0, as done elsewhere in this function.

 Introduce by commit 4b8a531e6bb0686203e9cf82a54dfe189de7d5c2.
 ([media] media: davinci: vpif: display: add V4L2-async support)

This fix is already present in the kernel with commit id
4fa94e224b84be7b2522a0f5ce5b64124f146fac

Regards,
--Prabhakar Lad
--
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 -next] [media] davinci: vpif_display: fix error return code in vpif_probe()

2013-08-22 Thread Prabhakar Lad
Hi Wei

On Fri, Aug 23, 2013 at 8:39 AM, Prabhakar Lad
prabhakar.cse...@gmail.com wrote:
 Hi Wei,

 On Fri, Aug 23, 2013 at 8:29 AM, Wei Yongjun weiyj...@gmail.com wrote:
 From: Wei Yongjun yongjun_...@trendmicro.com.cn

 Fix to return -ENODEV in the subdevice register error handling
 case instead of 0, as done elsewhere in this function.

 Introduce by commit 4b8a531e6bb0686203e9cf82a54dfe189de7d5c2.
 ([media] media: davinci: vpif: display: add V4L2-async support)

 This fix is already present in the kernel with commit id
 4fa94e224b84be7b2522a0f5ce5b64124f146fac

OOps my bad, I over looked it.

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

Regards,
--Prabhakar Lad
--
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 -next] [media] davinci: vpif_capture: fix error return code in vpif_probe()

2013-08-22 Thread Prabhakar Lad
Hi Wei,

Thanks for the patch.

On Fri, Aug 23, 2013 at 8:30 AM, Wei Yongjun weiyj...@gmail.com wrote:
 From: Wei Yongjun yongjun_...@trendmicro.com.cn

 Fix to return -ENODEV in the subdevice register error handling
 case instead of 0, as done elsewhere in this function.

 Introduced by commit 873229e4fdf34196aa5d707957c59ba54c25eaba
 ([media] media: davinci: vpif: capture: add V4L2-async support)

 Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn

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

Regards,
--Prabhakar Lad
--
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 -next] [media] davinci: vpif_capture: fix error return code in vpif_probe()

2013-08-22 Thread Prabhakar Lad
Hi Wei,

I retract my Ack.

On Fri, Aug 23, 2013 at 8:30 AM, Wei Yongjun weiyj...@gmail.com wrote:
 From: Wei Yongjun yongjun_...@trendmicro.com.cn

 Fix to return -ENODEV in the subdevice register error handling
 case instead of 0, as done elsewhere in this function.

 Introduced by commit 873229e4fdf34196aa5d707957c59ba54c25eaba
 ([media] media: davinci: vpif: capture: add V4L2-async support)

 Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn
 ---
  drivers/media/platform/davinci/vpif_capture.c | 1 +
  1 file changed, 1 insertion(+)

 diff --git a/drivers/media/platform/davinci/vpif_capture.c 
 b/drivers/media/platform/davinci/vpif_capture.c
 index 7fbde6d..e4b6a26 100644
 --- a/drivers/media/platform/davinci/vpif_capture.c
 +++ b/drivers/media/platform/davinci/vpif_capture.c
 @@ -2160,6 +2160,7 @@ static __init int vpif_probe(struct platform_device 
 *pdev)

 if (!vpif_obj.sd[i]) {
 vpif_err(Error registering v4l2 
 subdevice\n);
 +   err = -ENOMEM;

This should be err = -ENODEV

Regards,
--Prabhakar Lad
--
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 -next] [media] davinci: vpif_display: fix error return code in vpif_probe()

2013-08-22 Thread yongjun_...@trendmicro.com.cn

-Original Message-
From: Prabhakar Lad [mailto:prabhakar.cse...@gmail.com] 
Sent: 2013年8月23日 11:10
To: Wei Yongjun
Cc: Mauro Carvalho Chehab; Yongjun Wei (RD-CN); linux-media; dlos
Subject: Re: [PATCH -next] [media] davinci: vpif_display: fix error return code 
in vpif_probe()

Hi Wei,

On Fri, Aug 23, 2013 at 8:29 AM, Wei Yongjun weiyj...@gmail.com wrote:
 From: Wei Yongjun yongjun_...@trendmicro.com.cn

 Fix to return -ENODEV in the subdevice register error handling case 
 instead of 0, as done elsewhere in this function.

 Introduce by commit 4b8a531e6bb0686203e9cf82a54dfe189de7d5c2.
 ([media] media: davinci: vpif: display: add V4L2-async support)

This fix is already present in the kernel with commit id 
4fa94e224b84be7b2522a0f5ce5b64124f146fac

Yes, I fix this before, but commit 4b8a531e6bb0686203e9cf82a54dfe189de7d5c2 
reverted this fix.

Regards,
--Prabhakar Lad

table class=TM_EMAIL_NOTICEtrtdpre
TREND MICRO EMAIL NOTICE
The information contained in this email and any attachments is confidential 
and may be subject to copyright or other intellectual property protection. 
If you are not the intended recipient, you are not authorized to use or 
disclose this information, and we request that you notify us by reply mail or
telephone and delete the original message from your mail system.
/pre/td/tr/table