Callbacks

The standard callbacks are read and write. Obviously they correspond to the functions for read and write accesses to the hardware low-level codes.

The read callback returns the register value specified in the argument.


  static unsigned short snd_mychip_ac97_read(struct snd_ac97 *ac97,
                                             unsigned short reg)
  {
          struct mychip *chip = ac97->private_data;
          ....
          return the_register_value;
  }

          

Here, the chip can be cast from ac97->private_data.

Meanwhile, the write callback is used to set the register value.


  static void snd_mychip_ac97_write(struct snd_ac97 *ac97,
                       unsigned short reg, unsigned short val)

          

These callbacks are non-atomic like the control API callbacks.

There are also other callbacks: reset, wait and init.

The reset callback is used to reset the codec. If the chip requires a special kind of reset, you can define this callback.

The wait callback is used to add some waiting time in the standard initialization of the codec. If the chip requires the extra waiting time, define this callback.

The init callback is used for additional initialization of the codec.