Skip to content

Commit aa31704

Browse files
Conmanx360tiwai
authored andcommitted
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>
1 parent 63177af commit aa31704

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

sound/pci/hda/patch_ca0132.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
#include <linux/module.h>
2929
#include <linux/firmware.h>
3030
#include <linux/kernel.h>
31+
#include <linux/types.h>
32+
#include <linux/io.h>
33+
#include <linux/pci.h>
3134
#include <sound/core.h>
3235
#include "hda_codec.h"
3336
#include "hda_local.h"
@@ -764,6 +767,11 @@ struct ca0132_spec {
764767
#ifdef ENABLE_TUNING_CONTROLS
765768
long cur_ctl_vals[TUNING_CTLS_COUNT];
766769
#endif
770+
/*
771+
* Sound Blaster Z PCI region 2 iomem, used for input and output
772+
* switching, and other unknown commands.
773+
*/
774+
void __iomem *mem_base;
767775
};
768776

769777
/*
@@ -4700,6 +4708,8 @@ static void ca0132_free(struct hda_codec *codec)
47004708
snd_hda_sequence_write(codec, spec->base_exit_verbs);
47014709
ca0132_exit_chip(codec);
47024710
snd_hda_power_down(codec);
4711+
if (spec->mem_base)
4712+
iounmap(spec->mem_base);
47034713
kfree(spec->spec_init_verbs);
47044714
kfree(codec->spec);
47054715
}
@@ -4915,6 +4925,15 @@ static int patch_ca0132(struct hda_codec *codec)
49154925
else
49164926
spec->quirk = QUIRK_NONE;
49174927

4928+
/* Setup BAR Region 2 for Sound Blaster Z */
4929+
if (spec->quirk == QUIRK_SBZ) {
4930+
spec->mem_base = pci_iomap(codec->bus->pci, 2, 0xC20);
4931+
if (spec->mem_base == NULL) {
4932+
codec_warn(codec, "pci_iomap failed!");
4933+
codec_info(codec, "perhaps this is not an SBZ?");
4934+
spec->quirk = QUIRK_NONE;
4935+
}
4936+
}
49184937
spec->dsp_state = DSP_DOWNLOAD_INIT;
49194938
spec->num_mixers = 1;
49204939
spec->mixers[0] = ca0132_mixer;

0 commit comments

Comments
 (0)