home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / src / linux-headers-2.6.17-6 / include / sound / ak4xxx-adda.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-08-11  |  2.8 KB  |  81 lines

  1. #ifndef __SOUND_AK4XXX_ADDA_H
  2. #define __SOUND_AK4XXX_ADDA_H
  3.  
  4. /*
  5.  *   ALSA driver for AK4524 / AK4528 / AK4529 / AK4355 / AK4381
  6.  *   AD and DA converters
  7.  *
  8.  *    Copyright (c) 2000 Jaroslav Kysela <perex@suse.cz>
  9.  *
  10.  *   This program is free software; you can redistribute it and/or modify
  11.  *   it under the terms of the GNU General Public License as published by
  12.  *   the Free Software Foundation; either version 2 of the License, or
  13.  *   (at your option) any later version.
  14.  *
  15.  *   This program is distributed in the hope that it will be useful,
  16.  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.  *   GNU General Public License for more details.
  19.  *
  20.  *   You should have received a copy of the GNU General Public License
  21.  *   along with this program; if not, write to the Free Software
  22.  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  23.  *
  24.  */      
  25.  
  26. #ifndef AK4XXX_MAX_CHIPS
  27. #define AK4XXX_MAX_CHIPS    4
  28. #endif
  29.  
  30. struct snd_akm4xxx;
  31.  
  32. struct snd_ak4xxx_ops {
  33.     void (*lock)(struct snd_akm4xxx *ak, int chip);
  34.     void (*unlock)(struct snd_akm4xxx *ak, int chip);
  35.     void (*write)(struct snd_akm4xxx *ak, int chip, unsigned char reg,
  36.               unsigned char val);
  37.     void (*set_rate_val)(struct snd_akm4xxx *ak, unsigned int rate);
  38. };
  39.  
  40. #define AK4XXX_IMAGE_SIZE    (AK4XXX_MAX_CHIPS * 16)    /* 64 bytes */
  41.  
  42. struct snd_akm4xxx {
  43.     struct snd_card *card;
  44.     unsigned int num_adcs;            /* AK4524 or AK4528 ADCs */
  45.     unsigned int num_dacs;            /* AK4524 or AK4528 DACs */
  46.     unsigned char images[AK4XXX_IMAGE_SIZE]; /* saved register image */
  47.     unsigned char ipga_gain[AK4XXX_MAX_CHIPS][2]; /* saved register image
  48.                                * for IPGA (AK4528)
  49.                                */
  50.     unsigned long private_value[AK4XXX_MAX_CHIPS];    /* helper for driver */
  51.     void *private_data[AK4XXX_MAX_CHIPS];        /* helper for driver */
  52.     /* template should fill the following fields */
  53.     unsigned int idx_offset;        /* control index offset */
  54.     enum {
  55.         SND_AK4524, SND_AK4528, SND_AK4529,
  56.         SND_AK4355, SND_AK4358, SND_AK4381
  57.     } type;
  58.     unsigned int *num_stereo;    /* array of combined counts
  59.                      * for the mixer
  60.                      */
  61.     char **channel_names;        /* array of mixer channel names */
  62.     struct snd_ak4xxx_ops ops;
  63. };
  64.  
  65. void snd_akm4xxx_write(struct snd_akm4xxx *ak, int chip, unsigned char reg,
  66.                unsigned char val);
  67. void snd_akm4xxx_reset(struct snd_akm4xxx *ak, int state);
  68. void snd_akm4xxx_init(struct snd_akm4xxx *ak);
  69. int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak);
  70.  
  71. #define snd_akm4xxx_get(ak,chip,reg) \
  72.     (ak)->images[(chip) * 16 + (reg)]
  73. #define snd_akm4xxx_set(ak,chip,reg,val) \
  74.     ((ak)->images[(chip) * 16 + (reg)] = (val))
  75. #define snd_akm4xxx_get_ipga(ak,chip,reg) \
  76.     (ak)->ipga_gain[chip][(reg)-4]
  77. #define snd_akm4xxx_set_ipga(ak,chip,reg,val) \
  78.     ((ak)->ipga_gain[chip][(reg)-4] = (val))
  79.  
  80. #endif /* __SOUND_AK4XXX_ADDA_H */
  81.