summaryrefslogtreecommitdiff
path: root/include/sound/sdca.h
blob: 7e138229e8f3abb08a4bfc594eaf0b4047e8cd3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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