Skip to content

Commit 40c8372

Browse files
plbossartbardliao
authored andcommitted
ASoC: SDCA: add quirk function for RT712_VB match
Add a generic match function for quirks, chances are we are going to have lots of those... Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
1 parent 94d67c8 commit 40c8372

2 files changed

Lines changed: 52 additions & 1 deletion

File tree

include/sound/sdca.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,24 @@ struct sdca_device_data {
3939
struct sdca_function_desc sdca_func[SDCA_MAX_FUNCTION_COUNT];
4040
};
4141

42+
enum sdca_quirk {
43+
SDCA_QUIRKS_RT712_VB,
44+
};
45+
4246
#if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SND_SOC_SDCA)
4347

4448
void sdca_lookup_functions(struct sdw_slave *slave);
4549
void sdca_lookup_interface_revision(struct sdw_slave *slave);
50+
bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quirk);
4651

4752
#else
4853

4954
static inline void sdca_lookup_functions(struct sdw_slave *slave) {}
5055
static inline void sdca_lookup_interface_revision(struct sdw_slave *slave) {}
51-
56+
static inline bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quirk)
57+
{
58+
return false;
59+
}
5260
#endif
5361

5462
#endif

sound/soc/sdca/sdca_device.c

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/acpi.h>
1010
#include <linux/soundwire/sdw.h>
1111
#include <sound/sdca.h>
12+
#include <sound/sdca_function.h>
1213

1314
void sdca_lookup_interface_revision(struct sdw_slave *slave)
1415
{
@@ -22,3 +23,45 @@ void sdca_lookup_interface_revision(struct sdw_slave *slave)
2223
&slave->sdca_data.interface_revision);
2324
}
2425
EXPORT_SYMBOL_NS(sdca_lookup_interface_revision, SND_SOC_SDCA);
26+
27+
static bool sdca_device_quirk_rt712_vb(struct sdw_slave *slave)
28+
{
29+
struct sdw_slave_id *id = &slave->id;
30+
int i;
31+
32+
/*
33+
* The RT712_VA relies on the v06r04 draft, and the
34+
* RT712_VB on a more recent v08r01 draft.
35+
*/
36+
if (slave->sdca_data.interface_revision < 0x0801)
37+
return false;
38+
39+
if (id->mfg_id != 0x025d)
40+
return false;
41+
42+
if (id->part_id != 0x712 &&
43+
id->part_id != 0x713 &&
44+
id->part_id != 0x716 &&
45+
id->part_id != 0x717)
46+
return false;
47+
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)
51+
return true;
52+
}
53+
54+
return false;
55+
}
56+
57+
bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quirk)
58+
{
59+
switch (quirk) {
60+
case SDCA_QUIRKS_RT712_VB:
61+
return sdca_device_quirk_rt712_vb(slave);
62+
default:
63+
break;
64+
}
65+
return false;
66+
}
67+
EXPORT_SYMBOL_NS(sdca_device_quirk_match, SND_SOC_SDCA);

0 commit comments

Comments
 (0)