Commit 04c401f6 authored by Jaroslav Kysela's avatar Jaroslav Kysela Committed by Jaroslav Kysela

[PATCH] ALSA update [9/12] - 2002/09/11

  - AC'97 codec
    - added support/detection for MC'97 (modem codecs)
    - improved/updated register bit constants
    - AD1980 codec ID with patch code
    - added eMicro and Philips UCB1400 codecs
  - PCM Scatter-Gather support
    - added a function snd_pcm_sgbuf_get_addr()
  - rewritten PCI DMA allocation
  - ENS1371 - fixed IEC958 control index when AC'97 codec has S/PDIF capability, too
  - intel8x0
    - don't break when second codec cannot be initialized
  - via82xx
    - improved sg buffer handling
    - added "Input Source Select" control for via8233
    - fixed the registers for via8233
    - fixed the detection of via8233 chip
    - clean up the configuration of bd arrays
  - USB Audio
    - added the missing initialization of curframesize field (fixes capture)
parent c4eeeab4
......@@ -54,7 +54,7 @@
#define AC97_POWERDOWN 0x26 /* Powerdown control / status */
/* range 0x28-0x3a - AUDIO AC'97 2.0 extensions */
#define AC97_EXTENDED_ID 0x28 /* Extended Audio ID */
#define AC97_EXTENDED_STATUS 0x2a /* Extended Audio Status */
#define AC97_EXTENDED_STATUS 0x2a /* Extended Audio Status and Control */
#define AC97_PCM_FRONT_DAC_RATE 0x2c /* PCM Front DAC Rate */
#define AC97_PCM_SURR_DAC_RATE 0x2e /* PCM Surround DAC Rate */
#define AC97_PCM_LFE_DAC_RATE 0x30 /* PCM LFE DAC Rate */
......@@ -64,10 +64,40 @@
#define AC97_SURROUND_MASTER 0x38 /* Surround (Rear) Master Volume */
#define AC97_SPDIF 0x3a /* S/PDIF control */
/* range 0x3c-0x58 - MODEM */
#define AC97_EXTENDED_MID 0x3c /* Extended Modem ID */
#define AC97_EXTENDED_MSTATUS 0x3e /* Extended Modem Status and Control */
#define AC97_LINE1_RATE 0x40 /* Line1 DAC/ADC Rate */
#define AC97_LINE2_RATE 0x42 /* Line2 DAC/ADC Rate */
#define AC97_HANDSET_RATE 0x44 /* Handset DAC/ADC Rate */
#define AC97_LINE1_LEVEL 0x46 /* Line1 DAC/ADC Level */
#define AC97_LINE2_LEVEL 0x48 /* Line2 DAC/ADC Level */
#define AC97_HANDSET_LEVEL 0x4a /* Handset DAC/ADC Level */
#define AC97_GPIO_CFG 0x4c /* GPIO Configuration */
#define AC97_GPIO_POLARITY 0x4e /* GPIO Pin Polarity/Type, 0=low, 1=high active */
#define AC97_GPIO_STICKY 0x50 /* GPIO Pin Sticky, 0=not, 1=sticky */
#define AC97_GPIO_WAKEUP 0x52 /* GPIO Pin Wakeup, 0=no int, 1=yes int */
#define AC97_GPIO_STATUS 0x54 /* GPIO Pin Status, slot 12 */
#define AC97_MISC_AFE 0x56 /* Miscellaneous Modem AFE Status and Control */
/* range 0x5a-0x7b - Vendor Specific */
#define AC97_VENDOR_ID1 0x7c /* Vendor ID1 */
#define AC97_VENDOR_ID2 0x7e /* Vendor ID2 / revision */
/* basic capabilities (reset register) */
#define AC97_BC_DEDICATED_MIC 0x0001 /* Dedicated Mic PCM In Channel */
#define AC97_BC_RESERVED1 0x0002 /* Reserved (was Modem Line Codec support) */
#define AC97_BC_BASS_TREBLE 0x0004 /* Bass & Treble Control */
#define AC97_BC_SIM_STEREO 0x0008 /* Simulated stereo */
#define AC97_BC_HEADPHONE 0x0010 /* Headphone Out Support */
#define AC97_BC_LOUDNESS 0x0020 /* Loudness (bass boost) Supporqt */
#define AC97_BC_16BIT_DAC 0x0000 /* 16-bit DAC resolution */
#define AC97_BC_18BIT_DAC 0x0040 /* 18-bit DAC resolution */
#define AC97_BC_20BIT_DAC 0x0080 /* 20-bit DAC resolution */
#define AC97_BC_DAC_MASK 0x00c0
#define AC97_BC_16BIT_ADC 0x0000 /* 16-bit ADC resolution */
#define AC97_BC_18BIT_ADC 0x0100 /* 18-bit ADC resolution */
#define AC97_BC_20BIT_ADC 0x0200 /* 20-bit ADC resolution */
#define AC97_BC_ADC_MASK 0x0300
/* extended audio ID bit defines */
#define AC97_EI_VRA 0x0001 /* Variable bit rate supported */
#define AC97_EI_DRA 0x0002 /* Double rate supported */
......@@ -80,8 +110,8 @@
#define AC97_EI_LDAC 0x0100 /* PCM LFE DAC available */
#define AC97_EI_AMAP 0x0200 /* indicates optional slot/DAC mapping based on codec ID */
#define AC97_EI_REV_MASK 0x0c00 /* AC'97 revision mask */
#define AC97_EI_REV_22 0x0100 /* AC'97 revision 2.2 */
#define AC97_EI_REV_SHIFT 8
#define AC97_EI_REV_22 0x0400 /* AC'97 revision 2.2 */
#define AC97_EI_REV_SHIFT 10
#define AC97_EI_ADDR_MASK 0xc000 /* physical codec ID (address) */
#define AC97_EI_ADDR_SHIFT 14
......@@ -112,14 +142,25 @@
#define AC97_SC_COPY 0x0004 /* Copyright status */
#define AC97_SC_PRE 0x0008 /* Preemphasis status */
#define AC97_SC_CC_MASK 0x07f0 /* Category Code mask */
#define AC97_SC_CC_SHIFT 4
#define AC97_SC_L 0x0800 /* Generation Level status */
#define AC97_SC_SPSR_MASK 0xcfff /* S/PDIF Sample Rate bits */
#define AC97_SC_SPSR_MASK 0x3000 /* S/PDIF Sample Rate bits */
#define AC97_SC_SPSR_SHIFT 12
#define AC97_SC_SPSR_44K 0x0000 /* Use 44.1kHz Sample rate */
#define AC97_SC_SPSR_48K 0x2000 /* Use 48kHz Sample rate */
#define AC97_SC_SPSR_32K 0x3000 /* Use 32kHz Sample rate */
#define AC97_SC_DRS 0x4000 /* Double Rate S/PDIF */
#define AC97_SC_V 0x8000 /* Validity status */
/* extended modem ID bit defines */
#define AC97_MEI_LINE1 0x0001 /* Line1 present */
#define AC97_MEI_LINE2 0x0002 /* Line2 present */
#define AC97_MEI_HEADSET 0x0004 /* Headset present */
#define AC97_MEI_CID1 0x0008 /* caller ID decode for Line1 is supported */
#define AC97_MEI_CID2 0x0010 /* caller ID decode for Line2 is supported */
#define AC97_MEI_ADDR_MASK 0xc000 /* physical codec ID (address) */
#define AC97_MEI_ADDR_SHIFT 14
/* specific - SigmaTel */
#define AC97_SIGMATEL_ANALOG 0x6c /* Analog Special */
#define AC97_SIGMATEL_DAC2INVERT 0x6e
......@@ -154,8 +195,10 @@
#define AC97_CXR_SPDIF_AC3 0x2
/* ac97->scaps */
#define AC97_SCAP_SURROUND_DAC (1<<0) /* surround L&R DACs are present */
#define AC97_SCAP_CENTER_LFE_DAC (1<<1) /* center and LFE DACs are present */
#define AC97_SCAP_AUDIO (1<<0) /* audio AC'97 codec */
#define AC97_SCAP_MODEM (1<<1) /* modem AC'97 codec */
#define AC97_SCAP_SURROUND_DAC (1<<2) /* surround L&R DACs are present */
#define AC97_SCAP_CENTER_LFE_DAC (1<<3) /* center and LFE DACs are present */
/* ac97->flags */
#define AC97_HAS_PC_BEEP (1<<0) /* force PC Speaker usage */
......@@ -195,6 +238,7 @@ struct _snd_ac97 {
unsigned int id; /* identification of codec */
unsigned short caps; /* capabilities (register 0) */
unsigned short ext_id; /* extended feature identification (register 28) */
unsigned short ext_mid; /* extended modem ID (register 3C) */
unsigned int scaps; /* driver capabilities */
unsigned int flags; /* specific code */
unsigned int clock; /* AC'97 clock (usually 48000Hz) */
......
......@@ -45,6 +45,13 @@ static inline unsigned int snd_pcm_sgbuf_pages(size_t size)
return (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
}
/*
* return the physical address at the corresponding offset
*/
static inline dma_addr_t snd_pcm_sgbuf_get_addr(struct snd_sg_buf *sgbuf, size_t offset)
{
return sgbuf->table[offset >> PAGE_SHIFT].addr + offset % PAGE_SIZE;
}
int snd_pcm_sgbuf_init(snd_pcm_substream_t *substream, struct pci_dev *pci, int tblsize);
int snd_pcm_sgbuf_delete(snd_pcm_substream_t *substream);
......
/* include/version.h. Generated automatically by configure. */
#define CONFIG_SND_VERSION "0.9.0rc3"
#define CONFIG_SND_DATE " (Fri Sep 06 15:06:56 2002 UTC)"
#define CONFIG_SND_DATE " (Wed Sep 11 18:36:14 2002 UTC)"
......@@ -3,17 +3,23 @@
# Copyright (c) 1999,2001 by Jaroslav Kysela <perex@suse.cz>
#
export-objs := sound.o pcm.o pcm_lib.o rawmidi.o timer.o hwdep.o \
pcm_sgbuf.o
export-objs := sound.o pcm.o pcm_lib.o rawmidi.o timer.o hwdep.o
snd-objs := sound.o init.o isadma.o memory.o info.o control.o misc.o \
snd-objs := sound.o init.o memory.o info.o control.o misc.o \
device.o wrappers.o
ifeq ($(CONFIG_ISA),y)
snd-objs += isadma.o
endif
ifeq ($(CONFIG_SND_OSSEMUL),y)
snd-objs += sound_oss.o info_oss.o
endif
snd-pcm-objs := pcm.o pcm_native.o pcm_lib.o pcm_timer.o pcm_misc.o \
pcm_memory.o pcm_sgbuf.o
pcm_memory.o
ifeq ($(CONFIG_PCI),y)
snd-pcm-objs += pcm_sgbuf.o
export-objs += pcm_sgbuf.o
endif
snd-rawmidi-objs := rawmidi.o
snd-timer-objs := timer.o
......
......@@ -30,8 +30,6 @@
#include <sound/core.h>
#include <asm/dma.h>
#ifdef CONFIG_ISA
/*
*
*/
......@@ -78,5 +76,3 @@ unsigned int snd_dma_residue(unsigned long dma)
release_dma_lock(flags);
return result;
}
#endif /* CONFIG_ISA */
......@@ -545,35 +545,36 @@ int copy_from_user_toio(unsigned long dst, const void *src, size_t count)
*
* since pci_alloc_consistent always tries GFP_DMA when the requested
* pci memory region is below 32bit, it happens quite often that even
* 2 order or pages cannot be allocated.
* 2 order of pages cannot be allocated.
*
* so in the following, GFP_DMA is used only when the first allocation
* doesn't match the requested region.
* so in the following, we allocate at first without dma_mask, so that
* allocation will be done without GFP_DMA. if the area doesn't match
* with the requested region, then realloate with the original dma_mask
* again.
*/
#ifdef __i386__
#define get_phys_addr(x) virt_to_phys(x)
#else /* ppc and x86-64 */
#define get_phys_addr(x) virt_to_bus(x)
#endif
#undef pci_alloc_consistent
void *snd_pci_hack_alloc_consistent(struct pci_dev *hwdev, size_t size,
dma_addr_t *dma_handle)
{
void *ret;
int gfp = GFP_ATOMIC;
u64 dma_mask;
unsigned long rmask;
if (hwdev == NULL)
gfp |= GFP_DMA;
ret = (void *)__get_free_pages(gfp, get_order(size));
if (ret) {
if (hwdev && ((get_phys_addr(ret) + size - 1) & ~hwdev->dma_mask)) {
free_pages((unsigned long)ret, get_order(size));
ret = (void *)__get_free_pages(gfp | GFP_DMA, get_order(size));
}
}
if (ret) {
memset(ret, 0, size);
*dma_handle = get_phys_addr(ret);
return pci_alloc_consistent(hwdev, size, dma_handle);
dma_mask = hwdev->dma_mask;
rmask = ~((unsigned long)dma_mask);
hwdev->dma_mask = 0xffffffff; /* do without masking */
ret = pci_alloc_consistent(hwdev, size, dma_handle);
if (ret && ((*dma_handle + size - 1) & rmask)) {
pci_free_consistent(hwdev, size, ret, *dma_handle);
ret = 0;
}
hwdev->dma_mask = dma_mask; /* restore */
if (! ret)
ret = pci_alloc_consistent(hwdev, size, dma_handle);
return ret;
}
#endif /* hack */
......@@ -446,7 +446,7 @@ static int snd_dummy_volume_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
left = ucontrol->value.integer.value[0] % 101;
right = ucontrol->value.integer.value[1] % 101;
spin_lock_irqsave(&dummy->mixer_lock, flags);
change = dummy->mixer_volume[addr][0] != left &&
change = dummy->mixer_volume[addr][0] != left ||
dummy->mixer_volume[addr][1] != right;
dummy->mixer_volume[addr][0] = left;
dummy->mixer_volume[addr][1] = right;
......
This diff is collapsed.
......@@ -31,6 +31,7 @@
#include <sound/ac97_codec.h>
#include <sound/asoundef.h>
#include <sound/initval.h>
#include "ac97_patch.h"
/*
* Chip specific initialization
......@@ -323,3 +324,15 @@ int patch_ad1886(ac97_t * ac97)
snd_ac97_write_cache(ac97, AC97_AD_JACK_SPDIF, 0x0010);
return 0;
}
int patch_ad1980(ac97_t * ac97)
{
unsigned short misc;
patch_ad1881(ac97);
/* Switch FRONT/SURROUND LINE-OUT/HP-OUT default connection */
/* it seems that most vendors connect line-out connector to headphone out of AC'97 */
misc = snd_ac97_read(ac97, AC97_AD_MISC);
snd_ac97_write_cache(ac97, AC97_AD_MISC, misc | 0x0420);
return 0;
}
......@@ -37,3 +37,4 @@ int patch_ad1819(ac97_t * ac97);
int patch_ad1881(ac97_t * ac97);
int patch_ad1885(ac97_t * ac97);
int patch_ad1886(ac97_t * ac97);
int patch_ad1980(ac97_t * ac97);
......@@ -1319,7 +1319,10 @@ static int snd_ensoniq_1371_mixer(ensoniq_t * ensoniq)
if (ensoniq->pci->vendor == es1371_spdif_present[idx].vid &&
ensoniq->pci->device == es1371_spdif_present[idx].did &&
ensoniq->rev == es1371_spdif_present[idx].rev) {
snd_ctl_add(card, snd_ctl_new1(&snd_es1371_mixer_spdif, ensoniq));
snd_kcontrol_t *kctl = snd_ctl_new1(&snd_es1371_mixer_spdif, ensoniq);
if (ensoniq->u.es1371.ac97->ext_id & AC97_EI_SPDIF)
kctl->id.index = 1;
snd_ctl_add(card, kctl);
break;
}
return 0;
......
......@@ -1580,8 +1580,11 @@ static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock)
goto __skip_secondary;
for (i = 1; i < codecs; i++) {
ac97.num = i;
if ((err = snd_ac97_mixer(chip->card, &ac97, &x97)) < 0)
return err;
if ((err = snd_ac97_mixer(chip->card, &ac97, &x97)) < 0) {
snd_printk("Unable to initialize codec #%i [device = %i, GLOB_STA = 0x%x]\n", i, chip->device_type, glob_sta);
codecs = i;
break;
}
chip->ac97[i] = x97;
if (chip->device_type == DEVICE_INTEL_ICH4 && chip->ichd[ICHD_PCM2IN].ac97 == NULL)
chip->ichd[ICHD_PCM2IN].ac97 = x97;
......
/*
* Driver for ESS Maestro3/Allegro soundcards.
* Driver for ESS Maestro3/Allegro (ES1988) soundcards.
* Copyright (c) 2000 by Zach Brown <zab@zabbo.net>
* Takashi Iwai <tiwai@suse.de>
*
......@@ -52,6 +52,7 @@ MODULE_DESCRIPTION("ESS Maestro3 PCI");
MODULE_LICENSE("GPL");
MODULE_CLASSES("{sound}");
MODULE_DEVICES("{{ESS,Maestro3 PCI},"
"{ESS,ES1988},"
"{ESS,Allegro PCI},"
"{ESS,Allegro-1 PCI},"
"{ESS,Canyon3D-2/LE PCI}}");
......
This diff is collapsed.
......@@ -766,6 +766,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, snd_pcm_runtime_t *run
subs->curpacksize = subs->maxpacksize;
else
subs->curpacksize = maxsize;
subs->curframesize = bytes_to_frames(runtime, subs->curpacksize);
/* allocate a temporary buffer for playback */
if (is_playback) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment