-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ASoC/soundwire: add initial support for SDCA
Merge series from Bard Liao <yung-chuan.liao@linux.intel.com>: We need to get rt712 version by reading SDCA version and functions. This patch series adds initial support for SDCA and add a helper to tell if the codec is RT712_VB. This series may go via the ASoC tree with Vinod's Acked-by tag. Bard Liao (1): soundwire: sdw_intel: include linux/acpi.h Pierre-Louis Bossart (10): ASoC/soundwire: remove sdw_slave_extended_id ASoC: SDCA: add initial module soundwire: slave: lookup SDCA version and functions ASoC: SDCA: add quirk function for RT712_VB match ASoC: rt712-sdca: detect the SMART_MIC function during the probe stage ASoC: soc-acpi: introduce new 'machine check' callback ASoC: sdw_utils: add SmartMic DAI for RT712 VB ASoC: sdw_utils: add SmartMic DAI for RT713 VB ASoC: Intel: soc-acpi: add is_device_rt712_vb() helper ASoC: SOF: Intel: hda: use machine_check() for SoundWire drivers/soundwire/Kconfig | 1 + drivers/soundwire/amd_init.c | 12 +- drivers/soundwire/intel_init.c | 13 +- drivers/soundwire/slave.c | 14 ++ include/linux/soundwire/sdw.h | 9 +- include/linux/soundwire/sdw_amd.h | 7 +- include/linux/soundwire/sdw_intel.h | 8 +- include/sound/sdca.h | 62 +++++++ include/sound/sdca_function.h | 55 ++++++ include/sound/soc-acpi.h | 8 +- sound/soc/Kconfig | 1 + sound/soc/Makefile | 1 + sound/soc/amd/ps/pci-ps.c | 3 +- sound/soc/codecs/rt712-sdca-sdw.c | 1 + sound/soc/codecs/rt712-sdca.c | 38 +++- sound/soc/codecs/rt712-sdca.h | 1 + sound/soc/intel/Kconfig | 5 + sound/soc/intel/common/Makefile | 3 + .../intel/common/soc-acpi-intel-mtl-match.c | 51 ++++++ .../intel/common/soc-acpi-intel-sdca-quirks.c | 42 +++++ .../intel/common/soc-acpi-intel-sdca-quirks.h | 14 ++ sound/soc/sdca/Kconfig | 11 ++ sound/soc/sdca/Makefile | 5 + sound/soc/sdca/sdca_device.c | 67 +++++++ sound/soc/sdca/sdca_functions.c | 173 ++++++++++++++++++ sound/soc/sdw_utils/soc_sdw_utils.c | 18 +- sound/soc/soc-acpi.c | 30 +-- sound/soc/sof/amd/acp-common.c | 3 +- sound/soc/sof/intel/hda.c | 19 +- 29 files changed, 610 insertions(+), 65 deletions(-) create mode 100644 include/sound/sdca.h create mode 100644 include/sound/sdca_function.h create mode 100644 sound/soc/intel/common/soc-acpi-intel-sdca-quirks.c create mode 100644 sound/soc/intel/common/soc-acpi-intel-sdca-quirks.h create mode 100644 sound/soc/sdca/Kconfig create mode 100644 sound/soc/sdca/Makefile create mode 100644 sound/soc/sdca/sdca_device.c create mode 100644 sound/soc/sdca/sdca_functions.c -- 2.43.0
- Loading branch information
Showing
29 changed files
with
610 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ | ||
/* | ||
* The MIPI SDCA specification is available for public downloads at | ||
* https://www.mipi.org/mipi-sdca-v1-0-download | ||
* | ||
* Copyright(c) 2024 Intel Corporation | ||
*/ | ||
|
||
#ifndef __SDCA_H__ | ||
#define __SDCA_H__ | ||
|
||
struct sdw_slave; | ||
|
||
#define SDCA_MAX_FUNCTION_COUNT 8 | ||
|
||
/** | ||
* sdca_device_desc - short descriptor for an SDCA Function | ||
* @adr: ACPI address (used for SDCA register access) | ||
* @type: Function topology type | ||
* @name: human-readable string | ||
*/ | ||
struct sdca_function_desc { | ||
u64 adr; | ||
u32 type; | ||
const char *name; | ||
}; | ||
|
||
/** | ||
* sdca_device_data - structure containing all SDCA related information | ||
* @sdca_interface_revision: value read from _DSD property, mainly to check | ||
* for changes between silicon versions | ||
* @num_functions: total number of supported SDCA functions. Invalid/unsupported | ||
* functions will be skipped. | ||
* @sdca_func: array of function descriptors | ||
*/ | ||
struct sdca_device_data { | ||
u32 interface_revision; | ||
int num_functions; | ||
struct sdca_function_desc sdca_func[SDCA_MAX_FUNCTION_COUNT]; | ||
}; | ||
|
||
enum sdca_quirk { | ||
SDCA_QUIRKS_RT712_VB, | ||
}; | ||
|
||
#if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SND_SOC_SDCA) | ||
|
||
void sdca_lookup_functions(struct sdw_slave *slave); | ||
void sdca_lookup_interface_revision(struct sdw_slave *slave); | ||
bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quirk); | ||
|
||
#else | ||
|
||
static inline void sdca_lookup_functions(struct sdw_slave *slave) {} | ||
static inline void sdca_lookup_interface_revision(struct sdw_slave *slave) {} | ||
static inline bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quirk) | ||
{ | ||
return false; | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ | ||
/* | ||
* The MIPI SDCA specification is available for public downloads at | ||
* https://www.mipi.org/mipi-sdca-v1-0-download | ||
* | ||
* Copyright(c) 2024 Intel Corporation | ||
*/ | ||
|
||
#ifndef __SDCA_FUNCTION_H__ | ||
#define __SDCA_FUNCTION_H__ | ||
|
||
/* | ||
* SDCA Function Types from SDCA specification v1.0a Section 5.1.2 | ||
* all Function types not described are reserved | ||
* Note that SIMPLE_AMP, SIMPLE_MIC and SIMPLE_JACK Function Types | ||
* are NOT defined in SDCA 1.0a, but they were defined in earlier | ||
* drafts and are planned for 1.1. | ||
*/ | ||
|
||
enum sdca_function_type { | ||
SDCA_FUNCTION_TYPE_SMART_AMP = 0x01, /* Amplifier with protection features */ | ||
SDCA_FUNCTION_TYPE_SIMPLE_AMP = 0x02, /* subset of SmartAmp */ | ||
SDCA_FUNCTION_TYPE_SMART_MIC = 0x03, /* Smart microphone with acoustic triggers */ | ||
SDCA_FUNCTION_TYPE_SIMPLE_MIC = 0x04, /* subset of SmartMic */ | ||
SDCA_FUNCTION_TYPE_SPEAKER_MIC = 0x05, /* Combination of SmartMic and SmartAmp */ | ||
SDCA_FUNCTION_TYPE_UAJ = 0x06, /* 3.5mm Universal Audio jack */ | ||
SDCA_FUNCTION_TYPE_RJ = 0x07, /* Retaskable jack */ | ||
SDCA_FUNCTION_TYPE_SIMPLE_JACK = 0x08, /* Subset of UAJ */ | ||
SDCA_FUNCTION_TYPE_HID = 0x0A, /* Human Interface Device, for e.g. buttons */ | ||
SDCA_FUNCTION_TYPE_IMP_DEF = 0x1F, /* Implementation-defined function */ | ||
}; | ||
|
||
/* Human-readable names used for kernel logs and Function device registration/bind */ | ||
#define SDCA_FUNCTION_TYPE_SMART_AMP_NAME "SmartAmp" | ||
#define SDCA_FUNCTION_TYPE_SIMPLE_AMP_NAME "SimpleAmp" | ||
#define SDCA_FUNCTION_TYPE_SMART_MIC_NAME "SmartMic" | ||
#define SDCA_FUNCTION_TYPE_SIMPLE_MIC_NAME "SimpleMic" | ||
#define SDCA_FUNCTION_TYPE_SPEAKER_MIC_NAME "SpeakerMic" | ||
#define SDCA_FUNCTION_TYPE_UAJ_NAME "UAJ" | ||
#define SDCA_FUNCTION_TYPE_RJ_NAME "RJ" | ||
#define SDCA_FUNCTION_TYPE_SIMPLE_NAME "SimpleJack" | ||
#define SDCA_FUNCTION_TYPE_HID_NAME "HID" | ||
|
||
enum sdca_entity0_controls { | ||
SDCA_CONTROL_ENTITY_0_COMMIT_GROUP_MASK = 0x01, | ||
SDCA_CONTROL_ENTITY_0_INTSTAT_CLEAR = 0x02, | ||
SDCA_CONTROL_ENTITY_0_INT_ENABLE = 0x03, | ||
SDCA_CONTROL_ENTITY_0_FUNCTION_SDCA_VERSION = 0x04, | ||
SDCA_CONTROL_ENTITY_0_FUNCTION_TOPOLOGY = 0x05, | ||
SDCA_CONTROL_ENTITY_0_FUNCTION_MANUFACTURER_ID = 0x06, | ||
SDCA_CONTROL_ENTITY_0_FUNCTION_ID = 0x07, | ||
SDCA_CONTROL_ENTITY_0_FUNCTION_VERSION = 0x08 | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.