1 // SPDX-License-Identifier: GPL-2.0-or-later
2 //
3 // Realtek ALC680 codec
4 //
5
6 #include <linux/init.h>
7 #include <linux/module.h>
8 #include "realtek.h"
9
alc680_parse_auto_config(struct hda_codec * codec)10 static int alc680_parse_auto_config(struct hda_codec *codec)
11 {
12 return alc_parse_auto_config(codec, NULL, NULL);
13 }
14
15 /*
16 */
alc680_probe(struct hda_codec * codec,const struct hda_device_id * id)17 static int alc680_probe(struct hda_codec *codec, const struct hda_device_id *id)
18 {
19 int err;
20
21 /* ALC680 has no aa-loopback mixer */
22 err = alc_alloc_spec(codec, 0);
23 if (err < 0)
24 return err;
25
26 /* automatic parse from the BIOS config */
27 err = alc680_parse_auto_config(codec);
28 if (err < 0) {
29 snd_hda_gen_remove(codec);
30 return err;
31 }
32
33 return 0;
34 }
35
36 static const struct hda_codec_ops alc680_codec_ops = {
37 .probe = alc680_probe,
38 .remove = snd_hda_gen_remove,
39 .build_controls = alc_build_controls,
40 .build_pcms = snd_hda_gen_build_pcms,
41 .init = alc_init,
42 .unsol_event = snd_hda_jack_unsol_event,
43 .resume = alc_resume,
44 .suspend = alc_suspend,
45 .check_power_status = snd_hda_gen_check_power_status,
46 .stream_pm = snd_hda_gen_stream_pm,
47 };
48
49 /*
50 * driver entries
51 */
52 static const struct hda_device_id snd_hda_id_alc680[] = {
53 HDA_CODEC_ID(0x10ec0680, "ALC680"),
54 {} /* terminator */
55 };
56 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_alc680);
57
58 MODULE_LICENSE("GPL");
59 MODULE_DESCRIPTION("Realtek ALC680 HD-audio codec");
60 MODULE_IMPORT_NS("SND_HDA_CODEC_REALTEK");
61
62 static struct hda_codec_driver alc680_driver = {
63 .id = snd_hda_id_alc680,
64 .ops = &alc680_codec_ops,
65 };
66
67 module_hda_codec_driver(alc680_driver);
68