Ignore:
Timestamp:
Apr 9, 2006, 12:09:39 PM (19 years ago)
Author:
vladest
Message:

Latest ALSA patches
HDA patches
Patch for Intel from Rudy's
Fixes locks on NM256 chipsets
Fixes PM on Maestro3 chipsets

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk/alsa-kernel/pci/ca0106/ca0106.h

    r32 r76  
    66 *  FEATURES currently supported:
    77 *    See ca0106_main.c for features.
    8  *
     8 * 
    99 *  Changelog:
    1010 *    Support interrupts per period.
     
    154154                                                 * bit 9 0 = Mute / 1 = Analog out.
    155155                                                 * bit 10 0 = Line-in / 1 = Mic-in.
    156                                                 * bit 11 0 = ? / 1 = ?
    157                                                 * bit 12 0 = 48 Khz / 1 = 96 Khz Analog out on SB Live 24bit.
     156                                                * bit 11 0 = ? / 1 = ?
     157                                                * bit 12 0 = 48 Khz / 1 = 96 Khz Analog out on SB Live 24bit.
    158158                                                 * bit 13 0 = ? / 1 = ?
    159159                                                 * bit 14 0 = Mute / 1 = Analog out
     
    173173/* CA0106 pointer-offset register set, accessed through the PTR and DATA registers                     */
    174174/********************************************************************************************************/
    175 
     175                                                                                                                           
    176176/* Initally all registers from 0x00 to 0x3f have zero contents. */
    177177#define PLAYBACK_LIST_ADDR      0x00            /* Base DMA address of a list of pointers to each period/size */
    178                                                 /* One list entry: 4 bytes for DMA address,
     178                                                /* One list entry: 4 bytes for DMA address, 
    179179                                                 * 4 bytes for period_size << 16.
    180180                                                 * One list entry is 8 bytes long.
     
    218218                                                 * Playback mixer out enable [31:28] (one bit per channel)
    219219                                                 */
    220 /* The Digital out jack is shared with the Center/LFE Analogue output.
     220/* The Digital out jack is shared with the Center/LFE Analogue output. 
    221221 * The jack has 4 poles. I will call 1 - Tip, 2 - Next to 1, 3 - Next to 2, 4 - Next to 3
    222222 * For Analogue: 1 -> Center Speaker, 2 -> Sub Woofer, 3 -> Ground, 4 -> Ground
     
    231231 */
    232232/* A standard 2 pole mono mini-jack to RCA plug can be used for SPDIF Stereo PCM output from the Front channel.
    233  * A standard 3 pole stereo mini-jack to 2 RCA plugs can be used for SPDIF AC3/DTS and Stereo PCM output utilising the Rear channel and just one of the RCA plugs.
     233 * A standard 3 pole stereo mini-jack to 2 RCA plugs can be used for SPDIF AC3/DTS and Stereo PCM output utilising the Rear channel and just one of the RCA plugs. 
    234234 */
    235235#define SPCS0                   0x41            /* SPDIF output Channel Status 0 register. For Rear. default=0x02108004, non-audio=0x02108006   */
     
    331331#define CAPTURE_SOURCE_CHANNEL3 0x000f0000      /* 3 - Mic in, Line in, TAD in, Aux in. */
    332332#define CAPTURE_SOURCE_RECORD_MAP 0x0000ffff    /* Default 0x00e4 */
    333                                                 /* Record Map [7:0] (2 bits per channel) 0=mapped to channel 0, 1=mapped to channel 1, 2=mapped to channel2, 3=mapped to channel3
     333                                                /* Record Map [7:0] (2 bits per channel) 0=mapped to channel 0, 1=mapped to channel 1, 2=mapped to channel2, 3=mapped to channel3 
    334334                                                 * Record source select for channel 0 [18:16]
    335335                                                 * Record source select for channel 1 [22:20]
     
    400400                                                /* Similar to register 0x66, except that the destination is the I2S mixer instead of the SPDIF mixer. I.E. Outputs to the Analog outputs instead of SPDIF. */
    401401#define UNKNOWN6b               0x6b            /* Unknown. Readonly. Default 00400000 00400000 00400000 00400000 */
    402 #define UART_A_DATA             0x6c            /* Uart, used in setting sample rates, bits per sample etc. */
    403 #define UART_A_CMD              0x6d            /* Uart, used in setting sample rates, bits per sample etc. */
    404 #define UART_B_DATA             0x6e            /* Uart, Unknown. */
    405 #define UART_B_CMD              0x6f            /* Uart, Unknown. */
     402#define MIDI_UART_A_DATA                0x6c            /* Midi Uart A Data */
     403#define MIDI_UART_A_CMD         0x6d            /* Midi Uart A Command/Status */
     404#define MIDI_UART_B_DATA                0x6e            /* Midi Uart B Data (currently unused) */
     405#define MIDI_UART_B_CMD         0x6f            /* Midi Uart B Command/Status (currently unused) */
     406
     407/* unique channel identifier for midi->channel */
     408
     409#define CA0106_MIDI_CHAN_A              0x1
     410#define CA0106_MIDI_CHAN_B              0x2
     411
     412/* from mpu401 */
     413
     414#define CA0106_MIDI_INPUT_AVAIL         0x80
     415#define CA0106_MIDI_OUTPUT_READY        0x40
     416#define CA0106_MPU401_RESET             0xff
     417#define CA0106_MPU401_ENTER_UART        0x3f
     418#define CA0106_MPU401_ACK               0xfe
     419
    406420#define SAMPLE_RATE_TRACKER_STATUS 0x70         /* Readonly. Default 00108000 00108000 00500000 00500000 */
    407421                                                /* Estimated sample rate [19:0] Relative to 48kHz. 0x8000 =  1.0
     
    418432                                                 * SRC input source select [4] 0=Audio from digital mixer, 1=Audio from analog source.
    419433                                                 * Record rate [9:8] (0=48kHz, 1=Not available, 2=96kHz, 3=192Khz)
    420                                                  * Record mixer output enable [12:10]
     434                                                 * Record mixer output enable [12:10] 
    421435                                                 * I2S input rate master mode [15:14] (0=48kHz, 1=44.1kHz, 2=96kHz, 3=192Khz)
    422436                                                 * I2S output rate [17:16] (0=48kHz, 1=44.1kHz, 2=96kHz, 3=192Khz)
     
    431445                                                 * Record Source 0 input [29:28] (0=SPDIF in, 1=I2S in, 2=AC97 Mic, 3=AC97 PCM)
    432446                                                 * Record Source 1 input [31:30] (0=SPDIF in, 1=I2S in, 2=AC97 Mic, 3=AC97 PCM)
    433                                                  */
     447                                                 */ 
    434448                                                /* Sample rate output control register Channel=1
    435449                                                 * I2S Input 0 volume Right [7:0]
     
    453467                                                 * I2S output enable [19:16]
    454468                                                 * SPDIF output enable [27:24]
    455                                                  */
     469                                                 */ 
    456470#define UNKNOWN73               0x73            /* Unknown. Readonly. Default 0x0 */
    457471#define CHIP_VERSION            0x74            /* P17 Chip version. Channel_id 0 only. Default 00000071 */
     
    478492#define SPI                     0x7a            /* SPI: Serial Interface Register */
    479493#define I2C_A                   0x7b            /* I2C Address. 32 bit */
    480 #define I2C_D0                  0x7c            /* I2C Data Port 0. 32 bit */
    481 #define I2C_D1                  0x7d            /* I2C Data Port 1. 32 bit */
     494#define I2C_D0                  0x7c            /* I2C Data Port 0. 32 bit */
     495#define I2C_D1                  0x7d            /* I2C Data Port 1. 32 bit */
    482496//I2C values
    483 #define I2C_A_ADC_ADD_MASK      0x000000fe      //The address is a 7 bit address
    484 #define I2C_A_ADC_RW_MASK       0x00000001      //bit mask for R/W
    485 #define I2C_A_ADC_TRANS_MASK    0x00000010      //Bit mask for I2c address DAC value
    486 #define I2C_A_ADC_ABORT_MASK    0x00000020      //Bit mask for I2C transaction abort flag
    487 #define I2C_A_ADC_LAST_MASK     0x00000040      //Bit mask for Last word transaction
    488 #define I2C_A_ADC_BYTE_MASK     0x00000080      //Bit mask for Byte Mode
    489 
    490 #define I2C_A_ADC_ADD           0x00000034      //This is the Device address for ADC
    491 #define I2C_A_ADC_READ          0x00000001      //To perform a read operation
    492 #define I2C_A_ADC_START         0x00000100      //Start I2C transaction
    493 #define I2C_A_ADC_ABORT         0x00000200      //I2C transaction abort
    494 #define I2C_A_ADC_LAST          0x00000400      //I2C last transaction
    495 #define I2C_A_ADC_BYTE          0x00000800      //I2C one byte mode
    496 
    497 #define I2C_D_ADC_REG_MASK      0xfe000000      //ADC address register
    498 #define I2C_D_ADC_DAT_MASK      0x01ff0000      //ADC data register
    499 
    500 #define ADC_TIMEOUT             0x00000007      //ADC Timeout Clock Disable
    501 #define ADC_IFC_CTRL            0x0000000b      //ADC Interface Control
    502 #define ADC_MASTER              0x0000000c      //ADC Master Mode Control
    503 #define ADC_POWER               0x0000000d      //ADC PowerDown Control
    504 #define ADC_ATTEN_ADCL          0x0000000e      //ADC Attenuation ADCL
    505 #define ADC_ATTEN_ADCR          0x0000000f      //ADC Attenuation ADCR
    506 #define ADC_ALC_CTRL1           0x00000010      //ADC ALC Control 1
    507 #define ADC_ALC_CTRL2           0x00000011      //ADC ALC Control 2
    508 #define ADC_ALC_CTRL3           0x00000012      //ADC ALC Control 3
    509 #define ADC_NOISE_CTRL          0x00000013      //ADC Noise Gate Control
    510 #define ADC_LIMIT_CTRL          0x00000014      //ADC Limiter Control
    511 #define ADC_MUX                 0x00000015      //ADC Mux offset
     497#define I2C_A_ADC_ADD_MASK      0x000000fe      //The address is a 7 bit address
     498#define I2C_A_ADC_RW_MASK       0x00000001      //bit mask for R/W
     499#define I2C_A_ADC_TRANS_MASK    0x00000010      //Bit mask for I2c address DAC value
     500#define I2C_A_ADC_ABORT_MASK    0x00000020      //Bit mask for I2C transaction abort flag
     501#define I2C_A_ADC_LAST_MASK     0x00000040      //Bit mask for Last word transaction
     502#define I2C_A_ADC_BYTE_MASK     0x00000080      //Bit mask for Byte Mode
     503
     504#define I2C_A_ADC_ADD           0x00000034      //This is the Device address for ADC
     505#define I2C_A_ADC_READ          0x00000001      //To perform a read operation
     506#define I2C_A_ADC_START         0x00000100      //Start I2C transaction
     507#define I2C_A_ADC_ABORT         0x00000200      //I2C transaction abort
     508#define I2C_A_ADC_LAST          0x00000400      //I2C last transaction
     509#define I2C_A_ADC_BYTE          0x00000800      //I2C one byte mode
     510
     511#define I2C_D_ADC_REG_MASK      0xfe000000      //ADC address register
     512#define I2C_D_ADC_DAT_MASK      0x01ff0000      //ADC data register
     513
     514#define ADC_TIMEOUT             0x00000007      //ADC Timeout Clock Disable
     515#define ADC_IFC_CTRL            0x0000000b      //ADC Interface Control
     516#define ADC_MASTER              0x0000000c      //ADC Master Mode Control
     517#define ADC_POWER               0x0000000d      //ADC PowerDown Control
     518#define ADC_ATTEN_ADCL          0x0000000e      //ADC Attenuation ADCL
     519#define ADC_ATTEN_ADCR          0x0000000f      //ADC Attenuation ADCR
     520#define ADC_ALC_CTRL1           0x00000010      //ADC ALC Control 1
     521#define ADC_ALC_CTRL2           0x00000011      //ADC ALC Control 2
     522#define ADC_ALC_CTRL3           0x00000012      //ADC ALC Control 3
     523#define ADC_NOISE_CTRL          0x00000013      //ADC Noise Gate Control
     524#define ADC_LIMIT_CTRL          0x00000014      //ADC Limiter Control
     525#define ADC_MUX                 0x00000015      //ADC Mux offset
    512526
    513527#if 0
    514528/* FIXME: Not tested yet. */
    515 #define ADC_GAIN_MASK           0x000000ff      //Mask for ADC Gain
    516 #define ADC_ZERODB              0x000000cf      //Value to set ADC to 0dB
    517 #define ADC_MUTE_MASK           0x000000c0      //Mask for ADC mute
    518 #define ADC_MUTE                0x000000c0      //Value to mute ADC
    519 #define ADC_OSR                 0x00000008      //Mask for ADC oversample rate select
    520 #define ADC_TIMEOUT_DISABLE     0x00000008      //Value and mask to disable Timeout clock
    521 #define ADC_HPF_DISABLE         0x00000100      //Value and mask to disable High pass filter
    522 #define ADC_TRANWIN_MASK        0x00000070      //Mask for Length of Transient Window
     529#define ADC_GAIN_MASK           0x000000ff      //Mask for ADC Gain
     530#define ADC_ZERODB              0x000000cf      //Value to set ADC to 0dB
     531#define ADC_MUTE_MASK           0x000000c0      //Mask for ADC mute
     532#define ADC_MUTE                0x000000c0      //Value to mute ADC
     533#define ADC_OSR                 0x00000008      //Mask for ADC oversample rate select
     534#define ADC_TIMEOUT_DISABLE     0x00000008      //Value and mask to disable Timeout clock
     535#define ADC_HPF_DISABLE         0x00000100      //Value and mask to disable High pass filter
     536#define ADC_TRANWIN_MASK        0x00000070      //Mask for Length of Transient Window
    523537#endif
    524538
    525 #define ADC_MUX_MASK            0x0000000f      //Mask for ADC Mux
    526 #define ADC_MUX_MIC             0x00000002      //Value to select Mic at ADC Mux
    527 #define ADC_MUX_LINEIN          0x00000004      //Value to select LineIn at ADC Mux
    528 #define ADC_MUX_PHONE           0x00000001      //Value to select TAD at ADC Mux (Not used)
    529 #define ADC_MUX_AUX             0x00000008      //Value to select Aux at ADC Mux
     539#define ADC_MUX_MASK            0x0000000f      //Mask for ADC Mux
     540#define ADC_MUX_MIC             0x00000002      //Value to select Mic at ADC Mux
     541#define ADC_MUX_LINEIN          0x00000004      //Value to select LineIn at ADC Mux
     542#define ADC_MUX_PHONE           0x00000001      //Value to select TAD at ADC Mux (Not used)
     543#define ADC_MUX_AUX             0x00000008      //Value to select Aux at ADC Mux
    530544
    531545#define SET_CHANNEL 0  /* Testing channel outputs 0=Front, 1=Center/LFE, 2=Unknown, 3=Rear */
     
    539553#define CONTROL_UNKNOWN_CHANNEL 2
    540554
    541 typedef struct snd_ca0106_channel ca0106_channel_t;
    542 typedef struct snd_ca0106 ca0106_t;
    543 typedef struct snd_ca0106_pcm ca0106_pcm_t;
     555#include "ca_midi.h"
     556
     557struct snd_ca0106;
    544558
    545559struct snd_ca0106_channel {
    546         ca0106_t *emu;
     560        struct snd_ca0106 *emu;
    547561        int number;
    548562        int use;
    549         void (*interrupt)(ca0106_t *emu, ca0106_channel_t *channel);
    550         ca0106_pcm_t *epcm;
     563        void (*interrupt)(struct snd_ca0106 *emu, struct snd_ca0106_channel *channel);
     564        struct snd_ca0106_pcm *epcm;
    551565};
    552566
    553567struct snd_ca0106_pcm {
    554         ca0106_t *emu;
    555         snd_pcm_substream_t *substream;
     568        struct snd_ca0106 *emu;
     569        struct snd_pcm_substream *substream;
    556570        int channel_id;
    557571        unsigned short running;
    558572};
    559573
    560 typedef struct {
    561     u32 serial;
    562     char * name;
    563     int ac97;
    564     int gpio_type;
    565     int i2c_adc;
    566 } ca0106_details_t;
     574struct snd_ca0106_details {
     575        u32 serial;
     576        char * name;
     577        int ac97;
     578        int gpio_type;
     579        int i2c_adc;
     580        int spi_dac;
     581};
    567582
    568583// definition of the chip-specific record
    569584struct snd_ca0106 {
    570     snd_card_t *card;
    571     ca0106_details_t *details;
    572     struct pci_dev *pci;
    573 
    574     unsigned long port;
    575     struct resource *res_port;
    576     int irq;
    577 
    578     unsigned int revision;              /* chip revision */
    579     unsigned int serial;            /* serial number */
    580     unsigned short model;               /* subsystem id */
    581 
    582     spinlock_t emu_lock;
    583 
    584     ac97_t *ac97;
    585     snd_pcm_t *pcm;
    586 
    587     ca0106_channel_t playback_channels[4];
    588     ca0106_channel_t capture_channels[4];
    589     u32 spdif_bits[4];             /* s/pdif out setup */
    590     int spdif_enable;
    591     int capture_source;
    592     int capture_mic_line_in;
    593 
    594     struct snd_dma_buffer buffer;
     585        struct snd_card *card;
     586        struct snd_ca0106_details *details;
     587        struct pci_dev *pci;
     588
     589        unsigned long port;
     590        struct resource *res_port;
     591        int irq;
     592
     593        unsigned int revision;          /* chip revision */
     594        unsigned int serial;            /* serial number */
     595        unsigned short model;           /* subsystem id */
     596
     597        spinlock_t emu_lock;
     598
     599        struct snd_ac97 *ac97;
     600        struct snd_pcm *pcm;
     601
     602        struct snd_ca0106_channel playback_channels[4];
     603        struct snd_ca0106_channel capture_channels[4];
     604        u32 spdif_bits[4];             /* s/pdif out setup */
     605        int spdif_enable;
     606        int capture_source;
     607        int capture_mic_line_in;
     608
     609        struct snd_dma_buffer buffer;
     610
     611        struct snd_ca_midi midi;
     612        struct snd_ca_midi midi2;
    595613};
    596614
    597 int __devinit snd_ca0106_mixer(ca0106_t *emu);
    598 int __devinit snd_ca0106_proc_init(ca0106_t * emu);
    599 
    600 unsigned int snd_ca0106_ptr_read(ca0106_t * emu,
    601                                           unsigned int reg,
    602                                           unsigned int chn);
    603 
    604 void snd_ca0106_ptr_write(ca0106_t *emu,
    605                                    unsigned int reg,
    606                                    unsigned int chn,
    607                                    unsigned int data);
    608 
    609 int snd_ca0106_i2c_write(ca0106_t *emu, u32 reg, u32 value);
     615int snd_ca0106_mixer(struct snd_ca0106 *emu);
     616int snd_ca0106_proc_init(struct snd_ca0106 * emu);
     617
     618unsigned int snd_ca0106_ptr_read(struct snd_ca0106 * emu,
     619                                 unsigned int reg,
     620                                 unsigned int chn);
     621
     622void snd_ca0106_ptr_write(struct snd_ca0106 *emu,
     623                          unsigned int reg,
     624                          unsigned int chn,
     625                          unsigned int data);
     626
     627int snd_ca0106_i2c_write(struct snd_ca0106 *emu, u32 reg, u32 value);
     628
     629
Note: See TracChangeset for help on using the changeset viewer.