aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-12-03 08:43:14 -0500
committerTakashi Iwai <tiwai@suse.de>2008-12-03 08:43:14 -0500
commit0640f84fac8a8aa8e7911c950cd9a4b0199711f6 (patch)
tree0f7a0f0deb5152461854c91158ba834a1edec5b1 /sound/pci
parent8c2f767bf3c4a7932898e657c6b12a2234cd2eca (diff)
parentff7a3267368634e368ebaac68d5e3abf129edd1d (diff)
Merge branch 'topic/hda-modularize' into topic/hda
Diffstat (limited to 'sound/pci')
-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.h26
-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, 543 insertions, 109 deletions
diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
index ccf7326a667..eb2a19b894a 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 6daf5fd9a27..50f9d096725 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 3ecd7e797de..e00421c0d8b 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_HDA(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_HDA(snd_hda_detach_beep_device);
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index a867e1e8658..d49d0b69868 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_HDA(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_HDA(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_HDA(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_HDA(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_HDA(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_HDA(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_HDA(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_HDA(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_HDA(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_HDA(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_HDA(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_HDA(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 MODULE
534#define HDA_MODREQ_MAX_COUNT 2 /* two request_modules()'s */
535#else
536#define HDA_MODREQ_MAX_COUNT 0 /* all presets are statically linked */
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_HDA(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_HDA(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_HDA(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_HDA(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_HDA(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_HDA(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_HDA(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_HDA(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_HDA(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_HDA(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_HDA(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_HDA(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_HDA(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_HDA(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_HDA(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_HDA(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 */
@@ -1244,6 +1289,8 @@ void snd_hda_codec_reset(struct hda_codec *codec)
1244 codec->num_pcms = 0; 1289 codec->num_pcms = 0;
1245 codec->pcm_info = NULL; 1290 codec->pcm_info = NULL;
1246 codec->preset = NULL; 1291 codec->preset = NULL;
1292 module_put(codec->owner);
1293 codec->owner = NULL;
1247} 1294}
1248#endif /* CONFIG_SND_HDA_RECONFIG */ 1295#endif /* CONFIG_SND_HDA_RECONFIG */
1249 1296
@@ -1282,6 +1329,7 @@ int snd_hda_add_vmaster(struct hda_codec *codec, char *name,
1282 } 1329 }
1283 return 0; 1330 return 0;
1284} 1331}
1332EXPORT_SYMBOL_HDA(snd_hda_add_vmaster);
1285 1333
1286/* switch */ 1334/* switch */
1287int snd_hda_mixer_amp_switch_info(struct snd_kcontrol *kcontrol, 1335int snd_hda_mixer_amp_switch_info(struct snd_kcontrol *kcontrol,
@@ -1295,6 +1343,7 @@ int snd_hda_mixer_amp_switch_info(struct snd_kcontrol *kcontrol,
1295 uinfo->value.integer.max = 1; 1343 uinfo->value.integer.max = 1;
1296 return 0; 1344 return 0;
1297} 1345}
1346EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_switch_info);
1298 1347
1299int snd_hda_mixer_amp_switch_get(struct snd_kcontrol *kcontrol, 1348int snd_hda_mixer_amp_switch_get(struct snd_kcontrol *kcontrol,
1300 struct snd_ctl_elem_value *ucontrol) 1349 struct snd_ctl_elem_value *ucontrol)
@@ -1314,6 +1363,7 @@ int snd_hda_mixer_amp_switch_get(struct snd_kcontrol *kcontrol,
1314 HDA_AMP_MUTE) ? 0 : 1; 1363 HDA_AMP_MUTE) ? 0 : 1;
1315 return 0; 1364 return 0;
1316} 1365}
1366EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_switch_get);
1317 1367
1318int snd_hda_mixer_amp_switch_put(struct snd_kcontrol *kcontrol, 1368int snd_hda_mixer_amp_switch_put(struct snd_kcontrol *kcontrol,
1319 struct snd_ctl_elem_value *ucontrol) 1369 struct snd_ctl_elem_value *ucontrol)
@@ -1344,6 +1394,7 @@ int snd_hda_mixer_amp_switch_put(struct snd_kcontrol *kcontrol,
1344 snd_hda_power_down(codec); 1394 snd_hda_power_down(codec);
1345 return change; 1395 return change;
1346} 1396}
1397EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_switch_put);
1347 1398
1348/* 1399/*
1349 * bound volume controls 1400 * bound volume controls
@@ -1369,6 +1420,7 @@ int snd_hda_mixer_bind_switch_get(struct snd_kcontrol *kcontrol,
1369 mutex_unlock(&codec->spdif_mutex); 1420 mutex_unlock(&codec->spdif_mutex);
1370 return err; 1421 return err;
1371} 1422}
1423EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_switch_get);
1372 1424
1373int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol, 1425int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol,
1374 struct snd_ctl_elem_value *ucontrol) 1426 struct snd_ctl_elem_value *ucontrol)
@@ -1392,6 +1444,7 @@ int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol,
1392 mutex_unlock(&codec->spdif_mutex); 1444 mutex_unlock(&codec->spdif_mutex);
1393 return err < 0 ? err : change; 1445 return err < 0 ? err : change;
1394} 1446}
1447EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_switch_put);
1395 1448
1396/* 1449/*
1397 * generic bound volume/swtich controls 1450 * generic bound volume/swtich controls
@@ -1411,6 +1464,7 @@ int snd_hda_mixer_bind_ctls_info(struct snd_kcontrol *kcontrol,
1411 mutex_unlock(&codec->spdif_mutex); 1464 mutex_unlock(&codec->spdif_mutex);
1412 return err; 1465 return err;
1413} 1466}
1467EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_info);
1414 1468
1415int snd_hda_mixer_bind_ctls_get(struct snd_kcontrol *kcontrol, 1469int snd_hda_mixer_bind_ctls_get(struct snd_kcontrol *kcontrol,
1416 struct snd_ctl_elem_value *ucontrol) 1470 struct snd_ctl_elem_value *ucontrol)
@@ -1427,6 +1481,7 @@ int snd_hda_mixer_bind_ctls_get(struct snd_kcontrol *kcontrol,
1427 mutex_unlock(&codec->spdif_mutex); 1481 mutex_unlock(&codec->spdif_mutex);
1428 return err; 1482 return err;
1429} 1483}
1484EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_get);
1430 1485
1431int snd_hda_mixer_bind_ctls_put(struct snd_kcontrol *kcontrol, 1486int snd_hda_mixer_bind_ctls_put(struct snd_kcontrol *kcontrol,
1432 struct snd_ctl_elem_value *ucontrol) 1487 struct snd_ctl_elem_value *ucontrol)
@@ -1449,6 +1504,7 @@ int snd_hda_mixer_bind_ctls_put(struct snd_kcontrol *kcontrol,
1449 mutex_unlock(&codec->spdif_mutex); 1504 mutex_unlock(&codec->spdif_mutex);
1450 return err < 0 ? err : change; 1505 return err < 0 ? err : change;
1451} 1506}
1507EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_put);
1452 1508
1453int snd_hda_mixer_bind_tlv(struct snd_kcontrol *kcontrol, int op_flag, 1509int snd_hda_mixer_bind_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1454 unsigned int size, unsigned int __user *tlv) 1510 unsigned int size, unsigned int __user *tlv)
@@ -1465,6 +1521,7 @@ int snd_hda_mixer_bind_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1465 mutex_unlock(&codec->spdif_mutex); 1521 mutex_unlock(&codec->spdif_mutex);
1466 return err; 1522 return err;
1467} 1523}
1524EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_tlv);
1468 1525
1469struct hda_ctl_ops snd_hda_bind_vol = { 1526struct hda_ctl_ops snd_hda_bind_vol = {
1470 .info = snd_hda_mixer_amp_volume_info, 1527 .info = snd_hda_mixer_amp_volume_info,
@@ -1472,6 +1529,7 @@ struct hda_ctl_ops snd_hda_bind_vol = {
1472 .put = snd_hda_mixer_amp_volume_put, 1529 .put = snd_hda_mixer_amp_volume_put,
1473 .tlv = snd_hda_mixer_amp_tlv 1530 .tlv = snd_hda_mixer_amp_tlv
1474}; 1531};
1532EXPORT_SYMBOL_HDA(snd_hda_bind_vol);
1475 1533
1476struct hda_ctl_ops snd_hda_bind_sw = { 1534struct hda_ctl_ops snd_hda_bind_sw = {
1477 .info = snd_hda_mixer_amp_switch_info, 1535 .info = snd_hda_mixer_amp_switch_info,
@@ -1479,6 +1537,7 @@ struct hda_ctl_ops snd_hda_bind_sw = {
1479 .put = snd_hda_mixer_amp_switch_put, 1537 .put = snd_hda_mixer_amp_switch_put,
1480 .tlv = snd_hda_mixer_amp_tlv 1538 .tlv = snd_hda_mixer_amp_tlv
1481}; 1539};
1540EXPORT_SYMBOL_HDA(snd_hda_bind_sw);
1482 1541
1483/* 1542/*
1484 * SPDIF out controls 1543 * SPDIF out controls
@@ -1740,6 +1799,7 @@ int snd_hda_create_spdif_out_ctls(struct hda_codec *codec, hda_nid_t nid)
1740 codec->spdif_status = convert_to_spdif_status(codec->spdif_ctls); 1799 codec->spdif_status = convert_to_spdif_status(codec->spdif_ctls);
1741 return 0; 1800 return 0;
1742} 1801}
1802EXPORT_SYMBOL_HDA(snd_hda_create_spdif_out_ctls);
1743 1803
1744/* 1804/*
1745 * SPDIF sharing with analog output 1805 * SPDIF sharing with analog output
@@ -1777,6 +1837,7 @@ int snd_hda_create_spdif_share_sw(struct hda_codec *codec,
1777 return snd_hda_ctl_add(codec, 1837 return snd_hda_ctl_add(codec,
1778 snd_ctl_new1(&spdif_share_sw, mout)); 1838 snd_ctl_new1(&spdif_share_sw, mout));
1779} 1839}
1840EXPORT_SYMBOL_HDA(snd_hda_create_spdif_share_sw);
1780 1841
1781/* 1842/*
1782 * SPDIF input 1843 * SPDIF input
@@ -1886,6 +1947,7 @@ int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid)
1886 AC_DIG1_ENABLE; 1947 AC_DIG1_ENABLE;
1887 return 0; 1948 return 0;
1888} 1949}
1950EXPORT_SYMBOL_HDA(snd_hda_create_spdif_in_ctls);
1889 1951
1890#ifdef SND_HDA_NEEDS_RESUME 1952#ifdef SND_HDA_NEEDS_RESUME
1891/* 1953/*
@@ -1931,6 +1993,7 @@ int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid,
1931 snd_hda_power_down(codec); 1993 snd_hda_power_down(codec);
1932 return err; 1994 return err;
1933} 1995}
1996EXPORT_SYMBOL_HDA(snd_hda_codec_write_cache);
1934 1997
1935/* resume the all commands from the cache */ 1998/* resume the all commands from the cache */
1936void snd_hda_codec_resume_cache(struct hda_codec *codec) 1999void snd_hda_codec_resume_cache(struct hda_codec *codec)
@@ -1946,6 +2009,7 @@ void snd_hda_codec_resume_cache(struct hda_codec *codec)
1946 get_cmd_cache_cmd(key), buffer->val); 2009 get_cmd_cache_cmd(key), buffer->val);
1947 } 2010 }
1948} 2011}
2012EXPORT_SYMBOL_HDA(snd_hda_codec_resume_cache);
1949 2013
1950/** 2014/**
1951 * snd_hda_sequence_write_cache - sequence writes with caching 2015 * snd_hda_sequence_write_cache - sequence writes with caching
@@ -1963,6 +2027,7 @@ void snd_hda_sequence_write_cache(struct hda_codec *codec,
1963 snd_hda_codec_write_cache(codec, seq->nid, 0, seq->verb, 2027 snd_hda_codec_write_cache(codec, seq->nid, 0, seq->verb,
1964 seq->param); 2028 seq->param);
1965} 2029}
2030EXPORT_SYMBOL_HDA(snd_hda_sequence_write_cache);
1966#endif /* SND_HDA_NEEDS_RESUME */ 2031#endif /* SND_HDA_NEEDS_RESUME */
1967 2032
1968/* 2033/*
@@ -2081,7 +2146,7 @@ static void hda_call_codec_resume(struct hda_codec *codec)
2081 * 2146 *
2082 * Returns 0 if successful, otherwise a negative error code. 2147 * Returns 0 if successful, otherwise a negative error code.
2083 */ 2148 */
2084int __devinit snd_hda_build_controls(struct hda_bus *bus) 2149int /*__devinit*/ snd_hda_build_controls(struct hda_bus *bus)
2085{ 2150{
2086 struct hda_codec *codec; 2151 struct hda_codec *codec;
2087 2152
@@ -2092,6 +2157,7 @@ int __devinit snd_hda_build_controls(struct hda_bus *bus)
2092 } 2157 }
2093 return 0; 2158 return 0;
2094} 2159}
2160EXPORT_SYMBOL_HDA(snd_hda_build_controls);
2095 2161
2096int snd_hda_codec_build_controls(struct hda_codec *codec) 2162int snd_hda_codec_build_controls(struct hda_codec *codec)
2097{ 2163{
@@ -2203,6 +2269,7 @@ unsigned int snd_hda_calc_stream_format(unsigned int rate,
2203 2269
2204 return val; 2270 return val;
2205} 2271}
2272EXPORT_SYMBOL_HDA(snd_hda_calc_stream_format);
2206 2273
2207/** 2274/**
2208 * snd_hda_query_supported_pcm - query the supported PCM rates and formats 2275 * snd_hda_query_supported_pcm - query the supported PCM rates and formats
@@ -2382,6 +2449,7 @@ int snd_hda_is_supported_format(struct hda_codec *codec, hda_nid_t nid,
2382 2449
2383 return 1; 2450 return 1;
2384} 2451}
2452EXPORT_SYMBOL_HDA(snd_hda_is_supported_format);
2385 2453
2386/* 2454/*
2387 * PCM stuff 2455 * PCM stuff
@@ -2579,6 +2647,7 @@ int __devinit snd_hda_build_pcms(struct hda_bus *bus)
2579 } 2647 }
2580 return 0; 2648 return 0;
2581} 2649}
2650EXPORT_SYMBOL_HDA(snd_hda_build_pcms);
2582 2651
2583/** 2652/**
2584 * snd_hda_check_board_config - compare the current codec with the config table 2653 * snd_hda_check_board_config - compare the current codec with the config table
@@ -2634,6 +2703,7 @@ int snd_hda_check_board_config(struct hda_codec *codec,
2634 } 2703 }
2635 return -1; 2704 return -1;
2636} 2705}
2706EXPORT_SYMBOL_HDA(snd_hda_check_board_config);
2637 2707
2638/** 2708/**
2639 * snd_hda_add_new_ctls - create controls from the array 2709 * snd_hda_add_new_ctls - create controls from the array
@@ -2669,6 +2739,7 @@ int snd_hda_add_new_ctls(struct hda_codec *codec, struct snd_kcontrol_new *knew)
2669 } 2739 }
2670 return 0; 2740 return 0;
2671} 2741}
2742EXPORT_SYMBOL_HDA(snd_hda_add_new_ctls);
2672 2743
2673#ifdef CONFIG_SND_HDA_POWER_SAVE 2744#ifdef CONFIG_SND_HDA_POWER_SAVE
2674static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, 2745static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
@@ -2711,6 +2782,10 @@ void snd_hda_power_up(struct hda_codec *codec)
2711 cancel_delayed_work(&codec->power_work); 2782 cancel_delayed_work(&codec->power_work);
2712 codec->power_transition = 0; 2783 codec->power_transition = 0;
2713} 2784}
2785EXPORT_SYMBOL_HDA(snd_hda_power_up);
2786
2787#define power_save(codec) \
2788 ((codec)->bus->power_save ? *(codec)->bus->power_save : 0)
2714 2789
2715#define power_save(codec) \ 2790#define power_save(codec) \
2716 ((codec)->bus->power_save ? *(codec)->bus->power_save : 0) 2791 ((codec)->bus->power_save ? *(codec)->bus->power_save : 0)
@@ -2726,6 +2801,7 @@ void snd_hda_power_down(struct hda_codec *codec)
2726 msecs_to_jiffies(power_save(codec) * 1000)); 2801 msecs_to_jiffies(power_save(codec) * 1000));
2727 } 2802 }
2728} 2803}
2804EXPORT_SYMBOL_HDA(snd_hda_power_down);
2729 2805
2730int snd_hda_check_amp_list_power(struct hda_codec *codec, 2806int snd_hda_check_amp_list_power(struct hda_codec *codec,
2731 struct hda_loopback_check *check, 2807 struct hda_loopback_check *check,
@@ -2762,6 +2838,7 @@ int snd_hda_check_amp_list_power(struct hda_codec *codec,
2762 } 2838 }
2763 return 0; 2839 return 0;
2764} 2840}
2841EXPORT_SYMBOL_HDA(snd_hda_check_amp_list_power);
2765#endif 2842#endif
2766 2843
2767/* 2844/*
@@ -2781,6 +2858,7 @@ int snd_hda_ch_mode_info(struct hda_codec *codec,
2781 chmode[uinfo->value.enumerated.item].channels); 2858 chmode[uinfo->value.enumerated.item].channels);
2782 return 0; 2859 return 0;
2783} 2860}
2861EXPORT_SYMBOL_HDA(snd_hda_ch_mode_info);
2784 2862
2785int snd_hda_ch_mode_get(struct hda_codec *codec, 2863int snd_hda_ch_mode_get(struct hda_codec *codec,
2786 struct snd_ctl_elem_value *ucontrol, 2864 struct snd_ctl_elem_value *ucontrol,
@@ -2798,6 +2876,7 @@ int snd_hda_ch_mode_get(struct hda_codec *codec,
2798 } 2876 }
2799 return 0; 2877 return 0;
2800} 2878}
2879EXPORT_SYMBOL_HDA(snd_hda_ch_mode_get);
2801 2880
2802int snd_hda_ch_mode_put(struct hda_codec *codec, 2881int snd_hda_ch_mode_put(struct hda_codec *codec,
2803 struct snd_ctl_elem_value *ucontrol, 2882 struct snd_ctl_elem_value *ucontrol,
@@ -2818,6 +2897,7 @@ int snd_hda_ch_mode_put(struct hda_codec *codec,
2818 snd_hda_sequence_write_cache(codec, chmode[mode].sequence); 2897 snd_hda_sequence_write_cache(codec, chmode[mode].sequence);
2819 return 1; 2898 return 1;
2820} 2899}
2900EXPORT_SYMBOL_HDA(snd_hda_ch_mode_put);
2821 2901
2822/* 2902/*
2823 * input MUX helper 2903 * input MUX helper
@@ -2838,6 +2918,7 @@ int snd_hda_input_mux_info(const struct hda_input_mux *imux,
2838 strcpy(uinfo->value.enumerated.name, imux->items[index].label); 2918 strcpy(uinfo->value.enumerated.name, imux->items[index].label);
2839 return 0; 2919 return 0;
2840} 2920}
2921EXPORT_SYMBOL_HDA(snd_hda_input_mux_info);
2841 2922
2842int snd_hda_input_mux_put(struct hda_codec *codec, 2923int snd_hda_input_mux_put(struct hda_codec *codec,
2843 const struct hda_input_mux *imux, 2924 const struct hda_input_mux *imux,
@@ -2859,6 +2940,7 @@ int snd_hda_input_mux_put(struct hda_codec *codec,
2859 *cur_val = idx; 2940 *cur_val = idx;
2860 return 1; 2941 return 1;
2861} 2942}
2943EXPORT_SYMBOL_HDA(snd_hda_input_mux_put);
2862 2944
2863 2945
2864/* 2946/*
@@ -2911,6 +2993,7 @@ int snd_hda_multi_out_dig_open(struct hda_codec *codec,
2911 mutex_unlock(&codec->spdif_mutex); 2993 mutex_unlock(&codec->spdif_mutex);
2912 return 0; 2994 return 0;
2913} 2995}
2996EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_open);
2914 2997
2915int snd_hda_multi_out_dig_prepare(struct hda_codec *codec, 2998int snd_hda_multi_out_dig_prepare(struct hda_codec *codec,
2916 struct hda_multi_out *mout, 2999 struct hda_multi_out *mout,
@@ -2923,6 +3006,7 @@ int snd_hda_multi_out_dig_prepare(struct hda_codec *codec,
2923 mutex_unlock(&codec->spdif_mutex); 3006 mutex_unlock(&codec->spdif_mutex);
2924 return 0; 3007 return 0;
2925} 3008}
3009EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_prepare);
2926 3010
2927/* 3011/*
2928 * release the digital out 3012 * release the digital out
@@ -2935,6 +3019,7 @@ int snd_hda_multi_out_dig_close(struct hda_codec *codec,
2935 mutex_unlock(&codec->spdif_mutex); 3019 mutex_unlock(&codec->spdif_mutex);
2936 return 0; 3020 return 0;
2937} 3021}
3022EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_close);
2938 3023
2939/* 3024/*
2940 * set up more restrictions for analog out 3025 * set up more restrictions for analog out
@@ -2974,6 +3059,7 @@ int snd_hda_multi_out_analog_open(struct hda_codec *codec,
2974 return snd_pcm_hw_constraint_step(substream->runtime, 0, 3059 return snd_pcm_hw_constraint_step(substream->runtime, 0,
2975 SNDRV_PCM_HW_PARAM_CHANNELS, 2); 3060 SNDRV_PCM_HW_PARAM_CHANNELS, 2);
2976} 3061}
3062EXPORT_SYMBOL_HDA(snd_hda_multi_out_analog_open);
2977 3063
2978/* 3064/*
2979 * set up the i/o for analog out 3065 * set up the i/o for analog out
@@ -3032,6 +3118,7 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec,
3032 } 3118 }
3033 return 0; 3119 return 0;
3034} 3120}
3121EXPORT_SYMBOL_HDA(snd_hda_multi_out_analog_prepare);
3035 3122
3036/* 3123/*
3037 * clean up the setting for analog out 3124 * clean up the setting for analog out
@@ -3058,6 +3145,7 @@ int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec,
3058 mutex_unlock(&codec->spdif_mutex); 3145 mutex_unlock(&codec->spdif_mutex);
3059 return 0; 3146 return 0;
3060} 3147}
3148EXPORT_SYMBOL_HDA(snd_hda_multi_out_analog_cleanup);
3061 3149
3062/* 3150/*
3063 * Helper for automatic pin configuration 3151 * Helper for automatic pin configuration
@@ -3343,11 +3431,13 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
3343 3431
3344 return 0; 3432 return 0;
3345} 3433}
3434EXPORT_SYMBOL_HDA(snd_hda_parse_pin_def_config);
3346 3435
3347/* labels for input pins */ 3436/* labels for input pins */
3348const char *auto_pin_cfg_labels[AUTO_PIN_LAST] = { 3437const char *auto_pin_cfg_labels[AUTO_PIN_LAST] = {
3349 "Mic", "Front Mic", "Line", "Front Line", "CD", "Aux" 3438 "Mic", "Front Mic", "Line", "Front Line", "CD", "Aux"
3350}; 3439};
3440EXPORT_SYMBOL_HDA(auto_pin_cfg_labels);
3351 3441
3352 3442
3353#ifdef CONFIG_PM 3443#ifdef CONFIG_PM
@@ -3375,6 +3465,7 @@ int snd_hda_suspend(struct hda_bus *bus, pm_message_t state)
3375 } 3465 }
3376 return 0; 3466 return 0;
3377} 3467}
3468EXPORT_SYMBOL_HDA(snd_hda_suspend);
3378 3469
3379/** 3470/**
3380 * snd_hda_resume - resume the codecs 3471 * snd_hda_resume - resume the codecs
@@ -3395,7 +3486,8 @@ int snd_hda_resume(struct hda_bus *bus)
3395 } 3486 }
3396 return 0; 3487 return 0;
3397} 3488}
3398#endif 3489EXPORT_SYMBOL_HDA(snd_hda_resume);
3490#endif /* CONFIG_PM */
3399 3491
3400/* 3492/*
3401 * generic arrays 3493 * generic arrays
@@ -3424,6 +3516,7 @@ void *snd_array_new(struct snd_array *array)
3424 } 3516 }
3425 return snd_array_elem(array, array->used++); 3517 return snd_array_elem(array, array->used++);
3426} 3518}
3519EXPORT_SYMBOL_HDA(snd_array_new);
3427 3520
3428/* free the given array elements */ 3521/* free the given array elements */
3429void snd_array_free(struct snd_array *array) 3522void snd_array_free(struct snd_array *array)
@@ -3433,6 +3526,7 @@ void snd_array_free(struct snd_array *array)
3433 array->alloced = 0; 3526 array->alloced = 0;
3434 array->list = NULL; 3527 array->list = NULL;
3435} 3528}
3529EXPORT_SYMBOL_HDA(snd_array_free);
3436 3530
3437/* 3531/*
3438 * used by hda_proc.c and hda_eld.c 3532 * used by hda_proc.c and hda_eld.c
@@ -3451,6 +3545,7 @@ void snd_print_pcm_rates(int pcm, char *buf, int buflen)
3451 3545
3452 buf[j] = '\0'; /* necessary when j == 0 */ 3546 buf[j] = '\0'; /* necessary when j == 0 */
3453} 3547}
3548EXPORT_SYMBOL_HDA(snd_print_pcm_rates);
3454 3549
3455void snd_print_pcm_bits(int pcm, char *buf, int buflen) 3550void snd_print_pcm_bits(int pcm, char *buf, int buflen)
3456{ 3551{
@@ -3463,3 +3558,7 @@ void snd_print_pcm_bits(int pcm, char *buf, int buflen)
3463 3558
3464 buf[j] = '\0'; /* necessary when j == 0 */ 3559 buf[j] = '\0'; /* necessary when j == 0 */
3465} 3560}
3561EXPORT_SYMBOL_HDA(snd_print_pcm_bits);
3562
3563MODULE_DESCRIPTION("HDA codec core");
3564MODULE_LICENSE("GPL");
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index bbbc83b387d..5587d416229 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -640,6 +640,16 @@ struct hda_codec_preset {
640 int (*patch)(struct hda_codec *codec); 640 int (*patch)(struct hda_codec *codec);
641}; 641};
642 642
643struct hda_codec_preset_list {
644 const struct hda_codec_preset *preset;
645 struct module *owner;
646 struct list_head list;
647};
648
649/* initial hook */
650int snd_hda_add_codec_preset(struct hda_codec_preset_list *preset);
651int snd_hda_delete_codec_preset(struct hda_codec_preset_list *preset);
652
643/* ops set by the preset patch */ 653/* ops set by the preset patch */
644struct hda_codec_ops { 654struct hda_codec_ops {
645 int (*build_controls)(struct hda_codec *codec); 655 int (*build_controls)(struct hda_codec *codec);
@@ -733,6 +743,7 @@ struct hda_codec {
733 743
734 /* detected preset */ 744 /* detected preset */
735 const struct hda_codec_preset *preset; 745 const struct hda_codec_preset *preset;
746 struct module *owner;
736 const char *name; /* codec name */ 747 const char *name; /* codec name */
737 const char *modelname; /* model name for preset */ 748 const char *modelname; /* model name for preset */
738 749
@@ -896,4 +907,19 @@ static inline void snd_hda_power_down(struct hda_codec *codec) {}
896#define snd_hda_codec_needs_resume(codec) 1 907#define snd_hda_codec_needs_resume(codec) 1
897#endif 908#endif
898 909
910/*
911 * Codec modularization
912 */
913
914/* Export symbols only for communication with codec drivers;
915 * When built in kernel, all HD-audio drivers are supposed to be statically
916 * linked to the kernel. Thus, the symbols don't have to (or shouldn't) be
917 * exported unless it's built as a module.
918 */
919#ifdef MODULE
920#define EXPORT_SYMBOL_HDA(sym) EXPORT_SYMBOL_GPL(sym)
921#else
922#define EXPORT_SYMBOL_HDA(sym)
923#endif
924
899#endif /* __SOUND_HDA_CODEC_H */ 925#endif /* __SOUND_HDA_CODEC_H */
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 98ff010d5b9..65745e96dc7 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 173af489322..300ab407cf4 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 38212c1020a..00000000000
--- 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 0cc6be12b8b..c1918a1a6df 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 5603a1acddb..5887b827bb3 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 6ef57fbfb6e..f3ebe837f2d 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 07601070815..b20e1cede00 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 fe08bef897c..290da562f29 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 1360d54a7d0..e23de5594b6 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 40b3fcd142a..0bd4e6bf354 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
@@ -16613,7 +16612,7 @@ static int patch_alc662(struct hda_codec *codec)
16613/* 16612/*
16614 * patch entries 16613 * patch entries
16615 */ 16614 */
16616struct hda_codec_preset snd_hda_preset_realtek[] = { 16615static struct hda_codec_preset snd_hda_preset_realtek[] = {
16617 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, 16616 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
16618 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, 16617 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
16619 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, 16618 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
@@ -16645,3 +16644,26 @@ struct hda_codec_preset snd_hda_preset_realtek[] = {
16645 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, 16644 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16646 {} /* terminator */ 16645 {} /* terminator */
16647}; 16646};
16647
16648MODULE_ALIAS("snd-hda-codec-id:10ec*");
16649
16650MODULE_LICENSE("GPL");
16651MODULE_DESCRIPTION("Realtek HD-audio codec");
16652
16653static struct hda_codec_preset_list realtek_list = {
16654 .preset = snd_hda_preset_realtek,
16655 .owner = THIS_MODULE,
16656};
16657
16658static int __init patch_realtek_init(void)
16659{
16660 return snd_hda_add_codec_preset(&realtek_list);
16661}
16662
16663static void __exit patch_realtek_exit(void)
16664{
16665 snd_hda_delete_codec_preset(&realtek_list);
16666}
16667
16668module_init(patch_realtek_init)
16669module_exit(patch_realtek_exit)
diff --git a/sound/pci/hda/patch_si3054.c b/sound/pci/hda/patch_si3054.c
index 9332b63e406..43b436c5d01 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 14db35a61cf..f98c7e99787 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 {
@@ -5461,7 +5460,7 @@ static int patch_stac9872(struct hda_codec *codec)
5461/* 5460/*
5462 * patch entries 5461 * patch entries
5463 */ 5462 */
5464struct hda_codec_preset snd_hda_preset_sigmatel[] = { 5463static struct hda_codec_preset snd_hda_preset_sigmatel[] = {
5465 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 }, 5464 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 },
5466 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x }, 5465 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x },
5467 { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x }, 5466 { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x },
@@ -5525,3 +5524,27 @@ struct hda_codec_preset snd_hda_preset_sigmatel[] = {
5525 { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx }, 5524 { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
5526 {} /* terminator */ 5525 {} /* terminator */
5527}; 5526};
5527
5528MODULE_ALIAS("snd-hda-codec-id:8384*");
5529MODULE_ALIAS("snd-hda-codec-id:111d*");
5530
5531MODULE_LICENSE("GPL");
5532MODULE_DESCRIPTION("IDT/Sigmatel HD-audio codec");
5533
5534static struct hda_codec_preset_list sigmatel_list = {
5535 .preset = snd_hda_preset_sigmatel,
5536 .owner = THIS_MODULE,
5537};
5538
5539static int __init patch_sigmatel_init(void)
5540{
5541 return snd_hda_add_codec_preset(&sigmatel_list);
5542}
5543
5544static void __exit patch_sigmatel_exit(void)
5545{
5546 snd_hda_delete_codec_preset(&sigmatel_list);
5547}
5548
5549module_init(patch_sigmatel_init)
5550module_exit(patch_sigmatel_exit)
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 05182be1c9f..6e4d01d1d50 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)