2020-04-02 23:48:27 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2013-08-12 14:07:47 +02:00
|
|
|
|
|
|
|
#ifndef DEVICE_AZALIA_H
|
|
|
|
#define DEVICE_AZALIA_H
|
|
|
|
|
2020-05-02 19:24:23 +02:00
|
|
|
#include <acpi/acpi.h>
|
2019-03-03 07:01:05 +01:00
|
|
|
#include <device/mmio.h>
|
2013-08-12 14:07:47 +02:00
|
|
|
#include <device/device.h>
|
2020-08-03 15:42:23 +02:00
|
|
|
#include <stdint.h>
|
2013-08-12 14:07:47 +02:00
|
|
|
|
2020-08-03 15:00:46 +02:00
|
|
|
#define HDA_GCAP_REG 0x00
|
|
|
|
#define HDA_GCTL_REG 0x08
|
|
|
|
#define HDA_GCTL_CRST (1 << 0)
|
|
|
|
#define HDA_STATESTS_REG 0x0e
|
|
|
|
#define HDA_IC_REG 0x60
|
|
|
|
#define HDA_IR_REG 0x64
|
|
|
|
#define HDA_ICII_REG 0x68
|
|
|
|
#define HDA_ICII_BUSY (1 << 0)
|
|
|
|
#define HDA_ICII_VALID (1 << 1)
|
|
|
|
|
2020-12-05 18:02:32 +01:00
|
|
|
int azalia_set_bits(void *port, u32 mask, u32 val);
|
2020-12-05 18:52:38 +01:00
|
|
|
int azalia_enter_reset(u8 *base);
|
|
|
|
int azalia_exit_reset(u8 *base);
|
2020-12-05 18:22:58 +01:00
|
|
|
u32 azalia_find_verb(const u32 *verb_table, u32 verb_table_bytes, u32 viddid, const u32 **verb);
|
2021-02-08 12:37:56 +01:00
|
|
|
int azalia_program_verb_table(u8 *base, const u32 *verbs, u32 verb_size);
|
2013-08-12 14:07:47 +02:00
|
|
|
void azalia_audio_init(struct device *dev);
|
|
|
|
extern struct device_operations default_azalia_audio_ops;
|
|
|
|
|
2021-02-08 12:47:29 +01:00
|
|
|
/* Optional hook to program codec settings that are only known at runtime */
|
|
|
|
void mainboard_azalia_program_runtime_verbs(u8 *base, u32 viddid);
|
|
|
|
|
2014-09-05 01:01:31 +02:00
|
|
|
extern const u32 cim_verb_data[];
|
|
|
|
extern const u32 cim_verb_data_size;
|
|
|
|
extern const u32 pc_beep_verbs[];
|
|
|
|
extern const u32 pc_beep_verbs_size;
|
|
|
|
|
2020-03-20 10:07:53 +01:00
|
|
|
enum azalia_pin_connection {
|
|
|
|
JACK = 0,
|
|
|
|
NC,
|
|
|
|
INTEGRATED,
|
|
|
|
JACK_AND_INTEGRATED,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum azalia_pin_color {
|
|
|
|
COLOR_UNKNOWN = 0,
|
|
|
|
BLACK,
|
|
|
|
GREY,
|
|
|
|
BLUE,
|
|
|
|
GREEN,
|
|
|
|
RED,
|
|
|
|
ORANGE,
|
|
|
|
YELLOW,
|
|
|
|
PURPLE,
|
|
|
|
PINK,
|
|
|
|
WHITE = 0xe,
|
|
|
|
COLOR_OTHER = 0xf,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum azalia_pin_type {
|
|
|
|
TYPE_UNKNOWN = 0,
|
|
|
|
STEREO_MONO_1_8,
|
|
|
|
STEREO_MONO_1_4,
|
|
|
|
ATAPI,
|
|
|
|
RCA,
|
2020-10-21 16:43:08 +02:00
|
|
|
OPTICAL,
|
2020-03-20 10:07:53 +01:00
|
|
|
OTHER_DIGITAL,
|
|
|
|
OTHER_ANALOG,
|
|
|
|
MULTICHANNEL_ANALOG,
|
|
|
|
XLR,
|
|
|
|
RJ_11,
|
|
|
|
COMBINATION,
|
|
|
|
TYPE_OTHER = 0xf
|
|
|
|
};
|
|
|
|
|
|
|
|
enum azalia_pin_device {
|
|
|
|
LINE_OUT = 0,
|
|
|
|
SPEAKER,
|
|
|
|
HP_OUT,
|
|
|
|
CD,
|
|
|
|
SPDIF_OUT,
|
|
|
|
DIGITAL_OTHER_OUT,
|
|
|
|
MODEM_LINE_SIDE,
|
|
|
|
MODEM_HANDSET_SIDE,
|
|
|
|
LINE_IN,
|
|
|
|
AUX,
|
|
|
|
MIC_IN,
|
|
|
|
TELEPHONY,
|
|
|
|
SPDIF_IN,
|
|
|
|
DIGITAL_OTHER_IN,
|
|
|
|
DEVICE_OTHER = 0xf,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum azalia_pin_location_1 {
|
|
|
|
NA = 0,
|
|
|
|
REAR,
|
|
|
|
FRONT,
|
|
|
|
LEFT,
|
|
|
|
RIGHT,
|
|
|
|
TOP,
|
|
|
|
BOTTOM,
|
|
|
|
SPECIAL7,
|
|
|
|
SPECIAL8,
|
|
|
|
SPECIAL9,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum azalia_pin_location_2 {
|
|
|
|
EXTERNAL_PRIMARY_CHASSIS = 0,
|
|
|
|
INTERNAL,
|
|
|
|
SEPARATE_CHASSIS,
|
|
|
|
LOCATION_OTHER
|
|
|
|
};
|
|
|
|
|
|
|
|
#define AZALIA_PIN_DESC(conn, location2, location1, dev, type, color, no_presence_detect, \
|
|
|
|
association, sequence) \
|
|
|
|
(((conn) << 30) | \
|
|
|
|
((location2) << 27) | \
|
|
|
|
((location1) << 24) | \
|
|
|
|
((dev) << 20) | \
|
|
|
|
((type) << 16) | \
|
|
|
|
((color) << 12) | \
|
|
|
|
((no_presence_detect) << 8) | \
|
2020-08-28 10:59:45 +02:00
|
|
|
((association) << 4) | \
|
2020-03-20 10:07:53 +01:00
|
|
|
((sequence) << 0))
|
|
|
|
|
2017-03-08 02:45:12 +01:00
|
|
|
#define AZALIA_ARRAY_SIZES const u32 pc_beep_verbs_size = \
|
|
|
|
ARRAY_SIZE(pc_beep_verbs); \
|
2014-09-05 01:01:31 +02:00
|
|
|
const u32 cim_verb_data_size = sizeof(cim_verb_data)
|
2014-08-17 23:48:42 +02:00
|
|
|
|
2017-03-08 02:45:12 +01:00
|
|
|
#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))
|
2014-09-04 21:34:13 +02:00
|
|
|
|
2020-09-22 12:55:25 +02:00
|
|
|
#define AZALIA_PIN_CFG_NC(n) (0x411111f0 | (n & 0xf))
|
|
|
|
|
2018-11-09 02:57:33 +01:00
|
|
|
#define AZALIA_RESET(pin) \
|
|
|
|
(((pin) << 20) | 0x7ff00), (((pin) << 20) | 0x7ff00), \
|
|
|
|
(((pin) << 20) | 0x7ff00), (((pin) << 20) | 0x7ff00)
|
|
|
|
|
2014-09-04 21:34:13 +02:00
|
|
|
#define AZALIA_SUBVENDOR(codec, val) \
|
src/include: Add parenthesis around macros
Fix the following error found by checkpatch.pl:
ERROR: Macros with complex values should be enclosed in parentheses
False positives are detected for attribute macros. An example is:
ERROR: Macros with complex values should be enclosed in parentheses
+#define BOOT_STATE_INIT_ATTR __attribute__ ((used, section
(".bs_init")))
False positive also generated for macros for linker script files. An
example is:
ERROR: Macros with complex values should be enclosed in parentheses
+#define CBFS_CACHE(addr, size) \
+ REGION(cbfs_cache, addr, size, 4) \
+ ALIAS_REGION(cbfs_cache, preram_cbfs_cache) \
+ ALIAS_REGION(cbfs_cache, postram_cbfs_cache)
False positives generated for assembly code macros. An example is:
ERROR: Macros with complex values should be enclosed in parentheses
+#define DECLARE_OPTIONAL_REGION(name) asm (".weak _" #name ", _e" #name
)
False positive detected when macro includes multiple comma separated
values. The following code is from src/include/device/azalia_device.h:
#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))
TEST=Build and run on Galileo Gen2
Change-Id: I6e3b6950738e6906851a172ba3a22e3d5af1e35d
Signed-off-by: Lee Leahy <Leroy.P.Leahy@intel.com>
Reviewed-on: https://review.coreboot.org/18649
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-03-07 22:17:49 +01:00
|
|
|
(((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))
|
2014-09-04 21:34:13 +02:00
|
|
|
|
2013-08-12 14:07:47 +02:00
|
|
|
#endif /* DEVICE_AZALIA_H */
|