WIP FPC-III support
[linux/fpc-iii.git] / drivers / media / pci / ivtv / ivtv-alsa.h
blobd9f685b1c57ef2550f494d789f55012928c030c1
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 * ALSA interface to ivtv PCM capture streams
5 * Copyright (C) 2009,2012 Andy Walls <awalls@md.metrocast.net>
6 * Copyright (C) 2009 Devin Heitmueller <dheitmueller@kernellabs.com>
7 */
9 struct snd_card;
11 struct snd_ivtv_card {
12 struct v4l2_device *v4l2_dev;
13 struct snd_card *sc;
14 unsigned int capture_transfer_done;
15 unsigned int hwptr_done_capture;
16 struct snd_pcm_substream *capture_pcm_substream;
17 spinlock_t slock;
20 extern int ivtv_alsa_debug;
23 * File operations that manipulate the encoder or video or audio subdevices
24 * need to be serialized. Use the same lock we use for v4l2 file ops.
26 static inline void snd_ivtv_lock(struct snd_ivtv_card *itvsc)
28 struct ivtv *itv = to_ivtv(itvsc->v4l2_dev);
29 mutex_lock(&itv->serialize_lock);
32 static inline void snd_ivtv_unlock(struct snd_ivtv_card *itvsc)
34 struct ivtv *itv = to_ivtv(itvsc->v4l2_dev);
35 mutex_unlock(&itv->serialize_lock);
38 #define IVTV_ALSA_DBGFLG_WARN (1 << 0)
39 #define IVTV_ALSA_DBGFLG_INFO (1 << 1)
41 #define IVTV_ALSA_DEBUG(x, type, fmt, args...) \
42 do { \
43 if ((x) & ivtv_alsa_debug) \
44 pr_info("%s-alsa: " type ": " fmt, \
45 v4l2_dev->name , ## args); \
46 } while (0)
48 #define IVTV_ALSA_DEBUG_WARN(fmt, args...) \
49 IVTV_ALSA_DEBUG(IVTV_ALSA_DBGFLG_WARN, "warning", fmt , ## args)
51 #define IVTV_ALSA_DEBUG_INFO(fmt, args...) \
52 IVTV_ALSA_DEBUG(IVTV_ALSA_DBGFLG_INFO, "info", fmt , ## args)
54 #define IVTV_ALSA_ERR(fmt, args...) \
55 pr_err("%s-alsa: " fmt, v4l2_dev->name , ## args)
57 #define IVTV_ALSA_WARN(fmt, args...) \
58 pr_warn("%s-alsa: " fmt, v4l2_dev->name , ## args)
60 #define IVTV_ALSA_INFO(fmt, args...) \
61 pr_info("%s-alsa: " fmt, v4l2_dev->name , ## args)