drivers/sof: Use topology enums where appropriate

Also correct switch intendation, remove excess empty lines.

Change-Id: I86026e7f6c0c1c7f3dc6a473bb3afe2f6d32a247
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/75230
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Matt DeVillier 2023-05-15 10:32:00 -05:00 committed by Felix Held
parent 579e03a13e
commit 4c5ec21374
2 changed files with 27 additions and 29 deletions

View File

@ -33,12 +33,10 @@ enum _mic_tplg {
_4ch, _4ch,
}; };
struct drivers_sof_config { struct drivers_sof_config {
unsigned int spkr_tplg; enum _spkr_tplg spkr_tplg;
unsigned int jack_tplg; enum _jack_tplg jack_tplg;
unsigned int mic_tplg; enum _mic_tplg mic_tplg;
}; };
#endif /* __DRIVERS_AUDIO_SOF_H__ */ #endif /* __DRIVERS_AUDIO_SOF_H__ */

View File

@ -8,39 +8,39 @@
#include "chip.h" #include "chip.h"
static const char *get_spkr_tplg_str(unsigned int index) static const char *get_spkr_tplg_str(enum _spkr_tplg tplg)
{ {
switch (index) { switch (tplg) {
case 1: return "max98373"; case max98373: return "max98373";
case 2: return "max98360a"; case max98360a: return "max98360a";
case 3: return "max98357a"; case max98357a: return "max98357a";
case 4: return "max98357a-tdm"; case max98357a_tdm: return "max98357a-tdm";
case 5: return "max98390"; case max98390: return "max98390";
case 6: return "rt1011"; case rt1011: return "rt1011";
case 7: return "rt1015"; case rt1015: return "rt1015";
default: return "default"; default: return "default";
} }
} }
static const char *get_jack_tplg_str(unsigned int index) static const char *get_jack_tplg_str(enum _jack_tplg tplg)
{ {
switch (index) { switch (tplg) {
case 1: return "cs42l42"; case cs42l42: return "cs42l42";
case 2: return "da7219"; case da7219: return "da7219";
case 3: return "nau8825"; case nau8825: return "nau8825";
case 4: return "rt5682"; case rt5682: return "rt5682";
default: return "default"; default: return "default";
} }
} }
static const char *get_mic_tplg_str(unsigned int index) static const char *get_mic_tplg_str(enum _mic_tplg tplg)
{ {
switch (index) { switch (tplg) {
case 1: return "1ch"; case _1ch: return "1ch";
case 2: return "2ch-pdm0"; case _2ch_pdm0: return "2ch-pdm0";
case 3: return "2ch-pdm1"; case _2ch_pdm1: return "2ch-pdm1";
case 4: return "4ch"; case _4ch: return "4ch";
default: return "default"; default: return "default";
} }
} }