View | Details | Raw Unified | Return to bug 195303 | Differences between
and this patch

Collapse All | Expand All

(-)a/sound/hda/hdac_stream.c (-5 / +1 lines)
Lines 229-239 int snd_hdac_stream_setup(struct hdac_stream *azx_dev) Link Here
229
	/* set the interrupt enable bits in the descriptor control register */
229
	/* set the interrupt enable bits in the descriptor control register */
230
	snd_hdac_stream_updatel(azx_dev, SD_CTL, 0, SD_INT_MASK);
230
	snd_hdac_stream_updatel(azx_dev, SD_CTL, 0, SD_INT_MASK);
231
231
232
	if (azx_dev->direction == SNDRV_PCM_STREAM_PLAYBACK)
232
	azx_dev->fifo_size = snd_hdac_stream_readw(azx_dev, SD_FIFOSIZE) + 1;
233
		azx_dev->fifo_size =
234
			snd_hdac_stream_readw(azx_dev, SD_FIFOSIZE) + 1;
235
	else
236
		azx_dev->fifo_size = 0;
237
233
238
	/* when LPIB delay correction gives a small negative value,
234
	/* when LPIB delay correction gives a small negative value,
239
	 * we ignore it; currently set the threshold statically to
235
	 * we ignore it; currently set the threshold statically to
(-)a/sound/pci/hda/hda_intel.c (+43 lines)
Lines 64-69 enum { Link Here
64
	POS_FIX_VIACOMBO,
64
	POS_FIX_VIACOMBO,
65
	POS_FIX_COMBO,
65
	POS_FIX_COMBO,
66
	POS_FIX_SKL,
66
	POS_FIX_SKL,
67
	POS_FIX_AMD,
67
};
68
};
68
69
69
/* Defines for ATI HD Audio support in SB450 south bridge */
70
/* Defines for ATI HD Audio support in SB450 south bridge */
Lines 258-263 enum { Link Here
258
	AZX_DRIVER_ATI,
259
	AZX_DRIVER_ATI,
259
	AZX_DRIVER_ATIHDMI,
260
	AZX_DRIVER_ATIHDMI,
260
	AZX_DRIVER_ATIHDMI_NS,
261
	AZX_DRIVER_ATIHDMI_NS,
262
	AZX_DRIVER_AMD,
261
	AZX_DRIVER_VIA,
263
	AZX_DRIVER_VIA,
262
	AZX_DRIVER_SIS,
264
	AZX_DRIVER_SIS,
263
	AZX_DRIVER_ULI,
265
	AZX_DRIVER_ULI,
Lines 371-376 static char *driver_short_names[] = { Link Here
371
	[AZX_DRIVER_ATI] = "HDA ATI SB",
373
	[AZX_DRIVER_ATI] = "HDA ATI SB",
372
	[AZX_DRIVER_ATIHDMI] = "HDA ATI HDMI",
374
	[AZX_DRIVER_ATIHDMI] = "HDA ATI HDMI",
373
	[AZX_DRIVER_ATIHDMI_NS] = "HDA ATI HDMI",
375
	[AZX_DRIVER_ATIHDMI_NS] = "HDA ATI HDMI",
376
	[AZX_DRIVER_AMD] = "HD-Audio Generic",  /* kept old name for compatibility */
374
	[AZX_DRIVER_VIA] = "HDA VIA VT82xx",
377
	[AZX_DRIVER_VIA] = "HDA VIA VT82xx",
375
	[AZX_DRIVER_SIS] = "HDA SIS966",
378
	[AZX_DRIVER_SIS] = "HDA SIS966",
376
	[AZX_DRIVER_ULI] = "HDA ULI M5461",
379
	[AZX_DRIVER_ULI] = "HDA ULI M5461",
Lines 841-846 static unsigned int azx_via_get_position(struct azx *chip, Link Here
841
	return bound_pos + mod_dma_pos;
844
	return bound_pos + mod_dma_pos;
842
}
845
}
843
846
847
/* get the current DMA position with correction on AMD chips */
848
static unsigned int azx_get_pos_amd(struct azx *chip, struct azx_dev *azx_dev)
849
{
850
	unsigned int link_pos, fifo_size;
851
852
	link_pos = snd_hdac_stream_get_pos_lpib(azx_stream(azx_dev));
853
854
#if 0 /* FIXME: do we need a correction for playback, too? */
855
	if (azx_dev->core.substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
856
		return link_pos;
857
#endif
858
859
#if 1 /* FIXME: is this reliably readable on AMD platform (and correct?) */
860
	fifo_size = readw(azx_bus(chip)->remap_addr +
861
			  VIA_IN_STREAM0_FIFO_SIZE_OFFSET);
862
#else /* FIXME: ... or better to use fifo_size per stream? */
863
	fifo_size = azx_dev->core.fifo_size;
864
#endif
865
866
	if (azx_dev->insufficient) {
867
		if (link_pos <= fifo_size)
868
			return 0;
869
		azx_dev->insufficient = 0;
870
	}
871
872
	if (link_pos < fifo_size)
873
		link_pos += azx_dev->core.bufsize;
874
	link_pos -= fifo_size;
875
	return link_pos;
876
}
877
844
static unsigned int azx_skl_get_dpib_pos(struct azx *chip,
878
static unsigned int azx_skl_get_dpib_pos(struct azx *chip,
845
					 struct azx_dev *azx_dev)
879
					 struct azx_dev *azx_dev)
846
{
880
{
Lines 1417-1422 static int check_position_fix(struct azx *chip, int fix) Link Here
1417
	case POS_FIX_VIACOMBO:
1451
	case POS_FIX_VIACOMBO:
1418
	case POS_FIX_COMBO:
1452
	case POS_FIX_COMBO:
1419
	case POS_FIX_SKL:
1453
	case POS_FIX_SKL:
1454
	case POS_FIX_AMD:
1420
		return fix;
1455
		return fix;
1421
	}
1456
	}
1422
1457
Lines 1432-1437 static int check_position_fix(struct azx *chip, int fix) Link Here
1432
	if (chip->driver_type == AZX_DRIVER_VIA) {
1467
	if (chip->driver_type == AZX_DRIVER_VIA) {
1433
		dev_dbg(chip->card->dev, "Using VIACOMBO position fix\n");
1468
		dev_dbg(chip->card->dev, "Using VIACOMBO position fix\n");
1434
		return POS_FIX_VIACOMBO;
1469
		return POS_FIX_VIACOMBO;
1470
	} else if (chip->driver_type == AZX_DRIVER_AMD) {
1471
		dev_dbg(chip->card->dev, "Using AMD position fix\n");
1472
		return POS_FIX_AMD;
1435
	}
1473
	}
1436
	if (chip->driver_caps & AZX_DCAPS_POSFIX_LPIB) {
1474
	if (chip->driver_caps & AZX_DCAPS_POSFIX_LPIB) {
1437
		dev_dbg(chip->card->dev, "Using LPIB position fix\n");
1475
		dev_dbg(chip->card->dev, "Using LPIB position fix\n");
Lines 1453-1458 static void assign_position_fix(struct azx *chip, int fix) Link Here
1453
		[POS_FIX_VIACOMBO] = azx_via_get_position,
1491
		[POS_FIX_VIACOMBO] = azx_via_get_position,
1454
		[POS_FIX_COMBO] = azx_get_pos_lpib,
1492
		[POS_FIX_COMBO] = azx_get_pos_lpib,
1455
		[POS_FIX_SKL] = azx_get_pos_skl,
1493
		[POS_FIX_SKL] = azx_get_pos_skl,
1494
		[POS_FIX_AMD] = azx_get_pos_amd,
1456
	};
1495
	};
1457
1496
1458
	chip->get_position[0] = chip->get_position[1] = callbacks[fix];
1497
	chip->get_position[0] = chip->get_position[1] = callbacks[fix];
Lines 2447-2452 static const struct pci_device_id azx_ids[] = { Link Here
2447
	/* AMD Hudson */
2486
	/* AMD Hudson */
2448
	{ PCI_DEVICE(0x1022, 0x780d),
2487
	{ PCI_DEVICE(0x1022, 0x780d),
2449
	  .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB },
2488
	  .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB },
2489
	/* AMD X370 */
2490
	{ PCI_DEVICE(0x1022, 0x1457),
2491
	  .driver_data = AZX_DRIVER_AMD | AZX_DCAPS_PRESET_ATI_SB |
2492
			 AZX_DCAPS_PM_RUNTIME },
2450
	/* AMD Stoney */
2493
	/* AMD Stoney */
2451
	{ PCI_DEVICE(0x1022, 0x157a),
2494
	{ PCI_DEVICE(0x1022, 0x157a),
2452
	  .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB |
2495
	  .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB |

Return to bug 195303