Pierre-Louis Bossart | 1822758 | 2023-04-04 13:41:14 +0300 | [diff] [blame] | 1 | /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ |
| 2 | /* |
| 3 | * This file is provided under a dual BSD/GPLv2 license. When using or |
| 4 | * redistributing this file, you may do so under either license. |
| 5 | * |
Pierre-Louis Bossart | ea89a74 | 2024-05-03 09:03:59 -0500 | [diff] [blame] | 6 | * Copyright(c) 2022-2023 Intel Corporation |
Pierre-Louis Bossart | 1822758 | 2023-04-04 13:41:14 +0300 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | struct hdac_bus; |
Pierre-Louis Bossart | 2b864e9 | 2023-04-04 13:41:25 +0300 | [diff] [blame] | 10 | struct hdac_ext_link; |
Pierre-Louis Bossart | 1822758 | 2023-04-04 13:41:14 +0300 | [diff] [blame] | 11 | |
| 12 | #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_MLINK) |
| 13 | |
Pierre-Louis Bossart | 17c9b6e | 2023-04-04 13:41:15 +0300 | [diff] [blame] | 14 | int hda_bus_ml_init(struct hdac_bus *bus); |
Pierre-Louis Bossart | 1822758 | 2023-04-04 13:41:14 +0300 | [diff] [blame] | 15 | void hda_bus_ml_free(struct hdac_bus *bus); |
Pierre-Louis Bossart | fc7dab8 | 2023-04-04 13:41:17 +0300 | [diff] [blame] | 16 | |
Pierre-Louis Bossart | 6857c7e | 2023-04-04 13:41:19 +0300 | [diff] [blame] | 17 | int hdac_bus_eml_get_count(struct hdac_bus *bus, bool alt, int elid); |
Pierre-Louis Bossart | 2e42883 | 2023-04-04 13:41:20 +0300 | [diff] [blame] | 18 | void hdac_bus_eml_enable_interrupt(struct hdac_bus *bus, bool alt, int elid, bool enable); |
| 19 | bool hdac_bus_eml_check_interrupt(struct hdac_bus *bus, bool alt, int elid); |
Pierre-Louis Bossart | 6857c7e | 2023-04-04 13:41:19 +0300 | [diff] [blame] | 20 | |
Pierre-Louis Bossart | 02ba1b0 | 2023-04-04 13:41:21 +0300 | [diff] [blame] | 21 | int hdac_bus_eml_set_syncprd_unlocked(struct hdac_bus *bus, bool alt, int elid, u32 syncprd); |
| 22 | int hdac_bus_eml_sdw_set_syncprd_unlocked(struct hdac_bus *bus, u32 syncprd); |
| 23 | |
| 24 | int hdac_bus_eml_wait_syncpu_unlocked(struct hdac_bus *bus, bool alt, int elid); |
| 25 | int hdac_bus_eml_sdw_wait_syncpu_unlocked(struct hdac_bus *bus); |
| 26 | |
Pierre-Louis Bossart | 1f5a6e8 | 2023-04-04 13:41:22 +0300 | [diff] [blame] | 27 | void hdac_bus_eml_sync_arm_unlocked(struct hdac_bus *bus, bool alt, int elid, int sublink); |
| 28 | void hdac_bus_eml_sdw_sync_arm_unlocked(struct hdac_bus *bus, int sublink); |
| 29 | |
| 30 | int hdac_bus_eml_sync_go_unlocked(struct hdac_bus *bus, bool alt, int elid); |
| 31 | int hdac_bus_eml_sdw_sync_go_unlocked(struct hdac_bus *bus); |
| 32 | |
Pierre-Louis Bossart | d56d2058 | 2023-04-04 13:41:23 +0300 | [diff] [blame] | 33 | bool hdac_bus_eml_check_cmdsync_unlocked(struct hdac_bus *bus, bool alt, int elid); |
| 34 | bool hdac_bus_eml_sdw_check_cmdsync_unlocked(struct hdac_bus *bus); |
| 35 | |
Pierre-Louis Bossart | fc7dab8 | 2023-04-04 13:41:17 +0300 | [diff] [blame] | 36 | int hdac_bus_eml_power_up(struct hdac_bus *bus, bool alt, int elid, int sublink); |
| 37 | int hdac_bus_eml_power_up_unlocked(struct hdac_bus *bus, bool alt, int elid, int sublink); |
| 38 | |
| 39 | int hdac_bus_eml_power_down(struct hdac_bus *bus, bool alt, int elid, int sublink); |
| 40 | int hdac_bus_eml_power_down_unlocked(struct hdac_bus *bus, bool alt, int elid, int sublink); |
| 41 | |
Pierre-Louis Bossart | 725218f | 2023-04-04 13:41:18 +0300 | [diff] [blame] | 42 | int hdac_bus_eml_sdw_power_up_unlocked(struct hdac_bus *bus, int sublink); |
| 43 | int hdac_bus_eml_sdw_power_down_unlocked(struct hdac_bus *bus, int sublink); |
| 44 | |
Pierre-Louis Bossart | 34e38f0 | 2023-08-07 16:09:56 -0500 | [diff] [blame] | 45 | int hdac_bus_eml_sdw_get_lsdiid_unlocked(struct hdac_bus *bus, int sublink, u16 *lsdiid); |
Pierre-Louis Bossart | 87a6ddc | 2023-04-04 13:41:24 +0300 | [diff] [blame] | 46 | int hdac_bus_eml_sdw_set_lsdiid(struct hdac_bus *bus, int sublink, int dev_num); |
| 47 | |
Pierre-Louis Bossart | ccc2f0c | 2023-05-12 12:46:11 -0500 | [diff] [blame] | 48 | int hdac_bus_eml_sdw_map_stream_ch(struct hdac_bus *bus, int sublink, int y, |
| 49 | int channel_mask, int stream_id, int dir); |
| 50 | |
Pierre-Louis Bossart | 1822758 | 2023-04-04 13:41:14 +0300 | [diff] [blame] | 51 | void hda_bus_ml_put_all(struct hdac_bus *bus); |
| 52 | void hda_bus_ml_reset_losidv(struct hdac_bus *bus); |
| 53 | int hda_bus_ml_resume(struct hdac_bus *bus); |
| 54 | int hda_bus_ml_suspend(struct hdac_bus *bus); |
| 55 | |
Pierre-Louis Bossart | 2b864e9 | 2023-04-04 13:41:25 +0300 | [diff] [blame] | 56 | struct hdac_ext_link *hdac_bus_eml_ssp_get_hlink(struct hdac_bus *bus); |
| 57 | struct hdac_ext_link *hdac_bus_eml_dmic_get_hlink(struct hdac_bus *bus); |
Pierre-Louis Bossart | dcb88fc | 2023-05-12 12:46:07 -0500 | [diff] [blame] | 58 | struct hdac_ext_link *hdac_bus_eml_sdw_get_hlink(struct hdac_bus *bus); |
Pierre-Louis Bossart | 2b864e9 | 2023-04-04 13:41:25 +0300 | [diff] [blame] | 59 | |
Pierre-Louis Bossart | 681f27f | 2023-04-04 13:41:27 +0300 | [diff] [blame] | 60 | struct mutex *hdac_bus_eml_get_mutex(struct hdac_bus *bus, bool alt, int elid); |
| 61 | |
Pierre-Louis Bossart | 82958c4 | 2023-04-04 13:41:26 +0300 | [diff] [blame] | 62 | int hdac_bus_eml_enable_offload(struct hdac_bus *bus, bool alt, int elid, bool enable); |
| 63 | |
Pierre-Louis Bossart | 1822758 | 2023-04-04 13:41:14 +0300 | [diff] [blame] | 64 | #else |
| 65 | |
| 66 | static inline int |
Pierre-Louis Bossart | 17c9b6e | 2023-04-04 13:41:15 +0300 | [diff] [blame] | 67 | hda_bus_ml_init(struct hdac_bus *bus) { return 0; } |
Pierre-Louis Bossart | 1822758 | 2023-04-04 13:41:14 +0300 | [diff] [blame] | 68 | |
| 69 | static inline void hda_bus_ml_free(struct hdac_bus *bus) { } |
Pierre-Louis Bossart | fc7dab8 | 2023-04-04 13:41:17 +0300 | [diff] [blame] | 70 | |
| 71 | static inline int |
Pierre-Louis Bossart | 6857c7e | 2023-04-04 13:41:19 +0300 | [diff] [blame] | 72 | hdac_bus_eml_get_count(struct hdac_bus *bus, bool alt, int elid) { return 0; } |
| 73 | |
Pierre-Louis Bossart | 2e42883 | 2023-04-04 13:41:20 +0300 | [diff] [blame] | 74 | static inline void |
| 75 | hdac_bus_eml_enable_interrupt(struct hdac_bus *bus, bool alt, int elid, bool enable) { } |
| 76 | |
| 77 | static inline bool |
| 78 | hdac_bus_eml_check_interrupt(struct hdac_bus *bus, bool alt, int elid) { return false; } |
| 79 | |
Pierre-Louis Bossart | 6857c7e | 2023-04-04 13:41:19 +0300 | [diff] [blame] | 80 | static inline int |
Pierre-Louis Bossart | 02ba1b0 | 2023-04-04 13:41:21 +0300 | [diff] [blame] | 81 | hdac_bus_eml_set_syncprd_unlocked(struct hdac_bus *bus, bool alt, int elid, u32 syncprd) |
| 82 | { |
| 83 | return 0; |
| 84 | } |
| 85 | |
| 86 | static inline int |
| 87 | hdac_bus_eml_sdw_set_syncprd_unlocked(struct hdac_bus *bus, u32 syncprd) |
| 88 | { |
| 89 | return 0; |
| 90 | } |
| 91 | |
| 92 | static inline int |
| 93 | hdac_bus_eml_wait_syncpu_unlocked(struct hdac_bus *bus, bool alt, int elid) |
| 94 | { |
| 95 | return 0; |
| 96 | } |
| 97 | |
| 98 | static inline int |
| 99 | hdac_bus_eml_sdw_wait_syncpu_unlocked(struct hdac_bus *bus) { return 0; } |
| 100 | |
Pierre-Louis Bossart | 1f5a6e8 | 2023-04-04 13:41:22 +0300 | [diff] [blame] | 101 | static inline void |
| 102 | hdac_bus_eml_sync_arm_unlocked(struct hdac_bus *bus, bool alt, int elid, int sublink) { } |
| 103 | |
| 104 | static inline void |
| 105 | hdac_bus_eml_sdw_sync_arm_unlocked(struct hdac_bus *bus, int sublink) { } |
| 106 | |
| 107 | static inline int |
| 108 | hdac_bus_eml_sync_go_unlocked(struct hdac_bus *bus, bool alt, int elid) { return 0; } |
| 109 | |
| 110 | static inline int |
| 111 | hdac_bus_eml_sdw_sync_go_unlocked(struct hdac_bus *bus) { return 0; } |
| 112 | |
Pierre-Louis Bossart | d56d2058 | 2023-04-04 13:41:23 +0300 | [diff] [blame] | 113 | static inline bool |
| 114 | hdac_bus_eml_check_cmdsync_unlocked(struct hdac_bus *bus, bool alt, int elid) { return false; } |
| 115 | |
| 116 | static inline bool |
| 117 | hdac_bus_eml_sdw_check_cmdsync_unlocked(struct hdac_bus *bus) { return false; } |
| 118 | |
Pierre-Louis Bossart | 02ba1b0 | 2023-04-04 13:41:21 +0300 | [diff] [blame] | 119 | static inline int |
Pierre-Louis Bossart | fc7dab8 | 2023-04-04 13:41:17 +0300 | [diff] [blame] | 120 | hdac_bus_eml_power_up(struct hdac_bus *bus, bool alt, int elid, int sublink) |
| 121 | { |
| 122 | return 0; |
| 123 | } |
| 124 | |
| 125 | static inline int |
| 126 | hdac_bus_eml_power_up_unlocked(struct hdac_bus *bus, bool alt, int elid, int sublink) |
| 127 | { |
| 128 | return 0; |
| 129 | } |
| 130 | |
| 131 | static inline int |
| 132 | hdac_bus_eml_power_down(struct hdac_bus *bus, bool alt, int elid, int sublink) |
| 133 | { |
| 134 | return 0; |
| 135 | } |
| 136 | |
| 137 | static inline int |
| 138 | hdac_bus_eml_power_down_unlocked(struct hdac_bus *bus, bool alt, int elid, int sublink) |
| 139 | { |
| 140 | return 0; |
| 141 | } |
| 142 | |
Pierre-Louis Bossart | 725218f | 2023-04-04 13:41:18 +0300 | [diff] [blame] | 143 | static inline int |
| 144 | hdac_bus_eml_sdw_power_up_unlocked(struct hdac_bus *bus, int sublink) { return 0; } |
| 145 | |
| 146 | static inline int |
| 147 | hdac_bus_eml_sdw_power_down_unlocked(struct hdac_bus *bus, int sublink) { return 0; } |
| 148 | |
Pierre-Louis Bossart | 87a6ddc | 2023-04-04 13:41:24 +0300 | [diff] [blame] | 149 | static inline int |
Pierre-Louis Bossart | 34e38f0 | 2023-08-07 16:09:56 -0500 | [diff] [blame] | 150 | hdac_bus_eml_sdw_get_lsdiid_unlocked(struct hdac_bus *bus, int sublink, u16 *lsdiid) { return 0; } |
| 151 | |
| 152 | static inline int |
Pierre-Louis Bossart | 87a6ddc | 2023-04-04 13:41:24 +0300 | [diff] [blame] | 153 | hdac_bus_eml_sdw_set_lsdiid(struct hdac_bus *bus, int sublink, int dev_num) { return 0; } |
| 154 | |
Pierre-Louis Bossart | ccc2f0c | 2023-05-12 12:46:11 -0500 | [diff] [blame] | 155 | static inline int |
| 156 | hdac_bus_eml_sdw_map_stream_ch(struct hdac_bus *bus, int sublink, int y, |
| 157 | int channel_mask, int stream_id, int dir) |
| 158 | { |
| 159 | return 0; |
| 160 | } |
| 161 | |
Pierre-Louis Bossart | 1822758 | 2023-04-04 13:41:14 +0300 | [diff] [blame] | 162 | static inline void hda_bus_ml_put_all(struct hdac_bus *bus) { } |
| 163 | static inline void hda_bus_ml_reset_losidv(struct hdac_bus *bus) { } |
| 164 | static inline int hda_bus_ml_resume(struct hdac_bus *bus) { return 0; } |
| 165 | static inline int hda_bus_ml_suspend(struct hdac_bus *bus) { return 0; } |
| 166 | |
Pierre-Louis Bossart | 2b864e9 | 2023-04-04 13:41:25 +0300 | [diff] [blame] | 167 | static inline struct hdac_ext_link * |
| 168 | hdac_bus_eml_ssp_get_hlink(struct hdac_bus *bus) { return NULL; } |
| 169 | |
| 170 | static inline struct hdac_ext_link * |
| 171 | hdac_bus_eml_dmic_get_hlink(struct hdac_bus *bus) { return NULL; } |
| 172 | |
Pierre-Louis Bossart | dcb88fc | 2023-05-12 12:46:07 -0500 | [diff] [blame] | 173 | static inline struct hdac_ext_link * |
| 174 | hdac_bus_eml_sdw_get_hlink(struct hdac_bus *bus) { return NULL; } |
| 175 | |
Pierre-Louis Bossart | 681f27f | 2023-04-04 13:41:27 +0300 | [diff] [blame] | 176 | static inline struct mutex * |
| 177 | hdac_bus_eml_get_mutex(struct hdac_bus *bus, bool alt, int elid) { return NULL; } |
| 178 | |
Pierre-Louis Bossart | 82958c4 | 2023-04-04 13:41:26 +0300 | [diff] [blame] | 179 | static inline int |
| 180 | hdac_bus_eml_enable_offload(struct hdac_bus *bus, bool alt, int elid, bool enable) |
| 181 | { |
| 182 | return 0; |
| 183 | } |
Pierre-Louis Bossart | b85a3dc | 2024-02-13 13:43:54 +0200 | [diff] [blame] | 184 | #endif /* CONFIG_SND_SOC_SOF_HDA_MLINK */ |