Path: blob/master/drivers/media/video/cx18/cx18-alsa.h
17745 views
/*1* ALSA interface to cx18 PCM capture streams2*3* Copyright (C) 2009 Andy Walls <[email protected]>4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License as published by7* the Free Software Foundation; either version 2 of the License, or8* (at your option) any later version.9*10* This program is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13* GNU General Public License for more details.14*15* You should have received a copy of the GNU General Public License16* along with this program; if not, write to the Free Software17* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA18* 02111-1307 USA19*/2021struct snd_card;2223struct snd_cx18_card {24struct v4l2_device *v4l2_dev;25struct snd_card *sc;26unsigned int capture_transfer_done;27unsigned int hwptr_done_capture;28struct snd_pcm_substream *capture_pcm_substream;29spinlock_t slock;30};3132extern int cx18_alsa_debug;3334/*35* File operations that manipulate the encoder or video or audio subdevices36* need to be serialized. Use the same lock we use for v4l2 file ops.37*/38static inline void snd_cx18_lock(struct snd_cx18_card *cxsc)39{40struct cx18 *cx = to_cx18(cxsc->v4l2_dev);41mutex_lock(&cx->serialize_lock);42}4344static inline void snd_cx18_unlock(struct snd_cx18_card *cxsc)45{46struct cx18 *cx = to_cx18(cxsc->v4l2_dev);47mutex_unlock(&cx->serialize_lock);48}4950#define CX18_ALSA_DBGFLG_WARN (1 << 0)51#define CX18_ALSA_DBGFLG_WARN (1 << 0)52#define CX18_ALSA_DBGFLG_INFO (1 << 1)5354#define CX18_ALSA_DEBUG(x, type, fmt, args...) \55do { \56if ((x) & cx18_alsa_debug) \57printk(KERN_INFO "%s-alsa: " type ": " fmt, \58v4l2_dev->name , ## args); \59} while (0)6061#define CX18_ALSA_DEBUG_WARN(fmt, args...) \62CX18_ALSA_DEBUG(CX18_ALSA_DBGFLG_WARN, "warning", fmt , ## args)6364#define CX18_ALSA_DEBUG_INFO(fmt, args...) \65CX18_ALSA_DEBUG(CX18_ALSA_DBGFLG_INFO, "info", fmt , ## args)6667#define CX18_ALSA_ERR(fmt, args...) \68printk(KERN_ERR "%s-alsa: " fmt, v4l2_dev->name , ## args)6970#define CX18_ALSA_WARN(fmt, args...) \71printk(KERN_WARNING "%s-alsa: " fmt, v4l2_dev->name , ## args)7273#define CX18_ALSA_INFO(fmt, args...) \74printk(KERN_INFO "%s-alsa: " fmt, v4l2_dev->name , ## args)757677