FreeBSD kernel sound device code
csa.c File Reference
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <machine/resource.h>
#include <machine/bus.h>
#include <sys/rman.h>
#include <dev/sound/pcm/sound.h>
#include <dev/sound/chip.h>
#include <dev/sound/pci/csareg.h>
#include <dev/sound/pci/csavar.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <dev/sound/pci/cs461x_dsp.h>
Include dependency graph for csa.c:

Go to the source code of this file.

Data Structures

struct  csa_softc
 
struct  card_type
 

Macros

#define CS4610_PCI_ID   0x60011013
 
#define CS4614_PCI_ID   0x60031013
 
#define CS4615_PCI_ID   0x60041013
 

Typedefs

typedef struct csa_softcsc_p
 

Functions

 SND_DECLARE_FILE ("$FreeBSD$")
 
static int csa_probe (device_t dev)
 
static int csa_attach (device_t dev)
 
static struct resource * csa_alloc_resource (device_t bus, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
 
static int csa_release_resource (device_t bus, device_t child, int type, int rid, struct resource *r)
 
static int csa_setup_intr (device_t bus, device_t child, struct resource *irq, int flags, driver_filter_t *filter, driver_intr_t *intr, void *arg, void **cookiep)
 
static int csa_teardown_intr (device_t bus, device_t child, struct resource *irq, void *cookie)
 
static int csa_initialize (sc_p scp)
 
static int csa_downloadimage (csa_res *resp)
 
static int csa_transferimage (csa_res *resp, u_int32_t *src, u_long dest, u_long len)
 
static void amp_none (void)
 
static void amp_voyetra (void)
 
static int clkrun_hack (int run)
 
static struct card_typecsa_findcard (device_t dev)
 
struct csa_cardcsa_findsubcard (device_t dev)
 
static int csa_detach (device_t dev)
 
static int csa_resume (device_t dev)
 
static void csa_intr (void *arg)
 
void csa_clearserialfifos (csa_res *resp)
 
void csa_resetdsp (csa_res *resp)
 
int csa_readcodec (csa_res *resp, u_long offset, u_int32_t *data)
 
int csa_writecodec (csa_res *resp, u_long offset, u_int32_t data)
 
u_int32_t csa_readio (csa_res *resp, u_long offset)
 
void csa_writeio (csa_res *resp, u_long offset, u_int32_t data)
 
u_int32_t csa_readmem (csa_res *resp, u_long offset)
 
void csa_writemem (csa_res *resp, u_long offset, u_int32_t data)
 
 DRIVER_MODULE (snd_csa, pci, csa_driver, csa_devclass, 0, 0)
 
 MODULE_DEPEND (snd_csa, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER)
 
 MODULE_VERSION (snd_csa, 1)
 

Variables

static driver_intr_t csa_intr
 
static devclass_t csa_devclass
 
static struct csa_card cards_4610 []
 
static struct csa_card cards_4614 []
 
static struct csa_card cards_4615 []
 
static struct csa_card nocard = {0, 0, "unknown", NULL, NULL, NULL, 0}
 
static struct card_type cards []
 
static device_method_t csa_methods []
 
static driver_t csa_driver
 

Macro Definition Documentation

◆ CS4610_PCI_ID

#define CS4610_PCI_ID   0x60011013

Definition at line 60 of file csa.c.

◆ CS4614_PCI_ID

#define CS4614_PCI_ID   0x60031013

Definition at line 61 of file csa.c.

◆ CS4615_PCI_ID

#define CS4615_PCI_ID   0x60041013

Definition at line 62 of file csa.c.

Typedef Documentation

◆ sc_p

typedef struct csa_softc* sc_p

Definition at line 81 of file csa.c.

Function Documentation

◆ amp_none()

static void amp_none ( void  )
static

Definition at line 104 of file csa.c.

◆ amp_voyetra()

static void amp_voyetra ( void  )
static

Definition at line 109 of file csa.c.

◆ clkrun_hack()

static int clkrun_hack ( int  run)
static

Definition at line 114 of file csa.c.

References free.

◆ csa_alloc_resource()

static struct resource * csa_alloc_resource ( device_t  bus,
device_t  child,
int  type,
int *  rid,
rman_res_t  start,
rman_res_t  end,
rman_res_t  count,
u_int  flags 
)
static

Definition at line 402 of file csa.c.

References bus, PCIR_BAR, resp, rid, and type.

◆ csa_attach()

static int csa_attach ( device_t  dev)
static

◆ csa_clearserialfifos()

void csa_clearserialfifos ( csa_res resp)

Definition at line 773 of file csa.c.

References BA0_CLKCR1, BA0_SERBAD, BA0_SERBCM, BA0_SERBST, BA0_SERBWP, CLKCR1_SWCE, csa_readio(), csa_writeio(), resp, SERBCM_WRC, and SERBST_WBSY.

Referenced by csa_initialize(), csa_stopcapturedma(), and csa_stopplaydma().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ csa_detach()

static int csa_detach ( device_t  dev)
static

Definition at line 340 of file csa.c.

References dev, free, sndcard_func::func, and resp.

◆ csa_downloadimage()

static int csa_downloadimage ( csa_res resp)
static

Definition at line 854 of file csa.c.

References cs461x_firmware_struct::BA1Array, cs461x_firmware, csa_transferimage(), INKY_MEMORY_COUNT, cs461x_firmware_struct::MemoryStat, offset, resp, cs461x_firmware_struct::ulDestAddr, and cs461x_firmware_struct::ulSourceSize.

Referenced by csa_attach(), and csa_resume().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ csa_findcard()

static struct card_type * csa_findcard ( device_t  dev)
static

Definition at line 196 of file csa.c.

References cards, dev, and devid.

Referenced by csa_findsubcard(), and csa_probe().

Here is the caller graph for this function:

◆ csa_findsubcard()

struct csa_card * csa_findsubcard ( device_t  dev)

Definition at line 210 of file csa.c.

References card_type::cards, csa_findcard(), dev, nocard, csa_card::subdevice, and csa_card::subvendor.

Referenced by csa_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ csa_initialize()

◆ csa_intr()

static void csa_intr ( void *  arg)
static

Definition at line 537 of file csa.c.

References BA0_HICR, BA0_HISR, csa_readio(), csa_writeio(), HICR_CHGM, HICR_IEV, HISR_MIDI, HISR_VC0, HISR_VC1, and resp.

Here is the call graph for this function:

◆ csa_probe()

static int csa_probe ( device_t  dev)
static

Definition at line 232 of file csa.c.

References csa_findcard(), dev, and card_type::name.

Here is the call graph for this function:

◆ csa_readcodec()

int csa_readcodec ( csa_res resp,
u_long  offset,
u_int32_t *  data 
)

Definition at line 900 of file csa.c.

References ACCTL_CRW, ACCTL_DCV, ACCTL_ESYN, ACCTL_RSTN, ACCTL_VFRM, ACSTS_VSTS, BA0_AC97_RESET, BA0_ACCAD, BA0_ACCDA, BA0_ACCTL, BA0_ACSDA, BA0_ACSTS, csa_readio(), csa_writeio(), data, offset, and resp.

Referenced by csa_ac97_suspend(), csa_rdcd(), and csa_readio().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ csa_readio()

u_int32_t csa_readio ( csa_res resp,
u_long  offset 
)

Definition at line 1047 of file csa.c.

References BA0_AC97_RESET, csa_readcodec(), offset, and resp.

Referenced by csa_attach(), csa_clearserialfifos(), csa_init(), csa_initialize(), csa_intr(), csa_readcodec(), csa_setup_intr(), csa_writecodec(), and pcmcsa_resume().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ csa_readmem()

u_int32_t csa_readmem ( csa_res resp,
u_long  offset 
)

Definition at line 1070 of file csa.c.

References offset, and resp.

Referenced by csa_setupchan(), csa_startcapturedma(), csa_startdsp(), csa_startplaydma(), csa_stopcapturedma(), csa_stopplaydma(), csachan_getptr(), pcmcsa_attach(), pcmcsa_resume(), and pcmcsa_suspend().

Here is the caller graph for this function:

◆ csa_release_resource()

static int csa_release_resource ( device_t  bus,
device_t  child,
int  type,
int  rid,
struct resource *  r 
)
static

Definition at line 437 of file csa.c.

◆ csa_resetdsp()

void csa_resetdsp ( csa_res resp)

Definition at line 824 of file csa.c.

References BA1_DREG, BA1_FRMT, BA1_SPCR, BA1_TWPR, csa_writemem(), DREG_REGID_TRAP_SELECT, resp, SPCR_DRQEN, and SPCR_RSTSP.

Referenced by csa_attach(), csa_resume(), and pcmcsa_suspend().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ csa_resume()

static int csa_resume ( device_t  dev)
static

Definition at line 379 of file csa.c.

References csa_downloadimage(), csa_initialize(), csa_resetdsp(), dev, and resp.

Here is the call graph for this function:

◆ csa_setup_intr()

static int csa_setup_intr ( device_t  bus,
device_t  child,
struct resource *  irq,
int  flags,
driver_filter_t *  filter,
driver_intr_t *  intr,
void *  arg,
void **  cookiep 
)
static

Definition at line 453 of file csa.c.

References BA0_HICR, BA0_HISR, bus, child, csa_readio(), csa_writeio(), sndcard_func::func, HICR_CHGM, HICR_IEV, HISR_INTENA, intr, irq, resp, SCF_MIDI, and SCF_PCM.

Here is the call graph for this function:

◆ csa_teardown_intr()

static int csa_teardown_intr ( device_t  bus,
device_t  child,
struct resource *  irq,
void *  cookie 
)
static

Definition at line 499 of file csa.c.

References bus, child, sndcard_func::func, irq, resp, SCF_MIDI, and SCF_PCM.

◆ csa_transferimage()

static int csa_transferimage ( csa_res resp,
u_int32_t *  src,
u_long  dest,
u_long  len 
)
static

Definition at line 876 of file csa.c.

References csa_writemem(), len, resp, and src.

Referenced by csa_downloadimage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ csa_writecodec()

int csa_writecodec ( csa_res resp,
u_long  offset,
u_int32_t  data 
)

Definition at line 994 of file csa.c.

References ACCTL_DCV, ACCTL_ESYN, ACCTL_RSTN, ACCTL_VFRM, BA0_AC97_RESET, BA0_ACCAD, BA0_ACCDA, BA0_ACCTL, csa_readio(), csa_writeio(), data, offset, and resp.

Referenced by csa_ac97_resume(), csa_ac97_suspend(), csa_wrcd(), csa_writeio(), and pcmcsa_suspend().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ csa_writeio()

void csa_writeio ( csa_res resp,
u_long  offset,
u_int32_t  data 
)

Definition at line 1061 of file csa.c.

References BA0_AC97_RESET, csa_writecodec(), data, offset, and resp.

Referenced by csa_attach(), csa_clearserialfifos(), csa_init(), csa_initialize(), csa_intr(), csa_readcodec(), csa_setup_intr(), csa_stopcapturedma(), csa_stopplaydma(), csa_writecodec(), and pcmcsa_resume().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ csa_writemem()

void csa_writemem ( csa_res resp,
u_long  offset,
u_int32_t  data 
)

◆ DRIVER_MODULE()

DRIVER_MODULE ( snd_csa  ,
pci  ,
csa_driver  ,
csa_devclass  ,
,
 
)

◆ MODULE_DEPEND()

MODULE_DEPEND ( snd_csa  ,
sound  ,
SOUND_MINVER  ,
SOUND_PREFVER  ,
SOUND_MAXVER   
)

◆ MODULE_VERSION()

MODULE_VERSION ( snd_csa  ,
 
)

◆ SND_DECLARE_FILE()

SND_DECLARE_FILE ( "$FreeBSD$"  )

Variable Documentation

◆ cards

struct card_type cards[]
static
Initial value:
= {
{CS4610_PCI_ID, "CS4610/CS4611", cards_4610},
{CS4614_PCI_ID, "CS4280/CS4614/CS4622/CS4624/CS4630", cards_4614},
{CS4615_PCI_ID, "CS4615", cards_4615},
{0, NULL, NULL},
}
static struct csa_card cards_4614[]
Definition: csa.c:163
#define CS4614_PCI_ID
Definition: csa.c:61
static struct csa_card cards_4610[]
Definition: csa.c:159
#define CS4610_PCI_ID
Definition: csa.c:60
static struct csa_card cards_4615[]
Definition: csa.c:176
#define CS4615_PCI_ID
Definition: csa.c:62

Definition at line 188 of file csa.c.

Referenced by csa_findcard(), and opti_detect().

◆ cards_4610

struct csa_card cards_4610[]
static
Initial value:
= {
{0, 0, "Unknown/invalid SSID (CS4610)", NULL, NULL, NULL, 0},
}

Definition at line 159 of file csa.c.

◆ cards_4614

struct csa_card cards_4614[]
static
Initial value:
= {
{0x1489, 0x7001, "Genius Soundmaker 128 value", amp_none, NULL, NULL, 0},
{0x5053, 0x3357, "Turtle Beach Santa Cruz", amp_voyetra, NULL, NULL, 1},
{0x1071, 0x6003, "Mitac MI6020/21", amp_voyetra, NULL, NULL, 0},
{0x14AF, 0x0050, "Hercules Game Theatre XP", NULL, NULL, NULL, 0},
{0x1681, 0x0050, "Hercules Game Theatre XP", NULL, NULL, NULL, 0},
{0x1014, 0x0132, "Thinkpad 570", amp_none, NULL, NULL, 0},
{0x1014, 0x0153, "Thinkpad 600X/A20/T20", amp_none, NULL, clkrun_hack, 0},
{0x1014, 0x1010, "Thinkpad 600E (unsupported)", NULL, NULL, NULL, 0},
{0x153b, 0x1136, "Terratec SiXPack 5.1+", NULL, NULL, NULL, 0},
{0, 0, "Unknown/invalid SSID (CS4614)", NULL, NULL, NULL, 0},
}
static int clkrun_hack(int run)
Definition: csa.c:114
static void amp_voyetra(void)
Definition: csa.c:109
static void amp_none(void)
Definition: csa.c:104

Definition at line 163 of file csa.c.

◆ cards_4615

struct csa_card cards_4615[]
static
Initial value:
= {
{0, 0, "Unknown/invalid SSID (CS4615)", NULL, NULL, NULL, 0},
}

Definition at line 176 of file csa.c.

◆ csa_devclass

devclass_t csa_devclass
static

Definition at line 101 of file csa.c.

◆ csa_driver

driver_t csa_driver
static
Initial value:
= {
"csa",
sizeof(struct csa_softc),
}
static device_method_t csa_methods[]
Definition: csa.c:1081
Definition: csa.c:65

Definition at line 1101 of file csa.c.

◆ csa_intr

driver_intr_t csa_intr
static

Definition at line 96 of file csa.c.

Referenced by csa_attach().

◆ csa_methods

device_method_t csa_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, csa_probe),
DEVMETHOD(device_attach, csa_attach),
DEVMETHOD(device_detach, csa_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
DEVMETHOD(device_suspend, bus_generic_suspend),
DEVMETHOD(device_resume, csa_resume),
DEVMETHOD(bus_alloc_resource, csa_alloc_resource),
DEVMETHOD(bus_release_resource, csa_release_resource),
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
DEVMETHOD(bus_setup_intr, csa_setup_intr),
DEVMETHOD(bus_teardown_intr, csa_teardown_intr),
DEVMETHOD_END
}
static int csa_teardown_intr(device_t bus, device_t child, struct resource *irq, void *cookie)
Definition: csa.c:499
static int csa_setup_intr(device_t bus, device_t child, struct resource *irq, int flags, driver_filter_t *filter, driver_intr_t *intr, void *arg, void **cookiep)
Definition: csa.c:453
static int csa_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r)
Definition: csa.c:437
static int csa_probe(device_t dev)
Definition: csa.c:232
static int csa_detach(device_t dev)
Definition: csa.c:340
static int csa_attach(device_t dev)
Definition: csa.c:245
static struct resource * csa_alloc_resource(device_t bus, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
Definition: csa.c:402
static int csa_resume(device_t dev)
Definition: csa.c:379

Definition at line 1081 of file csa.c.

◆ nocard

struct csa_card nocard = {0, 0, "unknown", NULL, NULL, NULL, 0}
static

Definition at line 180 of file csa.c.

Referenced by csa_findsubcard().