1 // SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
2 // Copyright(c) 2024 Intel Corporation
5 * The MIPI SDCA specification is available for public downloads at
6 * https://www.mipi.org/mipi-sdca-v1-0-download
9 #include <linux/acpi.h>
10 #include <linux/soundwire/sdw.h>
11 #include <sound/sdca.h>
12 #include <sound/sdca_function.h>
14 void sdca_lookup_interface_revision(struct sdw_slave
*slave
)
16 struct fwnode_handle
*fwnode
= slave
->dev
.fwnode
;
19 * if this property is not present, then the sdca_interface_revision will
20 * remain zero, which will be considered as 'not defined' or 'invalid'.
22 fwnode_property_read_u32(fwnode
, "mipi-sdw-sdca-interface-revision",
23 &slave
->sdca_data
.interface_revision
);
25 EXPORT_SYMBOL_NS(sdca_lookup_interface_revision
, "SND_SOC_SDCA");
27 static bool sdca_device_quirk_rt712_vb(struct sdw_slave
*slave
)
29 struct sdw_slave_id
*id
= &slave
->id
;
33 * The RT712_VA relies on the v06r04 draft, and the
34 * RT712_VB on a more recent v08r01 draft.
36 if (slave
->sdca_data
.interface_revision
< 0x0801)
39 if (id
->mfg_id
!= 0x025d)
42 if (id
->part_id
!= 0x712 &&
43 id
->part_id
!= 0x713 &&
44 id
->part_id
!= 0x716 &&
48 for (i
= 0; i
< slave
->sdca_data
.num_functions
; i
++) {
49 if (slave
->sdca_data
.sdca_func
[i
].type
==
50 SDCA_FUNCTION_TYPE_SMART_MIC
)
57 bool sdca_device_quirk_match(struct sdw_slave
*slave
, enum sdca_quirk quirk
)
60 case SDCA_QUIRKS_RT712_VB
:
61 return sdca_device_quirk_rt712_vb(slave
);
67 EXPORT_SYMBOL_NS(sdca_device_quirk_match
, "SND_SOC_SDCA");