/* 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>
#include <linux/hid.h>
struct acpi_table_swft;
struct device;
struct sdca_entity;
struct sdca_function_desc;
#define SDCA_NO_INTERRUPT -1
/*
* 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_COMPANION_AMP: Sources audio from another amp.
* @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