| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #ifndef __SOUND_PCM_H
 | 
					
						
							|  |  |  | #define __SOUND_PCM_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  *  Digital Audio (PCM) abstract layer | 
					
						
							| 
									
										
										
										
											2007-10-15 09:50:19 +02:00
										 |  |  |  *  Copyright (c) by Jaroslav Kysela <perex@perex.cz> | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  *                   Abramo Bagnara <abramo@alsa-project.org> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *   This program is free software; you can redistribute it and/or modify | 
					
						
							|  |  |  |  *   it under the terms of the GNU General Public License as published by | 
					
						
							|  |  |  |  *   the Free Software Foundation; either version 2 of the License, or | 
					
						
							|  |  |  |  *   (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *   This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  *   GNU General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *   You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |  *   along with this program; if not, write to the Free Software | 
					
						
							|  |  |  |  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <sound/asound.h>
 | 
					
						
							|  |  |  | #include <sound/memalloc.h>
 | 
					
						
							| 
									
										
										
										
											2008-07-30 12:46:40 +01:00
										 |  |  | #include <sound/minors.h>
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #include <linux/poll.h>
 | 
					
						
							| 
									
										
										
										
											2006-10-20 15:17:02 -04:00
										 |  |  | #include <linux/mm.h>
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #include <linux/bitops.h>
 | 
					
						
							| 
									
										
										
										
											2011-08-25 15:35:03 +02:00
										 |  |  | #include <linux/pm_qos.h>
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define snd_pcm_substream_chip(substream) ((substream)->private_data)
 | 
					
						
							|  |  |  | #define snd_pcm_chip(pcm) ((pcm)->private_data)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
 | 
					
						
							| 
									
										
										
										
											2012-10-02 18:01:25 +01:00
										 |  |  | #include <sound/pcm_oss.h>
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  *  Hardware (lowlevel) section | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | struct snd_pcm_hardware { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	unsigned int info;		/* SNDRV_PCM_INFO_* */ | 
					
						
							|  |  |  | 	u64 formats;			/* SNDRV_PCM_FMTBIT_* */ | 
					
						
							|  |  |  | 	unsigned int rates;		/* SNDRV_PCM_RATE_* */ | 
					
						
							|  |  |  | 	unsigned int rate_min;		/* min rate */ | 
					
						
							|  |  |  | 	unsigned int rate_max;		/* max rate */ | 
					
						
							|  |  |  | 	unsigned int channels_min;	/* min channels */ | 
					
						
							|  |  |  | 	unsigned int channels_max;	/* max channels */ | 
					
						
							|  |  |  | 	size_t buffer_bytes_max;	/* max buffer size */ | 
					
						
							|  |  |  | 	size_t period_bytes_min;	/* min period size */ | 
					
						
							|  |  |  | 	size_t period_bytes_max;	/* max period size */ | 
					
						
							|  |  |  | 	unsigned int periods_min;	/* min # of periods */ | 
					
						
							|  |  |  | 	unsigned int periods_max;	/* max # of periods */ | 
					
						
							|  |  |  | 	size_t fifo_size;		/* fifo size in bytes */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-12-07 08:22:50 +01:00
										 |  |  | struct snd_pcm_substream; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | struct snd_pcm_ops { | 
					
						
							|  |  |  | 	int (*open)(struct snd_pcm_substream *substream); | 
					
						
							|  |  |  | 	int (*close)(struct snd_pcm_substream *substream); | 
					
						
							|  |  |  | 	int (*ioctl)(struct snd_pcm_substream * substream, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 		     unsigned int cmd, void *arg); | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	int (*hw_params)(struct snd_pcm_substream *substream, | 
					
						
							|  |  |  | 			 struct snd_pcm_hw_params *params); | 
					
						
							|  |  |  | 	int (*hw_free)(struct snd_pcm_substream *substream); | 
					
						
							|  |  |  | 	int (*prepare)(struct snd_pcm_substream *substream); | 
					
						
							|  |  |  | 	int (*trigger)(struct snd_pcm_substream *substream, int cmd); | 
					
						
							|  |  |  | 	snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream); | 
					
						
							| 
									
										
										
										
											2012-10-22 16:42:15 -05:00
										 |  |  | 	int (*wall_clock)(struct snd_pcm_substream *substream, | 
					
						
							|  |  |  | 			  struct timespec *audio_ts); | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	int (*copy)(struct snd_pcm_substream *substream, int channel, | 
					
						
							|  |  |  | 		    snd_pcm_uframes_t pos, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 		    void __user *buf, snd_pcm_uframes_t count); | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	int (*silence)(struct snd_pcm_substream *substream, int channel,  | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 		       snd_pcm_uframes_t pos, snd_pcm_uframes_t count); | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct page *(*page)(struct snd_pcm_substream *substream, | 
					
						
							|  |  |  | 			     unsigned long offset); | 
					
						
							|  |  |  | 	int (*mmap)(struct snd_pcm_substream *substream, struct vm_area_struct *vma); | 
					
						
							|  |  |  | 	int (*ack)(struct snd_pcm_substream *substream); | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-07-30 12:46:40 +01:00
										 |  |  | #if defined(CONFIG_SND_DYNAMIC_MINORS)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_DEVICES	(SNDRV_OS_MINORS-2)
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #define SNDRV_PCM_DEVICES	8
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2008-08-01 13:36:04 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #define SNDRV_PCM_IOCTL1_FALSE		((void *)0)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_IOCTL1_TRUE		((void *)1)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define SNDRV_PCM_IOCTL1_RESET		0
 | 
					
						
							|  |  |  | #define SNDRV_PCM_IOCTL1_INFO		1
 | 
					
						
							|  |  |  | #define SNDRV_PCM_IOCTL1_CHANNEL_INFO	2
 | 
					
						
							|  |  |  | #define SNDRV_PCM_IOCTL1_GSTATE		3
 | 
					
						
							| 
									
										
										
										
											2009-04-27 09:44:40 +02:00
										 |  |  | #define SNDRV_PCM_IOCTL1_FIFO_SIZE	4
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define SNDRV_PCM_TRIGGER_STOP		0
 | 
					
						
							|  |  |  | #define SNDRV_PCM_TRIGGER_START		1
 | 
					
						
							|  |  |  | #define SNDRV_PCM_TRIGGER_PAUSE_PUSH	3
 | 
					
						
							|  |  |  | #define SNDRV_PCM_TRIGGER_PAUSE_RELEASE	4
 | 
					
						
							|  |  |  | #define SNDRV_PCM_TRIGGER_SUSPEND	5
 | 
					
						
							|  |  |  | #define SNDRV_PCM_TRIGGER_RESUME	6
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define SNDRV_PCM_POS_XRUN		((snd_pcm_uframes_t)-1)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* If you change this don't forget to change rates[] table in pcm_native.c */ | 
					
						
							|  |  |  | #define SNDRV_PCM_RATE_5512		(1<<0)		/* 5512Hz */
 | 
					
						
							|  |  |  | #define SNDRV_PCM_RATE_8000		(1<<1)		/* 8000Hz */
 | 
					
						
							|  |  |  | #define SNDRV_PCM_RATE_11025		(1<<2)		/* 11025Hz */
 | 
					
						
							|  |  |  | #define SNDRV_PCM_RATE_16000		(1<<3)		/* 16000Hz */
 | 
					
						
							|  |  |  | #define SNDRV_PCM_RATE_22050		(1<<4)		/* 22050Hz */
 | 
					
						
							|  |  |  | #define SNDRV_PCM_RATE_32000		(1<<5)		/* 32000Hz */
 | 
					
						
							|  |  |  | #define SNDRV_PCM_RATE_44100		(1<<6)		/* 44100Hz */
 | 
					
						
							|  |  |  | #define SNDRV_PCM_RATE_48000		(1<<7)		/* 48000Hz */
 | 
					
						
							|  |  |  | #define SNDRV_PCM_RATE_64000		(1<<8)		/* 64000Hz */
 | 
					
						
							|  |  |  | #define SNDRV_PCM_RATE_88200		(1<<9)		/* 88200Hz */
 | 
					
						
							|  |  |  | #define SNDRV_PCM_RATE_96000		(1<<10)		/* 96000Hz */
 | 
					
						
							|  |  |  | #define SNDRV_PCM_RATE_176400		(1<<11)		/* 176400Hz */
 | 
					
						
							|  |  |  | #define SNDRV_PCM_RATE_192000		(1<<12)		/* 192000Hz */
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define SNDRV_PCM_RATE_CONTINUOUS	(1<<30)		/* continuous range */
 | 
					
						
							|  |  |  | #define SNDRV_PCM_RATE_KNOT		(1<<31)		/* supports more non-continuos rates */
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define SNDRV_PCM_RATE_8000_44100	(SNDRV_PCM_RATE_8000|SNDRV_PCM_RATE_11025|\
 | 
					
						
							|  |  |  | 					 SNDRV_PCM_RATE_16000|SNDRV_PCM_RATE_22050|\ | 
					
						
							|  |  |  | 					 SNDRV_PCM_RATE_32000|SNDRV_PCM_RATE_44100) | 
					
						
							|  |  |  | #define SNDRV_PCM_RATE_8000_48000	(SNDRV_PCM_RATE_8000_44100|SNDRV_PCM_RATE_48000)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_RATE_8000_96000	(SNDRV_PCM_RATE_8000_48000|SNDRV_PCM_RATE_64000|\
 | 
					
						
							|  |  |  | 					 SNDRV_PCM_RATE_88200|SNDRV_PCM_RATE_96000) | 
					
						
							|  |  |  | #define SNDRV_PCM_RATE_8000_192000	(SNDRV_PCM_RATE_8000_96000|SNDRV_PCM_RATE_176400|\
 | 
					
						
							|  |  |  | 					 SNDRV_PCM_RATE_192000) | 
					
						
							| 
									
										
										
										
											2011-02-14 11:00:47 +01:00
										 |  |  | #define _SNDRV_PCM_FMTBIT(fmt)		(1ULL << (__force int)SNDRV_PCM_FORMAT_##fmt)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_S8		_SNDRV_PCM_FMTBIT(S8)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_U8		_SNDRV_PCM_FMTBIT(U8)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_S16_LE		_SNDRV_PCM_FMTBIT(S16_LE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_S16_BE		_SNDRV_PCM_FMTBIT(S16_BE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_U16_LE		_SNDRV_PCM_FMTBIT(U16_LE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_U16_BE		_SNDRV_PCM_FMTBIT(U16_BE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_S24_LE		_SNDRV_PCM_FMTBIT(S24_LE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_S24_BE		_SNDRV_PCM_FMTBIT(S24_BE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_U24_LE		_SNDRV_PCM_FMTBIT(U24_LE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_U24_BE		_SNDRV_PCM_FMTBIT(U24_BE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_S32_LE		_SNDRV_PCM_FMTBIT(S32_LE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_S32_BE		_SNDRV_PCM_FMTBIT(S32_BE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_U32_LE		_SNDRV_PCM_FMTBIT(U32_LE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_U32_BE		_SNDRV_PCM_FMTBIT(U32_BE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_FLOAT_LE	_SNDRV_PCM_FMTBIT(FLOAT_LE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_FLOAT_BE	_SNDRV_PCM_FMTBIT(FLOAT_BE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_FLOAT64_LE	_SNDRV_PCM_FMTBIT(FLOAT64_LE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_FLOAT64_BE	_SNDRV_PCM_FMTBIT(FLOAT64_BE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE _SNDRV_PCM_FMTBIT(IEC958_SUBFRAME_LE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE _SNDRV_PCM_FMTBIT(IEC958_SUBFRAME_BE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_MU_LAW		_SNDRV_PCM_FMTBIT(MU_LAW)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_A_LAW		_SNDRV_PCM_FMTBIT(A_LAW)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_IMA_ADPCM	_SNDRV_PCM_FMTBIT(IMA_ADPCM)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_MPEG		_SNDRV_PCM_FMTBIT(MPEG)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_GSM		_SNDRV_PCM_FMTBIT(GSM)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_SPECIAL	_SNDRV_PCM_FMTBIT(SPECIAL)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_S24_3LE	_SNDRV_PCM_FMTBIT(S24_3LE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_U24_3LE	_SNDRV_PCM_FMTBIT(U24_3LE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_S24_3BE	_SNDRV_PCM_FMTBIT(S24_3BE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_U24_3BE	_SNDRV_PCM_FMTBIT(U24_3BE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_S20_3LE	_SNDRV_PCM_FMTBIT(S20_3LE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_U20_3LE	_SNDRV_PCM_FMTBIT(U20_3LE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_S20_3BE	_SNDRV_PCM_FMTBIT(S20_3BE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_U20_3BE	_SNDRV_PCM_FMTBIT(U20_3BE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_S18_3LE	_SNDRV_PCM_FMTBIT(S18_3LE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_U18_3LE	_SNDRV_PCM_FMTBIT(U18_3LE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_S18_3BE	_SNDRV_PCM_FMTBIT(S18_3BE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_U18_3BE	_SNDRV_PCM_FMTBIT(U18_3BE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_G723_24	_SNDRV_PCM_FMTBIT(G723_24)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_G723_24_1B	_SNDRV_PCM_FMTBIT(G723_24_1B)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_G723_40	_SNDRV_PCM_FMTBIT(G723_40)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_G723_40_1B	_SNDRV_PCM_FMTBIT(G723_40_1B)
 | 
					
						
							| 
									
										
										
										
											2013-04-17 00:01:36 +08:00
										 |  |  | #define SNDRV_PCM_FMTBIT_DSD_U8		_SNDRV_PCM_FMTBIT(DSD_U8)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_DSD_U16_LE	_SNDRV_PCM_FMTBIT(DSD_U16_LE)
 | 
					
						
							| 
									
										
										
										
											2014-09-05 10:47:56 +02:00
										 |  |  | #define SNDRV_PCM_FMTBIT_DSD_U32_LE	_SNDRV_PCM_FMTBIT(DSD_U32_LE)
 | 
					
						
							| 
									
										
										
										
											2014-11-21 16:04:46 +02:00
										 |  |  | #define SNDRV_PCM_FMTBIT_DSD_U16_BE	_SNDRV_PCM_FMTBIT(DSD_U16_BE)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_DSD_U32_BE	_SNDRV_PCM_FMTBIT(DSD_U32_BE)
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifdef SNDRV_LITTLE_ENDIAN
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_S16		SNDRV_PCM_FMTBIT_S16_LE
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_U16		SNDRV_PCM_FMTBIT_U16_LE
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_S24		SNDRV_PCM_FMTBIT_S24_LE
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_U24		SNDRV_PCM_FMTBIT_U24_LE
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_S32		SNDRV_PCM_FMTBIT_S32_LE
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_U32		SNDRV_PCM_FMTBIT_U32_LE
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_FLOAT		SNDRV_PCM_FMTBIT_FLOAT_LE
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_FLOAT64	SNDRV_PCM_FMTBIT_FLOAT64_LE
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef SNDRV_BIG_ENDIAN
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_S16		SNDRV_PCM_FMTBIT_S16_BE
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_U16		SNDRV_PCM_FMTBIT_U16_BE
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_S24		SNDRV_PCM_FMTBIT_S24_BE
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_U24		SNDRV_PCM_FMTBIT_U24_BE
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_S32		SNDRV_PCM_FMTBIT_S32_BE
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_U32		SNDRV_PCM_FMTBIT_U32_BE
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_FLOAT		SNDRV_PCM_FMTBIT_FLOAT_BE
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_FLOAT64	SNDRV_PCM_FMTBIT_FLOAT64_BE
 | 
					
						
							|  |  |  | #define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | struct snd_pcm_file { | 
					
						
							|  |  |  | 	struct snd_pcm_substream *substream; | 
					
						
							| 
									
										
										
										
											2006-07-31 16:51:51 +02:00
										 |  |  | 	int no_compat_mmap; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | struct snd_pcm_hw_rule; | 
					
						
							|  |  |  | typedef int (*snd_pcm_hw_rule_func_t)(struct snd_pcm_hw_params *params, | 
					
						
							|  |  |  | 				      struct snd_pcm_hw_rule *rule); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | struct snd_pcm_hw_rule { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	unsigned int cond; | 
					
						
							|  |  |  | 	snd_pcm_hw_rule_func_t func; | 
					
						
							|  |  |  | 	int var; | 
					
						
							|  |  |  | 	int deps[4]; | 
					
						
							|  |  |  | 	void *private; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | struct snd_pcm_hw_constraints { | 
					
						
							|  |  |  | 	struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -  | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 			 SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 			     SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; | 
					
						
							|  |  |  | 	unsigned int rules_num; | 
					
						
							|  |  |  | 	unsigned int rules_all; | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_pcm_hw_rule *rules; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline struct snd_mask *constrs_mask(struct snd_pcm_hw_constraints *constrs, | 
					
						
							|  |  |  | 					    snd_pcm_hw_param_t var) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | 	return &constrs->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK]; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline struct snd_interval *constrs_interval(struct snd_pcm_hw_constraints *constrs, | 
					
						
							|  |  |  | 						    snd_pcm_hw_param_t var) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | 	return &constrs->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | struct snd_ratnum { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	unsigned int num; | 
					
						
							|  |  |  | 	unsigned int den_min, den_max, den_step; | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | struct snd_ratden { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	unsigned int num_min, num_max, num_step; | 
					
						
							|  |  |  | 	unsigned int den; | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | struct snd_pcm_hw_constraint_ratnums { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	int nrats; | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_ratnum *rats; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | struct snd_pcm_hw_constraint_ratdens { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	int nrats; | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_ratden *rats; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | struct snd_pcm_hw_constraint_list { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	unsigned int count; | 
					
						
							| 
									
										
										
										
											2012-03-14 19:48:43 +00:00
										 |  |  | 	const unsigned int *list; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	unsigned int mask; | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-20 11:47:57 +01:00
										 |  |  | struct snd_pcm_hwptr_log; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | struct snd_pcm_runtime { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	/* -- Status -- */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_pcm_substream *trigger_master; | 
					
						
							| 
									
										
										
										
											2005-10-10 11:49:49 +02:00
										 |  |  | 	struct timespec trigger_tstamp;	/* trigger timestamp */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	int overrange; | 
					
						
							|  |  |  | 	snd_pcm_uframes_t avail_max; | 
					
						
							|  |  |  | 	snd_pcm_uframes_t hw_ptr_base;	/* Position at buffer restart */ | 
					
						
							| 
									
										
										
										
											2010-01-26 17:08:24 +01:00
										 |  |  | 	snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time */ | 
					
						
							| 
									
										
										
										
											2009-04-10 12:28:58 +02:00
										 |  |  | 	unsigned long hw_ptr_jiffies;	/* Time when hw_ptr is updated */ | 
					
						
							| 
									
										
										
										
											2010-08-18 14:16:54 +02:00
										 |  |  | 	unsigned long hw_ptr_buffer_jiffies; /* buffer time in jiffies */ | 
					
						
							| 
									
										
										
										
											2008-10-13 03:07:14 +02:00
										 |  |  | 	snd_pcm_sframes_t delay;	/* extra delay; typically FIFO size */ | 
					
						
							| 
									
										
										
										
											2012-10-22 16:42:14 -05:00
										 |  |  | 	u64 hw_ptr_wrap;                /* offset for hw_ptr due to boundary wrap-around */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* -- HW params -- */ | 
					
						
							|  |  |  | 	snd_pcm_access_t access;	/* access mode */ | 
					
						
							|  |  |  | 	snd_pcm_format_t format;	/* SNDRV_PCM_FORMAT_* */ | 
					
						
							|  |  |  | 	snd_pcm_subformat_t subformat;	/* subformat */ | 
					
						
							|  |  |  | 	unsigned int rate;		/* rate in Hz */ | 
					
						
							|  |  |  | 	unsigned int channels;		/* channels */ | 
					
						
							|  |  |  | 	snd_pcm_uframes_t period_size;	/* period size */ | 
					
						
							|  |  |  | 	unsigned int periods;		/* periods */ | 
					
						
							|  |  |  | 	snd_pcm_uframes_t buffer_size;	/* buffer size */ | 
					
						
							|  |  |  | 	snd_pcm_uframes_t min_align;	/* Min alignment for the format */ | 
					
						
							|  |  |  | 	size_t byte_align; | 
					
						
							|  |  |  | 	unsigned int frame_bits; | 
					
						
							|  |  |  | 	unsigned int sample_bits; | 
					
						
							|  |  |  | 	unsigned int info; | 
					
						
							|  |  |  | 	unsigned int rate_num; | 
					
						
							|  |  |  | 	unsigned int rate_den; | 
					
						
							| 
									
										
										
										
											2010-11-15 10:46:23 +01:00
										 |  |  | 	unsigned int no_period_wakeup: 1; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* -- SW params -- */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	int tstamp_mode;		/* mmap timestamp is updated */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |   	unsigned int period_step; | 
					
						
							|  |  |  | 	snd_pcm_uframes_t start_threshold; | 
					
						
							|  |  |  | 	snd_pcm_uframes_t stop_threshold; | 
					
						
							|  |  |  | 	snd_pcm_uframes_t silence_threshold; /* Silence filling happens when
 | 
					
						
							|  |  |  | 						noise is nearest than this */ | 
					
						
							|  |  |  | 	snd_pcm_uframes_t silence_size;	/* Silence filling size */ | 
					
						
							|  |  |  | 	snd_pcm_uframes_t boundary;	/* pointers wrap point */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	snd_pcm_uframes_t silence_start; /* starting pointer to silence area */ | 
					
						
							|  |  |  | 	snd_pcm_uframes_t silence_filled; /* size filled with silence */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	union snd_pcm_sync_id sync;	/* hardware synchronization ID */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* -- mmap -- */ | 
					
						
							| 
									
										
										
										
											2007-09-11 00:35:06 +02:00
										 |  |  | 	struct snd_pcm_mmap_status *status; | 
					
						
							|  |  |  | 	struct snd_pcm_mmap_control *control; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* -- locking / scheduling -- */ | 
					
						
							| 
									
										
										
										
											2010-06-27 00:13:20 +02:00
										 |  |  | 	snd_pcm_uframes_t twake; 	/* do transfer (!poll) wakeup if non-zero */ | 
					
						
							| 
									
										
										
										
											2010-01-21 10:32:15 +01:00
										 |  |  | 	wait_queue_head_t sleep;	/* poll sleep */ | 
					
						
							|  |  |  | 	wait_queue_head_t tsleep;	/* transfer sleep */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	struct fasync_struct *fasync; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* -- private section -- */ | 
					
						
							|  |  |  | 	void *private_data; | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	void (*private_free)(struct snd_pcm_runtime *runtime); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* -- hardware description -- */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_pcm_hardware hw; | 
					
						
							|  |  |  | 	struct snd_pcm_hw_constraints hw_constraints; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* -- interrupt callbacks -- */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	void (*transfer_ack_begin)(struct snd_pcm_substream *substream); | 
					
						
							|  |  |  | 	void (*transfer_ack_end)(struct snd_pcm_substream *substream); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* -- timer -- */ | 
					
						
							|  |  |  | 	unsigned int timer_resolution;	/* timer resolution */ | 
					
						
							| 
									
										
										
										
											2007-12-13 10:19:42 +01:00
										 |  |  | 	int tstamp_type;		/* timestamp type */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* -- DMA -- */            | 
					
						
							|  |  |  | 	unsigned char *dma_area;	/* DMA area */ | 
					
						
							|  |  |  | 	dma_addr_t dma_addr;		/* physical bus address (not accessible from main CPU) */ | 
					
						
							|  |  |  | 	size_t dma_bytes;		/* size of DMA area */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	struct snd_dma_buffer *dma_buffer_p;	/* allocated buffer */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
 | 
					
						
							|  |  |  | 	/* -- OSS things -- */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_pcm_oss_runtime oss; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2009-12-20 11:47:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifdef CONFIG_SND_PCM_XRUN_DEBUG
 | 
					
						
							|  |  |  | 	struct snd_pcm_hwptr_log *hwptr_log; | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | struct snd_pcm_group {		/* keep linked substreams */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	spinlock_t lock; | 
					
						
							| 
									
										
										
										
											2014-08-29 15:32:29 +02:00
										 |  |  | 	struct mutex mutex; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	struct list_head substreams; | 
					
						
							|  |  |  | 	int count; | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-10 10:13:30 +01:00
										 |  |  | struct pid; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | struct snd_pcm_substream { | 
					
						
							|  |  |  | 	struct snd_pcm *pcm; | 
					
						
							|  |  |  | 	struct snd_pcm_str *pstr; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	void *private_data;		/* copied from pcm->private_data */ | 
					
						
							|  |  |  | 	int number; | 
					
						
							|  |  |  | 	char name[32];			/* substream name */ | 
					
						
							|  |  |  | 	int stream;			/* stream (direction) */ | 
					
						
							| 
									
										
										
										
											2011-08-25 15:35:12 +02:00
										 |  |  | 	struct pm_qos_request latency_pm_qos_req; /* pm_qos request */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	size_t buffer_bytes_max;	/* limit ring buffer size */ | 
					
						
							|  |  |  | 	struct snd_dma_buffer dma_buffer; | 
					
						
							|  |  |  | 	size_t dma_max; | 
					
						
							|  |  |  | 	/* -- hardware operations -- */ | 
					
						
							| 
									
										
										
										
											2013-05-24 15:18:10 +02:00
										 |  |  | 	const struct snd_pcm_ops *ops; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	/* -- runtime information -- */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_pcm_runtime *runtime; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |         /* -- timer section -- */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_timer *timer;		/* timer */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	unsigned timer_running: 1;	/* time is running */ | 
					
						
							|  |  |  | 	/* -- next substream -- */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_pcm_substream *next; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	/* -- linked substreams -- */ | 
					
						
							|  |  |  | 	struct list_head link_list;	/* linked list member */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_pcm_group self_group;	/* fake group for non linked substream (with substream lock inside) */ | 
					
						
							|  |  |  | 	struct snd_pcm_group *group;		/* pointer to current group */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	/* -- assigned files -- */ | 
					
						
							| 
									
										
										
										
											2006-04-06 19:47:42 +02:00
										 |  |  | 	void *file; | 
					
						
							| 
									
										
										
										
											2006-04-28 15:13:41 +02:00
										 |  |  | 	int ref_count; | 
					
						
							| 
									
										
										
										
											2006-04-28 15:13:41 +02:00
										 |  |  | 	atomic_t mmap_count; | 
					
						
							| 
									
										
										
										
											2006-04-28 15:13:41 +02:00
										 |  |  | 	unsigned int f_flags; | 
					
						
							| 
									
										
										
										
											2006-03-27 16:40:49 +02:00
										 |  |  | 	void (*pcm_release)(struct snd_pcm_substream *); | 
					
						
							| 
									
										
										
										
											2009-11-10 10:13:30 +01:00
										 |  |  | 	struct pid *pid; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
 | 
					
						
							|  |  |  | 	/* -- OSS things -- */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_pcm_oss_substream oss; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2006-04-25 12:56:04 +02:00
										 |  |  | #ifdef CONFIG_SND_VERBOSE_PROCFS
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_info_entry *proc_root; | 
					
						
							|  |  |  | 	struct snd_info_entry *proc_info_entry; | 
					
						
							|  |  |  | 	struct snd_info_entry *proc_hw_params_entry; | 
					
						
							|  |  |  | 	struct snd_info_entry *proc_sw_params_entry; | 
					
						
							|  |  |  | 	struct snd_info_entry *proc_status_entry; | 
					
						
							|  |  |  | 	struct snd_info_entry *proc_prealloc_entry; | 
					
						
							| 
									
										
										
										
											2006-10-06 15:12:29 +02:00
										 |  |  | 	struct snd_info_entry *proc_prealloc_max_entry; | 
					
						
							| 
									
										
										
										
											2014-11-04 14:02:40 +01:00
										 |  |  | #ifdef CONFIG_SND_PCM_XRUN_DEBUG
 | 
					
						
							|  |  |  | 	struct snd_info_entry *proc_xrun_injection_entry; | 
					
						
							| 
									
										
										
										
											2006-04-25 12:56:04 +02:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2014-11-04 14:02:40 +01:00
										 |  |  | #endif /* CONFIG_SND_VERBOSE_PROCFS */
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	/* misc flags */ | 
					
						
							| 
									
										
										
										
											2006-03-27 16:40:49 +02:00
										 |  |  | 	unsigned int hw_opened: 1; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-04-28 15:13:41 +02:00
										 |  |  | #define SUBSTREAM_BUSY(substream) ((substream)->ref_count > 0)
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | struct snd_pcm_str { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	int stream;				/* stream (direction) */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_pcm *pcm; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	/* -- substreams -- */ | 
					
						
							|  |  |  | 	unsigned int substream_count; | 
					
						
							|  |  |  | 	unsigned int substream_opened; | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_pcm_substream *substream; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
 | 
					
						
							|  |  |  | 	/* -- OSS things -- */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_pcm_oss_stream oss; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2006-04-25 12:56:04 +02:00
										 |  |  | #ifdef CONFIG_SND_VERBOSE_PROCFS
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_info_entry *proc_root; | 
					
						
							|  |  |  | 	struct snd_info_entry *proc_info_entry; | 
					
						
							| 
									
										
										
										
											2006-04-25 12:56:04 +02:00
										 |  |  | #ifdef CONFIG_SND_PCM_XRUN_DEBUG
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	unsigned int xrun_debug;	/* 0 = disabled, 1 = verbose, 2 = stacktrace */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_info_entry *proc_xrun_debug_entry; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2006-04-25 12:56:04 +02:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2012-07-27 18:27:00 +02:00
										 |  |  | 	struct snd_kcontrol *chmap_kctl; /* channel-mapping controls */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | struct snd_pcm { | 
					
						
							|  |  |  | 	struct snd_card *card; | 
					
						
							| 
									
										
										
										
											2005-11-20 14:06:59 +01:00
										 |  |  | 	struct list_head list; | 
					
						
							| 
									
										
										
										
											2008-07-30 12:46:40 +01:00
										 |  |  | 	int device; /* device number */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	unsigned int info_flags; | 
					
						
							|  |  |  | 	unsigned short dev_class; | 
					
						
							|  |  |  | 	unsigned short dev_subclass; | 
					
						
							|  |  |  | 	char id[64]; | 
					
						
							|  |  |  | 	char name[80]; | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_pcm_str streams[2]; | 
					
						
							| 
									
										
										
										
											2006-01-16 16:29:08 +01:00
										 |  |  | 	struct mutex open_mutex; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	wait_queue_head_t open_wait; | 
					
						
							|  |  |  | 	void *private_data; | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	void (*private_free) (struct snd_pcm *pcm); | 
					
						
							| 
									
										
										
										
											2006-10-05 15:06:34 +02:00
										 |  |  | 	struct device *dev; /* actual hw device this belongs to */ | 
					
						
							| 
									
										
										
										
											2012-02-08 20:33:31 +00:00
										 |  |  | 	bool internal; /* pcm is for internal use only */ | 
					
						
							| 
									
										
										
										
											2014-08-29 15:32:29 +02:00
										 |  |  | 	bool nonatomic; /* whole PCM operations are in non-atomic context */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_pcm_oss oss; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | struct snd_pcm_notify { | 
					
						
							|  |  |  | 	int (*n_register) (struct snd_pcm * pcm); | 
					
						
							|  |  |  | 	int (*n_disconnect) (struct snd_pcm * pcm); | 
					
						
							|  |  |  | 	int (*n_unregister) (struct snd_pcm * pcm); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	struct list_head list; | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  *  Registering | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-02-12 00:55:28 -08:00
										 |  |  | extern const struct file_operations snd_pcm_f_ops[2]; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-05 13:01:54 +01:00
										 |  |  | int snd_pcm_new(struct snd_card *card, const char *id, int device, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 		int playback_count, int capture_count, | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 		struct snd_pcm **rpcm); | 
					
						
							| 
									
										
										
										
											2012-02-08 20:33:31 +00:00
										 |  |  | int snd_pcm_new_internal(struct snd_card *card, const char *id, int device, | 
					
						
							|  |  |  | 		int playback_count, int capture_count, | 
					
						
							|  |  |  | 		struct snd_pcm **rpcm); | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  *  Native I/O | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_pcm_info(struct snd_pcm_substream *substream, struct snd_pcm_info *info); | 
					
						
							|  |  |  | int snd_pcm_info_user(struct snd_pcm_substream *substream, | 
					
						
							|  |  |  | 		      struct snd_pcm_info __user *info); | 
					
						
							|  |  |  | int snd_pcm_status(struct snd_pcm_substream *substream, | 
					
						
							|  |  |  | 		   struct snd_pcm_status *status); | 
					
						
							|  |  |  | int snd_pcm_start(struct snd_pcm_substream *substream); | 
					
						
							| 
									
										
										
										
											2011-02-14 11:00:47 +01:00
										 |  |  | int snd_pcm_stop(struct snd_pcm_substream *substream, snd_pcm_state_t status); | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_pcm_drain_done(struct snd_pcm_substream *substream); | 
					
						
							| 
									
										
										
										
											2014-11-07 17:08:28 +01:00
										 |  |  | int snd_pcm_stop_xrun(struct snd_pcm_substream *substream); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #ifdef CONFIG_PM
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_pcm_suspend(struct snd_pcm_substream *substream); | 
					
						
							|  |  |  | int snd_pcm_suspend_all(struct snd_pcm *pcm); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg); | 
					
						
							| 
									
										
										
										
											2006-03-27 16:40:49 +02:00
										 |  |  | int snd_pcm_open_substream(struct snd_pcm *pcm, int stream, struct file *file, | 
					
						
							|  |  |  | 			   struct snd_pcm_substream **rsubstream); | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | void snd_pcm_release_substream(struct snd_pcm_substream *substream); | 
					
						
							| 
									
										
										
										
											2006-03-27 16:40:49 +02:00
										 |  |  | int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream, struct file *file, | 
					
						
							|  |  |  | 			     struct snd_pcm_substream **rsubstream); | 
					
						
							|  |  |  | void snd_pcm_detach_substream(struct snd_pcm_substream *substream); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | void snd_pcm_vma_notify_data(void *client, void *data); | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-23 12:36:25 +12:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifdef CONFIG_SND_DEBUG
 | 
					
						
							|  |  |  | void snd_pcm_debug_name(struct snd_pcm_substream *substream, | 
					
						
							|  |  |  | 			   char *name, size_t len); | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | static inline void | 
					
						
							|  |  |  | snd_pcm_debug_name(struct snd_pcm_substream *substream, char *buf, size_t size) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	*buf = 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  *  PCM library | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_stream_linked - Check whether the substream is linked with others | 
					
						
							|  |  |  |  * @substream: substream to check | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Returns true if the given substream is being linked with others. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline int snd_pcm_stream_linked(struct snd_pcm_substream *substream) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | 	return substream->group != &substream->self_group; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-01 11:19:37 +02:00
										 |  |  | void snd_pcm_stream_lock(struct snd_pcm_substream *substream); | 
					
						
							|  |  |  | void snd_pcm_stream_unlock(struct snd_pcm_substream *substream); | 
					
						
							|  |  |  | void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream); | 
					
						
							|  |  |  | void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream); | 
					
						
							|  |  |  | unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream); | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_stream_lock_irqsave - Lock the PCM stream | 
					
						
							|  |  |  |  * @substream: PCM substream | 
					
						
							|  |  |  |  * @flags: irq flags | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This locks the PCM stream like snd_pcm_stream_lock() but with the local | 
					
						
							|  |  |  |  * IRQ (only when nonatomic is false).  In nonatomic case, this is identical | 
					
						
							|  |  |  |  * as snd_pcm_stream_lock(). | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2014-09-01 11:19:37 +02:00
										 |  |  | #define snd_pcm_stream_lock_irqsave(substream, flags)		 \
 | 
					
						
							|  |  |  | 	do {							 \ | 
					
						
							|  |  |  | 		typecheck(unsigned long, flags);		 \ | 
					
						
							|  |  |  | 		flags = _snd_pcm_stream_lock_irqsave(substream); \ | 
					
						
							|  |  |  | 	} while (0) | 
					
						
							|  |  |  | void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream, | 
					
						
							|  |  |  | 				      unsigned long flags); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_group_for_each_entry - iterate over the linked substreams | 
					
						
							|  |  |  |  * @s: the iterator | 
					
						
							|  |  |  |  * @substream: the substream | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Iterate over the all linked substreams to the given @substream. | 
					
						
							|  |  |  |  * When @substream isn't linked with any others, this gives returns @substream | 
					
						
							|  |  |  |  * itself once. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2007-02-22 12:52:53 +01:00
										 |  |  | #define snd_pcm_group_for_each_entry(s, substream) \
 | 
					
						
							|  |  |  | 	list_for_each_entry(s, &substream->group->substreams, link_list) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_running - Check whether the substream is in a running state | 
					
						
							|  |  |  |  * @substream: substream to check | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Returns true if the given substream is in the state RUNNING, or in the | 
					
						
							|  |  |  |  * state DRAINING for playback. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline int snd_pcm_running(struct snd_pcm_substream *substream) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | 	return (substream->runtime->status->state == SNDRV_PCM_STATE_RUNNING || | 
					
						
							|  |  |  | 		(substream->runtime->status->state == SNDRV_PCM_STATE_DRAINING && | 
					
						
							|  |  |  | 		 substream->stream == SNDRV_PCM_STREAM_PLAYBACK)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * bytes_to_samples - Unit conversion of the size from bytes to samples | 
					
						
							|  |  |  |  * @runtime: PCM runtime instance | 
					
						
							|  |  |  |  * @size: size in bytes | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline ssize_t bytes_to_samples(struct snd_pcm_runtime *runtime, ssize_t size) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | 	return size * 8 / runtime->sample_bits; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * bytes_to_frames - Unit conversion of the size from bytes to frames | 
					
						
							|  |  |  |  * @runtime: PCM runtime instance | 
					
						
							|  |  |  |  * @size: size in bytes | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline snd_pcm_sframes_t bytes_to_frames(struct snd_pcm_runtime *runtime, ssize_t size) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | 	return size * 8 / runtime->frame_bits; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * samples_to_bytes - Unit conversion of the size from samples to bytes | 
					
						
							|  |  |  |  * @runtime: PCM runtime instance | 
					
						
							|  |  |  |  * @size: size in samples | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline ssize_t samples_to_bytes(struct snd_pcm_runtime *runtime, ssize_t size) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | 	return size * runtime->sample_bits / 8; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * frames_to_bytes - Unit conversion of the size from frames to bytes | 
					
						
							|  |  |  |  * @runtime: PCM runtime instance | 
					
						
							|  |  |  |  * @size: size in frames | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline ssize_t frames_to_bytes(struct snd_pcm_runtime *runtime, snd_pcm_sframes_t size) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | 	return size * runtime->frame_bits / 8; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * frame_aligned - Check whether the byte size is aligned to frames | 
					
						
							|  |  |  |  * @runtime: PCM runtime instance | 
					
						
							|  |  |  |  * @bytes: size in bytes | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline int frame_aligned(struct snd_pcm_runtime *runtime, ssize_t bytes) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | 	return bytes % runtime->byte_align == 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_lib_buffer_bytes - Get the buffer size of the current PCM in bytes | 
					
						
							|  |  |  |  * @substream: PCM substream | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline size_t snd_pcm_lib_buffer_bytes(struct snd_pcm_substream *substream) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_pcm_runtime *runtime = substream->runtime; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	return frames_to_bytes(runtime, runtime->buffer_size); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_lib_period_bytes - Get the period size of the current PCM in bytes | 
					
						
							|  |  |  |  * @substream: PCM substream | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline size_t snd_pcm_lib_period_bytes(struct snd_pcm_substream *substream) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_pcm_runtime *runtime = substream->runtime; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	return frames_to_bytes(runtime, runtime->period_size); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_playback_avail - Get the available (writable) space for playback | 
					
						
							|  |  |  |  * @runtime: PCM runtime instance | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Result is between 0 ... (boundary - 1) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline snd_pcm_uframes_t snd_pcm_playback_avail(struct snd_pcm_runtime *runtime) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | 	snd_pcm_sframes_t avail = runtime->status->hw_ptr + runtime->buffer_size - runtime->control->appl_ptr; | 
					
						
							|  |  |  | 	if (avail < 0) | 
					
						
							|  |  |  | 		avail += runtime->boundary; | 
					
						
							|  |  |  | 	else if ((snd_pcm_uframes_t) avail >= runtime->boundary) | 
					
						
							|  |  |  | 		avail -= runtime->boundary; | 
					
						
							|  |  |  | 	return avail; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_playback_avail - Get the available (readable) space for capture | 
					
						
							|  |  |  |  * @runtime: PCM runtime instance | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Result is between 0 ... (boundary - 1) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline snd_pcm_uframes_t snd_pcm_capture_avail(struct snd_pcm_runtime *runtime) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | 	snd_pcm_sframes_t avail = runtime->status->hw_ptr - runtime->control->appl_ptr; | 
					
						
							|  |  |  | 	if (avail < 0) | 
					
						
							|  |  |  | 		avail += runtime->boundary; | 
					
						
							|  |  |  | 	return avail; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_playback_hw_avail - Get the queued space for playback | 
					
						
							|  |  |  |  * @runtime: PCM runtime instance | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline snd_pcm_sframes_t snd_pcm_playback_hw_avail(struct snd_pcm_runtime *runtime) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | 	return runtime->buffer_size - snd_pcm_playback_avail(runtime); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_capture_hw_avail - Get the free space for capture | 
					
						
							|  |  |  |  * @runtime: PCM runtime instance | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(struct snd_pcm_runtime *runtime) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | 	return runtime->buffer_size - snd_pcm_capture_avail(runtime); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_playback_ready - check whether the playback buffer is available | 
					
						
							|  |  |  |  * @substream: the pcm substream instance | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Checks whether enough free space is available on the playback buffer. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2013-03-11 22:05:14 +01:00
										 |  |  |  * Return: Non-zero if available, or zero if not. | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline int snd_pcm_playback_ready(struct snd_pcm_substream *substream) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_pcm_runtime *runtime = substream->runtime; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	return snd_pcm_playback_avail(runtime) >= runtime->control->avail_min; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_capture_ready - check whether the capture buffer is available | 
					
						
							|  |  |  |  * @substream: the pcm substream instance | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Checks whether enough capture data is available on the capture buffer. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2013-03-11 22:05:14 +01:00
										 |  |  |  * Return: Non-zero if available, or zero if not. | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline int snd_pcm_capture_ready(struct snd_pcm_substream *substream) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_pcm_runtime *runtime = substream->runtime; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	return snd_pcm_capture_avail(runtime) >= runtime->control->avail_min; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_playback_data - check whether any data exists on the playback buffer | 
					
						
							|  |  |  |  * @substream: the pcm substream instance | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2013-03-11 22:05:14 +01:00
										 |  |  |  * Checks whether any data exists on the playback buffer. | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2013-03-11 22:05:14 +01:00
										 |  |  |  * Return: Non-zero if any data exists, or zero if not. If stop_threshold | 
					
						
							|  |  |  |  * is bigger or equal to boundary, then this function returns always non-zero. | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline int snd_pcm_playback_data(struct snd_pcm_substream *substream) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_pcm_runtime *runtime = substream->runtime; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	if (runtime->stop_threshold >= runtime->boundary) | 
					
						
							|  |  |  | 		return 1; | 
					
						
							|  |  |  | 	return snd_pcm_playback_avail(runtime) < runtime->buffer_size; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_playback_empty - check whether the playback buffer is empty | 
					
						
							|  |  |  |  * @substream: the pcm substream instance | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Checks whether the playback buffer is empty. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2013-03-11 22:05:14 +01:00
										 |  |  |  * Return: Non-zero if empty, or zero if not. | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline int snd_pcm_playback_empty(struct snd_pcm_substream *substream) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_pcm_runtime *runtime = substream->runtime; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	return snd_pcm_playback_avail(runtime) >= runtime->buffer_size; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_capture_empty - check whether the capture buffer is empty | 
					
						
							|  |  |  |  * @substream: the pcm substream instance | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Checks whether the capture buffer is empty. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2013-03-11 22:05:14 +01:00
										 |  |  |  * Return: Non-zero if empty, or zero if not. | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline int snd_pcm_capture_empty(struct snd_pcm_substream *substream) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_pcm_runtime *runtime = substream->runtime; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	return snd_pcm_capture_avail(runtime) == 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_trigger_done - Mark the master substream | 
					
						
							|  |  |  |  * @substream: the pcm substream instance | 
					
						
							|  |  |  |  * @master: the linked master substream | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * When multiple substreams of the same card are linked and the hardware | 
					
						
							|  |  |  |  * supports the single-shot operation, the driver calls this in the loop | 
					
						
							|  |  |  |  * in snd_pcm_group_for_each_entry() for marking the substream as "done". | 
					
						
							|  |  |  |  * Then most of trigger operations are performed only to the given master | 
					
						
							|  |  |  |  * substream. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * The trigger_master mark is cleared at timestamp updates at the end | 
					
						
							|  |  |  |  * of trigger operations. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline void snd_pcm_trigger_done(struct snd_pcm_substream *substream,  | 
					
						
							|  |  |  | 					struct snd_pcm_substream *master) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | 	substream->runtime->trigger_master = master; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static inline int hw_is_mask(int var) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return var >= SNDRV_PCM_HW_PARAM_FIRST_MASK && | 
					
						
							|  |  |  | 		var <= SNDRV_PCM_HW_PARAM_LAST_MASK; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static inline int hw_is_interval(int var) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return var >= SNDRV_PCM_HW_PARAM_FIRST_INTERVAL && | 
					
						
							|  |  |  | 		var <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline struct snd_mask *hw_param_mask(struct snd_pcm_hw_params *params, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 				     snd_pcm_hw_param_t var) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return ¶ms->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK]; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline struct snd_interval *hw_param_interval(struct snd_pcm_hw_params *params, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 					     snd_pcm_hw_param_t var) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return ¶ms->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline const struct snd_mask *hw_param_mask_c(const struct snd_pcm_hw_params *params, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 					     snd_pcm_hw_param_t var) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-09-11 00:33:48 +02:00
										 |  |  | 	return ¶ms->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK]; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline const struct snd_interval *hw_param_interval_c(const struct snd_pcm_hw_params *params, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 						     snd_pcm_hw_param_t var) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-09-11 00:33:48 +02:00
										 |  |  | 	return ¶ms->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:06:13 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * params_channels - Get the number of channels from the hw params | 
					
						
							|  |  |  |  * @p: hw params | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static inline unsigned int params_channels(const struct snd_pcm_hw_params *p) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_CHANNELS)->min; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2014-12-29 19:41:40 +01:00
										 |  |  |  * params_rate - Get the sample rate from the hw params | 
					
						
							| 
									
										
										
										
											2014-10-30 15:06:13 +01:00
										 |  |  |  * @p: hw params | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static inline unsigned int params_rate(const struct snd_pcm_hw_params *p) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_RATE)->min; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2014-12-29 19:41:40 +01:00
										 |  |  |  * params_period_size - Get the period size (in frames) from the hw params | 
					
						
							| 
									
										
										
										
											2014-10-30 15:06:13 +01:00
										 |  |  |  * @p: hw params | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static inline unsigned int params_period_size(const struct snd_pcm_hw_params *p) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_PERIOD_SIZE)->min; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2014-12-29 19:41:40 +01:00
										 |  |  |  * params_periods - Get the number of periods from the hw params | 
					
						
							| 
									
										
										
										
											2014-10-30 15:06:13 +01:00
										 |  |  |  * @p: hw params | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static inline unsigned int params_periods(const struct snd_pcm_hw_params *p) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_PERIODS)->min; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2014-12-29 19:41:40 +01:00
										 |  |  |  * params_buffer_size - Get the buffer size (in frames) from the hw params | 
					
						
							| 
									
										
										
										
											2014-10-30 15:06:13 +01:00
										 |  |  |  * @p: hw params | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static inline unsigned int params_buffer_size(const struct snd_pcm_hw_params *p) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_BUFFER_SIZE)->min; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2014-12-29 19:41:40 +01:00
										 |  |  |  * params_buffer_bytes - Get the buffer size (in bytes) from the hw params | 
					
						
							| 
									
										
										
										
											2014-10-30 15:06:13 +01:00
										 |  |  |  * @p: hw params | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static inline unsigned int params_buffer_bytes(const struct snd_pcm_hw_params *p) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_BUFFER_BYTES)->min; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v); | 
					
						
							|  |  |  | void snd_interval_mul(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c); | 
					
						
							|  |  |  | void snd_interval_div(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c); | 
					
						
							|  |  |  | void snd_interval_muldivk(const struct snd_interval *a, const struct snd_interval *b,  | 
					
						
							|  |  |  | 			  unsigned int k, struct snd_interval *c); | 
					
						
							|  |  |  | void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k, | 
					
						
							|  |  |  | 			  const struct snd_interval *b, struct snd_interval *c); | 
					
						
							| 
									
										
										
										
											2012-03-14 19:48:43 +00:00
										 |  |  | int snd_interval_list(struct snd_interval *i, unsigned int count, | 
					
						
							|  |  |  | 		      const unsigned int *list, unsigned int mask); | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_interval_ratnum(struct snd_interval *i, | 
					
						
							|  |  |  | 			unsigned int rats_count, struct snd_ratnum *rats, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 			unsigned int *nump, unsigned int *denp); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | void _snd_pcm_hw_params_any(struct snd_pcm_hw_params *params); | 
					
						
							|  |  |  | void _snd_pcm_hw_param_setempty(struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var); | 
					
						
							|  |  |  | int snd_pcm_hw_params_choose(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_pcm_hw_refine(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream); | 
					
						
							|  |  |  | int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_pcm_hw_constraint_mask(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 			       u_int32_t mask); | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 				 u_int64_t mask); | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_pcm_hw_constraint_minmax(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 				 unsigned int min, unsigned int max); | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_pcm_hw_constraint_integer(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var); | 
					
						
							|  |  |  | int snd_pcm_hw_constraint_list(struct snd_pcm_runtime *runtime,  | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 			       unsigned int cond, | 
					
						
							|  |  |  | 			       snd_pcm_hw_param_t var, | 
					
						
							| 
									
										
										
										
											2012-07-05 12:15:01 +01:00
										 |  |  | 			       const struct snd_pcm_hw_constraint_list *l); | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_pcm_hw_constraint_ratnums(struct snd_pcm_runtime *runtime,  | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 				  unsigned int cond, | 
					
						
							|  |  |  | 				  snd_pcm_hw_param_t var, | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 				  struct snd_pcm_hw_constraint_ratnums *r); | 
					
						
							|  |  |  | int snd_pcm_hw_constraint_ratdens(struct snd_pcm_runtime *runtime,  | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 				  unsigned int cond, | 
					
						
							|  |  |  | 				  snd_pcm_hw_param_t var, | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 				  struct snd_pcm_hw_constraint_ratdens *r); | 
					
						
							|  |  |  | int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime,  | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 				 unsigned int cond, | 
					
						
							|  |  |  | 				 unsigned int width, | 
					
						
							|  |  |  | 				 unsigned int msbits); | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_pcm_hw_constraint_step(struct snd_pcm_runtime *runtime, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 			       unsigned int cond, | 
					
						
							|  |  |  | 			       snd_pcm_hw_param_t var, | 
					
						
							|  |  |  | 			       unsigned long step); | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_pcm_hw_constraint_pow2(struct snd_pcm_runtime *runtime, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 			       unsigned int cond, | 
					
						
							|  |  |  | 			       snd_pcm_hw_param_t var); | 
					
						
							| 
									
										
										
										
											2011-09-16 23:03:02 +02:00
										 |  |  | int snd_pcm_hw_rule_noresample(struct snd_pcm_runtime *runtime, | 
					
						
							|  |  |  | 			       unsigned int base_rate); | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 			unsigned int cond, | 
					
						
							|  |  |  | 			int var, | 
					
						
							|  |  |  | 			snd_pcm_hw_rule_func_t func, void *private, | 
					
						
							|  |  |  | 			int dep, ...); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int snd_pcm_format_signed(snd_pcm_format_t format); | 
					
						
							|  |  |  | int snd_pcm_format_unsigned(snd_pcm_format_t format); | 
					
						
							|  |  |  | int snd_pcm_format_linear(snd_pcm_format_t format); | 
					
						
							|  |  |  | int snd_pcm_format_little_endian(snd_pcm_format_t format); | 
					
						
							|  |  |  | int snd_pcm_format_big_endian(snd_pcm_format_t format); | 
					
						
							| 
									
										
										
										
											2005-09-09 15:05:33 +02:00
										 |  |  | #if 0 /* just for DocBook */
 | 
					
						
							|  |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2005-05-18 16:25:46 +02:00
										 |  |  |  * snd_pcm_format_cpu_endian - Check the PCM format is CPU-endian | 
					
						
							|  |  |  |  * @format: the format to check | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2013-03-11 22:05:14 +01:00
										 |  |  |  * Return: 1 if the given PCM format is CPU-endian, 0 if | 
					
						
							| 
									
										
										
										
											2005-05-18 16:25:46 +02:00
										 |  |  |  * opposite, or a negative error code if endian not specified. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
											
												[ALSA] Remove superfluous PCI ID definitions
CS46xx driver,EMU10K1/EMU10K2 driver,PCM Midlevel,Trident driver
YMFPCI driver,BT87x driver,CMIPCI driver,CS4281 driver
ENS1370/1+ driver,ES1938 driver,ES1968 driver,Intel8x0 driver
Intel8x0-modem driver,Maestro3 driver,RME32 driver,RME96 driver
SonicVibes driver,VIA82xx driver,ALI5451 driver,ICE1712 driver
ICE1724 driver,NM256 driver,RME HDSP driver,RME9652 driver
Remove superfluous PCI ID definitions.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
											
										 
											2005-09-07 14:08:11 +02:00
										 |  |  | int snd_pcm_format_cpu_endian(snd_pcm_format_t format); | 
					
						
							| 
									
										
										
										
											2005-09-09 15:05:33 +02:00
										 |  |  | #endif /* DocBook */
 | 
					
						
							| 
									
										
										
										
											2005-05-18 16:25:46 +02:00
										 |  |  | #ifdef SNDRV_LITTLE_ENDIAN
 | 
					
						
							| 
									
										
										
										
											2005-09-09 13:10:17 -07:00
										 |  |  | #define snd_pcm_format_cpu_endian(format) snd_pcm_format_little_endian(format)
 | 
					
						
							| 
									
										
										
										
											2005-05-18 16:25:46 +02:00
										 |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2005-09-09 13:10:17 -07:00
										 |  |  | #define snd_pcm_format_cpu_endian(format) snd_pcm_format_big_endian(format)
 | 
					
						
							| 
									
										
										
										
											2005-05-18 16:25:46 +02:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | int snd_pcm_format_width(snd_pcm_format_t format);			/* in bits */ | 
					
						
							|  |  |  | int snd_pcm_format_physical_width(snd_pcm_format_t format);		/* in bits */ | 
					
						
							| 
									
										
										
										
											2005-05-18 16:25:46 +02:00
										 |  |  | ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | const unsigned char *snd_pcm_format_silence_64(snd_pcm_format_t format); | 
					
						
							|  |  |  | int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int frames); | 
					
						
							| 
									
										
										
										
											2013-04-18 00:12:55 +09:00
										 |  |  | snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsigned, int big_endian); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-24 15:18:10 +02:00
										 |  |  | void snd_pcm_set_ops(struct snd_pcm * pcm, int direction, | 
					
						
							|  |  |  | 		     const struct snd_pcm_ops *ops); | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | void snd_pcm_set_sync(struct snd_pcm_substream *substream); | 
					
						
							|  |  |  | int snd_pcm_lib_interleave_len(struct snd_pcm_substream *substream); | 
					
						
							|  |  |  | int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 		      unsigned int cmd, void *arg);                       | 
					
						
							| 
									
										
										
										
											2010-01-07 15:36:31 +01:00
										 |  |  | int snd_pcm_update_state(struct snd_pcm_substream *substream, | 
					
						
							|  |  |  | 			 struct snd_pcm_runtime *runtime); | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream); | 
					
						
							|  |  |  | int snd_pcm_playback_xrun_check(struct snd_pcm_substream *substream); | 
					
						
							|  |  |  | int snd_pcm_capture_xrun_check(struct snd_pcm_substream *substream); | 
					
						
							|  |  |  | int snd_pcm_playback_xrun_asap(struct snd_pcm_substream *substream); | 
					
						
							|  |  |  | int snd_pcm_capture_xrun_asap(struct snd_pcm_substream *substream); | 
					
						
							|  |  |  | void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_uframes_t new_hw_ptr); | 
					
						
							|  |  |  | void snd_pcm_period_elapsed(struct snd_pcm_substream *substream); | 
					
						
							|  |  |  | snd_pcm_sframes_t snd_pcm_lib_write(struct snd_pcm_substream *substream, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 				    const void __user *buf, | 
					
						
							|  |  |  | 				    snd_pcm_uframes_t frames); | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | snd_pcm_sframes_t snd_pcm_lib_read(struct snd_pcm_substream *substream, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 				   void __user *buf, snd_pcm_uframes_t frames); | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | snd_pcm_sframes_t snd_pcm_lib_writev(struct snd_pcm_substream *substream, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 				     void __user **bufs, snd_pcm_uframes_t frames); | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | snd_pcm_sframes_t snd_pcm_lib_readv(struct snd_pcm_substream *substream, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 				    void __user **bufs, snd_pcm_uframes_t frames); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-08-13 17:38:54 +02:00
										 |  |  | extern const struct snd_pcm_hw_constraint_list snd_pcm_known_rates; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime); | 
					
						
							| 
									
										
										
										
											2007-08-13 17:40:54 +02:00
										 |  |  | unsigned int snd_pcm_rate_to_rate_bit(unsigned int rate); | 
					
						
							| 
									
										
										
										
											2012-06-15 16:35:28 +01:00
										 |  |  | unsigned int snd_pcm_rate_bit_to_rate(unsigned int rate_bit); | 
					
						
							| 
									
										
										
										
											2014-01-11 10:24:43 +01:00
										 |  |  | unsigned int snd_pcm_rate_mask_intersect(unsigned int rates_a, | 
					
						
							|  |  |  | 					 unsigned int rates_b); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_set_runtime_buffer - Set the PCM runtime buffer | 
					
						
							|  |  |  |  * @substream: PCM substream to set | 
					
						
							|  |  |  |  * @bufp: the buffer information, NULL to clear | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copy the buffer information to runtime->dma_buffer when @bufp is non-NULL. | 
					
						
							|  |  |  |  * Otherwise it clears the current buffer information. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | static inline void snd_pcm_set_runtime_buffer(struct snd_pcm_substream *substream, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 					      struct snd_dma_buffer *bufp) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_pcm_runtime *runtime = substream->runtime; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	if (bufp) { | 
					
						
							|  |  |  | 		runtime->dma_buffer_p = bufp; | 
					
						
							|  |  |  | 		runtime->dma_area = bufp->area; | 
					
						
							|  |  |  | 		runtime->dma_addr = bufp->addr; | 
					
						
							|  |  |  | 		runtime->dma_bytes = bufp->bytes; | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		runtime->dma_buffer_p = NULL; | 
					
						
							|  |  |  | 		runtime->dma_area = NULL; | 
					
						
							|  |  |  | 		runtime->dma_addr = 0; | 
					
						
							|  |  |  | 		runtime->dma_bytes = 0; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  *  Timer interface | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream); | 
					
						
							|  |  |  | void snd_pcm_timer_init(struct snd_pcm_substream *substream); | 
					
						
							|  |  |  | void snd_pcm_timer_done(struct snd_pcm_substream *substream); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_gettime - Fill the timespec depending on the timestamp mode | 
					
						
							|  |  |  |  * @runtime: PCM runtime instance | 
					
						
							|  |  |  |  * @tv: timespec to fill | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2007-12-13 10:19:42 +01:00
										 |  |  | static inline void snd_pcm_gettime(struct snd_pcm_runtime *runtime, | 
					
						
							|  |  |  | 				   struct timespec *tv) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2014-07-08 16:51:49 +02:00
										 |  |  | 	switch (runtime->tstamp_type) { | 
					
						
							|  |  |  | 	case SNDRV_PCM_TSTAMP_TYPE_MONOTONIC: | 
					
						
							| 
									
										
										
										
											2014-06-11 23:59:14 +00:00
										 |  |  | 		ktime_get_ts(tv); | 
					
						
							| 
									
										
										
										
											2014-07-08 16:51:49 +02:00
										 |  |  | 		break; | 
					
						
							|  |  |  | 	case SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW: | 
					
						
							|  |  |  | 		getrawmonotonic(tv); | 
					
						
							|  |  |  | 		break; | 
					
						
							|  |  |  | 	default: | 
					
						
							| 
									
										
										
										
											2007-12-13 10:19:42 +01:00
										 |  |  | 		getnstimeofday(tv); | 
					
						
							| 
									
										
										
										
											2014-07-08 16:51:49 +02:00
										 |  |  | 		break; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2007-12-13 10:19:42 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  *  Memory | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream); | 
					
						
							|  |  |  | int snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm); | 
					
						
							|  |  |  | int snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 				  int type, struct device *data, | 
					
						
							|  |  |  | 				  size_t size, size_t max); | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 					  int type, void *data, | 
					
						
							|  |  |  | 					  size_t size, size_t max); | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size); | 
					
						
							|  |  |  | int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-18 09:29:00 +01:00
										 |  |  | int _snd_pcm_lib_alloc_vmalloc_buffer(struct snd_pcm_substream *substream, | 
					
						
							|  |  |  | 				      size_t size, gfp_t gfp_flags); | 
					
						
							|  |  |  | int snd_pcm_lib_free_vmalloc_buffer(struct snd_pcm_substream *substream); | 
					
						
							|  |  |  | struct page *snd_pcm_lib_get_vmalloc_page(struct snd_pcm_substream *substream, | 
					
						
							|  |  |  | 					  unsigned long offset); | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_lib_alloc_vmalloc_buffer - allocate virtual DMA buffer | 
					
						
							|  |  |  |  * @substream: the substream to allocate the buffer to | 
					
						
							|  |  |  |  * @size: the requested buffer size, in bytes | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Allocates the PCM substream buffer using vmalloc(), i.e., the memory is | 
					
						
							|  |  |  |  * contiguous in kernel virtual space, but not in physical memory.  Use this | 
					
						
							|  |  |  |  * if the buffer is accessed by kernel code but not by device DMA. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2013-03-11 22:05:14 +01:00
										 |  |  |  * Return: 1 if the buffer was changed, 0 if not changed, or a negative error | 
					
						
							| 
									
										
										
										
											2009-12-18 09:29:00 +01:00
										 |  |  |  * code. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2014-10-30 13:45:58 +01:00
										 |  |  | static inline int snd_pcm_lib_alloc_vmalloc_buffer | 
					
						
							|  |  |  | 			(struct snd_pcm_substream *substream, size_t size) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return _snd_pcm_lib_alloc_vmalloc_buffer(substream, size, | 
					
						
							|  |  |  | 						 GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-18 09:29:00 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_lib_alloc_vmalloc_32_buffer - allocate 32-bit-addressable buffer | 
					
						
							|  |  |  |  * @substream: the substream to allocate the buffer to | 
					
						
							|  |  |  |  * @size: the requested buffer size, in bytes | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This function works like snd_pcm_lib_alloc_vmalloc_buffer(), but uses | 
					
						
							|  |  |  |  * vmalloc_32(), i.e., the pages are allocated from 32-bit-addressable memory. | 
					
						
							| 
									
										
										
										
											2013-03-11 22:05:14 +01:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Return: 1 if the buffer was changed, 0 if not changed, or a negative error | 
					
						
							|  |  |  |  * code. | 
					
						
							| 
									
										
										
										
											2009-12-18 09:29:00 +01:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2014-10-30 13:45:58 +01:00
										 |  |  | static inline int snd_pcm_lib_alloc_vmalloc_32_buffer | 
					
						
							|  |  |  | 			(struct snd_pcm_substream *substream, size_t size) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return _snd_pcm_lib_alloc_vmalloc_buffer(substream, size, | 
					
						
							|  |  |  | 						 GFP_KERNEL | GFP_DMA32 | __GFP_ZERO); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2009-12-18 09:29:00 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-20 20:29:12 -07:00
										 |  |  | #define snd_pcm_get_dma_buf(substream) ((substream)->runtime->dma_buffer_p)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-17 16:39:06 +02:00
										 |  |  | #ifdef CONFIG_SND_DMA_SGBUF
 | 
					
						
							| 
									
										
										
										
											2008-08-21 13:00:13 +02:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * SG-buffer handling | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | #define snd_pcm_substream_sgbuf(substream) \
 | 
					
						
							| 
									
										
										
										
											2012-09-20 20:29:12 -07:00
										 |  |  | 	snd_pcm_get_dma_buf(substream)->private_data | 
					
						
							| 
									
										
										
										
											2008-08-21 13:00:13 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, | 
					
						
							|  |  |  | 				    unsigned long offset); | 
					
						
							| 
									
										
										
										
											2008-06-17 16:39:06 +02:00
										 |  |  | #else /* !SND_DMA_SGBUF */
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * fake using a continuous buffer | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2012-09-20 20:29:12 -07:00
										 |  |  | #define snd_pcm_sgbuf_ops_page	NULL
 | 
					
						
							|  |  |  | #endif /* SND_DMA_SGBUF */
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_sgbuf_get_addr - Get the DMA address at the corresponding offset | 
					
						
							|  |  |  |  * @substream: PCM substream | 
					
						
							|  |  |  |  * @ofs: byte offset | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2008-06-17 16:39:06 +02:00
										 |  |  | static inline dma_addr_t | 
					
						
							|  |  |  | snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2012-09-20 20:29:12 -07:00
										 |  |  | 	return snd_sgbuf_get_addr(snd_pcm_get_dma_buf(substream), ofs); | 
					
						
							| 
									
										
										
										
											2008-06-17 16:39:06 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_sgbuf_get_ptr - Get the virtual address at the corresponding offset | 
					
						
							|  |  |  |  * @substream: PCM substream | 
					
						
							|  |  |  |  * @ofs: byte offset | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2008-06-17 16:39:06 +02:00
										 |  |  | static inline void * | 
					
						
							|  |  |  | snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2012-09-20 20:29:12 -07:00
										 |  |  | 	return snd_sgbuf_get_ptr(snd_pcm_get_dma_buf(substream), ofs); | 
					
						
							| 
									
										
										
										
											2008-06-17 16:39:06 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_sgbuf_chunk_size - Compute the max size that fits within the contig. | 
					
						
							|  |  |  |  * page from the given size | 
					
						
							|  |  |  |  * @substream: PCM substream | 
					
						
							|  |  |  |  * @ofs: byte offset | 
					
						
							|  |  |  |  * @size: byte size to examine | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2012-09-20 20:29:12 -07:00
										 |  |  | static inline unsigned int | 
					
						
							|  |  |  | snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream, | 
					
						
							|  |  |  | 			     unsigned int ofs, unsigned int size) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return snd_sgbuf_get_chunk_size(snd_pcm_get_dma_buf(substream), ofs, size); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2008-06-17 16:39:06 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_mmap_data_open - increase the mmap counter | 
					
						
							|  |  |  |  * @area: VMA | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * PCM mmap callback should handle this counter properly | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data; | 
					
						
							| 
									
										
										
										
											2006-04-28 15:13:41 +02:00
										 |  |  | 	atomic_inc(&substream->mmap_count); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_mmap_data_close - decrease the mmap counter | 
					
						
							|  |  |  |  * @area: VMA | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * PCM mmap callback should handle this counter properly | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | static inline void snd_pcm_mmap_data_close(struct vm_area_struct *area) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | 	struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data; | 
					
						
							| 
									
										
										
										
											2006-04-28 15:13:41 +02:00
										 |  |  | 	atomic_dec(&substream->mmap_count); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-28 17:12:59 +02:00
										 |  |  | int snd_pcm_lib_default_mmap(struct snd_pcm_substream *substream, | 
					
						
							|  |  |  | 			     struct vm_area_struct *area); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | /* mmap for io-memory area */ | 
					
						
							|  |  |  | #if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_ALPHA)
 | 
					
						
							|  |  |  | #define SNDRV_PCM_INFO_MMAP_IOMEM	SNDRV_PCM_INFO_MMAP
 | 
					
						
							| 
									
										
										
										
											2005-11-17 13:59:38 +01:00
										 |  |  | int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, struct vm_area_struct *area); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #else
 | 
					
						
							|  |  |  | #define SNDRV_PCM_INFO_MMAP_IOMEM	0
 | 
					
						
							|  |  |  | #define snd_pcm_lib_mmap_iomem	NULL
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-25 17:51:54 +11:00
										 |  |  | #define snd_pcm_lib_mmap_vmalloc NULL
 | 
					
						
							| 
									
										
										
										
											2010-01-18 14:58:57 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_limit_isa_dma_size - Get the max size fitting with ISA DMA transfer | 
					
						
							|  |  |  |  * @dma: DMA number | 
					
						
							|  |  |  |  * @max: pointer to store the max size | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	*max = dma < 4 ? 64 * 1024 : 128 * 1024; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  *  Misc | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define SNDRV_PCM_DEFAULT_CON_SPDIF	(IEC958_AES0_CON_EMPHASIS_NONE|\
 | 
					
						
							|  |  |  | 					 (IEC958_AES1_CON_ORIGINAL<<8)|\ | 
					
						
							|  |  |  | 					 (IEC958_AES1_CON_PCM_CODER<<8)|\ | 
					
						
							|  |  |  | 					 (IEC958_AES3_CON_FS_48000<<24)) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-08-08 17:09:09 +02:00
										 |  |  | #define PCM_RUNTIME_CHECK(sub) snd_BUG_ON(!(sub) || !(sub)->runtime)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-08 14:26:51 +02:00
										 |  |  | const char *snd_pcm_format_name(snd_pcm_format_t format); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-24 15:26:03 +02:00
										 |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2012-08-18 17:43:05 -07:00
										 |  |  |  * snd_pcm_stream_str - Get a string naming the direction of a stream | 
					
						
							|  |  |  |  * @substream: the pcm substream instance | 
					
						
							| 
									
										
										
										
											2013-03-11 22:05:14 +01:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Return: A string naming the direction of the stream. | 
					
						
							| 
									
										
										
										
											2012-05-24 15:26:03 +02:00
										 |  |  |  */ | 
					
						
							|  |  |  | static inline const char *snd_pcm_stream_str(struct snd_pcm_substream *substream) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 
					
						
							|  |  |  | 		return "Playback"; | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 		return "Capture"; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-27 18:27:00 +02:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * PCM channel-mapping control API | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | /* array element of channel maps */ | 
					
						
							|  |  |  | struct snd_pcm_chmap_elem { | 
					
						
							|  |  |  | 	unsigned char channels; | 
					
						
							|  |  |  | 	unsigned char map[15]; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* channel map information; retrieved via snd_kcontrol_chip() */ | 
					
						
							|  |  |  | struct snd_pcm_chmap { | 
					
						
							|  |  |  | 	struct snd_pcm *pcm;	/* assigned PCM instance */ | 
					
						
							|  |  |  | 	int stream;		/* PLAYBACK or CAPTURE */ | 
					
						
							|  |  |  | 	struct snd_kcontrol *kctl; | 
					
						
							|  |  |  | 	const struct snd_pcm_chmap_elem *chmap; | 
					
						
							|  |  |  | 	unsigned int max_channels; | 
					
						
							|  |  |  | 	unsigned int channel_mask;	/* optional: active channels bitmask */ | 
					
						
							|  |  |  | 	void *private_data;	/* optional: private data pointer */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * snd_pcm_chmap_substream - get the PCM substream assigned to the given chmap info | 
					
						
							|  |  |  |  * @info: chmap information | 
					
						
							|  |  |  |  * @idx: the substream number index | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2012-07-27 18:27:00 +02:00
										 |  |  | static inline struct snd_pcm_substream * | 
					
						
							|  |  |  | snd_pcm_chmap_substream(struct snd_pcm_chmap *info, unsigned int idx) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct snd_pcm_substream *s; | 
					
						
							|  |  |  | 	for (s = info->pcm->streams[info->stream].substream; s; s = s->next) | 
					
						
							|  |  |  | 		if (s->number == idx) | 
					
						
							|  |  |  | 			return s; | 
					
						
							|  |  |  | 	return NULL; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ALSA-standard channel maps (RL/RR prior to C/LFE) */ | 
					
						
							|  |  |  | extern const struct snd_pcm_chmap_elem snd_pcm_std_chmaps[]; | 
					
						
							|  |  |  | /* Other world's standard channel maps (C/LFE prior to RL/RR) */ | 
					
						
							|  |  |  | extern const struct snd_pcm_chmap_elem snd_pcm_alt_chmaps[]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* bit masks to be passed to snd_pcm_chmap.channel_mask field */ | 
					
						
							|  |  |  | #define SND_PCM_CHMAP_MASK_24	((1U << 2) | (1U << 4))
 | 
					
						
							|  |  |  | #define SND_PCM_CHMAP_MASK_246	(SND_PCM_CHMAP_MASK_24 | (1U << 6))
 | 
					
						
							|  |  |  | #define SND_PCM_CHMAP_MASK_2468	(SND_PCM_CHMAP_MASK_246 | (1U << 8))
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream, | 
					
						
							|  |  |  | 			   const struct snd_pcm_chmap_elem *chmap, | 
					
						
							|  |  |  | 			   int max_channels, | 
					
						
							|  |  |  | 			   unsigned long private_value, | 
					
						
							|  |  |  | 			   struct snd_pcm_chmap **info_ret); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-30 15:02:50 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * pcm_format_to_bits - Strong-typed conversion of pcm_format to bitwise | 
					
						
							|  |  |  |  * @pcm_format: PCM format | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2013-04-23 01:00:41 +02:00
										 |  |  | static inline u64 pcm_format_to_bits(snd_pcm_format_t pcm_format) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return 1ULL << (__force int) pcm_format; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-04 18:19:48 +01:00
										 |  |  | /* printk helpers */ | 
					
						
							|  |  |  | #define pcm_err(pcm, fmt, args...) \
 | 
					
						
							|  |  |  | 	dev_err((pcm)->card->dev, fmt, ##args) | 
					
						
							|  |  |  | #define pcm_warn(pcm, fmt, args...) \
 | 
					
						
							|  |  |  | 	dev_warn((pcm)->card->dev, fmt, ##args) | 
					
						
							|  |  |  | #define pcm_dbg(pcm, fmt, args...) \
 | 
					
						
							|  |  |  | 	dev_dbg((pcm)->card->dev, fmt, ##args) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #endif /* __SOUND_PCM_H */
 |