rt1308-sdw.c (a4654e9bde4ecedb4921e6c8fe2088114bdff1b3) rt1308-sdw.c (f7cc9b996e7417708b8168697762e4bc97fa6696)
1// SPDX-License-Identifier: GPL-2.0
2//
3// rt1308-sdw.c -- rt1308 ALSA SoC audio driver
4//
5// Copyright(c) 2019 Realtek Semiconductor Corp.
6//
7//
8#include <linux/delay.h>

--- 493 unchanged lines hidden (view full) ---

502{
503 struct sdw_stream_data *stream;
504
505 stream = snd_soc_dai_get_dma_data(dai, substream);
506 snd_soc_dai_set_dma_data(dai, substream, NULL);
507 kfree(stream);
508}
509
1// SPDX-License-Identifier: GPL-2.0
2//
3// rt1308-sdw.c -- rt1308 ALSA SoC audio driver
4//
5// Copyright(c) 2019 Realtek Semiconductor Corp.
6//
7//
8#include <linux/delay.h>

--- 493 unchanged lines hidden (view full) ---

502{
503 struct sdw_stream_data *stream;
504
505 stream = snd_soc_dai_get_dma_data(dai, substream);
506 snd_soc_dai_set_dma_data(dai, substream, NULL);
507 kfree(stream);
508}
509
510static int rt1308_sdw_set_tdm_slot(struct snd_soc_dai *dai,
511 unsigned int tx_mask,
512 unsigned int rx_mask,
513 int slots, int slot_width)
514{
515 struct snd_soc_component *component = dai->component;
516 struct rt1308_sdw_priv *rt1308 =
517 snd_soc_component_get_drvdata(component);
518
519 if (tx_mask)
520 return -EINVAL;
521
522 if (slots > 2)
523 return -EINVAL;
524
525 rt1308->rx_mask = rx_mask;
526 rt1308->slots = slots;
527 /* slot_width is not used since it's irrelevant for SoundWire */
528
529 return 0;
530}
531
510static int rt1308_sdw_hw_params(struct snd_pcm_substream *substream,
511 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
512{
513 struct snd_soc_component *component = dai->component;
514 struct rt1308_sdw_priv *rt1308 =
515 snd_soc_component_get_drvdata(component);
516 struct sdw_stream_config stream_config;
517 struct sdw_port_config port_config;

--- 74 unchanged lines hidden (view full) ---

592 .num_dapm_routes = ARRAY_SIZE(rt1308_dapm_routes),
593};
594
595static const struct snd_soc_dai_ops rt1308_aif_dai_ops = {
596 .hw_params = rt1308_sdw_hw_params,
597 .hw_free = rt1308_sdw_pcm_hw_free,
598 .set_sdw_stream = rt1308_set_sdw_stream,
599 .shutdown = rt1308_sdw_shutdown,
532static int rt1308_sdw_hw_params(struct snd_pcm_substream *substream,
533 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
534{
535 struct snd_soc_component *component = dai->component;
536 struct rt1308_sdw_priv *rt1308 =
537 snd_soc_component_get_drvdata(component);
538 struct sdw_stream_config stream_config;
539 struct sdw_port_config port_config;

--- 74 unchanged lines hidden (view full) ---

614 .num_dapm_routes = ARRAY_SIZE(rt1308_dapm_routes),
615};
616
617static const struct snd_soc_dai_ops rt1308_aif_dai_ops = {
618 .hw_params = rt1308_sdw_hw_params,
619 .hw_free = rt1308_sdw_pcm_hw_free,
620 .set_sdw_stream = rt1308_set_sdw_stream,
621 .shutdown = rt1308_sdw_shutdown,
622 .set_tdm_slot = rt1308_sdw_set_tdm_slot,
600};
601
602#define RT1308_STEREO_RATES SNDRV_PCM_RATE_48000
603#define RT1308_FORMATS (SNDRV_PCM_FMTBIT_S8 | \
604 SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S16_LE | \
605 SNDRV_PCM_FMTBIT_S24_LE)
606
607static struct snd_soc_dai_driver rt1308_sdw_dai[] = {

--- 129 unchanged lines hidden ---
623};
624
625#define RT1308_STEREO_RATES SNDRV_PCM_RATE_48000
626#define RT1308_FORMATS (SNDRV_PCM_FMTBIT_S8 | \
627 SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S16_LE | \
628 SNDRV_PCM_FMTBIT_S24_LE)
629
630static struct snd_soc_dai_driver rt1308_sdw_dai[] = {

--- 129 unchanged lines hidden ---