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

Commit 2214482c authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
  ALSA: emu10k1: allow high-resolution mixer controls
  ALSA: pcm: fix delta calculation at boundary wraparound
  ALSA: hda_intel: fix handling of non-completion stream interrupts
  ALSA: usb/caiaq: fix Traktor Kontrol X1 ABS_HAT2X axis
  ALSA: hda: Fix model quirk for Dell M1730
  ALSA: hda - iMac9,1 sound fixes
  ALSA: hda: Use LPIB for Toshiba A100-259
  ALSA: hda: Use LPIB for Acer Aspire 5110
  ALSA: aw2-alsa.c: use pci_ids.h defines and fix checkpatch.pl noise
  ALSA: usb-audio: add support for Akai MPD16
  ALSA: pcm: fix the fix of the runtime->boundary calculation
parents 13da9e20 d2192121
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -345,7 +345,9 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
		new_hw_ptr = hw_base + pos;
	}
      __delta:
	delta = (new_hw_ptr - old_hw_ptr) % runtime->boundary;
	delta = new_hw_ptr - old_hw_ptr;
	if (delta < 0)
		delta += runtime->boundary;
	if (xrun_debug(substream, in_interrupt ?
			XRUN_DEBUG_PERIODUPDATE : XRUN_DEBUG_HWPTRUPDATE)) {
		char name[16];
@@ -439,8 +441,13 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
		snd_pcm_playback_silence(substream, new_hw_ptr);

	if (in_interrupt) {
		runtime->hw_ptr_interrupt = new_hw_ptr -
				(new_hw_ptr % runtime->period_size);
		delta = new_hw_ptr - runtime->hw_ptr_interrupt;
		if (delta < 0)
			delta += runtime->boundary;
		delta -= (snd_pcm_uframes_t)delta % runtime->period_size;
		runtime->hw_ptr_interrupt += delta;
		if (runtime->hw_ptr_interrupt >= runtime->boundary)
			runtime->hw_ptr_interrupt -= runtime->boundary;
	}
	runtime->hw_ptr_base = hw_base;
	runtime->status->hw_ptr = new_hw_ptr;
+3 −36
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@
#include <linux/pm_qos_params.h>
#include <linux/uio.h>
#include <linux/dma-mapping.h>
#include <linux/math64.h>
#include <sound/core.h>
#include <sound/control.h>
#include <sound/info.h>
@@ -370,38 +369,6 @@ static int period_to_usecs(struct snd_pcm_runtime *runtime)
	return usecs;
}

static int calc_boundary(struct snd_pcm_runtime *runtime)
{
	u_int64_t boundary;

	boundary = (u_int64_t)runtime->buffer_size *
		   (u_int64_t)runtime->period_size;
#if BITS_PER_LONG < 64
	/* try to find lowest common multiple for buffer and period */
	if (boundary > LONG_MAX - runtime->buffer_size) {
		u_int32_t remainder = -1;
		u_int32_t divident = runtime->buffer_size;
		u_int32_t divisor = runtime->period_size;
		while (remainder) {
			remainder = divident % divisor;
			if (remainder) {
				divident = divisor;
				divisor = remainder;
			}
		}
		boundary = div_u64(boundary, divisor);
		if (boundary > LONG_MAX - runtime->buffer_size)
			return -ERANGE;
	}
#endif
	if (boundary == 0)
		return -ERANGE;
	runtime->boundary = boundary;
	while (runtime->boundary * 2 <= LONG_MAX - runtime->buffer_size)
		runtime->boundary *= 2;
	return 0;
}

static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
			     struct snd_pcm_hw_params *params)
{
@@ -477,9 +444,9 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
	runtime->stop_threshold = runtime->buffer_size;
	runtime->silence_threshold = 0;
	runtime->silence_size = 0;
	err = calc_boundary(runtime);
	if (err < 0)
		goto _error;
	runtime->boundary = runtime->buffer_size;
	while (runtime->boundary * 2 <= LONG_MAX - runtime->buffer_size)
		runtime->boundary *= 2;

	snd_pcm_timer_resolution_change(substream);
	runtime->status->state = SNDRV_PCM_STATE_SETUP;
+4 −7
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <asm/io.h>
#include <linux/io.h>
#include <sound/core.h>
#include <sound/initval.h>
#include <sound/pcm.h>
@@ -44,9 +44,6 @@ MODULE_LICENSE("GPL");
/*********************************
 * DEFINES
 ********************************/
#define PCI_VENDOR_ID_SAA7146		  0x1131
#define PCI_DEVICE_ID_SAA7146		  0x7146

#define CTL_ROUTE_ANALOG 0
#define CTL_ROUTE_DIGITAL 1

@@ -165,7 +162,7 @@ module_param_array(enable, bool, NULL, 0444);
MODULE_PARM_DESC(enable, "Enable Audiowerk2 soundcard.");

static DEFINE_PCI_DEVICE_TABLE(snd_aw2_ids) = {
	{PCI_VENDOR_ID_SAA7146, PCI_DEVICE_ID_SAA7146, 0, 0,
	{PCI_VENDOR_ID_PHILIPS, PCI_DEVICE_ID_PHILIPS_SAA7146, 0, 0,
	 0, 0, 0},
	{0}
};
+28 −8
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
#include <linux/vmalloc.h>
#include <linux/init.h>
#include <linux/mutex.h>
#include <linux/moduleparam.h>

#include <sound/core.h>
#include <sound/tlv.h>
@@ -50,6 +51,10 @@
#define EMU10K1_CENTER_LFE_FROM_FRONT
#endif

static bool high_res_gpr_volume;
module_param(high_res_gpr_volume, bool, 0444);
MODULE_PARM_DESC(high_res_gpr_volume, "GPR mixer controls use 31-bit range.");

/*
 *  Tables
 */ 
@@ -296,6 +301,7 @@ static const u32 db_table[101] = {

/* EMU10k1/EMU10k2 DSP control db gain */
static const DECLARE_TLV_DB_SCALE(snd_emu10k1_db_scale1, -4000, 40, 1);
static const DECLARE_TLV_DB_LINEAR(snd_emu10k1_db_linear, TLV_DB_GAIN_MUTE, 0);

static const u32 onoff_table[2] = {
	0x00000000, 0x00000001
@@ -1072,11 +1078,18 @@ snd_emu10k1_init_mono_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
	strcpy(ctl->id.name, name);
	ctl->vcount = ctl->count = 1;
	ctl->gpr[0] = gpr + 0; ctl->value[0] = defval;
	if (high_res_gpr_volume) {
		ctl->min = 0;
		ctl->max = 0x7fffffff;
		ctl->tlv = snd_emu10k1_db_linear;
		ctl->translation = EMU10K1_GPR_TRANSLATION_NONE;
	} else {
		ctl->min = 0;
		ctl->max = 100;
		ctl->tlv = snd_emu10k1_db_scale1;
		ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100;
	}
}

static void __devinit
snd_emu10k1_init_stereo_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
@@ -1087,11 +1100,18 @@ snd_emu10k1_init_stereo_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
	ctl->vcount = ctl->count = 2;
	ctl->gpr[0] = gpr + 0; ctl->value[0] = defval;
	ctl->gpr[1] = gpr + 1; ctl->value[1] = defval;
	if (high_res_gpr_volume) {
		ctl->min = 0;
		ctl->max = 0x7fffffff;
		ctl->tlv = snd_emu10k1_db_linear;
		ctl->translation = EMU10K1_GPR_TRANSLATION_NONE;
	} else {
		ctl->min = 0;
		ctl->max = 100;
		ctl->tlv = snd_emu10k1_db_scale1;
		ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100;
	}
}

static void __devinit
snd_emu10k1_init_mono_onoff_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
+7 −2
Original line number Diff line number Diff line
@@ -1097,6 +1097,7 @@ static irqreturn_t azx_interrupt(int irq, void *dev_id)
	struct azx *chip = dev_id;
	struct azx_dev *azx_dev;
	u32 status;
	u8 sd_status;
	int i, ok;

	spin_lock(&chip->reg_lock);
@@ -1110,8 +1111,10 @@ static irqreturn_t azx_interrupt(int irq, void *dev_id)
	for (i = 0; i < chip->num_streams; i++) {
		azx_dev = &chip->azx_dev[i];
		if (status & azx_dev->sd_int_sta_mask) {
			sd_status = azx_sd_readb(azx_dev, SD_STS);
			azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK);
			if (!azx_dev->substream || !azx_dev->running)
			if (!azx_dev->substream || !azx_dev->running ||
			    !(sd_status & SD_INT_COMPLETE))
				continue;
			/* check whether this IRQ is really acceptable */
			ok = azx_position_ok(chip, azx_dev);
@@ -2279,12 +2282,14 @@ static int azx_dev_free(struct snd_device *device)
 * white/black-listing for position_fix
 */
static struct snd_pci_quirk position_fix_list[] __devinitdata = {
	SND_PCI_QUIRK(0x1025, 0x009f, "Acer Aspire 5110", POS_FIX_LPIB),
	SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB),
	SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB),
	SND_PCI_QUIRK(0x1028, 0x01f6, "Dell Latitude 131L", POS_FIX_LPIB),
	SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB),
	SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB),
	SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB),
	SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB),
	SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba A100-259", POS_FIX_LPIB),
	SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB),
	SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB),
	SND_PCI_QUIRK(0x1565, 0x820f, "Biostar Microtech", POS_FIX_LPIB),
Loading