Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright (C) 2013-15, Intel Corporation. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #ifndef __LINUX_SND_SOC_ACPI_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #define __LINUX_SND_SOC_ACPI_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/stddef.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/mod_devicetable.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) struct snd_soc_acpi_package_context {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 	char *name;           /* package name */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 	int length;           /* number of elements */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 	struct acpi_buffer *format;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 	struct acpi_buffer *state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 	bool data_valid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) /* codec name is used in DAIs is i2c-<HID>:00 with HID being 8 chars */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #define SND_ACPI_I2C_ID_LEN (4 + ACPI_ID_LEN + 3 + 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #if IS_ENABLED(CONFIG_ACPI)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) /* acpi match */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) struct snd_soc_acpi_mach *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) bool snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 				    struct snd_soc_acpi_package_context *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) /* check all codecs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) struct snd_soc_acpi_mach *snd_soc_acpi_codec_list(void *arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) /* acpi match */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) static inline struct snd_soc_acpi_mach *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) static inline bool
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 				   struct snd_soc_acpi_package_context *ctx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) /* check all codecs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) static inline struct snd_soc_acpi_mach *snd_soc_acpi_codec_list(void *arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58)  * snd_soc_acpi_mach_params: interface for machine driver configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60)  * @acpi_ipc_irq_index: used for BYT-CR detection
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)  * @platform: string used for HDAudio codec support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)  * @codec_mask: used for HDAudio support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)  * @common_hdmi_codec_drv: use commom HDAudio HDMI codec driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)  * @link_mask: links enabled on the board
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65)  * @links: array of link _ADR descriptors, null terminated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) struct snd_soc_acpi_mach_params {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	u32 acpi_ipc_irq_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	const char *platform;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	u32 codec_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	u32 dmic_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	bool common_hdmi_codec_drv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	u32 link_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	const struct snd_soc_acpi_link_adr *links;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78)  * snd_soc_acpi_endpoint - endpoint descriptor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79)  * @num: endpoint number (mandatory, unique per device)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)  * @aggregated: 0 (independent) or 1 (logically grouped)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)  * @group_position: zero-based order (only when @aggregated is 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82)  * @group_id: platform-unique group identifier (only when @aggregrated is 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) struct snd_soc_acpi_endpoint {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	u8 num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	u8 aggregated;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	u8 group_position;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	u8 group_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)  * snd_soc_acpi_adr_device - descriptor for _ADR-enumerated device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93)  * @adr: 64 bit ACPI _ADR value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)  * @num_endpoints: number of endpoints for this device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95)  * @endpoints: array of endpoints
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96)  * @name_prefix: string used for codec controls
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) struct snd_soc_acpi_adr_device {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	const u64 adr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	const u8 num_endpoints;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	const struct snd_soc_acpi_endpoint *endpoints;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	const char *name_prefix;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)  * snd_soc_acpi_link_adr - ACPI-based list of _ADR enumerated devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)  * @mask: one bit set indicates the link this list applies to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)  * @num_adr: ARRAY_SIZE of devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)  * @adr_d: array of devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)  * The number of devices per link can be more than 1, e.g. in SoundWire
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)  * multi-drop configurations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) struct snd_soc_acpi_link_adr {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	const u32 mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	const u32 num_adr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	const struct snd_soc_acpi_adr_device *adr_d;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)  * snd_soc_acpi_mach: ACPI-based machine descriptor. Most of the fields are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)  * related to the hardware, except for the firmware and topology file names.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)  * A platform supported by legacy and Sound Open Firmware (SOF) would expose
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)  * all firmware/topology related fields.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)  * @id: ACPI ID (usually the codec's) used to find a matching machine driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)  * @link_mask: describes required board layout, e.g. for SoundWire.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)  * @links: array of link _ADR descriptors, null terminated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)  * @drv_name: machine driver name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)  * @fw_filename: firmware file name. Used when SOF is not enabled.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)  * @board: board name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)  * @machine_quirk: pointer to quirk, usually based on DMI information when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)  * ACPI ID alone is not sufficient, wrong or misleading
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)  * @quirk_data: data used to uniquely identify a machine, usually a list of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)  * audio codecs whose presence if checked with ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)  * @pdata: intended for platform data or machine specific-ops. This structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)  *  is not constant since this field may be updated at run-time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)  * @sof_fw_filename: Sound Open Firmware file name, if enabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)  * @sof_tplg_filename: Sound Open Firmware topology file name, if enabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) /* Descriptor for SST ASoC machine driver */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) struct snd_soc_acpi_mach {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	const u8 id[ACPI_ID_LEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	const u32 link_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	const struct snd_soc_acpi_link_adr *links;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	const char *drv_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	const char *fw_filename;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	const char *board;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	struct snd_soc_acpi_mach * (*machine_quirk)(void *arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	const void *quirk_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	void *pdata;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	struct snd_soc_acpi_mach_params mach_params;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	const char *sof_fw_filename;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	const char *sof_tplg_filename;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) #define SND_SOC_ACPI_MAX_CODECS 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)  * struct snd_soc_acpi_codecs: Structure to hold secondary codec information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)  * apart from the matched one, this data will be passed to the quirk function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)  * to match with the ACPI detected devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)  * @num_codecs: number of secondary codecs used in the platform
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)  * @codecs: holds the codec IDs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) struct snd_soc_acpi_codecs {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	int num_codecs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	u8 codecs[SND_SOC_ACPI_MAX_CODECS][ACPI_ID_LEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) #endif