diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-02-17 15:46:37 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-03-23 08:15:51 -0400 |
commit | e3d280fc6d42017b2379503fbda83655a05294fe (patch) | |
tree | cc89c4b22054d620163f0d6bdad901f43957dbf5 /sound/hda | |
parent | 3372dbdd8ca11f51be8c6a30b2bc79eb04c4a902 (diff) |
ALSA: hda - Make snd_hda_bus_type public
Define the common hd-audio driver and device types to bind over
snd_hda_bus_type publicly. This allows to implement other type of
device and driver code over hd-audio bus.
Now both struct hda_codec and struct hda_codec_driver inherit these
new struct hdac_device and struct hdac_driver, respectively.
The bus registration is done in subsys_initcall() to assure it
before any other driver registrations.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/hda')
-rw-r--r-- | sound/hda/Kconfig | 2 | ||||
-rw-r--r-- | sound/hda/Makefile | 3 | ||||
-rw-r--r-- | sound/hda/hda_bus_type.c | 42 |
3 files changed, 47 insertions, 0 deletions
diff --git a/sound/hda/Kconfig b/sound/hda/Kconfig new file mode 100644 index 000000000000..4f428ccf64ad --- /dev/null +++ b/sound/hda/Kconfig | |||
@@ -0,0 +1,2 @@ | |||
1 | config SND_HDA_CORE | ||
2 | tristate | ||
diff --git a/sound/hda/Makefile b/sound/hda/Makefile new file mode 100644 index 000000000000..59c8d1feb5aa --- /dev/null +++ b/sound/hda/Makefile | |||
@@ -0,0 +1,3 @@ | |||
1 | snd-hda-core-objs := hda_bus_type.o | ||
2 | |||
3 | obj-$(CONFIG_SND_HDA_CORE) += snd-hda-core.o | ||
diff --git a/sound/hda/hda_bus_type.c b/sound/hda/hda_bus_type.c new file mode 100644 index 000000000000..519914a12e8a --- /dev/null +++ b/sound/hda/hda_bus_type.c | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * HD-audio bus | ||
3 | */ | ||
4 | #include <linux/init.h> | ||
5 | #include <linux/device.h> | ||
6 | #include <linux/module.h> | ||
7 | #include <linux/export.h> | ||
8 | #include <sound/hdaudio.h> | ||
9 | |||
10 | MODULE_DESCRIPTION("HD-audio bus"); | ||
11 | MODULE_LICENSE("GPL"); | ||
12 | |||
13 | static int hda_bus_match(struct device *dev, struct device_driver *drv) | ||
14 | { | ||
15 | struct hdac_device *hdev = dev_to_hdac_dev(dev); | ||
16 | struct hdac_driver *hdrv = drv_to_hdac_driver(drv); | ||
17 | |||
18 | if (hdev->type != hdrv->type) | ||
19 | return 0; | ||
20 | if (hdrv->match) | ||
21 | return hdrv->match(hdev, hdrv); | ||
22 | return 1; | ||
23 | } | ||
24 | |||
25 | struct bus_type snd_hda_bus_type = { | ||
26 | .name = "hdaudio", | ||
27 | .match = hda_bus_match, | ||
28 | }; | ||
29 | EXPORT_SYMBOL_GPL(snd_hda_bus_type); | ||
30 | |||
31 | static int __init hda_bus_init(void) | ||
32 | { | ||
33 | return bus_register(&snd_hda_bus_type); | ||
34 | } | ||
35 | |||
36 | static void __exit hda_bus_exit(void) | ||
37 | { | ||
38 | bus_unregister(&snd_hda_bus_type); | ||
39 | } | ||
40 | |||
41 | subsys_initcall(hda_bus_init); | ||
42 | module_exit(hda_bus_exit); | ||