]>
Commit | Line | Data |
---|---|---|
4e01f54b TI |
1 | /* |
2 | * HD audio interface patch for Creative X-Fi CA0110-IBG chip | |
3 | * | |
4 | * Copyright (c) 2008 Takashi Iwai <tiwai@suse.de> | |
5 | * | |
6 | * This driver is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation; either version 2 of the License, or | |
9 | * (at your option) any later version. | |
10 | * | |
11 | * This driver is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program; if not, write to the Free Software | |
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 | */ | |
20 | ||
21 | #include <linux/init.h> | |
4e01f54b | 22 | #include <linux/slab.h> |
da155d5b | 23 | #include <linux/module.h> |
4e01f54b TI |
24 | #include <sound/core.h> |
25 | #include "hda_codec.h" | |
26 | #include "hda_local.h" | |
128bc4ba | 27 | #include "hda_auto_parser.h" |
8fadf1da TI |
28 | #include "hda_jack.h" |
29 | #include "hda_generic.h" | |
4e01f54b | 30 | |
4e01f54b | 31 | |
728850a7 | 32 | static const struct hda_codec_ops ca0110_patch_ops = { |
8fadf1da TI |
33 | .build_controls = snd_hda_gen_build_controls, |
34 | .build_pcms = snd_hda_gen_build_pcms, | |
35 | .init = snd_hda_gen_init, | |
36 | .free = snd_hda_gen_free, | |
8a6c21ae | 37 | .unsol_event = snd_hda_jack_unsol_event, |
4e01f54b TI |
38 | }; |
39 | ||
4e01f54b TI |
40 | static int ca0110_parse_auto_config(struct hda_codec *codec) |
41 | { | |
8fadf1da | 42 | struct hda_gen_spec *spec = codec->spec; |
4e01f54b TI |
43 | int err; |
44 | ||
8fadf1da TI |
45 | err = snd_hda_parse_pin_defcfg(codec, &spec->autocfg, NULL, 0); |
46 | if (err < 0) | |
47 | return err; | |
48 | err = snd_hda_gen_parse_auto_config(codec, &spec->autocfg); | |
4e01f54b TI |
49 | if (err < 0) |
50 | return err; | |
51 | ||
4e01f54b TI |
52 | return 0; |
53 | } | |
54 | ||
55 | ||
1e168953 | 56 | static int patch_ca0110(struct hda_codec *codec) |
4e01f54b | 57 | { |
8fadf1da | 58 | struct hda_gen_spec *spec; |
4e01f54b TI |
59 | int err; |
60 | ||
61 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
62 | if (!spec) | |
63 | return -ENOMEM; | |
8fadf1da | 64 | snd_hda_gen_spec_init(spec); |
4e01f54b | 65 | codec->spec = spec; |
225068ab | 66 | codec->patch_ops = ca0110_patch_ops; |
4e01f54b | 67 | |
8fadf1da | 68 | spec->multi_cap_vol = 1; |
4e01f54b TI |
69 | codec->bus->needs_damn_long_delay = 1; |
70 | ||
71 | err = ca0110_parse_auto_config(codec); | |
72 | if (err < 0) | |
73 | goto error; | |
74 | ||
4e01f54b TI |
75 | return 0; |
76 | ||
77 | error: | |
8fadf1da | 78 | snd_hda_gen_free(codec); |
4e01f54b TI |
79 | return err; |
80 | } | |
81 | ||
82 | ||
83 | /* | |
84 | * patch entries | |
85 | */ | |
b9a94a9c TI |
86 | static const struct hda_device_id snd_hda_id_ca0110[] = { |
87 | HDA_CODEC_ENTRY(0x1102000a, "CA0110-IBG", patch_ca0110), | |
88 | HDA_CODEC_ENTRY(0x1102000b, "CA0110-IBG", patch_ca0110), | |
89 | HDA_CODEC_ENTRY(0x1102000d, "SB0880 X-Fi", patch_ca0110), | |
4e01f54b TI |
90 | {} /* terminator */ |
91 | }; | |
b9a94a9c | 92 | MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_ca0110); |
4e01f54b TI |
93 | |
94 | MODULE_LICENSE("GPL"); | |
95 | MODULE_DESCRIPTION("Creative CA0110-IBG HD-audio codec"); | |
96 | ||
d8a766a1 | 97 | static struct hda_codec_driver ca0110_driver = { |
b9a94a9c | 98 | .id = snd_hda_id_ca0110, |
4e01f54b TI |
99 | }; |
100 | ||
d8a766a1 | 101 | module_hda_codec_driver(ca0110_driver); |