ALSA: oxfw: Change the way to start stream
[deliverable/linux.git] / sound / firewire / oxfw / oxfw.h
CommitLineData
e2786ca6
TS
1/*
2 * oxfw.h - a part of driver for OXFW970/971 based devices
3 *
4 * Copyright (c) Clemens Ladisch <clemens@ladisch.de>
5 * Licensed under the terms of the GNU General Public License, version 2.
6 */
7
8#include <linux/device.h>
9#include <linux/firewire.h>
10#include <linux/firewire-constants.h>
11#include <linux/module.h>
12#include <linux/mod_devicetable.h>
13#include <linux/mutex.h>
14#include <linux/slab.h>
15
16#include <sound/control.h>
17#include <sound/core.h>
18#include <sound/initval.h>
19#include <sound/pcm.h>
20#include <sound/pcm_params.h>
3c96101f 21#include <sound/info.h>
e2786ca6
TS
22
23#include "../lib.h"
24#include "../fcp.h"
25#include "../packets-buffer.h"
26#include "../iso-resources.h"
27#include "../amdtp.h"
28#include "../cmp.h"
29
30struct device_info {
31 const char *driver_name;
fec7b753
TS
32 const char *vendor_name;
33 const char *model_name;
e2786ca6
TS
34 unsigned int mixer_channels;
35 u8 mute_fb_id;
36 u8 volume_fb_id;
37};
38
5cd1d3f4
TS
39/* This is an arbitrary number for convinience. */
40#define SND_OXFW_STREAM_FORMAT_ENTRIES 10
e2786ca6
TS
41struct snd_oxfw {
42 struct snd_card *card;
43 struct fw_unit *unit;
44 const struct device_info *device_info;
45 struct mutex mutex;
5cd1d3f4
TS
46
47 u8 *rx_stream_formats[SND_OXFW_STREAM_FORMAT_ENTRIES];
48 bool assumed;
e2786ca6
TS
49 struct cmp_connection in_conn;
50 struct amdtp_stream rx_stream;
5cd1d3f4 51
e2786ca6
TS
52 bool mute;
53 s16 volume[6];
54 s16 volume_min;
55 s16 volume_max;
56};
57
5b59d809
TS
58/*
59 * AV/C Stream Format Information Specification 1.1 Working Draft
60 * (Apr 2005, 1394TA)
61 */
62int avc_stream_set_format(struct fw_unit *unit, enum avc_general_plug_dir dir,
63 unsigned int pid, u8 *format, unsigned int len);
64int avc_stream_get_format(struct fw_unit *unit,
65 enum avc_general_plug_dir dir, unsigned int pid,
66 u8 *buf, unsigned int *len, unsigned int eid);
67static inline int
68avc_stream_get_format_single(struct fw_unit *unit,
69 enum avc_general_plug_dir dir, unsigned int pid,
70 u8 *buf, unsigned int *len)
71{
72 return avc_stream_get_format(unit, dir, pid, buf, len, 0xff);
73}
74static inline int
75avc_stream_get_format_list(struct fw_unit *unit,
76 enum avc_general_plug_dir dir, unsigned int pid,
77 u8 *buf, unsigned int *len,
78 unsigned int eid)
79{
80 return avc_stream_get_format(unit, dir, pid, buf, len, eid);
81}
82
83/*
84 * AV/C Digital Interface Command Set General Specification 4.2
85 * (Sep 2004, 1394TA)
86 */
87int avc_general_inquiry_sig_fmt(struct fw_unit *unit, unsigned int rate,
88 enum avc_general_plug_dir dir,
89 unsigned short pid);
90
e2786ca6 91int snd_oxfw_stream_init_simplex(struct snd_oxfw *oxfw);
f3699e2c
TS
92int snd_oxfw_stream_start_simplex(struct snd_oxfw *oxfw, unsigned int rate,
93 unsigned int pcm_channels);
e2786ca6
TS
94void snd_oxfw_stream_stop_simplex(struct snd_oxfw *oxfw);
95void snd_oxfw_stream_destroy_simplex(struct snd_oxfw *oxfw);
96void snd_oxfw_stream_update_simplex(struct snd_oxfw *oxfw);
3713d93a 97
5cd1d3f4
TS
98struct snd_oxfw_stream_formation {
99 unsigned int rate;
100 unsigned int pcm;
101 unsigned int midi;
102};
103int snd_oxfw_stream_parse_format(u8 *format,
104 struct snd_oxfw_stream_formation *formation);
105int snd_oxfw_stream_get_current_formation(struct snd_oxfw *oxfw,
106 enum avc_general_plug_dir dir,
107 struct snd_oxfw_stream_formation *formation);
108int snd_oxfw_stream_discover(struct snd_oxfw *oxfw);
109
3713d93a 110int snd_oxfw_create_pcm(struct snd_oxfw *oxfw);
31514bfb
TS
111
112int snd_oxfw_create_mixer(struct snd_oxfw *oxfw);
3c96101f
TS
113
114void snd_oxfw_proc_init(struct snd_oxfw *oxfw);
This page took 0.030159 seconds and 5 git commands to generate.