Bladeren bron

[ALSA] ac97 - Add support of static resolution tables

Modules: AC97 Codec

Added the support of static resolution table support for codecs
that the driver cannot probe the volume resolution properly.

The table pointer should be set in each codec patch.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai 20 jaren geleden
bovenliggende
commit
50dabc2d11
2 gewijzigde bestanden met toevoegingen van 19 en 0 verwijderingen
  1. 7 0
      include/sound/ac97_codec.h
  2. 12 0
      sound/pci/ac97/ac97_codec.c

+ 7 - 0
include/sound/ac97_codec.h

@@ -444,6 +444,12 @@ struct snd_ac97_template {
 	DECLARE_BITMAP(reg_accessed, 0x80); /* bit flags */
 	DECLARE_BITMAP(reg_accessed, 0x80); /* bit flags */
 };
 };
 
 
+/* static resolution table */
+struct snd_ac97_res_table {
+	unsigned short reg;	/* register */
+	unsigned short bits;	/* resolution bitmask */
+};
+
 struct snd_ac97 {
 struct snd_ac97 {
 	/* -- lowlevel (hardware) driver specific -- */
 	/* -- lowlevel (hardware) driver specific -- */
 	struct snd_ac97_build_ops * build_ops;
 	struct snd_ac97_build_ops * build_ops;
@@ -464,6 +470,7 @@ struct snd_ac97 {
 	unsigned short caps;	/* capabilities (register 0) */
 	unsigned short caps;	/* capabilities (register 0) */
 	unsigned short ext_id;	/* extended feature identification (register 28) */
 	unsigned short ext_id;	/* extended feature identification (register 28) */
 	unsigned short ext_mid;	/* extended modem ID (register 3C) */
 	unsigned short ext_mid;	/* extended modem ID (register 3C) */
+	const struct snd_ac97_res_table *res_table;	/* static resolution */
 	unsigned int scaps;	/* driver capabilities */
 	unsigned int scaps;	/* driver capabilities */
 	unsigned int flags;	/* specific code */
 	unsigned int flags;	/* specific code */
 	unsigned int rates[6];	/* see AC97_RATES_* defines */
 	unsigned int rates[6];	/* see AC97_RATES_* defines */

+ 12 - 0
sound/pci/ac97/ac97_codec.c

@@ -1030,6 +1030,18 @@ static void check_volume_resolution(struct snd_ac97 *ac97, int reg, unsigned cha
 	unsigned char max[3] = { 63, 31, 15 };
 	unsigned char max[3] = { 63, 31, 15 };
 	int i;
 	int i;
 
 
+	/* first look up the static resolution table */
+	if (ac97->res_table) {
+		const struct snd_ac97_res_table *tbl;
+		for (tbl = ac97->res_table; tbl->reg; tbl++) {
+			if (tbl->reg == reg) {
+				*lo_max = tbl->bits & 0xff;
+				*hi_max = (tbl->bits >> 8) & 0xff;
+				return;
+			}
+		}
+	}
+
 	*lo_max = *hi_max = 0;
 	*lo_max = *hi_max = 0;
 	for (i = 0 ; i < ARRAY_SIZE(cbit); i++) {
 	for (i = 0 ; i < ARRAY_SIZE(cbit); i++) {
 		unsigned short val;
 		unsigned short val;