sound/pci/ice1712/juli.c

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

File Facts

System
Linux kernel
Corpus path
sound/pci/ice1712/juli.c
Extension
.c
Size
18993 bytes
Lines
663
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 juli_spec {
	struct ak4114 *ak4114;
	unsigned int analog:1;
};

/*
 * chip addresses on I2C bus
 */
#define AK4114_ADDR		0x20		/* S/PDIF receiver */
#define AK4358_ADDR		0x22		/* DAC */

/*
 * Juli does not use the standard ICE1724 clock scheme. Juli's ice1724 chip is
 * supplied by external clock provided by Xilinx array and MK73-1 PLL frequency
 * multiplier. Actual frequency is set by ice1724 GPIOs hooked to the Xilinx.
 *
 * The clock circuitry is supplied by the two ice1724 crystals. This
 * arrangement allows to generate independent clock signal for AK4114's input
 * rate detection circuit. As a result, Juli, unlike most other
 * ice1724+ak4114-based cards, detects spdif input rate correctly.
 * This fact is applied in the driver, allowing to modify PCM stream rate
 * parameter according to the actual input rate.
 *
 * Juli uses the remaining three stereo-channels of its DAC to optionally
 * monitor analog input, digital input, and digital output. The corresponding
 * I2S signals are routed by Xilinx, controlled by GPIOs.
 *
 * The master mute is implemented using output muting transistors (GPIO) in
 * combination with smuting the DAC.
 *
 * The card itself has no HW master volume control, implemented using the
 * vmaster control.
 *
 * TODO:
 * researching and fixing the input monitors
 */

/*
 * GPIO pins
 */
#define GPIO_FREQ_MASK		(3<<0)
#define GPIO_FREQ_32KHZ		(0<<0)
#define GPIO_FREQ_44KHZ		(1<<0)
#define GPIO_FREQ_48KHZ		(2<<0)
#define GPIO_MULTI_MASK		(3<<2)
#define GPIO_MULTI_4X		(0<<2)
#define GPIO_MULTI_2X		(1<<2)
#define GPIO_MULTI_1X		(2<<2)		/* also external */
#define GPIO_MULTI_HALF		(3<<2)
#define GPIO_INTERNAL_CLOCK	(1<<4)		/* 0 = external, 1 = internal */
#define GPIO_CLOCK_MASK		(1<<4)
#define GPIO_ANALOG_PRESENT	(1<<5)		/* RO only: 0 = present */
#define GPIO_RXMCLK_SEL		(1<<7)		/* must be 0 */
#define GPIO_AK5385A_CKS0	(1<<8)
#define GPIO_AK5385A_DFS1	(1<<9)
#define GPIO_AK5385A_DFS0	(1<<10)
#define GPIO_DIGOUT_MONITOR	(1<<11)		/* 1 = active */
#define GPIO_DIGIN_MONITOR	(1<<12)		/* 1 = active */
#define GPIO_ANAIN_MONITOR	(1<<13)		/* 1 = active */
#define GPIO_AK5385A_CKS1	(1<<14)		/* must be 0 */
#define GPIO_MUTE_CONTROL	(1<<15)		/* output mute, 1 = muted */

#define GPIO_RATE_MASK		(GPIO_FREQ_MASK | GPIO_MULTI_MASK | \
		GPIO_CLOCK_MASK)
#define GPIO_AK5385A_MASK	(GPIO_AK5385A_CKS0 | GPIO_AK5385A_DFS0 | \
		GPIO_AK5385A_DFS1 | GPIO_AK5385A_CKS1)

#define JULI_PCM_RATE	(SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | \
		SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
		SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \
		SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | \
		SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000)

#define GPIO_RATE_16000		(GPIO_FREQ_32KHZ | GPIO_MULTI_HALF | \
		GPIO_INTERNAL_CLOCK)
#define GPIO_RATE_22050		(GPIO_FREQ_44KHZ | GPIO_MULTI_HALF | \
		GPIO_INTERNAL_CLOCK)
#define GPIO_RATE_24000		(GPIO_FREQ_48KHZ | GPIO_MULTI_HALF | \
		GPIO_INTERNAL_CLOCK)
#define GPIO_RATE_32000		(GPIO_FREQ_32KHZ | GPIO_MULTI_1X | \
		GPIO_INTERNAL_CLOCK)
#define GPIO_RATE_44100		(GPIO_FREQ_44KHZ | GPIO_MULTI_1X | \
		GPIO_INTERNAL_CLOCK)
#define GPIO_RATE_48000		(GPIO_FREQ_48KHZ | GPIO_MULTI_1X | \
		GPIO_INTERNAL_CLOCK)
#define GPIO_RATE_64000		(GPIO_FREQ_32KHZ | GPIO_MULTI_2X | \
		GPIO_INTERNAL_CLOCK)
#define GPIO_RATE_88200		(GPIO_FREQ_44KHZ | GPIO_MULTI_2X | \
		GPIO_INTERNAL_CLOCK)
#define GPIO_RATE_96000		(GPIO_FREQ_48KHZ | GPIO_MULTI_2X | \

Annotation

Implementation Notes