ASoC: nau8325: Revise soc_enum structure definition.
authorSeven Lee <wtli@nuvoton.com>
Mon, 1 Apr 2024 10:47:53 +0000 (18:47 +0800)
committerMark Brown <broonie@kernel.org>
Tue, 2 Apr 2024 14:55:21 +0000 (15:55 +0100)
This patch is modified nau8325_dac_oversampl_enum enumerated.
Use SOC_VALUE_ENUM instead to hide empty (presumably invalid) options.

Signed-off-by: Seven Lee <wtli@nuvoton.com>
Link: https://msgid.link/r/20240401104753.3432507-1-wtli@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/nau8325.c

index a00a30364c897775dad9a7fdd4dd8f1f0071f0d2..d65f731445977e8ddd649302edf8949c7f208a9f 100644 (file)
@@ -174,13 +174,20 @@ static bool nau8325_volatile_reg(struct device *dev, unsigned int reg)
        }
 }
 
-static const char * const nau8325_dac_oversampl[] = {
-       "64", "256", "128", "", "32" };
+static const char * const nau8325_dac_oversampl_texts[] = {
+       "64", "256", "128", "32",
+};
+
+static const unsigned int nau8325_dac_oversampl_values[] = {
+       0, 1, 2, 4,
+};
 
 static const struct soc_enum nau8325_dac_oversampl_enum =
-       SOC_ENUM_SINGLE(NAU8325_R29_DAC_CTRL1, NAU8325_DAC_OVERSAMPLE_SFT,
-                       ARRAY_SIZE(nau8325_dac_oversampl),
-                       nau8325_dac_oversampl);
+       SOC_VALUE_ENUM_SINGLE(NAU8325_R29_DAC_CTRL1,
+                             NAU8325_DAC_OVERSAMPLE_SFT, 0x7,
+                             ARRAY_SIZE(nau8325_dac_oversampl_texts),
+                             nau8325_dac_oversampl_texts,
+                             nau8325_dac_oversampl_values);
 
 static const DECLARE_TLV_DB_MINMAX_MUTE(dac_vol_tlv, -8000, 600);