diff options
author | Guneshwor Singh <guneshwor.o.singh@intel.com> | 2016-08-04 06:16:03 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2016-08-09 02:53:56 -0400 |
commit | 50279d9b5facde811280afe13dd8c79f0e7b21ed (patch) | |
tree | 42bd30d815d8e3c67c4e96c41e38e083004445f8 | |
parent | 404735c9fd8adff8e5ad11e1f9f8db069d865698 (diff) |
ALSA - hda: Add support for parsing new HDA capabilities
Skylake onwards HDA controller supports new capabilities like
Global Time Stamping (GTS) capability. So add support to parse
these new capabilities.
Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com>
Signed-off-by: Hardik T Shah <hardik.t.shah@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | include/sound/hda_register.h | 36 | ||||
-rw-r--r-- | sound/pci/hda/hda_controller.c | 5 | ||||
-rw-r--r-- | sound/pci/hda/hda_controller.h | 3 | ||||
-rw-r--r-- | sound/pci/hda/hda_intel.c | 17 |
4 files changed, 61 insertions, 0 deletions
diff --git a/include/sound/hda_register.h b/include/sound/hda_register.h index ff1aecf325e8..0013063db7f2 100644 --- a/include/sound/hda_register.h +++ b/include/sound/hda_register.h | |||
@@ -89,6 +89,19 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; | |||
89 | #define AZX_REG_SD_BDLPL 0x18 | 89 | #define AZX_REG_SD_BDLPL 0x18 |
90 | #define AZX_REG_SD_BDLPU 0x1c | 90 | #define AZX_REG_SD_BDLPU 0x1c |
91 | 91 | ||
92 | /* GTS registers */ | ||
93 | #define AZX_REG_LLCH 0x14 | ||
94 | |||
95 | #define AZX_REG_GTS_BASE 0x520 | ||
96 | |||
97 | #define AZX_REG_GTSCC (AZX_REG_GTS_BASE + 0x00) | ||
98 | #define AZX_REG_WALFCC (AZX_REG_GTS_BASE + 0x04) | ||
99 | #define AZX_REG_TSCCL (AZX_REG_GTS_BASE + 0x08) | ||
100 | #define AZX_REG_TSCCU (AZX_REG_GTS_BASE + 0x0C) | ||
101 | #define AZX_REG_LLPFOC (AZX_REG_GTS_BASE + 0x14) | ||
102 | #define AZX_REG_LLPCL (AZX_REG_GTS_BASE + 0x18) | ||
103 | #define AZX_REG_LLPCU (AZX_REG_GTS_BASE + 0x1C) | ||
104 | |||
92 | /* Haswell/Broadwell display HD-A controller Extended Mode registers */ | 105 | /* Haswell/Broadwell display HD-A controller Extended Mode registers */ |
93 | #define AZX_REG_HSW_EM4 0x100c | 106 | #define AZX_REG_HSW_EM4 0x100c |
94 | #define AZX_REG_HSW_EM5 0x1010 | 107 | #define AZX_REG_HSW_EM5 0x1010 |
@@ -242,6 +255,29 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; | |||
242 | /* Interval used to calculate the iterating register offset */ | 255 | /* Interval used to calculate the iterating register offset */ |
243 | #define AZX_DRSM_INTERVAL 0x08 | 256 | #define AZX_DRSM_INTERVAL 0x08 |
244 | 257 | ||
258 | /* Global time synchronization registers */ | ||
259 | #define GTSCC_TSCCD_MASK 0x80000000 | ||
260 | #define GTSCC_TSCCD_SHIFT BIT(31) | ||
261 | #define GTSCC_TSCCI_MASK 0x20 | ||
262 | #define GTSCC_CDMAS_DMA_DIR_SHIFT 4 | ||
263 | |||
264 | #define WALFCC_CIF_MASK 0x1FF | ||
265 | #define WALFCC_FN_SHIFT 9 | ||
266 | #define HDA_CLK_CYCLES_PER_FRAME 512 | ||
267 | |||
268 | /* | ||
269 | * An error occurs near frame "rollover". The clocks in frame value indicates | ||
270 | * whether this error may have occurred. Here we use the value of 10. Please | ||
271 | * see the errata for the right number [<10] | ||
272 | */ | ||
273 | #define HDA_MAX_CYCLE_VALUE 499 | ||
274 | #define HDA_MAX_CYCLE_OFFSET 10 | ||
275 | #define HDA_MAX_CYCLE_READ_RETRY 10 | ||
276 | |||
277 | #define TSCCU_CCU_SHIFT 32 | ||
278 | #define LLPC_CCU_SHIFT 32 | ||
279 | |||
280 | |||
245 | /* | 281 | /* |
246 | * helpers to read the stream position | 282 | * helpers to read the stream position |
247 | */ | 283 | */ |
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c index 27de8015717d..1567fe209e01 100644 --- a/sound/pci/hda/hda_controller.c +++ b/sound/pci/hda/hda_controller.c | |||
@@ -412,6 +412,11 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) | |||
412 | goto unlock; | 412 | goto unlock; |
413 | } | 413 | } |
414 | runtime->private_data = azx_dev; | 414 | runtime->private_data = azx_dev; |
415 | |||
416 | if (chip->gts_present) | ||
417 | azx_pcm_hw.info = azx_pcm_hw.info | | ||
418 | SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME; | ||
419 | |||
415 | runtime->hw = azx_pcm_hw; | 420 | runtime->hw = azx_pcm_hw; |
416 | runtime->hw.channels_min = hinfo->channels_min; | 421 | runtime->hw.channels_min = hinfo->channels_min; |
417 | runtime->hw.channels_max = hinfo->channels_max; | 422 | runtime->hw.channels_max = hinfo->channels_max; |
diff --git a/sound/pci/hda/hda_controller.h b/sound/pci/hda/hda_controller.h index ec63bbf1ec6d..a50e0532622a 100644 --- a/sound/pci/hda/hda_controller.h +++ b/sound/pci/hda/hda_controller.h | |||
@@ -159,6 +159,9 @@ struct azx { | |||
159 | unsigned int region_requested:1; | 159 | unsigned int region_requested:1; |
160 | unsigned int disabled:1; /* disabled by vga_switcheroo */ | 160 | unsigned int disabled:1; /* disabled by vga_switcheroo */ |
161 | 161 | ||
162 | /* GTS present */ | ||
163 | unsigned int gts_present:1; | ||
164 | |||
162 | #ifdef CONFIG_SND_HDA_DSP_LOADER | 165 | #ifdef CONFIG_SND_HDA_DSP_LOADER |
163 | struct azx_dev saved_azx_dev; | 166 | struct azx_dev saved_azx_dev; |
164 | #endif | 167 | #endif |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 89dacf9b4e6c..4786f435eb64 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -54,6 +54,7 @@ | |||
54 | /* for snoop control */ | 54 | /* for snoop control */ |
55 | #include <asm/pgtable.h> | 55 | #include <asm/pgtable.h> |
56 | #include <asm/cacheflush.h> | 56 | #include <asm/cacheflush.h> |
57 | #include <asm/cpufeature.h> | ||
57 | #endif | 58 | #endif |
58 | #include <sound/core.h> | 59 | #include <sound/core.h> |
59 | #include <sound/initval.h> | 60 | #include <sound/initval.h> |
@@ -1655,6 +1656,22 @@ static int azx_first_init(struct azx *chip) | |||
1655 | return -ENXIO; | 1656 | return -ENXIO; |
1656 | } | 1657 | } |
1657 | 1658 | ||
1659 | if (IS_SKL_PLUS(pci)) | ||
1660 | snd_hdac_bus_parse_capabilities(bus); | ||
1661 | |||
1662 | /* | ||
1663 | * Some Intel CPUs has always running timer (ART) feature and | ||
1664 | * controller may have Global time sync reporting capability, so | ||
1665 | * check both of these before declaring synchronized time reporting | ||
1666 | * capability SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME | ||
1667 | */ | ||
1668 | chip->gts_present = false; | ||
1669 | |||
1670 | #ifdef CONFIG_X86 | ||
1671 | if (bus->ppcap && boot_cpu_has(X86_FEATURE_ART)) | ||
1672 | chip->gts_present = true; | ||
1673 | #endif | ||
1674 | |||
1658 | if (chip->msi) { | 1675 | if (chip->msi) { |
1659 | if (chip->driver_caps & AZX_DCAPS_NO_MSI64) { | 1676 | if (chip->driver_caps & AZX_DCAPS_NO_MSI64) { |
1660 | dev_dbg(card->dev, "Disabling 64bit MSI\n"); | 1677 | dev_dbg(card->dev, "Disabling 64bit MSI\n"); |