sound/pci/ice1712/aureon.c

Source file repositories/reference/linux-study-clean/sound/pci/ice1712/aureon.c

File Facts

System
Linux kernel
Corpus path
sound/pci/ice1712/aureon.c
Extension
.c
Size
61266 bytes
Lines
2258
Domain
Driver Families
Bucket
sound/pci
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct aureon_spec {
	unsigned short stac9744[64];
	unsigned int cs8415_mux;
	unsigned short master[2];
	unsigned short vol[8];
	unsigned char pca9554_out;
};

/* WM8770 registers */
#define WM_DAC_ATTEN		0x00	/* DAC1-8 analog attenuation */
#define WM_DAC_MASTER_ATTEN	0x08	/* DAC master analog attenuation */
#define WM_DAC_DIG_ATTEN	0x09	/* DAC1-8 digital attenuation */
#define WM_DAC_DIG_MASTER_ATTEN	0x11	/* DAC master digital attenuation */
#define WM_PHASE_SWAP		0x12	/* DAC phase */
#define WM_DAC_CTRL1		0x13	/* DAC control bits */
#define WM_MUTE			0x14	/* mute controls */
#define WM_DAC_CTRL2		0x15	/* de-emphasis and zefo-flag */
#define WM_INT_CTRL		0x16	/* interface control */
#define WM_MASTER		0x17	/* master clock and mode */
#define WM_POWERDOWN		0x18	/* power-down controls */
#define WM_ADC_GAIN		0x19	/* ADC gain L(19)/R(1a) */
#define WM_ADC_MUX		0x1b	/* input MUX */
#define WM_OUT_MUX1		0x1c	/* output MUX */
#define WM_OUT_MUX2		0x1e	/* output MUX */
#define WM_RESET		0x1f	/* software reset */

/* CS8415A registers */
#define CS8415_CTRL1	0x01
#define CS8415_CTRL2	0x02
#define CS8415_QSUB		0x14
#define CS8415_RATIO	0x1E
#define CS8415_C_BUFFER	0x20
#define CS8415_ID		0x7F

/* PCA9554 registers */
#define PCA9554_DEV     0x40            /* I2C device address */
#define PCA9554_IN      0x00            /* input port */
#define PCA9554_OUT     0x01            /* output port */
#define PCA9554_INVERT  0x02            /* input invert */
#define PCA9554_DIR     0x03            /* port directions */

/*
 * Aureon Universe additional controls using PCA9554
 */

/*
 * Send data to pca9554
 */
static void aureon_pca9554_write(struct snd_ice1712 *ice, unsigned char reg,
				 unsigned char data)
{
	unsigned int tmp;
	int i, j;
	unsigned char dev = PCA9554_DEV;  /* ID 0100000, write */
	unsigned char val = 0;

	tmp = snd_ice1712_gpio_read(ice);

	snd_ice1712_gpio_set_mask(ice, ~(AUREON_SPI_MOSI|AUREON_SPI_CLK|
					 AUREON_WM_RW|AUREON_WM_CS|
					 AUREON_CS8415_CS));
	tmp |= AUREON_WM_RW;
	tmp |= AUREON_CS8415_CS | AUREON_WM_CS; /* disable SPI devices */

	tmp &= ~AUREON_SPI_MOSI;
	tmp &= ~AUREON_SPI_CLK;
	snd_ice1712_gpio_write(ice, tmp);
	udelay(50);

	/*
	 * send i2c stop condition and start condition
	 * to obtain sane state
	 */
	tmp |= AUREON_SPI_CLK;
	snd_ice1712_gpio_write(ice, tmp);
	udelay(50);
	tmp |= AUREON_SPI_MOSI;
	snd_ice1712_gpio_write(ice, tmp);
	udelay(100);
	tmp &= ~AUREON_SPI_MOSI;
	snd_ice1712_gpio_write(ice, tmp);
	udelay(50);
	tmp &= ~AUREON_SPI_CLK;
	snd_ice1712_gpio_write(ice, tmp);
	udelay(100);
	/*
	 * send device address, command and value,
	 * skipping ack cycles in between
	 */
	for (j = 0; j < 3; j++) {

Annotation

Implementation Notes