aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-11-27 09:47:11 -0500
committerTakashi Iwai <tiwai@suse.de>2008-11-27 09:47:11 -0500
commit1289e9e8b42f973f2ab39e5f4f2239ff826c27e9 (patch)
treef0462154211f734f278e981a5d5ae1ec66f1fb03 /sound
parent30d72e9f614e7bd76e28d4d92bd54d90a96905bb (diff)
ALSA: hda - Modularize HD-audio driver
Split the monolithc HD-audio driver into several pieces: - snd-hda-intel HD-audio PCI controller driver; loaded via udev - snd-hda-codec HD-audio codec bus driver - snd-hda-codec-* Specific HD-audio codec drivers When built as modules, snd-hda-codec (that is invoked by snd-hda-intel) looks up the codec vendor ID and loads the corresponding codec module automatically via request_module(). When built in a kernel, each codec drivers are statically hooked up before probing the PCI. This patch adds appropriate EXPORT_SYMBOL_GPL()'s and the module information for each driver, and driver-linking codes between codec-bus and codec drivers. TODO: - Avoid EXPORT_SYMBOL*() when built-in kernel - Restore __devinit appropriately depending on the condition Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/Kconfig50
-rw-r--r--sound/pci/hda/Makefile77
-rw-r--r--sound/pci/hda/hda_beep.c2
-rw-r--r--sound/pci/hda/hda_codec.c187
-rw-r--r--sound/pci/hda/hda_codec.h11
-rw-r--r--sound/pci/hda/hda_generic.c1
-rw-r--r--sound/pci/hda/hda_hwdep.c2
-rw-r--r--sound/pci/hda/hda_patch.h24
-rw-r--r--sound/pci/hda/patch_analog.c26
-rw-r--r--sound/pci/hda/patch_atihdmi.c31
-rw-r--r--sound/pci/hda/patch_cmedia.c27
-rw-r--r--sound/pci/hda/patch_conexant.c28
-rw-r--r--sound/pci/hda/patch_intelhdmi.c30
-rw-r--r--sound/pci/hda/patch_nvhdmi.c27
-rw-r--r--sound/pci/hda/patch_realtek.c26
-rw-r--r--sound/pci/hda/patch_si3054.c35
-rw-r--r--sound/pci/hda/patch_sigmatel.c27
-rw-r--r--sound/pci/hda/patch_via.c26
18 files changed, 528 insertions, 109 deletions
diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
index 7c60f1a45a8d..717040a491b9 100644
--- a/sound/pci/hda/Kconfig
+++ b/sound/pci/hda/Kconfig
@@ -46,6 +46,11 @@ config SND_HDA_CODEC_REALTEK
46 Say Y here to include Realtek HD-audio codec support in 46 Say Y here to include Realtek HD-audio codec support in
47 snd-hda-intel driver, such as ALC880. 47 snd-hda-intel driver, such as ALC880.
48 48
49 When the HD-audio driver is built as a module, the codec
50 support code is also built as another module,
51 snd-hda-codec-realtek.
52 This module is automatically loaded at probing.
53
49config SND_HDA_CODEC_ANALOG 54config SND_HDA_CODEC_ANALOG
50 bool "Build Analog Device HD-audio codec support" 55 bool "Build Analog Device HD-audio codec support"
51 default y 56 default y
@@ -53,6 +58,11 @@ config SND_HDA_CODEC_ANALOG
53 Say Y here to include Analog Device HD-audio codec support in 58 Say Y here to include Analog Device HD-audio codec support in
54 snd-hda-intel driver, such as AD1986A. 59 snd-hda-intel driver, such as AD1986A.
55 60
61 When the HD-audio driver is built as a module, the codec
62 support code is also built as another module,
63 snd-hda-codec-analog.
64 This module is automatically loaded at probing.
65
56config SND_HDA_CODEC_SIGMATEL 66config SND_HDA_CODEC_SIGMATEL
57 bool "Build IDT/Sigmatel HD-audio codec support" 67 bool "Build IDT/Sigmatel HD-audio codec support"
58 default y 68 default y
@@ -60,6 +70,11 @@ config SND_HDA_CODEC_SIGMATEL
60 Say Y here to include IDT (Sigmatel) HD-audio codec support in 70 Say Y here to include IDT (Sigmatel) HD-audio codec support in
61 snd-hda-intel driver, such as STAC9200. 71 snd-hda-intel driver, such as STAC9200.
62 72
73 When the HD-audio driver is built as a module, the codec
74 support code is also built as another module,
75 snd-hda-codec-idt.
76 This module is automatically loaded at probing.
77
63config SND_HDA_CODEC_VIA 78config SND_HDA_CODEC_VIA
64 bool "Build VIA HD-audio codec support" 79 bool "Build VIA HD-audio codec support"
65 default y 80 default y
@@ -67,6 +82,11 @@ config SND_HDA_CODEC_VIA
67 Say Y here to include VIA HD-audio codec support in 82 Say Y here to include VIA HD-audio codec support in
68 snd-hda-intel driver, such as VT1708. 83 snd-hda-intel driver, such as VT1708.
69 84
85 When the HD-audio driver is built as a module, the codec
86 support code is also built as another module,
87 snd-hda-codec-via.
88 This module is automatically loaded at probing.
89
70config SND_HDA_CODEC_ATIHDMI 90config SND_HDA_CODEC_ATIHDMI
71 bool "Build ATI HDMI HD-audio codec support" 91 bool "Build ATI HDMI HD-audio codec support"
72 default y 92 default y
@@ -74,6 +94,11 @@ config SND_HDA_CODEC_ATIHDMI
74 Say Y here to include ATI HDMI HD-audio codec support in 94 Say Y here to include ATI HDMI HD-audio codec support in
75 snd-hda-intel driver, such as ATI RS600 HDMI. 95 snd-hda-intel driver, such as ATI RS600 HDMI.
76 96
97 When the HD-audio driver is built as a module, the codec
98 support code is also built as another module,
99 snd-hda-codec-atihdmi.
100 This module is automatically loaded at probing.
101
77config SND_HDA_CODEC_NVHDMI 102config SND_HDA_CODEC_NVHDMI
78 bool "Build NVIDIA HDMI HD-audio codec support" 103 bool "Build NVIDIA HDMI HD-audio codec support"
79 default y 104 default y
@@ -81,6 +106,11 @@ config SND_HDA_CODEC_NVHDMI
81 Say Y here to include NVIDIA HDMI HD-audio codec support in 106 Say Y here to include NVIDIA HDMI HD-audio codec support in
82 snd-hda-intel driver, such as NVIDIA MCP78 HDMI. 107 snd-hda-intel driver, such as NVIDIA MCP78 HDMI.
83 108
109 When the HD-audio driver is built as a module, the codec
110 support code is also built as another module,
111 snd-hda-codec-nvhdmi.
112 This module is automatically loaded at probing.
113
84config SND_HDA_CODEC_INTELHDMI 114config SND_HDA_CODEC_INTELHDMI
85 bool "Build INTEL HDMI HD-audio codec support" 115 bool "Build INTEL HDMI HD-audio codec support"
86 default y 116 default y
@@ -88,6 +118,11 @@ config SND_HDA_CODEC_INTELHDMI
88 Say Y here to include INTEL HDMI HD-audio codec support in 118 Say Y here to include INTEL HDMI HD-audio codec support in
89 snd-hda-intel driver, such as Eaglelake integrated HDMI. 119 snd-hda-intel driver, such as Eaglelake integrated HDMI.
90 120
121 When the HD-audio driver is built as a module, the codec
122 support code is also built as another module,
123 snd-hda-codec-intelhdmi.
124 This module is automatically loaded at probing.
125
91config SND_HDA_ELD 126config SND_HDA_ELD
92 def_bool y 127 def_bool y
93 depends on SND_HDA_CODEC_INTELHDMI 128 depends on SND_HDA_CODEC_INTELHDMI
@@ -99,6 +134,11 @@ config SND_HDA_CODEC_CONEXANT
99 Say Y here to include Conexant HD-audio codec support in 134 Say Y here to include Conexant HD-audio codec support in
100 snd-hda-intel driver, such as CX20549. 135 snd-hda-intel driver, such as CX20549.
101 136
137 When the HD-audio driver is built as a module, the codec
138 support code is also built as another module,
139 snd-hda-codec-conexant.
140 This module is automatically loaded at probing.
141
102config SND_HDA_CODEC_CMEDIA 142config SND_HDA_CODEC_CMEDIA
103 bool "Build C-Media HD-audio codec support" 143 bool "Build C-Media HD-audio codec support"
104 default y 144 default y
@@ -106,6 +146,11 @@ config SND_HDA_CODEC_CMEDIA
106 Say Y here to include C-Media HD-audio codec support in 146 Say Y here to include C-Media HD-audio codec support in
107 snd-hda-intel driver, such as CMI9880. 147 snd-hda-intel driver, such as CMI9880.
108 148
149 When the HD-audio driver is built as a module, the codec
150 support code is also built as another module,
151 snd-hda-codec-cmedia.
152 This module is automatically loaded at probing.
153
109config SND_HDA_CODEC_SI3054 154config SND_HDA_CODEC_SI3054
110 bool "Build Silicon Labs 3054 HD-modem codec support" 155 bool "Build Silicon Labs 3054 HD-modem codec support"
111 default y 156 default y
@@ -113,6 +158,11 @@ config SND_HDA_CODEC_SI3054
113 Say Y here to include Silicon Labs 3054 HD-modem codec 158 Say Y here to include Silicon Labs 3054 HD-modem codec
114 (and compatibles) support in snd-hda-intel driver. 159 (and compatibles) support in snd-hda-intel driver.
115 160
161 When the HD-audio driver is built as a module, the codec
162 support code is also built as another module,
163 snd-hda-codec-si3054.
164 This module is automatically loaded at probing.
165
116config SND_HDA_GENERIC 166config SND_HDA_GENERIC
117 bool "Enable generic HD-audio codec parser" 167 bool "Enable generic HD-audio codec parser"
118 default y 168 default y
diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile
index 6daf5fd9a279..50f9d0967251 100644
--- a/sound/pci/hda/Makefile
+++ b/sound/pci/hda/Makefile
@@ -1,22 +1,59 @@
1snd-hda-intel-y := hda_intel.o 1snd-hda-intel-objs := hda_intel.o
2# since snd-hda-intel is the only driver using hda-codec,
3# merge it into a single module although it was originally
4# designed to be individual modules
5snd-hda-intel-y += hda_codec.o
6snd-hda-intel-$(CONFIG_PROC_FS) += hda_proc.o
7snd-hda-intel-$(CONFIG_SND_HDA_ELD) += hda_eld.o
8snd-hda-intel-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o
9snd-hda-intel-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o
10snd-hda-intel-$(CONFIG_SND_HDA_GENERIC) += hda_generic.o
11snd-hda-intel-$(CONFIG_SND_HDA_CODEC_REALTEK) += patch_realtek.o
12snd-hda-intel-$(CONFIG_SND_HDA_CODEC_CMEDIA) += patch_cmedia.o
13snd-hda-intel-$(CONFIG_SND_HDA_CODEC_ANALOG) += patch_analog.o
14snd-hda-intel-$(CONFIG_SND_HDA_CODEC_SIGMATEL) += patch_sigmatel.o
15snd-hda-intel-$(CONFIG_SND_HDA_CODEC_SI3054) += patch_si3054.o
16snd-hda-intel-$(CONFIG_SND_HDA_CODEC_ATIHDMI) += patch_atihdmi.o
17snd-hda-intel-$(CONFIG_SND_HDA_CODEC_CONEXANT) += patch_conexant.o
18snd-hda-intel-$(CONFIG_SND_HDA_CODEC_VIA) += patch_via.o
19snd-hda-intel-$(CONFIG_SND_HDA_CODEC_NVHDMI) += patch_nvhdmi.o
20snd-hda-intel-$(CONFIG_SND_HDA_CODEC_INTELHDMI) += patch_intelhdmi.o
21 2
3snd-hda-codec-y := hda_codec.o
4snd-hda-codec-$(CONFIG_SND_HDA_GENERIC) += hda_generic.o
5snd-hda-codec-$(CONFIG_PROC_FS) += hda_proc.o
6# snd-hda-codec-$(CONFIG_SND_HDA_ELD) += hda_eld.o
7snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o
8snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o
9
10snd-hda-codec-realtek-objs := patch_realtek.o
11snd-hda-codec-cmedia-objs := patch_cmedia.o
12snd-hda-codec-analog-objs := patch_analog.o
13snd-hda-codec-idt-objs := patch_sigmatel.o
14snd-hda-codec-si3054-objs := patch_si3054.o
15snd-hda-codec-atihdmi-objs := patch_atihdmi.o
16snd-hda-codec-conexant-objs := patch_conexant.o
17snd-hda-codec-via-objs := patch_via.o
18snd-hda-codec-nvhdmi-objs := patch_nvhdmi.o
19snd-hda-codec-intelhdmi-objs := patch_intelhdmi.o hda_eld.o
20
21# common driver
22obj-$(CONFIG_SND_HDA_INTEL) := snd-hda-codec.o
23
24# codec drivers (note: CONFIG_SND_HDA_CODEC_XXX are booleans)
25ifdef CONFIG_SND_HDA_CODEC_REALTEK
26obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-realtek.o
27endif
28ifdef CONFIG_SND_HDA_CODEC_CMEDIA
29obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-cmedia.o
30endif
31ifdef CONFIG_SND_HDA_CODEC_ANALOG
32obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-analog.o
33endif
34ifdef CONFIG_SND_HDA_CODEC_SIGMATEL
35obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-idt.o
36endif
37ifdef CONFIG_SND_HDA_CODEC_SI3054
38obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-si3054.o
39endif
40ifdef CONFIG_SND_HDA_CODEC_ATIHDMI
41obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-atihdmi.o
42endif
43ifdef CONFIG_SND_HDA_CODEC_CONEXANT
44obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-conexant.o
45endif
46ifdef CONFIG_SND_HDA_CODEC_VIA
47obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-via.o
48endif
49ifdef CONFIG_SND_HDA_CODEC_NVHDMI
50obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-nvhdmi.o
51endif
52ifdef CONFIG_SND_HDA_CODEC_INTELHDMI
53obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-intelhdmi.o
54endif
55
56# this must be the last entry after codec drivers;
57# otherwise the codec patches won't be hooked before the PCI probe
58# when built in kernel
22obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-intel.o 59obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-intel.o
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c
index 3ecd7e797dee..e6cc9463667a 100644
--- a/sound/pci/hda/hda_beep.c
+++ b/sound/pci/hda/hda_beep.c
@@ -128,6 +128,7 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
128 INIT_WORK(&beep->beep_work, &snd_hda_generate_beep); 128 INIT_WORK(&beep->beep_work, &snd_hda_generate_beep);
129 return 0; 129 return 0;
130} 130}
131EXPORT_SYMBOL_GPL(snd_hda_attach_beep_device);
131 132
132void snd_hda_detach_beep_device(struct hda_codec *codec) 133void snd_hda_detach_beep_device(struct hda_codec *codec)
133{ 134{
@@ -140,3 +141,4 @@ void snd_hda_detach_beep_device(struct hda_codec *codec)
140 kfree(beep); 141 kfree(beep);
141 } 142 }
142} 143}
144EXPORT_SYMBOL_GPL(snd_hda_detach_beep_device);
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 1cb85b73e19b..4aa7b1b72877 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -31,7 +31,6 @@
31#include <sound/initval.h> 31#include <sound/initval.h>
32#include "hda_local.h" 32#include "hda_local.h"
33#include <sound/hda_hwdep.h> 33#include <sound/hda_hwdep.h>
34#include "hda_patch.h" /* codec presets */
35 34
36/* 35/*
37 * vendor / preset table 36 * vendor / preset table
@@ -62,39 +61,26 @@ static struct hda_vendor_id hda_vendor_ids[] = {
62 {} /* terminator */ 61 {} /* terminator */
63}; 62};
64 63
65static const struct hda_codec_preset *hda_preset_tables[] = { 64static DEFINE_MUTEX(preset_mutex);
66#ifdef CONFIG_SND_HDA_CODEC_REALTEK 65static LIST_HEAD(hda_preset_tables);
67 snd_hda_preset_realtek, 66
68#endif 67int snd_hda_add_codec_preset(struct hda_codec_preset_list *preset)
69#ifdef CONFIG_SND_HDA_CODEC_CMEDIA 68{
70 snd_hda_preset_cmedia, 69 mutex_lock(&preset_mutex);
71#endif 70 list_add_tail(&preset->list, &hda_preset_tables);
72#ifdef CONFIG_SND_HDA_CODEC_ANALOG 71 mutex_unlock(&preset_mutex);
73 snd_hda_preset_analog, 72 return 0;
74#endif 73}
75#ifdef CONFIG_SND_HDA_CODEC_SIGMATEL 74EXPORT_SYMBOL_GPL(snd_hda_add_codec_preset);
76 snd_hda_preset_sigmatel, 75
77#endif 76int snd_hda_delete_codec_preset(struct hda_codec_preset_list *preset)
78#ifdef CONFIG_SND_HDA_CODEC_SI3054 77{
79 snd_hda_preset_si3054, 78 mutex_lock(&preset_mutex);
80#endif 79 list_del(&preset->list);
81#ifdef CONFIG_SND_HDA_CODEC_ATIHDMI 80 mutex_unlock(&preset_mutex);
82 snd_hda_preset_atihdmi, 81 return 0;
83#endif 82}
84#ifdef CONFIG_SND_HDA_CODEC_CONEXANT 83EXPORT_SYMBOL_GPL(snd_hda_delete_codec_preset);
85 snd_hda_preset_conexant,
86#endif
87#ifdef CONFIG_SND_HDA_CODEC_VIA
88 snd_hda_preset_via,
89#endif
90#ifdef CONFIG_SND_HDA_CODEC_NVHDMI
91 snd_hda_preset_nvhdmi,
92#endif
93#ifdef CONFIG_SND_HDA_CODEC_INTELHDMI
94 snd_hda_preset_intelhdmi,
95#endif
96 NULL
97};
98 84
99#ifdef CONFIG_SND_HDA_POWER_SAVE 85#ifdef CONFIG_SND_HDA_POWER_SAVE
100static void hda_power_work(struct work_struct *work); 86static void hda_power_work(struct work_struct *work);
@@ -128,6 +114,7 @@ const char *snd_hda_get_jack_location(u32 cfg)
128 } 114 }
129 return "UNKNOWN"; 115 return "UNKNOWN";
130} 116}
117EXPORT_SYMBOL_GPL(snd_hda_get_jack_location);
131 118
132const char *snd_hda_get_jack_connectivity(u32 cfg) 119const char *snd_hda_get_jack_connectivity(u32 cfg)
133{ 120{
@@ -135,6 +122,7 @@ const char *snd_hda_get_jack_connectivity(u32 cfg)
135 122
136 return jack_locations[(cfg >> (AC_DEFCFG_LOCATION_SHIFT + 4)) & 3]; 123 return jack_locations[(cfg >> (AC_DEFCFG_LOCATION_SHIFT + 4)) & 3];
137} 124}
125EXPORT_SYMBOL_GPL(snd_hda_get_jack_connectivity);
138 126
139const char *snd_hda_get_jack_type(u32 cfg) 127const char *snd_hda_get_jack_type(u32 cfg)
140{ 128{
@@ -148,6 +136,7 @@ const char *snd_hda_get_jack_type(u32 cfg)
148 return jack_types[(cfg & AC_DEFCFG_DEVICE) 136 return jack_types[(cfg & AC_DEFCFG_DEVICE)
149 >> AC_DEFCFG_DEVICE_SHIFT]; 137 >> AC_DEFCFG_DEVICE_SHIFT];
150} 138}
139EXPORT_SYMBOL_GPL(snd_hda_get_jack_type);
151 140
152/* 141/*
153 * Compose a 32bit command word to be sent to the HD-audio controller 142 * Compose a 32bit command word to be sent to the HD-audio controller
@@ -196,6 +185,7 @@ unsigned int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid,
196 snd_hda_power_down(codec); 185 snd_hda_power_down(codec);
197 return res; 186 return res;
198} 187}
188EXPORT_SYMBOL_GPL(snd_hda_codec_read);
199 189
200/** 190/**
201 * snd_hda_codec_write - send a single command without waiting for response 191 * snd_hda_codec_write - send a single command without waiting for response
@@ -224,6 +214,7 @@ int snd_hda_codec_write(struct hda_codec *codec, hda_nid_t nid, int direct,
224 snd_hda_power_down(codec); 214 snd_hda_power_down(codec);
225 return err; 215 return err;
226} 216}
217EXPORT_SYMBOL_GPL(snd_hda_codec_write);
227 218
228/** 219/**
229 * snd_hda_sequence_write - sequence writes 220 * snd_hda_sequence_write - sequence writes
@@ -238,6 +229,7 @@ void snd_hda_sequence_write(struct hda_codec *codec, const struct hda_verb *seq)
238 for (; seq->nid; seq++) 229 for (; seq->nid; seq++)
239 snd_hda_codec_write(codec, seq->nid, 0, seq->verb, seq->param); 230 snd_hda_codec_write(codec, seq->nid, 0, seq->verb, seq->param);
240} 231}
232EXPORT_SYMBOL_GPL(snd_hda_sequence_write);
241 233
242/** 234/**
243 * snd_hda_get_sub_nodes - get the range of sub nodes 235 * snd_hda_get_sub_nodes - get the range of sub nodes
@@ -259,6 +251,7 @@ int snd_hda_get_sub_nodes(struct hda_codec *codec, hda_nid_t nid,
259 *start_id = (parm >> 16) & 0x7fff; 251 *start_id = (parm >> 16) & 0x7fff;
260 return (int)(parm & 0x7fff); 252 return (int)(parm & 0x7fff);
261} 253}
254EXPORT_SYMBOL_GPL(snd_hda_get_sub_nodes);
262 255
263/** 256/**
264 * snd_hda_get_connections - get connection list 257 * snd_hda_get_connections - get connection list
@@ -347,6 +340,7 @@ int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid,
347 } 340 }
348 return conns; 341 return conns;
349} 342}
343EXPORT_SYMBOL_GPL(snd_hda_get_connections);
350 344
351 345
352/** 346/**
@@ -381,6 +375,7 @@ int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex)
381 375
382 return 0; 376 return 0;
383} 377}
378EXPORT_SYMBOL_GPL(snd_hda_queue_unsol_event);
384 379
385/* 380/*
386 * process queued unsolicited events 381 * process queued unsolicited events
@@ -482,7 +477,7 @@ static int snd_hda_bus_dev_register(struct snd_device *device)
482 * 477 *
483 * Returns 0 if successful, or a negative error code. 478 * Returns 0 if successful, or a negative error code.
484 */ 479 */
485int __devinit snd_hda_bus_new(struct snd_card *card, 480int /*__devinit*/ snd_hda_bus_new(struct snd_card *card,
486 const struct hda_bus_template *temp, 481 const struct hda_bus_template *temp,
487 struct hda_bus **busp) 482 struct hda_bus **busp)
488{ 483{
@@ -526,6 +521,7 @@ int __devinit snd_hda_bus_new(struct snd_card *card,
526 *busp = bus; 521 *busp = bus;
527 return 0; 522 return 0;
528} 523}
524EXPORT_SYMBOL_GPL(snd_hda_bus_new);
529 525
530#ifdef CONFIG_SND_HDA_GENERIC 526#ifdef CONFIG_SND_HDA_GENERIC
531#define is_generic_config(codec) \ 527#define is_generic_config(codec) \
@@ -534,19 +530,33 @@ int __devinit snd_hda_bus_new(struct snd_card *card,
534#define is_generic_config(codec) 0 530#define is_generic_config(codec) 0
535#endif 531#endif
536 532
533#ifdef CONFIG_SND_HDA_INTEL_MODULE
534#define HDA_MODREQ_MAX_COUNT 2 /* two request_modules()'s */
535#else
536#define HDA_MODREQ_MAX_COUNT 0
537#endif
538
537/* 539/*
538 * find a matching codec preset 540 * find a matching codec preset
539 */ 541 */
540static const struct hda_codec_preset * 542static const struct hda_codec_preset *
541find_codec_preset(struct hda_codec *codec) 543find_codec_preset(struct hda_codec *codec)
542{ 544{
543 const struct hda_codec_preset **tbl, *preset; 545 struct hda_codec_preset_list *tbl;
546 const struct hda_codec_preset *preset;
547 int mod_requested = 0;
544 548
545 if (is_generic_config(codec)) 549 if (is_generic_config(codec))
546 return NULL; /* use the generic parser */ 550 return NULL; /* use the generic parser */
547 551
548 for (tbl = hda_preset_tables; *tbl; tbl++) { 552 again:
549 for (preset = *tbl; preset->id; preset++) { 553 mutex_lock(&preset_mutex);
554 list_for_each_entry(tbl, &hda_preset_tables, list) {
555 if (!try_module_get(tbl->owner)) {
556 snd_printk(KERN_ERR "hda_codec: cannot module_get\n");
557 continue;
558 }
559 for (preset = tbl->preset; preset->id; preset++) {
550 u32 mask = preset->mask; 560 u32 mask = preset->mask;
551 if (preset->afg && preset->afg != codec->afg) 561 if (preset->afg && preset->afg != codec->afg)
552 continue; 562 continue;
@@ -556,9 +566,27 @@ find_codec_preset(struct hda_codec *codec)
556 mask = ~0; 566 mask = ~0;
557 if (preset->id == (codec->vendor_id & mask) && 567 if (preset->id == (codec->vendor_id & mask) &&
558 (!preset->rev || 568 (!preset->rev ||
559 preset->rev == codec->revision_id)) 569 preset->rev == codec->revision_id)) {
570 mutex_unlock(&preset_mutex);
571 codec->owner = tbl->owner;
560 return preset; 572 return preset;
573 }
561 } 574 }
575 module_put(tbl->owner);
576 }
577 mutex_unlock(&preset_mutex);
578
579 if (mod_requested < HDA_MODREQ_MAX_COUNT) {
580 char name[32];
581 if (!mod_requested)
582 snprintf(name, sizeof(name), "snd-hda-codec-id:%08x",
583 codec->vendor_id);
584 else
585 snprintf(name, sizeof(name), "snd-hda-codec-id:%04x*",
586 (codec->vendor_id >> 16) & 0xffff);
587 request_module(name);
588 mod_requested++;
589 goto again;
562 } 590 }
563 return NULL; 591 return NULL;
564} 592}
@@ -598,7 +626,7 @@ static int get_codec_name(struct hda_codec *codec)
598/* 626/*
599 * look for an AFG and MFG nodes 627 * look for an AFG and MFG nodes
600 */ 628 */
601static void __devinit setup_fg_nodes(struct hda_codec *codec) 629static void /*__devinit*/ setup_fg_nodes(struct hda_codec *codec)
602{ 630{
603 int i, total_nodes; 631 int i, total_nodes;
604 hda_nid_t nid; 632 hda_nid_t nid;
@@ -661,6 +689,7 @@ static void snd_hda_codec_free(struct hda_codec *codec)
661 codec->bus->caddr_tbl[codec->addr] = NULL; 689 codec->bus->caddr_tbl[codec->addr] = NULL;
662 if (codec->patch_ops.free) 690 if (codec->patch_ops.free)
663 codec->patch_ops.free(codec); 691 codec->patch_ops.free(codec);
692 module_put(codec->owner);
664 free_hda_cache(&codec->amp_cache); 693 free_hda_cache(&codec->amp_cache);
665 free_hda_cache(&codec->cmd_cache); 694 free_hda_cache(&codec->cmd_cache);
666 kfree(codec->name); 695 kfree(codec->name);
@@ -677,7 +706,7 @@ static void snd_hda_codec_free(struct hda_codec *codec)
677 * 706 *
678 * Returns 0 if successful, or a negative error code. 707 * Returns 0 if successful, or a negative error code.
679 */ 708 */
680int __devinit snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, 709int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr,
681 struct hda_codec **codecp) 710 struct hda_codec **codecp)
682{ 711{
683 struct hda_codec *codec; 712 struct hda_codec *codec;
@@ -779,6 +808,7 @@ int __devinit snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr,
779 *codecp = codec; 808 *codecp = codec;
780 return 0; 809 return 0;
781} 810}
811EXPORT_SYMBOL_GPL(snd_hda_codec_new);
782 812
783int snd_hda_codec_configure(struct hda_codec *codec) 813int snd_hda_codec_configure(struct hda_codec *codec)
784{ 814{
@@ -838,6 +868,7 @@ void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid,
838 msleep(1); 868 msleep(1);
839 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, format); 869 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, format);
840} 870}
871EXPORT_SYMBOL_GPL(snd_hda_codec_setup_stream);
841 872
842void snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid) 873void snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid)
843{ 874{
@@ -851,6 +882,7 @@ void snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid)
851 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, 0); 882 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, 0);
852#endif 883#endif
853} 884}
885EXPORT_SYMBOL_GPL(snd_hda_codec_cleanup_stream);
854 886
855/* 887/*
856 * amp access functions 888 * amp access functions
@@ -862,7 +894,7 @@ void snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid)
862#define INFO_AMP_VOL(ch) (1 << (1 + (ch))) 894#define INFO_AMP_VOL(ch) (1 << (1 + (ch)))
863 895
864/* initialize the hash table */ 896/* initialize the hash table */
865static void __devinit init_hda_cache(struct hda_cache_rec *cache, 897static void /*__devinit*/ init_hda_cache(struct hda_cache_rec *cache,
866 unsigned int record_size) 898 unsigned int record_size)
867{ 899{
868 memset(cache, 0, sizeof(*cache)); 900 memset(cache, 0, sizeof(*cache));
@@ -932,6 +964,7 @@ u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction)
932 } 964 }
933 return info->amp_caps; 965 return info->amp_caps;
934} 966}
967EXPORT_SYMBOL_GPL(query_amp_caps);
935 968
936int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, 969int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
937 unsigned int caps) 970 unsigned int caps)
@@ -945,6 +978,7 @@ int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
945 info->head.val |= INFO_AMP_CAPS; 978 info->head.val |= INFO_AMP_CAPS;
946 return 0; 979 return 0;
947} 980}
981EXPORT_SYMBOL_GPL(snd_hda_override_amp_caps);
948 982
949/* 983/*
950 * read the current volume to info 984 * read the current volume to info
@@ -998,6 +1032,7 @@ int snd_hda_codec_amp_read(struct hda_codec *codec, hda_nid_t nid, int ch,
998 return 0; 1032 return 0;
999 return get_vol_mute(codec, info, nid, ch, direction, index); 1033 return get_vol_mute(codec, info, nid, ch, direction, index);
1000} 1034}
1035EXPORT_SYMBOL_GPL(snd_hda_codec_amp_read);
1001 1036
1002/* 1037/*
1003 * update the AMP value, mask = bit mask to set, val = the value 1038 * update the AMP value, mask = bit mask to set, val = the value
@@ -1017,6 +1052,7 @@ int snd_hda_codec_amp_update(struct hda_codec *codec, hda_nid_t nid, int ch,
1017 put_vol_mute(codec, info, nid, ch, direction, idx, val); 1052 put_vol_mute(codec, info, nid, ch, direction, idx, val);
1018 return 1; 1053 return 1;
1019} 1054}
1055EXPORT_SYMBOL_GPL(snd_hda_codec_amp_update);
1020 1056
1021/* 1057/*
1022 * update the AMP stereo with the same mask and value 1058 * update the AMP stereo with the same mask and value
@@ -1030,6 +1066,7 @@ int snd_hda_codec_amp_stereo(struct hda_codec *codec, hda_nid_t nid,
1030 idx, mask, val); 1066 idx, mask, val);
1031 return ret; 1067 return ret;
1032} 1068}
1069EXPORT_SYMBOL_GPL(snd_hda_codec_amp_stereo);
1033 1070
1034#ifdef SND_HDA_NEEDS_RESUME 1071#ifdef SND_HDA_NEEDS_RESUME
1035/* resume the all amp commands from the cache */ 1072/* resume the all amp commands from the cache */
@@ -1055,6 +1092,7 @@ void snd_hda_codec_resume_amp(struct hda_codec *codec)
1055 } 1092 }
1056 } 1093 }
1057} 1094}
1095EXPORT_SYMBOL_GPL(snd_hda_codec_resume_amp);
1058#endif /* SND_HDA_NEEDS_RESUME */ 1096#endif /* SND_HDA_NEEDS_RESUME */
1059 1097
1060/* volume */ 1098/* volume */
@@ -1082,6 +1120,7 @@ int snd_hda_mixer_amp_volume_info(struct snd_kcontrol *kcontrol,
1082 uinfo->value.integer.max = caps; 1120 uinfo->value.integer.max = caps;
1083 return 0; 1121 return 0;
1084} 1122}
1123EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_volume_info);
1085 1124
1086int snd_hda_mixer_amp_volume_get(struct snd_kcontrol *kcontrol, 1125int snd_hda_mixer_amp_volume_get(struct snd_kcontrol *kcontrol,
1087 struct snd_ctl_elem_value *ucontrol) 1126 struct snd_ctl_elem_value *ucontrol)
@@ -1101,6 +1140,7 @@ int snd_hda_mixer_amp_volume_get(struct snd_kcontrol *kcontrol,
1101 & HDA_AMP_VOLMASK; 1140 & HDA_AMP_VOLMASK;
1102 return 0; 1141 return 0;
1103} 1142}
1143EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_volume_get);
1104 1144
1105int snd_hda_mixer_amp_volume_put(struct snd_kcontrol *kcontrol, 1145int snd_hda_mixer_amp_volume_put(struct snd_kcontrol *kcontrol,
1106 struct snd_ctl_elem_value *ucontrol) 1146 struct snd_ctl_elem_value *ucontrol)
@@ -1125,6 +1165,7 @@ int snd_hda_mixer_amp_volume_put(struct snd_kcontrol *kcontrol,
1125 snd_hda_power_down(codec); 1165 snd_hda_power_down(codec);
1126 return change; 1166 return change;
1127} 1167}
1168EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_volume_put);
1128 1169
1129int snd_hda_mixer_amp_tlv(struct snd_kcontrol *kcontrol, int op_flag, 1170int snd_hda_mixer_amp_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1130 unsigned int size, unsigned int __user *_tlv) 1171 unsigned int size, unsigned int __user *_tlv)
@@ -1151,6 +1192,7 @@ int snd_hda_mixer_amp_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1151 return -EFAULT; 1192 return -EFAULT;
1152 return 0; 1193 return 0;
1153} 1194}
1195EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_tlv);
1154 1196
1155/* 1197/*
1156 * set (static) TLV for virtual master volume; recalculated as max 0dB 1198 * set (static) TLV for virtual master volume; recalculated as max 0dB
@@ -1170,6 +1212,7 @@ void snd_hda_set_vmaster_tlv(struct hda_codec *codec, hda_nid_t nid, int dir,
1170 tlv[2] = -nums * step; 1212 tlv[2] = -nums * step;
1171 tlv[3] = step; 1213 tlv[3] = step;
1172} 1214}
1215EXPORT_SYMBOL_GPL(snd_hda_set_vmaster_tlv);
1173 1216
1174/* find a mixer control element with the given name */ 1217/* find a mixer control element with the given name */
1175static struct snd_kcontrol * 1218static struct snd_kcontrol *
@@ -1189,6 +1232,7 @@ struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec,
1189{ 1232{
1190 return _snd_hda_find_mixer_ctl(codec, name, 0); 1233 return _snd_hda_find_mixer_ctl(codec, name, 0);
1191} 1234}
1235EXPORT_SYMBOL_GPL(snd_hda_find_mixer_ctl);
1192 1236
1193/* Add a control element and assign to the codec */ 1237/* Add a control element and assign to the codec */
1194int snd_hda_ctl_add(struct hda_codec *codec, struct snd_kcontrol *kctl) 1238int snd_hda_ctl_add(struct hda_codec *codec, struct snd_kcontrol *kctl)
@@ -1205,6 +1249,7 @@ int snd_hda_ctl_add(struct hda_codec *codec, struct snd_kcontrol *kctl)
1205 *knewp = kctl; 1249 *knewp = kctl;
1206 return 0; 1250 return 0;
1207} 1251}
1252EXPORT_SYMBOL_GPL(snd_hda_ctl_add);
1208 1253
1209#ifdef CONFIG_SND_HDA_RECONFIG 1254#ifdef CONFIG_SND_HDA_RECONFIG
1210/* Clear all controls assigned to the given codec */ 1255/* Clear all controls assigned to the given codec */
@@ -1243,6 +1288,8 @@ void snd_hda_codec_reset(struct hda_codec *codec)
1243 codec->num_pcms = 0; 1288 codec->num_pcms = 0;
1244 codec->pcm_info = NULL; 1289 codec->pcm_info = NULL;
1245 codec->preset = NULL; 1290 codec->preset = NULL;
1291 module_put(codec->owner);
1292 codec->owner = NULL;
1246} 1293}
1247#endif /* CONFIG_SND_HDA_RECONFIG */ 1294#endif /* CONFIG_SND_HDA_RECONFIG */
1248 1295
@@ -1281,6 +1328,7 @@ int snd_hda_add_vmaster(struct hda_codec *codec, char *name,
1281 } 1328 }
1282 return 0; 1329 return 0;
1283} 1330}
1331EXPORT_SYMBOL_GPL(snd_hda_add_vmaster);
1284 1332
1285/* switch */ 1333/* switch */
1286int snd_hda_mixer_amp_switch_info(struct snd_kcontrol *kcontrol, 1334int snd_hda_mixer_amp_switch_info(struct snd_kcontrol *kcontrol,
@@ -1294,6 +1342,7 @@ int snd_hda_mixer_amp_switch_info(struct snd_kcontrol *kcontrol,
1294 uinfo->value.integer.max = 1; 1342 uinfo->value.integer.max = 1;
1295 return 0; 1343 return 0;
1296} 1344}
1345EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_switch_info);
1297 1346
1298int snd_hda_mixer_amp_switch_get(struct snd_kcontrol *kcontrol, 1347int snd_hda_mixer_amp_switch_get(struct snd_kcontrol *kcontrol,
1299 struct snd_ctl_elem_value *ucontrol) 1348 struct snd_ctl_elem_value *ucontrol)
@@ -1313,6 +1362,7 @@ int snd_hda_mixer_amp_switch_get(struct snd_kcontrol *kcontrol,
1313 HDA_AMP_MUTE) ? 0 : 1; 1362 HDA_AMP_MUTE) ? 0 : 1;
1314 return 0; 1363 return 0;
1315} 1364}
1365EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_switch_get);
1316 1366
1317int snd_hda_mixer_amp_switch_put(struct snd_kcontrol *kcontrol, 1367int snd_hda_mixer_amp_switch_put(struct snd_kcontrol *kcontrol,
1318 struct snd_ctl_elem_value *ucontrol) 1368 struct snd_ctl_elem_value *ucontrol)
@@ -1343,6 +1393,7 @@ int snd_hda_mixer_amp_switch_put(struct snd_kcontrol *kcontrol,
1343 snd_hda_power_down(codec); 1393 snd_hda_power_down(codec);
1344 return change; 1394 return change;
1345} 1395}
1396EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_switch_put);
1346 1397
1347/* 1398/*
1348 * bound volume controls 1399 * bound volume controls
@@ -1368,6 +1419,7 @@ int snd_hda_mixer_bind_switch_get(struct snd_kcontrol *kcontrol,
1368 mutex_unlock(&codec->spdif_mutex); 1419 mutex_unlock(&codec->spdif_mutex);
1369 return err; 1420 return err;
1370} 1421}
1422EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_switch_get);
1371 1423
1372int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol, 1424int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol,
1373 struct snd_ctl_elem_value *ucontrol) 1425 struct snd_ctl_elem_value *ucontrol)
@@ -1391,6 +1443,7 @@ int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol,
1391 mutex_unlock(&codec->spdif_mutex); 1443 mutex_unlock(&codec->spdif_mutex);
1392 return err < 0 ? err : change; 1444 return err < 0 ? err : change;
1393} 1445}
1446EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_switch_put);
1394 1447
1395/* 1448/*
1396 * generic bound volume/swtich controls 1449 * generic bound volume/swtich controls
@@ -1410,6 +1463,7 @@ int snd_hda_mixer_bind_ctls_info(struct snd_kcontrol *kcontrol,
1410 mutex_unlock(&codec->spdif_mutex); 1463 mutex_unlock(&codec->spdif_mutex);
1411 return err; 1464 return err;
1412} 1465}
1466EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_ctls_info);
1413 1467
1414int snd_hda_mixer_bind_ctls_get(struct snd_kcontrol *kcontrol, 1468int snd_hda_mixer_bind_ctls_get(struct snd_kcontrol *kcontrol,
1415 struct snd_ctl_elem_value *ucontrol) 1469 struct snd_ctl_elem_value *ucontrol)
@@ -1426,6 +1480,7 @@ int snd_hda_mixer_bind_ctls_get(struct snd_kcontrol *kcontrol,
1426 mutex_unlock(&codec->spdif_mutex); 1480 mutex_unlock(&codec->spdif_mutex);
1427 return err; 1481 return err;
1428} 1482}
1483EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_ctls_get);
1429 1484
1430int snd_hda_mixer_bind_ctls_put(struct snd_kcontrol *kcontrol, 1485int snd_hda_mixer_bind_ctls_put(struct snd_kcontrol *kcontrol,
1431 struct snd_ctl_elem_value *ucontrol) 1486 struct snd_ctl_elem_value *ucontrol)
@@ -1448,6 +1503,7 @@ int snd_hda_mixer_bind_ctls_put(struct snd_kcontrol *kcontrol,
1448 mutex_unlock(&codec->spdif_mutex); 1503 mutex_unlock(&codec->spdif_mutex);
1449 return err < 0 ? err : change; 1504 return err < 0 ? err : change;
1450} 1505}
1506EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_ctls_put);
1451 1507
1452int snd_hda_mixer_bind_tlv(struct snd_kcontrol *kcontrol, int op_flag, 1508int snd_hda_mixer_bind_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1453 unsigned int size, unsigned int __user *tlv) 1509 unsigned int size, unsigned int __user *tlv)
@@ -1464,6 +1520,7 @@ int snd_hda_mixer_bind_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1464 mutex_unlock(&codec->spdif_mutex); 1520 mutex_unlock(&codec->spdif_mutex);
1465 return err; 1521 return err;
1466} 1522}
1523EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_tlv);
1467 1524
1468struct hda_ctl_ops snd_hda_bind_vol = { 1525struct hda_ctl_ops snd_hda_bind_vol = {
1469 .info = snd_hda_mixer_amp_volume_info, 1526 .info = snd_hda_mixer_amp_volume_info,
@@ -1471,6 +1528,7 @@ struct hda_ctl_ops snd_hda_bind_vol = {
1471 .put = snd_hda_mixer_amp_volume_put, 1528 .put = snd_hda_mixer_amp_volume_put,
1472 .tlv = snd_hda_mixer_amp_tlv 1529 .tlv = snd_hda_mixer_amp_tlv
1473}; 1530};
1531EXPORT_SYMBOL_GPL(snd_hda_bind_vol);
1474 1532
1475struct hda_ctl_ops snd_hda_bind_sw = { 1533struct hda_ctl_ops snd_hda_bind_sw = {
1476 .info = snd_hda_mixer_amp_switch_info, 1534 .info = snd_hda_mixer_amp_switch_info,
@@ -1478,6 +1536,7 @@ struct hda_ctl_ops snd_hda_bind_sw = {
1478 .put = snd_hda_mixer_amp_switch_put, 1536 .put = snd_hda_mixer_amp_switch_put,
1479 .tlv = snd_hda_mixer_amp_tlv 1537 .tlv = snd_hda_mixer_amp_tlv
1480}; 1538};
1539EXPORT_SYMBOL_GPL(snd_hda_bind_sw);
1481 1540
1482/* 1541/*
1483 * SPDIF out controls 1542 * SPDIF out controls
@@ -1739,6 +1798,7 @@ int snd_hda_create_spdif_out_ctls(struct hda_codec *codec, hda_nid_t nid)
1739 codec->spdif_status = convert_to_spdif_status(codec->spdif_ctls); 1798 codec->spdif_status = convert_to_spdif_status(codec->spdif_ctls);
1740 return 0; 1799 return 0;
1741} 1800}
1801EXPORT_SYMBOL_GPL(snd_hda_create_spdif_out_ctls);
1742 1802
1743/* 1803/*
1744 * SPDIF sharing with analog output 1804 * SPDIF sharing with analog output
@@ -1776,6 +1836,7 @@ int snd_hda_create_spdif_share_sw(struct hda_codec *codec,
1776 return snd_hda_ctl_add(codec, 1836 return snd_hda_ctl_add(codec,
1777 snd_ctl_new1(&spdif_share_sw, mout)); 1837 snd_ctl_new1(&spdif_share_sw, mout));
1778} 1838}
1839EXPORT_SYMBOL_GPL(snd_hda_create_spdif_share_sw);
1779 1840
1780/* 1841/*
1781 * SPDIF input 1842 * SPDIF input
@@ -1885,6 +1946,7 @@ int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid)
1885 AC_DIG1_ENABLE; 1946 AC_DIG1_ENABLE;
1886 return 0; 1947 return 0;
1887} 1948}
1949EXPORT_SYMBOL_GPL(snd_hda_create_spdif_in_ctls);
1888 1950
1889#ifdef SND_HDA_NEEDS_RESUME 1951#ifdef SND_HDA_NEEDS_RESUME
1890/* 1952/*
@@ -1930,6 +1992,7 @@ int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid,
1930 snd_hda_power_down(codec); 1992 snd_hda_power_down(codec);
1931 return err; 1993 return err;
1932} 1994}
1995EXPORT_SYMBOL_GPL(snd_hda_codec_write_cache);
1933 1996
1934/* resume the all commands from the cache */ 1997/* resume the all commands from the cache */
1935void snd_hda_codec_resume_cache(struct hda_codec *codec) 1998void snd_hda_codec_resume_cache(struct hda_codec *codec)
@@ -1945,6 +2008,7 @@ void snd_hda_codec_resume_cache(struct hda_codec *codec)
1945 get_cmd_cache_cmd(key), buffer->val); 2008 get_cmd_cache_cmd(key), buffer->val);
1946 } 2009 }
1947} 2010}
2011EXPORT_SYMBOL_GPL(snd_hda_codec_resume_cache);
1948 2012
1949/** 2013/**
1950 * snd_hda_sequence_write_cache - sequence writes with caching 2014 * snd_hda_sequence_write_cache - sequence writes with caching
@@ -1962,6 +2026,7 @@ void snd_hda_sequence_write_cache(struct hda_codec *codec,
1962 snd_hda_codec_write_cache(codec, seq->nid, 0, seq->verb, 2026 snd_hda_codec_write_cache(codec, seq->nid, 0, seq->verb,
1963 seq->param); 2027 seq->param);
1964} 2028}
2029EXPORT_SYMBOL_GPL(snd_hda_sequence_write_cache);
1965#endif /* SND_HDA_NEEDS_RESUME */ 2030#endif /* SND_HDA_NEEDS_RESUME */
1966 2031
1967/* 2032/*
@@ -2080,7 +2145,7 @@ static void hda_call_codec_resume(struct hda_codec *codec)
2080 * 2145 *
2081 * Returns 0 if successful, otherwise a negative error code. 2146 * Returns 0 if successful, otherwise a negative error code.
2082 */ 2147 */
2083int __devinit snd_hda_build_controls(struct hda_bus *bus) 2148int /*__devinit*/ snd_hda_build_controls(struct hda_bus *bus)
2084{ 2149{
2085 struct hda_codec *codec; 2150 struct hda_codec *codec;
2086 2151
@@ -2091,6 +2156,7 @@ int __devinit snd_hda_build_controls(struct hda_bus *bus)
2091 } 2156 }
2092 return 0; 2157 return 0;
2093} 2158}
2159EXPORT_SYMBOL_GPL(snd_hda_build_controls);
2094 2160
2095int snd_hda_codec_build_controls(struct hda_codec *codec) 2161int snd_hda_codec_build_controls(struct hda_codec *codec)
2096{ 2162{
@@ -2202,6 +2268,7 @@ unsigned int snd_hda_calc_stream_format(unsigned int rate,
2202 2268
2203 return val; 2269 return val;
2204} 2270}
2271EXPORT_SYMBOL_GPL(snd_hda_calc_stream_format);
2205 2272
2206/** 2273/**
2207 * snd_hda_query_supported_pcm - query the supported PCM rates and formats 2274 * snd_hda_query_supported_pcm - query the supported PCM rates and formats
@@ -2381,6 +2448,7 @@ int snd_hda_is_supported_format(struct hda_codec *codec, hda_nid_t nid,
2381 2448
2382 return 1; 2449 return 1;
2383} 2450}
2451EXPORT_SYMBOL_GPL(snd_hda_is_supported_format);
2384 2452
2385/* 2453/*
2386 * PCM stuff 2454 * PCM stuff
@@ -2578,6 +2646,7 @@ int __devinit snd_hda_build_pcms(struct hda_bus *bus)
2578 } 2646 }
2579 return 0; 2647 return 0;
2580} 2648}
2649EXPORT_SYMBOL_GPL(snd_hda_build_pcms);
2581 2650
2582/** 2651/**
2583 * snd_hda_check_board_config - compare the current codec with the config table 2652 * snd_hda_check_board_config - compare the current codec with the config table
@@ -2633,6 +2702,7 @@ int snd_hda_check_board_config(struct hda_codec *codec,
2633 } 2702 }
2634 return -1; 2703 return -1;
2635} 2704}
2705EXPORT_SYMBOL_GPL(snd_hda_check_board_config);
2636 2706
2637/** 2707/**
2638 * snd_hda_add_new_ctls - create controls from the array 2708 * snd_hda_add_new_ctls - create controls from the array
@@ -2668,6 +2738,7 @@ int snd_hda_add_new_ctls(struct hda_codec *codec, struct snd_kcontrol_new *knew)
2668 } 2738 }
2669 return 0; 2739 return 0;
2670} 2740}
2741EXPORT_SYMBOL_GPL(snd_hda_add_new_ctls);
2671 2742
2672#ifdef CONFIG_SND_HDA_POWER_SAVE 2743#ifdef CONFIG_SND_HDA_POWER_SAVE
2673static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, 2744static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
@@ -2710,6 +2781,10 @@ void snd_hda_power_up(struct hda_codec *codec)
2710 cancel_delayed_work(&codec->power_work); 2781 cancel_delayed_work(&codec->power_work);
2711 codec->power_transition = 0; 2782 codec->power_transition = 0;
2712} 2783}
2784EXPORT_SYMBOL_GPL(snd_hda_power_up);
2785
2786#define power_save(codec) \
2787 ((codec)->bus->power_save ? *(codec)->bus->power_save : 0)
2713 2788
2714#define power_save(codec) \ 2789#define power_save(codec) \
2715 ((codec)->bus->power_save ? *(codec)->bus->power_save : 0) 2790 ((codec)->bus->power_save ? *(codec)->bus->power_save : 0)
@@ -2725,6 +2800,7 @@ void snd_hda_power_down(struct hda_codec *codec)
2725 msecs_to_jiffies(power_save(codec) * 1000)); 2800 msecs_to_jiffies(power_save(codec) * 1000));
2726 } 2801 }
2727} 2802}
2803EXPORT_SYMBOL_GPL(snd_hda_power_down);
2728 2804
2729int snd_hda_check_amp_list_power(struct hda_codec *codec, 2805int snd_hda_check_amp_list_power(struct hda_codec *codec,
2730 struct hda_loopback_check *check, 2806 struct hda_loopback_check *check,
@@ -2761,6 +2837,7 @@ int snd_hda_check_amp_list_power(struct hda_codec *codec,
2761 } 2837 }
2762 return 0; 2838 return 0;
2763} 2839}
2840EXPORT_SYMBOL_GPL(snd_hda_check_amp_list_power);
2764#endif 2841#endif
2765 2842
2766/* 2843/*
@@ -2780,6 +2857,7 @@ int snd_hda_ch_mode_info(struct hda_codec *codec,
2780 chmode[uinfo->value.enumerated.item].channels); 2857 chmode[uinfo->value.enumerated.item].channels);
2781 return 0; 2858 return 0;
2782} 2859}
2860EXPORT_SYMBOL_GPL(snd_hda_ch_mode_info);
2783 2861
2784int snd_hda_ch_mode_get(struct hda_codec *codec, 2862int snd_hda_ch_mode_get(struct hda_codec *codec,
2785 struct snd_ctl_elem_value *ucontrol, 2863 struct snd_ctl_elem_value *ucontrol,
@@ -2797,6 +2875,7 @@ int snd_hda_ch_mode_get(struct hda_codec *codec,
2797 } 2875 }
2798 return 0; 2876 return 0;
2799} 2877}
2878EXPORT_SYMBOL_GPL(snd_hda_ch_mode_get);
2800 2879
2801int snd_hda_ch_mode_put(struct hda_codec *codec, 2880int snd_hda_ch_mode_put(struct hda_codec *codec,
2802 struct snd_ctl_elem_value *ucontrol, 2881 struct snd_ctl_elem_value *ucontrol,
@@ -2817,6 +2896,7 @@ int snd_hda_ch_mode_put(struct hda_codec *codec,
2817 snd_hda_sequence_write_cache(codec, chmode[mode].sequence); 2896 snd_hda_sequence_write_cache(codec, chmode[mode].sequence);
2818 return 1; 2897 return 1;
2819} 2898}
2899EXPORT_SYMBOL_GPL(snd_hda_ch_mode_put);
2820 2900
2821/* 2901/*
2822 * input MUX helper 2902 * input MUX helper
@@ -2837,6 +2917,7 @@ int snd_hda_input_mux_info(const struct hda_input_mux *imux,
2837 strcpy(uinfo->value.enumerated.name, imux->items[index].label); 2917 strcpy(uinfo->value.enumerated.name, imux->items[index].label);
2838 return 0; 2918 return 0;
2839} 2919}
2920EXPORT_SYMBOL_GPL(snd_hda_input_mux_info);
2840 2921
2841int snd_hda_input_mux_put(struct hda_codec *codec, 2922int snd_hda_input_mux_put(struct hda_codec *codec,
2842 const struct hda_input_mux *imux, 2923 const struct hda_input_mux *imux,
@@ -2858,6 +2939,7 @@ int snd_hda_input_mux_put(struct hda_codec *codec,
2858 *cur_val = idx; 2939 *cur_val = idx;
2859 return 1; 2940 return 1;
2860} 2941}
2942EXPORT_SYMBOL_GPL(snd_hda_input_mux_put);
2861 2943
2862 2944
2863/* 2945/*
@@ -2910,6 +2992,7 @@ int snd_hda_multi_out_dig_open(struct hda_codec *codec,
2910 mutex_unlock(&codec->spdif_mutex); 2992 mutex_unlock(&codec->spdif_mutex);
2911 return 0; 2993 return 0;
2912} 2994}
2995EXPORT_SYMBOL_GPL(snd_hda_multi_out_dig_open);
2913 2996
2914int snd_hda_multi_out_dig_prepare(struct hda_codec *codec, 2997int snd_hda_multi_out_dig_prepare(struct hda_codec *codec,
2915 struct hda_multi_out *mout, 2998 struct hda_multi_out *mout,
@@ -2922,6 +3005,7 @@ int snd_hda_multi_out_dig_prepare(struct hda_codec *codec,
2922 mutex_unlock(&codec->spdif_mutex); 3005 mutex_unlock(&codec->spdif_mutex);
2923 return 0; 3006 return 0;
2924} 3007}
3008EXPORT_SYMBOL_GPL(snd_hda_multi_out_dig_prepare);
2925 3009
2926/* 3010/*
2927 * release the digital out 3011 * release the digital out
@@ -2934,6 +3018,7 @@ int snd_hda_multi_out_dig_close(struct hda_codec *codec,
2934 mutex_unlock(&codec->spdif_mutex); 3018 mutex_unlock(&codec->spdif_mutex);
2935 return 0; 3019 return 0;
2936} 3020}
3021EXPORT_SYMBOL_GPL(snd_hda_multi_out_dig_close);
2937 3022
2938/* 3023/*
2939 * set up more restrictions for analog out 3024 * set up more restrictions for analog out
@@ -2973,6 +3058,7 @@ int snd_hda_multi_out_analog_open(struct hda_codec *codec,
2973 return snd_pcm_hw_constraint_step(substream->runtime, 0, 3058 return snd_pcm_hw_constraint_step(substream->runtime, 0,
2974 SNDRV_PCM_HW_PARAM_CHANNELS, 2); 3059 SNDRV_PCM_HW_PARAM_CHANNELS, 2);
2975} 3060}
3061EXPORT_SYMBOL_GPL(snd_hda_multi_out_analog_open);
2976 3062
2977/* 3063/*
2978 * set up the i/o for analog out 3064 * set up the i/o for analog out
@@ -3031,6 +3117,7 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec,
3031 } 3117 }
3032 return 0; 3118 return 0;
3033} 3119}
3120EXPORT_SYMBOL_GPL(snd_hda_multi_out_analog_prepare);
3034 3121
3035/* 3122/*
3036 * clean up the setting for analog out 3123 * clean up the setting for analog out
@@ -3057,6 +3144,7 @@ int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec,
3057 mutex_unlock(&codec->spdif_mutex); 3144 mutex_unlock(&codec->spdif_mutex);
3058 return 0; 3145 return 0;
3059} 3146}
3147EXPORT_SYMBOL_GPL(snd_hda_multi_out_analog_cleanup);
3060 3148
3061/* 3149/*
3062 * Helper for automatic pin configuration 3150 * Helper for automatic pin configuration
@@ -3342,11 +3430,13 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
3342 3430
3343 return 0; 3431 return 0;
3344} 3432}
3433EXPORT_SYMBOL_GPL(snd_hda_parse_pin_def_config);
3345 3434
3346/* labels for input pins */ 3435/* labels for input pins */
3347const char *auto_pin_cfg_labels[AUTO_PIN_LAST] = { 3436const char *auto_pin_cfg_labels[AUTO_PIN_LAST] = {
3348 "Mic", "Front Mic", "Line", "Front Line", "CD", "Aux" 3437 "Mic", "Front Mic", "Line", "Front Line", "CD", "Aux"
3349}; 3438};
3439EXPORT_SYMBOL_GPL(auto_pin_cfg_labels);
3350 3440
3351 3441
3352#ifdef CONFIG_PM 3442#ifdef CONFIG_PM
@@ -3374,6 +3464,7 @@ int snd_hda_suspend(struct hda_bus *bus, pm_message_t state)
3374 } 3464 }
3375 return 0; 3465 return 0;
3376} 3466}
3467EXPORT_SYMBOL_GPL(snd_hda_suspend);
3377 3468
3378/** 3469/**
3379 * snd_hda_resume - resume the codecs 3470 * snd_hda_resume - resume the codecs
@@ -3394,7 +3485,8 @@ int snd_hda_resume(struct hda_bus *bus)
3394 } 3485 }
3395 return 0; 3486 return 0;
3396} 3487}
3397#endif 3488EXPORT_SYMBOL_GPL(snd_hda_resume);
3489#endif /* CONFIG_PM */
3398 3490
3399/* 3491/*
3400 * generic arrays 3492 * generic arrays
@@ -3423,6 +3515,7 @@ void *snd_array_new(struct snd_array *array)
3423 } 3515 }
3424 return snd_array_elem(array, array->used++); 3516 return snd_array_elem(array, array->used++);
3425} 3517}
3518EXPORT_SYMBOL_GPL(snd_array_new);
3426 3519
3427/* free the given array elements */ 3520/* free the given array elements */
3428void snd_array_free(struct snd_array *array) 3521void snd_array_free(struct snd_array *array)
@@ -3432,6 +3525,7 @@ void snd_array_free(struct snd_array *array)
3432 array->alloced = 0; 3525 array->alloced = 0;
3433 array->list = NULL; 3526 array->list = NULL;
3434} 3527}
3528EXPORT_SYMBOL_GPL(snd_array_free);
3435 3529
3436/* 3530/*
3437 * used by hda_proc.c and hda_eld.c 3531 * used by hda_proc.c and hda_eld.c
@@ -3450,6 +3544,7 @@ void snd_print_pcm_rates(int pcm, char *buf, int buflen)
3450 3544
3451 buf[j] = '\0'; /* necessary when j == 0 */ 3545 buf[j] = '\0'; /* necessary when j == 0 */
3452} 3546}
3547EXPORT_SYMBOL_GPL(snd_print_pcm_rates);
3453 3548
3454void snd_print_pcm_bits(int pcm, char *buf, int buflen) 3549void snd_print_pcm_bits(int pcm, char *buf, int buflen)
3455{ 3550{
@@ -3462,3 +3557,7 @@ void snd_print_pcm_bits(int pcm, char *buf, int buflen)
3462 3557
3463 buf[j] = '\0'; /* necessary when j == 0 */ 3558 buf[j] = '\0'; /* necessary when j == 0 */
3464} 3559}
3560EXPORT_SYMBOL_GPL(snd_print_pcm_bits);
3561
3562MODULE_DESCRIPTION("HDA codec core");
3563MODULE_LICENSE("GPL");
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 9fe0b67bb1e4..586ea08b340b 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -642,6 +642,16 @@ struct hda_codec_preset {
642 int (*patch)(struct hda_codec *codec); 642 int (*patch)(struct hda_codec *codec);
643}; 643};
644 644
645struct hda_codec_preset_list {
646 const struct hda_codec_preset *preset;
647 struct module *owner;
648 struct list_head list;
649};
650
651/* initial hook */
652int snd_hda_add_codec_preset(struct hda_codec_preset_list *preset);
653int snd_hda_delete_codec_preset(struct hda_codec_preset_list *preset);
654
645/* ops set by the preset patch */ 655/* ops set by the preset patch */
646struct hda_codec_ops { 656struct hda_codec_ops {
647 int (*build_controls)(struct hda_codec *codec); 657 int (*build_controls)(struct hda_codec *codec);
@@ -735,6 +745,7 @@ struct hda_codec {
735 745
736 /* detected preset */ 746 /* detected preset */
737 const struct hda_codec_preset *preset; 747 const struct hda_codec_preset *preset;
748 struct module *owner;
738 const char *name; /* codec name */ 749 const char *name; /* codec name */
739 const char *modelname; /* model name for preset */ 750 const char *modelname; /* model name for preset */
740 751
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 98ff010d5b95..65745e96dc70 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -1101,3 +1101,4 @@ int snd_hda_parse_generic_codec(struct hda_codec *codec)
1101 snd_hda_generic_free(codec); 1101 snd_hda_generic_free(codec);
1102 return err; 1102 return err;
1103} 1103}
1104EXPORT_SYMBOL(snd_hda_parse_generic_codec);
diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c
index 173af489322f..300ab407cf42 100644
--- a/sound/pci/hda/hda_hwdep.c
+++ b/sound/pci/hda/hda_hwdep.c
@@ -116,7 +116,7 @@ static void hwdep_free(struct snd_hwdep *hwdep)
116 clear_hwdep_elements(hwdep->private_data); 116 clear_hwdep_elements(hwdep->private_data);
117} 117}
118 118
119int __devinit snd_hda_create_hwdep(struct hda_codec *codec) 119int /*__devinit*/ snd_hda_create_hwdep(struct hda_codec *codec)
120{ 120{
121 char hwname[16]; 121 char hwname[16];
122 struct snd_hwdep *hwdep; 122 struct snd_hwdep *hwdep;
diff --git a/sound/pci/hda/hda_patch.h b/sound/pci/hda/hda_patch.h
deleted file mode 100644
index 38212c1020a6..000000000000
--- a/sound/pci/hda/hda_patch.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * HDA Patches - included by hda_codec.c
3 */
4
5/* Realtek codecs */
6extern struct hda_codec_preset snd_hda_preset_realtek[];
7/* C-Media codecs */
8extern struct hda_codec_preset snd_hda_preset_cmedia[];
9/* Analog Devices codecs */
10extern struct hda_codec_preset snd_hda_preset_analog[];
11/* SigmaTel codecs */
12extern struct hda_codec_preset snd_hda_preset_sigmatel[];
13/* SiLabs 3054/3055 modem codecs */
14extern struct hda_codec_preset snd_hda_preset_si3054[];
15/* ATI HDMI codecs */
16extern struct hda_codec_preset snd_hda_preset_atihdmi[];
17/* Conexant audio codec */
18extern struct hda_codec_preset snd_hda_preset_conexant[];
19/* VIA codecs */
20extern struct hda_codec_preset snd_hda_preset_via[];
21/* NVIDIA HDMI codecs */
22extern struct hda_codec_preset snd_hda_preset_nvhdmi[];
23/* INTEL HDMI codecs */
24extern struct hda_codec_preset snd_hda_preset_intelhdmi[];
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 0cc6be12b8b7..c1918a1a6df9 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -27,7 +27,6 @@
27#include <sound/core.h> 27#include <sound/core.h>
28#include "hda_codec.h" 28#include "hda_codec.h"
29#include "hda_local.h" 29#include "hda_local.h"
30#include "hda_patch.h"
31 30
32struct ad198x_spec { 31struct ad198x_spec {
33 struct snd_kcontrol_new *mixers[5]; 32 struct snd_kcontrol_new *mixers[5];
@@ -4308,7 +4307,7 @@ static int patch_ad1882(struct hda_codec *codec)
4308/* 4307/*
4309 * patch entries 4308 * patch entries
4310 */ 4309 */
4311struct hda_codec_preset snd_hda_preset_analog[] = { 4310static struct hda_codec_preset snd_hda_preset_analog[] = {
4312 { .id = 0x11d4184a, .name = "AD1884A", .patch = patch_ad1884a }, 4311 { .id = 0x11d4184a, .name = "AD1884A", .patch = patch_ad1884a },
4313 { .id = 0x11d41882, .name = "AD1882", .patch = patch_ad1882 }, 4312 { .id = 0x11d41882, .name = "AD1882", .patch = patch_ad1882 },
4314 { .id = 0x11d41883, .name = "AD1883", .patch = patch_ad1884a }, 4313 { .id = 0x11d41883, .name = "AD1883", .patch = patch_ad1884a },
@@ -4326,3 +4325,26 @@ struct hda_codec_preset snd_hda_preset_analog[] = {
4326 { .id = 0x11d4989b, .name = "AD1989B", .patch = patch_ad1988 }, 4325 { .id = 0x11d4989b, .name = "AD1989B", .patch = patch_ad1988 },
4327 {} /* terminator */ 4326 {} /* terminator */
4328}; 4327};
4328
4329MODULE_ALIAS("snd-hda-codec-id:11d4*");
4330
4331MODULE_LICENSE("GPL");
4332MODULE_DESCRIPTION("Analog Devices HD-audio codec");
4333
4334static struct hda_codec_preset_list analog_list = {
4335 .preset = snd_hda_preset_analog,
4336 .owner = THIS_MODULE,
4337};
4338
4339static int __init patch_analog_init(void)
4340{
4341 return snd_hda_add_codec_preset(&analog_list);
4342}
4343
4344static void __exit patch_analog_exit(void)
4345{
4346 snd_hda_delete_codec_preset(&analog_list);
4347}
4348
4349module_init(patch_analog_init)
4350module_exit(patch_analog_exit)
diff --git a/sound/pci/hda/patch_atihdmi.c b/sound/pci/hda/patch_atihdmi.c
index 5603a1acddb1..5887b827bb32 100644
--- a/sound/pci/hda/patch_atihdmi.c
+++ b/sound/pci/hda/patch_atihdmi.c
@@ -27,7 +27,6 @@
27#include <sound/core.h> 27#include <sound/core.h>
28#include "hda_codec.h" 28#include "hda_codec.h"
29#include "hda_local.h" 29#include "hda_local.h"
30#include "hda_patch.h"
31 30
32struct atihdmi_spec { 31struct atihdmi_spec {
33 struct hda_multi_out multiout; 32 struct hda_multi_out multiout;
@@ -187,7 +186,7 @@ static int patch_atihdmi(struct hda_codec *codec)
187/* 186/*
188 * patch entries 187 * patch entries
189 */ 188 */
190struct hda_codec_preset snd_hda_preset_atihdmi[] = { 189static struct hda_codec_preset snd_hda_preset_atihdmi[] = {
191 { .id = 0x1002793c, .name = "ATI RS600 HDMI", .patch = patch_atihdmi }, 190 { .id = 0x1002793c, .name = "ATI RS600 HDMI", .patch = patch_atihdmi },
192 { .id = 0x10027919, .name = "ATI RS600 HDMI", .patch = patch_atihdmi }, 191 { .id = 0x10027919, .name = "ATI RS600 HDMI", .patch = patch_atihdmi },
193 { .id = 0x1002791a, .name = "ATI RS690/780 HDMI", .patch = patch_atihdmi }, 192 { .id = 0x1002791a, .name = "ATI RS690/780 HDMI", .patch = patch_atihdmi },
@@ -196,3 +195,31 @@ struct hda_codec_preset snd_hda_preset_atihdmi[] = {
196 { .id = 0x17e80047, .name = "Chrontel HDMI", .patch = patch_atihdmi }, 195 { .id = 0x17e80047, .name = "Chrontel HDMI", .patch = patch_atihdmi },
197 {} /* terminator */ 196 {} /* terminator */
198}; 197};
198
199MODULE_ALIAS("snd-hda-codec-id:1002793c");
200MODULE_ALIAS("snd-hda-codec-id:10027919");
201MODULE_ALIAS("snd-hda-codec-id:1002791a");
202MODULE_ALIAS("snd-hda-codec-id:1002aa01");
203MODULE_ALIAS("snd-hda-codec-id:10951390");
204MODULE_ALIAS("snd-hda-codec-id:17e80047");
205
206MODULE_LICENSE("GPL");
207MODULE_DESCRIPTION("ATI HDMI HD-audio codec");
208
209static struct hda_codec_preset_list atihdmi_list = {
210 .preset = snd_hda_preset_atihdmi,
211 .owner = THIS_MODULE,
212};
213
214static int __init patch_atihdmi_init(void)
215{
216 return snd_hda_add_codec_preset(&atihdmi_list);
217}
218
219static void __exit patch_atihdmi_exit(void)
220{
221 snd_hda_delete_codec_preset(&atihdmi_list);
222}
223
224module_init(patch_atihdmi_init)
225module_exit(patch_atihdmi_exit)
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c
index 6ef57fbfb6eb..f3ebe837f2d5 100644
--- a/sound/pci/hda/patch_cmedia.c
+++ b/sound/pci/hda/patch_cmedia.c
@@ -28,7 +28,6 @@
28#include <sound/core.h> 28#include <sound/core.h>
29#include "hda_codec.h" 29#include "hda_codec.h"
30#include "hda_local.h" 30#include "hda_local.h"
31#include "hda_patch.h"
32#define NUM_PINS 11 31#define NUM_PINS 11
33 32
34 33
@@ -736,8 +735,32 @@ static int patch_cmi9880(struct hda_codec *codec)
736/* 735/*
737 * patch entries 736 * patch entries
738 */ 737 */
739struct hda_codec_preset snd_hda_preset_cmedia[] = { 738static struct hda_codec_preset snd_hda_preset_cmedia[] = {
740 { .id = 0x13f69880, .name = "CMI9880", .patch = patch_cmi9880 }, 739 { .id = 0x13f69880, .name = "CMI9880", .patch = patch_cmi9880 },
741 { .id = 0x434d4980, .name = "CMI9880", .patch = patch_cmi9880 }, 740 { .id = 0x434d4980, .name = "CMI9880", .patch = patch_cmi9880 },
742 {} /* terminator */ 741 {} /* terminator */
743}; 742};
743
744MODULE_ALIAS("snd-hda-codec-id:13f69880");
745MODULE_ALIAS("snd-hda-codec-id:434d4980");
746
747MODULE_LICENSE("GPL");
748MODULE_DESCRIPTION("C-Media HD-audio codec");
749
750static struct hda_codec_preset_list cmedia_list = {
751 .preset = snd_hda_preset_cmedia,
752 .owner = THIS_MODULE,
753};
754
755static int __init patch_cmedia_init(void)
756{
757 return snd_hda_add_codec_preset(&cmedia_list);
758}
759
760static void __exit patch_cmedia_exit(void)
761{
762 snd_hda_delete_codec_preset(&cmedia_list);
763}
764
765module_init(patch_cmedia_init)
766module_exit(patch_cmedia_exit)
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 076010708152..b20e1cede00b 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -27,7 +27,6 @@
27#include <sound/core.h> 27#include <sound/core.h>
28#include "hda_codec.h" 28#include "hda_codec.h"
29#include "hda_local.h" 29#include "hda_local.h"
30#include "hda_patch.h"
31 30
32#define CXT_PIN_DIR_IN 0x00 31#define CXT_PIN_DIR_IN 0x00
33#define CXT_PIN_DIR_OUT 0x01 32#define CXT_PIN_DIR_OUT 0x01
@@ -1771,7 +1770,7 @@ static int patch_cxt5051(struct hda_codec *codec)
1771/* 1770/*
1772 */ 1771 */
1773 1772
1774struct hda_codec_preset snd_hda_preset_conexant[] = { 1773static struct hda_codec_preset snd_hda_preset_conexant[] = {
1775 { .id = 0x14f15045, .name = "CX20549 (Venice)", 1774 { .id = 0x14f15045, .name = "CX20549 (Venice)",
1776 .patch = patch_cxt5045 }, 1775 .patch = patch_cxt5045 },
1777 { .id = 0x14f15047, .name = "CX20551 (Waikiki)", 1776 { .id = 0x14f15047, .name = "CX20551 (Waikiki)",
@@ -1780,3 +1779,28 @@ struct hda_codec_preset snd_hda_preset_conexant[] = {
1780 .patch = patch_cxt5051 }, 1779 .patch = patch_cxt5051 },
1781 {} /* terminator */ 1780 {} /* terminator */
1782}; 1781};
1782
1783MODULE_ALIAS("snd-hda-codec-id:14f15045");
1784MODULE_ALIAS("snd-hda-codec-id:14f15047");
1785MODULE_ALIAS("snd-hda-codec-id:14f15051");
1786
1787MODULE_LICENSE("GPL");
1788MODULE_DESCRIPTION("Conexant HD-audio codec");
1789
1790static struct hda_codec_preset_list conexant_list = {
1791 .preset = snd_hda_preset_conexant,
1792 .owner = THIS_MODULE,
1793};
1794
1795static int __init patch_conexant_init(void)
1796{
1797 return snd_hda_add_codec_preset(&conexant_list);
1798}
1799
1800static void __exit patch_conexant_exit(void)
1801{
1802 snd_hda_delete_codec_preset(&conexant_list);
1803}
1804
1805module_init(patch_conexant_init)
1806module_exit(patch_conexant_exit)
diff --git a/sound/pci/hda/patch_intelhdmi.c b/sound/pci/hda/patch_intelhdmi.c
index fe08bef897cd..290da562f29b 100644
--- a/sound/pci/hda/patch_intelhdmi.c
+++ b/sound/pci/hda/patch_intelhdmi.c
@@ -32,7 +32,6 @@
32#include <sound/core.h> 32#include <sound/core.h>
33#include "hda_codec.h" 33#include "hda_codec.h"
34#include "hda_local.h" 34#include "hda_local.h"
35#include "hda_patch.h"
36 35
37#define CVT_NID 0x02 /* audio converter */ 36#define CVT_NID 0x02 /* audio converter */
38#define PIN_NID 0x03 /* HDMI output pin */ 37#define PIN_NID 0x03 /* HDMI output pin */
@@ -675,7 +674,7 @@ static int patch_intel_hdmi(struct hda_codec *codec)
675 return 0; 674 return 0;
676} 675}
677 676
678struct hda_codec_preset snd_hda_preset_intelhdmi[] = { 677static struct hda_codec_preset snd_hda_preset_intelhdmi[] = {
679 { .id = 0x808629fb, .name = "INTEL G45 DEVCL", .patch = patch_intel_hdmi }, 678 { .id = 0x808629fb, .name = "INTEL G45 DEVCL", .patch = patch_intel_hdmi },
680 { .id = 0x80862801, .name = "INTEL G45 DEVBLC", .patch = patch_intel_hdmi }, 679 { .id = 0x80862801, .name = "INTEL G45 DEVBLC", .patch = patch_intel_hdmi },
681 { .id = 0x80862802, .name = "INTEL G45 DEVCTG", .patch = patch_intel_hdmi }, 680 { .id = 0x80862802, .name = "INTEL G45 DEVCTG", .patch = patch_intel_hdmi },
@@ -683,3 +682,30 @@ struct hda_codec_preset snd_hda_preset_intelhdmi[] = {
683 { .id = 0x10951392, .name = "SiI1392 HDMI", .patch = patch_intel_hdmi }, 682 { .id = 0x10951392, .name = "SiI1392 HDMI", .patch = patch_intel_hdmi },
684 {} /* terminator */ 683 {} /* terminator */
685}; 684};
685
686MODULE_ALIAS("snd-hda-codec-id:808629fb");
687MODULE_ALIAS("snd-hda-codec-id:80862801");
688MODULE_ALIAS("snd-hda-codec-id:80862802");
689MODULE_ALIAS("snd-hda-codec-id:80862803");
690MODULE_ALIAS("snd-hda-codec-id:10951392");
691
692MODULE_LICENSE("GPL");
693MODULE_DESCRIPTION("Intel HDMI HD-audio codec");
694
695static struct hda_codec_preset_list intel_list = {
696 .preset = snd_hda_preset_intelhdmi,
697 .owner = THIS_MODULE,
698};
699
700static int __init patch_intelhdmi_init(void)
701{
702 return snd_hda_add_codec_preset(&intel_list);
703}
704
705static void __exit patch_intelhdmi_exit(void)
706{
707 snd_hda_delete_codec_preset(&intel_list);
708}
709
710module_init(patch_intelhdmi_init)
711module_exit(patch_intelhdmi_exit)
diff --git a/sound/pci/hda/patch_nvhdmi.c b/sound/pci/hda/patch_nvhdmi.c
index 1360d54a7d01..e23de5594b6e 100644
--- a/sound/pci/hda/patch_nvhdmi.c
+++ b/sound/pci/hda/patch_nvhdmi.c
@@ -28,7 +28,6 @@
28#include <sound/core.h> 28#include <sound/core.h>
29#include "hda_codec.h" 29#include "hda_codec.h"
30#include "hda_local.h" 30#include "hda_local.h"
31#include "hda_patch.h"
32 31
33struct nvhdmi_spec { 32struct nvhdmi_spec {
34 struct hda_multi_out multiout; 33 struct hda_multi_out multiout;
@@ -159,8 +158,32 @@ static int patch_nvhdmi(struct hda_codec *codec)
159/* 158/*
160 * patch entries 159 * patch entries
161 */ 160 */
162struct hda_codec_preset snd_hda_preset_nvhdmi[] = { 161static struct hda_codec_preset snd_hda_preset_nvhdmi[] = {
163 { .id = 0x10de0002, .name = "NVIDIA MCP78 HDMI", .patch = patch_nvhdmi }, 162 { .id = 0x10de0002, .name = "NVIDIA MCP78 HDMI", .patch = patch_nvhdmi },
164 { .id = 0x10de0007, .name = "NVIDIA MCP7A HDMI", .patch = patch_nvhdmi }, 163 { .id = 0x10de0007, .name = "NVIDIA MCP7A HDMI", .patch = patch_nvhdmi },
165 {} /* terminator */ 164 {} /* terminator */
166}; 165};
166
167MODULE_ALIAS("snd-hda-codec-id:10de0002");
168MODULE_ALIAS("snd-hda-codec-id:10de0007");
169
170MODULE_LICENSE("GPL");
171MODULE_DESCRIPTION("Nvidia HDMI HD-audio codec");
172
173static struct hda_codec_preset_list nvhdmi_list = {
174 .preset = snd_hda_preset_nvhdmi,
175 .owner = THIS_MODULE,
176};
177
178static int __init patch_nvhdmi_init(void)
179{
180 return snd_hda_add_codec_preset(&nvhdmi_list);
181}
182
183static void __exit patch_nvhdmi_exit(void)
184{
185 snd_hda_delete_codec_preset(&nvhdmi_list);
186}
187
188module_init(patch_nvhdmi_init)
189module_exit(patch_nvhdmi_exit)
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 9cd2545d988e..ba640d36d648 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -30,7 +30,6 @@
30#include <sound/core.h> 30#include <sound/core.h>
31#include "hda_codec.h" 31#include "hda_codec.h"
32#include "hda_local.h" 32#include "hda_local.h"
33#include "hda_patch.h"
34 33
35#define ALC880_FRONT_EVENT 0x01 34#define ALC880_FRONT_EVENT 0x01
36#define ALC880_DCVOL_EVENT 0x02 35#define ALC880_DCVOL_EVENT 0x02
@@ -16579,7 +16578,7 @@ static int patch_alc662(struct hda_codec *codec)
16579/* 16578/*
16580 * patch entries 16579 * patch entries
16581 */ 16580 */
16582struct hda_codec_preset snd_hda_preset_realtek[] = { 16581static struct hda_codec_preset snd_hda_preset_realtek[] = {
16583 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, 16582 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16584 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, 16583 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16585 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, 16584 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
@@ -16611,3 +16610,26 @@ struct hda_codec_preset snd_hda_preset_realtek[] = {
16611 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, 16610 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16612 {} /* terminator */ 16611 {} /* terminator */
16613}; 16612};
16613
16614MODULE_ALIAS("snd-hda-codec-id:10ec*");
16615
16616MODULE_LICENSE("GPL");
16617MODULE_DESCRIPTION("Realtek HD-audio codec");
16618
16619static struct hda_codec_preset_list realtek_list = {
16620 .preset = snd_hda_preset_realtek,
16621 .owner = THIS_MODULE,
16622};
16623
16624static int __init patch_realtek_init(void)
16625{
16626 return snd_hda_add_codec_preset(&realtek_list);
16627}
16628
16629static void __exit patch_realtek_exit(void)
16630{
16631 snd_hda_delete_codec_preset(&realtek_list);
16632}
16633
16634module_init(patch_realtek_init)
16635module_exit(patch_realtek_exit)
diff --git a/sound/pci/hda/patch_si3054.c b/sound/pci/hda/patch_si3054.c
index 9332b63e406c..43b436c5d01b 100644
--- a/sound/pci/hda/patch_si3054.c
+++ b/sound/pci/hda/patch_si3054.c
@@ -28,7 +28,6 @@
28#include <sound/core.h> 28#include <sound/core.h>
29#include "hda_codec.h" 29#include "hda_codec.h"
30#include "hda_local.h" 30#include "hda_local.h"
31#include "hda_patch.h"
32 31
33/* si3054 verbs */ 32/* si3054 verbs */
34#define SI3054_VERB_READ_NODE 0x900 33#define SI3054_VERB_READ_NODE 0x900
@@ -283,7 +282,7 @@ static int patch_si3054(struct hda_codec *codec)
283/* 282/*
284 * patch entries 283 * patch entries
285 */ 284 */
286struct hda_codec_preset snd_hda_preset_si3054[] = { 285static struct hda_codec_preset snd_hda_preset_si3054[] = {
287 { .id = 0x163c3055, .name = "Si3054", .patch = patch_si3054 }, 286 { .id = 0x163c3055, .name = "Si3054", .patch = patch_si3054 },
288 { .id = 0x163c3155, .name = "Si3054", .patch = patch_si3054 }, 287 { .id = 0x163c3155, .name = "Si3054", .patch = patch_si3054 },
289 { .id = 0x11c13026, .name = "Si3054", .patch = patch_si3054 }, 288 { .id = 0x11c13026, .name = "Si3054", .patch = patch_si3054 },
@@ -301,3 +300,35 @@ struct hda_codec_preset snd_hda_preset_si3054[] = {
301 {} 300 {}
302}; 301};
303 302
303MODULE_ALIAS("snd-hda-codec-id:163c3055");
304MODULE_ALIAS("snd-hda-codec-id:163c3155");
305MODULE_ALIAS("snd-hda-codec-id:11c13026");
306MODULE_ALIAS("snd-hda-codec-id:11c13055");
307MODULE_ALIAS("snd-hda-codec-id:11c13155");
308MODULE_ALIAS("snd-hda-codec-id:10573055");
309MODULE_ALIAS("snd-hda-codec-id:10573057");
310MODULE_ALIAS("snd-hda-codec-id:10573155");
311MODULE_ALIAS("snd-hda-codec-id:11063288");
312MODULE_ALIAS("snd-hda-codec-id:15433155");
313MODULE_ALIAS("snd-hda-codec-id:18540018");
314
315MODULE_LICENSE("GPL");
316MODULE_DESCRIPTION("Si3054 HD-audio modem codec");
317
318static struct hda_codec_preset_list si3054_list = {
319 .preset = snd_hda_preset_si3054,
320 .owner = THIS_MODULE,
321};
322
323static int __init patch_si3054_init(void)
324{
325 return snd_hda_add_codec_preset(&si3054_list);
326}
327
328static void __exit patch_si3054_exit(void)
329{
330 snd_hda_delete_codec_preset(&si3054_list);
331}
332
333module_init(patch_si3054_init)
334module_exit(patch_si3054_exit)
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 70181d500536..9e07f44ab28a 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -33,7 +33,6 @@
33#include <sound/jack.h> 33#include <sound/jack.h>
34#include "hda_codec.h" 34#include "hda_codec.h"
35#include "hda_local.h" 35#include "hda_local.h"
36#include "hda_patch.h"
37#include "hda_beep.h" 36#include "hda_beep.h"
38 37
39enum { 38enum {
@@ -5455,7 +5454,7 @@ static int patch_stac9872(struct hda_codec *codec)
5455/* 5454/*
5456 * patch entries 5455 * patch entries
5457 */ 5456 */
5458struct hda_codec_preset snd_hda_preset_sigmatel[] = { 5457static struct hda_codec_preset snd_hda_preset_sigmatel[] = {
5459 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 }, 5458 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 },
5460 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x }, 5459 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x },
5461 { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x }, 5460 { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x },
@@ -5519,3 +5518,27 @@ struct hda_codec_preset snd_hda_preset_sigmatel[] = {
5519 { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx }, 5518 { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
5520 {} /* terminator */ 5519 {} /* terminator */
5521}; 5520};
5521
5522MODULE_ALIAS("snd-hda-codec-id:8384*");
5523MODULE_ALIAS("snd-hda-codec-id:111d*");
5524
5525MODULE_LICENSE("GPL");
5526MODULE_DESCRIPTION("IDT/Sigmatel HD-audio codec");
5527
5528static struct hda_codec_preset_list sigmatel_list = {
5529 .preset = snd_hda_preset_sigmatel,
5530 .owner = THIS_MODULE,
5531};
5532
5533static int __init patch_sigmatel_init(void)
5534{
5535 return snd_hda_add_codec_preset(&sigmatel_list);
5536}
5537
5538static void __exit patch_sigmatel_exit(void)
5539{
5540 snd_hda_delete_codec_preset(&sigmatel_list);
5541}
5542
5543module_init(patch_sigmatel_init)
5544module_exit(patch_sigmatel_exit)
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 05182be1c9f0..6e4d01d1d502 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -47,7 +47,6 @@
47#include <sound/asoundef.h> 47#include <sound/asoundef.h>
48#include "hda_codec.h" 48#include "hda_codec.h"
49#include "hda_local.h" 49#include "hda_local.h"
50#include "hda_patch.h"
51 50
52/* amp values */ 51/* amp values */
53#define AMP_VAL_IDX_SHIFT 19 52#define AMP_VAL_IDX_SHIFT 19
@@ -3249,7 +3248,7 @@ static int patch_vt1702(struct hda_codec *codec)
3249/* 3248/*
3250 * patch entries 3249 * patch entries
3251 */ 3250 */
3252struct hda_codec_preset snd_hda_preset_via[] = { 3251static struct hda_codec_preset snd_hda_preset_via[] = {
3253 { .id = 0x11061708, .name = "VIA VT1708", .patch = patch_vt1708}, 3252 { .id = 0x11061708, .name = "VIA VT1708", .patch = patch_vt1708},
3254 { .id = 0x11061709, .name = "VIA VT1708", .patch = patch_vt1708}, 3253 { .id = 0x11061709, .name = "VIA VT1708", .patch = patch_vt1708},
3255 { .id = 0x1106170A, .name = "VIA VT1708", .patch = patch_vt1708}, 3254 { .id = 0x1106170A, .name = "VIA VT1708", .patch = patch_vt1708},
@@ -3320,3 +3319,26 @@ struct hda_codec_preset snd_hda_preset_via[] = {
3320 .patch = patch_vt1702}, 3319 .patch = patch_vt1702},
3321 {} /* terminator */ 3320 {} /* terminator */
3322}; 3321};
3322
3323MODULE_ALIAS("snd-hda-codec-id:1106*");
3324
3325static struct hda_codec_preset_list via_list = {
3326 .preset = snd_hda_preset_via,
3327 .owner = THIS_MODULE,
3328};
3329
3330MODULE_LICENSE("GPL");
3331MODULE_DESCRIPTION("VIA HD-audio codec");
3332
3333static int __init patch_via_init(void)
3334{
3335 return snd_hda_add_codec_preset(&via_list);
3336}
3337
3338static void __exit patch_via_exit(void)
3339{
3340 snd_hda_delete_codec_preset(&via_list);
3341}
3342
3343module_init(patch_via_init)
3344module_exit(patch_via_exit)