ALSA: hdsp/hdspm: remove card->id from rawmidi device name
[linux-2.6-block.git] / include / sound / info.h
CommitLineData
1da177e4
LT
1#ifndef __SOUND_INFO_H
2#define __SOUND_INFO_H
3
4/*
5 * Header file for info interface
c1017a4c 6 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
1da177e4
LT
7 *
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#include <linux/poll.h>
26
27/* buffer for information */
28struct snd_info_buffer {
29 char *buffer; /* pointer to begin of buffer */
7e4eeec8
TI
30 unsigned int curr; /* current position in buffer */
31 unsigned int size; /* current size */
32 unsigned int len; /* total length of buffer */
1da177e4
LT
33 int stop; /* stop flag */
34 int error; /* error code */
35};
36
1da177e4
LT
37#define SNDRV_INFO_CONTENT_TEXT 0
38#define SNDRV_INFO_CONTENT_DATA 1
39
40struct snd_info_entry;
41
42struct snd_info_entry_text {
24c1f931
TI
43 void (*read) (struct snd_info_entry *entry, struct snd_info_buffer *buffer);
44 void (*write) (struct snd_info_entry *entry, struct snd_info_buffer *buffer);
1da177e4
LT
45};
46
47struct snd_info_entry_ops {
24c1f931 48 int (*open) (struct snd_info_entry *entry,
1da177e4 49 unsigned short mode, void **file_private_data);
24c1f931 50 int (*release) (struct snd_info_entry * entry,
1da177e4 51 unsigned short mode, void *file_private_data);
24c1f931 52 long (*read) (struct snd_info_entry *entry, void *file_private_data,
1da177e4
LT
53 struct file * file, char __user *buf,
54 unsigned long count, unsigned long pos);
24c1f931 55 long (*write) (struct snd_info_entry *entry, void *file_private_data,
1da177e4
LT
56 struct file * file, const char __user *buf,
57 unsigned long count, unsigned long pos);
24c1f931 58 long long (*llseek) (struct snd_info_entry *entry, void *file_private_data,
1da177e4 59 struct file * file, long long offset, int orig);
24c1f931 60 unsigned int (*poll) (struct snd_info_entry *entry, void *file_private_data,
1da177e4 61 struct file * file, poll_table * wait);
24c1f931 62 int (*ioctl) (struct snd_info_entry *entry, void *file_private_data,
1da177e4 63 struct file * file, unsigned int cmd, unsigned long arg);
24c1f931 64 int (*mmap) (struct snd_info_entry *entry, void *file_private_data,
1da177e4
LT
65 struct inode * inode, struct file * file,
66 struct vm_area_struct * vma);
67};
68
69struct snd_info_entry {
70 const char *name;
71 mode_t mode;
72 long size;
73 unsigned short content;
1da177e4
LT
74 union {
75 struct snd_info_entry_text text;
76 struct snd_info_entry_ops *ops;
77 } c;
24c1f931
TI
78 struct snd_info_entry *parent;
79 struct snd_card *card;
1da177e4
LT
80 struct module *module;
81 void *private_data;
24c1f931 82 void (*private_free)(struct snd_info_entry *entry);
1da177e4 83 struct proc_dir_entry *p;
1a60d4c5 84 struct mutex access;
746d4a02
TI
85 struct list_head children;
86 struct list_head list;
1da177e4
LT
87};
88
1da177e4 89#if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS)
24c1f931
TI
90int snd_info_minor_register(void);
91int snd_info_minor_unregister(void);
1da177e4
LT
92#else
93#define snd_info_minor_register() /* NOP */
94#define snd_info_minor_unregister() /* NOP */
95#endif
96
97
98#ifdef CONFIG_PROC_FS
99
24c1f931 100extern struct snd_info_entry *snd_seq_root;
1da177e4 101#ifdef CONFIG_SND_OSSEMUL
24c1f931 102extern struct snd_info_entry *snd_oss_root;
36b9cdfe 103void snd_card_info_read_oss(struct snd_info_buffer *buffer);
1da177e4
LT
104#else
105#define snd_oss_root NULL
36b9cdfe 106static inline void snd_card_info_read_oss(struct snd_info_buffer *buffer) {}
1da177e4
LT
107#endif
108
24c1f931 109int snd_iprintf(struct snd_info_buffer * buffer, char *fmt,...) __attribute__ ((format (printf, 2, 3)));
1da177e4
LT
110int snd_info_init(void);
111int snd_info_done(void);
112
24c1f931 113int snd_info_get_line(struct snd_info_buffer * buffer, char *line, int len);
1da177e4 114char *snd_info_get_str(char *dest, char *src, int len);
24c1f931 115struct snd_info_entry *snd_info_create_module_entry(struct module * module,
1da177e4 116 const char *name,
24c1f931
TI
117 struct snd_info_entry * parent);
118struct snd_info_entry *snd_info_create_card_entry(struct snd_card * card,
1da177e4 119 const char *name,
24c1f931
TI
120 struct snd_info_entry * parent);
121void snd_info_free_entry(struct snd_info_entry * entry);
122int snd_info_store_text(struct snd_info_entry * entry);
123int snd_info_restore_text(struct snd_info_entry * entry);
1da177e4 124
24c1f931
TI
125int snd_info_card_create(struct snd_card * card);
126int snd_info_card_register(struct snd_card * card);
127int snd_info_card_free(struct snd_card * card);
746d4a02 128void snd_info_card_disconnect(struct snd_card * card);
c2eb9c4e 129void snd_info_card_id_change(struct snd_card * card);
24c1f931 130int snd_info_register(struct snd_info_entry * entry);
1da177e4
LT
131
132/* for card drivers */
24c1f931 133int snd_card_proc_new(struct snd_card *card, const char *name, struct snd_info_entry **entryp);
1da177e4 134
24c1f931 135static inline void snd_info_set_text_ops(struct snd_info_entry *entry,
1da177e4 136 void *private_data,
24c1f931 137 void (*read)(struct snd_info_entry *, struct snd_info_buffer *))
1da177e4
LT
138{
139 entry->private_data = private_data;
1da177e4
LT
140 entry->c.text.read = read;
141}
142
e28563cc 143int snd_info_check_reserved_words(const char *str);
1da177e4
LT
144
145#else
146
147#define snd_seq_root NULL
148#define snd_oss_root NULL
149
24c1f931 150static inline int snd_iprintf(struct snd_info_buffer * buffer, char *fmt,...) { return 0; }
1da177e4
LT
151static inline int snd_info_init(void) { return 0; }
152static inline int snd_info_done(void) { return 0; }
153
24c1f931 154static inline int snd_info_get_line(struct snd_info_buffer * buffer, char *line, int len) { return 0; }
1da177e4 155static inline char *snd_info_get_str(char *dest, char *src, int len) { return NULL; }
24c1f931
TI
156static inline struct snd_info_entry *snd_info_create_module_entry(struct module * module, const char *name, struct snd_info_entry * parent) { return NULL; }
157static inline struct snd_info_entry *snd_info_create_card_entry(struct snd_card * card, const char *name, struct snd_info_entry * parent) { return NULL; }
158static inline void snd_info_free_entry(struct snd_info_entry * entry) { ; }
1da177e4 159
24c1f931
TI
160static inline int snd_info_card_create(struct snd_card * card) { return 0; }
161static inline int snd_info_card_register(struct snd_card * card) { return 0; }
162static inline int snd_info_card_free(struct snd_card * card) { return 0; }
746d4a02 163static inline void snd_info_card_disconnect(struct snd_card * card) { }
c2eb9c4e 164static inline void snd_info_card_id_change(struct snd_card * card) { }
24c1f931 165static inline int snd_info_register(struct snd_info_entry * entry) { return 0; }
1da177e4 166
e28563cc
TI
167static inline int snd_card_proc_new(struct snd_card *card, const char *name,
168 struct snd_info_entry **entryp) { return -EINVAL; }
169static inline void snd_info_set_text_ops(struct snd_info_entry *entry __attribute__((unused)),
170 void *private_data,
e28563cc
TI
171 void (*read)(struct snd_info_entry *, struct snd_info_buffer *)) {}
172
173static inline int snd_info_check_reserved_words(const char *str) { return 1; }
1da177e4
LT
174
175#endif
176
177/*
178 * OSS info part
179 */
180
181#if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS)
182
183#define SNDRV_OSS_INFO_DEV_AUDIO 0
184#define SNDRV_OSS_INFO_DEV_SYNTH 1
185#define SNDRV_OSS_INFO_DEV_MIDI 2
186#define SNDRV_OSS_INFO_DEV_TIMERS 4
187#define SNDRV_OSS_INFO_DEV_MIXERS 5
188
189#define SNDRV_OSS_INFO_DEV_COUNT 6
190
24c1f931 191int snd_oss_info_register(int dev, int num, char *string);
1da177e4
LT
192#define snd_oss_info_unregister(dev, num) snd_oss_info_register(dev, num, NULL)
193
194#endif /* CONFIG_SND_OSSEMUL && CONFIG_PROC_FS */
195
196#endif /* __SOUND_INFO_H */