/* Do the read twice due to buffers on some ac97 codecs. * e.g. The STAC9704 returns exactly what you wrote the the register * if you read it immediately. This causes the detect routine to fail. */ val = snd_ac97_read(ac97, reg); 
static void check_volume_resolution(ac97_t *ac97, int reg, unsigned char *lo_max, unsigned char *hi_max){	unsigned short cbit[3] = { 0x20, 0x10, 0x01 };	unsigned char max[3] = { 63, 31, 15 };	int i;	*lo_max = *hi_max = 0;	for (i = 0 ; i < ARRAY_SIZE(cbit); i++) {		unsigned short val;		snd_ac97_write(ac97, reg, 0x8080 | cbit[i] | (cbit[i] << 8));		val = snd_ac97_read(ac97, reg);		if (! *lo_max && (val & 0x7f) == cbit[i])			*lo_max = max[i];		if (! *hi_max && ((val >> 8) & 0x7f) == cbit[i])			*hi_max = max[i];		if (*lo_max && *hi_max)			break;	}}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/c9eab129fcbcef364b34fb3a70cb2531847e1edf/ac97_codec.c/clean/sound/pci/ac97/ac97_codec.c