v4l2-fh.h revision fc5602be7ca5b55174c5d6595089718779b28dfa
11babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus/*
21babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * v4l2-fh.h
31babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus *
41babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * V4L2 file handle. Store per file handle data for the V4L2
51babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * framework. Using file handles is optional for the drivers.
61babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus *
71babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * Copyright (C) 2009--2010 Nokia Corporation.
81babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus *
91babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
101babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus *
111babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * This program is free software; you can redistribute it and/or
121babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * modify it under the terms of the GNU General Public License
131babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * version 2 as published by the Free Software Foundation.
141babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus *
151babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * This program is distributed in the hope that it will be useful, but
161babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * WITHOUT ANY WARRANTY; without even the implied warranty of
171babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
181babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * General Public License for more details.
191babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus *
201babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * You should have received a copy of the GNU General Public License
211babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * along with this program; if not, write to the Free Software
221babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
231babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * 02110-1301 USA
241babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus */
251babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus
261babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus#ifndef V4L2_FH_H
271babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus#define V4L2_FH_H
281babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus
291babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus#include <linux/list.h>
301babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus
311babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailusstruct video_device;
32c3b5b0241f620a356c97d8f43343e721c718806dSakari Ailusstruct v4l2_events;
331babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus
341babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailusstruct v4l2_fh {
351babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus	struct list_head	list;
361babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus	struct video_device	*vdev;
37c3b5b0241f620a356c97d8f43343e721c718806dSakari Ailus	struct v4l2_events      *events; /* events, pending and subscribed */
38fc5602be7ca5b55174c5d6595089718779b28dfaHans Verkuil	enum v4l2_priority	prio;
391babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus};
401babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus
411babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus/*
421babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * Initialise the file handle. Parts of the V4L2 framework using the
431babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * file handles should be initialised in this function. Must be called
441babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * from driver's v4l2_file_operations->open() handler if the driver
451babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * uses v4l2_fh.
461babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus */
471babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailusint v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev);
481babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus/*
491babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * Add the fh to the list of file handles on a video_device. The file
501babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * handle must be initialised first.
511babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus */
521babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailusvoid v4l2_fh_add(struct v4l2_fh *fh);
531babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus/*
541babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * Remove file handle from the list of file handles. Must be called in
551babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * v4l2_file_operations->release() handler if the driver uses v4l2_fh.
561babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus */
571babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailusvoid v4l2_fh_del(struct v4l2_fh *fh);
581babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus/*
591babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * Release resources related to a file handle. Parts of the V4L2
601babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * framework using the v4l2_fh must release their resources here, too.
611babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * Must be called in v4l2_file_operations->release() handler if the
621babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus * driver uses v4l2_fh.
631babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus */
641babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailusvoid v4l2_fh_exit(struct v4l2_fh *fh);
651babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus
661babcb460f2b87c20eb6860b9685a0dab636cc4bSakari Ailus#endif /* V4L2_EVENT_H */
67