sound/ppc/burgundy.c

Source file repositories/reference/linux-study-clean/sound/ppc/burgundy.c

File Facts

System
Linux kernel
Corpus path
sound/ppc/burgundy.c
Extension
.c
Size
24112 bytes
Lines
715
Domain
Driver Families
Bucket
sound/ppc
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

if (do_notify) {
			snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
				       &chip->master_sw_ctl->id);
			snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
				       &chip->speaker_sw_ctl->id);
			snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
				       &chip->hp_detect_ctl->id);
		}
	}
}
#endif /* PMAC_SUPPORT_AUTOMUTE */


/*
 * initialize burgundy
 */
int snd_pmac_burgundy_init(struct snd_pmac *chip)
{
	int imac = of_machine_is_compatible("iMac");
	int i, err;

	/* Checks to see the chip is alive and kicking */
	if ((in_le32(&chip->awacs->codec_ctrl) & MASK_ERRCODE) == 0xf0000) {
		printk(KERN_WARNING "pmac burgundy: disabled by MacOS :-(\n");
		return 1;
	}

	snd_pmac_burgundy_wcw(chip, MASK_ADDR_BURGUNDY_OUTPUTENABLES,
			   DEF_BURGUNDY_OUTPUTENABLES);
	snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES,
			   DEF_BURGUNDY_MORE_OUTPUTENABLES);
	snd_pmac_burgundy_wcw(chip, MASK_ADDR_BURGUNDY_OUTPUTSELECTS,
			   DEF_BURGUNDY_OUTPUTSELECTS);

	snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_INPSEL21,
			   DEF_BURGUNDY_INPSEL21);
	snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_INPSEL3,
			   imac ? DEF_BURGUNDY_INPSEL3_IMAC
			   : DEF_BURGUNDY_INPSEL3_PMAC);
	snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_GAINCD,
			   DEF_BURGUNDY_GAINCD);
	snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_GAINLINE,
			   DEF_BURGUNDY_GAINLINE);
	snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_GAINMIC,
			   DEF_BURGUNDY_GAINMIC);
	snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_GAINMODEM,
			   DEF_BURGUNDY_GAINMODEM);

	snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_ATTENSPEAKER,
			   DEF_BURGUNDY_ATTENSPEAKER);
	snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_ATTENLINEOUT,
			   DEF_BURGUNDY_ATTENLINEOUT);
	snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_ATTENHP,
			   DEF_BURGUNDY_ATTENHP);

	snd_pmac_burgundy_wcw(chip, MASK_ADDR_BURGUNDY_MASTER_VOLUME,
			   DEF_BURGUNDY_MASTER_VOLUME);
	snd_pmac_burgundy_wcw(chip, MASK_ADDR_BURGUNDY_VOLCD,
			   DEF_BURGUNDY_VOLCD);
	snd_pmac_burgundy_wcw(chip, MASK_ADDR_BURGUNDY_VOLLINE,
			   DEF_BURGUNDY_VOLLINE);
	snd_pmac_burgundy_wcw(chip, MASK_ADDR_BURGUNDY_VOLMIC,
			   DEF_BURGUNDY_VOLMIC);

	if (chip->hp_stat_mask == 0) {
		/* set headphone-jack detection bit */
		if (imac)
			chip->hp_stat_mask = BURGUNDY_HPDETECT_IMAC_UPPER
				| BURGUNDY_HPDETECT_IMAC_LOWER
				| BURGUNDY_HPDETECT_IMAC_SIDE;
		else
			chip->hp_stat_mask = BURGUNDY_HPDETECT_PMAC_BACK;
	}
	/*
	 * build burgundy mixers
	 */
	strscpy(chip->card->mixername, "PowerMac Burgundy");

	for (i = 0; i < ARRAY_SIZE(snd_pmac_burgundy_mixers); i++) {
		err = snd_ctl_add(chip->card,
		    snd_ctl_new1(&snd_pmac_burgundy_mixers[i], chip));
		if (err < 0)
			return err;
	}
	for (i = 0; i < (imac ? ARRAY_SIZE(snd_pmac_burgundy_mixers_imac)
			: ARRAY_SIZE(snd_pmac_burgundy_mixers_pmac)); i++) {
		err = snd_ctl_add(chip->card,
		    snd_ctl_new1(imac ? &snd_pmac_burgundy_mixers_imac[i]
		    : &snd_pmac_burgundy_mixers_pmac[i], chip));
		if (err < 0)

Annotation

Implementation Notes