1 /* SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2013-15, Intel Corporation. All rights reserved.
6 #ifndef __LINUX_SND_SOC_ACPI_H
7 #define __LINUX_SND_SOC_ACPI_H
9 #include <linux/stddef.h>
10 #include <linux/acpi.h>
11 #include <linux/mod_devicetable.h>
13 struct snd_soc_acpi_package_context {
14 char *name; /* package name */
15 int length; /* number of elements */
16 struct acpi_buffer *format;
17 struct acpi_buffer *state;
21 /* codec name is used in DAIs is i2c-<HID>:00 with HID being 8 chars */
22 #define SND_ACPI_I2C_ID_LEN (4 + ACPI_ID_LEN + 3 + 1)
24 #if IS_ENABLED(CONFIG_ACPI)
25 bool snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN],
26 struct snd_soc_acpi_package_context *ctx);
29 snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN],
30 struct snd_soc_acpi_package_context *ctx)
37 struct snd_soc_acpi_mach *
38 snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines);
41 * snd_soc_acpi_mach_params: interface for machine driver configuration
43 * @acpi_ipc_irq_index: used for BYT-CR detection
44 * @platform: string used for HDaudio codec support
45 * @codec_mask: used for HDAudio support
47 struct snd_soc_acpi_mach_params {
48 u32 acpi_ipc_irq_index;
54 * snd_soc_acpi_mach: ACPI-based machine descriptor. Most of the fields are
55 * related to the hardware, except for the firmware and topology file names.
56 * A platform supported by legacy and Sound Open Firmware (SOF) would expose
57 * all firmware/topology related fields.
59 * @id: ACPI ID (usually the codec's) used to find a matching machine driver.
60 * @drv_name: machine driver name
61 * @fw_filename: firmware file name. Used when SOF is not enabled.
63 * @machine_quirk: pointer to quirk, usually based on DMI information when
64 * ACPI ID alone is not sufficient, wrong or misleading
65 * @quirk_data: data used to uniquely identify a machine, usually a list of
66 * audio codecs whose presence if checked with ACPI
67 * @pdata: intended for platform data or machine specific-ops. This structure
68 * is not constant since this field may be updated at run-time
69 * @sof_fw_filename: Sound Open Firmware file name, if enabled
70 * @sof_tplg_filename: Sound Open Firmware topology file name, if enabled
71 * @asoc_plat_name: ASoC platform name, used for binding machine drivers
73 * @new_mach_data: machine driver private data fixup
75 /* Descriptor for SST ASoC machine driver */
76 struct snd_soc_acpi_mach {
77 const u8 id[ACPI_ID_LEN];
79 const char *fw_filename;
81 struct snd_soc_acpi_mach * (*machine_quirk)(void *arg);
82 const void *quirk_data;
84 struct snd_soc_acpi_mach_params mach_params;
85 const char *sof_fw_filename;
86 const char *sof_tplg_filename;
87 const char *asoc_plat_name;
88 struct platform_device * (*new_mach_data)(void *pdata);
91 #define SND_SOC_ACPI_MAX_CODECS 3
94 * struct snd_soc_acpi_codecs: Structure to hold secondary codec information
95 * apart from the matched one, this data will be passed to the quirk function
96 * to match with the ACPI detected devices
98 * @num_codecs: number of secondary codecs used in the platform
99 * @codecs: holds the codec IDs
102 struct snd_soc_acpi_codecs {
104 u8 codecs[SND_SOC_ACPI_MAX_CODECS][ACPI_ID_LEN];
107 /* check all codecs */
108 struct snd_soc_acpi_mach *snd_soc_acpi_codec_list(void *arg);