2014-10-15 21:51:47 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"sort"
|
|
|
|
)
|
|
|
|
|
|
|
|
type azalia struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (i azalia) Scan(ctx Context, addr PCIDevData) {
|
|
|
|
az := Create(ctx, "hda_verb.c")
|
|
|
|
defer az.Close()
|
|
|
|
|
2017-05-01 10:33:56 +02:00
|
|
|
Add_gpl(az)
|
2014-10-15 21:51:47 +02:00
|
|
|
az.WriteString(
|
|
|
|
`#include <device/azalia_device.h>
|
|
|
|
|
|
|
|
const u32 cim_verb_data[] = {
|
|
|
|
`)
|
|
|
|
|
|
|
|
for _, codec := range ctx.InfoSource.GetAzaliaCodecs() {
|
2020-01-08 15:05:56 +01:00
|
|
|
fmt.Fprintf(az, "\t0x%08x,\t/* Codec Vendor / Device ID: %s */\n",
|
2014-10-15 21:51:47 +02:00
|
|
|
codec.VendorID, codec.Name)
|
2020-01-08 15:05:56 +01:00
|
|
|
fmt.Fprintf(az, "\t0x%08x,\t/* Subsystem ID */\n",
|
2014-10-15 21:51:47 +02:00
|
|
|
codec.SubsystemID)
|
2020-01-08 15:05:56 +01:00
|
|
|
fmt.Fprintf(az, "\t%d,\t\t/* Number of 4 dword sets */\n",
|
2014-10-15 21:51:47 +02:00
|
|
|
len(codec.PinConfig)+1)
|
|
|
|
fmt.Fprintf(az, "\tAZALIA_SUBVENDOR(0x%x, 0x%08x),\n",
|
|
|
|
codec.CodecNo, codec.SubsystemID)
|
|
|
|
|
|
|
|
keys := []int{}
|
|
|
|
for nid, _ := range codec.PinConfig {
|
|
|
|
keys = append(keys, nid)
|
|
|
|
}
|
|
|
|
|
|
|
|
sort.Ints(keys)
|
|
|
|
|
|
|
|
for _, nid := range keys {
|
|
|
|
fmt.Fprintf(az, "\tAZALIA_PIN_CFG(0x%x, 0x%02x, 0x%08x),\n",
|
|
|
|
codec.CodecNo, nid, codec.PinConfig[nid])
|
|
|
|
}
|
2020-01-08 15:05:56 +01:00
|
|
|
az.WriteString("\n");
|
2014-10-15 21:51:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
az.WriteString(
|
|
|
|
`};
|
|
|
|
|
|
|
|
const u32 pc_beep_verbs[0] = {};
|
|
|
|
|
|
|
|
AZALIA_ARRAY_SIZES;
|
|
|
|
`)
|
|
|
|
|
2020-01-08 15:05:56 +01:00
|
|
|
PutPCIDev(addr, "")
|
2014-10-15 21:51:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
/* I82801GX/I945 */
|
|
|
|
RegisterPCI(0x8086, 0x27d8, azalia{})
|
|
|
|
/* BD82X6X/sandybridge */
|
|
|
|
RegisterPCI(0x8086, 0x1c20, azalia{})
|
|
|
|
/* C216/ivybridge */
|
|
|
|
RegisterPCI(0x8086, 0x1e20, azalia{})
|
|
|
|
}
|