diff options
Diffstat (limited to 'sound/pci/oxygen/oxygen.h')
-rw-r--r-- | sound/pci/oxygen/oxygen.h | 103 |
1 files changed, 58 insertions, 45 deletions
diff --git a/sound/pci/oxygen/oxygen.h b/sound/pci/oxygen/oxygen.h index 74a644880074..19107c6307e5 100644 --- a/sound/pci/oxygen/oxygen.h +++ b/sound/pci/oxygen/oxygen.h | |||
@@ -19,14 +19,19 @@ | |||
19 | #define OXYGEN_IO_SIZE 0x100 | 19 | #define OXYGEN_IO_SIZE 0x100 |
20 | 20 | ||
21 | /* model-specific configuration of outputs/inputs */ | 21 | /* model-specific configuration of outputs/inputs */ |
22 | #define PLAYBACK_0_TO_I2S 0x001 | 22 | #define PLAYBACK_0_TO_I2S 0x0001 |
23 | #define PLAYBACK_1_TO_SPDIF 0x004 | 23 | /* PLAYBACK_0_TO_AC97_0 not implemented */ |
24 | #define PLAYBACK_2_TO_AC97_1 0x008 | 24 | #define PLAYBACK_1_TO_SPDIF 0x0004 |
25 | #define CAPTURE_0_FROM_I2S_1 0x010 | 25 | #define PLAYBACK_2_TO_AC97_1 0x0008 |
26 | #define CAPTURE_0_FROM_I2S_2 0x020 | 26 | #define CAPTURE_0_FROM_I2S_1 0x0010 |
27 | #define CAPTURE_1_FROM_SPDIF 0x080 | 27 | #define CAPTURE_0_FROM_I2S_2 0x0020 |
28 | #define CAPTURE_2_FROM_I2S_2 0x100 | 28 | /* CAPTURE_0_FROM_AC97_0 not implemented */ |
29 | #define CAPTURE_2_FROM_AC97_1 0x200 | 29 | #define CAPTURE_1_FROM_SPDIF 0x0080 |
30 | #define CAPTURE_2_FROM_I2S_2 0x0100 | ||
31 | #define CAPTURE_2_FROM_AC97_1 0x0200 | ||
32 | /* CAPTURE_3_FROM_I2S_3 not implemented */ | ||
33 | #define MIDI_OUTPUT 0x0800 | ||
34 | #define MIDI_INPUT 0x1000 | ||
30 | 35 | ||
31 | enum { | 36 | enum { |
32 | CONTROL_SPDIF_PCM, | 37 | CONTROL_SPDIF_PCM, |
@@ -51,7 +56,43 @@ struct snd_pcm_hardware; | |||
51 | struct snd_pcm_hw_params; | 56 | struct snd_pcm_hw_params; |
52 | struct snd_kcontrol_new; | 57 | struct snd_kcontrol_new; |
53 | struct snd_rawmidi; | 58 | struct snd_rawmidi; |
54 | struct oxygen_model; | 59 | struct oxygen; |
60 | |||
61 | struct oxygen_model { | ||
62 | const char *shortname; | ||
63 | const char *longname; | ||
64 | const char *chip; | ||
65 | struct module *owner; | ||
66 | int (*probe)(struct oxygen *chip, unsigned long driver_data); | ||
67 | void (*init)(struct oxygen *chip); | ||
68 | int (*control_filter)(struct snd_kcontrol_new *template); | ||
69 | int (*mixer_init)(struct oxygen *chip); | ||
70 | void (*cleanup)(struct oxygen *chip); | ||
71 | void (*suspend)(struct oxygen *chip); | ||
72 | void (*resume)(struct oxygen *chip); | ||
73 | void (*pcm_hardware_filter)(unsigned int channel, | ||
74 | struct snd_pcm_hardware *hardware); | ||
75 | void (*set_dac_params)(struct oxygen *chip, | ||
76 | struct snd_pcm_hw_params *params); | ||
77 | void (*set_adc_params)(struct oxygen *chip, | ||
78 | struct snd_pcm_hw_params *params); | ||
79 | void (*update_dac_volume)(struct oxygen *chip); | ||
80 | void (*update_dac_mute)(struct oxygen *chip); | ||
81 | void (*gpio_changed)(struct oxygen *chip); | ||
82 | void (*uart_input)(struct oxygen *chip); | ||
83 | void (*ac97_switch)(struct oxygen *chip, | ||
84 | unsigned int reg, unsigned int mute); | ||
85 | const unsigned int *dac_tlv; | ||
86 | size_t model_data_size; | ||
87 | unsigned int device_config; | ||
88 | u8 dac_channels; | ||
89 | u8 dac_volume_min; | ||
90 | u8 dac_volume_max; | ||
91 | u8 misc_flags; | ||
92 | u8 function_flags; | ||
93 | u16 dac_i2s_format; | ||
94 | u16 adc_i2s_format; | ||
95 | }; | ||
55 | 96 | ||
56 | struct oxygen { | 97 | struct oxygen { |
57 | unsigned long addr; | 98 | unsigned long addr; |
@@ -61,7 +102,6 @@ struct oxygen { | |||
61 | struct pci_dev *pci; | 102 | struct pci_dev *pci; |
62 | struct snd_rawmidi *midi; | 103 | struct snd_rawmidi *midi; |
63 | int irq; | 104 | int irq; |
64 | const struct oxygen_model *model; | ||
65 | void *model_data; | 105 | void *model_data; |
66 | unsigned int interrupt_mask; | 106 | unsigned int interrupt_mask; |
67 | u8 dac_volume[8]; | 107 | u8 dac_volume[8]; |
@@ -86,46 +126,16 @@ struct oxygen { | |||
86 | __le32 _32[OXYGEN_IO_SIZE / 4]; | 126 | __le32 _32[OXYGEN_IO_SIZE / 4]; |
87 | } saved_registers; | 127 | } saved_registers; |
88 | u16 saved_ac97_registers[2][0x40]; | 128 | u16 saved_ac97_registers[2][0x40]; |
89 | }; | 129 | unsigned int uart_input_count; |
90 | 130 | u8 uart_input[32]; | |
91 | struct oxygen_model { | 131 | struct oxygen_model model; |
92 | const char *shortname; | ||
93 | const char *longname; | ||
94 | const char *chip; | ||
95 | struct module *owner; | ||
96 | void (*init)(struct oxygen *chip); | ||
97 | int (*control_filter)(struct snd_kcontrol_new *template); | ||
98 | int (*mixer_init)(struct oxygen *chip); | ||
99 | void (*cleanup)(struct oxygen *chip); | ||
100 | void (*suspend)(struct oxygen *chip); | ||
101 | void (*resume)(struct oxygen *chip); | ||
102 | void (*pcm_hardware_filter)(unsigned int channel, | ||
103 | struct snd_pcm_hardware *hardware); | ||
104 | void (*set_dac_params)(struct oxygen *chip, | ||
105 | struct snd_pcm_hw_params *params); | ||
106 | void (*set_adc_params)(struct oxygen *chip, | ||
107 | struct snd_pcm_hw_params *params); | ||
108 | void (*update_dac_volume)(struct oxygen *chip); | ||
109 | void (*update_dac_mute)(struct oxygen *chip); | ||
110 | void (*gpio_changed)(struct oxygen *chip); | ||
111 | void (*ac97_switch)(struct oxygen *chip, | ||
112 | unsigned int reg, unsigned int mute); | ||
113 | const unsigned int *dac_tlv; | ||
114 | size_t model_data_size; | ||
115 | unsigned int pcm_dev_cfg; | ||
116 | u8 dac_channels; | ||
117 | u8 dac_volume_min; | ||
118 | u8 dac_volume_max; | ||
119 | u8 misc_flags; | ||
120 | u8 function_flags; | ||
121 | u16 dac_i2s_format; | ||
122 | u16 adc_i2s_format; | ||
123 | }; | 132 | }; |
124 | 133 | ||
125 | /* oxygen_lib.c */ | 134 | /* oxygen_lib.c */ |
126 | 135 | ||
127 | int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, | 136 | int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, |
128 | const struct oxygen_model *model); | 137 | const struct oxygen_model *model, |
138 | unsigned long driver_data); | ||
129 | void oxygen_pci_remove(struct pci_dev *pci); | 139 | void oxygen_pci_remove(struct pci_dev *pci); |
130 | #ifdef CONFIG_PM | 140 | #ifdef CONFIG_PM |
131 | int oxygen_pci_suspend(struct pci_dev *pci, pm_message_t state); | 141 | int oxygen_pci_suspend(struct pci_dev *pci, pm_message_t state); |
@@ -167,6 +177,9 @@ void oxygen_write_ac97_masked(struct oxygen *chip, unsigned int codec, | |||
167 | void oxygen_write_spi(struct oxygen *chip, u8 control, unsigned int data); | 177 | void oxygen_write_spi(struct oxygen *chip, u8 control, unsigned int data); |
168 | void oxygen_write_i2c(struct oxygen *chip, u8 device, u8 map, u8 data); | 178 | void oxygen_write_i2c(struct oxygen *chip, u8 device, u8 map, u8 data); |
169 | 179 | ||
180 | void oxygen_reset_uart(struct oxygen *chip); | ||
181 | void oxygen_write_uart(struct oxygen *chip, u8 data); | ||
182 | |||
170 | static inline void oxygen_set_bits8(struct oxygen *chip, | 183 | static inline void oxygen_set_bits8(struct oxygen *chip, |
171 | unsigned int reg, u8 value) | 184 | unsigned int reg, u8 value) |
172 | { | 185 | { |