hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/sound/soc/codecs/cs4271.c
....@@ -1,17 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * CS4271 ASoC codec driver
34 *
45 * Copyright (c) 2010 Alexander Sverdlin <subaparts@yandex.ru>
5
- *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU General Public License
8
- * as published by the Free Software Foundation; either version 2
9
- * of the License, or (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
156 *
167 * This driver support CS4271 codec being master or slave, working
178 * in control port mode, connected either via SPI or I2C.
....@@ -223,10 +214,10 @@
223214
224215 switch (format & SND_SOC_DAIFMT_MASTER_MASK) {
225216 case SND_SOC_DAIFMT_CBS_CFS:
226
- cs4271->master = 0;
217
+ cs4271->master = false;
227218 break;
228219 case SND_SOC_DAIFMT_CBM_CFM:
229
- cs4271->master = 1;
220
+ cs4271->master = true;
230221 val |= CS4271_MODE1_MASTER;
231222 break;
232223 default:
....@@ -343,7 +334,7 @@
343334 {0, CS4271_MODE1_MODE_4X, 256, CS4271_MODE1_DIV_2},
344335 };
345336
346
-#define CS4171_NR_RATIOS ARRAY_SIZE(cs4271_clk_tab)
337
+#define CS4271_NR_RATIOS ARRAY_SIZE(cs4271_clk_tab)
347338
348339 static int cs4271_hw_params(struct snd_pcm_substream *substream,
349340 struct snd_pcm_hw_params *params,
....@@ -365,9 +356,9 @@
365356 */
366357
367358 if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
368
- !dai->capture_active) ||
359
+ !snd_soc_dai_stream_active(dai, SNDRV_PCM_STREAM_CAPTURE)) ||
369360 (substream->stream == SNDRV_PCM_STREAM_CAPTURE &&
370
- !dai->playback_active)) {
361
+ !snd_soc_dai_stream_active(dai, SNDRV_PCM_STREAM_PLAYBACK))) {
371362 ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2,
372363 CS4271_MODE2_PDN,
373364 CS4271_MODE2_PDN);
....@@ -392,13 +383,13 @@
392383 val = CS4271_MODE1_MODE_4X;
393384
394385 ratio = cs4271->mclk / cs4271->rate;
395
- for (i = 0; i < CS4171_NR_RATIOS; i++)
386
+ for (i = 0; i < CS4271_NR_RATIOS; i++)
396387 if ((cs4271_clk_tab[i].master == cs4271->master) &&
397388 (cs4271_clk_tab[i].speed_mode == val) &&
398389 (cs4271_clk_tab[i].ratio == ratio))
399390 break;
400391
401
- if (i == CS4171_NR_RATIOS) {
392
+ if (i == CS4271_NR_RATIOS) {
402393 dev_err(component->dev, "Invalid sample rate\n");
403394 return -EINVAL;
404395 }