1 /* SPDX-License-Identifier: GPL-2.0-or-later */
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>
11 struct snd_ivtv_card
{
12 struct v4l2_device
*v4l2_dev
;
14 unsigned int capture_transfer_done
;
15 unsigned int hwptr_done_capture
;
16 struct snd_pcm_substream
*capture_pcm_substream
;
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...) \
43 if ((x) & ivtv_alsa_debug) \
44 pr_info("%s-alsa: " type ": " fmt, \
45 v4l2_dev->name , ## args); \
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)