diff options
author | Matt DeVillier <matt.devillier@gmail.com> | 2023-05-15 10:32:00 -0500 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2023-05-17 11:19:35 +0000 |
commit | 4c5ec2137439bc098ef046a0e06fa5c4d3ded457 (patch) | |
tree | c3688ab63e8a7d4348d882adce1bdfa85e55f63e /src | |
parent | 579e03a13ee0ed11dfdf47493deb3a9d9ab672c4 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/drivers/sof/chip.h | 8 | ||||
-rw-r--r-- | src/drivers/sof/sof.c | 48 |
2 files changed, 27 insertions, 29 deletions
diff --git a/src/drivers/sof/chip.h b/src/drivers/sof/chip.h index 518e06c3bd..5f7e8b8120 100644 --- a/src/drivers/sof/chip.h +++ b/src/drivers/sof/chip.h @@ -33,12 +33,10 @@ enum _mic_tplg { _4ch, }; - - struct drivers_sof_config { - unsigned int spkr_tplg; - unsigned int jack_tplg; - unsigned int mic_tplg; + enum _spkr_tplg spkr_tplg; + enum _jack_tplg jack_tplg; + enum _mic_tplg mic_tplg; }; #endif /* __DRIVERS_AUDIO_SOF_H__ */ diff --git a/src/drivers/sof/sof.c b/src/drivers/sof/sof.c index a8fc3cee0d..edc1f80d0e 100644 --- a/src/drivers/sof/sof.c +++ b/src/drivers/sof/sof.c @@ -8,39 +8,39 @@ #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) { - case 1: return "max98373"; - case 2: return "max98360a"; - case 3: return "max98357a"; - case 4: return "max98357a-tdm"; - case 5: return "max98390"; - case 6: return "rt1011"; - case 7: return "rt1015"; - default: return "default"; + switch (tplg) { + case max98373: return "max98373"; + case max98360a: return "max98360a"; + case max98357a: return "max98357a"; + case max98357a_tdm: return "max98357a-tdm"; + case max98390: return "max98390"; + case rt1011: return "rt1011"; + case rt1015: return "rt1015"; + 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) { - case 1: return "cs42l42"; - case 2: return "da7219"; - case 3: return "nau8825"; - case 4: return "rt5682"; - default: return "default"; + switch (tplg) { + case cs42l42: return "cs42l42"; + case da7219: return "da7219"; + case nau8825: return "nau8825"; + case rt5682: return "rt5682"; + 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) { - case 1: return "1ch"; - case 2: return "2ch-pdm0"; - case 3: return "2ch-pdm1"; - case 4: return "4ch"; - default: return "default"; + switch (tplg) { + case _1ch: return "1ch"; + case _2ch_pdm0: return "2ch-pdm0"; + case _2ch_pdm1: return "2ch-pdm1"; + case _4ch: return "4ch"; + default: return "default"; } } |