]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blob - include/sound/soc-acpi.h
UBUNTU: Ubuntu-5.4.0-117.132
[mirror_ubuntu-focal-kernel.git] / include / sound / soc-acpi.h
1 /* SPDX-License-Identifier: GPL-2.0
2 *
3 * Copyright (C) 2013-15, Intel Corporation. All rights reserved.
4 */
5
6 #ifndef __LINUX_SND_SOC_ACPI_H
7 #define __LINUX_SND_SOC_ACPI_H
8
9 #include <linux/stddef.h>
10 #include <linux/acpi.h>
11 #include <linux/mod_devicetable.h>
12
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;
18 bool data_valid;
19 };
20
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)
23
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
29 bool snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN],
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
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
43 static inline bool
44 snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN],
45 struct snd_soc_acpi_package_context *ctx)
46 {
47 return false;
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 }
55 #endif
56
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 */
65 struct snd_soc_acpi_mach_params {
66 u32 acpi_ipc_irq_index;
67 const char *platform;
68 u32 codec_mask;
69 u32 dmic_num;
70 bool common_hdmi_codec_drv;
71 };
72
73 /**
74 * snd_soc_acpi_mach: ACPI-based machine descriptor. Most of the fields are
75 * related to the hardware, except for the firmware and topology file names.
76 * A platform supported by legacy and Sound Open Firmware (SOF) would expose
77 * all firmware/topology related fields.
78 *
79 * @id: ACPI ID (usually the codec's) used to find a matching machine driver.
80 * @drv_name: machine driver name
81 * @fw_filename: firmware file name. Used when SOF is not enabled.
82 * @board: board name
83 * @machine_quirk: pointer to quirk, usually based on DMI information when
84 * ACPI ID alone is not sufficient, wrong or misleading
85 * @quirk_data: data used to uniquely identify a machine, usually a list of
86 * audio codecs whose presence if checked with ACPI
87 * @pdata: intended for platform data or machine specific-ops. This structure
88 * is not constant since this field may be updated at run-time
89 * @sof_fw_filename: Sound Open Firmware file name, if enabled
90 * @sof_tplg_filename: Sound Open Firmware topology file name, if enabled
91 */
92 /* Descriptor for SST ASoC machine driver */
93 struct snd_soc_acpi_mach {
94 const u8 id[ACPI_ID_LEN];
95 const char *drv_name;
96 const char *fw_filename;
97 const char *board;
98 struct snd_soc_acpi_mach * (*machine_quirk)(void *arg);
99 const void *quirk_data;
100 void *pdata;
101 struct snd_soc_acpi_mach_params mach_params;
102 const char *sof_fw_filename;
103 const char *sof_tplg_filename;
104 };
105
106 #define SND_SOC_ACPI_MAX_CODECS 3
107
108 /**
109 * struct snd_soc_acpi_codecs: Structure to hold secondary codec information
110 * apart from the matched one, this data will be passed to the quirk function
111 * to match with the ACPI detected devices
112 *
113 * @num_codecs: number of secondary codecs used in the platform
114 * @codecs: holds the codec IDs
115 *
116 */
117 struct snd_soc_acpi_codecs {
118 int num_codecs;
119 u8 codecs[SND_SOC_ACPI_MAX_CODECS][ACPI_ID_LEN];
120 };
121
122 #endif