Commit efb6f315 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Mark Brown

ASoC: soc-acpi: add _ADR-based link descriptors

For SoundWire support, we added a 'link_mask' to describe the PCB hardware
layout. This helped form a signature that can be used as a first-order way
of detecting the hardware and selecting the machine driver.

The concept of link_mask is however not enough. Some BIOS enable all links,
even when there are no devices physically connected. We can also see
variations with multiple devices attached on one link, or different types
of devices connected on the same link. To accurately represent the
hardware, we need to build static tables where each link exposes a list of
expected devices represented by the 64-bit _ADR field (which uniquely
identifies each device).

The new 'links' field is optional when the link_mask is sufficient to
represent a platform in a unique way.

The existing mechanism to support I2C devices is left as is, it'd be too
invasive to change the existing support for _HID and the notion of link is
not relevant either.
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarBard liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20200110222530.30303-2-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent cfe8191b
...@@ -61,6 +61,8 @@ static inline struct snd_soc_acpi_mach *snd_soc_acpi_codec_list(void *arg) ...@@ -61,6 +61,8 @@ static inline struct snd_soc_acpi_mach *snd_soc_acpi_codec_list(void *arg)
* @platform: string used for HDaudio codec support * @platform: string used for HDaudio codec support
* @codec_mask: used for HDAudio support * @codec_mask: used for HDAudio support
* @common_hdmi_codec_drv: use commom HDAudio HDMI codec driver * @common_hdmi_codec_drv: use commom HDAudio HDMI codec driver
* @link_mask: links enabled on the board
* @links: array of link _ADR descriptors, null terminated
*/ */
struct snd_soc_acpi_mach_params { struct snd_soc_acpi_mach_params {
u32 acpi_ipc_irq_index; u32 acpi_ipc_irq_index;
...@@ -68,6 +70,23 @@ struct snd_soc_acpi_mach_params { ...@@ -68,6 +70,23 @@ struct snd_soc_acpi_mach_params {
u32 codec_mask; u32 codec_mask;
u32 dmic_num; u32 dmic_num;
bool common_hdmi_codec_drv; bool common_hdmi_codec_drv;
u32 link_mask;
const struct snd_soc_acpi_link_adr *links;
};
/**
* snd_soc_acpi_link_adr: ACPI-based list of _ADR, with a variable
* number of devices per link
*
* @mask: one bit set indicates the link this list applies to
* @num_adr: ARRAY_SIZE of adr
* @adr: array of _ADR (represented as u64).
*/
struct snd_soc_acpi_link_adr {
const u32 mask;
const u32 num_adr;
const u64 *adr;
}; };
/** /**
...@@ -78,6 +97,7 @@ struct snd_soc_acpi_mach_params { ...@@ -78,6 +97,7 @@ struct snd_soc_acpi_mach_params {
* *
* @id: ACPI ID (usually the codec's) used to find a matching machine driver. * @id: ACPI ID (usually the codec's) used to find a matching machine driver.
* @link_mask: describes required board layout, e.g. for SoundWire. * @link_mask: describes required board layout, e.g. for SoundWire.
* @links: array of link _ADR descriptors, null terminated.
* @drv_name: machine driver name * @drv_name: machine driver name
* @fw_filename: firmware file name. Used when SOF is not enabled. * @fw_filename: firmware file name. Used when SOF is not enabled.
* @board: board name * @board: board name
...@@ -94,6 +114,7 @@ struct snd_soc_acpi_mach_params { ...@@ -94,6 +114,7 @@ struct snd_soc_acpi_mach_params {
struct snd_soc_acpi_mach { struct snd_soc_acpi_mach {
const u8 id[ACPI_ID_LEN]; const u8 id[ACPI_ID_LEN];
const u32 link_mask; const u32 link_mask;
const struct snd_soc_acpi_link_adr *links;
const char *drv_name; const char *drv_name;
const char *fw_filename; const char *fw_filename;
const char *board; const char *board;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment