rockchip v4l support ?

2015-07-13 Thread Christoph Fritz
Hi,

 is someone working on v4l (camera stack) support for rockchip SoCs?

Currently, it lacks pretty much everything. So what is your guess in the
amount of work at a rough estimate?

 Thanks
  -- chf

--
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: rockchip v4l support ?

2015-07-13 Thread Hans Verkuil
Hi Christoph,

On 07/13/2015 09:20 AM, Christoph Fritz wrote:
> Hi,
> 
>  is someone working on v4l (camera stack) support for rockchip SoCs?

I'm not aware of any activity, you're the first to ask about this on the 
linux-media
mailinglist.

However, a quick google turns up this:

https://groups.google.com/a/chromium.org/forum/#!topic/chromium-os-reviews/DMCeSXLwoKY

> Currently, it lacks pretty much everything. So what is your guess in the
> amount of work at a rough estimate?

Hard to tell since I do not know the hardware. Basically anything from a week
to a year or more :-)

It depends on whether there is any code out there for driving the camera stack
that you can base your work on and whether you have datasheets and how complex
the HW is.

Regards,

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


Re: [PATCH] [media] v4l2-subdev: return -EPIPE instead of -EINVAL in link validate default

2015-07-13 Thread Sakari Ailus
Hi Helen,

Helen Fornazier wrote:
> Hi,
> 
> On Tue, Jun 30, 2015 at 4:26 PM, Helen Fornazier 
> wrote:
> 
>> Hi Sakari and Laurent,
>>
>> Thanks for reviewing this
>>
>> On Tue, Jun 30, 2015 at 6:19 AM, Sakari Ailus
>>  wrote:
>>> Hi Laurent,
>>>
>>> Laurent Pinchart wrote:
 Hi Sakari,

 On Monday 29 June 2015 10:23:34 Sakari Ailus wrote:
> Helen Fornazier wrote:
>> According to the V4L2 API, the VIDIOC_STREAMON ioctl should return
>> EPIPE
>> when the pipeline configuration is invalid.
>>
>> As the .vidioc_streamon in the v4l2_ioctl_ops usually forwards the
>> error
>> caused by the v4l2_subdev_link_validate_default (if it is in use), it
>> should return -EPIPE if it detects a format mismatch in the pipeline
>> configuration
>
> Only link configuration errors have yielded -EPIPE so far, sub-device
> format configuration error has returned -INVAL instead as you noticed.

 It should also be noted that while v4l2_subdev_link_validate() will
>> return -
 EINVAL in case of error, the only driver that performs custom link
>> validation
 (omap3isp/ispccdc.c) will return -EPIPE.
>>>
>>> Good point. That has escaped me until now.
>>>
> There are not many sources of -EINVAL while enabling streaming and all
> others are directly caused by the application; I lean towards thinking
> the code is good as it was. The documentation could be improved though.
> It may not be clear which error codes could be caused by different
> conditions.
>
> The debug level messages from media module
> (drivers/media/media-entity.c) do provide more information if needed,
> albeit this certainly is not an application interface.
>
> I wonder what others think.

 There's a discrepancy between the implementation and the documentation,
>> so at
 least one of them need to be fixed. -EPIPE would be coherent with the
 documentation and seems appropriately named, but another error code
>> would
 allow userspace to tell link configuration and format configuration
>> problems
 apart.
>>>
>>> That was the original intent, I think.
>>>
 Do you think -EINVAL is the most appropriate error code for format
 configuration ? It's already used to indicate that the stream type is
>> invalid
 or that not enough buffers have been allocated, and is also used by
>> drivers
 directly for various purposes.
>>>
>>> That's true, it's been used also for that purpose. At the time this
>>> certainly was not the primary concern. If you can think of a better
>>> error code for the purpose (than EINVAL) I'm certainly fine with using
>> one.
>>>
>>> I still think that -EPIPE is worse for telling about incorrect format
>>> configuration than -EINVAL since it's relatively easy to avoid -EINVAL
>>> for the documented reasons.
>>>
>>> --
>>> Kind regards,
>>>
>>> Sakari Ailus
>>> sakari.ai...@linux.intel.com
>>
>> I'd like just to point out where in the docs EPIPE for format mismatch
>> is specified, as it is not described in the streamon page as I thought
>> it would, but it is in the subdev page in case anyone is looking for
>> it (as I took some time to find it too):
>>
>> http://linuxtv.org/downloads/v4l-dvb-apis/subdev.html
>> "Applications are responsible for configuring coherent parameters on
>> the whole pipeline and making sure that connected pads have compatible
>> formats. The pipeline is checked for formats mismatch at
>> VIDIOC_STREAMON time, and an EPIPE error code is then returned if the
>> configuration is invalid"
>>
>> So maybe the doc should be improved as you already stated.
>>
>> --
>> Helen Fornazier
>>
> 
> I would like to revive this subject.
> 
> Should we change the docs? Change the -EINVAL to -EPIPE, or create another
> error code? What are your opinion?
> 
> I read in the docs of dev-kmsg that EPIPE is returned when messages get
> overwritten, and in other parts of the code EPIPE is returned when there is
> an error in the pipeline communication level while trying to send
> information through the pipe or a pipe broken error.
> 
> But in the error-codes.txt files, the EPIPE error is defined as:
> *EPIPE "The pipe type specified in the URB doesn't match the endpoint's
> actual type"*

This exact definition sound USB specific to me.

> Then, if EPIPE is used when types don't match between two endpoints, it
> seems reasonable to me to use EPIPE when formats don't match either. Or do
> "types" in this context have a specific definition? I don't know much about
> URB, you may be able to judge this better.

A short recap of the current situation as far as I understand it:

- MC link validation failure yields EPIPE to the user space,

- V4L2 sub-device format validation failure generally results in EINVAL,
except that

- omap3isp CCDC driver returns EPIPE instead and

- EINVAL is used for many other purposes.

The issues are inconsistency between omap3isp CCDC and other drivers in
informing the user th

Re: rockchip v4l support ?

2015-07-13 Thread Christoph Fritz
Hi Alpha Lin,

 please see my question below.

On Mon, 2015-07-13 at 09:54 +0200, Hans Verkuil wrote:
> Hi Christoph,
> 
> On 07/13/2015 09:20 AM, Christoph Fritz wrote:
> > Hi,
> > 
> >  is someone working on v4l (camera stack) support for rockchip SoCs?
> 
> I'm not aware of any activity, you're the first to ask about this on the 
> linux-media
> mailinglist.
> 
> However, a quick google turns up this:
> 
> https://groups.google.com/a/chromium.org/forum/#!topic/chromium-os-reviews/DMCeSXLwoKY
> 
> > Currently, it lacks pretty much everything. So what is your guess in the
> > amount of work at a rough estimate?
> 
> Hard to tell since I do not know the hardware. Basically anything from a week
> to a year or more :-)
> 
> It depends on whether there is any code out there for driving the camera stack
> that you can base your work on and whether you have datasheets and how complex
> the HW is.

Could you please answer or comment some of the questions raised in the
text above?

 Thanks
  -- chf


--
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 1/6] v4l2-ctrls: Add new S8, S16 and S32 compound control types

2015-07-13 Thread Hans Verkuil
On 07/13/2015 12:18 AM, Laurent Pinchart wrote:
> Hi Sadegh,
> 
> On Friday 10 July 2015 15:45:23 sadegh abbasi wrote:
>> Hi Hans / Laurent,
>> Just wondering what has happened to these patches. I used them in my driver
>> and can not find them in 4.1 release. Have they been rejected?
> 
> Not exactly. The changes to v4l2-ctrls were considered to be fine, but we 
> have 
> a policy not to merge core changes without at least one driver using them. As 
> the OMAP4 ISS part of the series still needs work, nothing got merged.
> 
> Hans, you mentioned you wanted to look at the RGB2RGB controls in a wider 
> context (including the adv drivers for instance). Do you have anything to 
> report ?

Yes and no :-)

It's part of my work to support colorspace conversion hardware. Now for 4.2 I 
merged
a lot of patches that pave the way for the remaining code to go in. But that 
remaining
code still needs to be cleaned up. My code can be found here:

http://git.linuxtv.org/cgit.cgi/hverkuil/media_tree.git/log/?h=csc

Unfortunately it's on hold because the CEC framework has priority for me (and 
Cisco).

In addition, for drm Intel is working on color manager code as well (see the 
patch
series titled "Color Manager Implementation" at dri-devel). I would like to be 
able
to share the low-level matrix/vector calculation code with them. So I am 
waiting to
see how that turns out.

So quite some work has been done, but it's not ready for merging.

Regards,

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


Re: [PATCH 0/10 v6] Helper to abstract vma handling in media layer

2015-07-13 Thread Hans Verkuil
On 07/09/2015 02:12 PM, Hans Verkuil wrote:
> On 07/09/2015 01:48 PM, Jan Kara wrote:
>>   Hello,
>>
>>   Hans, did you have a chance to look at these patches? I have tested them
>> with the vivid driver but it would be good if you could run them through
>> your standard testing procedure as well. Andrew has updated the patches in
>> his tree but some ack from you would be welcome...
> 
> I've planned a 'patch day' for Monday. So hopefully you'll see a pull request
> by then.

OK, I'm confused. I thought the non-vb2 patches would go in for 4.2? That didn't
happen, so I guess the plan is to merge the whole lot for 4.3 via our media
tree? If that's the case, can you post a new patch series on top of the master
branch of the media tree? I want to make sure I use the right patches. Also, if
you do make a new patch series, then it would be better if patch 10/10 is folded
into patch 2/10.

If that's not the case, then you have to let me know what I should do.

Regards,

Hans

>>
>>  Honza
>> On Thu 18-06-15 16:08:30, Jan Kara wrote:
>>>   Hello,
>>>
>>> I'm sending the sixth version of my patch series to abstract vma handling 
>>> from
>>> the various media drivers. Since the previous version I have added a patch 
>>> to
>>> move mm helpers into a separate file and behind a config option. I also
>>> changed patch pushing mmap_sem down in videobuf2 core to avoid lockdep 
>>> warning
>>> and NULL dereference Hans found in his testing. I've also included small
>>> fixups Andrew was carrying.
>>>
>>> After this patch set drivers have to know much less details about vmas, 
>>> their
>>> types, and locking. Also quite some code is removed from them. As a bonus
>>> drivers get automatically VM_FAULT_RETRY handling. The primary motivation 
>>> for
>>> this series is to remove knowledge about mmap_sem locking from as many 
>>> places a
>>> possible so that we can change it with reasonable effort.
>>>
>>> The core of the series is the new helper get_vaddr_frames() which is given a
>>> virtual address and it fills in PFNs / struct page pointers (depending on 
>>> VMA
>>> type) into the provided array. If PFNs correspond to normal pages it also 
>>> grabs
>>> references to these pages. The difference from get_user_pages() is that this
>>> function can also deal with pfnmap, and io mappings which is what the media
>>> drivers need.
>>>
>>> I have tested the patches with vivid driver so at least vb2 code got some
>>> exposure. Conversion of other drivers was just compile-tested (for x86 so 
>>> e.g.
>>> exynos driver which is only for Samsung platform is completely untested).
>>>
>>> Andrew, can you please update the patches in mm three? Thanks!
>>>
>>> Honza
>>>
>>> Changes since v5:
>>> * Moved mm helper into a separate file and behind a config option
>>> * Changed the first patch pushing mmap_sem down in videobuf2 core to avoid
>>>   possible deadlock
>>>
>>> Changes since v4:
>>> * Minor cleanups and fixes pointed out by Mel and Vlasta
>>> * Added Acked-by tags
>>>
>>> Changes since v3:
>>> * Added include  into mm/gup.c as it's needed for some 
>>> archs
>>> * Fixed error path for exynos driver
>>>
>>> Changes since v2:
>>> * Renamed functions and structures as Mel suggested
>>> * Other minor changes suggested by Mel
>>> * Rebased on top of 4.1-rc2
>>> * Changed functions to get pointer to array of pages / pfns to perform
>>>   conversion if necessary. This fixes possible issue in the omap I may have
>>>   introduced in v2 and generally makes the API less errorprone.
> 
> --
> 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 4/5] [media] adv7604: Deliver resolution change events to userspace

2015-07-13 Thread Hans Verkuil
On 06/24/2015 06:50 PM, Lars-Peter Clausen wrote:
> Use the new v4l2_subdev_notify_event() helper function to deliver the
> resolution change event to userspace via the v4l2 subdev event queue as
> well as to the bridge driver using the callback notify mechanism.
> 
> This allows userspace applications to react to changes in resolution. This
> is useful and often necessary for video pipelines where there is no direct
> 1-to-1 relationship between the subdevice converter and the video capture
> device and hence it does not make sense to directly forward the event to
> the video capture device node.
> 
> Signed-off-by: Lars-Peter Clausen 
> ---
>  drivers/media/i2c/adv7604.c | 23 ++-
>  1 file changed, 18 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
> index cf1cb5a..b66f63e3 100644
> --- a/drivers/media/i2c/adv7604.c
> +++ b/drivers/media/i2c/adv7604.c
> @@ -1761,8 +1761,8 @@ static int adv76xx_s_routing(struct v4l2_subdev *sd,
>   select_input(sd);
>   enable_input(sd);
>  
> - v4l2_subdev_notify(sd, V4L2_DEVICE_NOTIFY_EVENT,
> -(void *)&adv76xx_ev_fmt);
> + v4l2_subdev_notify_event(sd, &adv76xx_ev_fmt);
> +
>   return 0;
>  }
>  
> @@ -1929,8 +1929,7 @@ static int adv76xx_isr(struct v4l2_subdev *sd, u32 
> status, bool *handled)
>   "%s: fmt_change = 0x%x, fmt_change_digital = 0x%x\n",
>   __func__, fmt_change, fmt_change_digital);
>  
> - v4l2_subdev_notify(sd, V4L2_DEVICE_NOTIFY_EVENT,
> -(void *)&adv76xx_ev_fmt);
> + v4l2_subdev_notify_event(sd, &adv76xx_ev_fmt);
>  
>   if (handled)
>   *handled = true;
> @@ -2348,6 +2347,20 @@ static int adv76xx_log_status(struct v4l2_subdev *sd)
>   return 0;
>  }
>  
> +static int adv76xx_subscribe_event(struct v4l2_subdev *sd,
> +struct v4l2_fh *fh,
> +struct v4l2_event_subscription *sub)
> +{
> + switch (sub->type) {
> + case V4L2_EVENT_SOURCE_CHANGE:
> + return v4l2_src_change_event_subdev_subscribe(sd, fh, sub);
> + case V4L2_EVENT_CTRL:
> + return v4l2_event_subdev_unsubscribe(sd, fh, sub);

This should be v4l2_ctrl_subdev_subscribe_event() of course. I'll fix this in
the patch before sending the pull request. Ditto for the adv7842 patch.

Regards,

Hans

> + default:
> + return -EINVAL;
> + }
> +}
> +
>  /* --- */
>  
>  static const struct v4l2_ctrl_ops adv76xx_ctrl_ops = {
> @@ -2357,7 +2370,7 @@ static const struct v4l2_ctrl_ops adv76xx_ctrl_ops = {
>  static const struct v4l2_subdev_core_ops adv76xx_core_ops = {
>   .log_status = adv76xx_log_status,
>   .interrupt_service_routine = adv76xx_isr,
> - .subscribe_event = v4l2_ctrl_subdev_subscribe_event,
> + .subscribe_event = adv76xx_subscribe_event,
>   .unsubscribe_event = v4l2_event_subdev_unsubscribe,
>  #ifdef CONFIG_VIDEO_ADV_DEBUG
>   .g_register = adv76xx_g_register,
> 

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


Re: [PATCH] [media] v4l2-subdev: return -EPIPE instead of -EINVAL in link validate default

2015-07-13 Thread Laurent Pinchart
Hello,

On Monday 13 July 2015 11:03:43 Sakari Ailus wrote:
> Helen Fornazier wrote:
> > On Tue, Jun 30, 2015 at 4:26 PM, Helen Fornazier wrote:
> >> On Tue, Jun 30, 2015 at 6:19 AM, Sakari Ailus wrote:
> >>> Laurent Pinchart wrote:
>  On Monday 29 June 2015 10:23:34 Sakari Ailus wrote:
> > Helen Fornazier wrote:
> >> According to the V4L2 API, the VIDIOC_STREAMON ioctl should return
> >> EPIPE when the pipeline configuration is invalid.
> >> 
> >> As the .vidioc_streamon in the v4l2_ioctl_ops usually forwards the
> >> error caused by the v4l2_subdev_link_validate_default (if it is in
> >> use), it should return -EPIPE if it detects a format mismatch in the
> >> pipeline configuration
> > 
> > Only link configuration errors have yielded -EPIPE so far, sub-device
> > format configuration error has returned -INVAL instead as you noticed.
>  
>  It should also be noted that while v4l2_subdev_link_validate() will
>  return -EINVAL in case of error, the only driver that performs custom
>  link validation (omap3isp/ispccdc.c) will return -EPIPE.
> >>> 
> >>> Good point. That has escaped me until now.
> >>> 
> > There are not many sources of -EINVAL while enabling streaming and all
> > others are directly caused by the application; I lean towards thinking
> > the code is good as it was. The documentation could be improved
> > though. It may not be clear which error codes could be caused by
> > different conditions.
> > 
> > The debug level messages from media module
> > (drivers/media/media-entity.c) do provide more information if needed,
> > albeit this certainly is not an application interface.
> > 
> > I wonder what others think.
>  
>  There's a discrepancy between the implementation and the documentation,
>  so at least one of them need to be fixed. -EPIPE would be coherent with
>  the documentation and seems appropriately named, but another error code
>  would allow userspace to tell link configuration and format
>  configuration problems apart.
> >>> 
> >>> That was the original intent, I think.
> >>> 
>  Do you think -EINVAL is the most appropriate error code for format
>  configuration ? It's already used to indicate that the stream type is
>  invalid or that not enough buffers have been allocated, and is also
>  used by drivers directly for various purposes.
> >>> 
> >>> That's true, it's been used also for that purpose. At the time this
> >>> certainly was not the primary concern. If you can think of a better
> >>> error code for the purpose (than EINVAL) I'm certainly fine with using
> >>> one.
> >>>
> >>> I still think that -EPIPE is worse for telling about incorrect format
> >>> configuration than -EINVAL since it's relatively easy to avoid -EINVAL
> >>> for the documented reasons.
> >>> 
> >> 
> >> I'd like just to point out where in the docs EPIPE for format mismatch
> >> is specified, as it is not described in the streamon page as I thought
> >> it would, but it is in the subdev page in case anyone is looking for
> >> it (as I took some time to find it too):
> >> 
> >> http://linuxtv.org/downloads/v4l-dvb-apis/subdev.html
> >> "Applications are responsible for configuring coherent parameters on
> >> the whole pipeline and making sure that connected pads have compatible
> >> formats. The pipeline is checked for formats mismatch at
> >> VIDIOC_STREAMON time, and an EPIPE error code is then returned if the
> >> configuration is invalid"
> >> 
> >> So maybe the doc should be improved as you already stated.
> > 
> > I would like to revive this subject.
> > 
> > Should we change the docs? Change the -EINVAL to -EPIPE, or create another
> > error code? What are your opinion?
> > 
> > I read in the docs of dev-kmsg that EPIPE is returned when messages get
> > overwritten, and in other parts of the code EPIPE is returned when there
> > is an error in the pipeline communication level while trying to send
> > information through the pipe or a pipe broken error.
> > 
> > But in the error-codes.txt files, the EPIPE error is defined as:
> > *EPIPE "The pipe type specified in the URB doesn't match the endpoint's
> > actual type"*

Just a bit of background information first. The Linux kernel uses error codes 
standardized by POSIX. A limited number of additional error codes have been 
added over time, but the usual approach when an error that doesn't match POSIX 
semantics is to reuse an existing error code whose name matches the error 
relatively well. EPIPE in USB is such an example, POSIX error codes have no 
knowledge of USB. We have similarly selected EPIPE for the media controller 
API as it seemed a good match to report errors related to the pipeline.

> This exact definition sound USB specific to me.

Yes, error-codes.txt is in Documentation/usb/, so that's expected :-)

> > Then, if EPIPE is used when types don't match between two endpoints, it
> > seems rea

Re: [Patch v3 1/1] media: am437x-vpfe: Requested frame size and fmt overwritten by current sensor setting

2015-07-13 Thread Hans Verkuil
On 06/29/2015 11:19 PM, Benoit Parrot wrote:
> Upon a S_FMT the input/requested frame size and pixel format is
> overwritten by the current sub-device settings.
> Fix this so application can actually set the frame size and format.
> 
> Fixes: 417d2e507edc ("[media] media: platform: add VPFE capture driver 
> support for AM437X")
> Cc:  # v4.0+
> Signed-off-by: Benoit Parrot 
> ---
> Changes since v2:
> - fix the stable commit reference syntax
> 
>  drivers/media/platform/am437x/am437x-vpfe.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/am437x/am437x-vpfe.c 
> b/drivers/media/platform/am437x/am437x-vpfe.c
> index eb25c43da126..0fa62c50f62d 100644
> --- a/drivers/media/platform/am437x/am437x-vpfe.c
> +++ b/drivers/media/platform/am437x/am437x-vpfe.c
> @@ -1584,7 +1584,7 @@ static int vpfe_s_fmt(struct file *file, void *priv,
>   return -EBUSY;
>   }
>  
> - ret = vpfe_try_fmt(file, priv, fmt);
> + ret = vpfe_try_fmt(file, priv, &format);
>   if (ret)
>   return ret;
>  
> 

I'm sorry, but this is wrong. The actual bug is not in s_fmt but in try_fmt.

try_fmt is not actually attempting to 'try' the format, but it just gets the
current subdev settings.

Instead it should do what s_fmt is doing, except for actually setting the 
format.

Frankly the am437x code is a bit of a mess in how it implements try and s_fmt.

Now, I am going to merge this patch anyway since it is clear from the code
that &format was intended. But this code certainly needs some more TLC since
this patch only addresses a small part of a much bigger problem.

Regards,

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


Re: [Patch v3 1/1] media: am437x-vpfe: Fix a race condition during release

2015-07-13 Thread Hans Verkuil
On 06/29/2015 11:18 PM, Benoit Parrot wrote:
> There was a race condition where during cleanup/release operation
> on-going streaming would cause a kernel panic because the hardware
> module was disabled prematurely with IRQ still pending.
> 
> Fixes: 417d2e507edc ("[media] media: platform: add VPFE capture driver 
> support for AM437X")
> Cc:  # v4.0+
> Signed-off-by: Benoit Parrot 
> ---
> Changes since v2:
> - fix the stable commit reference syntax
> 
>  drivers/media/platform/am437x/am437x-vpfe.c | 11 +--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/am437x/am437x-vpfe.c 
> b/drivers/media/platform/am437x/am437x-vpfe.c
> index a30cc2f7e4f1..eb25c43da126 100644
> --- a/drivers/media/platform/am437x/am437x-vpfe.c
> +++ b/drivers/media/platform/am437x/am437x-vpfe.c
> @@ -1185,14 +1185,21 @@ static int vpfe_initialize_device(struct vpfe_device 
> *vpfe)
>  static int vpfe_release(struct file *file)
>  {
>   struct vpfe_device *vpfe = video_drvdata(file);
> + bool fh_singular = v4l2_fh_is_singular_file(file);

Close, but no cigar.

The assignment to fh_singular should be moved inside the mutex. Right now
there still is a race condition between setting fh_singular and taking
the lock.

Regards,

Hans

>   int ret;
>  
>   mutex_lock(&vpfe->lock);
>  
> - if (v4l2_fh_is_singular_file(file))
> - vpfe_ccdc_close(&vpfe->ccdc, vpfe->pdev);
> + /* the release helper will cleanup any on-going streaming */
>   ret = _vb2_fop_release(file, NULL);
>  
> + /*
> +  * If this was the last open file.
> +  * Then de-initialize hw module.
> +  */
> + if (fh_singular)
> + vpfe_ccdc_close(&vpfe->ccdc, vpfe->pdev);
> +
>   mutex_unlock(&vpfe->lock);
>  
>   return ret;
> 

--
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: dvb_usb_af9015: command failed=1 _ kernel >= 4.1.x

2015-07-13 Thread poma
On 07.07.2015 10:48, poma wrote:
> On 06.07.2015 22:17, Jose Alberto Reguero wrote:
>> I made the patch for the af9035. I have not a af9015 whith mxl5007 and dual 
>> channel. Revert it, if it cause regresions.
>>
>> Jose Alberto
>>
> 
> Thanks.
> 
> From e19560ea038e54dc57be717db55f19d449df63f0 Mon Sep 17 00:00:00 2001
> From: poma 
> Date: Tue, 7 Jul 2015 10:26:13 +0200
> Subject: [PATCH] Fix for AF9015 DVB-T USB2.0 stick
> 
> This reverts commitas:
> 
> - 02f9cf96df57575acea2e6eb4041e9f3ecd32548
>   "[media] [PATH,2/2] mxl5007 move loop_thru to attach"
> - fe4860af002a4516dd878f7297b61e186c475b35
>   "[media] [PATH,1/2] mxl5007 move reset to attach"
> 
> This is the conclusion after extensive testing,
> these two commitas produce:
> 
> mxl5007t_soft_reset: 521: failed!
> mxl5007t_attach: error -121 on line 907
> 
> causing AF9015 DVB-T USB2.0 stick completely unusable.
> 
> 
> Tested-by: poma 
> ---
>  drivers/media/tuners/mxl5007t.c | 30 +-
>  1 file changed, 5 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/media/tuners/mxl5007t.c b/drivers/media/tuners/mxl5007t.c
> index f4ae04c..f8c4ba2 100644
> --- a/drivers/media/tuners/mxl5007t.c
> +++ b/drivers/media/tuners/mxl5007t.c
> @@ -374,6 +374,7 @@ static struct reg_pair_t *mxl5007t_calc_init_regs(struct 
> mxl5007t_state *state,
>   mxl5007t_set_if_freq_bits(state, cfg->if_freq_hz, cfg->invert_if);
>   mxl5007t_set_xtal_freq_bits(state, cfg->xtal_freq_hz);
>  
> + set_reg_bits(state->tab_init, 0x04, 0x01, cfg->loop_thru_enable);
>   set_reg_bits(state->tab_init, 0x03, 0x08, cfg->clk_out_enable << 3);
>   set_reg_bits(state->tab_init, 0x03, 0x07, cfg->clk_out_amp);
>  
> @@ -530,6 +531,10 @@ static int mxl5007t_tuner_init(struct mxl5007t_state 
> *state,
>   struct reg_pair_t *init_regs;
>   int ret;
>  
> + ret = mxl5007t_soft_reset(state);
> + if (mxl_fail(ret))
> + goto fail;
> +
>   /* calculate initialization reg array */
>   init_regs = mxl5007t_calc_init_regs(state, mode);
>  
> @@ -895,32 +900,7 @@ struct dvb_frontend *mxl5007t_attach(struct dvb_frontend 
> *fe,
>   /* existing tuner instance */
>   break;
>   }
> -
> - if (fe->ops.i2c_gate_ctrl)
> - fe->ops.i2c_gate_ctrl(fe, 1);
> -
> - ret = mxl5007t_soft_reset(state);
> -
> - if (fe->ops.i2c_gate_ctrl)
> - fe->ops.i2c_gate_ctrl(fe, 0);
> -
> - if (mxl_fail(ret))
> - goto fail;
> -
> - if (fe->ops.i2c_gate_ctrl)
> - fe->ops.i2c_gate_ctrl(fe, 1);
> -
> - ret = mxl5007t_write_reg(state, 0x04,
> - state->config->loop_thru_enable);
> -
> - if (fe->ops.i2c_gate_ctrl)
> - fe->ops.i2c_gate_ctrl(fe, 0);
> -
> - if (mxl_fail(ret))
> - goto fail;
> -
>   fe->tuner_priv = state;
> -
>   mutex_unlock(&mxl5007t_list_mutex);
>  
>   memcpy(&fe->ops.tuner_ops, &mxl5007t_tuner_ops,
> 


Guys, any chance to push this any time soon?


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


[PATCH] [media] bdisp: fix debug info memory access

2015-07-13 Thread Fabien Dessenne
bdisp_dev->dbg.copy_node shall be a copy of (and not point to)
bdisp_ctx->node, since this resource is freed upon driver release.

Signed-off-by: Fabien Dessenne 
---
 drivers/media/platform/sti/bdisp/bdisp-hw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/sti/bdisp/bdisp-hw.c 
b/drivers/media/platform/sti/bdisp/bdisp-hw.c
index c83f9c2..052c932 100644
--- a/drivers/media/platform/sti/bdisp/bdisp-hw.c
+++ b/drivers/media/platform/sti/bdisp/bdisp-hw.c
@@ -768,12 +768,12 @@ static void bdisp_hw_save_request(struct bdisp_ctx *ctx)
/* Allocate memory if not done yet */
if (!copy_node[i]) {
copy_node[i] = devm_kzalloc(ctx->bdisp_dev->dev,
-   sizeof(*copy_node),
+   sizeof(*copy_node[i]),
GFP_KERNEL);
if (!copy_node[i])
return;
}
-   copy_node[i] = node[i];
+   *copy_node[i] = *node[i];
}
 }
 
-- 
1.9.1

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


Re: [PATCH 1/5] [media] tc358743: register v4l2 asynchronous subdevice

2015-07-13 Thread Hans Verkuil
On 07/10/2015 03:11 PM, Philipp Zabel wrote:
> Add support for registering the sensor subdevice using the v4l2-async API.
> 
> Signed-off-by: Philipp Zabel 
> ---
>  drivers/media/i2c/tc358743.c | 12 
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
> index 34d4f32..48d1575 100644
> --- a/drivers/media/i2c/tc358743.c
> +++ b/drivers/media/i2c/tc358743.c
> @@ -1710,6 +1710,16 @@ static int tc358743_probe(struct i2c_client *client,
>   goto err_hdl;
>   }
>  
> + state->pad.flags = MEDIA_PAD_FL_SOURCE;
> + err = media_entity_init(&sd->entity, 1, &state->pad, 0);
> + if (err < 0)
> + goto err_hdl;
> +
> + sd->dev = &client->dev;
> + err = v4l2_async_register_subdev(sd);
> + if (err < 0)
> + goto err_hdl;
> +
>   mutex_init(&state->confctl_mutex);
>  
>   INIT_DELAYED_WORK(&state->delayed_work_enable_hotplug,
> @@ -1740,6 +1750,7 @@ err_work_queues:
>   destroy_workqueue(state->work_queues);
>   mutex_destroy(&state->confctl_mutex);
>  err_hdl:
> + media_entity_cleanup(&sd->entity);
>   v4l2_ctrl_handler_free(&state->hdl);
>   return err;
>  }
> @@ -1751,6 +1762,7 @@ static int tc358743_remove(struct i2c_client *client)
>  
>   cancel_delayed_work(&state->delayed_work_enable_hotplug);
>   destroy_workqueue(state->work_queues);
> + v4l2_async_unregister_subdev(sd);

Shouldn't there be a media_entity_cleanup() call in tc358743_remove() as well?

Regards,

Hans

>   v4l2_device_unregister_subdev(sd);
>   mutex_destroy(&state->confctl_mutex);
>   v4l2_ctrl_handler_free(&state->hdl);
> 

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


Re: [PATCH 3/5] [media] tc358743: support probe from device tree

2015-07-13 Thread Hans Verkuil
On 07/10/2015 03:11 PM, Philipp Zabel wrote:
> Add support for probing the TC358743 subdevice from device tree.
> The reference clock must be supplied using the common clock bindings.
> MIPI CSI-2 specific properties are parsed from the OF graph endpoint
> node and support for a non-continuous MIPI CSI-2 clock is added.
> 
> Signed-off-by: Philipp Zabel 
> ---
>  .../devicetree/bindings/media/i2c/tc358743.txt |  48 +++
>  drivers/media/i2c/tc358743.c   | 153 
> -
>  2 files changed, 195 insertions(+), 6 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/media/i2c/tc358743.txt
> 
> diff --git a/Documentation/devicetree/bindings/media/i2c/tc358743.txt 
> b/Documentation/devicetree/bindings/media/i2c/tc358743.txt
> new file mode 100644
> index 000..5218921
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/i2c/tc358743.txt
> @@ -0,0 +1,48 @@
> +* Toshiba TC358743 HDMI-RX to MIPI CSI2-TX Bridge
> +
> +The Toshiba TC358743 HDMI-RX to MIPI CSI2-TX (H2C) is a bridge that converts
> +a HDMI stream to MIPI CSI-2 TX. It is programmable through I2C.
> +
> +Required Properties:
> +
> +- compatible: value should be "toshiba,tc358743"
> +- clocks, clock-names: should contain a phandle link to the reference clock
> +source, the clock input is named "refclk".
> +
> +Optional Properties:
> +
> +- reset-gpios: gpio phandle GPIO connected to the reset pin
> +- interrupts, interrupt-parent: GPIO connected to the interrupt pin
> +- data-lanes: should be <1 2 3 4> for four-lane operation,
> +   or <1 2> for two-lane operation
> +- clock-lanes: should be <0>
> +- clock-noncontinuous: Presence of this boolean property decides whether the
> +MIPI CSI-2 clock is continuous or non-continuous.
> +- link-frequencies: List of allowed link frequencies in Hz. Each frequency is
> + expressed as a 64-bit big-endian integer. The frequency
> + is half of the bps per lane due to DDR transmission.
> +
> +For further information on the MIPI CSI-2 endpoint node properties, see
> +Documentation/devicetree/bindings/media/video-interfaces.txt.
> +
> +Example:
> +
> + tc358743@0f {
> + compatible = "toshiba,tc358743";
> + reg = <0x0f>;
> + clocks = <&hdmi_osc>;
> + clock-names = "refclk";
> + reset-gpios = <&gpio6 9 GPIO_ACTIVE_LOW>;
> + interrupt-parent = <&gpio2>;
> + interrupts = <5 IRQ_TYPE_LEVEL_HIGH>;
> +
> + port {
> + tc358743_out: endpoint {
> + remote-endpoint = <&mipi_csi2_in>;
> + data-lanes = <1 2 3 4>;
> + clock-lanes = <0>;
> + clock-noncontinuous;
> + link-frequencies = /bits/ 64 <29700>;
> + };
> + };
> + };
> diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
> index 0be6d9f..02c60b3 100644
> --- a/drivers/media/i2c/tc358743.c
> +++ b/drivers/media/i2c/tc358743.c
> @@ -29,7 +29,9 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -37,6 +39,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  
>  #include "tc358743_regs.h"
> @@ -69,6 +72,7 @@ static const struct v4l2_dv_timings_cap 
> tc358743_timings_cap = {
>  
>  struct tc358743_state {
>   struct tc358743_platform_data pdata;
> + struct v4l2_of_bus_mipi_csi2 bus;

Where is this bus struct set?

>   struct v4l2_subdev sd;
>   struct media_pad pad;
>   struct v4l2_ctrl_handler hdl;
> @@ -90,6 +94,8 @@ struct tc358743_state {
>  
>   struct v4l2_dv_timings timings;
>   u32 mbus_fmt_code;
> +
> + struct gpio_desc *reset_gpio;
>  };
>  
>  static void tc358743_enable_interrupts(struct v4l2_subdev *sd,
> @@ -700,7 +706,8 @@ static void tc358743_set_csi(struct v4l2_subdev *sd)
>   ((lanes > 2) ? MASK_D2M_HSTXVREGEN : 0x0) |
>   ((lanes > 3) ? MASK_D3M_HSTXVREGEN : 0x0));
>  
> - i2c_wr32(sd, TXOPTIONCNTRL, MASK_CONTCLKMODE);
> + i2c_wr32(sd, TXOPTIONCNTRL, (state->bus.flags &
> +  V4L2_MBUS_CSI2_CONTINUOUS_CLOCK) ? MASK_CONTCLKMODE : 0);

It's used here.

BTW, since I don't see state->bus being set, that means bus.flags == 0 and
so this register is now set to 0 instead of MASK_CONTCLKMODE.

When using platform data I guess bus.flags should be set to
V4L2_MBUS_CSI2_CONTINUOUS_CLOCK to prevent breakage.

>   i2c_wr32(sd, STARTCNTRL, MASK_START);
>   i2c_wr32(sd, CSI_START, MASK_STRT);
>  
> @@ -1638,6 +1645,135 @@ static const struct v4l2_ctrl_config 
> tc358743_ctrl_audio_present = {
>  
>  /* --- PROBE / REMOVE --- */
>  
> +#if CONFIG_OF
> +static void tc358743_gpio_reset(struct tc358743_state *

Re: [PATCH 2/5] [media] tc358743: enable v4l2 subdevice devnode

2015-07-13 Thread Hans Verkuil
On 07/10/2015 03:11 PM, Philipp Zabel wrote:
> Signed-off-by: Philipp Zabel 
> ---
>  drivers/media/i2c/tc358743.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
> index 48d1575..0be6d9f 100644
> --- a/drivers/media/i2c/tc358743.c
> +++ b/drivers/media/i2c/tc358743.c
> @@ -1668,7 +1668,7 @@ static int tc358743_probe(struct i2c_client *client,
>   state->i2c_client = client;
>   sd = &state->sd;
>   v4l2_i2c_subdev_init(sd, client, &tc358743_ops);
> - sd->flags |= V4L2_SUBDEV_FL_HAS_EVENTS;
> + sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;

Note: HAS_EVENTS won't do much since there are no .subscribe_event or
.unsubscribe_event ops. You should add those.

Regards,

Hans

>  
>   /* i2c access */
>   if ((i2c_rd16(sd, CHIPID) & MASK_CHIPID) != 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 4/5] [media] adv7604: Deliver resolution change events to userspace

2015-07-13 Thread Lars-Peter Clausen

On 07/13/2015 11:02 AM, Hans Verkuil wrote:

+static int adv76xx_subscribe_event(struct v4l2_subdev *sd,
+  struct v4l2_fh *fh,
+  struct v4l2_event_subscription *sub)
+{
+   switch (sub->type) {
+   case V4L2_EVENT_SOURCE_CHANGE:
+   return v4l2_src_change_event_subdev_subscribe(sd, fh, sub);
+   case V4L2_EVENT_CTRL:
+   return v4l2_event_subdev_unsubscribe(sd, fh, sub);


This should be v4l2_ctrl_subdev_subscribe_event() of course. I'll fix this in
the patch before sending the pull request. Ditto for the adv7842 patch.


Thanks.


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


[GIT PULL FOR v4.3] Various fixes/enhancements

2015-07-13 Thread Hans Verkuil
Nothing spectacular here, just a bunch of fixes and enhancements.

Regards,

Hans


The following changes since commit 8783b9c50400c6279d7c3b716637b98e83d3c933:

  [media] SMI PCIe IR driver for DVBSky cards (2015-07-06 08:26:16 -0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git for-v4.3a

for you to fetch changes up to b65e0bb52de5d0289034cc739337cfe549607134:

  bdisp: fix debug info memory access (2015-07-13 12:27:35 +0200)


Benoit Parrot (1):
  media: am437x-vpfe: Requested frame size and fmt overwritten by current 
sensor setting

Ezequiel Garcia (2):
  stk1160: Reduce driver verbosity
  stk1160: Add frame scaling support

Fabien Dessenne (3):
  bdisp: composing support
  bdisp: add debug info for RGB24 format
  bdisp: fix debug info memory access

Geert Uytterhoeven (1):
  adv7604/cobalt: Allow compile test if !GPIOLIB

Hans Verkuil (3):
  v4l2-event: v4l2_event_queue: do nothing if vdev == NULL
  DocBook: fix media-ioc-device-info.xml type
  DocBook media: fix typo in V4L2_CTRL_FLAG_EXECUTE_ON_WRITE

Lars-Peter Clausen (5):
  adv7604: Add support for control event notifications
  adv7842: Add support for control event notifications
  Add helper function for subdev event notifications
  adv7604: Deliver resolution change events to userspace
  adv7842: Deliver resolution change events to userspace

 Documentation/DocBook/media/v4l/media-ioc-device-info.xml |   2 +-
 Documentation/DocBook/media/v4l/vidioc-queryctrl.xml  |   2 +-
 drivers/media/i2c/adv7604.c   |  26 ++--
 drivers/media/i2c/adv7842.c   |  25 ++--
 drivers/media/pci/cobalt/Kconfig  |   3 +-
 drivers/media/platform/am437x/am437x-vpfe.c   |   2 +-
 drivers/media/platform/sti/bdisp/bdisp-debug.c|   8 +++
 drivers/media/platform/sti/bdisp/bdisp-hw.c   |  12 ++--
 drivers/media/platform/sti/bdisp/bdisp-v4l2.c |  76 
+++
 drivers/media/usb/stk1160/stk1160-core.c  |   5 +-
 drivers/media/usb/stk1160/stk1160-reg.h   |  34 +++
 drivers/media/usb/stk1160/stk1160-v4l.c   | 217 
+++---
 drivers/media/usb/stk1160/stk1160.h   |   1 -
 drivers/media/v4l2-core/v4l2-event.c  |   3 +
 drivers/media/v4l2-core/v4l2-subdev.c |  18 ++
 include/media/v4l2-subdev.h   |   4 ++
 16 files changed, 352 insertions(+), 86 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/5] [media] tc358743: allow event subscription

2015-07-13 Thread Hans Verkuil
On 07/10/2015 03:11 PM, Philipp Zabel wrote:
> This is useful to subscribe to HDMI hotplug events via the
> V4L2_CID_DV_RX_POWER_PRESENT control.
> 
> Signed-off-by: Philipp Zabel 
> ---
>  drivers/media/i2c/tc358743.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
> index 4a889d4..91fffa8 100644
> --- a/drivers/media/i2c/tc358743.c
> +++ b/drivers/media/i2c/tc358743.c
> @@ -40,6 +40,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> @@ -1604,6 +1605,8 @@ static const struct v4l2_subdev_core_ops 
> tc358743_core_ops = {
>   .s_register = tc358743_s_register,
>  #endif
>   .interrupt_service_routine = tc358743_isr,
> + .subscribe_event = v4l2_ctrl_subdev_subscribe_event,

Ah, they are set here.

But note that v4l2_ctrl_subdev_subscribe_event is not enough, since this driver
also issues the V4L2_EVENT_SOURCE_CHANGE event.

See this patch on how to do that:

http://git.linuxtv.org/cgit.cgi/hverkuil/media_tree.git/commit/?h=for-v4.3a&id=85c9b0b83795dac3d27043619a727af5c7313fe7

Note: requires the new v4l2_subdev_notify_event function that's not yet
merged (just posted the pull request for that).

Regards,

Hans

> + .unsubscribe_event = v4l2_event_subdev_unsubscribe,
>  };
>  
>  static const struct v4l2_subdev_video_ops tc358743_video_ops = {
> 

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


Re: [RFC v04] Driver for Toshiba TC358743

2015-07-13 Thread Hans Verkuil
Hi Mats, Philipp,

I'll merge this driver, but not yet the follow-ups from Philipp since those
need some more work.

Regards,

Hans

On 07/09/2015 10:45 AM, matra...@cisco.com wrote:
> From: Mats Randgaard 
> 
> Improvements based on feedback from Hans Verkuil:
> - Use functions in linux/hdmi.h to print AVI info frames
> - Replace private format change event with V4L2_EVENT_SOURCE_CHANGE
> - Rewrite set_fmt/get_fmt
> - Remove V4L2_SUBDEV_FL_HAS_DEVNODE
> 
> Other improvements since the previous version:
> - Protect CONFCTL with a mutex since it is written in both process
>   context and interrupt context
> - Restructure and describe the platform data
> - Replace the register that is verified in the probe function with the
>   read-only register CHIPID
> 
> Mats Randgaard (1):
>   Driver for Toshiba TC358743 HDMI to CSI-2 bridge
> 
>  MAINTAINERS|7 +
>  drivers/media/i2c/Kconfig  |9 +
>  drivers/media/i2c/Makefile |1 +
>  drivers/media/i2c/tc358743.c   | 1778 
> 
>  drivers/media/i2c/tc358743_regs.h  |  681 ++
>  include/media/tc358743.h   |  131 +++
>  include/uapi/linux/v4l2-controls.h |4 +
>  7 files changed, 2611 insertions(+)
>  create mode 100644 drivers/media/i2c/tc358743.c
>  create mode 100644 drivers/media/i2c/tc358743_regs.h
>  create mode 100644 include/media/tc358743.h
> 

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


[GIT PULL FOR v4.3] Various fixes/enhancements: v2

2015-07-13 Thread Hans Verkuil
Nothing spectacular here, just a bunch of fixes and enhancements.

It's v2 because I managed to drop one chunk of Geert's patch in v1.

Regards,

Hans

The following changes since commit 8783b9c50400c6279d7c3b716637b98e83d3c933:

  [media] SMI PCIe IR driver for DVBSky cards (2015-07-06 08:26:16 -0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git for-v4.3a

for you to fetch changes up to 0d35c715e351e2983b6256b3c04e3c835567c891:

  bdisp: fix debug info memory access (2015-07-13 13:11:28 +0200)


Benoit Parrot (1):
  media: am437x-vpfe: Requested frame size and fmt overwritten by current 
sensor setting

Ezequiel Garcia (2):
  stk1160: Reduce driver verbosity
  stk1160: Add frame scaling support

Fabien Dessenne (3):
  bdisp: composing support
  bdisp: add debug info for RGB24 format
  bdisp: fix debug info memory access

Geert Uytterhoeven (1):
  adv7604/cobalt: Allow compile test if !GPIOLIB

Hans Verkuil (3):
  v4l2-event: v4l2_event_queue: do nothing if vdev == NULL
  DocBook: fix media-ioc-device-info.xml type
  DocBook media: fix typo in V4L2_CTRL_FLAG_EXECUTE_ON_WRITE

Lars-Peter Clausen (5):
  adv7604: Add support for control event notifications
  adv7842: Add support for control event notifications
  Add helper function for subdev event notifications
  adv7604: Deliver resolution change events to userspace
  adv7842: Deliver resolution change events to userspace

 Documentation/DocBook/media/v4l/media-ioc-device-info.xml |   2 +-
 Documentation/DocBook/media/v4l/vidioc-queryctrl.xml  |   2 +-
 drivers/media/i2c/Kconfig |   3 +-
 drivers/media/i2c/adv7604.c   |  26 ++--
 drivers/media/i2c/adv7842.c   |  25 ++--
 drivers/media/pci/cobalt/Kconfig  |   3 +-
 drivers/media/platform/am437x/am437x-vpfe.c   |   2 +-
 drivers/media/platform/sti/bdisp/bdisp-debug.c|   8 +++
 drivers/media/platform/sti/bdisp/bdisp-hw.c   |  12 ++--
 drivers/media/platform/sti/bdisp/bdisp-v4l2.c |  76 
+++
 drivers/media/usb/stk1160/stk1160-core.c  |   5 +-
 drivers/media/usb/stk1160/stk1160-reg.h   |  34 +++
 drivers/media/usb/stk1160/stk1160-v4l.c   | 217 
+++---
 drivers/media/usb/stk1160/stk1160.h   |   1 -
 drivers/media/v4l2-core/v4l2-event.c  |   3 +
 drivers/media/v4l2-core/v4l2-subdev.c |  18 ++
 include/media/v4l2-subdev.h   |   4 ++
 17 files changed, 354 insertions(+), 87 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


[GIT PULL FOR v4.3] Add Toshiba TC358743 HDMI to CSI-2 bridge

2015-07-13 Thread Hans Verkuil
Add the new Toshiba TC358743 HDMI to CSI-2 bridge driver.

Regards,

Hans

The following changes since commit 8783b9c50400c6279d7c3b716637b98e83d3c933:

  [media] SMI PCIe IR driver for DVBSky cards (2015-07-06 08:26:16 -0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git tc358743

for you to fetch changes up to e0a725a60fde6b634e1213d1a9fc061f94fcf678:

  Driver for Toshiba TC358743 HDMI to CSI-2 bridge (2015-07-13 13:17:50 +0200)


Mats Randgaard (1):
  Driver for Toshiba TC358743 HDMI to CSI-2 bridge

 MAINTAINERS|7 +
 drivers/media/i2c/Kconfig  |9 +
 drivers/media/i2c/Makefile |1 +
 drivers/media/i2c/tc358743.c   | 1778 

 drivers/media/i2c/tc358743_regs.h  |  681 ++
 include/media/tc358743.h   |  131 +++
 include/uapi/linux/v4l2-controls.h |4 +
 7 files changed, 2611 insertions(+)
 create mode 100644 drivers/media/i2c/tc358743.c
 create mode 100644 drivers/media/i2c/tc358743_regs.h
 create mode 100644 include/media/tc358743.h
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC v3 04/19] media/usb/uvc: Implement vivioc_g_def_ext_ctrls

2015-07-13 Thread Hans Verkuil
Laurent,

Can you review/ack this since it touches on uvc?

Thanks!

Hans

On 06/12/2015 06:46 PM, Ricardo Ribalda Delgado wrote:
> Callback needed by ioctl VIDIOC_G_DEF_EXT_CTRLS as this driver does not
> use the controller framework.
> 
> Signed-off-by: Ricardo Ribalda Delgado 
> ---
>  drivers/media/usb/uvc/uvc_v4l2.c | 30 ++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/drivers/media/usb/uvc/uvc_v4l2.c 
> b/drivers/media/usb/uvc/uvc_v4l2.c
> index 2764f43607c1..e2698a77138a 100644
> --- a/drivers/media/usb/uvc/uvc_v4l2.c
> +++ b/drivers/media/usb/uvc/uvc_v4l2.c
> @@ -1001,6 +1001,35 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, 
> void *fh,
>   return uvc_ctrl_rollback(handle);
>  }
>  
> +static int uvc_ioctl_g_def_ext_ctrls(struct file *file, void *fh,
> +  struct v4l2_ext_controls *ctrls)
> +{
> + struct uvc_fh *handle = fh;
> + struct uvc_video_chain *chain = handle->chain;
> + struct v4l2_ext_control *ctrl = ctrls->controls;
> + unsigned int i;
> + int ret;
> + struct v4l2_queryctrl qc;
> +
> + ret = uvc_ctrl_begin(chain);
> + if (ret < 0)
> + return ret;
> +
> + for (i = 0; i < ctrls->count; ++ctrl, ++i) {
> + qc.id = ctrl->id;
> + ret = uvc_query_v4l2_ctrl(chain, &qc);
> + if (ret < 0) {
> + ctrls->error_idx = i;
> + return ret;
> + }
> + ctrl->value = qc.default_value;
> + }
> +
> + ctrls->error_idx = 0;
> +
> + return 0;
> +}
> +
>  static int uvc_ioctl_s_try_ext_ctrls(struct uvc_fh *handle,
>struct v4l2_ext_controls *ctrls,
>bool commit)
> @@ -1500,6 +1529,7 @@ const struct v4l2_ioctl_ops uvc_ioctl_ops = {
>   .vidioc_g_ctrl = uvc_ioctl_g_ctrl,
>   .vidioc_s_ctrl = uvc_ioctl_s_ctrl,
>   .vidioc_g_ext_ctrls = uvc_ioctl_g_ext_ctrls,
> + .vidioc_g_def_ext_ctrls = uvc_ioctl_g_def_ext_ctrls,
>   .vidioc_s_ext_ctrls = uvc_ioctl_s_ext_ctrls,
>   .vidioc_try_ext_ctrls = uvc_ioctl_try_ext_ctrls,
>   .vidioc_querymenu = uvc_ioctl_querymenu,
> 

--
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 0/5] i.MX5/6 mem2mem scaler

2015-07-13 Thread Fabio Estevam
Hi Philipp,

On Fri, Apr 10, 2015 at 11:41 AM, Kamil Debski  wrote:
> Hi,
>
> From: linux-media-ow...@vger.kernel.org [mailto:linux-media-
> ow...@vger.kernel.org] On Behalf Of Philipp Zabel
> Sent: Tuesday, March 17, 2015 4:48 PM
>>
>> Hi,
>>
>> this series uses the IPU IC post-processing task, to implement a
>> mem2mem device for scaling and colorspace conversion.
>
> This patchset makes changes in two subsystems - media and gpu.
> It would be good to merge these patchset through a single subsystem.
>
> The media part of this patchset is good, are there any comments to
> the gpu part of this patchset?
>
> I talked with Mauro on the IRC and he acked that this patchset could be
> merged via the gpu subsystem.

Do you plan to resend this series?

It is still not applied.

Regards,

Fabio Estevam
--
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] Doc: pps: Fix file name in pps.txt

2015-07-13 Thread Jonathan Corbet
On Mon, 13 Jul 2015 08:23:15 +0200
Rodolfo Giometti  wrote:

> On Mon, Jul 13, 2015 at 12:29:11PM +0900, Masanari Iida wrote:
> > This patch fix a file name of example code.
> > 
> > Signed-off-by: Masanari Iida   
> 
> Signed-off-by: Rodolfo Giometti 

Why Signed-off-by?  Did you maybe mean Acked-by here?

Thanks,

jon
--
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] Doc: pps: Fix file name in pps.txt

2015-07-13 Thread Rodolfo Giometti
On Mon, Jul 13, 2015 at 07:21:50AM -0600, Jonathan Corbet wrote:
> On Mon, 13 Jul 2015 08:23:15 +0200
> Rodolfo Giometti  wrote:
> 
> > On Mon, Jul 13, 2015 at 12:29:11PM +0900, Masanari Iida wrote:
> > > This patch fix a file name of example code.
> > > 
> > > Signed-off-by: Masanari Iida   
> > 
> > Signed-off-by: Rodolfo Giometti 
> 
> Why Signed-off-by?  Did you maybe mean Acked-by here?

Yes, you're right... I'm sorry! :(

Acked-by: Rodolfo Giometti 

-- 

HCE Engineering  e-mail: giome...@hce-engineering.com
GNU/Linux Solutions  giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.io
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
--
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 0/10 v6] Helper to abstract vma handling in media layer

2015-07-13 Thread Jan Kara
On Mon 13-07-15 10:45:25, Hans Verkuil wrote:
> On 07/09/2015 02:12 PM, Hans Verkuil wrote:
> > On 07/09/2015 01:48 PM, Jan Kara wrote:
> >>   Hello,
> >>
> >>   Hans, did you have a chance to look at these patches? I have tested them
> >> with the vivid driver but it would be good if you could run them through
> >> your standard testing procedure as well. Andrew has updated the patches in
> >> his tree but some ack from you would be welcome...
> > 
> > I've planned a 'patch day' for Monday. So hopefully you'll see a pull 
> > request
> > by then.
> 
> OK, I'm confused. I thought the non-vb2 patches would go in for 4.2? That
> didn't happen, so I guess the plan is to merge the whole lot for 4.3 via
> our media tree? If that's the case, can you post a new patch series on

I guess Andrew wasn't sure what to push and what not so he just chose the
safe option to not push anything.

> top of the master branch of the media tree? I want to make sure I use the
> right patches. Also, if you do make a new patch series, then it would be
> better if patch 10/10 is folded into patch 2/10.

OK, I'll rebase patches on top of media tree.

Honza

> >> On Thu 18-06-15 16:08:30, Jan Kara wrote:
> >>>   Hello,
> >>>
> >>> I'm sending the sixth version of my patch series to abstract vma handling 
> >>> from
> >>> the various media drivers. Since the previous version I have added a 
> >>> patch to
> >>> move mm helpers into a separate file and behind a config option. I also
> >>> changed patch pushing mmap_sem down in videobuf2 core to avoid lockdep 
> >>> warning
> >>> and NULL dereference Hans found in his testing. I've also included small
> >>> fixups Andrew was carrying.
> >>>
> >>> After this patch set drivers have to know much less details about vmas, 
> >>> their
> >>> types, and locking. Also quite some code is removed from them. As a bonus
> >>> drivers get automatically VM_FAULT_RETRY handling. The primary motivation 
> >>> for
> >>> this series is to remove knowledge about mmap_sem locking from as many 
> >>> places a
> >>> possible so that we can change it with reasonable effort.
> >>>
> >>> The core of the series is the new helper get_vaddr_frames() which is 
> >>> given a
> >>> virtual address and it fills in PFNs / struct page pointers (depending on 
> >>> VMA
> >>> type) into the provided array. If PFNs correspond to normal pages it also 
> >>> grabs
> >>> references to these pages. The difference from get_user_pages() is that 
> >>> this
> >>> function can also deal with pfnmap, and io mappings which is what the 
> >>> media
> >>> drivers need.
> >>>
> >>> I have tested the patches with vivid driver so at least vb2 code got some
> >>> exposure. Conversion of other drivers was just compile-tested (for x86 so 
> >>> e.g.
> >>> exynos driver which is only for Samsung platform is completely untested).
> >>>
> >>> Andrew, can you please update the patches in mm three? Thanks!
> >>>
> >>>   Honza
> >>>
> >>> Changes since v5:
> >>> * Moved mm helper into a separate file and behind a config option
> >>> * Changed the first patch pushing mmap_sem down in videobuf2 core to avoid
> >>>   possible deadlock
> >>>
> >>> Changes since v4:
> >>> * Minor cleanups and fixes pointed out by Mel and Vlasta
> >>> * Added Acked-by tags
> >>>
> >>> Changes since v3:
> >>> * Added include  into mm/gup.c as it's needed for some 
> >>> archs
> >>> * Fixed error path for exynos driver
> >>>
> >>> Changes since v2:
> >>> * Renamed functions and structures as Mel suggested
> >>> * Other minor changes suggested by Mel
> >>> * Rebased on top of 4.1-rc2
> >>> * Changed functions to get pointer to array of pages / pfns to perform
> >>>   conversion if necessary. This fixes possible issue in the omap I may 
> >>> have
> >>>   introduced in v2 and generally makes the API less errorprone.
> > 
> > --
> > 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
> > 
> 
-- 
Jan Kara 
SUSE Labs, CR
--
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 7/9] media: vb2: Convert vb2_dc_get_userptr() to use frame vector

2015-07-13 Thread Jan Kara
From: Jan Kara 

Convert vb2_dc_get_userptr() to use frame vector infrastructure. When we
are doing that there's no need to allocate page array and some code can
be simplified.

Acked-by: Marek Szyprowski 
Tested-by: Marek Szyprowski 
Signed-off-by: Jan Kara 
---
 drivers/media/v4l2-core/videobuf2-dma-contig.c | 212 -
 1 file changed, 34 insertions(+), 178 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c 
b/drivers/media/v4l2-core/videobuf2-dma-contig.c
index c548ce425701..2397ceb1dc6b 100644
--- a/drivers/media/v4l2-core/videobuf2-dma-contig.c
+++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c
@@ -32,15 +32,13 @@ struct vb2_dc_buf {
dma_addr_t  dma_addr;
enum dma_data_direction dma_dir;
struct sg_table *dma_sgt;
+   struct frame_vector *vec;
 
/* MMAP related */
struct vb2_vmarea_handler   handler;
atomic_trefcount;
struct sg_table *sgt_base;
 
-   /* USERPTR related */
-   struct vm_area_struct   *vma;
-
/* DMABUF related */
struct dma_buf_attachment   *db_attach;
 };
@@ -49,24 +47,6 @@ struct vb2_dc_buf {
 /*scatterlist table functions*/
 /*/
 
-
-static void vb2_dc_sgt_foreach_page(struct sg_table *sgt,
-   void (*cb)(struct page *pg))
-{
-   struct scatterlist *s;
-   unsigned int i;
-
-   for_each_sg(sgt->sgl, s, sgt->orig_nents, i) {
-   struct page *page = sg_page(s);
-   unsigned int n_pages = PAGE_ALIGN(s->offset + s->length)
-   >> PAGE_SHIFT;
-   unsigned int j;
-
-   for (j = 0; j < n_pages; ++j, ++page)
-   cb(page);
-   }
-}
-
 static unsigned long vb2_dc_get_contiguous_size(struct sg_table *sgt)
 {
struct scatterlist *s;
@@ -429,92 +409,12 @@ static struct dma_buf *vb2_dc_get_dmabuf(void *buf_priv, 
unsigned long flags)
 /*   callbacks for USERPTR buffers   */
 /*/
 
-static inline int vma_is_io(struct vm_area_struct *vma)
-{
-   return !!(vma->vm_flags & (VM_IO | VM_PFNMAP));
-}
-
-static int vb2_dc_get_user_pfn(unsigned long start, int n_pages,
-   struct vm_area_struct *vma, unsigned long *res)
-{
-   unsigned long pfn, start_pfn, prev_pfn;
-   unsigned int i;
-   int ret;
-
-   if (!vma_is_io(vma))
-   return -EFAULT;
-
-   ret = follow_pfn(vma, start, &pfn);
-   if (ret)
-   return ret;
-
-   start_pfn = pfn;
-   start += PAGE_SIZE;
-
-   for (i = 1; i < n_pages; ++i, start += PAGE_SIZE) {
-   prev_pfn = pfn;
-   ret = follow_pfn(vma, start, &pfn);
-
-   if (ret) {
-   pr_err("no page for address %lu\n", start);
-   return ret;
-   }
-   if (pfn != prev_pfn + 1)
-   return -EINVAL;
-   }
-
-   *res = start_pfn;
-   return 0;
-}
-
-static int vb2_dc_get_user_pages(unsigned long start, struct page **pages,
-   int n_pages, struct vm_area_struct *vma,
-   enum dma_data_direction dma_dir)
-{
-   if (vma_is_io(vma)) {
-   unsigned int i;
-
-   for (i = 0; i < n_pages; ++i, start += PAGE_SIZE) {
-   unsigned long pfn;
-   int ret = follow_pfn(vma, start, &pfn);
-
-   if (!pfn_valid(pfn))
-   return -EINVAL;
-
-   if (ret) {
-   pr_err("no page for address %lu\n", start);
-   return ret;
-   }
-   pages[i] = pfn_to_page(pfn);
-   }
-   } else {
-   int n;
-
-   n = get_user_pages(current, current->mm, start & PAGE_MASK,
-   n_pages, dma_dir == DMA_FROM_DEVICE, 1, pages, NULL);
-   /* negative error means that no page was pinned */
-   n = max(n, 0);
-   if (n != n_pages) {
-   pr_err("got only %d of %d user pages\n", n, n_pages);
-   while (n)
-   put_page(pages[--n]);
-   return -EFAULT;
-   }
-   }
-
-   return 0;
-}
-
-static void vb2_dc_put_dirty_page(struct page *page)
-{
-   set_page_dirty_lock(page);
-   put_page(page);
-}
-
 static void vb2_dc_put_userptr(void *buf_priv)
 {
struct vb2_dc_buf *buf = buf_priv;
struct sg_table *sgt = buf->dma_sgt;
+   int i;
+   struct page **pages;
 
if (sgt) {
DEFINE_DMA_ATTRS(attrs);
@@ -526,13 +426,15 @@ static void vb2_dc_put_userptr(void *buf_priv)
 */
dma_unmap_sg

[PATCH 8/9] media: vb2: Remove unused functions

2015-07-13 Thread Jan Kara
From: Jan Kara 

Conversion to the use of pinned pfns made some functions unused. Remove
them. Also there's no need to lock mmap_sem in __buf_prepare() anymore.

Acked-by: Marek Szyprowski 
Tested-by: Marek Szyprowski 
Signed-off-by: Jan Kara 
---
 drivers/media/v4l2-core/videobuf2-memops.c | 114 -
 include/media/videobuf2-memops.h   |   6 --
 2 files changed, 120 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-memops.c 
b/drivers/media/v4l2-core/videobuf2-memops.c
index 0ec186d41b9b..48c6a49c4928 100644
--- a/drivers/media/v4l2-core/videobuf2-memops.c
+++ b/drivers/media/v4l2-core/videobuf2-memops.c
@@ -23,120 +23,6 @@
 #include 
 
 /**
- * vb2_get_vma() - acquire and lock the virtual memory area
- * @vma:   given virtual memory area
- *
- * This function attempts to acquire an area mapped in the userspace for
- * the duration of a hardware operation. The area is "locked" by performing
- * the same set of operation that are done when process calls fork() and
- * memory areas are duplicated.
- *
- * Returns a copy of a virtual memory region on success or NULL.
- */
-struct vm_area_struct *vb2_get_vma(struct vm_area_struct *vma)
-{
-   struct vm_area_struct *vma_copy;
-
-   vma_copy = kmalloc(sizeof(*vma_copy), GFP_KERNEL);
-   if (vma_copy == NULL)
-   return NULL;
-
-   if (vma->vm_ops && vma->vm_ops->open)
-   vma->vm_ops->open(vma);
-
-   if (vma->vm_file)
-   get_file(vma->vm_file);
-
-   memcpy(vma_copy, vma, sizeof(*vma));
-
-   vma_copy->vm_mm = NULL;
-   vma_copy->vm_next = NULL;
-   vma_copy->vm_prev = NULL;
-
-   return vma_copy;
-}
-EXPORT_SYMBOL_GPL(vb2_get_vma);
-
-/**
- * vb2_put_userptr() - release a userspace virtual memory area
- * @vma:   virtual memory region associated with the area to be released
- *
- * This function releases the previously acquired memory area after a hardware
- * operation.
- */
-void vb2_put_vma(struct vm_area_struct *vma)
-{
-   if (!vma)
-   return;
-
-   if (vma->vm_ops && vma->vm_ops->close)
-   vma->vm_ops->close(vma);
-
-   if (vma->vm_file)
-   fput(vma->vm_file);
-
-   kfree(vma);
-}
-EXPORT_SYMBOL_GPL(vb2_put_vma);
-
-/**
- * vb2_get_contig_userptr() - lock physically contiguous userspace mapped 
memory
- * @vaddr: starting virtual address of the area to be verified
- * @size:  size of the area
- * @res_paddr: will return physical address for the given vaddr
- * @res_vma:   will return locked copy of struct vm_area for the given area
- *
- * This function will go through memory area of size @size mapped at @vaddr and
- * verify that the underlying physical pages are contiguous. If they are
- * contiguous the virtual memory area is locked and a @res_vma is filled with
- * the copy and @res_pa set to the physical address of the buffer.
- *
- * Returns 0 on success.
- */
-int vb2_get_contig_userptr(unsigned long vaddr, unsigned long size,
-  struct vm_area_struct **res_vma, dma_addr_t *res_pa)
-{
-   struct mm_struct *mm = current->mm;
-   struct vm_area_struct *vma;
-   unsigned long offset, start, end;
-   unsigned long this_pfn, prev_pfn;
-   dma_addr_t pa = 0;
-
-   start = vaddr;
-   offset = start & ~PAGE_MASK;
-   end = start + size;
-
-   vma = find_vma(mm, start);
-
-   if (vma == NULL || vma->vm_end < end)
-   return -EFAULT;
-
-   for (prev_pfn = 0; start < end; start += PAGE_SIZE) {
-   int ret = follow_pfn(vma, start, &this_pfn);
-   if (ret)
-   return ret;
-
-   if (prev_pfn == 0)
-   pa = this_pfn << PAGE_SHIFT;
-   else if (this_pfn != prev_pfn + 1)
-   return -EFAULT;
-
-   prev_pfn = this_pfn;
-   }
-
-   /*
-* Memory is contigous, lock vma and return to the caller
-*/
-   *res_vma = vb2_get_vma(vma);
-   if (*res_vma == NULL)
-   return -ENOMEM;
-
-   *res_pa = pa + offset;
-   return 0;
-}
-EXPORT_SYMBOL_GPL(vb2_get_contig_userptr);
-
-/**
  * vb2_create_framevec() - map virtual addresses to pfns
  * @start: Virtual user address where we start mapping
  * @length:Length of a range to map
diff --git a/include/media/videobuf2-memops.h b/include/media/videobuf2-memops.h
index 2f0564ff5f31..830b5239fd8b 100644
--- a/include/media/videobuf2-memops.h
+++ b/include/media/videobuf2-memops.h
@@ -31,12 +31,6 @@ struct vb2_vmarea_handler {
 
 extern const struct vm_operations_struct vb2_common_vm_ops;
 
-int vb2_get_contig_userptr(unsigned long vaddr, unsigned long size,
-  struct vm_area_struct **res_vma, dma_addr_t *res_pa);
-
-struct vm_area_struct *vb2_get_vma(struct vm_area_struct *vma);
-void vb2_put_vma(struct vm_area_struct *vma);
-
 struct frame_vector *vb2_create_framevec

[PATCH 9/9] drm/exynos: Convert g2d_userptr_get_dma_addr() to use get_vaddr_frames()

2015-07-13 Thread Jan Kara
From: Jan Kara 

Convert g2d_userptr_get_dma_addr() to pin pages using get_vaddr_frames().
This removes the knowledge about vmas and mmap_sem locking from exynos
driver. Also it fixes a problem that the function has been mapping user
provided address without holding mmap_sem.

Signed-off-by: Jan Kara 
---
 drivers/gpu/drm/exynos/Kconfig  |  1 +
 drivers/gpu/drm/exynos/exynos_drm_g2d.c | 91 ++-
 drivers/gpu/drm/exynos/exynos_drm_gem.c | 97 -
 3 files changed, 30 insertions(+), 159 deletions(-)

diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig
index 43003c4ad80b..b364562dc6c1 100644
--- a/drivers/gpu/drm/exynos/Kconfig
+++ b/drivers/gpu/drm/exynos/Kconfig
@@ -77,6 +77,7 @@ config DRM_EXYNOS_VIDI
 config DRM_EXYNOS_G2D
bool "Exynos DRM G2D"
depends on DRM_EXYNOS && !VIDEO_SAMSUNG_S5P_G2D
+   select FRAME_VECTOR
help
  Choose this option if you want to use Exynos G2D for DRM.
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c 
b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
index 81a250830808..1d8d9a508373 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
@@ -190,10 +190,8 @@ struct g2d_cmdlist_userptr {
dma_addr_t  dma_addr;
unsigned long   userptr;
unsigned long   size;
-   struct page **pages;
-   unsigned intnpages;
+   struct frame_vector *vec;
struct sg_table *sgt;
-   struct vm_area_struct   *vma;
atomic_trefcount;
boolin_pool;
boolout_of_list;
@@ -363,6 +361,7 @@ static void g2d_userptr_put_dma_addr(struct drm_device 
*drm_dev,
 {
struct g2d_cmdlist_userptr *g2d_userptr =
(struct g2d_cmdlist_userptr *)obj;
+   struct page **pages;
 
if (!obj)
return;
@@ -382,19 +381,21 @@ out:
exynos_gem_unmap_sgt_from_dma(drm_dev, g2d_userptr->sgt,
DMA_BIDIRECTIONAL);
 
-   exynos_gem_put_pages_to_userptr(g2d_userptr->pages,
-   g2d_userptr->npages,
-   g2d_userptr->vma);
+   pages = frame_vector_pages(g2d_userptr->vec);
+   if (!IS_ERR(pages)) {
+   int i;
 
-   exynos_gem_put_vma(g2d_userptr->vma);
+   for (i = 0; i < frame_vector_count(g2d_userptr->vec); i++)
+   set_page_dirty_lock(pages[i]);
+   }
+   put_vaddr_frames(g2d_userptr->vec);
+   frame_vector_destroy(g2d_userptr->vec);
 
if (!g2d_userptr->out_of_list)
list_del_init(&g2d_userptr->list);
 
sg_free_table(g2d_userptr->sgt);
kfree(g2d_userptr->sgt);
-
-   drm_free_large(g2d_userptr->pages);
kfree(g2d_userptr);
 }
 
@@ -408,9 +409,7 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct 
drm_device *drm_dev,
struct exynos_drm_g2d_private *g2d_priv = file_priv->g2d_priv;
struct g2d_cmdlist_userptr *g2d_userptr;
struct g2d_data *g2d;
-   struct page **pages;
struct sg_table *sgt;
-   struct vm_area_struct *vma;
unsigned long start, end;
unsigned int npages, offset;
int ret;
@@ -456,65 +455,38 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct 
drm_device *drm_dev,
return ERR_PTR(-ENOMEM);
 
atomic_set(&g2d_userptr->refcount, 1);
+   g2d_userptr->size = size;
 
start = userptr & PAGE_MASK;
offset = userptr & ~PAGE_MASK;
end = PAGE_ALIGN(userptr + size);
npages = (end - start) >> PAGE_SHIFT;
-   g2d_userptr->npages = npages;
-
-   pages = drm_calloc_large(npages, sizeof(struct page *));
-   if (!pages) {
-   DRM_ERROR("failed to allocate pages.\n");
-   ret = -ENOMEM;
+   g2d_userptr->vec = frame_vector_create(npages);
+   if (!g2d_userptr->vec)
goto err_free;
-   }
 
-   down_read(¤t->mm->mmap_sem);
-   vma = find_vma(current->mm, userptr);
-   if (!vma) {
-   up_read(¤t->mm->mmap_sem);
-   DRM_ERROR("failed to get vm region.\n");
+   ret = get_vaddr_frames(start, npages, true, true, g2d_userptr->vec);
+   if (ret != npages) {
+   DRM_ERROR("failed to get user pages from userptr.\n");
+   if (ret < 0)
+   goto err_destroy_framevec;
ret = -EFAULT;
-   goto err_free_pages;
+   goto err_put_framevec;
}
-
-   if (vma->vm_end < userptr + size) {
-   up_read(¤t->mm->mmap_sem);
-   DRM_ERROR("vma is too small.\n");
+   if (frame_vector_to_pages(g2d_userptr->vec) < 0) {
ret = -EFAULT;
-   goto err_free_pages;
+  

[PATCH 0/9 v7] Helper to abstract vma handling in media layer

2015-07-13 Thread Jan Kara
From: Jan Kara 

  Hello,

I'm sending the seventh version of my patch series to abstract vma handling
from the various media drivers. Since the previous version there are just
minor cleanups and fixes (see detailed changelog at the end of the email).

After this patch set drivers have to know much less details about vmas, their
types, and locking. Also quite some code is removed from them. As a bonus
drivers get automatically VM_FAULT_RETRY handling. The primary motivation for
this series is to remove knowledge about mmap_sem locking from as many places a
possible so that we can change it with reasonable effort.

The core of the series is the new helper get_vaddr_frames() which is given a
virtual address and it fills in PFNs / struct page pointers (depending on VMA
type) into the provided array. If PFNs correspond to normal pages it also grabs
references to these pages. The difference from get_user_pages() is that this
function can also deal with pfnmap, and io mappings which is what the media
drivers need.

I have tested the patches with vivid driver so at least vb2 code got some
exposure. Conversion of other drivers was just compile-tested (for x86 so e.g.
exynos driver which is only for Samsung platform is completely untested).

Hans, can you please pull the changes? Thanks!

Honza

Changes since v6:
* Fixed compilation error introduced into exynos driver
* Folded patch allowing get_vaddr_pfn() code to be selected by a config option
  into previous patches
* Rebased on top of linux-media tree

Changes since v5:
* Moved mm helper into a separate file and behind a config option
* Changed the first patch pushing mmap_sem down in videobuf2 core to avoid
  possible deadlock

Changes since v4:
* Minor cleanups and fixes pointed out by Mel and Vlasta
* Added Acked-by tags

Changes since v3:
* Added include  into mm/gup.c as it's needed for some archs
* Fixed error path for exynos driver

Changes since v2:
* Renamed functions and structures as Mel suggested
* Other minor changes suggested by Mel
* Rebased on top of 4.1-rc2
* Changed functions to get pointer to array of pages / pfns to perform
  conversion if necessary. This fixes possible issue in the omap I may have
  introduced in v2 and generally makes the API less errorprone.
--
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 5/9] media: vb2: Convert vb2_dma_sg_get_userptr() to use frame vector

2015-07-13 Thread Jan Kara
From: Jan Kara 

Acked-by: Marek Szyprowski 
Tested-by: Marek Szyprowski 
Signed-off-by: Jan Kara 
---
 drivers/media/v4l2-core/videobuf2-dma-sg.c | 95 +-
 1 file changed, 15 insertions(+), 80 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-dma-sg.c 
b/drivers/media/v4l2-core/videobuf2-dma-sg.c
index d2cf113d1933..be7bd6535c9d 100644
--- a/drivers/media/v4l2-core/videobuf2-dma-sg.c
+++ b/drivers/media/v4l2-core/videobuf2-dma-sg.c
@@ -38,6 +38,7 @@ struct vb2_dma_sg_buf {
struct device   *dev;
void*vaddr;
struct page **pages;
+   struct frame_vector *vec;
int offset;
enum dma_data_direction dma_dir;
struct sg_table sg_table;
@@ -51,7 +52,6 @@ struct vb2_dma_sg_buf {
unsigned intnum_pages;
atomic_trefcount;
struct vb2_vmarea_handler   handler;
-   struct vm_area_struct   *vma;
 
struct dma_buf_attachment   *db_attach;
 };
@@ -225,25 +225,17 @@ static void vb2_dma_sg_finish(void *buf_priv)
dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir);
 }
 
-static inline int vma_is_io(struct vm_area_struct *vma)
-{
-   return !!(vma->vm_flags & (VM_IO | VM_PFNMAP));
-}
-
 static void *vb2_dma_sg_get_userptr(void *alloc_ctx, unsigned long vaddr,
unsigned long size,
enum dma_data_direction dma_dir)
 {
struct vb2_dma_sg_conf *conf = alloc_ctx;
struct vb2_dma_sg_buf *buf;
-   unsigned long first, last;
-   int num_pages_from_user;
-   struct vm_area_struct *vma;
struct sg_table *sgt;
DEFINE_DMA_ATTRS(attrs);
+   struct frame_vector *vec;
 
dma_set_attr(DMA_ATTR_SKIP_CPU_SYNC, &attrs);
-
buf = kzalloc(sizeof *buf, GFP_KERNEL);
if (!buf)
return NULL;
@@ -254,63 +246,19 @@ static void *vb2_dma_sg_get_userptr(void *alloc_ctx, 
unsigned long vaddr,
buf->offset = vaddr & ~PAGE_MASK;
buf->size = size;
buf->dma_sgt = &buf->sg_table;
+   vec = vb2_create_framevec(vaddr, size, buf->dma_dir == DMA_FROM_DEVICE);
+   if (IS_ERR(vec))
+   goto userptr_fail_pfnvec;
+   buf->vec = vec;
 
-   first = (vaddr   & PAGE_MASK) >> PAGE_SHIFT;
-   last  = ((vaddr + size - 1) & PAGE_MASK) >> PAGE_SHIFT;
-   buf->num_pages = last - first + 1;
-
-   buf->pages = kzalloc(buf->num_pages * sizeof(struct page *),
-GFP_KERNEL);
-   if (!buf->pages)
-   goto userptr_fail_alloc_pages;
-
-   down_read(¤t->mm->mmap_sem);
-   vma = find_vma(current->mm, vaddr);
-   if (!vma) {
-   dprintk(1, "no vma for address %lu\n", vaddr);
-   goto userptr_fail_find_vma;
-   }
-
-   if (vma->vm_end < vaddr + size) {
-   dprintk(1, "vma at %lu is too small for %lu bytes\n",
-   vaddr, size);
-   goto userptr_fail_find_vma;
-   }
-
-   buf->vma = vb2_get_vma(vma);
-   if (!buf->vma) {
-   dprintk(1, "failed to copy vma\n");
-   goto userptr_fail_find_vma;
-   }
-
-   if (vma_is_io(buf->vma)) {
-   for (num_pages_from_user = 0;
-num_pages_from_user < buf->num_pages;
-++num_pages_from_user, vaddr += PAGE_SIZE) {
-   unsigned long pfn;
-
-   if (follow_pfn(vma, vaddr, &pfn)) {
-   dprintk(1, "no page for address %lu\n", vaddr);
-   break;
-   }
-   buf->pages[num_pages_from_user] = pfn_to_page(pfn);
-   }
-   } else
-   num_pages_from_user = get_user_pages(current, current->mm,
-vaddr & PAGE_MASK,
-buf->num_pages,
-buf->dma_dir == DMA_FROM_DEVICE,
-1, /* force */
-buf->pages,
-NULL);
-   up_read(¤t->mm->mmap_sem);
-
-   if (num_pages_from_user != buf->num_pages)
-   goto userptr_fail_get_user_pages;
+   buf->pages = frame_vector_pages(vec);
+   if (IS_ERR(buf->pages))
+   goto userptr_fail_sgtable;
+   buf->num_pages = frame_vector_count(vec);
 
if (sg_alloc_table_from_pages(buf->dma_sgt, buf->pages,
buf->num_pages, buf->offset, size, 0))
-   goto userptr_fail_alloc_table_from_pages;
+   goto userptr_fail_sgtable;
 
sgt = &buf->sg_table;
/*
@@ -326,19 +274

[PATCH 1/9] [media] vb2: Push mmap_sem down to memops

2015-07-13 Thread Jan Kara
From: Jan Kara 

Currently vb2 core acquires mmap_sem just around call to
__qbuf_userptr(). However since commit f035eb4e976ef5 (videobuf2: fix
lockdep warning) it isn't necessary to acquire it so early as we no
longer have to drop queue mutex before acquiring mmap_sem. So push
acquisition of mmap_sem down into .get_userptr memop so that the
semaphore is acquired for a shorter time and it is clearer what it is
needed for.

Note that we also need mmap_sem in .put_userptr memop since that ends up
calling vb2_put_vma() which calls vma->vm_ops->close() which should be
called with mmap_sem held. However we didn't hold mmap_sem in some code
paths anyway (e.g. when called via vb2_ioctl_reqbufs() ->
__vb2_queue_free() -> vb2_dma_sg_put_userptr()) and getting mmap_sem in
put_userptr() introduces a lock inversion with queue->mmap_lock in the
above mentioned call path.

Luckily this whole locking mess will get resolved once we convert
videobuf2 core to the new mm helper which avoids the need for mmap_sem
in .put_userptr memop altogether.

Signed-off-by: Jan Kara 
---
 drivers/media/v4l2-core/videobuf2-core.c   | 2 --
 drivers/media/v4l2-core/videobuf2-dma-contig.c | 5 +
 drivers/media/v4l2-core/videobuf2-dma-sg.c | 4 
 drivers/media/v4l2-core/videobuf2-vmalloc.c| 4 +++-
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-core.c 
b/drivers/media/v4l2-core/videobuf2-core.c
index 93b315459098..4df6dfc47fc8 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -1675,9 +1675,7 @@ static int __buf_prepare(struct vb2_buffer *vb, const 
struct v4l2_buffer *b)
ret = __qbuf_mmap(vb, b);
break;
case V4L2_MEMORY_USERPTR:
-   down_read(¤t->mm->mmap_sem);
ret = __qbuf_userptr(vb, b);
-   up_read(¤t->mm->mmap_sem);
break;
case V4L2_MEMORY_DMABUF:
ret = __qbuf_dmabuf(vb, b);
diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c 
b/drivers/media/v4l2-core/videobuf2-dma-contig.c
index 94c1e6455d36..c548ce425701 100644
--- a/drivers/media/v4l2-core/videobuf2-dma-contig.c
+++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c
@@ -616,6 +616,7 @@ static void *vb2_dc_get_userptr(void *alloc_ctx, unsigned 
long vaddr,
goto fail_buf;
}
 
+   down_read(¤t->mm->mmap_sem);
/* current->mm->mmap_sem is taken by videobuf2 core */
vma = find_vma(current->mm, vaddr);
if (!vma) {
@@ -642,6 +643,7 @@ static void *vb2_dc_get_userptr(void *alloc_ctx, unsigned 
long vaddr,
if (ret) {
unsigned long pfn;
if (vb2_dc_get_user_pfn(start, n_pages, vma, &pfn) == 0) {
+   up_read(¤t->mm->mmap_sem);
buf->dma_addr = vb2_dc_pfn_to_dma(buf->dev, pfn);
buf->size = size;
kfree(pages);
@@ -651,6 +653,7 @@ static void *vb2_dc_get_userptr(void *alloc_ctx, unsigned 
long vaddr,
pr_err("failed to get user pages\n");
goto fail_vma;
}
+   up_read(¤t->mm->mmap_sem);
 
sgt = kzalloc(sizeof(*sgt), GFP_KERNEL);
if (!sgt) {
@@ -713,10 +716,12 @@ fail_get_user_pages:
while (n_pages)
put_page(pages[--n_pages]);
 
+   down_read(¤t->mm->mmap_sem);
 fail_vma:
vb2_put_vma(buf->vma);
 
 fail_pages:
+   up_read(¤t->mm->mmap_sem);
kfree(pages); /* kfree is NULL-proof */
 
 fail_buf:
diff --git a/drivers/media/v4l2-core/videobuf2-dma-sg.c 
b/drivers/media/v4l2-core/videobuf2-dma-sg.c
index 7289b81bd7b7..d2cf113d1933 100644
--- a/drivers/media/v4l2-core/videobuf2-dma-sg.c
+++ b/drivers/media/v4l2-core/videobuf2-dma-sg.c
@@ -264,6 +264,7 @@ static void *vb2_dma_sg_get_userptr(void *alloc_ctx, 
unsigned long vaddr,
if (!buf->pages)
goto userptr_fail_alloc_pages;
 
+   down_read(¤t->mm->mmap_sem);
vma = find_vma(current->mm, vaddr);
if (!vma) {
dprintk(1, "no vma for address %lu\n", vaddr);
@@ -302,6 +303,7 @@ static void *vb2_dma_sg_get_userptr(void *alloc_ctx, 
unsigned long vaddr,
 1, /* force */
 buf->pages,
 NULL);
+   up_read(¤t->mm->mmap_sem);
 
if (num_pages_from_user != buf->num_pages)
goto userptr_fail_get_user_pages;
@@ -331,8 +333,10 @@ userptr_fail_get_user_pages:
if (!vma_is_io(buf->vma))
while (--num_pages_from_user >= 0)
put_page(buf->pages[num_pages_from_user]);
+   down_read(¤t->mm->mmap_sem);
vb2_put_vma(buf->vma);
 userptr_fail_find_vma:
+   up_read(¤t->mm->mmap_sem);
kfree(buf->pages);
 userptr_fail_alloc_pages:
kfree(buf);
diff --git a/dr

Re: [PATCH 0/9 v7] Helper to abstract vma handling in media layer

2015-07-13 Thread Hans Verkuil
On 07/13/2015 04:55 PM, Jan Kara wrote:
> From: Jan Kara 
> 
>   Hello,
> 
> I'm sending the seventh version of my patch series to abstract vma handling
> from the various media drivers. Since the previous version there are just
> minor cleanups and fixes (see detailed changelog at the end of the email).
> 
> After this patch set drivers have to know much less details about vmas, their
> types, and locking. Also quite some code is removed from them. As a bonus
> drivers get automatically VM_FAULT_RETRY handling. The primary motivation for
> this series is to remove knowledge about mmap_sem locking from as many places 
> a
> possible so that we can change it with reasonable effort.
> 
> The core of the series is the new helper get_vaddr_frames() which is given a
> virtual address and it fills in PFNs / struct page pointers (depending on VMA
> type) into the provided array. If PFNs correspond to normal pages it also 
> grabs
> references to these pages. The difference from get_user_pages() is that this
> function can also deal with pfnmap, and io mappings which is what the media
> drivers need.
> 
> I have tested the patches with vivid driver so at least vb2 code got some
> exposure. Conversion of other drivers was just compile-tested (for x86 so e.g.
> exynos driver which is only for Samsung platform is completely untested).
> 
> Hans, can you please pull the changes? Thanks!

Scheduled for Friday or the following Monday!

Thanks,

Hans

> 
>   Honza
> 
> Changes since v6:
> * Fixed compilation error introduced into exynos driver
> * Folded patch allowing get_vaddr_pfn() code to be selected by a config option
>   into previous patches
> * Rebased on top of linux-media tree
> 
> Changes since v5:
> * Moved mm helper into a separate file and behind a config option
> * Changed the first patch pushing mmap_sem down in videobuf2 core to avoid
>   possible deadlock
> 
> Changes since v4:
> * Minor cleanups and fixes pointed out by Mel and Vlasta
> * Added Acked-by tags
> 
> Changes since v3:
> * Added include  into mm/gup.c as it's needed for some archs
> * Fixed error path for exynos driver
> 
> Changes since v2:
> * Renamed functions and structures as Mel suggested
> * Other minor changes suggested by Mel
> * Rebased on top of 4.1-rc2
> * Changed functions to get pointer to array of pages / pfns to perform
>   conversion if necessary. This fixes possible issue in the omap I may have
>   introduced in v2 and generally makes the API less errorprone.
> --
> 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


[PATCH 2/9] mm: Provide new get_vaddr_frames() helper

2015-07-13 Thread Jan Kara
From: Jan Kara 

Provide new function get_vaddr_frames().  This function maps virtual
addresses from given start and fills given array with page frame numbers of
the corresponding pages. If given start belongs to a normal vma, the function
grabs reference to each of the pages to pin them in memory. If start
belongs to VM_IO | VM_PFNMAP vma, we don't touch page structures. Caller
must make sure pfns aren't reused for anything else while he is using
them.

This function is created for various drivers to simplify handling of
their buffers.

Acked-by: Mel Gorman 
Acked-by: Vlastimil Babka 
Signed-off-by: Jan Kara 
---
 include/linux/mm.h |  44 ++
 mm/Kconfig |   3 +
 mm/Makefile|   1 +
 mm/frame_vector.c  | 231 +
 4 files changed, 279 insertions(+)
 create mode 100644 mm/frame_vector.c

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 2e872f92dbac..79ad29a8a60a 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 struct mempolicy;
 struct anon_vma;
@@ -1198,6 +1199,49 @@ long get_user_pages_unlocked(struct task_struct *tsk, 
struct mm_struct *mm,
int write, int force, struct page **pages);
 int get_user_pages_fast(unsigned long start, int nr_pages, int write,
struct page **pages);
+
+/* Container for pinned pfns / pages */
+struct frame_vector {
+   unsigned int nr_allocated;  /* Number of frames we have space for */
+   unsigned int nr_frames; /* Number of frames stored in ptrs array */
+   bool got_ref;   /* Did we pin pages by getting page ref? */
+   bool is_pfns;   /* Does array contain pages or pfns? */
+   void *ptrs[0];  /* Array of pinned pfns / pages. Use
+* pfns_vector_pages() or pfns_vector_pfns()
+* for access */
+};
+
+struct frame_vector *frame_vector_create(unsigned int nr_frames);
+void frame_vector_destroy(struct frame_vector *vec);
+int get_vaddr_frames(unsigned long start, unsigned int nr_pfns,
+bool write, bool force, struct frame_vector *vec);
+void put_vaddr_frames(struct frame_vector *vec);
+int frame_vector_to_pages(struct frame_vector *vec);
+void frame_vector_to_pfns(struct frame_vector *vec);
+
+static inline unsigned int frame_vector_count(struct frame_vector *vec)
+{
+   return vec->nr_frames;
+}
+
+static inline struct page **frame_vector_pages(struct frame_vector *vec)
+{
+   if (vec->is_pfns) {
+   int err = frame_vector_to_pages(vec);
+
+   if (err)
+   return ERR_PTR(err);
+   }
+   return (struct page **)(vec->ptrs);
+}
+
+static inline unsigned long *frame_vector_pfns(struct frame_vector *vec)
+{
+   if (!vec->is_pfns)
+   frame_vector_to_pfns(vec);
+   return (unsigned long *)(vec->ptrs);
+}
+
 struct kvec;
 int get_kernel_pages(const struct kvec *iov, int nr_pages, int write,
struct page **pages);
diff --git a/mm/Kconfig b/mm/Kconfig
index e79de2bd12cd..7f146dd32fc5 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -654,3 +654,6 @@ config DEFERRED_STRUCT_PAGE_INIT
  when kswapd starts. This has a potential performance impact on
  processes running early in the lifetime of the systemm until kswapd
  finishes the initialisation.
+
+config FRAME_VECTOR
+   bool
diff --git a/mm/Makefile b/mm/Makefile
index 98c4eaeabdcb..be5d5c866305 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -78,3 +78,4 @@ obj-$(CONFIG_CMA) += cma.o
 obj-$(CONFIG_MEMORY_BALLOON) += balloon_compaction.o
 obj-$(CONFIG_PAGE_EXTENSION) += page_ext.o
 obj-$(CONFIG_CMA_DEBUGFS) += cma_debug.o
+obj-$(CONFIG_FRAME_VECTOR) += frame_vector.o
diff --git a/mm/frame_vector.c b/mm/frame_vector.c
new file mode 100644
index ..f76b579e46f1
--- /dev/null
+++ b/mm/frame_vector.c
@@ -0,0 +1,231 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * get_vaddr_frames() - map virtual addresses to pfns
+ * @start: starting user address
+ * @nr_frames: number of pages / pfns from start to map
+ * @write: whether pages will be written to by the caller
+ * @force: whether to force write access even if user mapping is
+ * readonly. See description of the same argument of
+   get_user_pages().
+ * @vec:   structure which receives pages / pfns of the addresses mapped.
+ * It should have space for at least nr_frames entries.
+ *
+ * This function maps virtual addresses from @start and fills @vec structure
+ * with page frame numbers or page pointers to corresponding pages (choice
+ * depends on the type of the vma underlying the virtual address). If @start
+ * belongs to a normal vma, the function grabs reference to each of the pages
+ * to pin them in memory. If @start belong

[PATCH 4/9] vb2: Provide helpers for mapping virtual addresses

2015-07-13 Thread Jan Kara
From: Jan Kara 

Provide simple helper functions to map virtual address range into an
array of pfns / pages.

Acked-by: Marek Szyprowski 
Tested-by: Marek Szyprowski 
Signed-off-by: Jan Kara 
---
 drivers/media/v4l2-core/Kconfig|  1 +
 drivers/media/v4l2-core/videobuf2-memops.c | 58 ++
 include/media/videobuf2-memops.h   |  5 +++
 3 files changed, 64 insertions(+)

diff --git a/drivers/media/v4l2-core/Kconfig b/drivers/media/v4l2-core/Kconfig
index b4b022933e29..82876a67f144 100644
--- a/drivers/media/v4l2-core/Kconfig
+++ b/drivers/media/v4l2-core/Kconfig
@@ -84,6 +84,7 @@ config VIDEOBUF2_CORE
 
 config VIDEOBUF2_MEMOPS
tristate
+   select FRAME_VECTOR
 
 config VIDEOBUF2_DMA_CONTIG
tristate
diff --git a/drivers/media/v4l2-core/videobuf2-memops.c 
b/drivers/media/v4l2-core/videobuf2-memops.c
index 81c1ad8b2cf1..0ec186d41b9b 100644
--- a/drivers/media/v4l2-core/videobuf2-memops.c
+++ b/drivers/media/v4l2-core/videobuf2-memops.c
@@ -137,6 +137,64 @@ int vb2_get_contig_userptr(unsigned long vaddr, unsigned 
long size,
 EXPORT_SYMBOL_GPL(vb2_get_contig_userptr);
 
 /**
+ * vb2_create_framevec() - map virtual addresses to pfns
+ * @start: Virtual user address where we start mapping
+ * @length:Length of a range to map
+ * @write: Should we map for writing into the area
+ *
+ * This function allocates and fills in a vector with pfns corresponding to
+ * virtual address range passed in arguments. If pfns have corresponding pages,
+ * page references are also grabbed to pin pages in memory. The function
+ * returns pointer to the vector on success and error pointer in case of
+ * failure. Returned vector needs to be freed via vb2_destroy_pfnvec().
+ */
+struct frame_vector *vb2_create_framevec(unsigned long start,
+unsigned long length,
+bool write)
+{
+   int ret;
+   unsigned long first, last;
+   unsigned long nr;
+   struct frame_vector *vec;
+
+   first = start >> PAGE_SHIFT;
+   last = (start + length - 1) >> PAGE_SHIFT;
+   nr = last - first + 1;
+   vec = frame_vector_create(nr);
+   if (!vec)
+   return ERR_PTR(-ENOMEM);
+   ret = get_vaddr_frames(start, nr, write, 1, vec);
+   if (ret < 0)
+   goto out_destroy;
+   /* We accept only complete set of PFNs */
+   if (ret != nr) {
+   ret = -EFAULT;
+   goto out_release;
+   }
+   return vec;
+out_release:
+   put_vaddr_frames(vec);
+out_destroy:
+   frame_vector_destroy(vec);
+   return ERR_PTR(ret);
+}
+EXPORT_SYMBOL(vb2_create_framevec);
+
+/**
+ * vb2_destroy_framevec() - release vector of mapped pfns
+ * @vec:   vector of pfns / pages to release
+ *
+ * This releases references to all pages in the vector @vec (if corresponding
+ * pfns are backed by pages) and frees the passed vector.
+ */
+void vb2_destroy_framevec(struct frame_vector *vec)
+{
+   put_vaddr_frames(vec);
+   frame_vector_destroy(vec);
+}
+EXPORT_SYMBOL(vb2_destroy_framevec);
+
+/**
  * vb2_common_vm_open() - increase refcount of the vma
  * @vma:   virtual memory region for the mapping
  *
diff --git a/include/media/videobuf2-memops.h b/include/media/videobuf2-memops.h
index f05444ca8c0c..2f0564ff5f31 100644
--- a/include/media/videobuf2-memops.h
+++ b/include/media/videobuf2-memops.h
@@ -15,6 +15,7 @@
 #define _MEDIA_VIDEOBUF2_MEMOPS_H
 
 #include 
+#include 
 
 /**
  * vb2_vmarea_handler - common vma refcount tracking handler
@@ -36,5 +37,9 @@ int vb2_get_contig_userptr(unsigned long vaddr, unsigned long 
size,
 struct vm_area_struct *vb2_get_vma(struct vm_area_struct *vma);
 void vb2_put_vma(struct vm_area_struct *vma);
 
+struct frame_vector *vb2_create_framevec(unsigned long start,
+unsigned long length,
+bool write);
+void vb2_destroy_framevec(struct frame_vector *vec);
 
 #endif
-- 
2.1.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 6/9] media: vb2: Convert vb2_vmalloc_get_userptr() to use frame vector

2015-07-13 Thread Jan Kara
From: Jan Kara 

Convert vb2_vmalloc_get_userptr() to use frame vector infrastructure.
When we are doing that there's no need to allocate page array and some
code can be simplified.

Acked-by: Marek Szyprowski 
Tested-by: Marek Szyprowski 
Signed-off-by: Jan Kara 
---
 drivers/media/v4l2-core/videobuf2-vmalloc.c | 92 +++--
 1 file changed, 36 insertions(+), 56 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-vmalloc.c 
b/drivers/media/v4l2-core/videobuf2-vmalloc.c
index 63bef959623e..ecb8f0c7f025 100644
--- a/drivers/media/v4l2-core/videobuf2-vmalloc.c
+++ b/drivers/media/v4l2-core/videobuf2-vmalloc.c
@@ -23,11 +23,9 @@
 
 struct vb2_vmalloc_buf {
void*vaddr;
-   struct page **pages;
-   struct vm_area_struct   *vma;
+   struct frame_vector *vec;
enum dma_data_direction dma_dir;
unsigned long   size;
-   unsigned intn_pages;
atomic_trefcount;
struct vb2_vmarea_handler   handler;
struct dma_buf  *dbuf;
@@ -76,10 +74,8 @@ static void *vb2_vmalloc_get_userptr(void *alloc_ctx, 
unsigned long vaddr,
 enum dma_data_direction dma_dir)
 {
struct vb2_vmalloc_buf *buf;
-   unsigned long first, last;
-   int n_pages, offset;
-   struct vm_area_struct *vma;
-   dma_addr_t physp;
+   struct frame_vector *vec;
+   int n_pages, offset, i;
 
buf = kzalloc(sizeof(*buf), GFP_KERNEL);
if (!buf)
@@ -88,53 +84,36 @@ static void *vb2_vmalloc_get_userptr(void *alloc_ctx, 
unsigned long vaddr,
buf->dma_dir = dma_dir;
offset = vaddr & ~PAGE_MASK;
buf->size = size;
-
-   down_read(¤t->mm->mmap_sem);
-   vma = find_vma(current->mm, vaddr);
-   if (vma && (vma->vm_flags & VM_PFNMAP) && (vma->vm_pgoff)) {
-   if (vb2_get_contig_userptr(vaddr, size, &vma, &physp))
-   goto fail_pages_array_alloc;
-   buf->vma = vma;
-   buf->vaddr = (__force void *)ioremap_nocache(physp, size);
-   if (!buf->vaddr)
-   goto fail_pages_array_alloc;
+   vec = vb2_create_framevec(vaddr, size, dma_dir == DMA_FROM_DEVICE);
+   if (IS_ERR(vec))
+   goto fail_pfnvec_create;
+   buf->vec = vec;
+   n_pages = frame_vector_count(vec);
+   if (frame_vector_to_pages(vec) < 0) {
+   unsigned long *nums = frame_vector_pfns(vec);
+
+   /*
+* We cannot get page pointers for these pfns. Check memory is
+* physically contiguous and use direct mapping.
+*/
+   for (i = 1; i < n_pages; i++)
+   if (nums[i-1] + 1 != nums[i])
+   goto fail_map;
+   buf->vaddr = (__force void *)
+   ioremap_nocache(nums[0] << PAGE_SHIFT, size);
} else {
-   first = vaddr >> PAGE_SHIFT;
-   last  = (vaddr + size - 1) >> PAGE_SHIFT;
-   buf->n_pages = last - first + 1;
-   buf->pages = kzalloc(buf->n_pages * sizeof(struct page *),
-GFP_KERNEL);
-   if (!buf->pages)
-   goto fail_pages_array_alloc;
-
-   /* current->mm->mmap_sem is taken by videobuf2 core */
-   n_pages = get_user_pages(current, current->mm,
-vaddr & PAGE_MASK, buf->n_pages,
-dma_dir == DMA_FROM_DEVICE,
-1, /* force */
-buf->pages, NULL);
-   if (n_pages != buf->n_pages)
-   goto fail_get_user_pages;
-
-   buf->vaddr = vm_map_ram(buf->pages, buf->n_pages, -1,
+   buf->vaddr = vm_map_ram(frame_vector_pages(vec), n_pages, -1,
PAGE_KERNEL);
-   if (!buf->vaddr)
-   goto fail_get_user_pages;
}
-   up_read(¤t->mm->mmap_sem);
 
+   if (!buf->vaddr)
+   goto fail_map;
buf->vaddr += offset;
return buf;
 
-fail_get_user_pages:
-   pr_debug("get_user_pages requested/got: %d/%d]\n", n_pages,
-buf->n_pages);
-   while (--n_pages >= 0)
-   put_page(buf->pages[n_pages]);
-   kfree(buf->pages);
-
-fail_pages_array_alloc:
-   up_read(¤t->mm->mmap_sem);
+fail_map:
+   vb2_destroy_framevec(vec);
+fail_pfnvec_create:
kfree(buf);
 
return NULL;
@@ -145,20 +124,21 @@ static void vb2_vmalloc_put_userptr(void *buf_priv)
struct vb2_vmalloc_buf *buf = buf_priv;
unsigned long vaddr = (unsigned long)buf->vaddr & PAGE_MASK;
unsigned int i;
+  

[PATCH 3/9] media: omap_vout: Convert omap_vout_uservirt_to_phys() to use get_vaddr_pfns()

2015-07-13 Thread Jan Kara
From: Jan Kara 

Convert omap_vout_uservirt_to_phys() to use get_vaddr_pfns() instead of
hand made mapping of virtual address to physical address. Also the
function leaked page reference from get_user_pages() so fix that by
properly release the reference when omap_vout_buffer_release() is
called.

Signed-off-by: Jan Kara 
---
 drivers/media/platform/omap/Kconfig |  1 +
 drivers/media/platform/omap/omap_vout.c | 67 +++--
 2 files changed, 32 insertions(+), 36 deletions(-)

diff --git a/drivers/media/platform/omap/Kconfig 
b/drivers/media/platform/omap/Kconfig
index dc2aaab54aef..217d613b0fe7 100644
--- a/drivers/media/platform/omap/Kconfig
+++ b/drivers/media/platform/omap/Kconfig
@@ -10,6 +10,7 @@ config VIDEO_OMAP2_VOUT
select OMAP2_DSS if HAS_IOMEM && ARCH_OMAP2PLUS
select OMAP2_VRFB if ARCH_OMAP2 || ARCH_OMAP3
select VIDEO_OMAP2_VOUT_VRFB if VIDEO_OMAP2_VOUT && OMAP2_VRFB
+   select FRAME_VECTOR
default n
---help---
  V4L2 Display driver support for OMAP2/3 based boards.
diff --git a/drivers/media/platform/omap/omap_vout.c 
b/drivers/media/platform/omap/omap_vout.c
index f09c5f17a42f..b0dad941f7cb 100644
--- a/drivers/media/platform/omap/omap_vout.c
+++ b/drivers/media/platform/omap/omap_vout.c
@@ -195,46 +195,34 @@ static int omap_vout_try_format(struct v4l2_pix_format 
*pix)
 }
 
 /*
- * omap_vout_uservirt_to_phys: This inline function is used to convert user
- * space virtual address to physical address.
+ * omap_vout_get_userptr: Convert user space virtual address to physical
+ * address.
  */
-static unsigned long omap_vout_uservirt_to_phys(unsigned long virtp)
+static int omap_vout_get_userptr(struct videobuf_buffer *vb, u32 virtp,
+u32 *physp)
 {
-   unsigned long physp = 0;
-   struct vm_area_struct *vma;
-   struct mm_struct *mm = current->mm;
+   struct frame_vector *vec;
+   int ret;
 
/* For kernel direct-mapped memory, take the easy way */
-   if (virtp >= PAGE_OFFSET)
-   return virt_to_phys((void *) virtp);
-
-   down_read(¤t->mm->mmap_sem);
-   vma = find_vma(mm, virtp);
-   if (vma && (vma->vm_flags & VM_IO) && vma->vm_pgoff) {
-   /* this will catch, kernel-allocated, mmaped-to-usermode
-  addresses */
-   physp = (vma->vm_pgoff << PAGE_SHIFT) + (virtp - vma->vm_start);
-   up_read(¤t->mm->mmap_sem);
-   } else {
-   /* otherwise, use get_user_pages() for general userland pages */
-   int res, nr_pages = 1;
-   struct page *pages;
+   if (virtp >= PAGE_OFFSET) {
+   *physp = virt_to_phys((void *)virtp);
+   return 0;
+   }
 
-   res = get_user_pages(current, current->mm, virtp, nr_pages, 1,
-   0, &pages, NULL);
-   up_read(¤t->mm->mmap_sem);
+   vec = frame_vector_create(1);
+   if (!vec)
+   return -ENOMEM;
 
-   if (res == nr_pages) {
-   physp =  __pa(page_address(&pages[0]) +
-   (virtp & ~PAGE_MASK));
-   } else {
-   printk(KERN_WARNING VOUT_NAME
-   "get_user_pages failed\n");
-   return 0;
-   }
+   ret = get_vaddr_frames(virtp, 1, true, false, vec);
+   if (ret != 1) {
+   frame_vector_destroy(vec);
+   return -EINVAL;
}
+   *physp = __pfn_to_phys(frame_vector_pfns(vec)[0]);
+   vb->priv = vec;
 
-   return physp;
+   return 0;
 }
 
 /*
@@ -784,11 +772,15 @@ static int omap_vout_buffer_prepare(struct videobuf_queue 
*q,
 * address of the buffer
 */
if (V4L2_MEMORY_USERPTR == vb->memory) {
+   int ret;
+
if (0 == vb->baddr)
return -EINVAL;
/* Physical address */
-   vout->queued_buf_addr[vb->i] = (u8 *)
-   omap_vout_uservirt_to_phys(vb->baddr);
+   ret = omap_vout_get_userptr(vb, vb->baddr,
+   (u32 *)&vout->queued_buf_addr[vb->i]);
+   if (ret < 0)
+   return ret;
} else {
unsigned long addr, dma_addr;
unsigned long size;
@@ -837,9 +829,12 @@ static void omap_vout_buffer_release(struct videobuf_queue 
*q,
struct omap_vout_device *vout = q->priv_data;
 
vb->state = VIDEOBUF_NEEDS_INIT;
+   if (vb->memory == V4L2_MEMORY_USERPTR && vb->priv) {
+   struct frame_vector *vec = vb->priv;
 
-   if (V4L2_MEMORY_MMAP != vout->memory)
-   return;
+   put_vaddr_frames(vec);
+   frame_vector_destroy(vec);
+   }
 }
 
 /*
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-medi

Re: [PATCH v3 1/7] rc: rc-ir-raw: Add scancode encoder callback

2015-07-13 Thread David Härdeman
On Mon, Jun 29, 2015 at 09:05:24PM +0200, David Härdeman wrote:
>On Tue, Jun 23, 2015 at 10:45:42PM +0200, David Härdeman wrote:
>>On 2015-06-18 23:23, Mauro Carvalho Chehab wrote:
>>>Em Sun, 14 Jun 2015 01:44:54 +0200
>>>David Härdeman  escreveu:
Maurowake up? I hope you're not planning to push the current code
upstream???
>>>
>>>What's there are planned to be sent upstream. If you think that something
>>>is not mature enough to be applied, please send a patch reverting it,
>>>with "[PATCH FIXES]" in the subject, clearly explaining why it should be
>>>reverted for me to analyze. Having Antti/James acks on that would help.
>>
>>This thread should already provide you with all the information you need why
>>the patches should be reverted (including Antii saying the patches should be
>>reverted).
>>
>>The current code includes hilarious "features" like producing different
>>results depending on module load order and makes sure we'll be stuck with a
>>bad API. Sending them upstream will look quite foolish...
>
>And now the patches have been submitted and comitted upstream. What's
>your plan? Leave it like this?

Mauro, I see that you've applied four of my patches...thanks for
that...but the question is still what you plan to do about the patches
that should be reverted4.2-rc2 was recently released and I'm still
not seeing any action on this while time is running out...?

-- 
David Härdeman
--
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


Media Controller - graph_mutex

2015-07-13 Thread Shuah Khan
All,

ALSA has to make media_entity_pipeline_start() call in irq
path. I am seeing warnings that the graph_mutex is unsafe irq
lock as expected. We have to update MC start/stop pipeline
to be irq safe for ALSA. Maybe there are other MC interfaces
that need to be irq safe, but I haven't seen any problems with
my limited testing.

So as per options, graph_mutex could be changed to a spinlock.
It looks like drivers hold this lock and it isn't abstracted to
MC API. Unfortunate, this would require changes to drivers that
directly hold the lock for graph walks if this mutex is changed
to spinlock.

e.g: drivers/media/platform/exynos4-is/fimc-isp-video.c

Changes aren't complex, just that the scope isn't limited
to MC API.

Other ideas??

thanks,
-- Shuah

-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shua...@osg.samsung.com | (970) 217-8978
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [media] DocBook: Fix typo in intro.xml

2015-07-13 Thread Masanari Iida
This patch fix spelling typos in intro.xml.
This xml file is not created from comments within source,
I fix the xml file.

Signed-off-by: Masanari Iida 
---
 Documentation/DocBook/media/dvb/intro.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/DocBook/media/dvb/intro.xml 
b/Documentation/DocBook/media/dvb/intro.xml
index bcc72c2..4abf6d9 100644
--- a/Documentation/DocBook/media/dvb/intro.xml
+++ b/Documentation/DocBook/media/dvb/intro.xml
@@ -163,8 +163,8 @@ are called:
 where N enumerates the DVB PCI cards in a system starting
 from 0, and M enumerates the devices of each type within each
 adapter, starting from 0, too. We will omit the “
-/dev/dvb/adapterN/” in the further dicussion
-of these devices. The naming scheme for the devices is the same wheter
+/dev/dvb/adapterN/” in the further discussion
+of these devices. The naming scheme for the devices is the same whether
 devfs is used or not.
 
 More details about the data structures and function calls of all
-- 
2.5.0.rc1

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


cron job: media_tree daily build: OK

2015-07-13 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:   Tue Jul 14 04:00:16 CEST 2015
git branch: test
git hash:   8783b9c50400c6279d7c3b716637b98e83d3c933
gcc version:i686-linux-gcc (GCC) 5.1.0
sparse version: v0.5.0-44-g40791b9
smatch version: 0.4.1-3153-g7d56ab3
host hardware:  x86_64
host os:4.0.0-3.slh.1-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin-bf561: 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.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.23-i686: OK
linux-3.13.11-i686: OK
linux-3.14.9-i686: OK
linux-3.15.2-i686: OK
linux-3.16.7-i686: OK
linux-3.17.8-i686: OK
linux-3.18.7-i686: OK
linux-3.19-i686: OK
linux-4.0-i686: OK
linux-4.1.1-i686: OK
linux-4.2-rc1-i686: OK
linux-2.6.32.27-x86_64: OK
linux-2.6.33.7-x86_64: OK
linux-2.6.34.7-x86_64: OK
linux-2.6.35.9-x86_64: OK
linux-2.6.36.4-x86_64: OK
linux-2.6.37.6-x86_64: OK
linux-2.6.38.8-x86_64: OK
linux-2.6.39.4-x86_64: OK
linux-3.0.60-x86_64: OK
linux-3.1.10-x86_64: OK
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: OK
linux-3.9.2-x86_64: OK
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12.23-x86_64: OK
linux-3.13.11-x86_64: OK
linux-3.14.9-x86_64: OK
linux-3.15.2-x86_64: OK
linux-3.16.7-x86_64: OK
linux-3.17.8-x86_64: OK
linux-3.18.7-x86_64: OK
linux-3.19-x86_64: OK
linux-4.0-x86_64: OK
linux-4.1.1-x86_64: OK
linux-4.2-rc1-x86_64: OK
apps: OK
spec-git: OK
sparse: WARNINGS
smatch: ERRORS

Detailed results are available here:

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

Full logs are available here:

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


file permissions for a video device

2015-07-13 Thread karthik poduval
Hi All,

I was working with a USB camera. As soon as I plug it into the host,
it probes and video device node gets created with the following
permission.
# ll /dev/video0
crw--- root root  81,   0 2015-07-13 20:39 video0


However it grants permissions to only a root user. I need to be able
to access this device node from a daemon (running in a non root user
account).

I can ofcourse chmod the devnode, but was wondering if there is a way
this can be done from the kernel itself ? Is there some place in the
uvc code which sets the created the devnode file permissions ?

-- 
Regards,
Karthik Poduval
--
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