1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <acpi/acpi_device.h>
4 #include <acpi/acpigen.h>
5 #include <device/device.h>
9 static const char *get_spkr_tplg_str(enum _spkr_tplg tplg
)
12 case max98373
: return "max98373";
13 case max98373_ssp2
: return "max98373-ssp2";
14 case max98360a
: return "max98360a";
15 case max98357a
: return "max98357a";
16 case max98357a_tdm
: return "max98357a-tdm";
17 case max98390
: return "max98390";
18 case rt1011
: return "rt1011";
19 case rt1015
: return "rt1015";
20 case rt1019
: return "rt1019";
21 case rt5650_sp
: return "rt5650";
22 default: return "default";
26 static const char *get_jack_tplg_str(enum _jack_tplg tplg
)
29 case cs42l42
: return "cs42l42";
30 case da7219
: return "da7219";
31 case nau8825
: return "nau8825";
32 case rt5650_hp
: return "rt5650";
33 case rt5682
: return "rt5682";
34 default: return "default";
38 static const char *get_mic_tplg_str(enum _mic_tplg tplg
)
41 case _1ch
: return "1ch";
42 case _2ch_pdm0
: return "2ch-pdm0";
43 case _2ch_pdm1
: return "2ch-pdm1";
44 case _4ch
: return "4ch";
45 default: return "default";
49 static void sof_fill_ssdt_generator(const struct device
*dev
)
51 struct drivers_sof_config
*config
= dev
->chip_info
;
52 const char *scope
= acpi_device_scope(dev
);
55 if (!dev
->enabled
|| !config
|| !scope
)
59 acpigen_write_scope(scope
);
62 dsd
= acpi_dp_new_table("_DSD");
63 acpi_dp_add_string(dsd
, "speaker-tplg",
64 get_spkr_tplg_str(config
->spkr_tplg
));
65 acpi_dp_add_string(dsd
, "hp-tplg",
66 get_jack_tplg_str(config
->jack_tplg
));
67 acpi_dp_add_string(dsd
, "mic-tplg",
68 get_mic_tplg_str(config
->mic_tplg
));
70 acpigen_pop_len(); /* Scope */
74 static struct device_operations sof_ops
= {
75 .read_resources
= noop_read_resources
,
76 .set_resources
= noop_set_resources
,
77 .acpi_fill_ssdt
= sof_fill_ssdt_generator
,
80 static void sof_enable(struct device
*dev
)
85 struct chip_operations drivers_sof_ops
= {
87 .enable_dev
= sof_enable