aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-02-03 11:57:16 -0500
committerTakashi Iwai <tiwai@suse.de>2015-02-03 11:57:16 -0500
commit3fe9cf390f6dc84f76b112b0a660967a84f9a81b (patch)
tree18b8573687ae8131db155aa791f4d2357d91e6c5 /include/sound
parent6ccd93bdb989507717edb375d40534f1177822c5 (diff)
parent830953c0724b42be30a74febcde6c89c706ed286 (diff)
Merge branch 'topic/snd-device' into for-next
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/compress_driver.h4
-rw-r--r--include/sound/control.h11
-rw-r--r--include/sound/core.h41
-rw-r--r--include/sound/hwdep.h3
-rw-r--r--include/sound/pcm.h2
-rw-r--r--include/sound/rawmidi.h4
6 files changed, 22 insertions, 43 deletions
diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h
index 1e2531058b7e..f48089d364c5 100644
--- a/include/sound/compress_driver.h
+++ b/include/sound/compress_driver.h
@@ -135,7 +135,7 @@ struct snd_compr_ops {
135/** 135/**
136 * struct snd_compr: Compressed device 136 * struct snd_compr: Compressed device
137 * @name: DSP device name 137 * @name: DSP device name
138 * @dev: Device pointer 138 * @dev: associated device instance
139 * @ops: pointer to DSP callbacks 139 * @ops: pointer to DSP callbacks
140 * @private_data: pointer to DSP pvt data 140 * @private_data: pointer to DSP pvt data
141 * @card: sound card pointer 141 * @card: sound card pointer
@@ -145,7 +145,7 @@ struct snd_compr_ops {
145 */ 145 */
146struct snd_compr { 146struct snd_compr {
147 const char *name; 147 const char *name;
148 struct device *dev; 148 struct device dev;
149 struct snd_compr_ops *ops; 149 struct snd_compr_ops *ops;
150 void *private_data; 150 void *private_data;
151 struct snd_card *card; 151 struct snd_card *card;
diff --git a/include/sound/control.h b/include/sound/control.h
index 042613938a1d..75f3054023f7 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -93,12 +93,17 @@ struct snd_kctl_event {
93 93
94struct pid; 94struct pid;
95 95
96enum {
97 SND_CTL_SUBDEV_PCM,
98 SND_CTL_SUBDEV_RAWMIDI,
99 SND_CTL_SUBDEV_ITEMS,
100};
101
96struct snd_ctl_file { 102struct snd_ctl_file {
97 struct list_head list; /* list of all control files */ 103 struct list_head list; /* list of all control files */
98 struct snd_card *card; 104 struct snd_card *card;
99 struct pid *pid; 105 struct pid *pid;
100 int prefer_pcm_subdevice; 106 int preferred_subdevice[SND_CTL_SUBDEV_ITEMS];
101 int prefer_rawmidi_subdevice;
102 wait_queue_head_t change_sleep; 107 wait_queue_head_t change_sleep;
103 spinlock_t read_lock; 108 spinlock_t read_lock;
104 struct fasync_struct *fasync; 109 struct fasync_struct *fasync;
@@ -138,6 +143,8 @@ int snd_ctl_unregister_ioctl_compat(snd_kctl_ioctl_func_t fcn);
138#define snd_ctl_unregister_ioctl_compat(fcn) 143#define snd_ctl_unregister_ioctl_compat(fcn)
139#endif 144#endif
140 145
146int snd_ctl_get_preferred_subdevice(struct snd_card *card, int type);
147
141static inline unsigned int snd_ctl_get_ioffnum(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id) 148static inline unsigned int snd_ctl_get_ioffnum(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id)
142{ 149{
143 return id->numid - kctl->id.numid; 150 return id->numid - kctl->id.numid;
diff --git a/include/sound/core.h b/include/sound/core.h
index 1df3f2fe5350..58882bfacdd7 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -109,6 +109,7 @@ struct snd_card {
109 private data */ 109 private data */
110 struct list_head devices; /* devices */ 110 struct list_head devices; /* devices */
111 111
112 struct device ctl_dev; /* control device */
112 unsigned int last_numid; /* last used numeric ID */ 113 unsigned int last_numid; /* last used numeric ID */
113 struct rw_semaphore controls_rwsem; /* controls list lock */ 114 struct rw_semaphore controls_rwsem; /* controls list lock */
114 rwlock_t ctl_files_rwlock; /* ctl_files list lock */ 115 rwlock_t ctl_files_rwlock; /* ctl_files list lock */
@@ -206,43 +207,13 @@ extern struct class *sound_class;
206 207
207void snd_request_card(int card); 208void snd_request_card(int card);
208 209
209int snd_register_device_for_dev(int type, struct snd_card *card, 210void snd_device_initialize(struct device *dev, struct snd_card *card);
210 int dev,
211 const struct file_operations *f_ops,
212 void *private_data,
213 const char *name,
214 struct device *device);
215 211
216/** 212int snd_register_device(int type, struct snd_card *card, int dev,
217 * snd_register_device - Register the ALSA device file for the card 213 const struct file_operations *f_ops,
218 * @type: the device type, SNDRV_DEVICE_TYPE_XXX 214 void *private_data, struct device *device);
219 * @card: the card instance 215int snd_unregister_device(struct device *dev);
220 * @dev: the device index
221 * @f_ops: the file operations
222 * @private_data: user pointer for f_ops->open()
223 * @name: the device file name
224 *
225 * Registers an ALSA device file for the given card.
226 * The operators have to be set in reg parameter.
227 *
228 * This function uses the card's device pointer to link to the
229 * correct &struct device.
230 *
231 * Return: Zero if successful, or a negative error code on failure.
232 */
233static inline int snd_register_device(int type, struct snd_card *card, int dev,
234 const struct file_operations *f_ops,
235 void *private_data,
236 const char *name)
237{
238 return snd_register_device_for_dev(type, card, dev, f_ops,
239 private_data, name,
240 snd_card_get_device_link(card));
241}
242
243int snd_unregister_device(int type, struct snd_card *card, int dev);
244void *snd_lookup_minor_data(unsigned int minor, int type); 216void *snd_lookup_minor_data(unsigned int minor, int type);
245struct device *snd_get_device(int type, struct snd_card *card, int dev);
246 217
247#ifdef CONFIG_SND_OSSEMUL 218#ifdef CONFIG_SND_OSSEMUL
248int snd_register_oss_device(int type, struct snd_card *card, int dev, 219int snd_register_oss_device(int type, struct snd_card *card, int dev,
diff --git a/include/sound/hwdep.h b/include/sound/hwdep.h
index ae04a3ec9c77..ab9fcb2f97f0 100644
--- a/include/sound/hwdep.h
+++ b/include/sound/hwdep.h
@@ -68,8 +68,7 @@ struct snd_hwdep {
68 wait_queue_head_t open_wait; 68 wait_queue_head_t open_wait;
69 void *private_data; 69 void *private_data;
70 void (*private_free) (struct snd_hwdep *hwdep); 70 void (*private_free) (struct snd_hwdep *hwdep);
71 struct device *dev; 71 struct device dev;
72 const struct attribute_group **groups;
73 72
74 struct mutex open_mutex; 73 struct mutex open_mutex;
75 int used; /* reference counter */ 74 int used; /* reference counter */
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index cd09c1b05c24..44e9c2f2a094 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -447,6 +447,7 @@ struct snd_pcm_str {
447#endif 447#endif
448#endif 448#endif
449 struct snd_kcontrol *chmap_kctl; /* channel-mapping controls */ 449 struct snd_kcontrol *chmap_kctl; /* channel-mapping controls */
450 struct device dev;
450}; 451};
451 452
452struct snd_pcm { 453struct snd_pcm {
@@ -463,7 +464,6 @@ struct snd_pcm {
463 wait_queue_head_t open_wait; 464 wait_queue_head_t open_wait;
464 void *private_data; 465 void *private_data;
465 void (*private_free) (struct snd_pcm *pcm); 466 void (*private_free) (struct snd_pcm *pcm);
466 struct device *dev; /* actual hw device this belongs to */
467 bool internal; /* pcm is for internal use only */ 467 bool internal; /* pcm is for internal use only */
468 bool nonatomic; /* whole PCM operations are in non-atomic context */ 468 bool nonatomic; /* whole PCM operations are in non-atomic context */
469#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 469#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h
index 311dafe6cc4b..f6cbef78db62 100644
--- a/include/sound/rawmidi.h
+++ b/include/sound/rawmidi.h
@@ -28,6 +28,7 @@
28#include <linux/wait.h> 28#include <linux/wait.h>
29#include <linux/mutex.h> 29#include <linux/mutex.h>
30#include <linux/workqueue.h> 30#include <linux/workqueue.h>
31#include <linux/device.h>
31 32
32#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) 33#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
33#include <sound/seq_device.h> 34#include <sound/seq_device.h>
@@ -139,7 +140,8 @@ struct snd_rawmidi {
139 struct mutex open_mutex; 140 struct mutex open_mutex;
140 wait_queue_head_t open_wait; 141 wait_queue_head_t open_wait;
141 142
142 struct snd_info_entry *dev; 143 struct device dev;
144
143 struct snd_info_entry *proc_entry; 145 struct snd_info_entry *proc_entry;
144 146
145#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) 147#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)