1279 lines · 43.7 KB · C
RawDownload
/* 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__ #include <linux/bits.h>#include <linux/types.h> struct device;struct sdca_entity;struct sdca_function_desc; /* * The addressing space for SDCA relies on 7 bits for Entities, so a * maximum of 128 Entities per function can be represented. */#define SDCA_MAX_ENTITY_COUNT 128 /* * Sanity check on number of initialization writes, can be expanded if needed. */#define SDCA_MAX_INIT_COUNT 2048 /* * The Cluster IDs are 16-bit, so a maximum of 65535 Clusters per * function can be represented, however limit this to a slightly * more reasonable value. Can be expanded if needed. */#define SDCA_MAX_CLUSTER_COUNT 256 /* * Sanity check on number of channels per Cluster, can be expanded if needed. */#define SDCA_MAX_CHANNEL_COUNT 32 /* * Sanity check on number of PDE delays, can be expanded if needed. */#define SDCA_MAX_DELAY_COUNT 256 /* * Sanity check on size of affected controls data, can be expanded if needed. */#define SDCA_MAX_AFFECTED_COUNT 2048 /** * enum sdca_function_type - SDCA Function Type codes * @SDCA_FUNCTION_TYPE_SMART_AMP: Amplifier with protection features. * @SDCA_FUNCTION_TYPE_SIMPLE_AMP: Subset of SmartAmp. * @SDCA_FUNCTION_TYPE_SMART_MIC: Smart microphone with acoustic triggers. * @SDCA_FUNCTION_TYPE_SIMPLE_MIC: Subset of SmartMic. * @SDCA_FUNCTION_TYPE_SPEAKER_MIC: Combination of SmartMic and SmartAmp. * @SDCA_FUNCTION_TYPE_UAJ: 3.5mm Universal Audio jack. * @SDCA_FUNCTION_TYPE_RJ: Retaskable jack. * @SDCA_FUNCTION_TYPE_SIMPLE_JACK: Subset of UAJ. * @SDCA_FUNCTION_TYPE_HID: Human Interface Device, for e.g. buttons. * @SDCA_FUNCTION_TYPE_IMP_DEF: Implementation-defined function. * * 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,	SDCA_FUNCTION_TYPE_SIMPLE_AMP			= 0x02,	SDCA_FUNCTION_TYPE_SMART_MIC			= 0x03,	SDCA_FUNCTION_TYPE_SIMPLE_MIC			= 0x04,	SDCA_FUNCTION_TYPE_SPEAKER_MIC			= 0x05,	SDCA_FUNCTION_TYPE_UAJ				= 0x06,	SDCA_FUNCTION_TYPE_RJ				= 0x07,	SDCA_FUNCTION_TYPE_SIMPLE_JACK			= 0x08,	SDCA_FUNCTION_TYPE_HID				= 0x0A,	SDCA_FUNCTION_TYPE_IMP_DEF			= 0x1F,}; /* 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"#define	SDCA_FUNCTION_TYPE_IMP_DEF_NAME			"ImplementationDefined" /** * struct sdca_init_write - a single initialization write * @addr: Register address to be written * @val: Single byte value to be written */struct sdca_init_write {	u32 addr;	u8 val;}; /** * define SDCA_CTL_TYPE - create a unique identifier for an SDCA Control * @ent: Entity Type code. * @sel: Control Selector code. * * Sometimes there is a need to identify a type of Control, for example to * determine what name the control should have. SDCA Selectors are reused * across Entity types, as such it is necessary to combine both the Entity * Type and the Control Selector to obtain a unique identifier. */#define SDCA_CTL_TYPE(ent, sel) ((ent) << 8 | (sel)) /** * define SDCA_CTL_TYPE_S - static version of SDCA_CTL_TYPE * @ent: Entity name, for example IT, MFPU, etc. this string can be read * from the last characters of the SDCA_ENTITY_TYPE_* macros. * @sel: Control Selector name, for example MIC_BIAS, MUTE, etc. this * string can be read from the last characters of the SDCA_CTL_*_* * macros. * * Short hand to specific a Control type statically for example: * SDCA_CTL_TYPE_S(IT, MIC_BIAS). */#define SDCA_CTL_TYPE_S(ent, sel) SDCA_CTL_TYPE(SDCA_ENTITY_TYPE_##ent, \						SDCA_CTL_##ent##_##sel) /** * enum sdca_it_controls - SDCA Controls for Input Terminal * * Control Selectors for Input Terminal from SDCA specification v1.0 * section 6.2.1.3. */enum sdca_it_controls {	SDCA_CTL_IT_MIC_BIAS				= 0x03,	SDCA_CTL_IT_USAGE				= 0x04,	SDCA_CTL_IT_LATENCY				= 0x08,	SDCA_CTL_IT_CLUSTERINDEX			= 0x10,	SDCA_CTL_IT_DATAPORT_SELECTOR			= 0x11,	SDCA_CTL_IT_MATCHING_GUID			= 0x12,	SDCA_CTL_IT_KEEP_ALIVE				= 0x13,	SDCA_CTL_IT_NDAI_STREAM				= 0x14,	SDCA_CTL_IT_NDAI_CATEGORY			= 0x15,	SDCA_CTL_IT_NDAI_CODINGTYPE			= 0x16,	SDCA_CTL_IT_NDAI_PACKETTYPE			= 0x17,}; /** * enum sdca_ot_controls - SDCA Controls for Output Terminal * * Control Selectors for Output Terminal from SDCA specification v1.0 * section 6.2.2.3. */enum sdca_ot_controls {	SDCA_CTL_OT_USAGE				= 0x04,	SDCA_CTL_OT_LATENCY				= 0x08,	SDCA_CTL_OT_DATAPORT_SELECTOR			= 0x11,	SDCA_CTL_OT_MATCHING_GUID			= 0x12,	SDCA_CTL_OT_KEEP_ALIVE				= 0x13,	SDCA_CTL_OT_NDAI_STREAM				= 0x14,	SDCA_CTL_OT_NDAI_CATEGORY			= 0x15,	SDCA_CTL_OT_NDAI_CODINGTYPE			= 0x16,	SDCA_CTL_OT_NDAI_PACKETTYPE			= 0x17,}; /** * enum sdca_usage_range - Column definitions for Usage */enum sdca_usage_range {	SDCA_USAGE_NUMBER				= 0,	SDCA_USAGE_CBN					= 1,	SDCA_USAGE_SAMPLE_RATE				= 2,	SDCA_USAGE_SAMPLE_WIDTH				= 3,	SDCA_USAGE_FULL_SCALE				= 4,	SDCA_USAGE_NOISE_FLOOR				= 5,	SDCA_USAGE_TAG					= 6,	SDCA_USAGE_NCOLS				= 7,}; /** * enum sdca_mu_controls - SDCA Controls for Mixer Unit * * Control Selectors for Mixer Unit from SDCA specification v1.0 * section 6.3.4.2. */enum sdca_mu_controls {	SDCA_CTL_MU_MIXER				= 0x01,	SDCA_CTL_MU_LATENCY				= 0x06,}; /** * enum sdca_su_controls - SDCA Controls for Selector Unit * * Control Selectors for Selector Unit from SDCA specification v1.0 * section 6.3.8.3. */enum sdca_su_controls {	SDCA_CTL_SU_SELECTOR				= 0x01,	SDCA_CTL_SU_LATENCY				= 0x02,}; /** * enum sdca_fu_controls - SDCA Controls for Feature Unit * * Control Selectors for Feature Unit from SDCA specification v1.0 * section 6.3.2.3. */enum sdca_fu_controls {	SDCA_CTL_FU_MUTE				= 0x01,	SDCA_CTL_FU_CHANNEL_VOLUME			= 0x02,	SDCA_CTL_FU_AGC					= 0x07,	SDCA_CTL_FU_BASS_BOOST				= 0x09,	SDCA_CTL_FU_LOUDNESS				= 0x0A,	SDCA_CTL_FU_GAIN				= 0x0B,	SDCA_CTL_FU_LATENCY				= 0x10,}; /** * enum sdca_volume_range - Column definitions for Q7.8dB volumes/gains */enum sdca_volume_range {	SDCA_VOLUME_LINEAR_MIN				= 0,	SDCA_VOLUME_LINEAR_MAX				= 1,	SDCA_VOLUME_LINEAR_STEP				= 2,	SDCA_VOLUME_LINEAR_NCOLS			= 3,}; /** * enum sdca_xu_controls - SDCA Controls for Extension Unit * * Control Selectors for Extension Unit from SDCA specification v1.0 * section 6.3.10.3. */enum sdca_xu_controls {	SDCA_CTL_XU_BYPASS				= 0x01,	SDCA_CTL_XU_LATENCY				= 0x06,	SDCA_CTL_XU_XU_ID				= 0x07,	SDCA_CTL_XU_XU_VERSION				= 0x08,	SDCA_CTL_XU_FDL_CURRENTOWNER			= 0x10,	SDCA_CTL_XU_FDL_MESSAGEOFFSET			= 0x12,	SDCA_CTL_XU_FDL_MESSAGELENGTH			= 0x13,	SDCA_CTL_XU_FDL_STATUS				= 0x14,	SDCA_CTL_XU_FDL_SET_INDEX			= 0x15,	SDCA_CTL_XU_FDL_HOST_REQUEST			= 0x16,}; /** * enum sdca_cs_controls - SDCA Controls for Clock Source * * Control Selectors for Clock Source from SDCA specification v1.0 * section 6.4.1.3. */enum sdca_cs_controls {	SDCA_CTL_CS_CLOCK_VALID				= 0x02,	SDCA_CTL_CS_SAMPLERATEINDEX			= 0x10,}; /** * enum sdca_samplerateindex_range - Column definitions for SampleRateIndex */enum sdca_samplerateindex_range {	SDCA_SAMPLERATEINDEX_INDEX			= 0,	SDCA_SAMPLERATEINDEX_RATE			= 1,	SDCA_SAMPLERATEINDEX_NCOLS			= 2,}; /** * enum sdca_cx_controls - SDCA Controls for Clock Selector * * Control Selectors for Clock Selector from SDCA specification v1.0 * section 6.4.2.3. */enum sdca_cx_controls {	SDCA_CTL_CX_CLOCK_SELECT			= 0x01,}; /** * enum sdca_pde_controls - SDCA Controls for Power Domain Entity * * Control Selectors for Power Domain Entity from SDCA specification * v1.0 section 6.5.2.2. */enum sdca_pde_controls {	SDCA_CTL_PDE_REQUESTED_PS			= 0x01,	SDCA_CTL_PDE_ACTUAL_PS				= 0x10,}; /** * enum sdca_requested_ps_range - Column definitions for Requested PS */enum sdca_requested_ps_range {	SDCA_REQUESTED_PS_STATE				= 0,	SDCA_REQUESTED_PS_NCOLS				= 1,}; /** * enum sdca_ge_controls - SDCA Controls for Group Unit * * Control Selectors for Group Unit from SDCA specification v1.0 * section 6.5.1.4. */enum sdca_ge_controls {	SDCA_CTL_GE_SELECTED_MODE			= 0x01,	SDCA_CTL_GE_DETECTED_MODE			= 0x02,}; /** * enum sdca_selected_mode_range - Column definitions for Selected Mode */enum sdca_selected_mode_range {	SDCA_SELECTED_MODE_INDEX			= 0,	SDCA_SELECTED_MODE_TERM_TYPE			= 1,	SDCA_SELECTED_MODE_NCOLS			= 2,}; /** * enum sdca_spe_controls - SDCA Controls for Security & Privacy Unit * * Control Selectors for Security & Privacy Unit from SDCA * specification v1.0 Section 6.5.3.2. */enum sdca_spe_controls {	SDCA_CTL_SPE_PRIVATE				= 0x01,	SDCA_CTL_SPE_PRIVACY_POLICY			= 0x02,	SDCA_CTL_SPE_PRIVACY_LOCKSTATE			= 0x03,	SDCA_CTL_SPE_PRIVACY_OWNER			= 0x04,	SDCA_CTL_SPE_AUTHTX_CURRENTOWNER		= 0x10,	SDCA_CTL_SPE_AUTHTX_MESSAGEOFFSET		= 0x12,	SDCA_CTL_SPE_AUTHTX_MESSAGELENGTH		= 0x13,	SDCA_CTL_SPE_AUTHRX_CURRENTOWNER		= 0x14,	SDCA_CTL_SPE_AUTHRX_MESSAGEOFFSET		= 0x16,	SDCA_CTL_SPE_AUTHRX_MESSAGELENGTH		= 0x17,}; /** * enum sdca_cru_controls - SDCA Controls for Channel Remapping Unit * * Control Selectors for Channel Remapping Unit from SDCA * specification v1.0 Section 6.3.1.3. */enum sdca_cru_controls {	SDCA_CTL_CRU_LATENCY				= 0x06,	SDCA_CTL_CRU_CLUSTERINDEX			= 0x10,}; /** * enum sdca_udmpu_controls - SDCA Controls for Up-Down Mixer Processing Unit * * Control Selectors for Up-Down Mixer Processing Unit from SDCA * specification v1.0 Section 6.3.9.3. */enum sdca_udmpu_controls {	SDCA_CTL_UDMPU_LATENCY				= 0x06,	SDCA_CTL_UDMPU_CLUSTERINDEX			= 0x10,	SDCA_CTL_UDMPU_ACOUSTIC_ENERGY_LEVEL_MONITOR	= 0x11,	SDCA_CTL_UDMPU_ULTRASOUND_LOOP_GAIN		= 0x12,	SDCA_CTL_UDMPU_OPAQUESET_0			= 0x18,	SDCA_CTL_UDMPU_OPAQUESET_1			= 0x19,	SDCA_CTL_UDMPU_OPAQUESET_2			= 0x1A,	SDCA_CTL_UDMPU_OPAQUESET_3			= 0x1B,	SDCA_CTL_UDMPU_OPAQUESET_4			= 0x1C,	SDCA_CTL_UDMPU_OPAQUESET_5			= 0x1D,	SDCA_CTL_UDMPU_OPAQUESET_6			= 0x1E,	SDCA_CTL_UDMPU_OPAQUESET_7			= 0x1F,	SDCA_CTL_UDMPU_OPAQUESET_8			= 0x20,	SDCA_CTL_UDMPU_OPAQUESET_9			= 0x21,	SDCA_CTL_UDMPU_OPAQUESET_10			= 0x22,	SDCA_CTL_UDMPU_OPAQUESET_11			= 0x23,	SDCA_CTL_UDMPU_OPAQUESET_12			= 0x24,	SDCA_CTL_UDMPU_OPAQUESET_13			= 0x25,	SDCA_CTL_UDMPU_OPAQUESET_14			= 0x26,	SDCA_CTL_UDMPU_OPAQUESET_15			= 0x27,	SDCA_CTL_UDMPU_OPAQUESET_16			= 0x28,	SDCA_CTL_UDMPU_OPAQUESET_17			= 0x29,	SDCA_CTL_UDMPU_OPAQUESET_18			= 0x2A,	SDCA_CTL_UDMPU_OPAQUESET_19			= 0x2B,	SDCA_CTL_UDMPU_OPAQUESET_20			= 0x2C,	SDCA_CTL_UDMPU_OPAQUESET_21			= 0x2D,	SDCA_CTL_UDMPU_OPAQUESET_22			= 0x2E,	SDCA_CTL_UDMPU_OPAQUESET_23			= 0x2F,}; /** * enum sdca_mfpu_controls - SDCA Controls for Multi-Function Processing Unit * * Control Selectors for Multi-Function Processing Unit from SDCA * specification v1.0 Section 6.3.3.4. */enum sdca_mfpu_controls {	SDCA_CTL_MFPU_BYPASS				= 0x01,	SDCA_CTL_MFPU_ALGORITHM_READY			= 0x04,	SDCA_CTL_MFPU_ALGORITHM_ENABLE			= 0x05,	SDCA_CTL_MFPU_LATENCY				= 0x08,	SDCA_CTL_MFPU_ALGORITHM_PREPARE			= 0x09,	SDCA_CTL_MFPU_CLUSTERINDEX			= 0x10,	SDCA_CTL_MFPU_CENTER_FREQUENCY_INDEX		= 0x11,	SDCA_CTL_MFPU_ULTRASOUND_LEVEL			= 0x12,	SDCA_CTL_MFPU_AE_NUMBER				= 0x13,	SDCA_CTL_MFPU_AE_CURRENTOWNER			= 0x14,	SDCA_CTL_MFPU_AE_MESSAGEOFFSET			= 0x16,	SDCA_CTL_MFPU_AE_MESSAGELENGTH			= 0x17,}; /** * enum sdca_smpu_controls - SDCA Controls for Smart Mic Processing Unit * * Control Selectors for Smart Mic Processing Unit from SDCA * specification v1.0 Section 6.3.7.3. */enum sdca_smpu_controls {	SDCA_CTL_SMPU_LATENCY				= 0x06,	SDCA_CTL_SMPU_TRIGGER_ENABLE			= 0x10,	SDCA_CTL_SMPU_TRIGGER_STATUS			= 0x11,	SDCA_CTL_SMPU_HIST_BUFFER_MODE			= 0x12,	SDCA_CTL_SMPU_HIST_BUFFER_PREAMBLE		= 0x13,	SDCA_CTL_SMPU_HIST_ERROR			= 0x14,	SDCA_CTL_SMPU_TRIGGER_EXTENSION			= 0x15,	SDCA_CTL_SMPU_TRIGGER_READY			= 0x16,	SDCA_CTL_SMPU_HIST_CURRENTOWNER			= 0x18,	SDCA_CTL_SMPU_HIST_MESSAGEOFFSET		= 0x1A,	SDCA_CTL_SMPU_HIST_MESSAGELENGTH		= 0x1B,	SDCA_CTL_SMPU_DTODTX_CURRENTOWNER		= 0x1C,	SDCA_CTL_SMPU_DTODTX_MESSAGEOFFSET		= 0x1E,	SDCA_CTL_SMPU_DTODTX_MESSAGELENGTH		= 0x1F,	SDCA_CTL_SMPU_DTODRX_CURRENTOWNER		= 0x20,	SDCA_CTL_SMPU_DTODRX_MESSAGEOFFSET		= 0x22,	SDCA_CTL_SMPU_DTODRX_MESSAGELENGTH		= 0x23,}; /** * enum sdca_sapu_controls - SDCA Controls for Smart Amp Processing Unit * * Control Selectors for Smart Amp Processing Unit from SDCA * specification v1.0 Section 6.3.6.3. */enum sdca_sapu_controls {	SDCA_CTL_SAPU_LATENCY				= 0x05,	SDCA_CTL_SAPU_PROTECTION_MODE			= 0x10,	SDCA_CTL_SAPU_PROTECTION_STATUS			= 0x11,	SDCA_CTL_SAPU_OPAQUESETREQ_INDEX		= 0x12,	SDCA_CTL_SAPU_DTODTX_CURRENTOWNER		= 0x14,	SDCA_CTL_SAPU_DTODTX_MESSAGEOFFSET		= 0x16,	SDCA_CTL_SAPU_DTODTX_MESSAGELENGTH		= 0x17,	SDCA_CTL_SAPU_DTODRX_CURRENTOWNER		= 0x18,	SDCA_CTL_SAPU_DTODRX_MESSAGEOFFSET		= 0x1A,	SDCA_CTL_SAPU_DTODRX_MESSAGELENGTH		= 0x1B,}; /** * enum sdca_ppu_controls - SDCA Controls for Post Processing Unit * * Control Selectors for Post Processing Unit from SDCA specification * v1.0 Section 6.3.5.3. */enum sdca_ppu_controls {	SDCA_CTL_PPU_LATENCY				= 0x06,	SDCA_CTL_PPU_POSTURENUMBER			= 0x10,	SDCA_CTL_PPU_POSTUREEXTENSION			= 0x11,	SDCA_CTL_PPU_HORIZONTALBALANCE			= 0x12,	SDCA_CTL_PPU_VERTICALBALANCE			= 0x13,}; /** * enum sdca_tg_controls - SDCA Controls for Tone Generator Entity * * Control Selectors for Tone Generator from SDCA specification v1.0 * Section 6.5.4.4. */enum sdca_tg_controls {	SDCA_CTL_TG_TONE_DIVIDER			= 0x10,}; /** * enum sdca_hide_controls - SDCA Controls for HIDE Entity * * Control Selectors for HIDE from SDCA specification v1.0 Section * 6.6.1.2. */enum sdca_hide_controls {	SDCA_CTL_HIDE_HIDTX_CURRENTOWNER		= 0x10,	SDCA_CTL_HIDE_HIDTX_MESSAGEOFFSET		= 0x12,	SDCA_CTL_HIDE_HIDTX_MESSAGELENGTH		= 0x13,	SDCA_CTL_HIDE_HIDRX_CURRENTOWNER		= 0x14,	SDCA_CTL_HIDE_HIDRX_MESSAGEOFFSET		= 0x16,	SDCA_CTL_HIDE_HIDRX_MESSAGELENGTH		= 0x17,}; /** * enum sdca_entity0_controls - SDCA Controls for Entity 0 * * Control Selectors for Entity 0 from SDCA specification v1.0 Section * 6.7.1.1. */enum sdca_entity0_controls {	SDCA_CTL_ENTITY_0_COMMIT_GROUP_MASK		= 0x01,

Lines 1–500 of 1279.