diff options
Diffstat (limited to 'include/sound/soc-dai.h')
| -rw-r--r-- | include/sound/soc-dai.h | 104 | 
1 files changed, 69 insertions, 35 deletions
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index e7b68024800..688f2ba8009 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -16,9 +16,9 @@  #include <linux/list.h> -#include <sound/soc.h> -  struct snd_pcm_substream; +struct snd_soc_dapm_widget; +struct snd_compr_stream;  /*   * DAI hardware audio formats. @@ -26,13 +26,13 @@ struct snd_pcm_substream;   * Describes the physical PCM data formating and clocking. Add new formats   * to the end.   */ -#define SND_SOC_DAIFMT_I2S		0 /* I2S mode */ -#define SND_SOC_DAIFMT_RIGHT_J		1 /* Right Justified mode */ -#define SND_SOC_DAIFMT_LEFT_J		2 /* Left Justified mode */ -#define SND_SOC_DAIFMT_DSP_A		3 /* L data MSB after FRM LRC */ -#define SND_SOC_DAIFMT_DSP_B		4 /* L data MSB during FRM LRC */ -#define SND_SOC_DAIFMT_AC97		5 /* AC97 */ -#define SND_SOC_DAIFMT_PDM		6 /* Pulse density modulation */ +#define SND_SOC_DAIFMT_I2S		1 /* I2S mode */ +#define SND_SOC_DAIFMT_RIGHT_J		2 /* Right Justified mode */ +#define SND_SOC_DAIFMT_LEFT_J		3 /* Left Justified mode */ +#define SND_SOC_DAIFMT_DSP_A		4 /* L data MSB after FRM LRC */ +#define SND_SOC_DAIFMT_DSP_B		5 /* L data MSB during FRM LRC */ +#define SND_SOC_DAIFMT_AC97		6 /* AC97 */ +#define SND_SOC_DAIFMT_PDM		7 /* Pulse density modulation */  /* left and right justified also known as MSB and LSB respectively */  #define SND_SOC_DAIFMT_MSB		SND_SOC_DAIFMT_LEFT_J @@ -44,8 +44,8 @@ struct snd_pcm_substream;   * DAI bit clocks can be be gated (disabled) when the DAI is not   * sending or receiving PCM data in a frame. This can be used to save power.   */ -#define SND_SOC_DAIFMT_CONT		(0 << 4) /* continuous clock */ -#define SND_SOC_DAIFMT_GATED		(1 << 4) /* clock is gated */ +#define SND_SOC_DAIFMT_CONT		(1 << 4) /* continuous clock */ +#define SND_SOC_DAIFMT_GATED		(0 << 4) /* clock is gated */  /*   * DAI hardware signal inversions. @@ -54,9 +54,9 @@ struct snd_pcm_substream;   * format.   */  #define SND_SOC_DAIFMT_NB_NF		(0 << 8) /* normal bit clock + frame */ -#define SND_SOC_DAIFMT_NB_IF		(1 << 8) /* normal BCLK + inv FRM */ -#define SND_SOC_DAIFMT_IB_NF		(2 << 8) /* invert BCLK + nor FRM */ -#define SND_SOC_DAIFMT_IB_IF		(3 << 8) /* invert BCLK + FRM */ +#define SND_SOC_DAIFMT_NB_IF		(2 << 8) /* normal BCLK + inv FRM */ +#define SND_SOC_DAIFMT_IB_NF		(3 << 8) /* invert BCLK + nor FRM */ +#define SND_SOC_DAIFMT_IB_IF		(4 << 8) /* invert BCLK + FRM */  /*   * DAI hardware clock masters. @@ -65,10 +65,10 @@ struct snd_pcm_substream;   * i.e. if the codec is clk and FRM master then the interface is   * clk and frame slave.   */ -#define SND_SOC_DAIFMT_CBM_CFM		(0 << 12) /* codec clk & FRM master */ -#define SND_SOC_DAIFMT_CBS_CFM		(1 << 12) /* codec clk slave & FRM master */ -#define SND_SOC_DAIFMT_CBM_CFS		(2 << 12) /* codec clk master & frame slave */ -#define SND_SOC_DAIFMT_CBS_CFS		(3 << 12) /* codec clk & FRM slave */ +#define SND_SOC_DAIFMT_CBM_CFM		(1 << 12) /* codec clk & FRM master */ +#define SND_SOC_DAIFMT_CBS_CFM		(2 << 12) /* codec clk slave & FRM master */ +#define SND_SOC_DAIFMT_CBM_CFS		(3 << 12) /* codec clk master & frame slave */ +#define SND_SOC_DAIFMT_CBS_CFS		(4 << 12) /* codec clk & FRM slave */  #define SND_SOC_DAIFMT_FORMAT_MASK	0x000f  #define SND_SOC_DAIFMT_CLOCK_MASK	0x00f0 @@ -95,14 +95,6 @@ struct snd_soc_dai_driver;  struct snd_soc_dai;  struct snd_ac97_bus_ops; -/* Digital Audio Interface registration */ -int snd_soc_register_dai(struct device *dev, -		struct snd_soc_dai_driver *dai_drv); -void snd_soc_unregister_dai(struct device *dev); -int snd_soc_register_dais(struct device *dev, -		struct snd_soc_dai_driver *dai_drv, size_t count); -void snd_soc_unregister_dais(struct device *dev, size_t count); -  /* Digital Audio Interface clocking API.*/  int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,  	unsigned int freq, int dir); @@ -113,6 +105,8 @@ int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai,  int snd_soc_dai_set_pll(struct snd_soc_dai *dai,  	int pll_id, int source, unsigned int freq_in, unsigned int freq_out); +int snd_soc_dai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio); +  /* Digital Audio interface formatting */  int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt); @@ -126,7 +120,10 @@ int snd_soc_dai_set_channel_map(struct snd_soc_dai *dai,  int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate);  /* Digital Audio Interface mute */ -int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute); +int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute, +			     int direction); + +int snd_soc_dai_is_dummy(struct snd_soc_dai *dai);  struct snd_soc_dai_ops {  	/* @@ -138,12 +135,15 @@ struct snd_soc_dai_ops {  	int (*set_pll)(struct snd_soc_dai *dai, int pll_id, int source,  		unsigned int freq_in, unsigned int freq_out);  	int (*set_clkdiv)(struct snd_soc_dai *dai, int div_id, int div); +	int (*set_bclk_ratio)(struct snd_soc_dai *dai, unsigned int ratio);  	/*  	 * DAI format configuration  	 * Called by soc_card drivers, normally in their hw_params.  	 */  	int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt); +	int (*xlate_tdm_slot_mask)(unsigned int slots, +		unsigned int *tx_mask, unsigned int *rx_mask);  	int (*set_tdm_slot)(struct snd_soc_dai *dai,  		unsigned int tx_mask, unsigned int rx_mask,  		int slots, int slot_width); @@ -157,6 +157,7 @@ struct snd_soc_dai_ops {  	 * Called by soc-core to minimise any pops.  	 */  	int (*digital_mute)(struct snd_soc_dai *dai, int mute); +	int (*mute_stream)(struct snd_soc_dai *dai, int mute, int stream);  	/*  	 * ALSA PCM audio operations - all optional. @@ -172,8 +173,17 @@ struct snd_soc_dai_ops {  		struct snd_soc_dai *);  	int (*prepare)(struct snd_pcm_substream *,  		struct snd_soc_dai *); +	/* +	 * NOTE: Commands passed to the trigger function are not necessarily +	 * compatible with the current state of the dai. For example this +	 * sequence of commands is possible: START STOP STOP. +	 * So do not unconditionally use refcounting functions in the trigger +	 * function, e.g. clk_enable/disable. +	 */  	int (*trigger)(struct snd_pcm_substream *, int,  		struct snd_soc_dai *); +	int (*bespoke_trigger)(struct snd_pcm_substream *, int, +		struct snd_soc_dai *);  	/*  	 * For hardware based FIFO caused delay reporting.  	 * Optional. @@ -197,20 +207,29 @@ struct snd_soc_dai_driver {  	const char *name;  	unsigned int id;  	int ac97_control; +	unsigned int base;  	/* DAI driver callbacks */  	int (*probe)(struct snd_soc_dai *dai);  	int (*remove)(struct snd_soc_dai *dai);  	int (*suspend)(struct snd_soc_dai *dai);  	int (*resume)(struct snd_soc_dai *dai); +	/* compress dai */ +	bool compress_dai;  	/* ops */ -	struct snd_soc_dai_ops *ops; +	const struct snd_soc_dai_ops *ops;  	/* DAI capabilities */  	struct snd_soc_pcm_stream capture;  	struct snd_soc_pcm_stream playback;  	unsigned int symmetric_rates:1; +	unsigned int symmetric_channels:1; +	unsigned int symmetric_samplebits:1; + +	/* probe ordering - for components with runtime dependencies */ +	int probe_order; +	int remove_order;  };  /* @@ -231,24 +250,32 @@ struct snd_soc_dai {  	unsigned int capture_active:1;		/* stream is in use */  	unsigned int playback_active:1;		/* stream is in use */  	unsigned int symmetric_rates:1; -	struct snd_pcm_runtime *runtime; +	unsigned int symmetric_channels:1; +	unsigned int symmetric_samplebits:1;  	unsigned int active; -	unsigned char pop_wait:1;  	unsigned char probed:1; +	struct snd_soc_dapm_widget *playback_widget; +	struct snd_soc_dapm_widget *capture_widget; +	struct snd_soc_dapm_context dapm; +  	/* DAI DMA data */  	void *playback_dma_data;  	void *capture_dma_data; +	/* Symmetry data - only valid if symmetry is being enforced */ +	unsigned int rate; +	unsigned int channels; +	unsigned int sample_bits; +  	/* parent platform/codec */ -	union { -		struct snd_soc_platform *platform; -		struct snd_soc_codec *codec; -	}; +	struct snd_soc_platform *platform; +	struct snd_soc_codec *codec; +	struct snd_soc_component *component; +  	struct snd_soc_card *card;  	struct list_head list; -	struct list_head card_list;  };  static inline void *snd_soc_dai_get_dma_data(const struct snd_soc_dai *dai, @@ -268,6 +295,13 @@ static inline void snd_soc_dai_set_dma_data(struct snd_soc_dai *dai,  		dai->capture_dma_data = data;  } +static inline void snd_soc_dai_init_dma_data(struct snd_soc_dai *dai, +					     void *playback, void *capture) +{ +	dai->playback_dma_data = playback; +	dai->capture_dma_data = capture; +} +  static inline void snd_soc_dai_set_drvdata(struct snd_soc_dai *dai,  		void *data)  {  | 
