.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * CS4271 ASoC codec driver |
---|
3 | 4 | * |
---|
4 | 5 | * 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. |
---|
15 | 6 | * |
---|
16 | 7 | * This driver support CS4271 codec being master or slave, working |
---|
17 | 8 | * in control port mode, connected either via SPI or I2C. |
---|
.. | .. |
---|
223 | 214 | |
---|
224 | 215 | switch (format & SND_SOC_DAIFMT_MASTER_MASK) { |
---|
225 | 216 | case SND_SOC_DAIFMT_CBS_CFS: |
---|
226 | | - cs4271->master = 0; |
---|
| 217 | + cs4271->master = false; |
---|
227 | 218 | break; |
---|
228 | 219 | case SND_SOC_DAIFMT_CBM_CFM: |
---|
229 | | - cs4271->master = 1; |
---|
| 220 | + cs4271->master = true; |
---|
230 | 221 | val |= CS4271_MODE1_MASTER; |
---|
231 | 222 | break; |
---|
232 | 223 | default: |
---|
.. | .. |
---|
343 | 334 | {0, CS4271_MODE1_MODE_4X, 256, CS4271_MODE1_DIV_2}, |
---|
344 | 335 | }; |
---|
345 | 336 | |
---|
346 | | -#define CS4171_NR_RATIOS ARRAY_SIZE(cs4271_clk_tab) |
---|
| 337 | +#define CS4271_NR_RATIOS ARRAY_SIZE(cs4271_clk_tab) |
---|
347 | 338 | |
---|
348 | 339 | static int cs4271_hw_params(struct snd_pcm_substream *substream, |
---|
349 | 340 | struct snd_pcm_hw_params *params, |
---|
.. | .. |
---|
365 | 356 | */ |
---|
366 | 357 | |
---|
367 | 358 | if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK && |
---|
368 | | - !dai->capture_active) || |
---|
| 359 | + !snd_soc_dai_stream_active(dai, SNDRV_PCM_STREAM_CAPTURE)) || |
---|
369 | 360 | (substream->stream == SNDRV_PCM_STREAM_CAPTURE && |
---|
370 | | - !dai->playback_active)) { |
---|
| 361 | + !snd_soc_dai_stream_active(dai, SNDRV_PCM_STREAM_PLAYBACK))) { |
---|
371 | 362 | ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2, |
---|
372 | 363 | CS4271_MODE2_PDN, |
---|
373 | 364 | CS4271_MODE2_PDN); |
---|
.. | .. |
---|
392 | 383 | val = CS4271_MODE1_MODE_4X; |
---|
393 | 384 | |
---|
394 | 385 | ratio = cs4271->mclk / cs4271->rate; |
---|
395 | | - for (i = 0; i < CS4171_NR_RATIOS; i++) |
---|
| 386 | + for (i = 0; i < CS4271_NR_RATIOS; i++) |
---|
396 | 387 | if ((cs4271_clk_tab[i].master == cs4271->master) && |
---|
397 | 388 | (cs4271_clk_tab[i].speed_mode == val) && |
---|
398 | 389 | (cs4271_clk_tab[i].ratio == ratio)) |
---|
399 | 390 | break; |
---|
400 | 391 | |
---|
401 | | - if (i == CS4171_NR_RATIOS) { |
---|
| 392 | + if (i == CS4271_NR_RATIOS) { |
---|
402 | 393 | dev_err(component->dev, "Invalid sample rate\n"); |
---|
403 | 394 | return -EINVAL; |
---|
404 | 395 | } |
---|