aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/intel_mid_i2s/intel_alsa_ssp_snd_card.h
diff options
context:
space:
mode:
authorSelma Bensaid <selma.bensaid@intel.com>2010-12-09 10:37:44 +0000
committerAlan Cox <alan@linux.intel.com>2010-12-09 10:37:44 +0000
commitf42e19b29cc9c529746eb7e0a579b179786d205d (patch)
tree9fabdd500af5fc789f0b23ec57d25be841649fd7 /sound/pci/intel_mid_i2s/intel_alsa_ssp_snd_card.h
parent3912d7e37d67374fcb77c1612ed486bad4dd9993 (diff)
downloadmrst-s0i3-test-f42e19b29cc9c529746eb7e0a579b179786d205d.tar.gz
mrst-s0i3-test-f42e19b29cc9c529746eb7e0a579b179786d205d.tar.xz
mrst-s0i3-test-f42e19b29cc9c529746eb7e0a579b179786d205d.zip
ALSA SSP Driver: ALSA sound card for TI WL1273 Chip (BT/FM/WLAN)
This sound card handles 2 PCM devices - BT PCM device which support 1 capture substream and 1 playback substream (8KHz, mono, 16 bits/sample) - FM device which support 1 capture substream only (the FM TX is not supported) (48KHz, stereo, 16bits/sample) These 2 PCM devices are exclusive (i.e FM and BT substreams cannot run in parallel) The ALSA SSP driver interfaces with Intel MID I2S driver to configure the SSP peripheral according to PCM device's settings and to send/receive PCM samples. Signed-off-by: Selma Bensaid <selma.bensaid@intel.com> Signed-off-by: Alan Cox <alan@linux.intel.com>
Diffstat (limited to 'sound/pci/intel_mid_i2s/intel_alsa_ssp_snd_card.h')
-rw-r--r--sound/pci/intel_mid_i2s/intel_alsa_ssp_snd_card.h166
1 files changed, 166 insertions, 0 deletions
diff --git a/sound/pci/intel_mid_i2s/intel_alsa_ssp_snd_card.h b/sound/pci/intel_mid_i2s/intel_alsa_ssp_snd_card.h
new file mode 100644
index 00000000000..f0e3439b261
--- /dev/null
+++ b/sound/pci/intel_mid_i2s/intel_alsa_ssp_snd_card.h
@@ -0,0 +1,166 @@
+/*
+ * intel_alsa_ssp_snd_card.h
+ *
+ * Copyright (C) 2010 Intel Corp
+ * Authors: Selma Bensaid <selma.bensaid@intel.com>
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * 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; version 2 of the License.
+ *
+ * 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.
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+#ifndef _LINUX_INTEL_ALSA_SSP_SND_CARD_H
+#define _LINUX_INTEL_ALSA_SSP_SND_CARD_H
+
+#include <linux/io.h>
+#include <linux/delay.h>
+#include <linux/interrupt.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/moduleparam.h>
+#include <linux/sched.h>
+#include <sound/initval.h>
+#include <sound/core.h>
+#include <sound/control.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <sound/info.h>
+
+#include "intel_alsa_ssp_hw_interface.h"
+
+
+
+int snd_i2s_alsa_open(struct snd_pcm_substream *substream);
+int snd_i2s_alsa_close(struct snd_pcm_substream *substream);
+int snd_i2s_alsa_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params);
+int snd_i2s_alsa_pcm_prepare(struct snd_pcm_substream *substream);
+int snd_i2s_alsa_pcm_trigger(struct snd_pcm_substream *substream, int cmd);
+int snd_i2s_alsa_hw_free(struct snd_pcm_substream *substream);
+snd_pcm_uframes_t snd_i2s_alsa_pcm_pointer(struct snd_pcm_substream *substream);
+int snd_i2s_alsa_pcm_prepare(struct snd_pcm_substream *substream);
+
+/*
+ * Defines
+ */
+#define INTEL_ALSA_SSP_DRIVER_VERSION "1.0.3"
+#define INTEL_ALSA_SSP_CARD_NAME "IntelALSASSP"
+
+
+/*
+ * Structures Definition
+ */
+struct intel_alsa_ssp_card_info {
+ struct snd_card *card;
+ char *card_id;
+ int playback_cnt;
+ int capture_cnt;
+ int card_index;
+};
+
+struct intel_alsa_ssp_dev_info {
+ char dev_name[32];
+ int nb_play_stream;
+ int nb_capt_stream;
+ struct snd_pcm_hardware *stream_hw_param;
+};
+
+/*
+ * Global Variables
+ */
+
+/* Data path functionalities */
+struct snd_pcm_hardware BT_alsa_hw_param = {
+ .info = (SNDRV_PCM_INFO_INTERLEAVED |
+ SNDRV_PCM_INFO_DOUBLE |
+ SNDRV_PCM_INFO_PAUSE |
+ SNDRV_PCM_INFO_RESUME |
+ SNDRV_PCM_INFO_MMAP |
+ SNDRV_PCM_INFO_MMAP_VALID |
+ SNDRV_PCM_INFO_BATCH | SNDRV_PCM_INFO_SYNC_START),
+ .formats = (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_U16_LE),
+ .rates = (SNDRV_PCM_RATE_8000),
+ .rate_min = 8000,
+ .rate_max = 8000,
+ .channels_min = 1,
+ .channels_max = 1,
+ .buffer_bytes_max = (320*1024),
+ .period_bytes_min = 32,
+ .period_bytes_max = (320*1024),
+ .periods_min = 2,
+ .periods_max = (1024*2),
+ .fifo_size = 0,
+};
+
+struct snd_pcm_hardware FM_alsa_hw_param = {
+ .info = (SNDRV_PCM_INFO_INTERLEAVED |
+ SNDRV_PCM_INFO_DOUBLE |
+ SNDRV_PCM_INFO_PAUSE |
+ SNDRV_PCM_INFO_RESUME |
+ SNDRV_PCM_INFO_MMAP |
+ SNDRV_PCM_INFO_MMAP_VALID |
+ SNDRV_PCM_INFO_BATCH | SNDRV_PCM_INFO_SYNC_START),
+ .formats = (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_U16_LE),
+ .rates = (SNDRV_PCM_RATE_48000),
+ .rate_min = 48000,
+ .rate_max = 48000,
+ .channels_min = 1,
+ .channels_max = 2,
+ .buffer_bytes_max = (640*1024),
+ .period_bytes_min = 64,
+ .period_bytes_max = (640*1024),
+ .periods_min = 2,
+ .periods_max = (1024*2),
+ .fifo_size = 0,
+};
+
+struct snd_pcm_ops s_alsa_ssp_playback_ops = {
+ .open = snd_i2s_alsa_open,
+ .close = snd_i2s_alsa_close,
+ .ioctl = snd_pcm_lib_ioctl,
+ .hw_params = snd_i2s_alsa_hw_params,
+ .hw_free = snd_i2s_alsa_hw_free,
+ .trigger = snd_i2s_alsa_pcm_trigger,
+ .pointer = snd_i2s_alsa_pcm_pointer,
+ .prepare = snd_i2s_alsa_pcm_prepare,
+};
+
+struct snd_pcm_ops s_alsa_ssp_capture_ops = {
+ .open = snd_i2s_alsa_open,
+ .close = snd_i2s_alsa_close,
+ .ioctl = snd_pcm_lib_ioctl,
+ .hw_params = snd_i2s_alsa_hw_params,
+ .hw_free = snd_i2s_alsa_hw_free,
+ .trigger = snd_i2s_alsa_pcm_trigger,
+ .pointer = snd_i2s_alsa_pcm_pointer,
+ .prepare = snd_i2s_alsa_pcm_prepare,
+};
+
+struct intel_alsa_ssp_dev_info s_dev_info[INTEL_ALSA_SSP_SND_CARD_MAX_DEVICES] = {
+ {
+ .dev_name = "BT_DEVICE",
+ .nb_play_stream = 1,
+ .nb_capt_stream = 1,
+ .stream_hw_param = &BT_alsa_hw_param,
+
+ },
+ {
+ .dev_name = "FM_DEVICE",
+ .nb_play_stream = 0,
+ .nb_capt_stream = 1,
+ .stream_hw_param = &FM_alsa_hw_param,
+
+ }
+};
+
+#endif /* _LINUX_INTEL_ALSA_SSP_SND_CARD_H */