mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-28 16:52:18 +00:00
3a513da1ae
Add new module for SDCA (SoundWire Device Class for Audio) support. For now just add a parser to identify the SDCA revision and the function mask. Note that the SDCA definitions and related MIPI DisCo properties are defined only for ACPI platforms and extracted with _DSD helpers. There is currently no support for Device Tree in the specification, the 'depends on ACPI' reflects this design limitation. This might change in a future revision of the specification but for SDCA 1.0 ACPI is the only supported type of platform firmware. The SDCA library is defined with static inline fallbacks, which will allow for unconditional addition of SDCA support in common parts of the code. The design follows a four-step process: 1) Basic information related to Functions is extracted from MIPI DisCo tables and stored in the 'struct sdw_slave'. Devm_ based memory allocation is not allowed at this point prior to a driver probe, so we only store the function node, address and type. 2) When a codec driver probes, it will register subdevices for each Function identified in phase 1) 3) a driver will probe for each subdevice and addition parsing/memory allocation takes place at this level. devm_ based allocation is highly encouraged to make error handling manageable. 4) Before the peripheral device becomes physically attached, register access is not permitted and the regmaps are cache-only. When peripheral device is enumerated, the bus level uses the 'update_status' notification; after optional device-level initialization, the codec driver will notify each of the subdevices so that they can start interacting with the hardware. Note that the context extracted in 1) should be arguably be handled completely in the codec driver probe. That would however make it difficult to use the ACPI information for machine quirks, and e.g. select different machine driver and topologies as done for the RT712_VB handling later in the series. To make the implementation of quirks simpler, this patchset extracts a minimal amount of context (interface revision and number/type of Functions) before the codec driver probe, and stores this context in the scope of the 'struct sdw_slave'. The SDCA library can also be used in a vendor-specific driver without creating subdevices, e.g. to retrieve the 'initialization-table' values to write platform-specific values as needed. For more technical details, the SDCA specification is available for public downloads at https://www.mipi.org/mipi-sdca-v1-0-download Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://patch.msgid.link/20241016102333.294448-4-yung-chuan.liao@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
56 lines
2.2 KiB
C
56 lines
2.2 KiB
C
/* 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
|