0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef CTATC_H
0015 #define CTATC_H
0016
0017 #include <linux/types.h>
0018 #include <linux/mutex.h>
0019 #include <linux/pci.h>
0020 #include <linux/timer.h>
0021 #include <sound/core.h>
0022
0023 #include "ctvmem.h"
0024 #include "cthardware.h"
0025 #include "ctresource.h"
0026
0027 enum CTALSADEVS {
0028 FRONT,
0029 SURROUND,
0030 CLFE,
0031 SIDE,
0032 IEC958,
0033 MIXER,
0034 NUM_CTALSADEVS
0035 };
0036
0037 struct ct_atc_chip_sub_details {
0038 u16 subsys;
0039 const char *nm_model;
0040 };
0041
0042 struct ct_atc_chip_details {
0043 u16 vendor;
0044 u16 device;
0045 const struct ct_atc_chip_sub_details *sub_details;
0046 const char *nm_card;
0047 };
0048
0049 struct ct_atc;
0050 struct ct_timer;
0051 struct ct_timer_instance;
0052
0053
0054 struct ct_atc_pcm {
0055 struct snd_pcm_substream *substream;
0056 void (*interrupt)(struct ct_atc_pcm *apcm);
0057 struct ct_timer_instance *timer;
0058 unsigned int started:1;
0059
0060
0061 struct ct_vm_block *vm_block;
0062 void *src;
0063 void **srccs;
0064 void **srcimps;
0065 void **amixers;
0066 void *mono;
0067 unsigned char n_srcc;
0068 unsigned char n_srcimp;
0069 unsigned char n_amixer;
0070 };
0071
0072
0073 struct ct_atc {
0074 struct pci_dev *pci;
0075 struct snd_card *card;
0076 unsigned int rsr;
0077 unsigned int msr;
0078 unsigned int pll_rate;
0079
0080 int chip_type;
0081 int model;
0082 const char *chip_name;
0083 const char *model_name;
0084
0085 struct ct_vm *vm;
0086 int (*map_audio_buffer)(struct ct_atc *atc, struct ct_atc_pcm *apcm);
0087 void (*unmap_audio_buffer)(struct ct_atc *atc, struct ct_atc_pcm *apcm);
0088 unsigned long (*get_ptp_phys)(struct ct_atc *atc, int index);
0089
0090 struct mutex atc_mutex;
0091
0092 int (*pcm_playback_prepare)(struct ct_atc *atc,
0093 struct ct_atc_pcm *apcm);
0094 int (*pcm_playback_start)(struct ct_atc *atc, struct ct_atc_pcm *apcm);
0095 int (*pcm_playback_stop)(struct ct_atc *atc, struct ct_atc_pcm *apcm);
0096 int (*pcm_playback_position)(struct ct_atc *atc,
0097 struct ct_atc_pcm *apcm);
0098 int (*spdif_passthru_playback_prepare)(struct ct_atc *atc,
0099 struct ct_atc_pcm *apcm);
0100 int (*pcm_capture_prepare)(struct ct_atc *atc, struct ct_atc_pcm *apcm);
0101 int (*pcm_capture_start)(struct ct_atc *atc, struct ct_atc_pcm *apcm);
0102 int (*pcm_capture_stop)(struct ct_atc *atc, struct ct_atc_pcm *apcm);
0103 int (*pcm_capture_position)(struct ct_atc *atc,
0104 struct ct_atc_pcm *apcm);
0105 int (*pcm_release_resources)(struct ct_atc *atc,
0106 struct ct_atc_pcm *apcm);
0107 int (*select_line_in)(struct ct_atc *atc);
0108 int (*select_mic_in)(struct ct_atc *atc);
0109 int (*select_digit_io)(struct ct_atc *atc);
0110 int (*line_front_unmute)(struct ct_atc *atc, unsigned char state);
0111 int (*line_surround_unmute)(struct ct_atc *atc, unsigned char state);
0112 int (*line_clfe_unmute)(struct ct_atc *atc, unsigned char state);
0113 int (*line_rear_unmute)(struct ct_atc *atc, unsigned char state);
0114 int (*line_in_unmute)(struct ct_atc *atc, unsigned char state);
0115 int (*mic_unmute)(struct ct_atc *atc, unsigned char state);
0116 int (*spdif_out_unmute)(struct ct_atc *atc, unsigned char state);
0117 int (*spdif_in_unmute)(struct ct_atc *atc, unsigned char state);
0118 int (*spdif_out_get_status)(struct ct_atc *atc, unsigned int *status);
0119 int (*spdif_out_set_status)(struct ct_atc *atc, unsigned int status);
0120 int (*spdif_out_passthru)(struct ct_atc *atc, unsigned char state);
0121 struct capabilities (*capabilities)(struct ct_atc *atc);
0122 int (*output_switch_get)(struct ct_atc *atc);
0123 int (*output_switch_put)(struct ct_atc *atc, int position);
0124 int (*mic_source_switch_get)(struct ct_atc *atc);
0125 int (*mic_source_switch_put)(struct ct_atc *atc, int position);
0126
0127
0128 void *rsc_mgrs[NUM_RSCTYP];
0129 void *mixer;
0130 struct hw *hw;
0131 void **daios;
0132 void **pcm;
0133 void **srcs;
0134 void **srcimps;
0135 unsigned char n_daio;
0136 unsigned char n_src;
0137 unsigned char n_srcimp;
0138 unsigned char n_pcm;
0139
0140 struct ct_timer *timer;
0141
0142 #ifdef CONFIG_PM_SLEEP
0143 int (*suspend)(struct ct_atc *atc);
0144 int (*resume)(struct ct_atc *atc);
0145 #define NUM_PCMS (NUM_CTALSADEVS - 1)
0146 struct snd_pcm *pcms[NUM_PCMS];
0147 #endif
0148 };
0149
0150
0151 int ct_atc_create(struct snd_card *card, struct pci_dev *pci,
0152 unsigned int rsr, unsigned int msr, int chip_type,
0153 unsigned int subsysid, struct ct_atc **ratc);
0154 int ct_atc_create_alsa_devs(struct ct_atc *atc);
0155
0156 #endif