mirror of
https://abf.rosa.ru/djam/kernel-6.6.git
synced 2025-02-24 19:32:46 +00:00
67 lines
2.6 KiB
Diff
67 lines
2.6 KiB
Diff
From 96d8efac4b8eb7f6b18b2aff3c02b292801b6999 Mon Sep 17 00:00:00 2001
|
|
From: Marian Postevca <posteuca@mutex.one>
|
|
Date: Wed, 30 Aug 2023 01:01:13 +0300
|
|
Subject: [PATCH 405/415] ASoC: es8316: Replace NR_SUPPORTED_MCLK_LRCK_RATIOS
|
|
with ARRAY_SIZE()
|
|
|
|
No need for a special define since we can use ARRAY_SIZE() directly,
|
|
and won't need to worry to keep it in sync.
|
|
|
|
Signed-off-by: Marian Postevca <posteuca@mutex.one>
|
|
Link: https://lore.kernel.org/r/20230829220116.1159-3-posteuca@mutex.one
|
|
Signed-off-by: Mark Brown <broonie@kernel.org>
|
|
---
|
|
sound/soc/codecs/es8316.c | 9 ++++-----
|
|
1 file changed, 4 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c
|
|
index 09fc0b25f600..a1c3e10c3cf1 100644
|
|
--- a/sound/soc/codecs/es8316.c
|
|
+++ b/sound/soc/codecs/es8316.c
|
|
@@ -27,7 +27,6 @@
|
|
* MCLK/LRCK ratios, but we also add ratio 400, which is commonly used on
|
|
* Intel Cherry Trail platforms (19.2MHz MCLK, 48kHz LRCK).
|
|
*/
|
|
-#define NR_SUPPORTED_MCLK_LRCK_RATIOS ARRAY_SIZE(supported_mclk_lrck_ratios)
|
|
static const unsigned int supported_mclk_lrck_ratios[] = {
|
|
256, 384, 400, 500, 512, 768, 1024
|
|
};
|
|
@@ -40,7 +39,7 @@ struct es8316_priv {
|
|
struct snd_soc_jack *jack;
|
|
int irq;
|
|
unsigned int sysclk;
|
|
- unsigned int allowed_rates[NR_SUPPORTED_MCLK_LRCK_RATIOS];
|
|
+ unsigned int allowed_rates[ARRAY_SIZE(supported_mclk_lrck_ratios)];
|
|
struct snd_pcm_hw_constraint_list sysclk_constraints;
|
|
bool jd_inverted;
|
|
};
|
|
@@ -382,7 +381,7 @@ static int es8316_set_dai_sysclk(struct snd_soc_dai *codec_dai,
|
|
/* Limit supported sample rates to ones that can be autodetected
|
|
* by the codec running in slave mode.
|
|
*/
|
|
- for (i = 0; i < NR_SUPPORTED_MCLK_LRCK_RATIOS; i++) {
|
|
+ for (i = 0; i < ARRAY_SIZE(supported_mclk_lrck_ratios); i++) {
|
|
const unsigned int ratio = supported_mclk_lrck_ratios[i];
|
|
|
|
if (freq % ratio == 0)
|
|
@@ -472,7 +471,7 @@ static int es8316_pcm_hw_params(struct snd_pcm_substream *substream,
|
|
int i;
|
|
|
|
/* Validate supported sample rates that are autodetected from MCLK */
|
|
- for (i = 0; i < NR_SUPPORTED_MCLK_LRCK_RATIOS; i++) {
|
|
+ for (i = 0; i < ARRAY_SIZE(supported_mclk_lrck_ratios); i++) {
|
|
const unsigned int ratio = supported_mclk_lrck_ratios[i];
|
|
|
|
if (es8316->sysclk % ratio != 0)
|
|
@@ -480,7 +479,7 @@ static int es8316_pcm_hw_params(struct snd_pcm_substream *substream,
|
|
if (es8316->sysclk / ratio == params_rate(params))
|
|
break;
|
|
}
|
|
- if (i == NR_SUPPORTED_MCLK_LRCK_RATIOS)
|
|
+ if (i == ARRAY_SIZE(supported_mclk_lrck_ratios))
|
|
return -EINVAL;
|
|
lrck_divider = es8316->sysclk / params_rate(params);
|
|
bclk_divider = lrck_divider / 4;
|
|
--
|
|
2.40.1
|
|
|