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 | int (*pcm_constraints)(struct snd_pcm_runtime *runtime); |
34 | unsigned int mixer_channels; | |
35 | u8 mute_fb_id; | |
36 | u8 volume_fb_id; | |
37 | }; | |
38 | ||
39 | struct snd_oxfw { | |
40 | struct snd_card *card; | |
41 | struct fw_unit *unit; | |
42 | const struct device_info *device_info; | |
43 | struct mutex mutex; | |
44 | struct cmp_connection in_conn; | |
45 | struct amdtp_stream rx_stream; | |
46 | bool mute; | |
47 | s16 volume[6]; | |
48 | s16 volume_min; | |
49 | s16 volume_max; | |
50 | }; | |
51 | ||
5b59d809 TS |
52 | /* |
53 | * AV/C Stream Format Information Specification 1.1 Working Draft | |
54 | * (Apr 2005, 1394TA) | |
55 | */ | |
56 | int avc_stream_set_format(struct fw_unit *unit, enum avc_general_plug_dir dir, | |
57 | unsigned int pid, u8 *format, unsigned int len); | |
58 | int avc_stream_get_format(struct fw_unit *unit, | |
59 | enum avc_general_plug_dir dir, unsigned int pid, | |
60 | u8 *buf, unsigned int *len, unsigned int eid); | |
61 | static inline int | |
62 | avc_stream_get_format_single(struct fw_unit *unit, | |
63 | enum avc_general_plug_dir dir, unsigned int pid, | |
64 | u8 *buf, unsigned int *len) | |
65 | { | |
66 | return avc_stream_get_format(unit, dir, pid, buf, len, 0xff); | |
67 | } | |
68 | static inline int | |
69 | avc_stream_get_format_list(struct fw_unit *unit, | |
70 | enum avc_general_plug_dir dir, unsigned int pid, | |
71 | u8 *buf, unsigned int *len, | |
72 | unsigned int eid) | |
73 | { | |
74 | return avc_stream_get_format(unit, dir, pid, buf, len, eid); | |
75 | } | |
76 | ||
77 | /* | |
78 | * AV/C Digital Interface Command Set General Specification 4.2 | |
79 | * (Sep 2004, 1394TA) | |
80 | */ | |
81 | int avc_general_inquiry_sig_fmt(struct fw_unit *unit, unsigned int rate, | |
82 | enum avc_general_plug_dir dir, | |
83 | unsigned short pid); | |
84 | ||
e2786ca6 TS |
85 | int snd_oxfw_stream_init_simplex(struct snd_oxfw *oxfw); |
86 | int snd_oxfw_stream_start_simplex(struct snd_oxfw *oxfw); | |
87 | void snd_oxfw_stream_stop_simplex(struct snd_oxfw *oxfw); | |
88 | void snd_oxfw_stream_destroy_simplex(struct snd_oxfw *oxfw); | |
89 | void snd_oxfw_stream_update_simplex(struct snd_oxfw *oxfw); | |
3713d93a TS |
90 | |
91 | int firewave_constraints(struct snd_pcm_runtime *runtime); | |
92 | int lacie_speakers_constraints(struct snd_pcm_runtime *runtime); | |
93 | int snd_oxfw_create_pcm(struct snd_oxfw *oxfw); | |
31514bfb TS |
94 | |
95 | int snd_oxfw_create_mixer(struct snd_oxfw *oxfw); |