MAINTAINERS: Add Maximilian Brune to RISC-V
[coreboot.git] / util / autoport / azalia.go
blob6dd78b1e62a5eac881ab9d6b702aab9a091de5ba
1 package main
3 import (
4 "fmt"
5 "sort"
8 type azalia struct {
11 func (i azalia) Scan(ctx Context, addr PCIDevData) {
12 az := Create(ctx, "hda_verb.c")
13 defer az.Close()
15 Add_gpl(az)
16 az.WriteString(
17 `#include <device/azalia_device.h>
19 const u32 cim_verb_data[] = {
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)
32 keys := []int{}
33 for nid, _ := range codec.PinConfig {
34 keys = append(keys, nid)
37 sort.Ints(keys)
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])
43 az.WriteString("\n");
46 az.WriteString(
47 `};
49 const u32 pc_beep_verbs[0] = {};
51 AZALIA_ARRAY_SIZES;
54 PutPCIDev(addr, "")
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{})