ASoC: cs42l43: Minor code tidy ups

Add some missing commas, refactor a couple small bits of code.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://msgid.link/r/20240125103117.2622095-2-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Charles Keepax 2024-01-25 10:31:12 +00:00 committed by Mark Brown
parent fb430b0639
commit 40f6281c1e
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
2 changed files with 9 additions and 13 deletions

View File

@ -29,11 +29,11 @@
#include "cs42l43.h"
static const unsigned int cs42l43_accdet_us[] = {
20, 100, 1000, 10000, 50000, 75000, 100000, 200000
20, 100, 1000, 10000, 50000, 75000, 100000, 200000,
};
static const unsigned int cs42l43_accdet_db_ms[] = {
0, 125, 250, 500, 750, 1000, 1250, 1500
0, 125, 250, 500, 750, 1000, 1250, 1500,
};
static const unsigned int cs42l43_accdet_ramp_ms[] = { 10, 40, 90, 170 };
@ -851,6 +851,9 @@ static const char * const cs42l43_jack_text[] = {
"Line-In", "Microphone", "Optical",
};
static_assert(ARRAY_SIZE(cs42l43_jack_override_modes) ==
ARRAY_SIZE(cs42l43_jack_text) - 1);
SOC_ENUM_SINGLE_VIRT_DECL(cs42l43_jack_enum, cs42l43_jack_text);
int cs42l43_jack_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
@ -873,9 +876,6 @@ int cs42l43_jack_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *u
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
unsigned int override = ucontrol->value.integer.value[0];
BUILD_BUG_ON(ARRAY_SIZE(cs42l43_jack_override_modes) !=
ARRAY_SIZE(cs42l43_jack_text) - 1);
if (override >= e->items)
return -EINVAL;

View File

@ -1059,12 +1059,10 @@ static int cs42l43_decim_get(struct snd_kcontrol *kcontrol,
int ret;
ret = cs42l43_shutter_get(priv, CS42L43_STATUS_MIC_SHUTTER_MUTE_SHIFT);
if (ret < 0)
return ret;
if (ret > 0)
ret = cs42l43_dapm_get_volsw(kcontrol, ucontrol);
else if (!ret)
ucontrol->value.integer.value[0] = ret;
else
ret = cs42l43_dapm_get_volsw(kcontrol, ucontrol);
return ret;
}
@ -1077,12 +1075,10 @@ static int cs42l43_spk_get(struct snd_kcontrol *kcontrol,
int ret;
ret = cs42l43_shutter_get(priv, CS42L43_STATUS_SPK_SHUTTER_MUTE_SHIFT);
if (ret < 0)
return ret;
if (ret > 0)
ret = snd_soc_get_volsw(kcontrol, ucontrol);
else if (!ret)
ucontrol->value.integer.value[0] = ret;
else
ret = snd_soc_get_volsw(kcontrol, ucontrol);
return ret;
}