If you need to access to the codec from the driver, you can
call the following functions:
snd_ac97_write()
,
snd_ac97_read()
,
snd_ac97_update()
and
snd_ac97_update_bits()
.
Both snd_ac97_write()
and
snd_ac97_update()
functions are used to
set a value to the given register
(AC97_XXX
). The difference between them is
that snd_ac97_update()
doesn't write a
value if the given value has been already set, while
snd_ac97_write()
always rewrites the
value.
snd_ac97_write(ac97, AC97_MASTER, 0x8080); snd_ac97_update(ac97, AC97_MASTER, 0x8080);
snd_ac97_read()
is used to read the value
of the given register. For example,
value = snd_ac97_read(ac97, AC97_MASTER);
snd_ac97_update_bits()
is used to update
some bits in the given register.
snd_ac97_update_bits(ac97, reg, mask, value);
Also, there is a function to change the sample rate (of a
given register such as
AC97_PCM_FRONT_DAC_RATE
) when VRA or
DRA is supported by the codec:
snd_ac97_set_rate()
.
snd_ac97_set_rate(ac97, AC97_PCM_FRONT_DAC_RATE, 44100);
The following registers are available to set the rate:
AC97_PCM_MIC_ADC_RATE
,
AC97_PCM_FRONT_DAC_RATE
,
AC97_PCM_LR_ADC_RATE
,
AC97_SPDIF
. When
AC97_SPDIF
is specified, the register is
not really changed but the corresponding IEC958 status bits will
be updated.