Felix Held submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Felix Held: Looks good to me, approved Arthur Heymans: Looks good to me, approved Tim Wawrzynczak: Looks good to me, approved
device/azalia_device.h: Rewrite verb macros

Introduce the `AZALIA_VERB_12B` macro to encode HDA commands with 12-bit
verb identifiers and rewrite existing helper macros to use it.

Tested with BUILD_TIMELESS=1, Purism Librem Mini remains identical.

Change-Id: I5b2418f6d2faf6d5ab424949d18784ca6d519799
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/58901
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
---
M src/include/device/azalia_device.h
1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/src/include/device/azalia_device.h b/src/include/device/azalia_device.h
index ca77350..18481fe 100644
--- a/src/include/device/azalia_device.h
+++ b/src/include/device/azalia_device.h
@@ -126,26 +126,27 @@
ARRAY_SIZE(pc_beep_verbs); \
const u32 cim_verb_data_size = sizeof(cim_verb_data)

-#define AZALIA_PIN_CFG(codec, pin, val) \
- (((codec) << 28) | ((pin) << 20) | (0x71c << 8) \
- | ((val) & 0xff)), \
- (((codec) << 28) | ((pin) << 20) | (0x71d << 8) \
- | (((val) >> 8) & 0xff)), \
- (((codec) << 28) | ((pin) << 20) | (0x71e << 8) \
- | (((val) >> 16) & 0xff)), \
- (((codec) << 28) | ((pin) << 20) | (0x71f << 8) \
- | (((val) >> 24) & 0xff))
+#define AZALIA_VERB_12B(codec, pin, verb, val) \
+ ((codec) << 28 | (pin) << 20 | (verb) << 8 | (val))
+
+#define AZALIA_PIN_CFG(codec, pin, val) \
+ AZALIA_VERB_12B(codec, pin, 0x71c, ((val) >> 0) & 0xff), \
+ AZALIA_VERB_12B(codec, pin, 0x71d, ((val) >> 8) & 0xff), \
+ AZALIA_VERB_12B(codec, pin, 0x71e, ((val) >> 16) & 0xff), \
+ AZALIA_VERB_12B(codec, pin, 0x71f, ((val) >> 24) & 0xff)

#define AZALIA_PIN_CFG_NC(n) (0x411111f0 | ((n) & 0xf))

-#define AZALIA_RESET(pin) \
- (((pin) << 20) | 0x7ff00), (((pin) << 20) | 0x7ff00), \
- (((pin) << 20) | 0x7ff00), (((pin) << 20) | 0x7ff00)
+#define AZALIA_RESET(pin) \
+ AZALIA_VERB_12B(0, pin, 0x7ff, 0), \
+ AZALIA_VERB_12B(0, pin, 0x7ff, 0), \
+ AZALIA_VERB_12B(0, pin, 0x7ff, 0), \
+ AZALIA_VERB_12B(0, pin, 0x7ff, 0)

-#define AZALIA_SUBVENDOR(codec, val) \
- (((codec) << 28) | (0x01720 << 8) | ((val) & 0xff)), \
- (((codec) << 28) | (0x01721 << 8) | (((val) >> 8) & 0xff)), \
- (((codec) << 28) | (0x01722 << 8) | (((val) >> 16) & 0xff)), \
- (((codec) << 28) | (0x01723 << 8) | (((val) >> 24) & 0xff))
+#define AZALIA_SUBVENDOR(codec, val) \
+ AZALIA_VERB_12B(codec, 1, 0x720, ((val) >> 0) & 0xff), \
+ AZALIA_VERB_12B(codec, 1, 0x721, ((val) >> 8) & 0xff), \
+ AZALIA_VERB_12B(codec, 1, 0x722, ((val) >> 16) & 0xff), \
+ AZALIA_VERB_12B(codec, 1, 0x723, ((val) >> 24) & 0xff)

#endif /* DEVICE_AZALIA_H */

To view, visit change 58901. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I5b2418f6d2faf6d5ab424949d18784ca6d519799
Gerrit-Change-Number: 58901
Gerrit-PatchSet: 2
Gerrit-Owner: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Felix Singer <felixsinger@posteo.net>
Gerrit-Reviewer: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-Reviewer: Felix Held <felix-coreboot@felixheld.de>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Patrick Rudolph <siro@das-labor.org>
Gerrit-Reviewer: Tim Wawrzynczak <twawrzynczak@chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged