Merge tag 'armsoc-dt64' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[deliverable/linux.git] / drivers / media / pci / ivtv / ivtv-alsa.h
1 /*
2 * ALSA interface to ivtv PCM capture streams
3 *
4 * Copyright (C) 2009,2012 Andy Walls <awalls@md.metrocast.net>
5 * Copyright (C) 2009 Devin Heitmueller <dheitmueller@kernellabs.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 * 02111-1307 USA
21 */
22
23 struct snd_card;
24
25 struct snd_ivtv_card {
26 struct v4l2_device *v4l2_dev;
27 struct snd_card *sc;
28 unsigned int capture_transfer_done;
29 unsigned int hwptr_done_capture;
30 struct snd_pcm_substream *capture_pcm_substream;
31 spinlock_t slock;
32 };
33
34 extern int ivtv_alsa_debug;
35
36 /*
37 * File operations that manipulate the encoder or video or audio subdevices
38 * need to be serialized. Use the same lock we use for v4l2 file ops.
39 */
40 static inline void snd_ivtv_lock(struct snd_ivtv_card *itvsc)
41 {
42 struct ivtv *itv = to_ivtv(itvsc->v4l2_dev);
43 mutex_lock(&itv->serialize_lock);
44 }
45
46 static inline void snd_ivtv_unlock(struct snd_ivtv_card *itvsc)
47 {
48 struct ivtv *itv = to_ivtv(itvsc->v4l2_dev);
49 mutex_unlock(&itv->serialize_lock);
50 }
51
52 #define IVTV_ALSA_DBGFLG_WARN (1 << 0)
53 #define IVTV_ALSA_DBGFLG_INFO (1 << 1)
54
55 #define IVTV_ALSA_DEBUG(x, type, fmt, args...) \
56 do { \
57 if ((x) & ivtv_alsa_debug) \
58 pr_info("%s-alsa: " type ": " fmt, \
59 v4l2_dev->name , ## args); \
60 } while (0)
61
62 #define IVTV_ALSA_DEBUG_WARN(fmt, args...) \
63 IVTV_ALSA_DEBUG(IVTV_ALSA_DBGFLG_WARN, "warning", fmt , ## args)
64
65 #define IVTV_ALSA_DEBUG_INFO(fmt, args...) \
66 IVTV_ALSA_DEBUG(IVTV_ALSA_DBGFLG_INFO, "info", fmt , ## args)
67
68 #define IVTV_ALSA_ERR(fmt, args...) \
69 pr_err("%s-alsa: " fmt, v4l2_dev->name , ## args)
70
71 #define IVTV_ALSA_WARN(fmt, args...) \
72 pr_warn("%s-alsa: " fmt, v4l2_dev->name , ## args)
73
74 #define IVTV_ALSA_INFO(fmt, args...) \
75 pr_info("%s-alsa: " fmt, v4l2_dev->name , ## args)
This page took 0.031369 seconds and 5 git commands to generate.