Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7ae44cfa authored by Risto Suominen's avatar Risto Suominen Committed by Takashi Iwai
Browse files

[ALSA] snd-powermac: style awacs.s and awacs.h



Coding style corrections for awacs.c and awacs.h.

Signed-off-by: default avatarRisto Suominen <Risto.Suominen@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent a8c2a6bf
Loading
Loading
Loading
Loading
+59 −35
Original line number Diff line number Diff line
@@ -267,7 +267,8 @@ static int snd_pmac_awacs_put_switch(struct snd_kcontrol *kcontrol,
static void awacs_set_cuda(int reg, int val)
{
	struct adb_request req;
	cuda_request(&req, NULL, 5, CUDA_PACKET, CUDA_GET_SET_IIC, 0x8a, reg, val);
	cuda_request(&req, NULL, 5, CUDA_PACKET, CUDA_GET_SET_IIC, 0x8a,
			reg, val);
	while (! req.complete)
		cuda_poll();
}
@@ -289,8 +290,8 @@ static void awacs_amp_set_tone(struct awacs_amp *amp, int bass, int treble)
/*
 * vol = 0 - 31 (attenuation), 32 = mute bit, stereo
 */
static int awacs_amp_set_vol(struct awacs_amp *amp, int index, int lvol, int rvol,
			     int do_check)
static int awacs_amp_set_vol(struct awacs_amp *amp, int index,
			     int lvol, int rvol, int do_check)
{
	if (do_check && amp->amp_vol[index][0] == lvol &&
			amp->amp_vol[index][1] == rvol)
@@ -361,8 +362,10 @@ static int snd_pmac_awacs_put_volume_amp(struct snd_kcontrol *kcontrol,
	snd_assert(amp, return -EINVAL);
	snd_assert(index >= 0 && index <= 1, return -EINVAL);

	vol[0] = (31 - (ucontrol->value.integer.value[0] & 31)) | (amp->amp_vol[index][0] & 32);
	vol[1] = (31 - (ucontrol->value.integer.value[1] & 31)) | (amp->amp_vol[index][1] & 32);
	vol[0] = (31 - (ucontrol->value.integer.value[0] & 31))
		| (amp->amp_vol[index][0] & 32);
	vol[1] = (31 - (ucontrol->value.integer.value[1] & 31))
		| (amp->amp_vol[index][1] & 32);
	return awacs_amp_set_vol(amp, index, vol[0], vol[1], 1);
}

@@ -374,8 +377,10 @@ static int snd_pmac_awacs_get_switch_amp(struct snd_kcontrol *kcontrol,
	struct awacs_amp *amp = chip->mixer_data;
	snd_assert(amp, return -EINVAL);
	snd_assert(index >= 0 && index <= 1, return -EINVAL);
	ucontrol->value.integer.value[0] = (amp->amp_vol[index][0] & 32) ? 0 : 1;
	ucontrol->value.integer.value[1] = (amp->amp_vol[index][1] & 32) ? 0 : 1;
	ucontrol->value.integer.value[0] = (amp->amp_vol[index][0] & 32)
					? 0 : 1;
	ucontrol->value.integer.value[1] = (amp->amp_vol[index][1] & 32)
					? 0 : 1;
	return 0;
}

@@ -389,8 +394,10 @@ static int snd_pmac_awacs_put_switch_amp(struct snd_kcontrol *kcontrol,
	snd_assert(amp, return -EINVAL);
	snd_assert(index >= 0 && index <= 1, return -EINVAL);

	vol[0] = (ucontrol->value.integer.value[0] ? 0 : 32) | (amp->amp_vol[index][0] & 31);
	vol[1] = (ucontrol->value.integer.value[1] ? 0 : 32) | (amp->amp_vol[index][1] & 31);
	vol[0] = (ucontrol->value.integer.value[0] ? 0 : 32)
		| (amp->amp_vol[index][0] & 31);
	vol[1] = (ucontrol->value.integer.value[1] ? 0 : 32)
		| (amp->amp_vol[index][1] & 31);
	return awacs_amp_set_vol(amp, index, vol[0], vol[1], 1);
}

@@ -688,12 +695,14 @@ AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_PAROUT1, 0);
/*
 * add new mixer elements to the card
 */
static int build_mixers(struct snd_pmac *chip, int nums, struct snd_kcontrol_new *mixers)
static int build_mixers(struct snd_pmac *chip, int nums,
			struct snd_kcontrol_new *mixers)
{
	int i, err;

	for (i = 0; i < nums; i++) {
		if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&mixers[i], chip))) < 0)
		err = snd_ctl_add(chip->card, snd_ctl_new1(&mixers[i], chip));
		if (err < 0)
			return err;
	}
	return 0;
@@ -743,8 +752,10 @@ static void snd_pmac_awacs_resume(struct snd_pmac *chip)
#ifdef PMAC_AMP_AVAIL
	if (chip->mixer_data) {
		struct awacs_amp *amp = chip->mixer_data;
		awacs_amp_set_vol(amp, 0, amp->amp_vol[0][0], amp->amp_vol[0][1], 0);
		awacs_amp_set_vol(amp, 1, amp->amp_vol[1][0], amp->amp_vol[1][1], 0);
		awacs_amp_set_vol(amp, 0,
				  amp->amp_vol[0][0], amp->amp_vol[0][1], 0);
		awacs_amp_set_vol(amp, 1,
				  amp->amp_vol[1][0], amp->amp_vol[1][1], 0);
		awacs_amp_set_tone(amp, amp->amp_tone[0], amp->amp_tone[1]);
		awacs_amp_set_master(amp, amp->amp_master);
	}
@@ -860,8 +871,10 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
	chip->awacs_reg[2] = vol;
	chip->awacs_reg[4] = vol;
	if (chip->model == PMAC_SCREAMER) {
		chip->awacs_reg[5] = vol; /* FIXME: screamer has loopthru vol control */
		chip->awacs_reg[6] = MASK_MIC_BOOST; /* FIXME: maybe should be vol << 3 for PCMCIA speaker */
		/* FIXME: screamer has loopthru vol control */
		chip->awacs_reg[5] = vol;
		/* FIXME: maybe should be vol << 3 for PCMCIA speaker */
		chip->awacs_reg[6] = MASK_MIC_BOOST;
		chip->awacs_reg[7] = 0;
	}

@@ -877,7 +890,8 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
			return -ENOMEM;
		chip->mixer_data = amp;
		chip->mixer_free = awacs_amp_free;
		awacs_amp_set_vol(amp, 0, 63, 63, 0); /* mute and zero vol */
		/* mute and zero vol */
		awacs_amp_set_vol(amp, 0, 63, 63, 0);
		awacs_amp_set_vol(amp, 1, 63, 63, 0);
		awacs_amp_set_tone(amp, 7, 7); /* 0 dB */
		awacs_amp_set_master(amp, 79); /* 0 dB */
@@ -921,8 +935,9 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
	 */
	strcpy(chip->card->mixername, "PowerMac AWACS");

	if ((err = build_mixers(chip, ARRAY_SIZE(snd_pmac_awacs_mixers),
				snd_pmac_awacs_mixers)) < 0)
	err = build_mixers(chip, ARRAY_SIZE(snd_pmac_awacs_mixers),
				snd_pmac_awacs_mixers);
	if (err < 0)
		return err;
	if (beige)
		;
@@ -955,7 +970,8 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
	chip->master_sw_ctl = snd_ctl_new1((pm7500 || imac)
			? &snd_pmac_awacs_master_sw_imac
			: &snd_pmac_awacs_master_sw, chip);
	if ((err = snd_ctl_add(chip->card, chip->master_sw_ctl)) < 0)
	err = snd_ctl_add(chip->card, chip->master_sw_ctl);
	if (err < 0)
		return err;
#ifdef PMAC_AMP_AVAIL
	if (chip->mixer_data) {
@@ -965,27 +981,34 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
		 * screamer registers.
		 * in this case, it seems the route C is not used.
		 */
		if ((err = build_mixers(chip, ARRAY_SIZE(snd_pmac_awacs_amp_vol),
					snd_pmac_awacs_amp_vol)) < 0)
		err = build_mixers(chip, ARRAY_SIZE(snd_pmac_awacs_amp_vol),
					snd_pmac_awacs_amp_vol);
		if (err < 0)
			return err;
		/* overwrite */
		chip->master_sw_ctl = snd_ctl_new1(&snd_pmac_awacs_amp_hp_sw, chip);
		if ((err = snd_ctl_add(chip->card, chip->master_sw_ctl)) < 0)
		chip->master_sw_ctl = snd_ctl_new1(&snd_pmac_awacs_amp_hp_sw,
							chip);
		err = snd_ctl_add(chip->card, chip->master_sw_ctl);
		if (err < 0)
			return err;
		chip->speaker_sw_ctl = snd_ctl_new1(&snd_pmac_awacs_amp_spk_sw, chip);
		if ((err = snd_ctl_add(chip->card, chip->speaker_sw_ctl)) < 0)
		chip->speaker_sw_ctl = snd_ctl_new1(&snd_pmac_awacs_amp_spk_sw,
							chip);
		err = snd_ctl_add(chip->card, chip->speaker_sw_ctl);
		if (err < 0)
			return err;
	} else
#endif /* PMAC_AMP_AVAIL */
	{
		/* route A = headphone, route C = speaker */
		if ((err = build_mixers(chip, ARRAY_SIZE(snd_pmac_awacs_speaker_vol),
					snd_pmac_awacs_speaker_vol)) < 0)
		err = build_mixers(chip, ARRAY_SIZE(snd_pmac_awacs_speaker_vol),
					snd_pmac_awacs_speaker_vol);
		if (err < 0)
			return err;
		chip->speaker_sw_ctl = snd_ctl_new1(imac
				? &snd_pmac_awacs_speaker_sw_imac
				: &snd_pmac_awacs_speaker_sw, chip);
		if ((err = snd_ctl_add(chip->card, chip->speaker_sw_ctl)) < 0)
		err = snd_ctl_add(chip->card, chip->speaker_sw_ctl);
		if (err < 0)
			return err;
	}

@@ -1020,7 +1043,8 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
	chip->resume = snd_pmac_awacs_resume;
#endif
#ifdef PMAC_SUPPORT_AUTOMUTE
	if ((err = snd_pmac_add_automute(chip)) < 0)
	err = snd_pmac_add_automute(chip);
	if (err < 0)
		return err;
	chip->detect_headphone = snd_pmac_awacs_detect_headphone;
	chip->update_automute = snd_pmac_awacs_update_automute;
+3 −2
Original line number Diff line number Diff line
@@ -175,7 +175,8 @@ struct awacs_regs {
/* DBDMA ChannelStatus Bit Masks */
/* ----- ------------- --- ----- */
#define MASK_CSERR	(0x1 << 7)	/* Error */
#define MASK_EOI	(0x1 << 6)	/* End of Input -- only for Input Channel */
#define MASK_EOI	(0x1 << 6)	/* End of Input --
					   only for Input Channel */
#define MASK_CSUNUSED	(0x1f << 1)	/* bits 1-5 not used */
#define MASK_WAIT	(0x1)		/* Wait */