1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21#include <linux/init.h>
22#include <linux/slab.h>
23#include <linux/module.h>
24#include <sound/core.h>
25#include "hda_codec.h"
26#include "hda_local.h"
27#include "hda_auto_parser.h"
28#include "hda_jack.h"
29#include "hda_generic.h"
30
31
32static const struct hda_codec_ops ca0110_patch_ops = {
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,
37 .unsol_event = snd_hda_jack_unsol_event,
38};
39
40static int ca0110_parse_auto_config(struct hda_codec *codec)
41{
42 struct hda_gen_spec *spec = codec->spec;
43 int err;
44
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);
49 if (err < 0)
50 return err;
51
52 return 0;
53}
54
55
56static int patch_ca0110(struct hda_codec *codec)
57{
58 struct hda_gen_spec *spec;
59 int err;
60
61 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
62 if (!spec)
63 return -ENOMEM;
64 snd_hda_gen_spec_init(spec);
65 codec->spec = spec;
66 codec->patch_ops = ca0110_patch_ops;
67
68 spec->multi_cap_vol = 1;
69 codec->bus->needs_damn_long_delay = 1;
70
71 err = ca0110_parse_auto_config(codec);
72 if (err < 0)
73 goto error;
74
75 return 0;
76
77 error:
78 snd_hda_gen_free(codec);
79 return err;
80}
81
82
83
84
85
86static 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),
90 {}
91};
92MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_ca0110);
93
94MODULE_LICENSE("GPL");
95MODULE_DESCRIPTION("Creative CA0110-IBG HD-audio codec");
96
97static struct hda_codec_driver ca0110_driver = {
98 .id = snd_hda_id_ca0110,
99};
100
101module_hda_codec_driver(ca0110_driver);
102