Select Git revision
msm.c 25.23 KiB
/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/of.h>
#include <linux/module.h>
#include <linux/workqueue.h>
#include <linux/delay.h>
#include <linux/types.h>
#include <linux/list.h>
#include <linux/ioctl.h>
#include <linux/spinlock.h>
#include <linux/proc_fs.h>
#include <linux/atomic.h>
#include <linux/wait.h>
#include <linux/videodev2.h>
#include <linux/msm_ion.h>
#include <linux/iommu.h>
#include <linux/platform_device.h>
#include <media/v4l2-fh.h>
#include "msm.h"
#include "msm_vb2.h"
#include "msm_sd.h"
static struct v4l2_device *msm_v4l2_dev;
static struct list_head ordered_sd_list;
static struct msm_queue_head *msm_session_q;
/* config node envent queue */
static struct v4l2_fh *msm_eventq;
spinlock_t msm_eventq_lock;
static struct pid *msm_pid;
spinlock_t msm_pid_lock;
#define msm_dequeue(queue, type, member) ({ \
unsigned long flags; \
struct msm_queue_head *__q = (queue); \
type *node = 0; \
spin_lock_irqsave(&__q->lock, flags); \
if (!list_empty(&__q->list)) { \
__q->len--; \
node = list_first_entry(&__q->list, \
type, member); \
if ((node) && (&node->member) && (&node->member.next)) \
list_del_init(&node->member); \
} \
spin_unlock_irqrestore(&__q->lock, flags); \
node; \
})
#define msm_delete_sd_entry(queue, type, member, q_node) ({ \
unsigned long flags; \
struct msm_queue_head *__q = (queue); \
type *node = 0; \
spin_lock_irqsave(&__q->lock, flags); \
if (!list_empty(&__q->list)) { \
list_for_each_entry(node, &__q->list, member) \
if (node->sd == q_node) { \
__q->len--; \
list_del_init(&node->member); \