blob: 1bec187d772f8201a6e8cf8bf6d65986f999f287 [file] [log] [blame]
Tim Blechmann02bec492009-03-24 12:24:35 +01001/* -*- linux-c -*- *
2 *
3 * ALSA driver for the digigram lx6464es interface
4 *
5 * Copyright (c) 2009 Tim Blechmann <tim@klingt.org>
6 *
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; see the file COPYING. If not, write to
20 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
22 *
23 */
24
25#ifndef LX6464ES_H
26#define LX6464ES_H
27
28#include <linux/spinlock.h>
Arun Sharma600634972011-07-26 16:09:06 -070029#include <linux/atomic.h>
Tim Blechmann02bec492009-03-24 12:24:35 +010030
31#include <sound/core.h>
32#include <sound/pcm.h>
33
34#include "lx_core.h"
35
36#define LXP "LX6464ES: "
37
38enum {
39 ES_cmd_free = 0, /* no command executing */
40 ES_cmd_processing = 1, /* execution of a read/write command */
41 ES_read_pending = 2, /* a asynchron read command is pending */
42 ES_read_finishing = 3, /* a read command has finished waiting (set by
43 * Interrupt or CancelIrp) */
44};
45
46enum lx_stream_status {
47 LX_STREAM_STATUS_FREE,
48/* LX_STREAM_STATUS_OPEN, */
49 LX_STREAM_STATUS_SCHEDULE_RUN,
50/* LX_STREAM_STATUS_STARTED, */
51 LX_STREAM_STATUS_RUNNING,
52 LX_STREAM_STATUS_SCHEDULE_STOP,
53/* LX_STREAM_STATUS_STOPPED, */
54/* LX_STREAM_STATUS_PAUSED */
55};
56
57
58struct lx_stream {
59 struct snd_pcm_substream *stream;
60 snd_pcm_uframes_t frame_pos;
61 enum lx_stream_status status; /* free, open, running, draining
62 * pause */
Tim Blechmannf7467452010-10-31 19:46:19 +010063 unsigned int is_capture:1;
Tim Blechmann02bec492009-03-24 12:24:35 +010064};
65
66
67struct lx6464es {
68 struct snd_card *card;
69 struct pci_dev *pci;
70 int irq;
71
Tim Blechmann80b52492011-06-24 17:36:20 +020072 u8 mac_address[6];
73
Takashi Iwai6336c202014-09-10 14:01:05 +020074 struct mutex lock; /* interrupt lock */
Tim Blechmann02bec492009-03-24 12:24:35 +010075 struct mutex setup_mutex; /* mutex used in hw_params, open
76 * and close */
77
Tim Blechmann02bec492009-03-24 12:24:35 +010078 /* ports */
79 unsigned long port_plx; /* io port (size=256) */
80 void __iomem *port_plx_remapped; /* remapped plx port */
81 void __iomem *port_dsp_bar; /* memory port (32-bit,
82 * non-prefetchable,
83 * size=8K) */
84
85 /* messaging */
Takashi Iwai6336c202014-09-10 14:01:05 +020086 struct mutex msg_lock; /* message lock */
Tim Blechmann02bec492009-03-24 12:24:35 +010087 struct lx_rmh rmh;
Takashi Iwai6336c202014-09-10 14:01:05 +020088 u32 irqsrc;
Tim Blechmann02bec492009-03-24 12:24:35 +010089
90 /* configuration */
91 uint freq_ratio : 2;
92 uint playback_mute : 1;
93 uint hardware_running[2];
94 u32 board_sample_rate; /* sample rate read from
95 * board */
Tim Blechmann02bec492009-03-24 12:24:35 +010096 u16 pcm_granularity; /* board blocksize */
97
98 /* dma */
99 struct snd_dma_buffer capture_dma_buf;
100 struct snd_dma_buffer playback_dma_buf;
101
102 /* pcm */
103 struct snd_pcm *pcm;
104
105 /* streams */
106 struct lx_stream capture_stream;
107 struct lx_stream playback_stream;
108};
109
110
111#endif /* LX6464ES_H */