diff options
author | Angel Pons <th3fanbus@gmail.com> | 2021-03-18 15:43:42 +0100 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2021-03-24 07:54:46 +0000 |
commit | 6da78660d055e7fdd7af07e824433921b500437b (patch) | |
tree | 68eaa2865b1364fcb5d31bbbc4cd6252f54f7229 /src | |
parent | fa1befcb575c30f59d8622547974c92cde92eb98 (diff) |
device/azalia_device.c: Correct STATESTS access width
The HD Audio spec states that the STATESTS register is 16 bits wide.
Change-Id: If7859ed33e58d907a91c4ac8675892e37998cf41
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/50790
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Diffstat (limited to 'src')
-rw-r--r-- | src/device/azalia_device.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/device/azalia_device.c b/src/device/azalia_device.c index a0b8d5f5be..1048804add 100644 --- a/src/device/azalia_device.c +++ b/src/device/azalia_device.c @@ -47,18 +47,18 @@ int azalia_exit_reset(u8 *base) return azalia_set_bits(base + HDA_GCTL_REG, HDA_GCTL_CRST, HDA_GCTL_CRST); } -static int codec_detect(u8 *base) +static u16 codec_detect(u8 *base) { struct stopwatch sw; - u32 reg32; + u16 reg16; if (azalia_exit_reset(base) < 0) goto no_codec; /* clear STATESTS bits (BAR + 0xe)[2:0] */ - reg32 = read32(base + HDA_STATESTS_REG); - reg32 |= 7; - write32(base + HDA_STATESTS_REG, reg32); + reg16 = read16(base + HDA_STATESTS_REG); + reg16 |= 7; + write16(base + HDA_STATESTS_REG, reg16); /* Wait for readback of register to * match what was just written to it @@ -67,8 +67,8 @@ static int codec_detect(u8 *base) do { /* Wait 1ms based on BKDG wait time */ mdelay(1); - reg32 = read32(base + HDA_STATESTS_REG); - } while ((reg32 != 0) && !stopwatch_expired(&sw)); + reg16 = read16(base + HDA_STATESTS_REG); + } while ((reg16 != 0) && !stopwatch_expired(&sw)); /* Timeout occurred */ if (stopwatch_expired(&sw)) @@ -81,12 +81,12 @@ static int codec_detect(u8 *base) goto no_codec; /* Read in Codec location (BAR + 0xe)[2..0] */ - reg32 = read32(base + HDA_STATESTS_REG); - reg32 &= 0x0f; - if (!reg32) + reg16 = read16(base + HDA_STATESTS_REG); + reg16 &= 0x0f; + if (!reg16) goto no_codec; - return reg32; + return reg16; no_codec: /* Codec Not found */ @@ -261,7 +261,7 @@ static void codec_init(struct device *dev, u8 *base, int addr) mainboard_azalia_program_runtime_verbs(base, reg32); } -static void codecs_init(struct device *dev, u8 *base, u32 codec_mask) +static void codecs_init(struct device *dev, u8 *base, u16 codec_mask) { int i; @@ -275,7 +275,7 @@ void azalia_audio_init(struct device *dev) { u8 *base; struct resource *res; - u32 codec_mask; + u16 codec_mask; res = find_resource(dev, PCI_BASE_ADDRESS_0); if (!res) |