summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>2018-12-07 18:50:05 -0500
committerMark Brown <broonie@kernel.org>2018-12-13 10:35:48 -0500
commitfa11ab5688f744bc868356f3f14c3bb9f283a780 (patch)
treedaaa9d8e5c4caa23b71bf4a57c783a8ebc8b1e6f /sound
parentc746de8dbc7b0ae9df491f7a99a6dab34203b51b (diff)
ASoC: Intel: Skylake: stop probe if HDaudio capabilities don't exist
Check immediately if required HDaudio capabilities can't be found (no PPCAP or no streams exposed in GCAP), and move all DMA inits after the error tests. PPCAP and GCAP are not reliable indicators of DSP presence, but if they don't exist then the driver will not work. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/intel/skylake/skl.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index 41a084b3d48f..72e366bbba33 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -946,6 +946,12 @@ static int skl_first_init(struct hdac_bus *bus)
946 946
947 snd_hdac_bus_parse_capabilities(bus); 947 snd_hdac_bus_parse_capabilities(bus);
948 948
949 /* check if PPCAP exists */
950 if (!bus->ppcap) {
951 dev_err(bus->dev, "bus ppcap not set, HDaudio or DSP not present?\n");
952 return -ENODEV;
953 }
954
949 if (skl_acquire_irq(bus, 0) < 0) 955 if (skl_acquire_irq(bus, 0) < 0)
950 return -EBUSY; 956 return -EBUSY;
951 957
@@ -955,23 +961,25 @@ static int skl_first_init(struct hdac_bus *bus)
955 gcap = snd_hdac_chip_readw(bus, GCAP); 961 gcap = snd_hdac_chip_readw(bus, GCAP);
956 dev_dbg(bus->dev, "chipset global capabilities = 0x%x\n", gcap); 962 dev_dbg(bus->dev, "chipset global capabilities = 0x%x\n", gcap);
957 963
958 /* allow 64bit DMA address if supported by H/W */
959 if (!dma_set_mask(bus->dev, DMA_BIT_MASK(64))) {
960 dma_set_coherent_mask(bus->dev, DMA_BIT_MASK(64));
961 } else {
962 dma_set_mask(bus->dev, DMA_BIT_MASK(32));
963 dma_set_coherent_mask(bus->dev, DMA_BIT_MASK(32));
964 }
965
966 /* read number of streams from GCAP register */ 964 /* read number of streams from GCAP register */
967 cp_streams = (gcap >> 8) & 0x0f; 965 cp_streams = (gcap >> 8) & 0x0f;
968 pb_streams = (gcap >> 12) & 0x0f; 966 pb_streams = (gcap >> 12) & 0x0f;
969 967
970 if (!pb_streams && !cp_streams) 968 if (!pb_streams && !cp_streams) {
969 dev_err(bus->dev, "no streams found in GCAP definitions?\n");
971 return -EIO; 970 return -EIO;
971 }
972 972
973 bus->num_streams = cp_streams + pb_streams; 973 bus->num_streams = cp_streams + pb_streams;
974 974
975 /* allow 64bit DMA address if supported by H/W */
976 if (!dma_set_mask(bus->dev, DMA_BIT_MASK(64))) {
977 dma_set_coherent_mask(bus->dev, DMA_BIT_MASK(64));
978 } else {
979 dma_set_mask(bus->dev, DMA_BIT_MASK(32));
980 dma_set_coherent_mask(bus->dev, DMA_BIT_MASK(32));
981 }
982
975 /* initialize streams */ 983 /* initialize streams */
976 snd_hdac_ext_stream_init_all 984 snd_hdac_ext_stream_init_all
977 (bus, 0, cp_streams, SNDRV_PCM_STREAM_CAPTURE); 985 (bus, 0, cp_streams, SNDRV_PCM_STREAM_CAPTURE);