hdspe.c (241066) | hdspe.c (254263) |
---|---|
1/*- 2 * Copyright (c) 2012 Ruslan Bukin <br@bsdpad.com> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 24 unchanged lines hidden (view full) --- 33#include <dev/sound/pci/hdspe.h> 34#include <dev/sound/chip.h> 35 36#include <dev/pci/pcireg.h> 37#include <dev/pci/pcivar.h> 38 39#include <mixer_if.h> 40 | 1/*- 2 * Copyright (c) 2012 Ruslan Bukin <br@bsdpad.com> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 24 unchanged lines hidden (view full) --- 33#include <dev/sound/pci/hdspe.h> 34#include <dev/sound/chip.h> 35 36#include <dev/pci/pcireg.h> 37#include <dev/pci/pcivar.h> 38 39#include <mixer_if.h> 40 |
41SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pci/hdspe.c 241066 2012-09-30 09:21:10Z kevlo $"); | 41SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pci/hdspe.c 254263 2013-08-12 23:30:01Z scottl $"); |
42 43static struct hdspe_channel chan_map_aio[] = { 44 { 0, 1, "line", 1, 1 }, 45 { 6, 7, "phone", 1, 0 }, 46 { 8, 9, "aes", 1, 1 }, 47 { 10, 11, "s/pdif", 1, 1 }, 48 { 12, 16, "adat", 1, 1 }, 49 --- 188 unchanged lines hidden (view full) --- 238 return 0; 239 } 240 } 241 242 return (ENXIO); 243} 244 245static int | 42 43static struct hdspe_channel chan_map_aio[] = { 44 { 0, 1, "line", 1, 1 }, 45 { 6, 7, "phone", 1, 0 }, 46 { 8, 9, "aes", 1, 1 }, 47 { 10, 11, "s/pdif", 1, 1 }, 48 { 12, 16, "adat", 1, 1 }, 49 --- 188 unchanged lines hidden (view full) --- 238 return 0; 239 } 240 } 241 242 return (ENXIO); 243} 244 245static int |
246set_pci_config(device_t dev) 247{ 248 uint32_t data; 249 250 pci_enable_busmaster(dev); 251 252 data = pci_get_revid(dev); 253 data |= PCIM_CMD_PORTEN; 254 pci_write_config(dev, PCIR_COMMAND, data, 2); 255 256 return 0; 257} 258 259static int | |
260hdspe_init(struct sc_info *sc) 261{ 262 long long period; 263 264 /* Set defaults. */ 265 sc->ctrl_register |= HDSPM_CLOCK_MODE_MASTER; 266 267 /* Set latency. */ --- 34 unchanged lines hidden (view full) --- 302 struct hdspe_channel *chan_map; 303 uint32_t rev; 304 int i, err; 305 306#if 0 307 device_printf(dev, "hdspe_attach()\n"); 308#endif 309 | 246hdspe_init(struct sc_info *sc) 247{ 248 long long period; 249 250 /* Set defaults. */ 251 sc->ctrl_register |= HDSPM_CLOCK_MODE_MASTER; 252 253 /* Set latency. */ --- 34 unchanged lines hidden (view full) --- 288 struct hdspe_channel *chan_map; 289 uint32_t rev; 290 int i, err; 291 292#if 0 293 device_printf(dev, "hdspe_attach()\n"); 294#endif 295 |
310 set_pci_config(dev); 311 | |
312 sc = device_get_softc(dev); 313 sc->lock = snd_mtxcreate(device_get_nameunit(dev), 314 "snd_hdspe softc"); 315 sc->dev = dev; 316 | 296 sc = device_get_softc(dev); 297 sc->lock = snd_mtxcreate(device_get_nameunit(dev), 298 "snd_hdspe softc"); 299 sc->dev = dev; 300 |
301 pci_enable_busmaster(dev); |
|
317 rev = pci_get_revid(dev); 318 switch (rev) { 319 case PCI_REVISION_AIO: 320 sc->type = AIO; 321 chan_map = chan_map_aio; 322 break; 323 case PCI_REVISION_RAYDAT: 324 sc->type = RAYDAT; --- 89 unchanged lines hidden --- | 302 rev = pci_get_revid(dev); 303 switch (rev) { 304 case PCI_REVISION_AIO: 305 sc->type = AIO; 306 chan_map = chan_map_aio; 307 break; 308 case PCI_REVISION_RAYDAT: 309 sc->type = RAYDAT; --- 89 unchanged lines hidden --- |