Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 #ifndef __SOUND_AD1816A_H
0003 #define __SOUND_AD1816A_H
0004 
0005 /*
0006     ad1816a.h - definitions for ADI SoundPort AD1816A chip.
0007     Copyright (C) 1999-2000 by Massimo Piccioni <dafastidio@libero.it>
0008 
0009 */
0010 
0011 #include <sound/control.h>
0012 #include <sound/pcm.h>
0013 #include <sound/timer.h>
0014 
0015 #define AD1816A_REG(r)          (chip->port + r)
0016 
0017 #define AD1816A_CHIP_STATUS     0x00
0018 #define AD1816A_INDIR_ADDR      0x00
0019 #define AD1816A_INTERRUPT_STATUS    0x01
0020 #define AD1816A_INDIR_DATA_LOW      0x02
0021 #define AD1816A_INDIR_DATA_HIGH     0x03
0022 #define AD1816A_PIO_DEBUG       0x04
0023 #define AD1816A_PIO_STATUS      0x05
0024 #define AD1816A_PIO_DATA        0x06
0025 #define AD1816A_RESERVED_7      0x07
0026 #define AD1816A_PLAYBACK_CONFIG     0x08
0027 #define AD1816A_CAPTURE_CONFIG      0x09
0028 #define AD1816A_RESERVED_10     0x0a
0029 #define AD1816A_RESERVED_11     0x0b
0030 #define AD1816A_JOYSTICK_RAW_DATA   0x0c
0031 #define AD1816A_JOYSTICK_CTRL       0x0d
0032 #define AD1816A_JOY_POS_DATA_LOW    0x0e
0033 #define AD1816A_JOY_POS_DATA_HIGH   0x0f
0034 
0035 #define AD1816A_LOW_BYTE_TMP        0x00
0036 #define AD1816A_INTERRUPT_ENABLE    0x01
0037 #define AD1816A_EXTERNAL_CTRL       0x01
0038 #define AD1816A_PLAYBACK_SAMPLE_RATE    0x02
0039 #define AD1816A_CAPTURE_SAMPLE_RATE 0x03
0040 #define AD1816A_VOICE_ATT       0x04
0041 #define AD1816A_FM_ATT          0x05
0042 #define AD1816A_I2S_1_ATT       0x06
0043 #define AD1816A_I2S_0_ATT       0x07
0044 #define AD1816A_PLAYBACK_BASE_COUNT 0x08
0045 #define AD1816A_PLAYBACK_CURR_COUNT 0x09
0046 #define AD1816A_CAPTURE_BASE_COUNT  0x0a
0047 #define AD1816A_CAPTURE_CURR_COUNT  0x0b
0048 #define AD1816A_TIMER_BASE_COUNT    0x0c
0049 #define AD1816A_TIMER_CURR_COUNT    0x0d
0050 #define AD1816A_MASTER_ATT      0x0e
0051 #define AD1816A_CD_GAIN_ATT     0x0f
0052 #define AD1816A_SYNTH_GAIN_ATT      0x10
0053 #define AD1816A_VID_GAIN_ATT        0x11
0054 #define AD1816A_LINE_GAIN_ATT       0x12
0055 #define AD1816A_MIC_GAIN_ATT        0x13
0056 #define AD1816A_PHONE_IN_GAIN_ATT   0x13
0057 #define AD1816A_ADC_SOURCE_SEL      0x14
0058 #define AD1816A_ADC_PGA         0x14
0059 #define AD1816A_CHIP_CONFIG     0x20
0060 #define AD1816A_DSP_CONFIG      0x21
0061 #define AD1816A_FM_SAMPLE_RATE      0x22
0062 #define AD1816A_I2S_1_SAMPLE_RATE   0x23
0063 #define AD1816A_I2S_0_SAMPLE_RATE   0x24
0064 #define AD1816A_RESERVED_37     0x25
0065 #define AD1816A_PROGRAM_CLOCK_RATE  0x26
0066 #define AD1816A_3D_PHAT_CTRL        0x27
0067 #define AD1816A_PHONE_OUT_ATT       0x27
0068 #define AD1816A_RESERVED_40     0x28
0069 #define AD1816A_HW_VOL_BUT      0x29
0070 #define AD1816A_DSP_MAILBOX_0       0x2a
0071 #define AD1816A_DSP_MAILBOX_1       0x2b
0072 #define AD1816A_POWERDOWN_CTRL      0x2c
0073 #define AD1816A_TIMER_CTRL      0x2c
0074 #define AD1816A_VERSION_ID      0x2d
0075 #define AD1816A_RESERVED_46     0x2e
0076 
0077 #define AD1816A_READY           0x80
0078 
0079 #define AD1816A_PLAYBACK_IRQ_PENDING    0x80
0080 #define AD1816A_CAPTURE_IRQ_PENDING 0x40
0081 #define AD1816A_TIMER_IRQ_PENDING   0x20
0082 
0083 #define AD1816A_PLAYBACK_ENABLE     0x01
0084 #define AD1816A_PLAYBACK_PIO        0x02
0085 #define AD1816A_CAPTURE_ENABLE      0x01
0086 #define AD1816A_CAPTURE_PIO     0x02
0087 
0088 #define AD1816A_FMT_LINEAR_8        0x00
0089 #define AD1816A_FMT_ULAW_8      0x08
0090 #define AD1816A_FMT_LINEAR_16_LIT   0x10
0091 #define AD1816A_FMT_ALAW_8      0x18
0092 #define AD1816A_FMT_LINEAR_16_BIG   0x30
0093 #define AD1816A_FMT_ALL         0x38
0094 #define AD1816A_FMT_STEREO      0x04
0095 
0096 #define AD1816A_PLAYBACK_IRQ_ENABLE 0x8000
0097 #define AD1816A_CAPTURE_IRQ_ENABLE  0x4000
0098 #define AD1816A_TIMER_IRQ_ENABLE    0x2000
0099 #define AD1816A_TIMER_ENABLE        0x0080
0100 
0101 #define AD1816A_SRC_LINE        0x00
0102 #define AD1816A_SRC_OUT         0x10
0103 #define AD1816A_SRC_CD          0x20
0104 #define AD1816A_SRC_SYNTH       0x30
0105 #define AD1816A_SRC_VIDEO       0x40
0106 #define AD1816A_SRC_MIC         0x50
0107 #define AD1816A_SRC_MONO        0x50
0108 #define AD1816A_SRC_PHONE_IN        0x60
0109 #define AD1816A_SRC_MASK        0x70
0110 
0111 #define AD1816A_CAPTURE_NOT_EQUAL   0x1000
0112 #define AD1816A_WSS_ENABLE      0x8000
0113 
0114 struct snd_ad1816a {
0115     unsigned long port;
0116     struct resource *res_port;
0117     int irq;
0118     int dma1;
0119     int dma2;
0120 
0121     unsigned short hardware;
0122     unsigned short version;
0123 
0124     spinlock_t lock;
0125 
0126     unsigned short mode;
0127     unsigned int clock_freq;
0128 
0129     struct snd_card *card;
0130     struct snd_pcm *pcm;
0131 
0132     struct snd_pcm_substream *playback_substream;
0133     struct snd_pcm_substream *capture_substream;
0134     unsigned int p_dma_size;
0135     unsigned int c_dma_size;
0136 
0137     struct snd_timer *timer;
0138 #ifdef CONFIG_PM
0139     unsigned short image[48];
0140 #endif
0141 };
0142 
0143 
0144 #define AD1816A_HW_AUTO     0
0145 #define AD1816A_HW_AD1816A  1
0146 #define AD1816A_HW_AD1815   2
0147 #define AD1816A_HW_AD18MAX10    3
0148 
0149 #define AD1816A_MODE_PLAYBACK   0x01
0150 #define AD1816A_MODE_CAPTURE    0x02
0151 #define AD1816A_MODE_TIMER  0x04
0152 #define AD1816A_MODE_OPEN   (AD1816A_MODE_PLAYBACK |    \
0153                 AD1816A_MODE_CAPTURE |      \
0154                 AD1816A_MODE_TIMER)
0155 
0156 
0157 extern int snd_ad1816a_create(struct snd_card *card, unsigned long port,
0158                   int irq, int dma1, int dma2,
0159                   struct snd_ad1816a *chip);
0160 
0161 extern int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device);
0162 extern int snd_ad1816a_mixer(struct snd_ad1816a *chip);
0163 extern int snd_ad1816a_timer(struct snd_ad1816a *chip, int device);
0164 #ifdef CONFIG_PM
0165 extern void snd_ad1816a_suspend(struct snd_ad1816a *chip);
0166 extern void snd_ad1816a_resume(struct snd_ad1816a *chip);
0167 #endif
0168 
0169 #endif  /* __SOUND_AD1816A_H */