Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 42a0b318 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: ctxfi - Fix endian-dependent codes



The UAA-mode check in hwct20k1.c is implemented with the endian-dependent
codes.  Fix to be more portable (and readable).

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 6d74b86d
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -1785,6 +1785,8 @@ static int hw_have_digit_io_switch(struct hw *hw)
				|| ((subsys_id & 0xf000) == 0x6000));
}

#define CTLBITS(a, b, c, d)	(((a) << 24) | ((b) << 16) | ((c) << 8) | (d))

#define UAA_CFG_PWRSTATUS	0x44
#define UAA_CFG_SPACE_FLAG	0xA0
#define UAA_CORE_CHANGE		0x3FFC
@@ -1792,12 +1794,18 @@ static int uaa_to_xfi(struct pci_dev *pci)
{
	unsigned int bar0, bar1, bar2, bar3, bar4, bar5;
	unsigned int cmd, irq, cl_size, l_timer, pwr;
	unsigned int CTLA, CTLZ, CTLL, CTLX, CTL_, CTLF, CTLi;
	unsigned int is_uaa = 0;
	unsigned int data[4] = {0};
	unsigned int io_base;
	void *mem_base;
	int i = 0;
	const u32 CTLX = CTLBITS('C', 'T', 'L', 'X');
	const u32 CTL_ = CTLBITS('C', 'T', 'L', '-');
	const u32 CTLF = CTLBITS('C', 'T', 'L', 'F');
	const u32 CTLi = CTLBITS('C', 'T', 'L', 'i');
	const u32 CTLA = CTLBITS('C', 'T', 'L', 'A');
	const u32 CTLZ = CTLBITS('C', 'T', 'L', 'Z');
	const u32 CTLL = CTLBITS('C', 'T', 'L', 'L');

	/* By default, Hendrix card UAA Bar0 should be using memory... */
	io_base = pci_resource_start(pci, 0);
@@ -1805,14 +1813,6 @@ static int uaa_to_xfi(struct pci_dev *pci)
	if (NULL == mem_base)
		return -ENOENT;

	CTLX = ___constant_swab32(*((unsigned int *)"CTLX"));
	CTL_ = ___constant_swab32(*((unsigned int *)"CTL-"));
	CTLF = ___constant_swab32(*((unsigned int *)"CTLF"));
	CTLi = ___constant_swab32(*((unsigned int *)"CTLi"));
	CTLA = ___constant_swab32(*((unsigned int *)"CTLA"));
	CTLZ = ___constant_swab32(*((unsigned int *)"CTLZ"));
	CTLL = ___constant_swab32(*((unsigned int *)"CTLL"));

	/* Read current mode from Mode Change Register */
	for (i = 0; i < 4; i++)
		data[i] = readl(mem_base + UAA_CORE_CHANGE);