Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/sys/dev/pci Pull up revisions 1.1-1.6 (new, requested b...



details:   https://anonhg.NetBSD.org/src/rev/7e71a895ed1d
branches:  netbsd-1-5
changeset: 492609:7e71a895ed1d
user:      he <he%NetBSD.org@localhost>
date:      Thu Jan 24 22:36:33 2002 +0000

description:
Pull up revisions 1.1-1.6 (new, requested by he):
  Add driver for the ESS Allegro-1 / Maestro-3 audio hardware.

diffstat:

 sys/dev/pci/esareg.h |  619 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 619 insertions(+), 0 deletions(-)

diffs (truncated from 623 to 300 lines):

diff -r 17871fe9b2da -r 7e71a895ed1d sys/dev/pci/esareg.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/pci/esareg.h      Thu Jan 24 22:36:33 2002 +0000
@@ -0,0 +1,619 @@
+/* $NetBSD: esareg.h,v 1.6.2.2 2002/01/24 22:36:33 he Exp $ */
+
+/*
+ * Copyright (c) 2002 Lennart Augustsson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * ESS Allegro-1 / Maestro3 Audio Driver
+ * 
+ * Lots of magic based on the FreeBSD maestro3 driver and
+ * reverse engineering.
+ * Original driver by Don Kim.
+ *
+ */
+
+/* Allegro PCI configuration registers */
+#define PCI_LEGACY_AUDIO_CTRL   0x40
+#define DISABLE_LEGACY          0x00008000
+
+#define ESA_PCI_ALLEGRO_CONFIG      0x50
+#define ESA_SB_ADDR_240             0x00000004
+#define ESA_MPU_ADDR_MASK           0x00000018
+#define ESA_MPU_ADDR_330            0x00000000
+#define ESA_MPU_ADDR_300            0x00000008
+#define ESA_MPU_ADDR_320            0x00000010
+#define ESA_MPU_ADDR_340            0x00000018
+#define ESA_USE_PCI_TIMING          0x00000040
+#define ESA_POSTED_WRITE_ENABLE     0x00000080
+#define ESA_DMA_POLICY_MASK         0x00000700
+#define ESA_DMA_DDMA                0x00000000
+#define ESA_DMA_TDMA                0x00000100
+#define ESA_DMA_PCPCI               0x00000200
+#define ESA_DMA_WBDMA16             0x00000400
+#define ESA_DMA_WBDMA4              0x00000500
+#define ESA_DMA_WBDMA2              0x00000600
+#define ESA_DMA_WBDMA1              0x00000700
+#define ESA_DMA_SAFE_GUARD          0x00000800
+#define ESA_HI_PERF_GP_ENABLE       0x00001000
+#define ESA_PIC_SNOOP_MODE_0        0x00002000
+#define ESA_PIC_SNOOP_MODE_1        0x00004000
+#define ESA_SOUNDBLASTER_IRQ_MASK   0x00008000
+#define ESA_RING_IN_ENABLE          0x00010000
+#define ESA_SPDIF_TEST_MODE         0x00020000
+#define ESA_CLK_MULT_MODE_SELECT_2  0x00040000
+#define ESA_EEPROM_WRITE_ENABLE     0x00080000
+#define ESA_CODEC_DIR_IN            0x00100000
+#define ESA_HV_BUTTON_FROM_GD       0x00200000
+#define ESA_REDUCED_DEBOUNCE        0x00400000
+#define ESA_HV_CTRL_ENABLE          0x00800000
+#define ESA_SPDIF_ENABLE            0x01000000
+#define ESA_CLK_DIV_SELECT          0x06000000
+#define ESA_CLK_DIV_BY_48           0x00000000
+#define ESA_CLK_DIV_BY_49           0x02000000
+#define ESA_CLK_DIV_BY_50           0x04000000
+#define ESA_CLK_DIV_RESERVED        0x06000000
+#define ESA_PM_CTRL_ENABLE          0x08000000
+#define ESA_CLK_MULT_MODE_SELECT    0x30000000
+#define ESA_CLK_MULT_MODE_SHIFT     28
+#define ESA_CLK_MULT_MODE_0         0x00000000
+#define ESA_CLK_MULT_MODE_1         0x10000000
+#define ESA_CLK_MULT_MODE_2         0x20000000
+#define ESA_CLK_MULT_MODE_3         0x30000000
+#define ESA_INT_CLK_SELECT          0x40000000
+#define ESA_INT_CLK_MULT_RESET      0x80000000
+
+/* M3 */
+#define ESA_INT_CLK_SRC_NOT_PCI     0x00100000
+#define ESA_INT_CLK_MULT_ENABLE     0x80000000
+
+#define ESA_PCI_ACPI_CONTROL        0x54
+#define ESA_PCI_ACPI_D0             0x00000000
+#define ESA_PCI_ACPI_D1             0xB4F70000
+#define ESA_PCI_ACPI_D2             0xB4F7B4F7
+
+#define ESA_PCI_USER_CONFIG         0x58
+#define ESA_EXT_PCI_MASTER_ENABLE   0x00000001
+#define ESA_SPDIF_OUT_SELECT        0x00000002
+#define ESA_TEST_PIN_DIR_CTRL       0x00000004
+#define ESA_AC97_CODEC_TEST         0x00000020
+#define ESA_TRI_STATE_BUFFER        0x00000080
+#define ESA_IN_CLK_12MHZ_SELECT     0x00000100
+#define ESA_MULTI_FUNC_DISABLE      0x00000200
+#define ESA_EXT_MASTER_PAIR_SEL     0x00000400
+#define ESA_PCI_MASTER_SUPPORT      0x00000800
+#define ESA_STOP_CLOCK_ENABLE       0x00001000
+#define ESA_EAPD_DRIVE_ENABLE       0x00002000
+#define ESA_REQ_TRI_STATE_ENABLE    0x00004000
+#define ESA_REQ_LOW_ENABLE          0x00008000
+#define ESA_MIDI_1_ENABLE           0x00010000
+#define ESA_MIDI_2_ENABLE           0x00020000
+#define ESA_SB_AUDIO_SYNC           0x00040000
+#define ESA_HV_CTRL_TEST            0x00100000
+#define ESA_SOUNDBLASTER_TEST       0x00400000
+
+#define ESA_PCI_USER_CONFIG_C       0x5C
+
+#define ESA_PCI_DDMA_CTRL           0x60
+#define ESA_DDMA_ENABLE             0x00000001
+
+
+/* Allegro registers */
+#define ESA_HOST_INT_CTRL           0x18
+#define ESA_SB_INT_ENABLE           0x0001
+#define ESA_MPU401_INT_ENABLE       0x0002
+#define ESA_ASSP_INT_ENABLE         0x0010
+#define ESA_RING_INT_ENABLE         0x0020
+#define ESA_HV_INT_ENABLE           0x0040
+#define ESA_CLKRUN_GEN_ENABLE       0x0100
+#define ESA_HV_CTRL_TO_PME          0x0400
+#define ESA_SOFTWARE_RESET_ENABLE   0x8000
+
+/*
+ * should be using the above defines, probably.
+ */
+#define ESA_REGB_ENABLE_RESET       0x01
+#define ESA_REGB_STOP_CLOCK         0x10
+
+#define ESA_HOST_INT_STATUS         0x1A
+#define ESA_SB_INT_PENDING          0x01
+#define ESA_MPU401_INT_PENDING      0x02
+#define ESA_ASSP_INT_PENDING        0x10
+#define ESA_RING_INT_PENDING        0x20
+#define ESA_HV_INT_PENDING          0x40
+
+#define ESA_HARDWARE_VOL_CTRL       0x1B
+#define ESA_SHADOW_MIX_REG_VOICE    0x1C
+#define ESA_HW_VOL_COUNTER_VOICE    0x1D
+#define ESA_SHADOW_MIX_REG_MASTER   0x1E
+#define ESA_HW_VOL_COUNTER_MASTER   0x1F
+
+#define ESA_CODEC_COMMAND           0x30
+#define ESA_CODEC_READ_B            0x80
+
+#define ESA_CODEC_STATUS            0x30
+#define ESA_CODEC_BUSY_B            0x01
+
+#define ESA_CODEC_DATA              0x32
+
+#define ESA_RING_BUS_CTRL_A         0x36
+#define ESA_RAC_PME_ENABLE          0x0100
+#define ESA_RAC_SDFS_ENABLE         0x0200
+#define ESA_LAC_PME_ENABLE          0x0400
+#define ESA_LAC_SDFS_ENABLE         0x0800
+#define ESA_SERIAL_AC_LINK_ENABLE   0x1000
+#define ESA_IO_SRAM_ENABLE          0x2000
+#define ESA_IIS_INPUT_ENABLE        0x8000
+
+#define ESA_RING_BUS_CTRL_B         0x38
+#define ESA_SECOND_CODEC_ID_MASK    0x0003
+#define ESA_SPDIF_FUNC_ENABLE       0x0010
+#define ESA_SECOND_AC_ENABLE        0x0020
+#define ESA_SB_MODULE_INTF_ENABLE   0x0040
+#define ESA_SSPE_ENABLE             0x0040
+#define ESA_M3I_DOCK_ENABLE         0x0080
+
+#define ESA_SDO_OUT_DEST_CTRL       0x3A
+#define ESA_COMMAND_ADDR_OUT        0x0003
+#define ESA_PCM_LR_OUT_LOCAL        0x0000
+#define ESA_PCM_LR_OUT_REMOTE       0x0004
+#define ESA_PCM_LR_OUT_MUTE         0x0008
+#define ESA_PCM_LR_OUT_BOTH         0x000C
+#define ESA_LINE1_DAC_OUT_LOCAL     0x0000
+#define ESA_LINE1_DAC_OUT_REMOTE    0x0010
+#define ESA_LINE1_DAC_OUT_MUTE      0x0020
+#define ESA_LINE1_DAC_OUT_BOTH      0x0030
+#define ESA_PCM_CLS_OUT_LOCAL       0x0000
+#define ESA_PCM_CLS_OUT_REMOTE      0x0040
+#define ESA_PCM_CLS_OUT_MUTE        0x0080
+#define ESA_PCM_CLS_OUT_BOTH        0x00C0
+#define ESA_PCM_RLF_OUT_LOCAL       0x0000
+#define ESA_PCM_RLF_OUT_REMOTE      0x0100
+#define ESA_PCM_RLF_OUT_MUTE        0x0200
+#define ESA_PCM_RLF_OUT_BOTH        0x0300
+#define ESA_LINE2_DAC_OUT_LOCAL     0x0000
+#define ESA_LINE2_DAC_OUT_REMOTE    0x0400
+#define ESA_LINE2_DAC_OUT_MUTE      0x0800
+#define ESA_LINE2_DAC_OUT_BOTH      0x0C00
+#define ESA_HANDSET_OUT_LOCAL       0x0000
+#define ESA_HANDSET_OUT_REMOTE      0x1000
+#define ESA_HANDSET_OUT_MUTE        0x2000
+#define ESA_HANDSET_OUT_BOTH        0x3000
+#define ESA_IO_CTRL_OUT_LOCAL       0x0000
+#define ESA_IO_CTRL_OUT_REMOTE      0x4000
+#define ESA_IO_CTRL_OUT_MUTE        0x8000
+#define ESA_IO_CTRL_OUT_BOTH        0xC000
+
+#define ESA_SDO_IN_DEST_CTRL        0x3C
+#define ESA_STATUS_ADDR_IN          0x0003
+#define ESA_PCM_LR_IN_LOCAL         0x0000
+#define ESA_PCM_LR_IN_REMOTE        0x0004
+#define ESA_PCM_LR_RESERVED         0x0008
+#define ESA_PCM_LR_IN_BOTH          0x000C
+#define ESA_LINE1_ADC_IN_LOCAL      0x0000
+#define ESA_LINE1_ADC_IN_REMOTE     0x0010
+#define ESA_LINE1_ADC_IN_MUTE       0x0020
+#define ESA_MIC_ADC_IN_LOCAL        0x0000
+#define ESA_MIC_ADC_IN_REMOTE       0x0040
+#define ESA_MIC_ADC_IN_MUTE         0x0080
+#define ESA_LINE2_DAC_IN_LOCAL      0x0000
+#define ESA_LINE2_DAC_IN_REMOTE     0x0400
+#define ESA_LINE2_DAC_IN_MUTE       0x0800
+#define ESA_HANDSET_IN_LOCAL        0x0000
+#define ESA_HANDSET_IN_REMOTE       0x1000
+#define ESA_HANDSET_IN_MUTE         0x2000
+#define ESA_IO_STATUS_IN_LOCAL      0x0000
+#define ESA_IO_STATUS_IN_REMOTE     0x4000
+
+#define ESA_SPDIF_IN_CTRL           0x3E
+#define ESA_SPDIF_IN_ENABLE         0x0001
+
+#define ESA_GPIO_DATA               0x60
+#define ESA_GPIO_DATA_MASK          0x0FFF
+#define ESA_GPIO_HV_STATUS          0x3000
+#define ESA_GPIO_PME_STATUS         0x4000
+
+#define ESA_GPIO_MASK               0x64
+#define ESA_GPIO_DIRECTION          0x68
+#define ESA_GPO_PRIMARY_AC97        0x0001
+#define ESA_GPI_LINEOUT_SENSE       0x0004
+#define ESA_GPO_SECONDARY_AC97      0x0008
+#define ESA_GPI_VOL_DOWN            0x0010
+#define ESA_GPI_VOL_UP              0x0020
+#define ESA_GPI_IIS_CLK             0x0040
+#define ESA_GPI_IIS_LRCLK           0x0080
+#define ESA_GPI_IIS_DATA            0x0100
+#define ESA_GPI_DOCKING_STATUS      0x0100
+#define ESA_GPI_HEADPHONE_SENSE     0x0200
+#define ESA_GPO_EXT_AMP_SHUTDOWN    0x1000
+
+/* M3 */
+#define ESA_GPO_M3_EXT_AMP_SHUTDN   0x0002
+
+#define ESA_ASSP_INDEX_PORT         0x80
+#define ESA_ASSP_MEMORY_PORT        0x82
+#define ESA_ASSP_DATA_PORT          0x84
+
+#define ESA_MPU401_DATA_PORT        0x98
+#define ESA_MPU401_STATUS_PORT      0x99
+
+#define ESA_CLK_MULT_DATA_PORT      0x9C
+
+#define ESA_ASSP_CONTROL_A          0xA2
+#define ESA_ASSP_0_WS_ENABLE        0x01
+#define ESA_ASSP_CTRL_A_RESERVED1   0x02
+#define ESA_ASSP_CTRL_A_RESERVED2   0x04
+#define ESA_ASSP_CLK_49MHZ_SELECT   0x08
+#define ESA_FAST_PLU_ENABLE         0x10
+#define ESA_ASSP_CTRL_A_RESERVED3   0x20
+#define ESA_DSP_CLK_36MHZ_SELECT    0x40
+
+#define ESA_ASSP_CONTROL_B          0xA4
+#define ESA_RESET_ASSP              0x00
+#define ESA_RUN_ASSP                0x01
+#define ESA_ENABLE_ASSP_CLOCK       0x00
+#define ESA_STOP_ASSP_CLOCK         0x10
+#define ESA_RESET_TOGGLE            0x40
+
+#define ESA_ASSP_CONTROL_C          0xA6
+#define ESA_ASSP_HOST_INT_ENABLE    0x01
+#define ESA_FM_ADDR_REMAP_DISABLE   0x02
+#define ESA_HOST_WRITE_PORT_ENABLE  0x08
+
+#define ESA_ASSP_HOST_INT_STATUS    0xAC
+#define ESA_DSP2HOST_REQ_PIORECORD  0x01
+#define ESA_DSP2HOST_REQ_I2SRATE    0x02
+#define ESA_DSP2HOST_REQ_TIMER      0x04
+
+/*
+ * ASSP control regs
+ */
+#define ESA_DSP_PORT_TIMER_COUNT    0x06
+
+#define ESA_DSP_PORT_MEMORY_INDEX   0x80
+
+#define ESA_DSP_PORT_MEMORY_TYPE    0x82



Home | Main Index | Thread Index | Old Index