Debian Codegraph @

util/autoport/azalia.go

raw symbols SCIP
1 package main
2
3 import (
4 "fmt"
5 "sort"
6 )
7
8 type azalia struct {
9 }
10
11 func (i azalia) Scan(ctx Context, addr PCIDevData) {
12 az := Create(ctx, "hda_verb.c")
13 defer az.Close()
14
15 Add_SPDX(az, C, GPL2_only)
16 az.WriteString(
17 `#include <device/azalia_device.h>
18
19 const u32 cim_verb_data[] = {
20 `)
21
22 for _, codec := range ctx.InfoSource.GetAzaliaCodecs() {
23 fmt.Fprintf(az, "\t0x%08x,\t/* Codec Vendor / Device ID: %s */\n",
24 codec.VendorID, codec.Name)
25 fmt.Fprintf(az, "\t0x%08x,\t/* Subsystem ID */\n",
26 codec.SubsystemID)
27 fmt.Fprintf(az, "\t%d,\t\t/* Number of 4 dword sets */\n",
28 len(codec.PinConfig)+1)
29 fmt.Fprintf(az, "\tAZALIA_SUBVENDOR(%d, 0x%08x),\n",
30 codec.CodecNo, codec.SubsystemID)
31
32 keys := []int{}
33 for nid, _ := range codec.PinConfig {
34 keys = append(keys, nid)
35 }
36
37 sort.Ints(keys)
38
39 for _, nid := range keys {
40 fmt.Fprintf(az, "\tAZALIA_PIN_CFG(%d, 0x%02x, 0x%08x),\n",
41 codec.CodecNo, nid, codec.PinConfig[nid])
42 }
43 az.WriteString("\n");
44 }
45
46 az.WriteString(
47 `};
48
49 const u32 pc_beep_verbs[0] = {};
50
51 AZALIA_ARRAY_SIZES;
52 `)
53
54 PutPCIDev(addr, "")
55 }
56
57 func init() {
58 /* I82801GX/I945 */
59 RegisterPCI(0x8086, 0x27d8, azalia{})
60 /* BD82X6X/sandybridge */
61 RegisterPCI(0x8086, 0x1c20, azalia{})
62 /* C216/ivybridge */
63 RegisterPCI(0x8086, 0x1e20, azalia{})
64 /* Lynx Point */
65 RegisterPCI(0x8086, 0x8c20, azalia{})
66 RegisterPCI(0x8086, 0x9c20, azalia{})
67 }