sound/soc/intel/common/soc-acpi-intel-cht-match.c

Source file repositories/reference/linux-study-clean/sound/soc/intel/common/soc-acpi-intel-cht-match.c

File Facts

System
Linux kernel
Corpus path
sound/soc/intel/common/soc-acpi-intel-cht-match.c
Extension
.c
Size
5999 bytes
Lines
236
Domain
Driver Families
Bucket
sound/soc
Inferred role
Driver Families: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0-only
/*
 * soc-acpi-intel-cht-match.c - tables and support for CHT ACPI enumeration.
 *
 * Copyright (c) 2017, Intel Corporation.
 */

#include <linux/dmi.h>
#include <sound/soc-acpi.h>
#include <sound/soc-acpi-intel-match.h>

static unsigned long cht_machine_id;

#define CHT_SURFACE_MACH 1

static int cht_surface_quirk_cb(const struct dmi_system_id *id)
{
	cht_machine_id = CHT_SURFACE_MACH;
	return 1;
}

static const struct dmi_system_id cht_table[] = {
	{
		.callback = cht_surface_quirk_cb,
		.matches = {
			DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
			DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
		},
	},
	{ }
};

static struct snd_soc_acpi_mach cht_surface_mach = {
	.id = "10EC5640",
	.drv_name = "cht-bsw-rt5645",
	.fw_filename = "intel/fw_sst_22a8.bin",
	.board = "cht-bsw",
	.sof_tplg_filename = "sof-cht-rt5645.tplg",
};

static struct snd_soc_acpi_mach *cht_quirk(void *arg)
{
	struct snd_soc_acpi_mach *mach = arg;

	dmi_check_system(cht_table);

	if (cht_machine_id == CHT_SURFACE_MACH)
		return &cht_surface_mach;
	else
		return mach;
}

/*
 * Some tablets with Android factory OS have buggy DSDTs with an ESSX8316 device
 * in the ACPI tables. While they are not using an ESS8316 codec. These DSDTs
 * also have an ACPI device for the correct codec, ignore the ESSX8316.
 */
static const struct dmi_system_id cht_ess8316_not_present_table[] = {
	{
		/* Nextbook Ares 8A */
		.matches = {
			DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
			DMI_MATCH(DMI_PRODUCT_NAME, "CherryTrail"),
			DMI_MATCH(DMI_BIOS_VERSION, "M882"),
		},
	},
	{ }
};

static struct snd_soc_acpi_mach *cht_ess8316_quirk(void *arg)
{
	if (dmi_check_system(cht_ess8316_not_present_table))
		return NULL;

	return arg;
}

/*
 * The Lenovo Yoga Tab 3 Pro YT3-X90, with Android factory OS has a buggy DSDT
 * with the coded not being listed at all.
 */
static const struct dmi_system_id lenovo_yoga_tab3_x90[] = {
	{
		/* Lenovo Yoga Tab 3 Pro YT3-X90, codec missing from DSDT */
		.matches = {
			DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
			DMI_MATCH(DMI_PRODUCT_VERSION, "Blade3-10A-001"),
		},
	},
	{ }

Annotation

Implementation Notes