Commit aa02bb6e authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Takashi Iwai

ALSA: fireworks: Add PCM interface

This commit adds a functionality to capture/playback PCM samples.

When AMDTP stream is already running for PCM or the source of clock is not
internal, available sampling rate is limited at current one.
Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 53111cdc
...@@ -65,6 +65,7 @@ config SND_FIREWORKS ...@@ -65,6 +65,7 @@ config SND_FIREWORKS
tristate "Echo Fireworks board module support" tristate "Echo Fireworks board module support"
select SND_FIREWIRE_LIB select SND_FIREWIRE_LIB
select SND_RAWMIDI select SND_RAWMIDI
select SND_PCM
help help
Say Y here to include support for FireWire devices based Say Y here to include support for FireWire devices based
on Echo Digital Audio Fireworks board: on Echo Digital Audio Fireworks board:
......
snd-fireworks-objs := fireworks_transaction.o fireworks_command.o \ snd-fireworks-objs := fireworks_transaction.o fireworks_command.o \
fireworks_stream.o fireworks_proc.o fireworks_midi.o \ fireworks_stream.o fireworks_proc.o fireworks_midi.o \
fireworks.o fireworks_pcm.o fireworks.o
obj-m += snd-fireworks.o obj-m += snd-fireworks.o
...@@ -232,6 +232,10 @@ efw_probe(struct fw_unit *unit, ...@@ -232,6 +232,10 @@ efw_probe(struct fw_unit *unit,
goto error; goto error;
} }
err = snd_efw_create_pcm_devices(efw);
if (err < 0)
goto error;
err = snd_efw_stream_init_duplex(efw); err = snd_efw_stream_init_duplex(efw);
if (err < 0) if (err < 0)
goto error; goto error;
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <sound/pcm.h> #include <sound/pcm.h>
#include <sound/info.h> #include <sound/info.h>
#include <sound/rawmidi.h> #include <sound/rawmidi.h>
#include <sound/pcm_params.h>
#include "../packets-buffer.h" #include "../packets-buffer.h"
#include "../iso-resources.h" #include "../iso-resources.h"
...@@ -201,6 +202,9 @@ void snd_efw_proc_init(struct snd_efw *efw); ...@@ -201,6 +202,9 @@ void snd_efw_proc_init(struct snd_efw *efw);
int snd_efw_create_midi_devices(struct snd_efw *efw); int snd_efw_create_midi_devices(struct snd_efw *efw);
int snd_efw_create_pcm_devices(struct snd_efw *efw);
int snd_efw_get_multiplier_mode(unsigned int sampling_rate, unsigned int *mode);
#define SND_EFW_DEV_ENTRY(vendor, model) \ #define SND_EFW_DEV_ENTRY(vendor, model) \
{ \ { \
.match_flags = IEEE1394_MATCH_VENDOR_ID | \ .match_flags = IEEE1394_MATCH_VENDOR_ID | \
......
This diff is collapsed.
...@@ -9,39 +9,6 @@ ...@@ -9,39 +9,6 @@
#define CALLBACK_TIMEOUT 100 #define CALLBACK_TIMEOUT 100
static unsigned int freq_table[] = {
/* multiplier mode 0 */
[0] = 32000,
[1] = 44100,
[2] = 48000,
/* multiplier mode 1 */
[3] = 88200,
[4] = 96000,
/* multiplier mode 2 */
[5] = 176400,
[6] = 192000,
};
static inline unsigned int
get_multiplier_mode_with_index(unsigned int index)
{
return ((int)index - 1) / 2;
}
int snd_efw_get_multiplier_mode(unsigned int sampling_rate, unsigned int *mode)
{
unsigned int i;
for (i = 0; i < ARRAY_SIZE(freq_table); i++) {
if (freq_table[i] == sampling_rate) {
*mode = get_multiplier_mode_with_index(i);
return 0;
}
}
return -EINVAL;
}
static int static int
init_stream(struct snd_efw *efw, struct amdtp_stream *stream) init_stream(struct snd_efw *efw, struct amdtp_stream *stream)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment