]>
Commit | Line | Data |
---|---|---|
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> | |
21 | ||
22 | #include "../lib.h" | |
23 | #include "../fcp.h" | |
24 | #include "../packets-buffer.h" | |
25 | #include "../iso-resources.h" | |
26 | #include "../amdtp.h" | |
27 | #include "../cmp.h" | |
28 | ||
29 | struct device_info { | |
30 | const char *driver_name; | |
fec7b753 TS |
31 | const char *vendor_name; |
32 | const char *model_name; | |
e2786ca6 TS |
33 | unsigned int mixer_channels; |
34 | u8 mute_fb_id; | |
35 | u8 volume_fb_id; | |
36 | }; | |
37 | ||
5cd1d3f4 TS |
38 | /* This is an arbitrary number for convinience. */ |
39 | #define SND_OXFW_STREAM_FORMAT_ENTRIES 10 | |
e2786ca6 TS |
40 | struct snd_oxfw { |
41 | struct snd_card *card; | |
42 | struct fw_unit *unit; | |
43 | const struct device_info *device_info; | |
44 | struct mutex mutex; | |
5cd1d3f4 TS |
45 | |
46 | u8 *rx_stream_formats[SND_OXFW_STREAM_FORMAT_ENTRIES]; | |
47 | bool assumed; | |
e2786ca6 TS |
48 | struct cmp_connection in_conn; |
49 | struct amdtp_stream rx_stream; | |
5cd1d3f4 | 50 | |
e2786ca6 TS |
51 | bool mute; |
52 | s16 volume[6]; | |
53 | s16 volume_min; | |
54 | s16 volume_max; | |
55 | }; | |
56 | ||
5b59d809 TS |
57 | /* |
58 | * AV/C Stream Format Information Specification 1.1 Working Draft | |
59 | * (Apr 2005, 1394TA) | |
60 | */ | |
61 | int avc_stream_set_format(struct fw_unit *unit, enum avc_general_plug_dir dir, | |
62 | unsigned int pid, u8 *format, unsigned int len); | |
63 | int avc_stream_get_format(struct fw_unit *unit, | |
64 | enum avc_general_plug_dir dir, unsigned int pid, | |
65 | u8 *buf, unsigned int *len, unsigned int eid); | |
66 | static inline int | |
67 | avc_stream_get_format_single(struct fw_unit *unit, | |
68 | enum avc_general_plug_dir dir, unsigned int pid, | |
69 | u8 *buf, unsigned int *len) | |
70 | { | |
71 | return avc_stream_get_format(unit, dir, pid, buf, len, 0xff); | |
72 | } | |
73 | static inline int | |
74 | avc_stream_get_format_list(struct fw_unit *unit, | |
75 | enum avc_general_plug_dir dir, unsigned int pid, | |
76 | u8 *buf, unsigned int *len, | |
77 | unsigned int eid) | |
78 | { | |
79 | return avc_stream_get_format(unit, dir, pid, buf, len, eid); | |
80 | } | |
81 | ||
82 | /* | |
83 | * AV/C Digital Interface Command Set General Specification 4.2 | |
84 | * (Sep 2004, 1394TA) | |
85 | */ | |
86 | int avc_general_inquiry_sig_fmt(struct fw_unit *unit, unsigned int rate, | |
87 | enum avc_general_plug_dir dir, | |
88 | unsigned short pid); | |
89 | ||
e2786ca6 TS |
90 | int snd_oxfw_stream_init_simplex(struct snd_oxfw *oxfw); |
91 | int snd_oxfw_stream_start_simplex(struct snd_oxfw *oxfw); | |
92 | void snd_oxfw_stream_stop_simplex(struct snd_oxfw *oxfw); | |
93 | void snd_oxfw_stream_destroy_simplex(struct snd_oxfw *oxfw); | |
94 | void snd_oxfw_stream_update_simplex(struct snd_oxfw *oxfw); | |
3713d93a | 95 | |
5cd1d3f4 TS |
96 | struct snd_oxfw_stream_formation { |
97 | unsigned int rate; | |
98 | unsigned int pcm; | |
99 | unsigned int midi; | |
100 | }; | |
101 | int snd_oxfw_stream_parse_format(u8 *format, | |
102 | struct snd_oxfw_stream_formation *formation); | |
103 | int snd_oxfw_stream_get_current_formation(struct snd_oxfw *oxfw, | |
104 | enum avc_general_plug_dir dir, | |
105 | struct snd_oxfw_stream_formation *formation); | |
106 | int snd_oxfw_stream_discover(struct snd_oxfw *oxfw); | |
107 | ||
3713d93a | 108 | int snd_oxfw_create_pcm(struct snd_oxfw *oxfw); |
31514bfb TS |
109 | |
110 | int snd_oxfw_create_mixer(struct snd_oxfw *oxfw); |