diff options
author | Bhupesh Sharma <bhupesh.sharma@st.com> | 2013-03-28 05:41:53 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-04-02 04:42:49 -0400 |
commit | 2f1d57069338b14fcf4765ae2c25fc377da45b1f (patch) | |
tree | 3b2cbfd148a6d5766ebd3b2b0decd6346b94e929 | |
parent | d692522577c051058efbe9e3c8aef68a4c36e4f7 (diff) |
usb: gadget/uvc: Add support for 'get_unmapped_area' for MMUless architectures
This patch adds the support for 'get_unmapped_area' in UVC gadget
which is called when the 'mmap' system call is executed on MMUless
architectures.
Signed-off-by: Bhupesh Sharma <bhupesh.sharma@st.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r-- | drivers/usb/gadget/uvc_queue.c | 18 | ||||
-rw-r--r-- | drivers/usb/gadget/uvc_v4l2.c | 15 |
2 files changed, 33 insertions, 0 deletions
diff --git a/drivers/usb/gadget/uvc_queue.c b/drivers/usb/gadget/uvc_queue.c index 31397954c889..7ce27e35550b 100644 --- a/drivers/usb/gadget/uvc_queue.c +++ b/drivers/usb/gadget/uvc_queue.c | |||
@@ -232,6 +232,24 @@ static int uvc_queue_mmap(struct uvc_video_queue *queue, | |||
232 | return ret; | 232 | return ret; |
233 | } | 233 | } |
234 | 234 | ||
235 | #ifndef CONFIG_MMU | ||
236 | /* | ||
237 | * Get unmapped area. | ||
238 | * | ||
239 | * NO-MMU arch need this function to make mmap() work correctly. | ||
240 | */ | ||
241 | static unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue, | ||
242 | unsigned long pgoff) | ||
243 | { | ||
244 | unsigned long ret; | ||
245 | |||
246 | mutex_lock(&queue->mutex); | ||
247 | ret = vb2_get_unmapped_area(&queue->queue, 0, 0, pgoff, 0); | ||
248 | mutex_unlock(&queue->mutex); | ||
249 | return ret; | ||
250 | } | ||
251 | #endif | ||
252 | |||
235 | /* | 253 | /* |
236 | * Cancel the video buffers queue. | 254 | * Cancel the video buffers queue. |
237 | * | 255 | * |
diff --git a/drivers/usb/gadget/uvc_v4l2.c b/drivers/usb/gadget/uvc_v4l2.c index c058867ea4fb..ad48e81155e2 100644 --- a/drivers/usb/gadget/uvc_v4l2.c +++ b/drivers/usb/gadget/uvc_v4l2.c | |||
@@ -339,6 +339,18 @@ uvc_v4l2_poll(struct file *file, poll_table *wait) | |||
339 | return uvc_queue_poll(&uvc->video.queue, file, wait); | 339 | return uvc_queue_poll(&uvc->video.queue, file, wait); |
340 | } | 340 | } |
341 | 341 | ||
342 | #ifndef CONFIG_MMU | ||
343 | static unsigned long uvc_v4l2_get_unmapped_area(struct file *file, | ||
344 | unsigned long addr, unsigned long len, unsigned long pgoff, | ||
345 | unsigned long flags) | ||
346 | { | ||
347 | struct video_device *vdev = video_devdata(file); | ||
348 | struct uvc_device *uvc = video_get_drvdata(vdev); | ||
349 | |||
350 | return uvc_queue_get_unmapped_area(&uvc->video.queue, pgoff); | ||
351 | } | ||
352 | #endif | ||
353 | |||
342 | static struct v4l2_file_operations uvc_v4l2_fops = { | 354 | static struct v4l2_file_operations uvc_v4l2_fops = { |
343 | .owner = THIS_MODULE, | 355 | .owner = THIS_MODULE, |
344 | .open = uvc_v4l2_open, | 356 | .open = uvc_v4l2_open, |
@@ -346,5 +358,8 @@ static struct v4l2_file_operations uvc_v4l2_fops = { | |||
346 | .ioctl = uvc_v4l2_ioctl, | 358 | .ioctl = uvc_v4l2_ioctl, |
347 | .mmap = uvc_v4l2_mmap, | 359 | .mmap = uvc_v4l2_mmap, |
348 | .poll = uvc_v4l2_poll, | 360 | .poll = uvc_v4l2_poll, |
361 | #ifndef CONFIG_MMU | ||
362 | .get_unmapped_area = uvc_v4l2_get_unmapped_area, | ||
363 | #endif | ||
349 | }; | 364 | }; |
350 | 365 | ||