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 callbacks of control API.

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

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

The wait callback is used for a certain wait at the standard initialization of the codec. If the chip requires the extra wait-time, define this callback.

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