Angel Pons | 32859fc | 2020-04-02 23:48:27 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Andrew Wu | b7bb70d | 2013-08-12 20:07:47 +0800 | [diff] [blame] | 3 | |
| 4 | #ifndef DEVICE_AZALIA_H |
| 5 | #define DEVICE_AZALIA_H |
| 6 | |
Vladimir Serbinenko | 75c8387 | 2014-09-05 01:01:31 +0200 | [diff] [blame] | 7 | #include <types.h> |
Vladimir Serbinenko | 75c8387 | 2014-09-05 01:01:31 +0200 | [diff] [blame] | 8 | #include <arch/acpi.h> |
Kyösti Mälkki | 13f6650 | 2019-03-03 08:01:05 +0200 | [diff] [blame] | 9 | #include <device/mmio.h> |
Andrew Wu | b7bb70d | 2013-08-12 20:07:47 +0800 | [diff] [blame] | 10 | #include <device/device.h> |
| 11 | |
| 12 | void azalia_audio_init(struct device *dev); |
| 13 | extern struct device_operations default_azalia_audio_ops; |
| 14 | |
Vladimir Serbinenko | 75c8387 | 2014-09-05 01:01:31 +0200 | [diff] [blame] | 15 | extern const u32 cim_verb_data[]; |
| 16 | extern const u32 cim_verb_data_size; |
| 17 | extern const u32 pc_beep_verbs[]; |
| 18 | extern const u32 pc_beep_verbs_size; |
| 19 | |
Patrick Rudolph | 9a521d7 | 2020-03-20 10:07:53 +0100 | [diff] [blame^] | 20 | enum azalia_pin_connection { |
| 21 | JACK = 0, |
| 22 | NC, |
| 23 | INTEGRATED, |
| 24 | JACK_AND_INTEGRATED, |
| 25 | }; |
| 26 | |
| 27 | enum azalia_pin_color { |
| 28 | COLOR_UNKNOWN = 0, |
| 29 | BLACK, |
| 30 | GREY, |
| 31 | BLUE, |
| 32 | GREEN, |
| 33 | RED, |
| 34 | ORANGE, |
| 35 | YELLOW, |
| 36 | PURPLE, |
| 37 | PINK, |
| 38 | WHITE = 0xe, |
| 39 | COLOR_OTHER = 0xf, |
| 40 | }; |
| 41 | |
| 42 | enum azalia_pin_type { |
| 43 | TYPE_UNKNOWN = 0, |
| 44 | STEREO_MONO_1_8, |
| 45 | STEREO_MONO_1_4, |
| 46 | ATAPI, |
| 47 | RCA, |
| 48 | OPTIONAL, |
| 49 | OTHER_DIGITAL, |
| 50 | OTHER_ANALOG, |
| 51 | MULTICHANNEL_ANALOG, |
| 52 | XLR, |
| 53 | RJ_11, |
| 54 | COMBINATION, |
| 55 | TYPE_OTHER = 0xf |
| 56 | }; |
| 57 | |
| 58 | enum azalia_pin_device { |
| 59 | LINE_OUT = 0, |
| 60 | SPEAKER, |
| 61 | HP_OUT, |
| 62 | CD, |
| 63 | SPDIF_OUT, |
| 64 | DIGITAL_OTHER_OUT, |
| 65 | MODEM_LINE_SIDE, |
| 66 | MODEM_HANDSET_SIDE, |
| 67 | LINE_IN, |
| 68 | AUX, |
| 69 | MIC_IN, |
| 70 | TELEPHONY, |
| 71 | SPDIF_IN, |
| 72 | DIGITAL_OTHER_IN, |
| 73 | DEVICE_OTHER = 0xf, |
| 74 | }; |
| 75 | |
| 76 | enum azalia_pin_location_1 { |
| 77 | NA = 0, |
| 78 | REAR, |
| 79 | FRONT, |
| 80 | LEFT, |
| 81 | RIGHT, |
| 82 | TOP, |
| 83 | BOTTOM, |
| 84 | SPECIAL7, |
| 85 | SPECIAL8, |
| 86 | SPECIAL9, |
| 87 | }; |
| 88 | |
| 89 | enum azalia_pin_location_2 { |
| 90 | EXTERNAL_PRIMARY_CHASSIS = 0, |
| 91 | INTERNAL, |
| 92 | SEPARATE_CHASSIS, |
| 93 | LOCATION_OTHER |
| 94 | }; |
| 95 | |
| 96 | #define AZALIA_PIN_DESC(conn, location2, location1, dev, type, color, no_presence_detect, \ |
| 97 | association, sequence) \ |
| 98 | (((conn) << 30) | \ |
| 99 | ((location2) << 27) | \ |
| 100 | ((location1) << 24) | \ |
| 101 | ((dev) << 20) | \ |
| 102 | ((type) << 16) | \ |
| 103 | ((color) << 12) | \ |
| 104 | ((no_presence_detect) << 8) | \ |
| 105 | ((sequence) << 4) | \ |
| 106 | ((sequence) << 0)) |
| 107 | |
Lee Leahy | 6a566d7 | 2017-03-07 17:45:12 -0800 | [diff] [blame] | 108 | #define AZALIA_ARRAY_SIZES const u32 pc_beep_verbs_size = \ |
| 109 | ARRAY_SIZE(pc_beep_verbs); \ |
Vladimir Serbinenko | 75c8387 | 2014-09-05 01:01:31 +0200 | [diff] [blame] | 110 | const u32 cim_verb_data_size = sizeof(cim_verb_data) |
Vladimir Serbinenko | 6a3a8ce | 2014-08-17 23:48:42 +0200 | [diff] [blame] | 111 | |
Lee Leahy | 6a566d7 | 2017-03-07 17:45:12 -0800 | [diff] [blame] | 112 | #define AZALIA_PIN_CFG(codec, pin, val) \ |
| 113 | (((codec) << 28) | ((pin) << 20) | (0x71c << 8) \ |
| 114 | | ((val) & 0xff)), \ |
| 115 | (((codec) << 28) | ((pin) << 20) | (0x71d << 8) \ |
| 116 | | (((val) >> 8) & 0xff)), \ |
| 117 | (((codec) << 28) | ((pin) << 20) | (0x71e << 8) \ |
| 118 | | (((val) >> 16) & 0xff)), \ |
| 119 | (((codec) << 28) | ((pin) << 20) | (0x71f << 8) \ |
| 120 | | (((val) >> 24) & 0xff)) |
Vladimir Serbinenko | 8f0da58 | 2014-09-04 21:34:13 +0200 | [diff] [blame] | 121 | |
Lijian Zhao | 5c9237f | 2018-11-08 17:57:33 -0800 | [diff] [blame] | 122 | #define AZALIA_RESET(pin) \ |
| 123 | (((pin) << 20) | 0x7ff00), (((pin) << 20) | 0x7ff00), \ |
| 124 | (((pin) << 20) | 0x7ff00), (((pin) << 20) | 0x7ff00) |
| 125 | |
Vladimir Serbinenko | 8f0da58 | 2014-09-04 21:34:13 +0200 | [diff] [blame] | 126 | #define AZALIA_SUBVENDOR(codec, val) \ |
Lee Leahy | f00e446 | 2017-03-07 13:17:49 -0800 | [diff] [blame] | 127 | (((codec) << 28) | (0x01720 << 8) | ((val) & 0xff)), \ |
| 128 | (((codec) << 28) | (0x01721 << 8) | (((val) >> 8) & 0xff)), \ |
| 129 | (((codec) << 28) | (0x01722 << 8) | (((val) >> 16) & 0xff)), \ |
| 130 | (((codec) << 28) | (0x01723 << 8) | (((val) >> 24) & 0xff)) |
Vladimir Serbinenko | 8f0da58 | 2014-09-04 21:34:13 +0200 | [diff] [blame] | 131 | |
Andrew Wu | b7bb70d | 2013-08-12 20:07:47 +0800 | [diff] [blame] | 132 | #endif /* DEVICE_AZALIA_H */ |