| .. | .. |
|---|
| 1 | | -/* SPDX-License-Identifier: GPL-2.0 |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only |
|---|
| 2 | 2 | * |
|---|
| 3 | 3 | * Copyright (C) 2013-15, Intel Corporation. All rights reserved. |
|---|
| 4 | 4 | */ |
|---|
| .. | .. |
|---|
| 22 | 22 | #define SND_ACPI_I2C_ID_LEN (4 + ACPI_ID_LEN + 3 + 1) |
|---|
| 23 | 23 | |
|---|
| 24 | 24 | #if IS_ENABLED(CONFIG_ACPI) |
|---|
| 25 | +/* acpi match */ |
|---|
| 26 | +struct snd_soc_acpi_mach * |
|---|
| 27 | +snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines); |
|---|
| 28 | + |
|---|
| 25 | 29 | bool snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN], |
|---|
| 26 | 30 | struct snd_soc_acpi_package_context *ctx); |
|---|
| 31 | + |
|---|
| 32 | +/* check all codecs */ |
|---|
| 33 | +struct snd_soc_acpi_mach *snd_soc_acpi_codec_list(void *arg); |
|---|
| 34 | + |
|---|
| 27 | 35 | #else |
|---|
| 36 | +/* acpi match */ |
|---|
| 37 | +static inline struct snd_soc_acpi_mach * |
|---|
| 38 | +snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines) |
|---|
| 39 | +{ |
|---|
| 40 | + return NULL; |
|---|
| 41 | +} |
|---|
| 42 | + |
|---|
| 28 | 43 | static inline bool |
|---|
| 29 | 44 | snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN], |
|---|
| 30 | 45 | struct snd_soc_acpi_package_context *ctx) |
|---|
| 31 | 46 | { |
|---|
| 32 | 47 | return false; |
|---|
| 33 | 48 | } |
|---|
| 49 | + |
|---|
| 50 | +/* check all codecs */ |
|---|
| 51 | +static inline struct snd_soc_acpi_mach *snd_soc_acpi_codec_list(void *arg) |
|---|
| 52 | +{ |
|---|
| 53 | + return NULL; |
|---|
| 54 | +} |
|---|
| 34 | 55 | #endif |
|---|
| 35 | 56 | |
|---|
| 36 | | -/* acpi match */ |
|---|
| 37 | | -struct snd_soc_acpi_mach * |
|---|
| 38 | | -snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines); |
|---|
| 57 | +/** |
|---|
| 58 | + * snd_soc_acpi_mach_params: interface for machine driver configuration |
|---|
| 59 | + * |
|---|
| 60 | + * @acpi_ipc_irq_index: used for BYT-CR detection |
|---|
| 61 | + * @platform: string used for HDAudio codec support |
|---|
| 62 | + * @codec_mask: used for HDAudio support |
|---|
| 63 | + * @common_hdmi_codec_drv: use commom HDAudio HDMI codec driver |
|---|
| 64 | + * @link_mask: links enabled on the board |
|---|
| 65 | + * @links: array of link _ADR descriptors, null terminated |
|---|
| 66 | + */ |
|---|
| 67 | +struct snd_soc_acpi_mach_params { |
|---|
| 68 | + u32 acpi_ipc_irq_index; |
|---|
| 69 | + const char *platform; |
|---|
| 70 | + u32 codec_mask; |
|---|
| 71 | + u32 dmic_num; |
|---|
| 72 | + bool common_hdmi_codec_drv; |
|---|
| 73 | + u32 link_mask; |
|---|
| 74 | + const struct snd_soc_acpi_link_adr *links; |
|---|
| 75 | +}; |
|---|
| 76 | + |
|---|
| 77 | +/** |
|---|
| 78 | + * snd_soc_acpi_endpoint - endpoint descriptor |
|---|
| 79 | + * @num: endpoint number (mandatory, unique per device) |
|---|
| 80 | + * @aggregated: 0 (independent) or 1 (logically grouped) |
|---|
| 81 | + * @group_position: zero-based order (only when @aggregated is 1) |
|---|
| 82 | + * @group_id: platform-unique group identifier (only when @aggregrated is 1) |
|---|
| 83 | + */ |
|---|
| 84 | +struct snd_soc_acpi_endpoint { |
|---|
| 85 | + u8 num; |
|---|
| 86 | + u8 aggregated; |
|---|
| 87 | + u8 group_position; |
|---|
| 88 | + u8 group_id; |
|---|
| 89 | +}; |
|---|
| 90 | + |
|---|
| 91 | +/** |
|---|
| 92 | + * snd_soc_acpi_adr_device - descriptor for _ADR-enumerated device |
|---|
| 93 | + * @adr: 64 bit ACPI _ADR value |
|---|
| 94 | + * @num_endpoints: number of endpoints for this device |
|---|
| 95 | + * @endpoints: array of endpoints |
|---|
| 96 | + * @name_prefix: string used for codec controls |
|---|
| 97 | + */ |
|---|
| 98 | +struct snd_soc_acpi_adr_device { |
|---|
| 99 | + const u64 adr; |
|---|
| 100 | + const u8 num_endpoints; |
|---|
| 101 | + const struct snd_soc_acpi_endpoint *endpoints; |
|---|
| 102 | + const char *name_prefix; |
|---|
| 103 | +}; |
|---|
| 104 | + |
|---|
| 105 | +/** |
|---|
| 106 | + * snd_soc_acpi_link_adr - ACPI-based list of _ADR enumerated devices |
|---|
| 107 | + * @mask: one bit set indicates the link this list applies to |
|---|
| 108 | + * @num_adr: ARRAY_SIZE of devices |
|---|
| 109 | + * @adr_d: array of devices |
|---|
| 110 | + * |
|---|
| 111 | + * The number of devices per link can be more than 1, e.g. in SoundWire |
|---|
| 112 | + * multi-drop configurations. |
|---|
| 113 | + */ |
|---|
| 114 | + |
|---|
| 115 | +struct snd_soc_acpi_link_adr { |
|---|
| 116 | + const u32 mask; |
|---|
| 117 | + const u32 num_adr; |
|---|
| 118 | + const struct snd_soc_acpi_adr_device *adr_d; |
|---|
| 119 | +}; |
|---|
| 39 | 120 | |
|---|
| 40 | 121 | /** |
|---|
| 41 | 122 | * snd_soc_acpi_mach: ACPI-based machine descriptor. Most of the fields are |
|---|
| .. | .. |
|---|
| 44 | 125 | * all firmware/topology related fields. |
|---|
| 45 | 126 | * |
|---|
| 46 | 127 | * @id: ACPI ID (usually the codec's) used to find a matching machine driver. |
|---|
| 128 | + * @link_mask: describes required board layout, e.g. for SoundWire. |
|---|
| 129 | + * @links: array of link _ADR descriptors, null terminated. |
|---|
| 47 | 130 | * @drv_name: machine driver name |
|---|
| 48 | 131 | * @fw_filename: firmware file name. Used when SOF is not enabled. |
|---|
| 49 | 132 | * @board: board name |
|---|
| .. | .. |
|---|
| 55 | 138 | * is not constant since this field may be updated at run-time |
|---|
| 56 | 139 | * @sof_fw_filename: Sound Open Firmware file name, if enabled |
|---|
| 57 | 140 | * @sof_tplg_filename: Sound Open Firmware topology file name, if enabled |
|---|
| 58 | | - * @asoc_plat_name: ASoC platform name, used for binding machine drivers |
|---|
| 59 | | - * if non NULL |
|---|
| 60 | | - * @new_mach_data: machine driver private data fixup |
|---|
| 61 | 141 | */ |
|---|
| 62 | 142 | /* Descriptor for SST ASoC machine driver */ |
|---|
| 63 | 143 | struct snd_soc_acpi_mach { |
|---|
| 64 | 144 | const u8 id[ACPI_ID_LEN]; |
|---|
| 145 | + const u32 link_mask; |
|---|
| 146 | + const struct snd_soc_acpi_link_adr *links; |
|---|
| 65 | 147 | const char *drv_name; |
|---|
| 66 | 148 | const char *fw_filename; |
|---|
| 67 | 149 | const char *board; |
|---|
| 68 | 150 | struct snd_soc_acpi_mach * (*machine_quirk)(void *arg); |
|---|
| 69 | 151 | const void *quirk_data; |
|---|
| 70 | 152 | void *pdata; |
|---|
| 153 | + struct snd_soc_acpi_mach_params mach_params; |
|---|
| 71 | 154 | const char *sof_fw_filename; |
|---|
| 72 | 155 | const char *sof_tplg_filename; |
|---|
| 73 | | - const char *asoc_plat_name; |
|---|
| 74 | | - struct platform_device * (*new_mach_data)(void *pdata); |
|---|
| 75 | 156 | }; |
|---|
| 76 | 157 | |
|---|
| 77 | 158 | #define SND_SOC_ACPI_MAX_CODECS 3 |
|---|
| .. | .. |
|---|
| 89 | 170 | int num_codecs; |
|---|
| 90 | 171 | u8 codecs[SND_SOC_ACPI_MAX_CODECS][ACPI_ID_LEN]; |
|---|
| 91 | 172 | }; |
|---|
| 92 | | - |
|---|
| 93 | | -/* check all codecs */ |
|---|
| 94 | | -struct snd_soc_acpi_mach *snd_soc_acpi_codec_list(void *arg); |
|---|
| 95 | 173 | |
|---|
| 96 | 174 | #endif |
|---|