diff options
Diffstat (limited to 'include/sound/vx_core.h')
| -rw-r--r-- | include/sound/vx_core.h | 131 | 
1 files changed, 67 insertions, 64 deletions
| diff --git a/include/sound/vx_core.h b/include/sound/vx_core.h index 7a60a3888667..5fd6f3305e0d 100644 --- a/include/sound/vx_core.h +++ b/include/sound/vx_core.h | |||
| @@ -36,9 +36,6 @@ | |||
| 36 | struct firmware; | 36 | struct firmware; | 
| 37 | struct device; | 37 | struct device; | 
| 38 | 38 | ||
| 39 | typedef struct snd_vx_core vx_core_t; | ||
| 40 | typedef struct vx_pipe vx_pipe_t; | ||
| 41 | |||
| 42 | #define VX_DRIVER_VERSION 0x010000 /* 1.0.0 */ | 39 | #define VX_DRIVER_VERSION 0x010000 /* 1.0.0 */ | 
| 43 | 40 | ||
| 44 | /* | 41 | /* | 
| @@ -76,7 +73,7 @@ struct vx_pipe { | |||
| 76 | int channels; | 73 | int channels; | 
| 77 | unsigned int differed_type; | 74 | unsigned int differed_type; | 
| 78 | pcx_time_t pcx_time; | 75 | pcx_time_t pcx_time; | 
| 79 | snd_pcm_substream_t *substream; | 76 | struct snd_pcm_substream *substream; | 
| 80 | 77 | ||
| 81 | int hbuf_size; /* H-buffer size in bytes */ | 78 | int hbuf_size; /* H-buffer size in bytes */ | 
| 82 | int buffer_bytes; /* the ALSA pcm buffer size in bytes */ | 79 | int buffer_bytes; /* the ALSA pcm buffer size in bytes */ | 
| @@ -88,36 +85,38 @@ struct vx_pipe { | |||
| 88 | u64 cur_count; /* current sample position (for playback) */ | 85 | u64 cur_count; /* current sample position (for playback) */ | 
| 89 | 86 | ||
| 90 | unsigned int references; /* an output pipe may be used for monitoring and/or playback */ | 87 | unsigned int references; /* an output pipe may be used for monitoring and/or playback */ | 
| 91 | vx_pipe_t *monitoring_pipe; /* pointer to the monitoring pipe (capture pipe only)*/ | 88 | struct vx_pipe *monitoring_pipe; /* pointer to the monitoring pipe (capture pipe only)*/ | 
| 92 | 89 | ||
| 93 | struct tasklet_struct start_tq; | 90 | struct tasklet_struct start_tq; | 
| 94 | }; | 91 | }; | 
| 95 | 92 | ||
| 93 | struct vx_core; | ||
| 94 | |||
| 96 | struct snd_vx_ops { | 95 | struct snd_vx_ops { | 
| 97 | /* low-level i/o */ | 96 | /* low-level i/o */ | 
| 98 | unsigned char (*in8)(vx_core_t *chip, int reg); | 97 | unsigned char (*in8)(struct vx_core *chip, int reg); | 
| 99 | unsigned int (*in32)(vx_core_t *chip, int reg); | 98 | unsigned int (*in32)(struct vx_core *chip, int reg); | 
| 100 | void (*out8)(vx_core_t *chip, int reg, unsigned char val); | 99 | void (*out8)(struct vx_core *chip, int reg, unsigned char val); | 
| 101 | void (*out32)(vx_core_t *chip, int reg, unsigned int val); | 100 | void (*out32)(struct vx_core *chip, int reg, unsigned int val); | 
| 102 | /* irq */ | 101 | /* irq */ | 
| 103 | int (*test_and_ack)(vx_core_t *chip); | 102 | int (*test_and_ack)(struct vx_core *chip); | 
| 104 | void (*validate_irq)(vx_core_t *chip, int enable); | 103 | void (*validate_irq)(struct vx_core *chip, int enable); | 
| 105 | /* codec */ | 104 | /* codec */ | 
| 106 | void (*write_codec)(vx_core_t *chip, int codec, unsigned int data); | 105 | void (*write_codec)(struct vx_core *chip, int codec, unsigned int data); | 
| 107 | void (*akm_write)(vx_core_t *chip, int reg, unsigned int data); | 106 | void (*akm_write)(struct vx_core *chip, int reg, unsigned int data); | 
| 108 | void (*reset_codec)(vx_core_t *chip); | 107 | void (*reset_codec)(struct vx_core *chip); | 
| 109 | void (*change_audio_source)(vx_core_t *chip, int src); | 108 | void (*change_audio_source)(struct vx_core *chip, int src); | 
| 110 | void (*set_clock_source)(vx_core_t *chp, int src); | 109 | void (*set_clock_source)(struct vx_core *chp, int src); | 
| 111 | /* chip init */ | 110 | /* chip init */ | 
| 112 | int (*load_dsp)(vx_core_t *chip, int idx, const struct firmware *fw); | 111 | int (*load_dsp)(struct vx_core *chip, int idx, const struct firmware *fw); | 
| 113 | void (*reset_dsp)(vx_core_t *chip); | 112 | void (*reset_dsp)(struct vx_core *chip); | 
| 114 | void (*reset_board)(vx_core_t *chip, int cold_reset); | 113 | void (*reset_board)(struct vx_core *chip, int cold_reset); | 
| 115 | int (*add_controls)(vx_core_t *chip); | 114 | int (*add_controls)(struct vx_core *chip); | 
| 116 | /* pcm */ | 115 | /* pcm */ | 
| 117 | void (*dma_write)(vx_core_t *chip, snd_pcm_runtime_t *runtime, | 116 | void (*dma_write)(struct vx_core *chip, struct snd_pcm_runtime *runtime, | 
| 118 | vx_pipe_t *pipe, int count); | 117 | struct vx_pipe *pipe, int count); | 
| 119 | void (*dma_read)(vx_core_t *chip, snd_pcm_runtime_t *runtime, | 118 | void (*dma_read)(struct vx_core *chip, struct snd_pcm_runtime *runtime, | 
| 120 | vx_pipe_t *pipe, int count); | 119 | struct vx_pipe *pipe, int count); | 
| 121 | }; | 120 | }; | 
| 122 | 121 | ||
| 123 | struct snd_vx_hardware { | 122 | struct snd_vx_hardware { | 
| @@ -158,10 +157,10 @@ enum { | |||
| 158 | /* min/max values for analog output for old codecs */ | 157 | /* min/max values for analog output for old codecs */ | 
| 159 | #define VX_ANALOG_OUT_LEVEL_MAX 0xe3 | 158 | #define VX_ANALOG_OUT_LEVEL_MAX 0xe3 | 
| 160 | 159 | ||
| 161 | struct snd_vx_core { | 160 | struct vx_core { | 
| 162 | /* ALSA stuff */ | 161 | /* ALSA stuff */ | 
| 163 | snd_card_t *card; | 162 | struct snd_card *card; | 
| 164 | snd_pcm_t *pcm[VX_MAX_CODECS]; | 163 | struct snd_pcm *pcm[VX_MAX_CODECS]; | 
| 165 | int type; /* VX_TYPE_XXX */ | 164 | int type; /* VX_TYPE_XXX */ | 
| 166 | 165 | ||
| 167 | int irq; | 166 | int irq; | 
| @@ -179,7 +178,7 @@ struct snd_vx_core { | |||
| 179 | unsigned int pcm_running; | 178 | unsigned int pcm_running; | 
| 180 | 179 | ||
| 181 | struct device *dev; | 180 | struct device *dev; | 
| 182 | snd_hwdep_t *hwdep; | 181 | struct snd_hwdep *hwdep; | 
| 183 | 182 | ||
| 184 | struct vx_rmh irq_rmh; /* RMH used in interrupts */ | 183 | struct vx_rmh irq_rmh; /* RMH used in interrupts */ | 
| 185 | 184 | ||
| @@ -216,14 +215,14 @@ struct snd_vx_core { | |||
| 216 | /* | 215 | /* | 
| 217 | * constructor | 216 | * constructor | 
| 218 | */ | 217 | */ | 
| 219 | vx_core_t *snd_vx_create(snd_card_t *card, struct snd_vx_hardware *hw, | 218 | struct vx_core *snd_vx_create(struct snd_card *card, struct snd_vx_hardware *hw, | 
| 220 | struct snd_vx_ops *ops, int extra_size); | 219 | struct snd_vx_ops *ops, int extra_size); | 
| 221 | int snd_vx_setup_firmware(vx_core_t *chip); | 220 | int snd_vx_setup_firmware(struct vx_core *chip); | 
| 222 | int snd_vx_load_boot_image(vx_core_t *chip, const struct firmware *dsp); | 221 | int snd_vx_load_boot_image(struct vx_core *chip, const struct firmware *dsp); | 
| 223 | int snd_vx_dsp_boot(vx_core_t *chip, const struct firmware *dsp); | 222 | int snd_vx_dsp_boot(struct vx_core *chip, const struct firmware *dsp); | 
| 224 | int snd_vx_dsp_load(vx_core_t *chip, const struct firmware *dsp); | 223 | int snd_vx_dsp_load(struct vx_core *chip, const struct firmware *dsp); | 
| 225 | 224 | ||
| 226 | void snd_vx_free_firmware(vx_core_t *chip); | 225 | void snd_vx_free_firmware(struct vx_core *chip); | 
| 227 | 226 | ||
| 228 | /* | 227 | /* | 
| 229 | * interrupt handler; exported for pcmcia | 228 | * interrupt handler; exported for pcmcia | 
| @@ -233,37 +232,37 @@ irqreturn_t snd_vx_irq_handler(int irq, void *dev, struct pt_regs *regs); | |||
| 233 | /* | 232 | /* | 
| 234 | * lowlevel functions | 233 | * lowlevel functions | 
| 235 | */ | 234 | */ | 
| 236 | static inline int vx_test_and_ack(vx_core_t *chip) | 235 | static inline int vx_test_and_ack(struct vx_core *chip) | 
| 237 | { | 236 | { | 
| 238 | snd_assert(chip->ops->test_and_ack, return -ENXIO); | 237 | snd_assert(chip->ops->test_and_ack, return -ENXIO); | 
| 239 | return chip->ops->test_and_ack(chip); | 238 | return chip->ops->test_and_ack(chip); | 
| 240 | } | 239 | } | 
| 241 | 240 | ||
| 242 | static inline void vx_validate_irq(vx_core_t *chip, int enable) | 241 | static inline void vx_validate_irq(struct vx_core *chip, int enable) | 
| 243 | { | 242 | { | 
| 244 | snd_assert(chip->ops->validate_irq, return); | 243 | snd_assert(chip->ops->validate_irq, return); | 
| 245 | chip->ops->validate_irq(chip, enable); | 244 | chip->ops->validate_irq(chip, enable); | 
| 246 | } | 245 | } | 
| 247 | 246 | ||
| 248 | static inline unsigned char snd_vx_inb(vx_core_t *chip, int reg) | 247 | static inline unsigned char snd_vx_inb(struct vx_core *chip, int reg) | 
| 249 | { | 248 | { | 
| 250 | snd_assert(chip->ops->in8, return 0); | 249 | snd_assert(chip->ops->in8, return 0); | 
| 251 | return chip->ops->in8(chip, reg); | 250 | return chip->ops->in8(chip, reg); | 
| 252 | } | 251 | } | 
| 253 | 252 | ||
| 254 | static inline unsigned int snd_vx_inl(vx_core_t *chip, int reg) | 253 | static inline unsigned int snd_vx_inl(struct vx_core *chip, int reg) | 
| 255 | { | 254 | { | 
| 256 | snd_assert(chip->ops->in32, return 0); | 255 | snd_assert(chip->ops->in32, return 0); | 
| 257 | return chip->ops->in32(chip, reg); | 256 | return chip->ops->in32(chip, reg); | 
| 258 | } | 257 | } | 
| 259 | 258 | ||
| 260 | static inline void snd_vx_outb(vx_core_t *chip, int reg, unsigned char val) | 259 | static inline void snd_vx_outb(struct vx_core *chip, int reg, unsigned char val) | 
| 261 | { | 260 | { | 
| 262 | snd_assert(chip->ops->out8, return); | 261 | snd_assert(chip->ops->out8, return); | 
| 263 | chip->ops->out8(chip, reg, val); | 262 | chip->ops->out8(chip, reg, val); | 
| 264 | } | 263 | } | 
| 265 | 264 | ||
| 266 | static inline void snd_vx_outl(vx_core_t *chip, int reg, unsigned int val) | 265 | static inline void snd_vx_outl(struct vx_core *chip, int reg, unsigned int val) | 
| 267 | { | 266 | { | 
| 268 | snd_assert(chip->ops->out32, return); | 267 | snd_assert(chip->ops->out32, return); | 
| 269 | chip->ops->out32(chip, reg, val); | 268 | chip->ops->out32(chip, reg, val); | 
| @@ -274,27 +273,25 @@ static inline void snd_vx_outl(vx_core_t *chip, int reg, unsigned int val) | |||
| 274 | #define vx_inl(chip,reg) snd_vx_inl(chip, VX_##reg) | 273 | #define vx_inl(chip,reg) snd_vx_inl(chip, VX_##reg) | 
| 275 | #define vx_outl(chip,reg,val) snd_vx_outl(chip, VX_##reg,val) | 274 | #define vx_outl(chip,reg,val) snd_vx_outl(chip, VX_##reg,val) | 
| 276 | 275 | ||
| 277 | void snd_vx_delay(vx_core_t *chip, int msec); | 276 | static inline void vx_reset_dsp(struct vx_core *chip) | 
| 278 | |||
| 279 | static inline void vx_reset_dsp(vx_core_t *chip) | ||
| 280 | { | 277 | { | 
| 281 | snd_assert(chip->ops->reset_dsp, return); | 278 | snd_assert(chip->ops->reset_dsp, return); | 
| 282 | chip->ops->reset_dsp(chip); | 279 | chip->ops->reset_dsp(chip); | 
| 283 | } | 280 | } | 
| 284 | 281 | ||
| 285 | int vx_send_msg(vx_core_t *chip, struct vx_rmh *rmh); | 282 | int vx_send_msg(struct vx_core *chip, struct vx_rmh *rmh); | 
| 286 | int vx_send_msg_nolock(vx_core_t *chip, struct vx_rmh *rmh); | 283 | int vx_send_msg_nolock(struct vx_core *chip, struct vx_rmh *rmh); | 
| 287 | int vx_send_rih(vx_core_t *chip, int cmd); | 284 | int vx_send_rih(struct vx_core *chip, int cmd); | 
| 288 | int vx_send_rih_nolock(vx_core_t *chip, int cmd); | 285 | int vx_send_rih_nolock(struct vx_core *chip, int cmd); | 
| 289 | 286 | ||
| 290 | void vx_reset_codec(vx_core_t *chip, int cold_reset); | 287 | void vx_reset_codec(struct vx_core *chip, int cold_reset); | 
| 291 | 288 | ||
| 292 | /* | 289 | /* | 
| 293 | * check the bit on the specified register | 290 | * check the bit on the specified register | 
| 294 | * returns zero if a bit matches, or a negative error code. | 291 | * returns zero if a bit matches, or a negative error code. | 
| 295 | * exported for vxpocket driver | 292 | * exported for vxpocket driver | 
| 296 | */ | 293 | */ | 
| 297 | int snd_vx_check_reg_bit(vx_core_t *chip, int reg, int mask, int bit, int time); | 294 | int snd_vx_check_reg_bit(struct vx_core *chip, int reg, int mask, int bit, int time); | 
| 298 | #define vx_check_isr(chip,mask,bit,time) snd_vx_check_reg_bit(chip, VX_ISR, mask, bit, time) | 295 | #define vx_check_isr(chip,mask,bit,time) snd_vx_check_reg_bit(chip, VX_ISR, mask, bit, time) | 
| 299 | #define vx_wait_isr_bit(chip,bit) vx_check_isr(chip, bit, bit, 200) | 296 | #define vx_wait_isr_bit(chip,bit) vx_check_isr(chip, bit, bit, 200) | 
| 300 | #define vx_wait_for_rx_full(chip) vx_wait_isr_bit(chip, ISR_RX_FULL) | 297 | #define vx_wait_for_rx_full(chip) vx_wait_isr_bit(chip, ISR_RX_FULL) | 
| @@ -303,15 +300,15 @@ int snd_vx_check_reg_bit(vx_core_t *chip, int reg, int mask, int bit, int time); | |||
| 303 | /* | 300 | /* | 
| 304 | * pseudo-DMA transfer | 301 | * pseudo-DMA transfer | 
| 305 | */ | 302 | */ | 
| 306 | static inline void vx_pseudo_dma_write(vx_core_t *chip, snd_pcm_runtime_t *runtime, | 303 | static inline void vx_pseudo_dma_write(struct vx_core *chip, struct snd_pcm_runtime *runtime, | 
| 307 | vx_pipe_t *pipe, int count) | 304 | struct vx_pipe *pipe, int count) | 
| 308 | { | 305 | { | 
| 309 | snd_assert(chip->ops->dma_write, return); | 306 | snd_assert(chip->ops->dma_write, return); | 
| 310 | chip->ops->dma_write(chip, runtime, pipe, count); | 307 | chip->ops->dma_write(chip, runtime, pipe, count); | 
| 311 | } | 308 | } | 
| 312 | 309 | ||
| 313 | static inline void vx_pseudo_dma_read(vx_core_t *chip, snd_pcm_runtime_t *runtime, | 310 | static inline void vx_pseudo_dma_read(struct vx_core *chip, struct snd_pcm_runtime *runtime, | 
| 314 | vx_pipe_t *pipe, int count) | 311 | struct vx_pipe *pipe, int count) | 
| 315 | { | 312 | { | 
| 316 | snd_assert(chip->ops->dma_read, return); | 313 | snd_assert(chip->ops->dma_read, return); | 
| 317 | chip->ops->dma_read(chip, runtime, pipe, count); | 314 | chip->ops->dma_read(chip, runtime, pipe, count); | 
| @@ -329,27 +326,33 @@ static inline void vx_pseudo_dma_read(vx_core_t *chip, snd_pcm_runtime_t *runtim | |||
| 329 | /* | 326 | /* | 
| 330 | * pcm stuff | 327 | * pcm stuff | 
| 331 | */ | 328 | */ | 
| 332 | int snd_vx_pcm_new(vx_core_t *chip); | 329 | int snd_vx_pcm_new(struct vx_core *chip); | 
| 333 | void vx_pcm_update_intr(vx_core_t *chip, unsigned int events); | 330 | void vx_pcm_update_intr(struct vx_core *chip, unsigned int events); | 
| 334 | 331 | ||
| 335 | /* | 332 | /* | 
| 336 | * mixer stuff | 333 | * mixer stuff | 
| 337 | */ | 334 | */ | 
| 338 | int snd_vx_mixer_new(vx_core_t *chip); | 335 | int snd_vx_mixer_new(struct vx_core *chip); | 
| 339 | void vx_toggle_dac_mute(vx_core_t *chip, int mute); | 336 | void vx_toggle_dac_mute(struct vx_core *chip, int mute); | 
| 340 | int vx_sync_audio_source(vx_core_t *chip); | 337 | int vx_sync_audio_source(struct vx_core *chip); | 
| 341 | int vx_set_monitor_level(vx_core_t *chip, int audio, int level, int active); | 338 | int vx_set_monitor_level(struct vx_core *chip, int audio, int level, int active); | 
| 342 | 339 | ||
| 343 | /* | 340 | /* | 
| 344 | * IEC958 & clock stuff | 341 | * IEC958 & clock stuff | 
| 345 | */ | 342 | */ | 
| 346 | void vx_set_iec958_status(vx_core_t *chip, unsigned int bits); | 343 | void vx_set_iec958_status(struct vx_core *chip, unsigned int bits); | 
| 347 | int vx_set_clock(vx_core_t *chip, unsigned int freq); | 344 | int vx_set_clock(struct vx_core *chip, unsigned int freq); | 
| 348 | void vx_set_internal_clock(vx_core_t *chip, unsigned int freq); | 345 | void vx_set_internal_clock(struct vx_core *chip, unsigned int freq); | 
| 349 | int vx_change_frequency(vx_core_t *chip); | 346 | int vx_change_frequency(struct vx_core *chip); | 
| 350 | 347 | ||
| 351 | 348 | ||
| 352 | /* | 349 | /* | 
| 350 | * PM | ||
| 351 | */ | ||
| 352 | int snd_vx_suspend(struct vx_core *card, pm_message_t state); | ||
| 353 | int snd_vx_resume(struct vx_core *card); | ||
| 354 | |||
| 355 | /* | ||
| 353 | * hardware constants | 356 | * hardware constants | 
| 354 | */ | 357 | */ | 
| 355 | 358 | ||
