Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bd05dbd3 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

Merge branch 'topic/ctxfi-fix' into topic/ctxfi

parents 67fbf880 c76157d9
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -277,7 +277,6 @@ config SND_CS5535AUDIO

config SND_CTXFI
	tristate "Creative Sound Blaster X-Fi"
	depends on X86
	select SND_PCM
	help
	  If you want to use soundcards based on Creative Sound Blastr X-Fi
+16 −19
Original line number Diff line number Diff line
@@ -72,15 +72,15 @@ static struct {
	[FRONT]		= { .create = ct_alsa_pcm_create,
			    .destroy = NULL,
			    .public_name = "Front/WaveIn"},
	[REAR]		= { .create = ct_alsa_pcm_create,
	[SURROUND]	= { .create = ct_alsa_pcm_create,
			    .destroy = NULL,
			    .public_name = "Rear"},
			    .public_name = "Surround"},
	[CLFE]		= { .create = ct_alsa_pcm_create,
			    .destroy = NULL,
			    .public_name = "Center/LFE"},
	[SURROUND]	= { .create = ct_alsa_pcm_create,
	[SIDE]		= { .create = ct_alsa_pcm_create,
			    .destroy = NULL,
			    .public_name = "Surround"},
			    .public_name = "Side"},
	[IEC958]	= { .create = ct_alsa_pcm_create,
			    .destroy = NULL,
			    .public_name = "IEC958 Non-audio"},
@@ -119,7 +119,6 @@ atc_pcm_release_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm);

static int ct_map_audio_buffer(struct ct_atc *atc, struct ct_atc_pcm *apcm)
{
	unsigned long flags;
	struct snd_pcm_runtime *runtime;
	struct ct_vm *vm;

@@ -129,9 +128,7 @@ static int ct_map_audio_buffer(struct ct_atc *atc, struct ct_atc_pcm *apcm)
	runtime = apcm->substream->runtime;
	vm = atc->vm;

	spin_lock_irqsave(&atc->vm_lock, flags);
	apcm->vm_block = vm->map(vm, runtime->dma_area, runtime->dma_bytes);
	spin_unlock_irqrestore(&atc->vm_lock, flags);
	apcm->vm_block = vm->map(vm, apcm->substream, runtime->dma_bytes);

	if (NULL == apcm->vm_block)
		return -ENOENT;
@@ -141,7 +138,6 @@ static int ct_map_audio_buffer(struct ct_atc *atc, struct ct_atc_pcm *apcm)

static void ct_unmap_audio_buffer(struct ct_atc *atc, struct ct_atc_pcm *apcm)
{
	unsigned long flags;
	struct ct_vm *vm;

	if (NULL == apcm->vm_block)
@@ -149,9 +145,7 @@ static void ct_unmap_audio_buffer(struct ct_atc *atc, struct ct_atc_pcm *apcm)

	vm = atc->vm;

	spin_lock_irqsave(&atc->vm_lock, flags);
	vm->unmap(vm, apcm->vm_block);
	spin_unlock_irqrestore(&atc->vm_lock, flags);

	apcm->vm_block = NULL;
}
@@ -161,9 +155,7 @@ static unsigned long atc_get_ptp_phys(struct ct_atc *atc, int index)
	struct ct_vm *vm;
	void *kvirt_addr;
	unsigned long phys_addr;
	unsigned long flags;

	spin_lock_irqsave(&atc->vm_lock, flags);
	vm = atc->vm;
	kvirt_addr = vm->get_ptp_virt(vm, index);
	if (kvirt_addr == NULL)
@@ -171,8 +163,6 @@ static unsigned long atc_get_ptp_phys(struct ct_atc *atc, int index)
	else
		phys_addr = virt_to_phys(kvirt_addr);

	spin_unlock_irqrestore(&atc->vm_lock, flags);

	return phys_addr;
}

@@ -180,16 +170,15 @@ static unsigned int convert_format(snd_pcm_format_t snd_format)
{
	switch (snd_format) {
	case SNDRV_PCM_FORMAT_U8:
	case SNDRV_PCM_FORMAT_S8:
		return SRC_SF_U8;
	case SNDRV_PCM_FORMAT_S16_LE:
	case SNDRV_PCM_FORMAT_U16_LE:
		return SRC_SF_S16;
	case SNDRV_PCM_FORMAT_S24_3LE:
		return SRC_SF_S24;
	case SNDRV_PCM_FORMAT_S24_LE:
	case SNDRV_PCM_FORMAT_S32_LE:
		return SRC_SF_S32;
	case SNDRV_PCM_FORMAT_FLOAT_LE:
		return SRC_SF_F32;
	default:
		printk(KERN_ERR "ctxfi: not recognized snd format is %d \n",
			snd_format);
@@ -264,6 +253,9 @@ static int atc_pcm_playback_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm)
		return 0;
	}

	/* first release old resources */
	atc->pcm_release_resources(atc, apcm);

	/* Get SRC resource */
	desc.multi = apcm->substream->runtime->channels;
	desc.msr = atc->msr;
@@ -506,6 +498,9 @@ atc_pcm_capture_get_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm)
	int n_srcimp = 0, n_amixer = 0, n_srcc = 0, n_sum = 0;
	struct src_node_conf_t src_node_conf[2] = {{0} };

	/* first release old resources */
	atc->pcm_release_resources(atc, apcm);

	/* The numbers of converting SRCs and SRCIMPs should be determined
	 * by pitch value. */

@@ -777,6 +772,9 @@ static int spdif_passthru_playback_get_resources(struct ct_atc *atc,
	int n_amixer = apcm->substream->runtime->channels, i = 0;
	unsigned int pitch = 0, rsr = atc->pll_rate;

	/* first release old resources */
	atc->pcm_release_resources(atc, apcm);

	/* Get SRC resource */
	desc.multi = apcm->substream->runtime->channels;
	desc.msr = 1;
@@ -1562,7 +1560,6 @@ int ct_atc_create(struct snd_card *card, struct pci_dev *pci,
	atc_set_ops(atc);

	spin_lock_init(&atc->atc_lock);
	spin_lock_init(&atc->vm_lock);

	/* Find card model */
	err = atc_identify_card(atc);
+2 −3
Original line number Diff line number Diff line
@@ -29,9 +29,9 @@

enum CTALSADEVS {		/* Types of alsa devices */
	FRONT,
	REAR,
	CLFE,
	SURROUND,
	CLFE,
	SIDE,
	IEC958,
	MIXER,
	NUM_CTALSADEVS		/* This should always be the last */
@@ -101,7 +101,6 @@ struct ct_atc {
	unsigned long (*get_ptp_phys)(struct ct_atc *atc, int index);

	spinlock_t atc_lock;
	spinlock_t vm_lock;

	int (*pcm_playback_prepare)(struct ct_atc *atc,
				    struct ct_atc_pcm *apcm);
+6 −10
Original line number Diff line number Diff line
@@ -1249,18 +1249,14 @@ static int hw_trn_init(struct hw *hw, const struct trn_conf *info)
	}

	trnctl = 0x13;  /* 32-bit, 4k-size page */
#if BITS_PER_LONG == 64
	ptp_phys_low = info->vm_pgt_phys & ((1UL<<32)-1);
	ptp_phys_high = (info->vm_pgt_phys>>32) & ((1UL<<32)-1);
	ptp_phys_low = (u32)info->vm_pgt_phys;
	ptp_phys_high = upper_32_bits(info->vm_pgt_phys);
	if (sizeof(void *) == 8) /* 64bit address */
		trnctl |= (1 << 2);
#elif BITS_PER_LONG == 32
	ptp_phys_low = info->vm_pgt_phys & (~0UL);
	ptp_phys_high = 0;
#else
#	error "Unknown BITS_PER_LONG!"
#endif
#if 0 /* Only 4k h/w pages for simplicitiy */
#if PAGE_SIZE == 8192
	trnctl |= (1<<5);
#endif
#endif
	hw_write_20kx(hw, PTPALX, ptp_phys_low);
	hw_write_20kx(hw, PTPAHX, ptp_phys_high);
+4 −13
Original line number Diff line number Diff line
@@ -1203,19 +1203,10 @@ static int hw_trn_init(struct hw *hw, const struct trn_conf *info)
	}

	vmctl = 0x80000C0F;  /* 32-bit, 4k-size page */
#if BITS_PER_LONG == 64
	ptp_phys_low = info->vm_pgt_phys & ((1UL<<32)-1);
	ptp_phys_high = (info->vm_pgt_phys>>32) & ((1UL<<32)-1);
	ptp_phys_low = (u32)info->vm_pgt_phys;
	ptp_phys_high = upper_32_bits(info->vm_pgt_phys);
	if (sizeof(void *) == 8) /* 64bit address */
		vmctl |= (3 << 8);
#elif BITS_PER_LONG == 32
	ptp_phys_low = info->vm_pgt_phys & (~0UL);
	ptp_phys_high = 0;
#else
#	error "Unknown BITS_PER_LONG!"
#endif
#if PAGE_SIZE == 8192
#	error "Don't support 8k-page!"
#endif
	/* Write page table physical address to all PTPAL registers */
	for (i = 0; i < 64; i++) {
		hw_write_20kx(hw, VMEM_PTPAL+(16*i), ptp_phys_low);
Loading