Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
ac97_codec.c File Reference
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/pci.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/tlv.h>
#include <sound/ac97_codec.h>
#include <sound/asoundef.h>
#include <sound/initval.h>
#include "ac97_id.h"
#include "ac97_patch.c"

Go to the source code of this file.

Data Structures

struct  ac97_codec_id
 
struct  ac97_power_reg
 
struct  quirk_table
 

Macros

#define ac97_is_power_save_mode(ac97)   0
 
#define AD18XX_PCM_BITS(xname, codec, lshift, rshift, mask)
 
#define AD18XX_PCM_VOLUME(xname, codec)
 
#define snd_ac97_cmix_new(card, pfx, reg, acheck, ac97)   snd_ac97_cmix_new_stereo(card, pfx, reg, 0, acheck, ac97)
 
#define snd_ac97_cmute_new(card, name, reg, acheck, ac97)   snd_ac97_cmute_new_stereo(card, name, reg, 0, acheck, ac97)
 

Enumerations

enum  {
  AC97_GENERAL_PCM_OUT = 0, AC97_GENERAL_STEREO_ENHANCEMENT, AC97_GENERAL_3D, AC97_GENERAL_LOUDNESS,
  AC97_GENERAL_MONO, AC97_GENERAL_MIC, AC97_GENERAL_LOOPBACK
}
 
enum  {
  PWIDX_ADC, PWIDX_FRONT, PWIDX_CLFE, PWIDX_SURR,
  PWIDX_MIC, PWIDX_SIZE
}
 

Functions

 MODULE_AUTHOR ("Jaroslav Kysela <[email protected]>")
 
 MODULE_DESCRIPTION ("Universal interface for Audio Codec '97")
 
 MODULE_LICENSE ("GPL")
 
 module_param (enable_loopback, bool, 0444)
 
 MODULE_PARM_DESC (enable_loopback,"Enable AC97 ADC/DAC Loopback Control")
 
void snd_ac97_write (struct snd_ac97 *ac97, unsigned short reg, unsigned short value)
 
 EXPORT_SYMBOL (snd_ac97_write)
 
unsigned short snd_ac97_read (struct snd_ac97 *ac97, unsigned short reg)
 
 EXPORT_SYMBOL (snd_ac97_read)
 
void snd_ac97_write_cache (struct snd_ac97 *ac97, unsigned short reg, unsigned short value)
 
 EXPORT_SYMBOL (snd_ac97_write_cache)
 
int snd_ac97_update (struct snd_ac97 *ac97, unsigned short reg, unsigned short value)
 
 EXPORT_SYMBOL (snd_ac97_update)
 
int snd_ac97_update_bits (struct snd_ac97 *ac97, unsigned short reg, unsigned short mask, unsigned short value)
 
 EXPORT_SYMBOL (snd_ac97_update_bits)
 
int snd_ac97_update_bits_nolock (struct snd_ac97 *ac97, unsigned short reg, unsigned short mask, unsigned short value)
 
void snd_ac97_get_name (struct snd_ac97 *ac97, unsigned int id, char *name, int modem)
 
const charsnd_ac97_get_short_name (struct snd_ac97 *ac97)
 
 EXPORT_SYMBOL (snd_ac97_get_short_name)
 
int snd_ac97_bus (struct snd_card *card, int num, struct snd_ac97_bus_ops *ops, void *private_data, struct snd_ac97_bus **rbus)
 
 EXPORT_SYMBOL (snd_ac97_bus)
 
int snd_ac97_mixer (struct snd_ac97_bus *bus, struct snd_ac97_template *template, struct snd_ac97 **rac97)
 
 EXPORT_SYMBOL (snd_ac97_mixer)
 
int snd_ac97_tune_hardware (struct snd_ac97 *ac97, struct ac97_quirk *quirk, const char *override)
 
 EXPORT_SYMBOL (snd_ac97_tune_hardware)
 

Macro Definition Documentation

#define ac97_is_power_save_mode (   ac97)    0

Definition at line 213 of file ac97_codec.c.

#define AD18XX_PCM_BITS (   xname,
  codec,
  lshift,
  rshift,
  mask 
)
Value:
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .info = snd_ac97_ad18xx_pcm_info_bits, \
.get = snd_ac97_ad18xx_pcm_get_bits, .put = snd_ac97_ad18xx_pcm_put_bits, \
.private_value = (codec) | ((lshift) << 8) | ((rshift) << 12) | ((mask) << 16) }

Definition at line 885 of file ac97_codec.c.

#define AD18XX_PCM_VOLUME (   xname,
  codec 
)
Value:
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .info = snd_ac97_ad18xx_pcm_info_volume, \
.get = snd_ac97_ad18xx_pcm_get_volume, .put = snd_ac97_ad18xx_pcm_put_volume, \
.private_value = codec }

Definition at line 939 of file ac97_codec.c.

#define snd_ac97_cmix_new (   card,
  pfx,
  reg,
  acheck,
  ac97 
)    snd_ac97_cmix_new_stereo(card, pfx, reg, 0, acheck, ac97)

Definition at line 1321 of file ac97_codec.c.

#define snd_ac97_cmute_new (   card,
  name,
  reg,
  acheck,
  ac97 
)    snd_ac97_cmute_new_stereo(card, name, reg, 0, acheck, ac97)

Definition at line 1323 of file ac97_codec.c.

Enumeration Type Documentation

anonymous enum
Enumerator:
AC97_GENERAL_PCM_OUT 
AC97_GENERAL_STEREO_ENHANCEMENT 
AC97_GENERAL_3D 
AC97_GENERAL_LOUDNESS 
AC97_GENERAL_MONO 
AC97_GENERAL_MIC 
AC97_GENERAL_LOOPBACK 

Definition at line 654 of file ac97_codec.c.

anonymous enum
Enumerator:
PWIDX_ADC 
PWIDX_FRONT 
PWIDX_CLFE 
PWIDX_SURR 
PWIDX_MIC 
PWIDX_SIZE 

Definition at line 2355 of file ac97_codec.c.

Function Documentation

EXPORT_SYMBOL ( snd_ac97_write  )
EXPORT_SYMBOL ( snd_ac97_read  )
EXPORT_SYMBOL ( snd_ac97_write_cache  )
EXPORT_SYMBOL ( snd_ac97_update  )
EXPORT_SYMBOL ( snd_ac97_update_bits  )
EXPORT_SYMBOL ( snd_ac97_get_short_name  )
EXPORT_SYMBOL ( snd_ac97_bus  )
EXPORT_SYMBOL ( snd_ac97_mixer  )
EXPORT_SYMBOL ( snd_ac97_tune_hardware  )
MODULE_AUTHOR ( "Jaroslav Kysela <[email protected]>"  )
MODULE_DESCRIPTION ( "Universal interface for Audio Codec '97"  )
MODULE_LICENSE ( "GPL"  )
module_param ( enable_loopback  ,
bool  ,
0444   
)
MODULE_PARM_DESC ( enable_loopback  ,
"Enable AC97 ADC/DAC Loopback Control  
)
int snd_ac97_bus ( struct snd_card card,
int  num,
struct snd_ac97_bus_ops ops,
void private_data,
struct snd_ac97_bus **  rbus 
)

snd_ac97_bus - create an AC97 bus component : the card instance : the bus number : the bus callbacks table : private data pointer for the new instance : the pointer to store the new AC97 bus instance.

Creates an AC97 bus component. An struct snd_ac97_bus instance is newly allocated and initialized.

The ops table must include valid callbacks (at least read and write). The other callbacks, wait and reset, are not mandatory.

The clock is set to 48000. If another clock is needed, set (*rbus)->clock manually.

The AC97 bus instance is registered as a low-level device, so you don't have to release it manually.

Returns zero if successful, or a negative error code on failure.

Definition at line 1915 of file ac97_codec.c.

void snd_ac97_get_name ( struct snd_ac97 ac97,
unsigned int  id,
char name,
int  modem 
)

Definition at line 1801 of file ac97_codec.c.

const char* snd_ac97_get_short_name ( struct snd_ac97 ac97)

snd_ac97_get_short_name - retrieve codec name : the codec instance

Returns the short identifying name of the codec.

Definition at line 1841 of file ac97_codec.c.

int snd_ac97_mixer ( struct snd_ac97_bus bus,
struct snd_ac97_template template,
struct snd_ac97 **  rac97 
)

snd_ac97_mixer - create an Codec97 component : the AC97 bus which codec is attached to : the template of ac97, including index, callbacks and the private data. : the pointer to store the new ac97 instance.

Creates an Codec97 component. An struct snd_ac97 instance is newly allocated and initialized from the template. The codec is then initialized by the standard procedure.

The template must include the codec number (num) and address (addr), and the private data (private_data).

The ac97 instance is registered as a low-level device, so you don't have to release it manually.

Returns zero if successful, or a negative error code on failure.

Definition at line 2011 of file ac97_codec.c.

unsigned short snd_ac97_read ( struct snd_ac97 ac97,
unsigned short  reg 
)

snd_ac97_read - read a value from the given register

: the ac97 instance : the register to read

Reads a value from the given register. This will invoke the read callback directly after the register check.

Returns the read value.

Definition at line 304 of file ac97_codec.c.

int snd_ac97_tune_hardware ( struct snd_ac97 ac97,
struct ac97_quirk quirk,
const char override 
)

snd_ac97_tune_hardware - tune up the hardware : the ac97 instance : quirk list : explicit quirk value (overrides the list if non-NULL)

Do some workaround for each pci device, such as renaming of the headphone (true line-out) control as "Master". The quirk-list must be terminated with a zero-filled entry.

Returns zero if successful, or a negative error code on failure.

Definition at line 2891 of file ac97_codec.c.

int snd_ac97_update ( struct snd_ac97 ac97,
unsigned short  reg,
unsigned short  value 
)

snd_ac97_update - update the value on the given register : the ac97 instance : the register to change : the value to set

Compares the value with the register cache and updates the value only when the value is changed.

Returns 1 if the value is changed, 0 if no change, or a negative code on failure.

Definition at line 358 of file ac97_codec.c.

int snd_ac97_update_bits ( struct snd_ac97 ac97,
unsigned short  reg,
unsigned short  mask,
unsigned short  value 
)

snd_ac97_update_bits - update the bits on the given register : the ac97 instance : the register to change : the bit-mask to change : the value to set

Updates the masked-bits on the given register only when the value is changed.

Returns 1 if the bits are changed, 0 if no change, or a negative code on failure.

Definition at line 390 of file ac97_codec.c.

int snd_ac97_update_bits_nolock ( struct snd_ac97 ac97,
unsigned short  reg,
unsigned short  mask,
unsigned short  value 
)

Definition at line 405 of file ac97_codec.c.

void snd_ac97_write ( struct snd_ac97 ac97,
unsigned short  reg,
unsigned short  value 
)

snd_ac97_write - write a value on the given register : the ac97 instance : the register to change : the value to set

Writes a value on the given register. This will invoke the write callback directly after the register check. This function doesn't change the register cache unlike #snd_ca97_write_cache(), so use this only when you don't want to reflect the change to the suspend/resume state.

Definition at line 279 of file ac97_codec.c.

void snd_ac97_write_cache ( struct snd_ac97 ac97,
unsigned short  reg,
unsigned short  value 
)

snd_ac97_write_cache - write a value on the given register and update the cache : the ac97 instance : the register to change : the value to set

Writes a value on the given register and updates the register cache. The cached values are used for the cached-read and the suspend/resume.

Definition at line 333 of file ac97_codec.c.