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

Commit 133271fe authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Jaroslav Kysela
Browse files

[ALSA] cmipci: reorganize chip version detection



Add a case for chip version 39 where no bit is set in register 0Ch, and
move the detection of version 39 before that of 8768.  This makes the
logic more compatible with the driver on that other OS.

Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent c9116ae4
Loading
Loading
Loading
Loading
+20 −24
Original line number Diff line number Diff line
@@ -2625,46 +2625,42 @@ static void __devinit query_chip(struct cmipci *cm)
	if (! detect) {
		/* check reg 08h, bit 24-28 */
		detect = snd_cmipci_read(cm, CM_REG_CHFORMAT) & CM_CHIP_MASK1;
		if (! detect) {
		switch (detect) {
		case 0:
			cm->chip_version = 33;
			cm->max_channels = 2;
			if (cm->do_soft_ac3)
				cm->can_ac3_sw = 1;
			else
				cm->can_ac3_hw = 1;
			cm->has_dual_dac = 1;
		} else {
			break;
		case 1:
			cm->chip_version = 37;
			cm->max_channels = 2;
			cm->can_ac3_hw = 1;
			cm->has_dual_dac = 1;
		}
	} else {
		/* check reg 0Ch, bit 26 */
		if (detect & CM_CHIP_8768) {
			cm->chip_version = 68;
			cm->max_channels = 8;
			cm->can_ac3_hw = 1;
			cm->has_dual_dac = 1;
			cm->can_multi_ch = 1;
		} else if (detect & CM_CHIP_055) {
			cm->chip_version = 55;
			cm->max_channels = 6;
			break;
		default:
			cm->chip_version = 39;
			cm->can_ac3_hw = 1;
			break;
		}
		cm->max_channels = 2;
		cm->has_dual_dac = 1;
			cm->can_multi_ch = 1;
		} else if (detect & CM_CHIP_039) {
	} else {
		if (detect & CM_CHIP_039) {
			cm->chip_version = 39;
			if (detect & CM_CHIP_039_6CH) /* 4 or 6 channels */
				cm->max_channels = 6;
			else
				cm->max_channels = 4;
		} else if (detect & CM_CHIP_8768) {
			cm->chip_version = 68;
			cm->max_channels = 8;
		} else {
			cm->chip_version = 55;
			cm->max_channels = 6;
		}
		cm->can_ac3_hw = 1;
		cm->has_dual_dac = 1;
		cm->can_multi_ch = 1;
		} else {
			printk(KERN_ERR "chip %x version not supported\n", detect);
		}
	}
}