aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/intel_mid_i2s/intel_alsa_ssp_snd_card.h
blob: f0e3439b261c88d0fb906c5cb9eca9def36fb0d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
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 */