summaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/core.h113
-rw-r--r--include/sound/emu10k1.h2
-rw-r--r--include/sound/hwdep.h3
-rw-r--r--include/sound/pcm.h8
-rw-r--r--include/sound/rawmidi.h2
5 files changed, 73 insertions, 55 deletions
diff --git a/include/sound/core.h b/include/sound/core.h
index 2a14f1f02d4f..d3f5f818e0b9 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -22,6 +22,7 @@
*
*/
+#include <linux/device.h>
#include <linux/sched.h> /* wake_up() */
#include <linux/mutex.h> /* struct mutex */
#include <linux/rwsem.h> /* struct rw_semaphore */
@@ -41,39 +42,33 @@
/* forward declarations */
struct pci_dev;
struct module;
-struct device;
-struct device_attribute;
+struct completion;
/* device allocation stuff */
-#define SNDRV_DEV_TYPE_RANGE_SIZE 0x1000
-
-typedef int __bitwise snd_device_type_t;
-#define SNDRV_DEV_TOPLEVEL ((__force snd_device_type_t) 0)
-#define SNDRV_DEV_CONTROL ((__force snd_device_type_t) 1)
-#define SNDRV_DEV_LOWLEVEL_PRE ((__force snd_device_type_t) 2)
-#define SNDRV_DEV_LOWLEVEL_NORMAL ((__force snd_device_type_t) 0x1000)
-#define SNDRV_DEV_PCM ((__force snd_device_type_t) 0x1001)
-#define SNDRV_DEV_RAWMIDI ((__force snd_device_type_t) 0x1002)
-#define SNDRV_DEV_TIMER ((__force snd_device_type_t) 0x1003)
-#define SNDRV_DEV_SEQUENCER ((__force snd_device_type_t) 0x1004)
-#define SNDRV_DEV_HWDEP ((__force snd_device_type_t) 0x1005)
-#define SNDRV_DEV_INFO ((__force snd_device_type_t) 0x1006)
-#define SNDRV_DEV_BUS ((__force snd_device_type_t) 0x1007)
-#define SNDRV_DEV_CODEC ((__force snd_device_type_t) 0x1008)
-#define SNDRV_DEV_JACK ((__force snd_device_type_t) 0x1009)
-#define SNDRV_DEV_COMPRESS ((__force snd_device_type_t) 0x100A)
-#define SNDRV_DEV_LOWLEVEL ((__force snd_device_type_t) 0x2000)
-
-typedef int __bitwise snd_device_state_t;
-#define SNDRV_DEV_BUILD ((__force snd_device_state_t) 0)
-#define SNDRV_DEV_REGISTERED ((__force snd_device_state_t) 1)
-#define SNDRV_DEV_DISCONNECTED ((__force snd_device_state_t) 2)
-
-typedef int __bitwise snd_device_cmd_t;
-#define SNDRV_DEV_CMD_PRE ((__force snd_device_cmd_t) 0)
-#define SNDRV_DEV_CMD_NORMAL ((__force snd_device_cmd_t) 1)
-#define SNDRV_DEV_CMD_POST ((__force snd_device_cmd_t) 2)
+/* type of the object used in snd_device_*()
+ * this also defines the calling order
+ */
+enum snd_device_type {
+ SNDRV_DEV_LOWLEVEL,
+ SNDRV_DEV_CONTROL,
+ SNDRV_DEV_INFO,
+ SNDRV_DEV_BUS,
+ SNDRV_DEV_CODEC,
+ SNDRV_DEV_PCM,
+ SNDRV_DEV_COMPRESS,
+ SNDRV_DEV_RAWMIDI,
+ SNDRV_DEV_TIMER,
+ SNDRV_DEV_SEQUENCER,
+ SNDRV_DEV_HWDEP,
+ SNDRV_DEV_JACK,
+};
+
+enum snd_device_state {
+ SNDRV_DEV_BUILD,
+ SNDRV_DEV_REGISTERED,
+ SNDRV_DEV_DISCONNECTED,
+};
struct snd_device;
@@ -86,8 +81,8 @@ struct snd_device_ops {
struct snd_device {
struct list_head list; /* list of registered devices */
struct snd_card *card; /* card which holds this device */
- snd_device_state_t state; /* state of the device */
- snd_device_type_t type; /* device type */
+ enum snd_device_state state; /* state of the device */
+ enum snd_device_type type; /* device type */
void *device_data; /* device structure */
struct snd_device_ops *ops; /* operations */
};
@@ -131,11 +126,10 @@ struct snd_card {
state */
spinlock_t files_lock; /* lock the files for this card */
int shutdown; /* this card is going down */
- int free_on_last_close; /* free in context of file_release */
- wait_queue_head_t shutdown_sleep;
- atomic_t refcount; /* refcount for disconnection */
+ struct completion *release_completion;
struct device *dev; /* device assigned to this card */
- struct device *card_dev; /* cardX object for sysfs */
+ struct device card_dev; /* cardX object for sysfs */
+ bool registered; /* card_dev is registered? */
#ifdef CONFIG_PM
unsigned int power_state; /* power state */
@@ -149,6 +143,8 @@ struct snd_card {
#endif
};
+#define dev_to_snd_card(p) container_of(p, struct snd_card, card_dev)
+
#ifdef CONFIG_PM
static inline void snd_power_lock(struct snd_card *card)
{
@@ -197,7 +193,7 @@ struct snd_minor {
/* return a device pointer linked to each sound device as a parent */
static inline struct device *snd_card_get_device_link(struct snd_card *card)
{
- return card ? card->card_dev : NULL;
+ return card ? &card->card_dev : NULL;
}
/* sound.c */
@@ -244,13 +240,11 @@ static inline int snd_register_device(int type, struct snd_card *card, int dev,
int snd_unregister_device(int type, struct snd_card *card, int dev);
void *snd_lookup_minor_data(unsigned int minor, int type);
-int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev,
- struct device_attribute *attr);
+struct device *snd_get_device(int type, struct snd_card *card, int dev);
#ifdef CONFIG_SND_OSSEMUL
int snd_register_oss_device(int type, struct snd_card *card, int dev,
- const struct file_operations *f_ops, void *private_data,
- const char *name);
+ const struct file_operations *f_ops, void *private_data);
int snd_unregister_oss_device(int type, struct snd_card *card, int dev);
void *snd_lookup_oss_minor_data(unsigned int minor, int type);
#endif
@@ -284,9 +278,16 @@ int snd_card_locked(int card);
extern int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int cmd);
#endif
-int snd_card_create(int idx, const char *id,
- struct module *module, int extra_size,
- struct snd_card **card_ret);
+int snd_card_new(struct device *parent, int idx, const char *xid,
+ struct module *module, int extra_size,
+ struct snd_card **card_ret);
+
+static inline int __deprecated
+snd_card_create(int idx, const char *id, struct module *module, int extra_size,
+ struct snd_card **ret)
+{
+ return snd_card_new(NULL, idx, id, module, extra_size, ret);
+}
int snd_card_disconnect(struct snd_card *card);
int snd_card_free(struct snd_card *card);
@@ -298,20 +299,19 @@ int snd_card_info_done(void);
int snd_component_add(struct snd_card *card, const char *component);
int snd_card_file_add(struct snd_card *card, struct file *file);
int snd_card_file_remove(struct snd_card *card, struct file *file);
-void snd_card_unref(struct snd_card *card);
+#define snd_card_unref(card) put_device(&(card)->card_dev)
#define snd_card_set_dev(card, devptr) ((card)->dev = (devptr))
/* device.c */
-int snd_device_new(struct snd_card *card, snd_device_type_t type,
+int snd_device_new(struct snd_card *card, enum snd_device_type type,
void *device_data, struct snd_device_ops *ops);
int snd_device_register(struct snd_card *card, void *device_data);
int snd_device_register_all(struct snd_card *card);
-int snd_device_disconnect(struct snd_card *card, void *device_data);
int snd_device_disconnect_all(struct snd_card *card);
-int snd_device_free(struct snd_card *card, void *device_data);
-int snd_device_free_all(struct snd_card *card, snd_device_cmd_t cmd);
+void snd_device_free(struct snd_card *card, void *device_data);
+void snd_device_free_all(struct snd_card *card);
/* isadma.c */
@@ -433,7 +433,6 @@ static inline void snd_printdd(const char *format, ...) {}
#define gameport_get_port_data(gp) (gp)->port_data
#endif
-#ifdef CONFIG_PCI
/* PCI quirk list helper */
struct snd_pci_quirk {
unsigned short subvendor; /* PCI subvendor ID */
@@ -469,12 +468,26 @@ struct snd_pci_quirk {
#define snd_pci_quirk_name(q) ""
#endif
+#ifdef CONFIG_PCI
const struct snd_pci_quirk *
snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list);
const struct snd_pci_quirk *
snd_pci_quirk_lookup_id(u16 vendor, u16 device,
const struct snd_pci_quirk *list);
+#else
+static inline const struct snd_pci_quirk *
+snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list)
+{
+ return NULL;
+}
+
+static inline const struct snd_pci_quirk *
+snd_pci_quirk_lookup_id(u16 vendor, u16 device,
+ const struct snd_pci_quirk *list)
+{
+ return NULL;
+}
#endif
#endif /* __SOUND_CORE_H */
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index dfb42ca6d043..c46908c1bb3f 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -436,8 +436,6 @@
#define CCCA_CURRADDR_MASK 0x00ffffff /* Current address of the selected channel */
#define CCCA_CURRADDR 0x18000008
-/* undefine CCR to avoid conflict with the definition for SH */
-#undef CCR
#define CCR 0x09 /* Cache control register */
#define CCR_CACHEINVALIDSIZE 0x07190009
#define CCR_CACHEINVALIDSIZE_MASK 0xfe000000 /* Number of invalid samples cache for this channel */
diff --git a/include/sound/hwdep.h b/include/sound/hwdep.h
index 8c05e47a4090..ae04a3ec9c77 100644
--- a/include/sound/hwdep.h
+++ b/include/sound/hwdep.h
@@ -60,7 +60,6 @@ struct snd_hwdep {
int iface;
#ifdef CONFIG_SND_OSSEMUL
- char oss_dev[32];
int oss_type;
int ossreg;
#endif
@@ -69,6 +68,8 @@ struct snd_hwdep {
wait_queue_head_t open_wait;
void *private_data;
void (*private_free) (struct snd_hwdep *hwdep);
+ struct device *dev;
+ const struct attribute_group **groups;
struct mutex open_mutex;
int used; /* reference counter */
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 4883499ab38b..b4d6697085fe 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -1141,4 +1141,12 @@ static inline u64 pcm_format_to_bits(snd_pcm_format_t pcm_format)
return 1ULL << (__force int) pcm_format;
}
+/* printk helpers */
+#define pcm_err(pcm, fmt, args...) \
+ dev_err((pcm)->card->dev, fmt, ##args)
+#define pcm_warn(pcm, fmt, args...) \
+ dev_warn((pcm)->card->dev, fmt, ##args)
+#define pcm_dbg(pcm, fmt, args...) \
+ dev_dbg((pcm)->card->dev, fmt, ##args)
+
#endif /* __SOUND_PCM_H */
diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h
index adf0885153f3..311dafe6cc4b 100644
--- a/include/sound/rawmidi.h
+++ b/include/sound/rawmidi.h
@@ -157,10 +157,8 @@ void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream,
/* callbacks */
-void snd_rawmidi_receive_reset(struct snd_rawmidi_substream *substream);
int snd_rawmidi_receive(struct snd_rawmidi_substream *substream,
const unsigned char *buffer, int count);
-void snd_rawmidi_transmit_reset(struct snd_rawmidi_substream *substream);
int snd_rawmidi_transmit_empty(struct snd_rawmidi_substream *substream);
int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream,
unsigned char *buffer, int count);
OpenPOWER on IntegriCloud