sound/pci/ice1712/hoontech.c

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

File Facts

System
Linux kernel
Corpus path
sound/pci/ice1712/hoontech.c
Extension
.c
Size
10723 bytes
Lines
367
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 hoontech_spec {
	unsigned char boxbits[4];
	unsigned int config;
	unsigned short boxconfig[4];
};

static void snd_ice1712_stdsp24_gpio_write(struct snd_ice1712 *ice, unsigned char byte)
{
	byte |= ICE1712_STDSP24_CLOCK_BIT;
	udelay(100);
	snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, byte);
	byte &= ~ICE1712_STDSP24_CLOCK_BIT;
	udelay(100);
	snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, byte);
	byte |= ICE1712_STDSP24_CLOCK_BIT;
	udelay(100);
	snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, byte);
}

static void snd_ice1712_stdsp24_darear(struct snd_ice1712 *ice, int activate)
{
	struct hoontech_spec *spec = ice->spec;

	guard(mutex)(&ice->gpio_mutex);
	ICE1712_STDSP24_0_DAREAR(spec->boxbits, activate);
	snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[0]);
}

static void snd_ice1712_stdsp24_mute(struct snd_ice1712 *ice, int activate)
{
	struct hoontech_spec *spec = ice->spec;

	guard(mutex)(&ice->gpio_mutex);
	ICE1712_STDSP24_3_MUTE(spec->boxbits, activate);
	snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]);
}

static void snd_ice1712_stdsp24_insel(struct snd_ice1712 *ice, int activate)
{
	struct hoontech_spec *spec = ice->spec;

	guard(mutex)(&ice->gpio_mutex);
	ICE1712_STDSP24_3_INSEL(spec->boxbits, activate);
	snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]);
}

static void snd_ice1712_stdsp24_box_channel(struct snd_ice1712 *ice, int box, int chn, int activate)
{
	struct hoontech_spec *spec = ice->spec;

	guard(mutex)(&ice->gpio_mutex);

	/* select box */
	ICE1712_STDSP24_0_BOX(spec->boxbits, box);
	snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[0]);

	/* prepare for write */
	if (chn == 3)
		ICE1712_STDSP24_2_CHN4(spec->boxbits, 0);
	ICE1712_STDSP24_2_MIDI1(spec->boxbits, activate);
	snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]);
	snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]);

	ICE1712_STDSP24_1_CHN1(spec->boxbits, 1);
	ICE1712_STDSP24_1_CHN2(spec->boxbits, 1);
	ICE1712_STDSP24_1_CHN3(spec->boxbits, 1);
	ICE1712_STDSP24_2_CHN4(spec->boxbits, 1);
	snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[1]);
	snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]);
	udelay(100);
	if (chn == 3) {
		ICE1712_STDSP24_2_CHN4(spec->boxbits, 0);
		snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]);
	} else {
		switch (chn) {
		case 0:	ICE1712_STDSP24_1_CHN1(spec->boxbits, 0); break;
		case 1:	ICE1712_STDSP24_1_CHN2(spec->boxbits, 0); break;
		case 2:	ICE1712_STDSP24_1_CHN3(spec->boxbits, 0); break;
		}
		snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[1]);
	}
	udelay(100);
	ICE1712_STDSP24_1_CHN1(spec->boxbits, 1);
	ICE1712_STDSP24_1_CHN2(spec->boxbits, 1);
	ICE1712_STDSP24_1_CHN3(spec->boxbits, 1);
	ICE1712_STDSP24_2_CHN4(spec->boxbits, 1);
	snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[1]);
	snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]);
	udelay(100);

Annotation

Implementation Notes