aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-04-16 05:27:07 -0400
committerJaroslav Kysela <perex@suse.cz>2007-05-11 10:55:59 -0400
commit756e2b014349e90aca1d0432498d1b35e5445566 (patch)
tree29783e20bd2b5433024d63c9061500fabe3be745 /sound/pci/hda/hda_codec.c
parent5930ca41857f57e130b4438a9a261b2ab91f6fcf (diff)
[ALSA] hda-intel - Merge hda-codec module to a single module
Merge hda-codec module to a single hda-intel module since this is the only user right now. Although hda-codec stuff is designed to be used universally from different controller drivers, currently only one controller interface (and compatibles) are used. So, let's merge them to a single module to save memory. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r--sound/pci/hda/hda_codec.c92
1 files changed, 25 insertions, 67 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 1fa93bd25a7b..fe4acfa9e4e6 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -24,7 +24,6 @@
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/pci.h> 26#include <linux/pci.h>
27#include <linux/moduleparam.h>
28#include <linux/mutex.h> 27#include <linux/mutex.h>
29#include <sound/core.h> 28#include <sound/core.h>
30#include "hda_codec.h" 29#include "hda_codec.h"
@@ -34,11 +33,6 @@
34#include "hda_local.h" 33#include "hda_local.h"
35 34
36 35
37MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
38MODULE_DESCRIPTION("Universal interface for High Definition Audio Codec");
39MODULE_LICENSE("GPL");
40
41
42/* 36/*
43 * vendor / preset table 37 * vendor / preset table
44 */ 38 */
@@ -90,8 +84,6 @@ unsigned int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid, int dire
90 return res; 84 return res;
91} 85}
92 86
93EXPORT_SYMBOL(snd_hda_codec_read);
94
95/** 87/**
96 * snd_hda_codec_write - send a single command without waiting for response 88 * snd_hda_codec_write - send a single command without waiting for response
97 * @codec: the HDA codec 89 * @codec: the HDA codec
@@ -114,8 +106,6 @@ int snd_hda_codec_write(struct hda_codec *codec, hda_nid_t nid, int direct,
114 return err; 106 return err;
115} 107}
116 108
117EXPORT_SYMBOL(snd_hda_codec_write);
118
119/** 109/**
120 * snd_hda_sequence_write - sequence writes 110 * snd_hda_sequence_write - sequence writes
121 * @codec: the HDA codec 111 * @codec: the HDA codec
@@ -130,8 +120,6 @@ void snd_hda_sequence_write(struct hda_codec *codec, const struct hda_verb *seq)
130 snd_hda_codec_write(codec, seq->nid, 0, seq->verb, seq->param); 120 snd_hda_codec_write(codec, seq->nid, 0, seq->verb, seq->param);
131} 121}
132 122
133EXPORT_SYMBOL(snd_hda_sequence_write);
134
135/** 123/**
136 * snd_hda_get_sub_nodes - get the range of sub nodes 124 * snd_hda_get_sub_nodes - get the range of sub nodes
137 * @codec: the HDA codec 125 * @codec: the HDA codec
@@ -150,8 +138,6 @@ int snd_hda_get_sub_nodes(struct hda_codec *codec, hda_nid_t nid, hda_nid_t *sta
150 return (int)(parm & 0x7fff); 138 return (int)(parm & 0x7fff);
151} 139}
152 140
153EXPORT_SYMBOL(snd_hda_get_sub_nodes);
154
155/** 141/**
156 * snd_hda_get_connections - get connection list 142 * snd_hda_get_connections - get connection list
157 * @codec: the HDA codec 143 * @codec: the HDA codec
@@ -268,8 +254,6 @@ int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex)
268 return 0; 254 return 0;
269} 255}
270 256
271EXPORT_SYMBOL(snd_hda_queue_unsol_event);
272
273/* 257/*
274 * process queueud unsolicited events 258 * process queueud unsolicited events
275 */ 259 */
@@ -298,7 +282,7 @@ static void process_unsol_events(struct work_struct *work)
298/* 282/*
299 * initialize unsolicited queue 283 * initialize unsolicited queue
300 */ 284 */
301static int init_unsol_queue(struct hda_bus *bus) 285static int __devinit init_unsol_queue(struct hda_bus *bus)
302{ 286{
303 struct hda_bus_unsolicited *unsol; 287 struct hda_bus_unsolicited *unsol;
304 288
@@ -355,8 +339,9 @@ static int snd_hda_bus_dev_free(struct snd_device *device)
355 * 339 *
356 * Returns 0 if successful, or a negative error code. 340 * Returns 0 if successful, or a negative error code.
357 */ 341 */
358int snd_hda_bus_new(struct snd_card *card, const struct hda_bus_template *temp, 342int __devinit snd_hda_bus_new(struct snd_card *card,
359 struct hda_bus **busp) 343 const struct hda_bus_template *temp,
344 struct hda_bus **busp)
360{ 345{
361 struct hda_bus *bus; 346 struct hda_bus *bus;
362 int err; 347 int err;
@@ -394,12 +379,11 @@ int snd_hda_bus_new(struct snd_card *card, const struct hda_bus_template *temp,
394 return 0; 379 return 0;
395} 380}
396 381
397EXPORT_SYMBOL(snd_hda_bus_new);
398
399/* 382/*
400 * find a matching codec preset 383 * find a matching codec preset
401 */ 384 */
402static const struct hda_codec_preset *find_codec_preset(struct hda_codec *codec) 385static const struct hda_codec_preset __devinit *
386find_codec_preset(struct hda_codec *codec)
403{ 387{
404 const struct hda_codec_preset **tbl, *preset; 388 const struct hda_codec_preset **tbl, *preset;
405 389
@@ -450,7 +434,7 @@ void snd_hda_get_codec_name(struct hda_codec *codec,
450/* 434/*
451 * look for an AFG and MFG nodes 435 * look for an AFG and MFG nodes
452 */ 436 */
453static void setup_fg_nodes(struct hda_codec *codec) 437static void __devinit setup_fg_nodes(struct hda_codec *codec)
454{ 438{
455 int i, total_nodes; 439 int i, total_nodes;
456 hda_nid_t nid; 440 hda_nid_t nid;
@@ -517,8 +501,8 @@ static void init_amp_hash(struct hda_codec *codec);
517 * 501 *
518 * Returns 0 if successful, or a negative error code. 502 * Returns 0 if successful, or a negative error code.
519 */ 503 */
520int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, 504int __devinit snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr,
521 struct hda_codec **codecp) 505 struct hda_codec **codecp)
522{ 506{
523 struct hda_codec *codec; 507 struct hda_codec *codec;
524 char component[13]; 508 char component[13];
@@ -603,8 +587,6 @@ int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr,
603 return 0; 587 return 0;
604} 588}
605 589
606EXPORT_SYMBOL(snd_hda_codec_new);
607
608/** 590/**
609 * snd_hda_codec_setup_stream - set up the codec for streaming 591 * snd_hda_codec_setup_stream - set up the codec for streaming
610 * @codec: the CODEC to set up 592 * @codec: the CODEC to set up
@@ -627,8 +609,6 @@ void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, u32 stre
627 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, format); 609 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, format);
628} 610}
629 611
630EXPORT_SYMBOL(snd_hda_codec_setup_stream);
631
632/* 612/*
633 * amp access functions 613 * amp access functions
634 */ 614 */
@@ -639,7 +619,7 @@ EXPORT_SYMBOL(snd_hda_codec_setup_stream);
639#define INFO_AMP_VOL(ch) (1 << (1 + (ch))) 619#define INFO_AMP_VOL(ch) (1 << (1 + (ch)))
640 620
641/* initialize the hash table */ 621/* initialize the hash table */
642static void init_amp_hash(struct hda_codec *codec) 622static void __devinit init_amp_hash(struct hda_codec *codec)
643{ 623{
644 memset(codec->amp_hash, 0xff, sizeof(codec->amp_hash)); 624 memset(codec->amp_hash, 0xff, sizeof(codec->amp_hash));
645 codec->num_amp_entries = 0; 625 codec->num_amp_entries = 0;
@@ -1169,7 +1149,8 @@ static struct snd_kcontrol_new dig_mixes[] = {
1169 * 1149 *
1170 * Returns 0 if successful, or a negative error code. 1150 * Returns 0 if successful, or a negative error code.
1171 */ 1151 */
1172int snd_hda_create_spdif_out_ctls(struct hda_codec *codec, hda_nid_t nid) 1152int __devinit snd_hda_create_spdif_out_ctls(struct hda_codec *codec,
1153 hda_nid_t nid)
1173{ 1154{
1174 int err; 1155 int err;
1175 struct snd_kcontrol *kctl; 1156 struct snd_kcontrol *kctl;
@@ -1261,7 +1242,8 @@ static struct snd_kcontrol_new dig_in_ctls[] = {
1261 * 1242 *
1262 * Returns 0 if successful, or a negative error code. 1243 * Returns 0 if successful, or a negative error code.
1263 */ 1244 */
1264int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid) 1245int __devinit snd_hda_create_spdif_in_ctls(struct hda_codec *codec,
1246 hda_nid_t nid)
1265{ 1247{
1266 int err; 1248 int err;
1267 struct snd_kcontrol *kctl; 1249 struct snd_kcontrol *kctl;
@@ -1311,7 +1293,7 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
1311 * 1293 *
1312 * Returns 0 if successful, otherwise a negative error code. 1294 * Returns 0 if successful, otherwise a negative error code.
1313 */ 1295 */
1314int snd_hda_build_controls(struct hda_bus *bus) 1296int __devinit snd_hda_build_controls(struct hda_bus *bus)
1315{ 1297{
1316 struct list_head *p; 1298 struct list_head *p;
1317 1299
@@ -1342,8 +1324,6 @@ int snd_hda_build_controls(struct hda_bus *bus)
1342 return 0; 1324 return 0;
1343} 1325}
1344 1326
1345EXPORT_SYMBOL(snd_hda_build_controls);
1346
1347/* 1327/*
1348 * stream formats 1328 * stream formats
1349 */ 1329 */
@@ -1433,8 +1413,6 @@ unsigned int snd_hda_calc_stream_format(unsigned int rate,
1433 return val; 1413 return val;
1434} 1414}
1435 1415
1436EXPORT_SYMBOL(snd_hda_calc_stream_format);
1437
1438/** 1416/**
1439 * snd_hda_query_supported_pcm - query the supported PCM rates and formats 1417 * snd_hda_query_supported_pcm - query the supported PCM rates and formats
1440 * @codec: the HDA codec 1418 * @codec: the HDA codec
@@ -1688,7 +1666,7 @@ static int set_pcm_default_values(struct hda_codec *codec, struct hda_pcm_stream
1688 * 1666 *
1689 * This function returns 0 if successfull, or a negative error code. 1667 * This function returns 0 if successfull, or a negative error code.
1690 */ 1668 */
1691int snd_hda_build_pcms(struct hda_bus *bus) 1669int __devinit snd_hda_build_pcms(struct hda_bus *bus)
1692{ 1670{
1693 struct list_head *p; 1671 struct list_head *p;
1694 1672
@@ -1716,8 +1694,6 @@ int snd_hda_build_pcms(struct hda_bus *bus)
1716 return 0; 1694 return 0;
1717} 1695}
1718 1696
1719EXPORT_SYMBOL(snd_hda_build_pcms);
1720
1721/** 1697/**
1722 * snd_hda_check_board_config - compare the current codec with the config table 1698 * snd_hda_check_board_config - compare the current codec with the config table
1723 * @codec: the HDA codec 1699 * @codec: the HDA codec
@@ -1731,9 +1707,9 @@ EXPORT_SYMBOL(snd_hda_build_pcms);
1731 * 1707 *
1732 * If no entries are matching, the function returns a negative value. 1708 * If no entries are matching, the function returns a negative value.
1733 */ 1709 */
1734int snd_hda_check_board_config(struct hda_codec *codec, 1710int __devinit snd_hda_check_board_config(struct hda_codec *codec,
1735 int num_configs, const char **models, 1711 int num_configs, const char **models,
1736 const struct snd_pci_quirk *tbl) 1712 const struct snd_pci_quirk *tbl)
1737{ 1713{
1738 if (codec->bus->modelname && models) { 1714 if (codec->bus->modelname && models) {
1739 int i; 1715 int i;
@@ -1783,7 +1759,8 @@ int snd_hda_check_board_config(struct hda_codec *codec,
1783 * 1759 *
1784 * Returns 0 if successful, or a negative error code. 1760 * Returns 0 if successful, or a negative error code.
1785 */ 1761 */
1786int snd_hda_add_new_ctls(struct hda_codec *codec, struct snd_kcontrol_new *knew) 1762int __devinit snd_hda_add_new_ctls(struct hda_codec *codec,
1763 struct snd_kcontrol_new *knew)
1787{ 1764{
1788 int err; 1765 int err;
1789 1766
@@ -2040,7 +2017,7 @@ int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec, struct hda_multi_o
2040 * Helper for automatic ping configuration 2017 * Helper for automatic ping configuration
2041 */ 2018 */
2042 2019
2043static int is_in_nid_list(hda_nid_t nid, hda_nid_t *list) 2020static int __devinit is_in_nid_list(hda_nid_t nid, hda_nid_t *list)
2044{ 2021{
2045 for (; *list; list++) 2022 for (; *list; list++)
2046 if (*list == nid) 2023 if (*list == nid)
@@ -2065,8 +2042,9 @@ static int is_in_nid_list(hda_nid_t nid, hda_nid_t *list)
2065 * The digital input/output pins are assigned to dig_in_pin and dig_out_pin, 2042 * The digital input/output pins are assigned to dig_in_pin and dig_out_pin,
2066 * respectively. 2043 * respectively.
2067 */ 2044 */
2068int snd_hda_parse_pin_def_config(struct hda_codec *codec, struct auto_pin_cfg *cfg, 2045int __devinit snd_hda_parse_pin_def_config(struct hda_codec *codec,
2069 hda_nid_t *ignore_nids) 2046 struct auto_pin_cfg *cfg,
2047 hda_nid_t *ignore_nids)
2070{ 2048{
2071 hda_nid_t nid, nid_start; 2049 hda_nid_t nid, nid_start;
2072 int i, j, nodes; 2050 int i, j, nodes;
@@ -2273,8 +2251,6 @@ int snd_hda_suspend(struct hda_bus *bus, pm_message_t state)
2273 return 0; 2251 return 0;
2274} 2252}
2275 2253
2276EXPORT_SYMBOL(snd_hda_suspend);
2277
2278/** 2254/**
2279 * snd_hda_resume - resume the codecs 2255 * snd_hda_resume - resume the codecs
2280 * @bus: the HDA bus 2256 * @bus: the HDA bus
@@ -2297,8 +2273,6 @@ int snd_hda_resume(struct hda_bus *bus)
2297 return 0; 2273 return 0;
2298} 2274}
2299 2275
2300EXPORT_SYMBOL(snd_hda_resume);
2301
2302/** 2276/**
2303 * snd_hda_resume_ctls - resume controls in the new control list 2277 * snd_hda_resume_ctls - resume controls in the new control list
2304 * @codec: the HDA codec 2278 * @codec: the HDA codec
@@ -2357,19 +2331,3 @@ int snd_hda_resume_spdif_in(struct hda_codec *codec)
2357 return snd_hda_resume_ctls(codec, dig_in_ctls); 2331 return snd_hda_resume_ctls(codec, dig_in_ctls);
2358} 2332}
2359#endif 2333#endif
2360
2361/*
2362 * INIT part
2363 */
2364
2365static int __init alsa_hda_init(void)
2366{
2367 return 0;
2368}
2369
2370static void __exit alsa_hda_exit(void)
2371{
2372}
2373
2374module_init(alsa_hda_init)
2375module_exit(alsa_hda_exit)