diff options
author | Connor McAdams <conmanx360@gmail.com> | 2018-05-08 19:20:03 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2018-05-13 09:29:27 +0200 |
commit | aa31704fd81c84f6a9e0b87f3455246936654ae6 (patch) | |
tree | b30e77dbbdc9c08bd724ff1c5b017fa82280992b /sound | |
parent | ALSA: hda/ca0132: Add pincfg for SBZ + R3Di, add fp hp auto-detect (diff) | |
download | linux-aa31704fd81c84f6a9e0b87f3455246936654ae6.tar.xz linux-aa31704fd81c84f6a9e0b87f3455246936654ae6.zip |
ALSA: hda/ca0132: Add PCI region2 iomap for SBZ
This patch adds iomapping for the region2 section of memory on the SBZ.
This memory region is used in later patches for setting inputs and
outputs. If the mapping fails, the quirk is changed back to QUIRK_NONE
to avoid attempts to write to uninitialized memory.
It also adds a new exit sequence to unmap the iomem for the SBZ.
[ Reordered linux/*.h inclusion in the patch by tiwai ]
Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/hda/patch_ca0132.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c index 6ca8bc4321d4..29772831e412 100644 --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c @@ -28,6 +28,9 @@ #include <linux/module.h> #include <linux/firmware.h> #include <linux/kernel.h> +#include <linux/types.h> +#include <linux/io.h> +#include <linux/pci.h> #include <sound/core.h> #include "hda_codec.h" #include "hda_local.h" @@ -764,6 +767,11 @@ struct ca0132_spec { #ifdef ENABLE_TUNING_CONTROLS long cur_ctl_vals[TUNING_CTLS_COUNT]; #endif + /* + * Sound Blaster Z PCI region 2 iomem, used for input and output + * switching, and other unknown commands. + */ + void __iomem *mem_base; }; /* @@ -4700,6 +4708,8 @@ static void ca0132_free(struct hda_codec *codec) snd_hda_sequence_write(codec, spec->base_exit_verbs); ca0132_exit_chip(codec); snd_hda_power_down(codec); + if (spec->mem_base) + iounmap(spec->mem_base); kfree(spec->spec_init_verbs); kfree(codec->spec); } @@ -4915,6 +4925,15 @@ static int patch_ca0132(struct hda_codec *codec) else spec->quirk = QUIRK_NONE; + /* Setup BAR Region 2 for Sound Blaster Z */ + if (spec->quirk == QUIRK_SBZ) { + spec->mem_base = pci_iomap(codec->bus->pci, 2, 0xC20); + if (spec->mem_base == NULL) { + codec_warn(codec, "pci_iomap failed!"); + codec_info(codec, "perhaps this is not an SBZ?"); + spec->quirk = QUIRK_NONE; + } + } spec->dsp_state = DSP_DOWNLOAD_INIT; spec->num_mixers = 1; spec->mixers[0] = ca0132_mixer; |