1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * ALSA interface to cx18 PCM capture streams
5 * Copyright (C) 2009 Andy Walls <awalls@md.metrocast.net>
10 struct snd_cx18_card
{
11 struct v4l2_device
*v4l2_dev
;
13 unsigned int capture_transfer_done
;
14 unsigned int hwptr_done_capture
;
15 struct snd_pcm_substream
*capture_pcm_substream
;
19 extern int cx18_alsa_debug
;
22 * File operations that manipulate the encoder or video or audio subdevices
23 * need to be serialized. Use the same lock we use for v4l2 file ops.
25 static inline void snd_cx18_lock(struct snd_cx18_card
*cxsc
)
27 struct cx18
*cx
= to_cx18(cxsc
->v4l2_dev
);
28 mutex_lock(&cx
->serialize_lock
);
31 static inline void snd_cx18_unlock(struct snd_cx18_card
*cxsc
)
33 struct cx18
*cx
= to_cx18(cxsc
->v4l2_dev
);
34 mutex_unlock(&cx
->serialize_lock
);
37 #define CX18_ALSA_DBGFLG_WARN (1 << 0)
38 #define CX18_ALSA_DBGFLG_INFO (1 << 1)
40 #define CX18_ALSA_DEBUG(x, type, fmt, args...) \
42 if ((x) & cx18_alsa_debug) \
43 printk(KERN_INFO "%s-alsa: " type ": " fmt, \
44 v4l2_dev->name , ## args); \
47 #define CX18_ALSA_DEBUG_WARN(fmt, args...) \
48 CX18_ALSA_DEBUG(CX18_ALSA_DBGFLG_WARN, "warning", fmt , ## args)
50 #define CX18_ALSA_DEBUG_INFO(fmt, args...) \
51 CX18_ALSA_DEBUG(CX18_ALSA_DBGFLG_INFO, "info", fmt , ## args)
53 #define CX18_ALSA_ERR(fmt, args...) \
54 printk(KERN_ERR "%s-alsa: " fmt, v4l2_dev->name , ## args)
56 #define CX18_ALSA_WARN(fmt, args...) \
57 printk(KERN_WARNING "%s-alsa: " fmt, v4l2_dev->name , ## args)
59 #define CX18_ALSA_INFO(fmt, args...) \
60 printk(KERN_INFO "%s-alsa: " fmt, v4l2_dev->name , ## args)