Re: [PATCH v4 3/3] Documentation: of: Document graph bindings

2014-02-27 Thread Tomi Valkeinen
On 26/02/14 17:47, Philipp Zabel wrote:

 Ok, that looks compact enough. I still don't see the need to change make
 the remote-endpoint property required to achieve this, though. On the
 other hand, I wouldn't object to making it mandatory either.

Sure, having remote-endpoint as required doesn't achieve anything
particular as such. I just feel it's cleaner. If you have an endpoint,
it must point to somewhere. Maybe it makes the code a tiny bit simpler.

If we do already have users for this that do not have the
remote-endpoint, then we're stuck with having it as optional. If we
don't, I'd rather have it as mandatory.

In any case, it's not a very important thing either way.

 Of course, it's up to the developer how his dts looks like. But to me it
 makes sense to require the remote-endpoint property, as the endpoint, or
 even the port, doesn't make much sense if there's nothing to connect to.
 
 Please let's not make it mandatory for a port node to contain an
 endpoint. For any device with multiple ports we can't use the simplified
 form above, and only adding the (correctly numbered) port in all the
 board device trees would be a pain.

That's true. I went with having the ports in the board file, for example
on omap3 the dss has two ports, and N900 board uses the second one:

dss {
status = ok;

pinctrl-names = default;
pinctrl-0 = dss_sdi_pins;

vdds_sdi-supply = vaux1;

ports {
#address-cells = 1;
#size-cells = 0;

port@1 {
reg = 1;

sdi_out: endpoint {
remote-endpoint = lcd_in;
datapairs = 2;
};
};
};
};

Here I guess I could have:

dss {
status = ok;

pinctrl-names = default;
pinctrl-0 = dss_sdi_pins;

vdds_sdi-supply = vaux1;
};

dss_sdi_port {
sdi_out: endpoint {
remote-endpoint = lcd_in;
datapairs = 2;
};
};

But I didn't like that as it splits the pincontrol and regulator supply
from the port/endpoint, which are functionally linked together.

Actually, somewhat aside the subject, I'd like to have the pinctrl and
maybe regulator supply also per endpoint, but I didn't see how that
would be possible with the current framework. If a board would need to
endpoints for the same port, most likely it would also need to different
sets of pinctrls.

 Tomi




signature.asc
Description: OpenPGP digital signature


Re: [RFC PATCH] [media]: of: move graph helpers from drivers/media/v4l2-core to drivers/of

2014-02-27 Thread Tomi Valkeinen
On 26/02/14 16:48, Philipp Zabel wrote:

 I would like the document to acknowledge the difference from the
 phandle+args pattern used elsewhere and a description of when it would
 be appropriate to use this instead of a simpler binding.
 
 Alright. The main point of this binding is that the devices may have
 multiple distinct ports that each can be connected to other devices.

The other main point with this binding are multiple endpoints per port.
So you can have, say, a display controller, with single port, which has
two endpoints going to two separate LCD panels.

In physical level that would usually mean that the same pins from the
display controller are connected to two panels. Most likely this would
mean that only one panel can be used at a time, possibly with different
settings (say, 16 RGB pins for one panel, 24 RGB pins for the other).

 Tomi




signature.asc
Description: OpenPGP digital signature


[PATCH for v3.14] videodev2.h: add parenthesis around macro arguments

2014-02-27 Thread Hans Verkuil
bt-width should be (bt)-width, and same for the other fields.

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

diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 6ae7bbe..fe94bb9 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -1059,14 +1059,14 @@ struct v4l2_bt_timings {
 
 /* A few useful defines to calculate the total blanking and frame sizes */
 #define V4L2_DV_BT_BLANKING_WIDTH(bt) \
-   (bt-hfrontporch + bt-hsync + bt-hbackporch)
+   ((bt)-hfrontporch + (bt)-hsync + (bt)-hbackporch)
 #define V4L2_DV_BT_FRAME_WIDTH(bt) \
-   (bt-width + V4L2_DV_BT_BLANKING_WIDTH(bt))
+   ((bt)-width + V4L2_DV_BT_BLANKING_WIDTH(bt))
 #define V4L2_DV_BT_BLANKING_HEIGHT(bt) \
-   (bt-vfrontporch + bt-vsync + bt-vbackporch + \
-bt-il_vfrontporch + bt-il_vsync + bt-il_vbackporch)
+   ((bt)-vfrontporch + (bt)-vsync + (bt)-vbackporch + \
+(bt)-il_vfrontporch + (bt)-il_vsync + (bt)-il_vbackporch)
 #define V4L2_DV_BT_FRAME_HEIGHT(bt) \
-   (bt-height + V4L2_DV_BT_BLANKING_HEIGHT(bt))
+   ((bt)-height + V4L2_DV_BT_BLANKING_HEIGHT(bt))
 
 /** struct v4l2_dv_timings - DV timings
  * @type:  the type of the timings
-- 
1.9.0

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


Re: [PATCH v4 3/3] Documentation: of: Document graph bindings

2014-02-27 Thread Tomi Valkeinen
On 27/02/14 12:52, Philipp Zabel wrote:

 This is a bit verbose, and if your output port is on an encoder device
 with multiple inputs, the correct port number would become a bit
 unintuitive. For example, we'd have to use port@4 as the output encoder
 units that have a 4-port input multiplexer and port@1 for those that
 don't.

Hmm, sorry, I don't follow...

The port numbers should be fixed for a particular device. If the device
has 4 input ports, the output port would always be port@4, no matter how
many of the input ports are actually used.

I don't have anything against having the ports described in the SoC
dtsi. But I do think it may make it a bit unclear that the ports are
from the same device, and share things like pinmuxing. Both approaches
should work fine, afaics.

However, if, instead, we could have the pinmuxing and other relevant
information in the port or endpoint nodes, making the ports independent
of each other and of the device behind them, I argument above would
disappear.

Also, while I'm all for making the dts files clear, I do think the one
writing the dts still needs to go carefully through the binding docs.
Say, a device may need a gpio list with a bunch of gpios. The developer
just needs to read the docs and know that gpio #3 on the list is GPIO_XYZ.

So I don't see it as a major problem that the board developer needs to
know that port@1 on OMAP3's DSS is SDI output.

 Here I guess I could have:

 dss {
  status = ok;

  pinctrl-names = default;
  pinctrl-0 = dss_sdi_pins;

  vdds_sdi-supply = vaux1;
 };
 
 What is supplied by this regulator. Is it the PHY?

Yes.

 Actually, somewhat aside the subject, I'd like to have the pinctrl and
 maybe regulator supply also per endpoint, but I didn't see how that
 would be possible with the current framework. If a board would need to
 endpoints for the same port, most likely it would also need to different
 sets of pinctrls.
 
 I have a usecase for this the other way around. The i.MX6 DISP0 parallel
 display pads can be connected to two different display controllers via
 multiplexers in the pin control block.
 
 parallel-display {
   compatible = fsl,imx-parallel-display;
   #address-cells = 1;
   #size-cells = 0;
 
   port@0 {
   endpoint {
   remote-endpoint = ipu1_di0;
   };
   };
 
   port@1 {
   endpoint {
   remote-endpoint = ipu2_di0;
   };
   };
 
   disp0: port@2 {
   endpoint {
   pinctrl-names = 0, 1;
   pinctrl-0 = pinctrl_disp0_ipu1;
   pinctrl-1 = pinctrl_disp0_ipu2;
   remote-endpoint = lcd_in;
   };
   }
 };
 
 Here, depending on the active input port, the corresponding pin control
 on the output port could be set. This is probably quite driver specific,
 so I don't see yet how the framework should help with this. In any case,
 maybe this is a bit out of scope for the generic graph bindings.

Hmm, why wouldn't you have the pinctrl definitions in the ports 0 and 1,
then, if it's about selecting the active input pins?

I think the pinctrl framework could offer ways to have pinctrl
definitions anywhere in the DT structure. It'd be up to the driver to
point to the pinctrl in the DT, ask the framework to parse them, and
eventually enable/disable the pins.

But yes, it's a bit out of scope =).

 Tomi




signature.asc
Description: OpenPGP digital signature


Re: [REVIEWv2 PATCH 03/15] vb2: fix PREPARE_BUF regression

2014-02-27 Thread Laurent Pinchart
Hi Hans,

Thank you for the patch.

On Tuesday 25 February 2014 13:52:43 Hans Verkuil wrote:
 Fix an incorrect test in vb2_internal_qbuf() where only DEQUEUED buffers
 are allowed. But PREPARED buffers are also OK.
 
 Introduced by commit 4138111a27859dcc56a5592c804dd16bb12a23d1
 (vb2: simplify qbuf/prepare_buf by removing callback).
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com

I wonder how I've managed to ack the commit that broke this without noticing 
the problem :-/ Sorry about that.

Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com

 ---
  drivers/media/v4l2-core/videobuf2-core.c | 8 ++--
  1 file changed, 2 insertions(+), 6 deletions(-)
 
 diff --git a/drivers/media/v4l2-core/videobuf2-core.c
 b/drivers/media/v4l2-core/videobuf2-core.c index f1a2857c..909f367 100644
 --- a/drivers/media/v4l2-core/videobuf2-core.c
 +++ b/drivers/media/v4l2-core/videobuf2-core.c
 @@ -1420,11 +1420,6 @@ static int vb2_internal_qbuf(struct vb2_queue *q,
 struct v4l2_buffer *b) return ret;
 
   vb = q-bufs[b-index];
 - if (vb-state != VB2_BUF_STATE_DEQUEUED) {
 - dprintk(1, %s(): invalid buffer state %d\n, __func__,
 - vb-state);
 - return -EINVAL;
 - }
 
   switch (vb-state) {
   case VB2_BUF_STATE_DEQUEUED:
 @@ -1438,7 +1433,8 @@ static int vb2_internal_qbuf(struct vb2_queue *q,
 struct v4l2_buffer *b) dprintk(1, qbuf: buffer still being prepared\n);
   return -EINVAL;
   default:
 - dprintk(1, qbuf: buffer already in use\n);
 + dprintk(1, %s(): invalid buffer state %d\n, __func__,
 + vb-state);
   return -EINVAL;
   }

-- 
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: [REVIEWv2 PATCH 04/15] vb2: add debugging code to check for unbalanced ops

2014-02-27 Thread Laurent Pinchart
Hi Hans,

Thank you for the patch. This is a pretty useful debugging tool. Please see 
below for two small comments.

On Tuesday 25 February 2014 13:52:44 Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com
 
 When a vb2_queue is freed check if all the mem_ops and queue ops were
 balanced. So the number of calls to e.g. buf_finish has to match the number
 of calls to buf_prepare, etc.
 
 This code is only enabled if CONFIG_VIDEO_ADV_DEBUG is set.
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 Acked-by: Pawel Osciak pa...@osciak.com
 ---
  drivers/media/v4l2-core/videobuf2-core.c | 233 +---
  include/media/videobuf2-core.h   |  43 ++
  2 files changed, 226 insertions(+), 50 deletions(-)
 
 diff --git a/drivers/media/v4l2-core/videobuf2-core.c
 b/drivers/media/v4l2-core/videobuf2-core.c index 909f367..8f1578b 100644
 --- a/drivers/media/v4l2-core/videobuf2-core.c
 +++ b/drivers/media/v4l2-core/videobuf2-core.c
 @@ -33,12 +33,63 @@ module_param(debug, int, 0644);
   printk(KERN_DEBUG vb2:  fmt, ## arg); \
   } while (0)
 
 -#define call_memop(q, op, args...)   \
 - (((q)-mem_ops-op) ?   \
 - ((q)-mem_ops-op(args)) : 0)
 +#ifdef CONFIG_VIDEO_ADV_DEBUG
 +
 +/*
 + * If advanced debugging is on, then count how often each op is called,
 + * which can either be per-buffer or per-queue.
 + *
 + * If the op failed then the 'fail_' variant is called to decrease the
 + * counter. That makes it easy to check that the 'init' and 'cleanup'
 + * (and variations thereof) stay balanced.

It would have been nice to avoid the fail_ variants by not increasing the 
counter when the operation fails, but I suppose that's not possible given that 
what return value indicates an error is operation-specific.

 + */
 +
 +#define call_memop(vb, op, args...)  \
 +({   \
 + struct vb2_queue *_q = (vb)-vb2_queue; \
 + dprintk(2, call_memop(%p, %d, %s)%s\n,\
 + _q, (vb)-v4l2_buf.index, #op,  \
 + _q-mem_ops-op ?  :  (nop));   \
 + (vb)-cnt_mem_ ## op++; \
 + _q-mem_ops-op ? _q-mem_ops-op(args) : 0;\
 +})
 +#define fail_memop(vb, op) ((vb)-cnt_mem_ ## op--)
 +
 +#define call_qop(q, op, args...) \
 +({   \
 + dprintk(2, call_qop(%p, %s)%s\n, q, #op,  \
 + (q)-ops-op ?  :  (nop));  \
 + (q)-cnt_ ## op++;  \
 + (q)-ops-op ? (q)-ops-op(args) : 0;  \
 +})
 +#define fail_qop(q, op) ((q)-cnt_ ## op--)
 +
 +#define call_vb_qop(vb, op, args...) \
 +({   \
 + struct vb2_queue *_q = (vb)-vb2_queue; \
 + dprintk(2, call_vb_qop(%p, %d, %s)%s\n,   \
 + _q, (vb)-v4l2_buf.index, #op,  \
 + _q-ops-op ?  :  (nop));   \
 + (vb)-cnt_ ## op++; \
 + _q-ops-op ? _q-ops-op(args) : 0;\
 +})
 +#define fail_vb_qop(vb, op) ((vb)-cnt_ ## op--)
 +
 +#else
 +
 +#define call_memop(vb, op, args...)  \
 + ((vb)-vb2_queue-mem_ops-op ? (vb)-vb2_queue-mem_ops-op(args) : 0)
 +#define fail_memop(vb, op)
 
  #define call_qop(q, op, args...) \
 - (((q)-ops-op) ? ((q)-ops-op(args)) : 0)
 + ((q)-ops-op ? (q)-ops-op(args) : 0)
 +#define fail_qop(q, op)
 +
 +#define call_vb_qop(vb, op, args...) \
 + ((vb)-vb2_queue-ops-op ? (vb)-vb2_queue-ops-op(args) : 0)
 +#define fail_vb_qop(vb, op)
 +
 +#endif
 
  #define V4L2_BUFFER_MASK_FLAGS   (V4L2_BUF_FLAG_MAPPED | 
V4L2_BUF_FLAG_QUEUED
 | \ V4L2_BUF_FLAG_DONE | V4L2_BUF_FLAG_ERROR | \
 @@ -61,7 +112,7 @@ static int __vb2_buf_mem_alloc(struct vb2_buffer *vb)
   for (plane = 0; plane  vb-num_planes; ++plane) {
   unsigned long size = PAGE_ALIGN(q-plane_sizes[plane]);
 
 - mem_priv = call_memop(q, alloc, q-alloc_ctx[plane],
 + mem_priv = call_memop(vb, alloc, q-alloc_ctx[plane],
 size, q-gfp_flags);
   if (IS_ERR_OR_NULL(mem_priv))
   goto free;
 @@ -73,9 +124,10 @@ static int __vb2_buf_mem_alloc(struct vb2_buffer *vb)
 
   return 0;
  free:
 + fail_memop(vb, alloc);
   /* Free already allocated memory if one of the allocations 

Re: [REVIEWv2 PATCH 05/15] vb2: change result code of buf_finish to void

2014-02-27 Thread Laurent Pinchart
Hi Hans,

Thank you for the patch.

On Tuesday 25 February 2014 13:52:45 Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com
 
 The buf_finish op should always work, so change the return type to void.
 Update the few drivers that use it. Note that buf_finish can be called
 both when the DMA is streaming and when it isn't (during queue_cancel).

I'm not sure what branch this series is based on, but in the latest linuxtv 
master branch buf_finish is only called from vb2_internal_dqbuf(), itself only 
called from vb2_dqbuf() and __vb2_perform_fileio().

I would split the patch in two, one patch to change the buf_finish behaviour 
inside the drivers and update the buf_finish documentation to explain when it 
can be called in more details, and another one to change its return value to 
void.

 Update drivers to check that where appropriate.
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 Acked-by: Pawel Osciak pa...@osciak.com
 Reviewed-by: Pawel Osciak pa...@osciak.com
 ---
  drivers/media/parport/bw-qcam.c |  6 --
  drivers/media/pci/sta2x11/sta2x11_vip.c |  7 +++
  drivers/media/platform/marvell-ccic/mcam-core.c |  3 +--
  drivers/media/usb/pwc/pwc-if.c  | 16 +---
  drivers/media/usb/uvc/uvc_queue.c   |  6 +++---
  drivers/media/v4l2-core/videobuf2-core.c|  6 +-
  drivers/staging/media/go7007/go7007-v4l2.c  |  3 +--
  include/media/videobuf2-core.h  |  2 +-
  8 files changed, 23 insertions(+), 26 deletions(-)
 
 diff --git a/drivers/media/parport/bw-qcam.c
 b/drivers/media/parport/bw-qcam.c index d12bd33..8d69bfb 100644
 --- a/drivers/media/parport/bw-qcam.c
 +++ b/drivers/media/parport/bw-qcam.c
 @@ -667,13 +667,16 @@ static void buffer_queue(struct vb2_buffer *vb)
   vb2_buffer_done(vb, VB2_BUF_STATE_DONE);
  }
 
 -static int buffer_finish(struct vb2_buffer *vb)
 +static void buffer_finish(struct vb2_buffer *vb)
  {
   struct qcam *qcam = vb2_get_drv_priv(vb-vb2_queue);
   void *vbuf = vb2_plane_vaddr(vb, 0);
   int size = vb-vb2_queue-plane_sizes[0];
   int len;
 
 + if (!vb2_is_streaming(vb-vb2_queue))
 + return;
 +
   mutex_lock(qcam-lock);
   parport_claim_or_block(qcam-pdev);
 
 @@ -691,7 +694,6 @@ static int buffer_finish(struct vb2_buffer *vb)
   if (len != size)
   vb-state = VB2_BUF_STATE_ERROR;
   vb2_set_plane_payload(vb, 0, len);
 - return 0;
  }
 
  static struct vb2_ops qcam_video_qops = {
 diff --git a/drivers/media/pci/sta2x11/sta2x11_vip.c
 b/drivers/media/pci/sta2x11/sta2x11_vip.c index e5cfb6c..bb11443 100644
 --- a/drivers/media/pci/sta2x11/sta2x11_vip.c
 +++ b/drivers/media/pci/sta2x11/sta2x11_vip.c
 @@ -327,7 +327,7 @@ static void buffer_queue(struct vb2_buffer *vb)
   }
   spin_unlock(vip-lock);
  }
 -static int buffer_finish(struct vb2_buffer *vb)
 +static void buffer_finish(struct vb2_buffer *vb)
  {
   struct sta2x11_vip *vip = vb2_get_drv_priv(vb-vb2_queue);
   struct vip_buffer *vip_buf = to_vip_buffer(vb);
 @@ -337,9 +337,8 @@ static int buffer_finish(struct vb2_buffer *vb)
   list_del_init(vip_buf-list);
   spin_unlock(vip-lock);
 
 - vip_active_buf_next(vip);
 -
 - return 0;
 + if (vb2_is_streaming(vb-vb2_queue))
 + vip_active_buf_next(vip);
  }
 
  static int start_streaming(struct vb2_queue *vq, unsigned int count)
 diff --git a/drivers/media/platform/marvell-ccic/mcam-core.c
 b/drivers/media/platform/marvell-ccic/mcam-core.c index 32fab30..8b34c48
 100644
 --- a/drivers/media/platform/marvell-ccic/mcam-core.c
 +++ b/drivers/media/platform/marvell-ccic/mcam-core.c
 @@ -1238,7 +1238,7 @@ static int mcam_vb_sg_buf_prepare(struct vb2_buffer
 *vb) return 0;
  }
 
 -static int mcam_vb_sg_buf_finish(struct vb2_buffer *vb)
 +static void mcam_vb_sg_buf_finish(struct vb2_buffer *vb)
  {
   struct mcam_camera *cam = vb2_get_drv_priv(vb-vb2_queue);
   struct sg_table *sg_table = vb2_dma_sg_plane_desc(vb, 0);
 @@ -1246,7 +1246,6 @@ static int mcam_vb_sg_buf_finish(struct vb2_buffer
 *vb) if (sg_table)
   dma_unmap_sg(cam-dev, sg_table-sgl,
   sg_table-nents, DMA_FROM_DEVICE);
 - return 0;
  }
 
  static void mcam_vb_sg_buf_cleanup(struct vb2_buffer *vb)
 diff --git a/drivers/media/usb/pwc/pwc-if.c b/drivers/media/usb/pwc/pwc-if.c
 index abf365a..b9c9f10 100644
 --- a/drivers/media/usb/pwc/pwc-if.c
 +++ b/drivers/media/usb/pwc/pwc-if.c
 @@ -614,17 +614,19 @@ static int buffer_prepare(struct vb2_buffer *vb)
   return 0;
  }
 
 -static int buffer_finish(struct vb2_buffer *vb)
 +static void buffer_finish(struct vb2_buffer *vb)
  {
   struct pwc_device *pdev = vb2_get_drv_priv(vb-vb2_queue);
   struct pwc_frame_buf *buf = container_of(vb, struct pwc_frame_buf, vb);
 
 - /*
 -  * Application has called dqbuf and is getting back a buffer we've
 -  * filled, take the pwc data we've 

Re: [REVIEWv2 PATCH 04/15] vb2: add debugging code to check for unbalanced ops

2014-02-27 Thread Hans Verkuil
On 02/27/14 12:15, Laurent Pinchart wrote:
 Hi Hans,
 
 Thank you for the patch. This is a pretty useful debugging tool. Please see 
 below for two small comments.
 
 On Tuesday 25 February 2014 13:52:44 Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com

 When a vb2_queue is freed check if all the mem_ops and queue ops were
 balanced. So the number of calls to e.g. buf_finish has to match the number
 of calls to buf_prepare, etc.

 This code is only enabled if CONFIG_VIDEO_ADV_DEBUG is set.

 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 Acked-by: Pawel Osciak pa...@osciak.com
 ---
  drivers/media/v4l2-core/videobuf2-core.c | 233 +---
  include/media/videobuf2-core.h   |  43 ++
  2 files changed, 226 insertions(+), 50 deletions(-)

 diff --git a/drivers/media/v4l2-core/videobuf2-core.c
 b/drivers/media/v4l2-core/videobuf2-core.c index 909f367..8f1578b 100644
 --- a/drivers/media/v4l2-core/videobuf2-core.c
 +++ b/drivers/media/v4l2-core/videobuf2-core.c
 @@ -33,12 +33,63 @@ module_param(debug, int, 0644);
  printk(KERN_DEBUG vb2:  fmt, ## arg); \
  } while (0)

 -#define call_memop(q, op, args...)  \
 -(((q)-mem_ops-op) ?   \
 -((q)-mem_ops-op(args)) : 0)
 +#ifdef CONFIG_VIDEO_ADV_DEBUG
 +
 +/*
 + * If advanced debugging is on, then count how often each op is called,
 + * which can either be per-buffer or per-queue.
 + *
 + * If the op failed then the 'fail_' variant is called to decrease the
 + * counter. That makes it easy to check that the 'init' and 'cleanup'
 + * (and variations thereof) stay balanced.
 
 It would have been nice to avoid the fail_ variants by not increasing the 
 counter when the operation fails, but I suppose that's not possible given 
 that 
 what return value indicates an error is operation-specific.

Yeah, I tried to come up with the least messy solution and this was it.

 
 + */
 +
 +#define call_memop(vb, op, args...) \
 +({  \
 +struct vb2_queue *_q = (vb)-vb2_queue; \
 +dprintk(2, call_memop(%p, %d, %s)%s\n,\
 +_q, (vb)-v4l2_buf.index, #op,  \
 +_q-mem_ops-op ?  :  (nop));   \
 +(vb)-cnt_mem_ ## op++; \
 +_q-mem_ops-op ? _q-mem_ops-op(args) : 0;\
 +})
 +#define fail_memop(vb, op) ((vb)-cnt_mem_ ## op--)
 +
 +#define call_qop(q, op, args...)\
 +({  \
 +dprintk(2, call_qop(%p, %s)%s\n, q, #op,  \
 +(q)-ops-op ?  :  (nop));  \
 +(q)-cnt_ ## op++;  \
 +(q)-ops-op ? (q)-ops-op(args) : 0;  \
 +})
 +#define fail_qop(q, op) ((q)-cnt_ ## op--)
 +
 +#define call_vb_qop(vb, op, args...)
 \
 +({  \
 +struct vb2_queue *_q = (vb)-vb2_queue; \
 +dprintk(2, call_vb_qop(%p, %d, %s)%s\n,   \
 +_q, (vb)-v4l2_buf.index, #op,  \
 +_q-ops-op ?  :  (nop));   \
 +(vb)-cnt_ ## op++; \
 +_q-ops-op ? _q-ops-op(args) : 0;\
 +})
 +#define fail_vb_qop(vb, op) ((vb)-cnt_ ## op--)
 +
 +#else
 +
 +#define call_memop(vb, op, args...) \
 +((vb)-vb2_queue-mem_ops-op ? (vb)-vb2_queue-mem_ops-op(args) : 0)
 +#define fail_memop(vb, op)

  #define call_qop(q, op, args...)\
 -(((q)-ops-op) ? ((q)-ops-op(args)) : 0)
 +((q)-ops-op ? (q)-ops-op(args) : 0)
 +#define fail_qop(q, op)
 +
 +#define call_vb_qop(vb, op, args...)
 \
 +((vb)-vb2_queue-ops-op ? (vb)-vb2_queue-ops-op(args) : 0)
 +#define fail_vb_qop(vb, op)
 +
 +#endif

  #define V4L2_BUFFER_MASK_FLAGS  (V4L2_BUF_FLAG_MAPPED | 
 V4L2_BUF_FLAG_QUEUED
 | \ V4L2_BUF_FLAG_DONE | V4L2_BUF_FLAG_ERROR | \
 @@ -61,7 +112,7 @@ static int __vb2_buf_mem_alloc(struct vb2_buffer *vb)
  for (plane = 0; plane  vb-num_planes; ++plane) {
  unsigned long size = PAGE_ALIGN(q-plane_sizes[plane]);

 -mem_priv = call_memop(q, alloc, q-alloc_ctx[plane],
 +mem_priv = call_memop(vb, alloc, q-alloc_ctx[plane],
size, q-gfp_flags);
  if (IS_ERR_OR_NULL(mem_priv))
  goto free;
 @@ -73,9 +124,10 @@ static int __vb2_buf_mem_alloc(struct vb2_buffer *vb)

  return 0;
  

Re: [REVIEWv2 PATCH 05/15] vb2: change result code of buf_finish to void

2014-02-27 Thread Laurent Pinchart
On Thursday 27 February 2014 12:23:58 Laurent Pinchart wrote:
 On Tuesday 25 February 2014 13:52:45 Hans Verkuil wrote:
  From: Hans Verkuil hans.verk...@cisco.com
  
  The buf_finish op should always work, so change the return type to void.
  Update the few drivers that use it. Note that buf_finish can be called
  both when the DMA is streaming and when it isn't (during queue_cancel).
 
 I'm not sure what branch this series is based on, but in the latest linuxtv
 master branch buf_finish is only called from vb2_internal_dqbuf(), itself
 only called from vb2_dqbuf() and __vb2_perform_fileio().

And I should have read the next patches before commenting on this :-)

 I would split the patch in two, one patch to change the buf_finish behaviour
 inside the drivers and update the buf_finish documentation to explain when
 it can be called in more details, and another one to change its return
 value to void.

Let's reorder the patches if you don't mind. I would still split this as 
described in 5.1 and 5.2. I would then move 5.2 before 5.1, and either squash 
6 with 5.1 or move 6 before 5.1.

  Update drivers to check that where appropriate.
  
  Signed-off-by: Hans Verkuil hans.verk...@cisco.com
  Acked-by: Pawel Osciak pa...@osciak.com
  Reviewed-by: Pawel Osciak pa...@osciak.com
  ---
  
   drivers/media/parport/bw-qcam.c |  6 --
   drivers/media/pci/sta2x11/sta2x11_vip.c |  7 +++
   drivers/media/platform/marvell-ccic/mcam-core.c |  3 +--
   drivers/media/usb/pwc/pwc-if.c  | 16 +---
   drivers/media/usb/uvc/uvc_queue.c   |  6 +++---
   drivers/media/v4l2-core/videobuf2-core.c|  6 +-
   drivers/staging/media/go7007/go7007-v4l2.c  |  3 +--
   include/media/videobuf2-core.h  |  2 +-
   8 files changed, 23 insertions(+), 26 deletions(-)
  
  diff --git a/drivers/media/parport/bw-qcam.c
  b/drivers/media/parport/bw-qcam.c index d12bd33..8d69bfb 100644
  --- a/drivers/media/parport/bw-qcam.c
  +++ b/drivers/media/parport/bw-qcam.c
  @@ -667,13 +667,16 @@ static void buffer_queue(struct vb2_buffer *vb)
  
  vb2_buffer_done(vb, VB2_BUF_STATE_DONE);
   
   }
  
  -static int buffer_finish(struct vb2_buffer *vb)
  +static void buffer_finish(struct vb2_buffer *vb)
  
   {
   
  struct qcam *qcam = vb2_get_drv_priv(vb-vb2_queue);
  void *vbuf = vb2_plane_vaddr(vb, 0);
  int size = vb-vb2_queue-plane_sizes[0];
  int len;
  
  +   if (!vb2_is_streaming(vb-vb2_queue))
  +   return;
  +
  
  mutex_lock(qcam-lock);
  parport_claim_or_block(qcam-pdev);
  
  @@ -691,7 +694,6 @@ static int buffer_finish(struct vb2_buffer *vb)
  
  if (len != size)
  
  vb-state = VB2_BUF_STATE_ERROR;
  
  vb2_set_plane_payload(vb, 0, len);
  
  -   return 0;
  
   }
   
   static struct vb2_ops qcam_video_qops = {
  
  diff --git a/drivers/media/pci/sta2x11/sta2x11_vip.c
  b/drivers/media/pci/sta2x11/sta2x11_vip.c index e5cfb6c..bb11443 100644
  --- a/drivers/media/pci/sta2x11/sta2x11_vip.c
  +++ b/drivers/media/pci/sta2x11/sta2x11_vip.c
  @@ -327,7 +327,7 @@ static void buffer_queue(struct vb2_buffer *vb)
  
  }
  spin_unlock(vip-lock);
   
   }
  
  -static int buffer_finish(struct vb2_buffer *vb)
  +static void buffer_finish(struct vb2_buffer *vb)
  
   {
   
  struct sta2x11_vip *vip = vb2_get_drv_priv(vb-vb2_queue);
  struct vip_buffer *vip_buf = to_vip_buffer(vb);
  
  @@ -337,9 +337,8 @@ static int buffer_finish(struct vb2_buffer *vb)
  
  list_del_init(vip_buf-list);
  spin_unlock(vip-lock);
  
  -   vip_active_buf_next(vip);
  -
  -   return 0;
  +   if (vb2_is_streaming(vb-vb2_queue))
  +   vip_active_buf_next(vip);
  
   }
   
   static int start_streaming(struct vb2_queue *vq, unsigned int count)
  
  diff --git a/drivers/media/platform/marvell-ccic/mcam-core.c
  b/drivers/media/platform/marvell-ccic/mcam-core.c index 32fab30..8b34c48
  100644
  --- a/drivers/media/platform/marvell-ccic/mcam-core.c
  +++ b/drivers/media/platform/marvell-ccic/mcam-core.c
  @@ -1238,7 +1238,7 @@ static int mcam_vb_sg_buf_prepare(struct vb2_buffer
  *vb) return 0;
  
   }
  
  -static int mcam_vb_sg_buf_finish(struct vb2_buffer *vb)
  +static void mcam_vb_sg_buf_finish(struct vb2_buffer *vb)
  
   {
   
  struct mcam_camera *cam = vb2_get_drv_priv(vb-vb2_queue);
  struct sg_table *sg_table = vb2_dma_sg_plane_desc(vb, 0);
  
  @@ -1246,7 +1246,6 @@ static int mcam_vb_sg_buf_finish(struct vb2_buffer
  *vb) if (sg_table)
  
  dma_unmap_sg(cam-dev, sg_table-sgl,
  
  sg_table-nents, DMA_FROM_DEVICE);
  
  -   return 0;
  
   }
   
   static void mcam_vb_sg_buf_cleanup(struct vb2_buffer *vb)
  
  diff --git a/drivers/media/usb/pwc/pwc-if.c
  b/drivers/media/usb/pwc/pwc-if.c index abf365a..b9c9f10 100644
  --- a/drivers/media/usb/pwc/pwc-if.c
  +++ b/drivers/media/usb/pwc/pwc-if.c
  @@ -614,17 +614,19 

Re: [REVIEWv2 PATCH 05/15] vb2: change result code of buf_finish to void

2014-02-27 Thread Laurent Pinchart
And one more separate comment.

On Tuesday 25 February 2014 13:52:45 Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com
 
 The buf_finish op should always work, so change the return type to void.
 Update the few drivers that use it. Note that buf_finish can be called
 both when the DMA is streaming and when it isn't (during queue_cancel).
 Update drivers to check that where appropriate.
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 Acked-by: Pawel Osciak pa...@osciak.com
 Reviewed-by: Pawel Osciak pa...@osciak.com
 ---
  drivers/media/parport/bw-qcam.c |  6 --
  drivers/media/pci/sta2x11/sta2x11_vip.c |  7 +++
  drivers/media/platform/marvell-ccic/mcam-core.c |  3 +--
  drivers/media/usb/pwc/pwc-if.c  | 16 +---
  drivers/media/usb/uvc/uvc_queue.c   |  6 +++---
  drivers/media/v4l2-core/videobuf2-core.c|  6 +-
  drivers/staging/media/go7007/go7007-v4l2.c  |  3 +--
  include/media/videobuf2-core.h  |  2 +-
  8 files changed, 23 insertions(+), 26 deletions(-)
 
 diff --git a/drivers/media/parport/bw-qcam.c
 b/drivers/media/parport/bw-qcam.c index d12bd33..8d69bfb 100644
 --- a/drivers/media/parport/bw-qcam.c
 +++ b/drivers/media/parport/bw-qcam.c
 @@ -667,13 +667,16 @@ static void buffer_queue(struct vb2_buffer *vb)
   vb2_buffer_done(vb, VB2_BUF_STATE_DONE);
  }
 
 -static int buffer_finish(struct vb2_buffer *vb)
 +static void buffer_finish(struct vb2_buffer *vb)
  {
   struct qcam *qcam = vb2_get_drv_priv(vb-vb2_queue);
   void *vbuf = vb2_plane_vaddr(vb, 0);
   int size = vb-vb2_queue-plane_sizes[0];
   int len;
 
 + if (!vb2_is_streaming(vb-vb2_queue))
 + return;
 +
   mutex_lock(qcam-lock);
   parport_claim_or_block(qcam-pdev);
 
 @@ -691,7 +694,6 @@ static int buffer_finish(struct vb2_buffer *vb)
   if (len != size)
   vb-state = VB2_BUF_STATE_ERROR;
   vb2_set_plane_payload(vb, 0, len);
 - return 0;
  }
 
  static struct vb2_ops qcam_video_qops = {
 diff --git a/drivers/media/pci/sta2x11/sta2x11_vip.c
 b/drivers/media/pci/sta2x11/sta2x11_vip.c index e5cfb6c..bb11443 100644
 --- a/drivers/media/pci/sta2x11/sta2x11_vip.c
 +++ b/drivers/media/pci/sta2x11/sta2x11_vip.c
 @@ -327,7 +327,7 @@ static void buffer_queue(struct vb2_buffer *vb)
   }
   spin_unlock(vip-lock);
  }
 -static int buffer_finish(struct vb2_buffer *vb)
 +static void buffer_finish(struct vb2_buffer *vb)
  {
   struct sta2x11_vip *vip = vb2_get_drv_priv(vb-vb2_queue);
   struct vip_buffer *vip_buf = to_vip_buffer(vb);
 @@ -337,9 +337,8 @@ static int buffer_finish(struct vb2_buffer *vb)
   list_del_init(vip_buf-list);
   spin_unlock(vip-lock);
 
 - vip_active_buf_next(vip);
 -
 - return 0;
 + if (vb2_is_streaming(vb-vb2_queue))
 + vip_active_buf_next(vip);
  }
 
  static int start_streaming(struct vb2_queue *vq, unsigned int count)
 diff --git a/drivers/media/platform/marvell-ccic/mcam-core.c
 b/drivers/media/platform/marvell-ccic/mcam-core.c index 32fab30..8b34c48
 100644
 --- a/drivers/media/platform/marvell-ccic/mcam-core.c
 +++ b/drivers/media/platform/marvell-ccic/mcam-core.c
 @@ -1238,7 +1238,7 @@ static int mcam_vb_sg_buf_prepare(struct vb2_buffer
 *vb) return 0;
  }
 
 -static int mcam_vb_sg_buf_finish(struct vb2_buffer *vb)
 +static void mcam_vb_sg_buf_finish(struct vb2_buffer *vb)
  {
   struct mcam_camera *cam = vb2_get_drv_priv(vb-vb2_queue);
   struct sg_table *sg_table = vb2_dma_sg_plane_desc(vb, 0);
 @@ -1246,7 +1246,6 @@ static int mcam_vb_sg_buf_finish(struct vb2_buffer
 *vb) if (sg_table)
   dma_unmap_sg(cam-dev, sg_table-sgl,
   sg_table-nents, DMA_FROM_DEVICE);
 - return 0;
  }
 
  static void mcam_vb_sg_buf_cleanup(struct vb2_buffer *vb)
 diff --git a/drivers/media/usb/pwc/pwc-if.c b/drivers/media/usb/pwc/pwc-if.c
 index abf365a..b9c9f10 100644
 --- a/drivers/media/usb/pwc/pwc-if.c
 +++ b/drivers/media/usb/pwc/pwc-if.c
 @@ -614,17 +614,19 @@ static int buffer_prepare(struct vb2_buffer *vb)
   return 0;
  }
 
 -static int buffer_finish(struct vb2_buffer *vb)
 +static void buffer_finish(struct vb2_buffer *vb)
  {
   struct pwc_device *pdev = vb2_get_drv_priv(vb-vb2_queue);
   struct pwc_frame_buf *buf = container_of(vb, struct pwc_frame_buf, vb);
 
 - /*
 -  * Application has called dqbuf and is getting back a buffer we've
 -  * filled, take the pwc data we've stored in buf-data and decompress
 -  * it into a usable format, storing the result in the vb2_buffer
 -  */
 - return pwc_decompress(pdev, buf);
 + if (vb-state == VB2_BUF_STATE_DONE) {
 + /*
 +  * Application has called dqbuf and is getting back a buffer 
 we've
 +  * filled, take the pwc data we've stored in buf-data and 
 decompress
 +  * it into a usable format, storing the result in the 

Re: [REVIEWv2 PATCH 06/15] vb2: add note that buf_finish can be called with !vb2_is_streaming()

2014-02-27 Thread Laurent Pinchart
Hi Hans,

Thank you for the patch.

On Tuesday 25 February 2014 13:52:46 Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com
 
 Drivers need to be aware that buf_finish can be called when there is no
 streaming going on, so make a note of that.
 
 Also add a bunch of missing periods at the end of sentences.
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 Acked-by: Pawel Osciak pa...@osciak.com
 ---
  include/media/videobuf2-core.h | 44 ---
  1 file changed, 23 insertions(+), 21 deletions(-)
 
 diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
 index f443ce0..82b7f0f 100644
 --- a/include/media/videobuf2-core.h
 +++ b/include/media/videobuf2-core.h

[snip]

   * @buf_finish:  called before every dequeue of the buffer back 
 to
   *   userspace; drivers may perform any operations required
 - *   before userspace accesses the buffer; optional
 + *   before userspace accesses the buffer; optional. Note:
 + *   this op can be called as well when vb2_is_streaming()
 + *   returns false!

Based on patch 05/15 several drivers assumed that buf_finish is only be called 
when the buffer is to be dequeued to userspace, and performed operations such 
as decompressing the image (yuck...), updating buffer fields such as the 
timestamp, ... If I understand the problem correctly, those operations are 
just a waste of CPU cycles if the buffer will not be returned to userspace, 
hence the driver changes in patch 05/15.

I would document that explicitly here to tell driver developers that 
buf_finish will be called for every buffer that has been queued, and that 
operations related to updating the buffer for userspace can be skipped if the 
queue isn't streaming.

-- 
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: [REVIEWv2 PATCH 07/15] vb2: call buf_finish from __dqbuf

2014-02-27 Thread Laurent Pinchart
Hi Hans,

On Tuesday 25 February 2014 13:52:47 Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com
 
 This ensures that it is also called from queue_cancel, which also calls
 __dqbuf(). Without this change any time queue_cancel is called while
 streaming the buf_finish op will not be called and any driver cleanup
 will not happen.
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 Acked-by: Pawel Osciak pa...@osciak.com
 ---
  drivers/media/v4l2-core/videobuf2-core.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/media/v4l2-core/videobuf2-core.c
 b/drivers/media/v4l2-core/videobuf2-core.c index 59bfd85..b5142e5 100644
 --- a/drivers/media/v4l2-core/videobuf2-core.c
 +++ b/drivers/media/v4l2-core/videobuf2-core.c
 @@ -1758,6 +1758,8 @@ static void __vb2_dqbuf(struct vb2_buffer *vb)
   if (vb-state == VB2_BUF_STATE_DEQUEUED)
   return;
 
 + call_vb_qop(vb, buf_finish, vb);
 +
   vb-state = VB2_BUF_STATE_DEQUEUED;
 
   /* unmap DMABUF buffer */
 @@ -1783,8 +1785,6 @@ static int vb2_internal_dqbuf(struct vb2_queue *q,
 struct v4l2_buffer *b, bool n if (ret  0)
   return ret;
 
 - call_vb_qop(vb, buf_finish, vb);
 -
   switch (vb-state) {
   case VB2_BUF_STATE_DONE:
   dprintk(3, dqbuf: Returning done buffer\n);

This will cause an issue with the uvcvideo driver (and possibly others) if I'm 
not mistaken. To give a bit more context, we currently have the following code 
in vb2_internal_dqbuf.

ret = call_qop(q, buf_finish, vb);
if (ret) {
dprintk(1, dqbuf: buffer finish failed\n);
return ret;
}

switch (vb-state) {
case VB2_BUF_STATE_DONE:
dprintk(3, dqbuf: Returning done buffer\n);
break;
case VB2_BUF_STATE_ERROR:
dprintk(3, dqbuf: Returning done buffer with errors\n);
break;
default:
dprintk(1, dqbuf: Invalid buffer state\n);
return -EINVAL;
}

/* Fill buffer information for the userspace */
__fill_v4l2_buffer(vb, b);
/* Remove from videobuf queue */
list_del(vb-queued_entry);
/* go back to dequeued state */
__vb2_dqbuf(vb);

You're thus effectively moving the buf_finish call from before 
__fill_v4l2_buffer() to after it. As the buf_finish operation in uvcvideo 
fills the vb2 timestamp, the timestamp copied to userspace will be wrong.

Other drivers may fill other vb2 fields that need to be copied to userspace as 
well. You should also double check that no driver modifies the vb2 state in 
the buf_finish operation. Expanding the buf_finish documentation to tell what 
drivers are allowed to do could be nice.

-- 
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 00/16] sleep_on removal, second try

2014-02-27 Thread Geert Uytterhoeven
Hi Michael, Arnd,

On Thu, Feb 27, 2014 at 7:37 AM, Michael Schmitz
schm...@biophys.uni-duesseldorf.de wrote:
 It's been a while since the first submission of these patches,
 but a lot of them have made it into linux-next already, so here
 is the stuff that is not merged yet, hopefully addressing all
 the comments.

 Geert and Michael: the I was expecting the ataflop and atari_scsi
 patches to be merged already, based on earlier discussion.
 Can you apply them to the linux-m68k tree, or do you prefer
 them to go through the scsi and block maintainers?

 Not sure what we decided to do - I'd prefer to double-check the latest ones
 first, but I'd be OK with these to go via m68k.

 Maybe Geert waits for acks from linux-scsi and linux-block? (The rest of my
 patches to Atari SCSI still awaits comment there.)

I was waiting for a final confirmation. I was under the impression some rework
was needed, and seeing Michael's NAK confirms that.

I'd be glad to take them through the m68k tree (for 3.15), once they have
received testing and Michael's ACK. Or the block resp. SCSI maintainers can
take them if they prefer, which apparently already happened for 01/16.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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: [REVIEWv2 PATCH 09/15] vb2: rename queued_count to owned_by_drv_count

2014-02-27 Thread Laurent Pinchart
Hi Hans,

Thank you for the patch.

On Tuesday 25 February 2014 13:52:49 Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com
 
 'queued_count' is a bit vague since it is not clear to which queue it
 refers to: the vb2 internal list of buffers or the driver-owned list
 of buffers.
 
 Rename to make it explicit.
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 Acked-by: Pawel Osciak pa...@osciak.com

Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com

 ---
  drivers/media/v4l2-core/videobuf2-core.c | 10 +-
  include/media/videobuf2-core.h   |  4 ++--
  2 files changed, 7 insertions(+), 7 deletions(-)
 
 diff --git a/drivers/media/v4l2-core/videobuf2-core.c
 b/drivers/media/v4l2-core/videobuf2-core.c index eefcff7..2a7815c 100644
 --- a/drivers/media/v4l2-core/videobuf2-core.c
 +++ b/drivers/media/v4l2-core/videobuf2-core.c
 @@ -1071,7 +1071,7 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum
 vb2_buffer_state state) spin_lock_irqsave(q-done_lock, flags);
   vb-state = state;
   list_add_tail(vb-done_entry, q-done_list);
 - atomic_dec(q-queued_count);
 + atomic_dec(q-owned_by_drv_count);
   spin_unlock_irqrestore(q-done_lock, flags);
 
   /* Inform any processes that may be waiting for buffers */
 @@ -1402,7 +1402,7 @@ static void __enqueue_in_driver(struct vb2_buffer *vb)
 unsigned int plane;
 
   vb-state = VB2_BUF_STATE_ACTIVE;
 - atomic_inc(q-queued_count);
 + atomic_inc(q-owned_by_drv_count);
 
   /* sync buffers */
   for (plane = 0; plane  vb-num_planes; ++plane)
 @@ -1554,7 +1554,7 @@ static int vb2_start_streaming(struct vb2_queue *q)
   int ret;
 
   /* Tell the driver to start streaming */
 - ret = call_qop(q, start_streaming, q, atomic_read(q-queued_count));
 + ret = call_qop(q, start_streaming, q,
 atomic_read(q-owned_by_drv_count)); if (ret)
   fail_qop(q, start_streaming);
 
 @@ -1775,7 +1775,7 @@ int vb2_wait_for_all_buffers(struct vb2_queue *q)
   }
 
   if (!q-retry_start_streaming)
 - wait_event(q-done_wq, !atomic_read(q-queued_count));
 + wait_event(q-done_wq, !atomic_read(q-owned_by_drv_count));
   return 0;
  }
  EXPORT_SYMBOL_GPL(vb2_wait_for_all_buffers);
 @@ -1907,7 +1907,7 @@ static void __vb2_queue_cancel(struct vb2_queue *q)
* has not already dequeued before initiating cancel.
*/
   INIT_LIST_HEAD(q-done_list);
 - atomic_set(q-queued_count, 0);
 + atomic_set(q-owned_by_drv_count, 0);
   wake_up_all(q-done_wq);
 
   /*
 diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
 index 82b7f0f..adaffed 100644
 --- a/include/media/videobuf2-core.h
 +++ b/include/media/videobuf2-core.h
 @@ -353,7 +353,7 @@ struct v4l2_fh;
   * @bufs:videobuf buffer structures
   * @num_buffers: number of allocated/used buffers
   * @queued_list: list of buffers currently queued from userspace
 - * @queued_count: number of buffers owned by the driver
 + * @owned_by_drv_count: number of buffers owned by the driver
   * @done_list:   list of buffers ready to be dequeued to userspace
   * @done_lock:   lock to protect done_list list
   * @done_wq: waitqueue for processes waiting for buffers ready to be
 dequeued @@ -385,7 +385,7 @@ struct vb2_queue {
 
   struct list_headqueued_list;
 
 - atomic_tqueued_count;
 + atomic_towned_by_drv_count;
   struct list_headdone_list;
   spinlock_t  done_lock;
   wait_queue_head_t   done_wq;

-- 
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: [REVIEWv2 PATCH 10/15] vb2: don't init the list if there are still buffers

2014-02-27 Thread Laurent Pinchart
Hi Hans,

Thank you for the patch.

On Tuesday 25 February 2014 13:52:50 Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com
 
 __vb2_queue_free() would init the queued_list at all times, even if
 q-num_buffers  0. This should only happen if num_buffers == 0.
 
 This situation can happen if a CREATE_BUFFERS call couldn't allocate
 enough buffers and had to free those it did manage to allocate before
 returning an error.
 
 While we're at it: __vb2_queue_alloc() returns the number of buffers
 allocated, not an error code. So stick the result in allocated_buffers
 instead of ret as that's very confusing.
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com

Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com

 ---
  drivers/media/v4l2-core/videobuf2-core.c | 29 +
 1 file changed, 17 insertions(+), 12 deletions(-)
 
 diff --git a/drivers/media/v4l2-core/videobuf2-core.c
 b/drivers/media/v4l2-core/videobuf2-core.c index 2a7815c..90374c0 100644
 --- a/drivers/media/v4l2-core/videobuf2-core.c
 +++ b/drivers/media/v4l2-core/videobuf2-core.c
 @@ -452,9 +452,10 @@ static int __vb2_queue_free(struct vb2_queue *q,
 unsigned int buffers) }
 
   q-num_buffers -= buffers;
 - if (!q-num_buffers)
 + if (!q-num_buffers) {
   q-memory = 0;
 - INIT_LIST_HEAD(q-queued_list);
 + INIT_LIST_HEAD(q-queued_list);
 + }
   return 0;
  }
 
 @@ -820,14 +821,12 @@ static int __reqbufs(struct vb2_queue *q, struct
 v4l2_requestbuffers *req) }
 
   /* Finally, allocate buffers and video memory */
 - ret = __vb2_queue_alloc(q, req-memory, num_buffers, num_planes);
 - if (ret == 0) {
 + allocated_buffers = __vb2_queue_alloc(q, req-memory, num_buffers,
 num_planes); +if (allocated_buffers == 0) {
   dprintk(1, Memory allocation failed\n);
   return -ENOMEM;
   }
 
 - allocated_buffers = ret;
 -
   /*
* Check if driver can handle the allocated number of buffers.
*/
 @@ -851,6 +850,10 @@ static int __reqbufs(struct vb2_queue *q, struct
 v4l2_requestbuffers *req) q-num_buffers = allocated_buffers;
 
   if (ret  0) {
 + /*
 +  * Note: __vb2_queue_free() will subtract 'allocated_buffers'
 +  * from q-num_buffers.
 +  */
   __vb2_queue_free(q, allocated_buffers);
   return ret;
   }
 @@ -924,20 +927,18 @@ static int __create_bufs(struct vb2_queue *q, struct
 v4l2_create_buffers *create }
 
   /* Finally, allocate buffers and video memory */
 - ret = __vb2_queue_alloc(q, create-memory, num_buffers,
 + allocated_buffers = __vb2_queue_alloc(q, create-memory, num_buffers,
   num_planes);
 - if (ret == 0) {
 + if (allocated_buffers == 0) {
   dprintk(1, Memory allocation failed\n);
   return -ENOMEM;
   }
 
 - allocated_buffers = ret;
 -
   /*
* Check if driver can handle the so far allocated number of buffers.
*/
 - if (ret  num_buffers) {
 - num_buffers = ret;
 + if (allocated_buffers  num_buffers) {
 + num_buffers = allocated_buffers;
 
   /*
* q-num_buffers contains the total number of buffers, that the
 @@ -960,6 +961,10 @@ static int __create_bufs(struct vb2_queue *q, struct
 v4l2_create_buffers *create q-num_buffers += allocated_buffers;
 
   if (ret  0) {
 + /*
 +  * Note: __vb2_queue_free() will subtract 'allocated_buffers'
 +  * from q-num_buffers.
 +  */
   __vb2_queue_free(q, allocated_buffers);
   return -ENOMEM;
   }

-- 
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: [REVIEWv2 PATCH 07/15] vb2: call buf_finish from __dqbuf

2014-02-27 Thread Hans Verkuil
On 02/27/14 12:51, Laurent Pinchart wrote:
 Hi Hans,
 
 On Tuesday 25 February 2014 13:52:47 Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com

 This ensures that it is also called from queue_cancel, which also calls
 __dqbuf(). Without this change any time queue_cancel is called while
 streaming the buf_finish op will not be called and any driver cleanup
 will not happen.

 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 Acked-by: Pawel Osciak pa...@osciak.com
 ---
  drivers/media/v4l2-core/videobuf2-core.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

 diff --git a/drivers/media/v4l2-core/videobuf2-core.c
 b/drivers/media/v4l2-core/videobuf2-core.c index 59bfd85..b5142e5 100644
 --- a/drivers/media/v4l2-core/videobuf2-core.c
 +++ b/drivers/media/v4l2-core/videobuf2-core.c
 @@ -1758,6 +1758,8 @@ static void __vb2_dqbuf(struct vb2_buffer *vb)
  if (vb-state == VB2_BUF_STATE_DEQUEUED)
  return;

 +call_vb_qop(vb, buf_finish, vb);
 +
  vb-state = VB2_BUF_STATE_DEQUEUED;

  /* unmap DMABUF buffer */
 @@ -1783,8 +1785,6 @@ static int vb2_internal_dqbuf(struct vb2_queue *q,
 struct v4l2_buffer *b, bool n if (ret  0)
  return ret;

 -call_vb_qop(vb, buf_finish, vb);
 -
  switch (vb-state) {
  case VB2_BUF_STATE_DONE:
  dprintk(3, dqbuf: Returning done buffer\n);
 
 This will cause an issue with the uvcvideo driver (and possibly others) if 
 I'm 
 not mistaken. To give a bit more context, we currently have the following 
 code 
 in vb2_internal_dqbuf.
 
 ret = call_qop(q, buf_finish, vb);
 if (ret) {
 dprintk(1, dqbuf: buffer finish failed\n);
 return ret;
 }
 
 switch (vb-state) {
 case VB2_BUF_STATE_DONE:
 dprintk(3, dqbuf: Returning done buffer\n);
 break;
 case VB2_BUF_STATE_ERROR:
 dprintk(3, dqbuf: Returning done buffer with errors\n);
 break;
 default:
 dprintk(1, dqbuf: Invalid buffer state\n);
 return -EINVAL;
 }
 
 /* Fill buffer information for the userspace */
 __fill_v4l2_buffer(vb, b);
 /* Remove from videobuf queue */
 list_del(vb-queued_entry);
 /* go back to dequeued state */
 __vb2_dqbuf(vb);
 
 You're thus effectively moving the buf_finish call from before 
 __fill_v4l2_buffer() to after it. As the buf_finish operation in uvcvideo 
 fills the vb2 timestamp, the timestamp copied to userspace will be wrong.

Ouch. Good catch. The solution is to move the __vb2_dqbuf() call to before
the __fill_v4l2_buffer call. But I should see if I can add some test for
this to vivi/v4l2-compliance as well since that should have been caught.

 Other drivers may fill other vb2 fields that need to be copied to userspace 
 as 
 well. You should also double check that no driver modifies the vb2 state in 
 the buf_finish operation. Expanding the buf_finish documentation to tell what 
 drivers are allowed to do could be nice.

Good point.

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


[GIT PULL] mem2mem patches for 3.15

2014-02-27 Thread Kamil Debski
The following changes since commit b215621049bd57221455990880fb6b906f7dac21:

  Merge branch 'v4l_for_linus' into to_next (2014-02-04 06:48:49 -0200)

are available in the git repository at:


  git://linuxtv.org/kdebski/media_tree_2.git master

for you to fetch changes up to 61ca9493f4f0d3c8c1b4129b5bda6a2be32e5bf4:

  s5p-mfc: Add Horizontal and Vertical MV Search Range (2014-02-26 14:54:08
+0100)


Amit Grover (2):
  v4l2: Add settings for Horizontal and Vertical MV Search Range
  s5p-mfc: Add Horizontal and Vertical MV Search Range

 Documentation/DocBook/media/v4l/controls.xml|   20 +++
 drivers/media/platform/s5p-mfc/regs-mfc-v6.h|1 +
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h |2 ++
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c|   24
+++
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |8 ++--
 drivers/media/v4l2-core/v4l2-ctrls.c|6 ++
 include/uapi/linux/v4l2-controls.h  |2 ++
 7 files changed, 57 insertions(+), 6 deletions(-)

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


Use of dma_buf_unmap_attachment in interrupt context?

2014-02-27 Thread Hans Verkuil
A quick question: can dma_buf_unmap_attachment be called from
interrupt context? It is the dmabuf equivalent to e.g. dma_sync_sg_for_cpu
or dma_unmap_sg, and those can be called from interrupt context.

I cannot see anything specific about this in the sources or dma-buf-sharing.txt.

If it turns out that dma_buf_unmap_attachment can be called from atomic context,
then that should be documented, I think.

Regards,

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


[PATCH 1/1] Reading array out of bound in ds3000_read_snr

2014-02-27 Thread xypron . glpk
From: Heinrich Schuchardt xypron.g...@gmx.de

An attempt was made to read dvbs2_snr_tab[80],
though dvbs2_snr_tab has only 80 elements.

Signed-off-by: Heinrich Schuchardt xypron.g...@gmx.de
---
 drivers/media/dvb-frontends/ds3000.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/ds3000.c 
b/drivers/media/dvb-frontends/ds3000.c
index 1e344b0..335daef 100644
--- a/drivers/media/dvb-frontends/ds3000.c
+++ b/drivers/media/dvb-frontends/ds3000.c
@@ -616,7 +616,7 @@ static int ds3000_read_snr(struct dvb_frontend *fe, u16 
*snr)
snr_reading = dvbs2_noise_reading / tmp;
if (snr_reading  80)
snr_reading = 80;
-   *snr = -(dvbs2_snr_tab[snr_reading] / 1000);
+   *snr = -(dvbs2_snr_tab[snr_reading - 1] / 1000);
}
dprintk(%s: raw / cooked = 0x%02x / 0x%04x\n, __func__,
snr_reading, *snr);
-- 
1.7.10.4

--
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] [media] tvp5150: Fix type mismatch warning in clamp macro

2014-02-27 Thread Philipp Zabel
This patch fixes the following warning:

drivers/media/i2c/tvp5150.c: In function '__tvp5150_try_crop':
include/linux/kernel.h:762:17: warning: comparison of distinct pointer types 
lacks a cast [enabled by default]
  (void) (__val == __min);  \
 ^
drivers/media/i2c/tvp5150.c:886:16: note: in expansion of macro 'clamp'
  rect-width = clamp(rect-width,
^
include/linux/kernel.h:763:17: warning: comparison of distinct pointer types 
lacks a cast [enabled by default]
  (void) (__val == __max);  \
 ^
drivers/media/i2c/tvp5150.c:886:16: note: in expansion of macro 'clamp'
  rect-width = clamp(rect-width,
^
include/linux/kernel.h:762:17: warning: comparison of distinct pointer types 
lacks a cast [enabled by default]
  (void) (__val == __min);  \
 ^
drivers/media/i2c/tvp5150.c:904:17: note: in expansion of macro 'clamp'
  rect-height = clamp(rect-height,
 ^
include/linux/kernel.h:763:17: warning: comparison of distinct pointer types 
lacks a cast [enabled by default]
  (void) (__val == __max);  \
 ^
drivers/media/i2c/tvp5150.c:904:17: note: in expansion of macro 'clamp'
  rect-height = clamp(rect-height,
 ^

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/i2c/tvp5150.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index 542d252..8ac52fc 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -16,9 +16,9 @@
 
 #include tvp5150_reg.h
 
-#define TVP5150_H_MAX  720
-#define TVP5150_V_MAX_525_60   480
-#define TVP5150_V_MAX_OTHERS   576
+#define TVP5150_H_MAX  720U
+#define TVP5150_V_MAX_525_60   480U
+#define TVP5150_V_MAX_OTHERS   576U
 #define TVP5150_MAX_CROP_LEFT  511
 #define TVP5150_MAX_CROP_TOP   127
 #define TVP5150_CROP_SHIFT 2
-- 
1.8.5.3

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


[PATCH 2/2] [media] tvp5150: Make debug module parameter visible in sysfs

2014-02-27 Thread Philipp Zabel
Set permissions on the debug module parameter to make it appear in sysfs.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/i2c/tvp5150.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index 8ac52fc..4fd3688 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -29,7 +29,7 @@ MODULE_LICENSE(GPL);
 
 
 static int debug;
-module_param(debug, int, 0);
+module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, Debug level (0-2));
 
 struct tvp5150 {
-- 
1.8.5.3

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


[PATCH v5 6/7] of: Implement simplified graph binding for single port devices

2014-02-27 Thread Philipp Zabel
For simple devices with only one port, it can be made implicit.
The endpoint node can be a direct child of the device node.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/of/base.c | 24 +++-
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index ba3cfca..7d9c62b 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2037,8 +2037,13 @@ struct device_node *of_graph_get_next_endpoint(const 
struct device_node *parent,
struct device_node *node;
/*
 * It's the first call, we have to find a port subnode
-* within this node or within an optional 'ports' node.
+* within this node or within an optional 'ports' node,
+* or at least a single endpoint.
 */
+   endpoint = of_get_child_by_name(parent, endpoint);
+   if (endpoint)
+   return endpoint;
+
node = of_get_child_by_name(parent, ports);
if (node)
parent = node;
@@ -2049,8 +2054,6 @@ struct device_node *of_graph_get_next_endpoint(const 
struct device_node *parent,
/* Found a port, get an endpoint. */
endpoint = of_get_next_child(port, NULL);
of_node_put(port);
-   } else {
-   endpoint = NULL;
}
 
if (!endpoint)
@@ -2065,6 +2068,10 @@ struct device_node *of_graph_get_next_endpoint(const 
struct device_node *parent,
if (WARN_ONCE(!port, %s(): endpoint has no parent node\n,
  __func__))
return NULL;
+   if (port == parent) {
+   of_node_put(port);
+   return NULL;
+   }
 
/* Avoid dropping prev node refcount to 0. */
of_node_get(prev);
@@ -2105,9 +2112,11 @@ struct device_node *of_graph_get_remote_port_parent(
/* Get remote endpoint node. */
np = of_parse_phandle(node, remote-endpoint, 0);
 
-   /* Walk 3 levels up only if there is 'ports' node. */
+   /* Walk 3 levels up only if there is 'ports' node */
for (depth = 3; depth  np; depth--) {
np = of_get_next_parent(np);
+   if (depth == 3  of_node_cmp(np-name, port))
+   break;
if (depth == 2  of_node_cmp(np-name, ports))
break;
}
@@ -2130,6 +2139,11 @@ struct device_node *of_graph_get_remote_port(const 
struct device_node *node)
np = of_parse_phandle(node, remote-endpoint, 0);
if (!np)
return NULL;
-   return of_get_next_parent(np);
+   np = of_get_next_parent(np);
+   if (of_node_cmp(np-name, port)) {
+   of_node_put(np);
+   return NULL;
+   }
+   return np;
 }
 EXPORT_SYMBOL(of_graph_get_remote_port);
-- 
1.8.5.3

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


[PATCH v5 0/7] Move device tree graph parsing helpers to drivers/of

2014-02-27 Thread Philipp Zabel
Hi,

this version of the OF graph helper move series addresses a few of
Grant's and Tomi's comments.

Changes since v4:
 - Moved graph helpers into drivers/of/base.c
 - Fixed endpoint parsing patch to update users
 - Improved documentation, emphasizing features that differentiate
   the graph bindings from simple phandle graphs. Made it clear that
   this is not necessarily specific to data connections
 - Added cleanups to of_graph_get_next_endpoint routine
 - Added simplified binding for single port devices

regards
Philipp

Philipp Zabel (7):
  [media] of: move graph helpers from drivers/media/v4l2-core to
drivers/of
  Documentation: of: Document graph bindings
  of: Warn if of_graph_get_next_endpoint is called with the root node
  of: Reduce indentation in of_graph_get_next_endpoint
  [media] of: move common endpoint parsing to drivers/of
  of: Implement simplified graph binding for single port devices
  of: Document simplified graph binding for single port devices

 Documentation/devicetree/bindings/graph.txt   | 137 +
 drivers/media/i2c/adv7343.c   |   4 +-
 drivers/media/i2c/mt9p031.c   |   4 +-
 drivers/media/i2c/s5k5baf.c   |   3 +-
 drivers/media/i2c/tvp514x.c   |   3 +-
 drivers/media/i2c/tvp7002.c   |   3 +-
 drivers/media/platform/exynos4-is/fimc-is.c   |   6 +-
 drivers/media/platform/exynos4-is/media-dev.c |  13 +-
 drivers/media/platform/exynos4-is/mipi-csis.c |   5 +-
 drivers/media/v4l2-core/v4l2-of.c | 133 +
 drivers/of/base.c | 165 ++
 include/linux/of_graph.h  |  66 +++
 include/media/v4l2-of.h   |  33 +-
 13 files changed, 397 insertions(+), 178 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/graph.txt
 create mode 100644 include/linux/of_graph.h

-- 
1.8.5.3

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


[PATCH v5 1/7] [media] of: move graph helpers from drivers/media/v4l2-core to drivers/of

2014-02-27 Thread Philipp Zabel
This patch moves the parsing helpers used to parse connected graphs
in the device tree, like the video interface bindings documented in
Documentation/devicetree/bindings/media/video-interfaces.txt, from
drivers/media/v4l2-core/v4l2-of.c into drivers/of/base.c.

This allows to reuse the same parser code from outside the V4L2
framework, most importantly from display drivers.
The functions v4l2_of_get_next_endpoint, v4l2_of_get_remote_port,
and v4l2_of_get_remote_port_parent are moved. They are renamed to
of_graph_get_next_endpoint, of_graph_get_remote_port, and
of_graph_get_remote_port_parent, respectively.
Since there are not that many current users yet, switch all of
them to the new functions right away.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
Changes since v4:
 - Moved into drivers/of/base.c instead of creating of_graph.c
---
 drivers/media/i2c/adv7343.c   |   4 +-
 drivers/media/i2c/mt9p031.c   |   4 +-
 drivers/media/i2c/s5k5baf.c   |   3 +-
 drivers/media/i2c/tvp514x.c   |   3 +-
 drivers/media/i2c/tvp7002.c   |   3 +-
 drivers/media/platform/exynos4-is/fimc-is.c   |   6 +-
 drivers/media/platform/exynos4-is/media-dev.c |   3 +-
 drivers/media/platform/exynos4-is/mipi-csis.c |   3 +-
 drivers/media/v4l2-core/v4l2-of.c | 117 -
 drivers/of/base.c | 118 ++
 include/linux/of_graph.h  |  46 ++
 include/media/v4l2-of.h   |  25 +-
 12 files changed, 182 insertions(+), 153 deletions(-)
 create mode 100644 include/linux/of_graph.h

diff --git a/drivers/media/i2c/adv7343.c b/drivers/media/i2c/adv7343.c
index d4e15a6..9d38f7b 100644
--- a/drivers/media/i2c/adv7343.c
+++ b/drivers/media/i2c/adv7343.c
@@ -26,12 +26,12 @@
 #include linux/videodev2.h
 #include linux/uaccess.h
 #include linux/of.h
+#include linux/of_graph.h
 
 #include media/adv7343.h
 #include media/v4l2-async.h
 #include media/v4l2-device.h
 #include media/v4l2-ctrls.h
-#include media/v4l2-of.h
 
 #include adv7343_regs.h
 
@@ -410,7 +410,7 @@ adv7343_get_pdata(struct i2c_client *client)
if (!IS_ENABLED(CONFIG_OF) || !client-dev.of_node)
return client-dev.platform_data;
 
-   np = v4l2_of_get_next_endpoint(client-dev.of_node, NULL);
+   np = of_graph_get_next_endpoint(client-dev.of_node, NULL);
if (!np)
return NULL;
 
diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
index e5ddf47..192c4aa 100644
--- a/drivers/media/i2c/mt9p031.c
+++ b/drivers/media/i2c/mt9p031.c
@@ -21,6 +21,7 @@
 #include linux/module.h
 #include linux/of.h
 #include linux/of_gpio.h
+#include linux/of_graph.h
 #include linux/pm.h
 #include linux/regulator/consumer.h
 #include linux/slab.h
@@ -29,7 +30,6 @@
 #include media/mt9p031.h
 #include media/v4l2-ctrls.h
 #include media/v4l2-device.h
-#include media/v4l2-of.h
 #include media/v4l2-subdev.h
 
 #include aptina-pll.h
@@ -943,7 +943,7 @@ mt9p031_get_pdata(struct i2c_client *client)
if (!IS_ENABLED(CONFIG_OF) || !client-dev.of_node)
return client-dev.platform_data;
 
-   np = v4l2_of_get_next_endpoint(client-dev.of_node, NULL);
+   np = of_graph_get_next_endpoint(client-dev.of_node, NULL);
if (!np)
return NULL;
 
diff --git a/drivers/media/i2c/s5k5baf.c b/drivers/media/i2c/s5k5baf.c
index 77e10e0..2d768ef 100644
--- a/drivers/media/i2c/s5k5baf.c
+++ b/drivers/media/i2c/s5k5baf.c
@@ -21,6 +21,7 @@
 #include linux/media.h
 #include linux/module.h
 #include linux/of_gpio.h
+#include linux/of_graph.h
 #include linux/regulator/consumer.h
 #include linux/slab.h
 
@@ -1855,7 +1856,7 @@ static int s5k5baf_parse_device_node(struct s5k5baf 
*state, struct device *dev)
if (ret  0)
return ret;
 
-   node_ep = v4l2_of_get_next_endpoint(node, NULL);
+   node_ep = of_graph_get_next_endpoint(node, NULL);
if (!node_ep) {
dev_err(dev, no endpoint defined at node %s\n,
node-full_name);
diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c
index 83d85df..ca00117 100644
--- a/drivers/media/i2c/tvp514x.c
+++ b/drivers/media/i2c/tvp514x.c
@@ -36,6 +36,7 @@
 #include linux/module.h
 #include linux/v4l2-mediabus.h
 #include linux/of.h
+#include linux/of_graph.h
 
 #include media/v4l2-async.h
 #include media/v4l2-device.h
@@ -1068,7 +1069,7 @@ tvp514x_get_pdata(struct i2c_client *client)
if (!IS_ENABLED(CONFIG_OF) || !client-dev.of_node)
return client-dev.platform_data;
 
-   endpoint = v4l2_of_get_next_endpoint(client-dev.of_node, NULL);
+   endpoint = of_graph_get_next_endpoint(client-dev.of_node, NULL);
if (!endpoint)
return NULL;
 
diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c
index 912e1cc..c4e1e2c 100644
--- 

[PATCH v5 7/7] of: Document simplified graph binding for single port devices

2014-02-27 Thread Philipp Zabel
For simple devices with only one port, it can be made implicit.
The endpoint node can be a direct child of the device node.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 Documentation/devicetree/bindings/graph.txt | 8 
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/graph.txt 
b/Documentation/devicetree/bindings/graph.txt
index 554865b..6dfaff8 100644
--- a/Documentation/devicetree/bindings/graph.txt
+++ b/Documentation/devicetree/bindings/graph.txt
@@ -84,6 +84,14 @@ device {
 };
 };
 
+For devices with only a single port and a single endpoint, this can be further
+simplified by making the port implicit, and adding the endpoint node as a 
direct
+child of the device node.
+
+device {
+   endpoint { ... };
+};
+
 Links between endpoints
 ---
 
-- 
1.8.5.3

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


[PATCH v5 4/7] of: Reduce indentation in of_graph_get_next_endpoint

2014-02-27 Thread Philipp Zabel
A 'return endpoint;' at the end of the (!prev) case allows to
reduce the indentation level of the (prev) case.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/of/base.c | 42 ++
 1 file changed, 22 insertions(+), 20 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 6e650cf..8ecca7a 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2026,32 +2026,34 @@ struct device_node *of_graph_get_next_endpoint(const 
struct device_node *parent,
pr_err(%s(): no endpoint nodes specified for %s\n,
   __func__, parent-full_name);
of_node_put(node);
-   } else {
-   port = of_get_parent(prev);
-   if (WARN_ONCE(!port, %s(): endpoint has no parent node\n,
- __func__))
-   return NULL;
 
-   /* Avoid dropping prev node refcount to 0. */
-   of_node_get(prev);
-   endpoint = of_get_next_child(port, prev);
-   if (endpoint) {
-   of_node_put(port);
-   return endpoint;
-   }
+   return endpoint;
+   }
 
-   /* No more endpoints under this port, try the next one. */
-   do {
-   port = of_get_next_child(parent, port);
-   if (!port)
-   return NULL;
-   } while (of_node_cmp(port-name, port));
+   port = of_get_parent(prev);
+   if (WARN_ONCE(!port, %s(): endpoint has no parent node\n,
+ __func__))
+   return NULL;
 
-   /* Pick up the first endpoint in this port. */
-   endpoint = of_get_next_child(port, NULL);
+   /* Avoid dropping prev node refcount to 0. */
+   of_node_get(prev);
+   endpoint = of_get_next_child(port, prev);
+   if (endpoint) {
of_node_put(port);
+   return endpoint;
}
 
+   /* No more endpoints under this port, try the next one. */
+   do {
+   port = of_get_next_child(parent, port);
+   if (!port)
+   return NULL;
+   } while (of_node_cmp(port-name, port));
+
+   /* Pick up the first endpoint in this port. */
+   endpoint = of_get_next_child(port, NULL);
+   of_node_put(port);
+
return endpoint;
 }
 EXPORT_SYMBOL(of_graph_get_next_endpoint);
-- 
1.8.5.3

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


[PATCH v5 3/7] of: Warn if of_graph_get_next_endpoint is called with the root node

2014-02-27 Thread Philipp Zabel
If of_graph_get_next_endpoint is given a parentless node instead of an
endpoint node, it is clearly a bug.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/of/base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index b2f223f..6e650cf 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2028,8 +2028,8 @@ struct device_node *of_graph_get_next_endpoint(const 
struct device_node *parent,
of_node_put(node);
} else {
port = of_get_parent(prev);
-   if (!port)
-   /* Hm, has someone given us the root node ?... */
+   if (WARN_ONCE(!port, %s(): endpoint has no parent node\n,
+ __func__))
return NULL;
 
/* Avoid dropping prev node refcount to 0. */
-- 
1.8.5.3

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


[PATCH v5 2/7] Documentation: of: Document graph bindings

2014-02-27 Thread Philipp Zabel
The device tree graph bindings as used by V4L2 and documented in
Documentation/device-tree/bindings/media/video-interfaces.txt contain
generic parts that are not media specific but could be useful for any
subsystem with data flow between multiple devices. This document
describe the generic bindings.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
Changes since v4:
 - Differentiate from graphs made by simple phandle links
 - Do not mention data flow except in video-interfaces example
 - 
---
 Documentation/devicetree/bindings/graph.txt | 129 
 1 file changed, 129 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/graph.txt

diff --git a/Documentation/devicetree/bindings/graph.txt 
b/Documentation/devicetree/bindings/graph.txt
new file mode 100644
index 000..554865b
--- /dev/null
+++ b/Documentation/devicetree/bindings/graph.txt
@@ -0,0 +1,129 @@
+Common bindings for device graphs
+
+General concept
+---
+
+The hierarchical organisation of the device tree is well suited to describe
+control flow to devices, but there can be more complex connections between
+devices that work together to form a logical compound device, following an
+arbitrarily complex graph.
+There already is a simple directed graph between devices tree nodes using
+phandle properties pointing to other nodes to describe connections that
+can not be inferred from device tree parent-child relationships. The device
+tree graph bindings described herein abstract more complex devices that can
+have multiple specifiable ports, each of which can be linked to one or more
+ports of other devices.
+
+These common bindings do not contain any information about the direction of
+type of the connections, they just map their existence. Specific properties
+may be described by specialized bindings depending on the type of connection.
+
+To see how this binding applies to video pipelines, for example, see
+Documentation/device-tree/bindings/media/video-interfaces.txt.
+Here the ports describe data interfaces, and the links between them are
+the connecting data buses. A single port with multiple connections can
+correspond to multiple devices being connected to the same physical bus.
+
+Organisation of ports and endpoints
+---
+
+Ports are described by child 'port' nodes contained in the device node.
+Each port node contains an 'endpoint' subnode for each remote device port
+connected to this port. If a single port is connected to more than one
+remote device, an 'endpoint' child node must be provided for each link.
+If more than one port is present in a device node or there is more than one
+endpoint at a port, or a port node needs to be associated with a selected
+hardware interface, a common scheme using '#address-cells', '#size-cells'
+and 'reg' properties is used number the nodes.
+
+device {
+...
+#address-cells = 1;
+#size-cells = 0;
+
+port@0 {
+   #address-cells = 1;
+   #size-cells = 0;
+   reg = 0;
+
+endpoint@0 {
+   reg = 0;
+   ...
+   };
+endpoint@1 {
+   reg = 1;
+   ...
+   };
+};
+
+port@1 {
+   reg = 1;
+
+   endpoint { ... };
+   };
+};
+
+All 'port' nodes can be grouped under an optional 'ports' node, which
+allows to specify #address-cells, #size-cells properties for the 'port'
+nodes independently from any other child device nodes a device might
+have.
+
+device {
+...
+ports {
+#address-cells = 1;
+#size-cells = 0;
+
+port@0 {
+...
+endpoint@0 { ... };
+endpoint@1 { ... };
+};
+
+port@1 { ... };
+};
+};
+
+Links between endpoints
+---
+
+Each endpoint should contain a 'remote-endpoint' phandle property that points
+to the corresponding endpoint in the port of the remote device. In turn, the
+remote endpoint should contain a 'remote-endpoint' property. If it has one,
+it must not point to another than the local endpoint. Two endpoints with their
+'remote-endpoint' phandles pointing at each other form a link between the
+containing ports.
+
+device_1 {
+port {
+device_1_output: endpoint {
+remote-endpoint = device_2_input;
+};
+};
+};
+
+device_1 {
+port {
+device_2_input: endpoint {
+remote-endpoint = device_1_output;
+};
+};
+};
+
+
+Required properties
+---
+
+If there is more than one 'port' or more than one 'endpoint' node or 'reg'
+property is present in port and/or endpoint nodes the following properties
+are required in a relevant 

[PATCH v5 5/7] [media] of: move common endpoint parsing to drivers/of

2014-02-27 Thread Philipp Zabel
This patch adds a new struct of_endpoint which is then embedded in struct
v4l2_of_endpoint and contains the endpoint properties that are not V4L2
(or even media) specific: the port number, endpoint id, local device tree
node and remote endpoint phandle. of_graph_parse_endpoint parses those
properties and is used by v4l2_of_parse_endpoint, which just adds the
V4L2 MBUS information to the containing v4l2_of_endpoint structure.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
Changes since v4:
 - Fixed users of struct v4l2_of_endpoint
 - Removed left-over #include media/of_graph.h from v4l2-of.h
---
 drivers/media/platform/exynos4-is/media-dev.c | 10 -
 drivers/media/platform/exynos4-is/mipi-csis.c |  2 +-
 drivers/media/v4l2-core/v4l2-of.c | 16 +++---
 drivers/of/base.c | 31 +++
 include/linux/of_graph.h  | 20 +
 include/media/v4l2-of.h   |  8 ++-
 6 files changed, 62 insertions(+), 25 deletions(-)

diff --git a/drivers/media/platform/exynos4-is/media-dev.c 
b/drivers/media/platform/exynos4-is/media-dev.c
index d0f82da..04d6ecd 100644
--- a/drivers/media/platform/exynos4-is/media-dev.c
+++ b/drivers/media/platform/exynos4-is/media-dev.c
@@ -469,10 +469,10 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd,
return 0;
 
v4l2_of_parse_endpoint(ep, endpoint);
-   if (WARN_ON(endpoint.port == 0) || index = FIMC_MAX_SENSORS)
+   if (WARN_ON(endpoint.base.port == 0) || index = FIMC_MAX_SENSORS)
return -EINVAL;
 
-   pd-mux_id = (endpoint.port - 1)  0x1;
+   pd-mux_id = (endpoint.base.port - 1)  0x1;
 
rem = of_graph_get_remote_port_parent(ep);
of_node_put(ep);
@@ -494,13 +494,13 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd,
return -EINVAL;
}
 
-   if (fimc_input_is_parallel(endpoint.port)) {
+   if (fimc_input_is_parallel(endpoint.base.port)) {
if (endpoint.bus_type == V4L2_MBUS_PARALLEL)
pd-sensor_bus_type = FIMC_BUS_TYPE_ITU_601;
else
pd-sensor_bus_type = FIMC_BUS_TYPE_ITU_656;
pd-flags = endpoint.bus.parallel.flags;
-   } else if (fimc_input_is_mipi_csi(endpoint.port)) {
+   } else if (fimc_input_is_mipi_csi(endpoint.base.port)) {
/*
 * MIPI CSI-2: only input mux selection and
 * the sensor's clock frequency is needed.
@@ -508,7 +508,7 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd,
pd-sensor_bus_type = FIMC_BUS_TYPE_MIPI_CSI2;
} else {
v4l2_err(fmd-v4l2_dev, Wrong port id (%u) at node %s\n,
-endpoint.port, rem-full_name);
+endpoint.base.port, rem-full_name);
}
/*
 * For FIMC-IS handled sensors, that are placed under i2c-isp device
diff --git a/drivers/media/platform/exynos4-is/mipi-csis.c 
b/drivers/media/platform/exynos4-is/mipi-csis.c
index fd1ae65..3678ba5 100644
--- a/drivers/media/platform/exynos4-is/mipi-csis.c
+++ b/drivers/media/platform/exynos4-is/mipi-csis.c
@@ -772,7 +772,7 @@ static int s5pcsis_parse_dt(struct platform_device *pdev,
/* Get port node and validate MIPI-CSI channel id. */
v4l2_of_parse_endpoint(node, endpoint);
 
-   state-index = endpoint.port - FIMC_INPUT_MIPI_CSI2_0;
+   state-index = endpoint.base.port - FIMC_INPUT_MIPI_CSI2_0;
if (state-index  0 || state-index = CSIS_MAX_ENTITIES)
return -ENXIO;
 
diff --git a/drivers/media/v4l2-core/v4l2-of.c 
b/drivers/media/v4l2-core/v4l2-of.c
index f919db3..b4ed9a9 100644
--- a/drivers/media/v4l2-core/v4l2-of.c
+++ b/drivers/media/v4l2-core/v4l2-of.c
@@ -127,17 +127,9 @@ static void v4l2_of_parse_parallel_bus(const struct 
device_node *node,
 int v4l2_of_parse_endpoint(const struct device_node *node,
   struct v4l2_of_endpoint *endpoint)
 {
-   struct device_node *port_node = of_get_parent(node);
-
-   memset(endpoint, 0, offsetof(struct v4l2_of_endpoint, head));
-
-   endpoint-local_node = node;
-   /*
-* It doesn't matter whether the two calls below succeed.
-* If they don't then the default value 0 is used.
-*/
-   of_property_read_u32(port_node, reg, endpoint-port);
-   of_property_read_u32(node, reg, endpoint-id);
+   of_graph_parse_endpoint(node, endpoint-base);
+   endpoint-bus_type = 0;
+   memset(endpoint-bus, 0, sizeof(endpoint-bus));
 
v4l2_of_parse_csi_bus(node, endpoint);
/*
@@ -147,8 +139,6 @@ int v4l2_of_parse_endpoint(const struct device_node *node,
if (endpoint-bus.mipi_csi2.flags == 0)
v4l2_of_parse_parallel_bus(node, endpoint);
 
-   of_node_put(port_node);
-
return 0;
 }
 

Re: [RFC PATCH 2/3] ir-rc5-sz: Add ir encoding support

2014-02-27 Thread James Hogan
On Sunday 16 February 2014 19:04:01 Antti Seppälä wrote:
 On 12 February 2014 01:39, James Hogan james.ho...@imgtec.com wrote:
  On Tuesday 11 February 2014 20:14:19 Antti Seppälä wrote:
  Are you working on the wakeup protocol selector sysfs interface?
  
  I gave it a try yesterday, but it's a bit of a work in progress at the
  moment. It's also a bit more effort for img-ir to work properly with it,
  so I'd probably just limit the allowed wakeup protocols to the enabled
  normal protocol at first in img-ir.
  
  Here's what I have (hopefully kmail won't corrupt it), feel free to take
  and improve/fix it. I'm not keen on the invasiveness of the
  allowed_protos/enabled_protocols change (which isn't complete), but it
  should probably be abstracted at some point anyway.
 
 In general the approach here looks good. At least I couldn't figure
 any easy way to be less intrusive towards drivers/decoders and still
 support wakeup filters.

Thanks for taking a look (and sorry for the delay getting back to this, 
holiday and sickness got in the way). FYI I've cleaned up my wakeup_protocols 
patches a lot and will probably post tomorrow (after rebasing my patches to 
allow me to test img-ir properly with it).

Cheers
James

signature.asc
Description: This is a digitally signed message part.


Re: [PATCH v3 06/15] dt: binding: add binding for ImgTec IR block

2014-02-27 Thread James Hogan
Hi Rob, Mark + DT maintainers,

On Friday 07 February 2014 15:49:15 James Hogan wrote:
 Add device tree binding for ImgTec Consumer Infrared block, specifically
 major revision 1 of the hardware.
 
 Signed-off-by: James Hogan james.ho...@imgtec.com
 Cc: Mauro Carvalho Chehab m.che...@samsung.com
 Cc: linux-media@vger.kernel.org
 Cc: Rob Herring robh...@kernel.org
 Cc: Pawel Moll pawel.m...@arm.com
 Cc: Mark Rutland mark.rutl...@arm.com
 Cc: Ian Campbell ijc+devicet...@hellion.org.uk
 Cc: Kumar Gala ga...@codeaurora.org
 Cc: devicet...@vger.kernel.org
 Cc: Rob Landley r...@landley.net
 Cc: linux-...@vger.kernel.org
 Cc: Tomasz Figa tomasz.f...@gmail.com
 ---
 v3:
 - Rename compatible string to img,ir-rev1 (Rob Herring).
 - Specify ordering of clocks explicitly (Rob Herring).

I'd appreciate if somebody could give this another glance after the two 
changes listed above and Ack it (I'll probably be posting a v4 patchset 
tomorrow).

Thanks
James

 
 v2:
 - Future proof compatible string from img,ir to img,ir1, where the 1
   corresponds to the major revision number of the hardware (Tomasz
   Figa).
 - Added clock-names property and three specific clock names described in
   the manual, only one of which is used by the current driver (Tomasz
   Figa).
 ---
  .../devicetree/bindings/media/img-ir-rev1.txt  | 34
 ++ 1 file changed, 34 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/media/img-ir-rev1.txt
 
 diff --git a/Documentation/devicetree/bindings/media/img-ir-rev1.txt
 b/Documentation/devicetree/bindings/media/img-ir-rev1.txt new file mode
 100644
 index ..5434ce61b925
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/media/img-ir-rev1.txt
 @@ -0,0 +1,34 @@
 +* ImgTec Infrared (IR) decoder version 1
 +
 +This binding is for Imagination Technologies' Infrared decoder block,
 +specifically major revision 1.
 +
 +Required properties:
 +- compatible:Should be img,ir-rev1
 +- reg:   Physical base address of the controller and 
 length of
 + memory mapped region.
 +- interrupts:The interrupt specifier to the cpu.
 +
 +Optional properties:
 +- clocks:List of clock specifiers as described in standard
 + clock bindings.
 + Up to 3 clocks may be specified in the following order:
 + 1st:Core clock (defaults to 32.768KHz if omitted).
 + 2nd:System side (fast) clock.
 + 3rd:Power modulation clock.
 +- clock-names:   List of clock names corresponding to the clocks
 + specified in the clocks property.
 + Accepted clock names are:
 + core: Core clock.
 + sys:  System clock.
 + mod:  Power modulation clock.
 +
 +Example:
 +
 + ir@02006200 {
 + compatible = img,ir-rev1;
 + reg = 0x02006200 0x100;
 + interrupts = 29 4;
 + clocks = clk_32khz;
 + clock-names =  core;
 + };


signature.asc
Description: This is a digitally signed message part.


Re: [PATCH v3 06/15] dt: binding: add binding for ImgTec IR block

2014-02-27 Thread Rob Herring
On Thu, Feb 27, 2014 at 4:52 PM, James Hogan james.ho...@imgtec.com wrote:
 Hi Rob, Mark + DT maintainers,

 On Friday 07 February 2014 15:49:15 James Hogan wrote:
 Add device tree binding for ImgTec Consumer Infrared block, specifically
 major revision 1 of the hardware.

 Signed-off-by: James Hogan james.ho...@imgtec.com
 Cc: Mauro Carvalho Chehab m.che...@samsung.com
 Cc: linux-media@vger.kernel.org
 Cc: Rob Herring robh...@kernel.org
 Cc: Pawel Moll pawel.m...@arm.com
 Cc: Mark Rutland mark.rutl...@arm.com
 Cc: Ian Campbell ijc+devicet...@hellion.org.uk
 Cc: Kumar Gala ga...@codeaurora.org
 Cc: devicet...@vger.kernel.org
 Cc: Rob Landley r...@landley.net
 Cc: linux-...@vger.kernel.org
 Cc: Tomasz Figa tomasz.f...@gmail.com
 ---
 v3:
 - Rename compatible string to img,ir-rev1 (Rob Herring).
 - Specify ordering of clocks explicitly (Rob Herring).

 I'd appreciate if somebody could give this another glance after the two
 changes listed above and Ack it (I'll probably be posting a v4 patchset
 tomorrow).

Looks fine.

Acked-by: Rob Herring r...@kernel.org


 v2:
 - Future proof compatible string from img,ir to img,ir1, where the 1
   corresponds to the major revision number of the hardware (Tomasz
   Figa).
 - Added clock-names property and three specific clock names described in
   the manual, only one of which is used by the current driver (Tomasz
   Figa).
 ---
  .../devicetree/bindings/media/img-ir-rev1.txt  | 34
 ++ 1 file changed, 34 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/media/img-ir-rev1.txt

 diff --git a/Documentation/devicetree/bindings/media/img-ir-rev1.txt
 b/Documentation/devicetree/bindings/media/img-ir-rev1.txt new file mode
 100644
 index ..5434ce61b925
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/media/img-ir-rev1.txt
 @@ -0,0 +1,34 @@
 +* ImgTec Infrared (IR) decoder version 1
 +
 +This binding is for Imagination Technologies' Infrared decoder block,
 +specifically major revision 1.
 +
 +Required properties:
 +- compatible:Should be img,ir-rev1
 +- reg:   Physical base address of the controller and 
 length of
 + memory mapped region.
 +- interrupts:The interrupt specifier to the cpu.
 +
 +Optional properties:
 +- clocks:List of clock specifiers as described in standard
 + clock bindings.
 + Up to 3 clocks may be specified in the following order:
 + 1st:Core clock (defaults to 32.768KHz if omitted).
 + 2nd:System side (fast) clock.
 + 3rd:Power modulation clock.
 +- clock-names:   List of clock names corresponding to the clocks
 + specified in the clocks property.
 + Accepted clock names are:
 + core: Core clock.
 + sys:  System clock.
 + mod:  Power modulation clock.
 +
 +Example:
 +
 + ir@02006200 {
 + compatible = img,ir-rev1;
 + reg = 0x02006200 0x100;
 + interrupts = 29 4;
 + clocks = clk_32khz;
 + clock-names =  core;
 + };
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PULL] feb27 - git://linuxtv.org/mkrufky/dvb dvb

2014-02-27 Thread Michael Krufky
I added two patches to this branch - This request supersedes yesterday's
pull request.

The following changes since commit
efab6b6a6ea9364ececb955f69a9d3ffc6b782a1:

  [media] vivi: queue_setup improvements (2014-02-24 10:59:15 -0300)

are available in the git repository at:

  git://linuxtv.org/mkrufky/dvb dvb

for you to fetch changes up to 121be88a350f841083c9a84aab5ca06dea49736d:

  au0828: rework GPIO management for HVR-950q. (2014-02-27 21:19:18
  -0500)


Alexander Shiyan (1):
  stb6100: fix buffer length check in stb6100_write_reg_range()

Dan Carpenter (1):
  stv0900: remove an unneeded check

Devin Heitmueller (1):
  au0828: rework GPIO management for HVR-950q.

Heinrich Schuchardt (1):
  ds3000: fix reading array out of bound in ds3000_read_snr

Malcolm Priestley (2):
  m88rs2000: add caps FE_CAN_INVERSION_AUTO
  m88rs2000: prevent frontend crash on continuous transponder scans

 drivers/media/dvb-frontends/ds3000.c |  2 +-
 drivers/media/dvb-frontends/m88rs2000.c  | 19 ++-
 drivers/media/dvb-frontends/stb6100.c|  2 +-
 drivers/media/dvb-frontends/stv0900_sw.c |  2 +-
 drivers/media/usb/au0828/au0828-cards.c  | 21 ++---
 5 files changed, 35 insertions(+), 11 deletions(-)
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


cron job: media_tree daily build: WARNINGS

2014-02-27 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 Feb 28 04:00:27 CET 2014
git branch: test
git hash:   efab6b6a6ea9364ececb955f69a9d3ffc6b782a1
gcc version:i686-linux-gcc (GCC) 4.8.2
sparse version: 0.4.5-rc1
host hardware:  x86_64
host os:3.12-6.slh.2-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: WARNINGS
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.31.14-i686: OK
linux-2.6.32.27-i686: OK
linux-2.6.33.7-i686: OK
linux-2.6.34.7-i686: OK
linux-2.6.35.9-i686: OK
linux-2.6.36.4-i686: OK
linux-2.6.37.6-i686: OK
linux-2.6.38.8-i686: OK
linux-2.6.39.4-i686: OK
linux-3.0.60-i686: OK
linux-3.1.10-i686: OK
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: OK
linux-3.7.4-i686: OK
linux-3.8-i686: OK
linux-3.9.2-i686: OK
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12-i686: OK
linux-3.13-i686: OK
linux-3.14-rc1-i686: OK
linux-2.6.31.14-x86_64: WARNINGS
linux-2.6.32.27-x86_64: OK
linux-2.6.33.7-x86_64: OK
linux-2.6.34.7-x86_64: OK
linux-2.6.35.9-x86_64: OK
linux-2.6.36.4-x86_64: OK
linux-2.6.37.6-x86_64: OK
linux-2.6.38.8-x86_64: OK
linux-2.6.39.4-x86_64: OK
linux-3.0.60-x86_64: OK
linux-3.1.10-x86_64: OK
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: OK
linux-3.9.2-x86_64: OK
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12-x86_64: OK
linux-3.13-x86_64: OK
linux-3.14-rc1-x86_64: OK
apps: OK
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