Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / drivers / media / pci / ivtv / ivtv-alsa.h
blobeae6462233674e481960a9fea31e251309860470
1 /*
2 * ALSA interface to ivtv PCM capture streams
4 * Copyright (C) 2009,2012 Andy Walls <awalls@md.metrocast.net>
5 * Copyright (C) 2009 Devin Heitmueller <dheitmueller@kernellabs.com>
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.
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.
18 struct snd_card;
20 struct snd_ivtv_card {
21 struct v4l2_device *v4l2_dev;
22 struct snd_card *sc;
23 unsigned int capture_transfer_done;
24 unsigned int hwptr_done_capture;
25 struct snd_pcm_substream *capture_pcm_substream;
26 spinlock_t slock;
29 extern int ivtv_alsa_debug;
32 * File operations that manipulate the encoder or video or audio subdevices
33 * need to be serialized. Use the same lock we use for v4l2 file ops.
35 static inline void snd_ivtv_lock(struct snd_ivtv_card *itvsc)
37 struct ivtv *itv = to_ivtv(itvsc->v4l2_dev);
38 mutex_lock(&itv->serialize_lock);
41 static inline void snd_ivtv_unlock(struct snd_ivtv_card *itvsc)
43 struct ivtv *itv = to_ivtv(itvsc->v4l2_dev);
44 mutex_unlock(&itv->serialize_lock);
47 #define IVTV_ALSA_DBGFLG_WARN (1 << 0)
48 #define IVTV_ALSA_DBGFLG_INFO (1 << 1)
50 #define IVTV_ALSA_DEBUG(x, type, fmt, args...) \
51 do { \
52 if ((x) & ivtv_alsa_debug) \
53 pr_info("%s-alsa: " type ": " fmt, \
54 v4l2_dev->name , ## args); \
55 } while (0)
57 #define IVTV_ALSA_DEBUG_WARN(fmt, args...) \
58 IVTV_ALSA_DEBUG(IVTV_ALSA_DBGFLG_WARN, "warning", fmt , ## args)
60 #define IVTV_ALSA_DEBUG_INFO(fmt, args...) \
61 IVTV_ALSA_DEBUG(IVTV_ALSA_DBGFLG_INFO, "info", fmt , ## args)
63 #define IVTV_ALSA_ERR(fmt, args...) \
64 pr_err("%s-alsa: " fmt, v4l2_dev->name , ## args)
66 #define IVTV_ALSA_WARN(fmt, args...) \
67 pr_warn("%s-alsa: " fmt, v4l2_dev->name , ## args)
69 #define IVTV_ALSA_INFO(fmt, args...) \
70 pr_info("%s-alsa: " fmt, v4l2_dev->name , ## args)