Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 1 | /* |
Stefan Reinauer | 7e61e45 | 2008-01-18 10:35:56 +0000 | [diff] [blame] | 2 | * This file is part of the coreboot project. |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2004 Tyan Computer |
| 5 | * Written by Yinghai Lu <yhlu@tyan.com> for Tyan Computer. |
| 6 | * Copyright (C) 2006,2007 AMD |
| 7 | * Written by Yinghai Lu <yinghai.lu@amd.com> for AMD. |
| 8 | * Copyright (C) 2007 Silicon Integrated Systems Corp. (SiS) |
| 9 | * Written by Morgan Tsai <my_tsai@sis.com> for SiS. |
| 10 | * |
| 11 | * This program is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This program is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 20 | */ |
| 21 | |
| 22 | #include <console/console.h> |
| 23 | #include <device/device.h> |
| 24 | #include <device/pci.h> |
| 25 | #include <device/pci_ids.h> |
| 26 | #include <device/pci_ops.h> |
| 27 | #include <arch/io.h> |
Carl-Daniel Hailfinger | a358892 | 2007-11-05 22:21:27 +0000 | [diff] [blame] | 28 | #include <delay.h> |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 29 | #include "sis966.h" |
| 30 | |
Stefan Reinauer | eea66b7 | 2010-04-07 15:32:52 +0000 | [diff] [blame] | 31 | u8 SiS_SiS7502_init[7][3]={ |
Morgan Tsai | 218c265 | 2007-11-02 16:09:58 +0000 | [diff] [blame] | 32 | {0x04, 0xFF, 0x07}, |
| 33 | {0x2C, 0xFF, 0x39}, |
| 34 | {0x2D, 0xFF, 0x10}, |
| 35 | {0x2E, 0xFF, 0x91}, |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 36 | {0x2F, 0xFF, 0x01}, |
| 37 | {0x04, 0xFF, 0x06}, |
| 38 | {0x00, 0x00, 0x00} //End of table |
| 39 | }; |
| 40 | |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 41 | static int set_bits(void *port, u32 mask, u32 val) |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 42 | { |
Stefan Reinauer | eea66b7 | 2010-04-07 15:32:52 +0000 | [diff] [blame] | 43 | u32 dword; |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 44 | int count; |
| 45 | |
| 46 | val &= mask; |
Stefan Reinauer | 9fe4d79 | 2010-01-16 17:53:38 +0000 | [diff] [blame] | 47 | dword = read32(port); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 48 | dword &= ~mask; |
| 49 | dword |= val; |
Stefan Reinauer | 9fe4d79 | 2010-01-16 17:53:38 +0000 | [diff] [blame] | 50 | write32(port, dword); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 51 | |
| 52 | count = 50; |
| 53 | do { |
Stefan Reinauer | 9fe4d79 | 2010-01-16 17:53:38 +0000 | [diff] [blame] | 54 | dword = read32(port); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 55 | dword &= mask; |
| 56 | udelay(100); |
| 57 | } while ((dword != val) && --count); |
| 58 | |
| 59 | if(!count) return -1; |
| 60 | |
Morgan Tsai | 218c265 | 2007-11-02 16:09:58 +0000 | [diff] [blame] | 61 | udelay(500); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 62 | return 0; |
| 63 | |
| 64 | } |
| 65 | |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 66 | static u32 send_verb(u8 *base, u32 verb) |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 67 | { |
Stefan Reinauer | eea66b7 | 2010-04-07 15:32:52 +0000 | [diff] [blame] | 68 | u32 dword; |
Morgan Tsai | 218c265 | 2007-11-02 16:09:58 +0000 | [diff] [blame] | 69 | |
Stefan Reinauer | 9fe4d79 | 2010-01-16 17:53:38 +0000 | [diff] [blame] | 70 | dword = read32(base + 0x68); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 71 | dword=dword|(unsigned long)0x0002; |
Stefan Reinauer | 9fe4d79 | 2010-01-16 17:53:38 +0000 | [diff] [blame] | 72 | write32(base + 0x68, dword); |
Morgan Tsai | 218c265 | 2007-11-02 16:09:58 +0000 | [diff] [blame] | 73 | do { |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 74 | dword = read32(base + 0x68); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 75 | } while ((dword & 1)!=0); |
Stefan Reinauer | 9fe4d79 | 2010-01-16 17:53:38 +0000 | [diff] [blame] | 76 | write32(base + 0x60, verb); |
Morgan Tsai | 218c265 | 2007-11-02 16:09:58 +0000 | [diff] [blame] | 77 | udelay(500); |
Stefan Reinauer | 9fe4d79 | 2010-01-16 17:53:38 +0000 | [diff] [blame] | 78 | dword = read32(base + 0x68); |
Morgan Tsai | 218c265 | 2007-11-02 16:09:58 +0000 | [diff] [blame] | 79 | dword =(dword |0x1); |
Stefan Reinauer | 9fe4d79 | 2010-01-16 17:53:38 +0000 | [diff] [blame] | 80 | write32(base + 0x68, dword); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 81 | do { |
Morgan Tsai | 218c265 | 2007-11-02 16:09:58 +0000 | [diff] [blame] | 82 | udelay(100); |
Stefan Reinauer | 9fe4d79 | 2010-01-16 17:53:38 +0000 | [diff] [blame] | 83 | dword = read32(base + 0x68); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 84 | } while ((dword & 3) != 2); |
| 85 | |
Stefan Reinauer | 9fe4d79 | 2010-01-16 17:53:38 +0000 | [diff] [blame] | 86 | dword = read32(base + 0x64); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 87 | return dword; |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 88 | } |
| 89 | |
| 90 | |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 91 | static int codec_detect(u8 *base) |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 92 | { |
Stefan Reinauer | eea66b7 | 2010-04-07 15:32:52 +0000 | [diff] [blame] | 93 | u32 dword; |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 94 | int idx=0; |
| 95 | |
| 96 | /* 1 */ // controller reset |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 97 | printk(BIOS_DEBUG, "controller reset\n"); |
Morgan Tsai | 218c265 | 2007-11-02 16:09:58 +0000 | [diff] [blame] | 98 | |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 99 | set_bits(base + 0x08, 1, 1); |
Morgan Tsai | 218c265 | 2007-11-02 16:09:58 +0000 | [diff] [blame] | 100 | |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 101 | do{ |
Stefan Reinauer | 9fe4d79 | 2010-01-16 17:53:38 +0000 | [diff] [blame] | 102 | dword = read32(base + 0x08)&0x1; |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 103 | if(idx++>1000) { printk(BIOS_DEBUG, "controller reset fail !!! \n"); break;} |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 104 | } while (dword !=1); |
Morgan Tsai | 218c265 | 2007-11-02 16:09:58 +0000 | [diff] [blame] | 105 | |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 106 | dword=send_verb(base,0x000F0000); // get codec VendorId and DeviceId |
Morgan Tsai | 218c265 | 2007-11-02 16:09:58 +0000 | [diff] [blame] | 107 | |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 108 | if(dword==0) { |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 109 | printk(BIOS_DEBUG, "No codec!\n"); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 110 | return 0; |
| 111 | } |
| 112 | |
Myles Watson | 08e0fb8 | 2010-03-22 16:33:25 +0000 | [diff] [blame] | 113 | printk(BIOS_DEBUG, "Codec ID = %x\n", dword); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 114 | |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 115 | dword=0x1; |
| 116 | return dword; |
| 117 | |
| 118 | } |
| 119 | |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 120 | |
Stefan Reinauer | eea66b7 | 2010-04-07 15:32:52 +0000 | [diff] [blame] | 121 | static u32 verb_data[] = { |
Morgan Tsai | 218c265 | 2007-11-02 16:09:58 +0000 | [diff] [blame] | 122 | |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 123 | //14 |
| 124 | 0x01471c10, |
| 125 | 0x01471d40, |
| 126 | 0x01471e01, |
| 127 | 0x01471f01, |
| 128 | //15 |
| 129 | 0x01571c12, |
| 130 | 0x01571d10, |
| 131 | 0x01571e01, |
| 132 | 0x01571f01, |
| 133 | //16 |
| 134 | 0x01671c11, |
| 135 | 0x01671d60, |
| 136 | 0x01671e01, |
| 137 | 0x01671f01, |
| 138 | //17 |
| 139 | 0x01771c14, |
| 140 | 0x01771d20, |
| 141 | 0x01771e01, |
| 142 | 0x01771f01, |
| 143 | //18 |
| 144 | 0x01871c40, |
| 145 | 0x01871d98, |
| 146 | 0x01871ea1, |
| 147 | 0x01871f01, |
| 148 | //19 |
| 149 | 0x01971c50, |
| 150 | 0x01971d98, |
| 151 | 0x01971ea1, |
| 152 | 0x01971f02, |
| 153 | //1a |
| 154 | 0x01a71c4f, |
| 155 | 0x01a71d30, |
| 156 | 0x01a71e81, |
| 157 | 0x01a71f01, |
| 158 | //1b |
| 159 | 0x01b71c20, |
| 160 | 0x01b71d40, |
| 161 | 0x01b71e01, |
| 162 | 0x01b71f02, |
| 163 | //1c |
| 164 | 0x01c71cf0, |
| 165 | 0x01c71d01, |
| 166 | 0x01c71e33, |
| 167 | 0x01c71f59, |
| 168 | //1d |
| 169 | 0x01d71c01, |
| 170 | 0x01d71de6, |
| 171 | 0x01d71e05, |
| 172 | 0x01d71f40, |
| 173 | //1e |
| 174 | 0x01e71c30, |
| 175 | 0x01e71d11, |
| 176 | 0x01e71e44, |
| 177 | 0x01e71f01, |
| 178 | //1f |
| 179 | 0x01f71c60, |
| 180 | 0x01f71d61, |
| 181 | 0x01f71ec4, |
| 182 | 0x01f71f01, |
| 183 | }; |
| 184 | |
Stefan Reinauer | eea66b7 | 2010-04-07 15:32:52 +0000 | [diff] [blame] | 185 | static unsigned find_verb(u32 viddid, u32 **verb) |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 186 | { |
| 187 | if((viddid == 0x10ec0883) || (viddid == 0x10ec0882) || (viddid == 0x10ec0880)) return 0; |
Stefan Reinauer | eea66b7 | 2010-04-07 15:32:52 +0000 | [diff] [blame] | 188 | *verb = (u32 *)verb_data; |
| 189 | return sizeof(verb_data)/sizeof(u32); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 190 | } |
| 191 | |
| 192 | |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 193 | static void codec_init(u8 *base, int addr) |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 194 | { |
Stefan Reinauer | eea66b7 | 2010-04-07 15:32:52 +0000 | [diff] [blame] | 195 | u32 dword; |
| 196 | u32 *verb; |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 197 | unsigned verb_size; |
| 198 | int i; |
| 199 | |
| 200 | /* 1 */ |
| 201 | do { |
Stefan Reinauer | 9fe4d79 | 2010-01-16 17:53:38 +0000 | [diff] [blame] | 202 | dword = read32(base + 0x68); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 203 | } while (dword & 1); |
| 204 | |
| 205 | dword = (addr<<28) | 0x000f0000; |
Stefan Reinauer | 9fe4d79 | 2010-01-16 17:53:38 +0000 | [diff] [blame] | 206 | write32(base + 0x60, dword); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 207 | |
| 208 | do { |
Stefan Reinauer | 9fe4d79 | 2010-01-16 17:53:38 +0000 | [diff] [blame] | 209 | dword = read32(base + 0x68); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 210 | } while ((dword & 3)!=2); |
| 211 | |
Stefan Reinauer | 9fe4d79 | 2010-01-16 17:53:38 +0000 | [diff] [blame] | 212 | dword = read32(base + 0x64); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 213 | |
| 214 | /* 2 */ |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 215 | printk(BIOS_DEBUG, "codec viddid: %08x\n", dword); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 216 | verb_size = find_verb(dword, &verb); |
| 217 | |
| 218 | if(!verb_size) { |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 219 | printk(BIOS_DEBUG, "No verb!\n"); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 220 | return; |
| 221 | } |
| 222 | |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 223 | printk(BIOS_DEBUG, "verb_size: %d\n", verb_size); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 224 | /* 3 */ |
| 225 | for(i=0; i<verb_size; i++) { |
| 226 | send_verb(base,verb[i]); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 227 | } |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 228 | printk(BIOS_DEBUG, "verb loaded!\n"); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 229 | } |
| 230 | |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 231 | static void codecs_init(u8 *base, u32 codec_mask) |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 232 | { |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 233 | codec_init(base, 0); |
| 234 | return; |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 235 | } |
| 236 | |
| 237 | static void aza_init(struct device *dev) |
| 238 | { |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 239 | u8 *base; |
Morgan Tsai | 218c265 | 2007-11-02 16:09:58 +0000 | [diff] [blame] | 240 | struct resource *res; |
Stefan Reinauer | eea66b7 | 2010-04-07 15:32:52 +0000 | [diff] [blame] | 241 | u32 codec_mask; |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 242 | |
Stefan Reinauer | 5ab52dd | 2015-01-05 13:01:01 -0800 | [diff] [blame] | 243 | printk(BIOS_DEBUG, "AZALIA_INIT:---------->\n"); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 244 | |
| 245 | //-------------- enable AZA (SiS7502) ------------------------- |
| 246 | { |
Stefan Reinauer | eea66b7 | 2010-04-07 15:32:52 +0000 | [diff] [blame] | 247 | u8 temp8; |
Morgan Tsai | 218c265 | 2007-11-02 16:09:58 +0000 | [diff] [blame] | 248 | int i=0; |
| 249 | while(SiS_SiS7502_init[i][0] != 0) |
| 250 | { |
| 251 | temp8 = pci_read_config8(dev, SiS_SiS7502_init[i][0]); |
| 252 | temp8 &= SiS_SiS7502_init[i][1]; |
| 253 | temp8 |= SiS_SiS7502_init[i][2]; |
| 254 | pci_write_config8(dev, SiS_SiS7502_init[i][0], temp8); |
| 255 | i++; |
| 256 | }; |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 257 | } |
| 258 | //----------------------------------------------------------- |
| 259 | |
| 260 | |
Morgan Tsai | 218c265 | 2007-11-02 16:09:58 +0000 | [diff] [blame] | 261 | // put audio to D0 state |
| 262 | pci_write_config8(dev, 0x54,0x00); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 263 | |
Morgan Tsai | 218c265 | 2007-11-02 16:09:58 +0000 | [diff] [blame] | 264 | #if DEBUG_AZA |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 265 | { |
Morgan Tsai | 218c265 | 2007-11-02 16:09:58 +0000 | [diff] [blame] | 266 | int i; |
| 267 | |
Stefan Reinauer | 5ab52dd | 2015-01-05 13:01:01 -0800 | [diff] [blame] | 268 | printk(BIOS_DEBUG, "****** Azalia PCI config ******"); |
| 269 | printk(BIOS_DEBUG, "\n 03020100 07060504 0B0A0908 0F0E0D0C"); |
Morgan Tsai | 218c265 | 2007-11-02 16:09:58 +0000 | [diff] [blame] | 270 | |
| 271 | for(i=0;i<0xff;i+=4){ |
| 272 | if((i%16)==0){ |
Stefan Reinauer | 5ab52dd | 2015-01-05 13:01:01 -0800 | [diff] [blame] | 273 | printk(BIOS_DEBUG, "\n%02x: ", i); |
Morgan Tsai | 218c265 | 2007-11-02 16:09:58 +0000 | [diff] [blame] | 274 | } |
Stefan Reinauer | 5ab52dd | 2015-01-05 13:01:01 -0800 | [diff] [blame] | 275 | printk(BIOS_DEBUG, "%08x ", pci_read_config32(dev,i)); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 276 | } |
Stefan Reinauer | 5ab52dd | 2015-01-05 13:01:01 -0800 | [diff] [blame] | 277 | printk(BIOS_DEBUG, "\n"); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 278 | } |
Morgan Tsai | 218c265 | 2007-11-02 16:09:58 +0000 | [diff] [blame] | 279 | #endif |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 280 | |
| 281 | res = find_resource(dev, 0x10); |
| 282 | if(!res) |
| 283 | return; |
| 284 | |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 285 | base = res2mmio(res, 0, 0); |
| 286 | printk(BIOS_DEBUG, "base = 0x%p\n", base); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 287 | |
| 288 | codec_mask = codec_detect(base); |
| 289 | |
| 290 | if(codec_mask) { |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 291 | printk(BIOS_DEBUG, "codec_mask = %02x\n", codec_mask); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 292 | codecs_init(base, codec_mask); |
| 293 | } |
| 294 | |
Stefan Reinauer | 5ab52dd | 2015-01-05 13:01:01 -0800 | [diff] [blame] | 295 | printk(BIOS_DEBUG, "AZALIA_INIT:<----------\n"); |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 296 | } |
| 297 | |
| 298 | static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device) |
| 299 | { |
| 300 | pci_write_config32(dev, 0x40, |
| 301 | ((device & 0xffff) << 16) | (vendor & 0xffff)); |
| 302 | } |
| 303 | |
| 304 | static struct pci_operations lops_pci = { |
| 305 | .set_subsystem = lpci_set_subsystem, |
| 306 | }; |
| 307 | |
| 308 | static struct device_operations aza_audio_ops = { |
| 309 | .read_resources = pci_dev_read_resources, |
| 310 | .set_resources = pci_dev_set_resources, |
| 311 | .enable_resources = pci_dev_enable_resources, |
| 312 | // .enable = sis966_enable, |
| 313 | .init = aza_init, |
| 314 | .scan_bus = 0, |
| 315 | .ops_pci = &lops_pci, |
| 316 | }; |
| 317 | |
Stefan Reinauer | 83b52e7 | 2007-10-30 02:17:49 +0000 | [diff] [blame] | 318 | static const struct pci_driver azaaudio_driver __pci_driver = { |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 319 | .ops = &aza_audio_ops, |
| 320 | .vendor = PCI_VENDOR_ID_SIS, |
Morgan Tsai | 31e805d | 2007-11-14 01:34:02 +0000 | [diff] [blame] | 321 | .device = PCI_DEVICE_ID_SIS_SIS966_HD_AUDIO, |
Morgan Tsai | 1602dd5 | 2007-10-29 21:00:14 +0000 | [diff] [blame] | 322 | }; |