Commit bf2aa9cc authored by Connor McAdams's avatar Connor McAdams Committed by Takashi Iwai

ALSA: hda/ca0132 - Cleanup ca0132_mmio_init function.

Cleanup the ca0132_mmio_init function, separating into two separate
functions, one for Sound Blaster Z/ZxR/Recon3D, and another for the
AE-5.
Signed-off-by: default avatarConnor McAdams <conmanx360@gmail.com>
Link: https://lore.kernel.org/r/20200825201040.30339-2-conmanx360@gmail.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 14b51ccd
...@@ -8108,78 +8108,118 @@ static void r3di_pre_dsp_setup(struct hda_codec *codec) ...@@ -8108,78 +8108,118 @@ static void r3di_pre_dsp_setup(struct hda_codec *codec)
* what they do, or if they're necessary. Could possibly * what they do, or if they're necessary. Could possibly
* be removed. Figure they're better to leave in. * be removed. Figure they're better to leave in.
*/ */
static void ca0132_mmio_init(struct hda_codec *codec) static const unsigned int ca0113_mmio_init_address_sbz[] = {
0x400, 0x408, 0x40c, 0x01c, 0xc0c, 0xc00, 0xc04, 0xc0c, 0xc0c, 0xc0c,
0xc0c, 0xc08, 0xc08, 0xc08, 0xc08, 0xc08, 0xc04
};
static const unsigned int ca0113_mmio_init_data_sbz[] = {
0x00000030, 0x00000000, 0x00000003, 0x00000003, 0x00000003,
0x00000003, 0x000000c1, 0x000000f1, 0x00000001, 0x000000c7,
0x000000c1, 0x00000080
};
static const unsigned int ca0113_mmio_init_data_zxr[] = {
0x00000030, 0x00000000, 0x00000000, 0x00000003, 0x00000003,
0x00000003, 0x00000001, 0x000000f1, 0x00000001, 0x000000c7,
0x000000c1, 0x00000080
};
static const unsigned int ca0113_mmio_init_address_ae5[] = {
0x400, 0x42c, 0x46c, 0x4ac, 0x4ec, 0x43c, 0x47c, 0x4bc, 0x4fc, 0x408,
0x100, 0x410, 0x40c, 0x100, 0x100, 0x830, 0x86c, 0x800, 0x86c, 0x800,
0x804, 0x20c, 0x01c, 0xc0c, 0xc00, 0xc04, 0xc0c, 0xc0c, 0xc0c, 0xc0c,
0xc08, 0xc08, 0xc08, 0xc08, 0xc08, 0xc04, 0x01c
};
static const unsigned int ca0113_mmio_init_data_ae5[] = {
0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
0x00000600, 0x00000014, 0x00000001, 0x0000060f, 0x0000070f,
0x00000aff, 0x00000000, 0x0000006b, 0x00000001, 0x0000006b,
0x00000057, 0x00800000, 0x00880680, 0x00000080, 0x00000030,
0x00000000, 0x00000000, 0x00000003, 0x00000003, 0x00000003,
0x00000001, 0x000000f1, 0x00000001, 0x000000c7, 0x000000c1,
0x00000080, 0x00880680
};
static void ca0132_mmio_init_sbz(struct hda_codec *codec)
{ {
struct ca0132_spec *spec = codec->spec; struct ca0132_spec *spec = codec->spec;
unsigned int tmp[2], i, count, cur_addr;
const unsigned int *addr, *data;
if (ca0132_quirk(spec) == QUIRK_AE5) addr = ca0113_mmio_init_address_sbz;
writel(0x00000001, spec->mem_base + 0x400); for (i = 0; i < 3; i++)
else writel(0x00000000, spec->mem_base + addr[i]);
writel(0x00000000, spec->mem_base + 0x400);
if (ca0132_quirk(spec) == QUIRK_AE5) cur_addr = i;
writel(0x00000001, spec->mem_base + 0x408); switch (ca0132_quirk(spec)) {
else case QUIRK_ZXR:
writel(0x00000000, spec->mem_base + 0x408); tmp[0] = 0x00880480;
tmp[1] = 0x00000080;
break;
case QUIRK_SBZ:
tmp[0] = 0x00820680;
tmp[1] = 0x00000083;
break;
case QUIRK_R3D:
tmp[0] = 0x00880680;
tmp[1] = 0x00000083;
break;
default:
tmp[0] = 0x00000000;
tmp[1] = 0x00000000;
break;
}
if (ca0132_quirk(spec) == QUIRK_AE5) for (i = 0; i < 2; i++)
writel(0x00000001, spec->mem_base + 0x40c); writel(tmp[i], spec->mem_base + addr[cur_addr + i]);
else
writel(0x00000000, spec->mem_base + 0x40C);
if (ca0132_quirk(spec) == QUIRK_ZXR) cur_addr += i;
writel(0x00880640, spec->mem_base + 0x01C);
else
writel(0x00880680, spec->mem_base + 0x01C);
if (ca0132_quirk(spec) == QUIRK_AE5) switch (ca0132_quirk(spec)) {
writel(0x00000080, spec->mem_base + 0xC0C); case QUIRK_ZXR:
else count = ARRAY_SIZE(ca0113_mmio_init_data_zxr);
writel(0x00000083, spec->mem_base + 0xC0C); data = ca0113_mmio_init_data_zxr;
break;
default:
count = ARRAY_SIZE(ca0113_mmio_init_data_sbz);
data = ca0113_mmio_init_data_sbz;
break;
}
writel(0x00000030, spec->mem_base + 0xC00); for (i = 0; i < count; i++)
writel(0x00000000, spec->mem_base + 0xC04); writel(data[i], spec->mem_base + addr[cur_addr + i]);
}
if (ca0132_quirk(spec) == QUIRK_AE5) static void ca0132_mmio_init_ae5(struct hda_codec *codec)
writel(0x00000000, spec->mem_base + 0xC0C); {
else struct ca0132_spec *spec = codec->spec;
writel(0x00000003, spec->mem_base + 0xC0C); const unsigned int *addr, *data;
unsigned int i, count;
writel(0x00000003, spec->mem_base + 0xC0C); addr = ca0113_mmio_init_address_ae5;
writel(0x00000003, spec->mem_base + 0xC0C); data = ca0113_mmio_init_data_ae5;
writel(0x00000003, spec->mem_base + 0xC0C); count = ARRAY_SIZE(ca0113_mmio_init_data_ae5);
if (ca0132_quirk(spec) == QUIRK_AE5) for (i = 0; i < count; i++)
writel(0x00000001, spec->mem_base + 0xC08); writel(data[i], spec->mem_base + addr[i]);
else }
writel(0x000000C1, spec->mem_base + 0xC08);
writel(0x000000F1, spec->mem_base + 0xC08); static void ca0132_mmio_init(struct hda_codec *codec)
writel(0x00000001, spec->mem_base + 0xC08); {
writel(0x000000C7, spec->mem_base + 0xC08); struct ca0132_spec *spec = codec->spec;
writel(0x000000C1, spec->mem_base + 0xC08);
writel(0x00000080, spec->mem_base + 0xC04);
if (ca0132_quirk(spec) == QUIRK_AE5) { switch (ca0132_quirk(spec)) {
writel(0x00000000, spec->mem_base + 0x42c); case QUIRK_R3D:
writel(0x00000000, spec->mem_base + 0x46c); case QUIRK_SBZ:
writel(0x00000000, spec->mem_base + 0x4ac); case QUIRK_ZXR:
writel(0x00000000, spec->mem_base + 0x4ec); ca0132_mmio_init_sbz(codec);
writel(0x00000000, spec->mem_base + 0x43c); break;
writel(0x00000000, spec->mem_base + 0x47c); case QUIRK_AE5:
writel(0x00000000, spec->mem_base + 0x4bc); ca0132_mmio_init_ae5(codec);
writel(0x00000000, spec->mem_base + 0x4fc); break;
writel(0x00000600, spec->mem_base + 0x100);
writel(0x00000014, spec->mem_base + 0x410);
writel(0x0000060f, spec->mem_base + 0x100);
writel(0x0000070f, spec->mem_base + 0x100);
writel(0x00000aff, spec->mem_base + 0x830);
writel(0x00000000, spec->mem_base + 0x86c);
writel(0x0000006b, spec->mem_base + 0x800);
writel(0x00000001, spec->mem_base + 0x86c);
writel(0x0000006b, spec->mem_base + 0x800);
writel(0x00000057, spec->mem_base + 0x804);
writel(0x00800000, spec->mem_base + 0x20c);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment