ASoC: rt722-sdca: Add RT722 SDCA driver
Subsystems (3)
PATCH v2 1/1 ASoC: rt722-sdca: Add RT722 SDCA driver
This is the initial codec driver for rt722-sdca.
Patch v2 is to fix warning message from kernel test robot.
--- sound/soc/codecs/Kconfig | 7 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/rt722-sdca-sdw.c | 505 ++++++++++ sound/soc/codecs/rt722-sdca-sdw.h | 124 +++ sound/soc/codecs/rt722-sdca.c | 1549 +++++++++++++++++++++++++++++ sound/soc/codecs/rt722-sdca.h | 237 +++++ 6 files changed, 2424 insertions(+) create mode 100644 sound/soc/codecs/rt722-sdca-sdw.c create mode 100644 sound/soc/codecs/rt722-sdca-sdw.h create mode 100644 sound/soc/codecs/rt722-sdca.c create mode 100644 sound/soc/codecs/rt722-sdca.h
sound/soc/codecs/Kconfig +7 -0
@@ -207,6 +207,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_RT712_SDCA_DMIC_SDW imply SND_SOC_RT715_SDW imply SND_SOC_RT715_SDCA_SDW + imply SND_SOC_RT722_SDCA_SDW imply SND_SOC_RT1308_SDW imply SND_SOC_RT1316_SDW imply SND_SOC_RT1318_SDW
@@ -1539,6 +1540,12 @@ config SND_SOC_RT712_SDCA_DMIC_SDW select REGMAP_SOUNDWIRE select REGMAP_SOUNDWIRE_MBQ +config SND_SOC_RT722_SDCA_SDW + tristate "Realtek RT722 SDCA Codec - SDW" + depends on SOUNDWIRE + select REGMAP_SOUNDWIRE + select REGMAP_SOUNDWIRE_MBQ + config SND_SOC_RT715 tristate
sound/soc/codecs/Makefile +2 -0
@@ -237,6 +237,7 @@ snd-soc-rt712-sdca-objs := rt712-sdca.o rt712-sdca-sdw.o snd-soc-rt712-sdca-dmic-objs := rt712-sdca-dmic.o snd-soc-rt715-objs := rt715.o rt715-sdw.o snd-soc-rt715-sdca-objs := rt715-sdca.o rt715-sdca-sdw.o +snd-soc-rt722-sdca-objs := rt722-sdca.o rt722-sdca-sdw.o snd-soc-rt9120-objs := rt9120.o snd-soc-sdw-mockup-objs := sdw-mockup.o snd-soc-sgtl5000-objs := sgtl5000.o
@@ -607,6 +608,7 @@ obj-$(CONFIG_SND_SOC_RT712_SDCA_SDW) += snd-soc-rt712-sdca.o obj-$(CONFIG_SND_SOC_RT712_SDCA_DMIC_SDW) += snd-soc-rt712-sdca-dmic.o obj-$(CONFIG_SND_SOC_RT715) += snd-soc-rt715.o obj-$(CONFIG_SND_SOC_RT715_SDCA_SDW) += snd-soc-rt715-sdca.o +obj-$(CONFIG_SND_SOC_RT722_SDCA_SDW) += snd-soc-rt722-sdca.o obj-$(CONFIG_SND_SOC_RT9120) += snd-soc-rt9120.o obj-$(CONFIG_SND_SOC_SDW_MOCKUP) += snd-soc-sdw-mockup.o obj-$(CONFIG_SND_SOC_SGTL5000) += snd-soc-sgtl5000.o
sound/soc/codecs/rt722-sdca-sdw.c new file +505 -0
505 lines not on this page · raw message
sound/soc/codecs/rt722-sdca-sdw.h new file +124 -0
124 lines not on this page · raw message
sound/soc/codecs/rt722-sdca.c new file +1549 -0
1,549 lines not on this page · raw message
sound/soc/codecs/rt722-sdca.h new file +237 -0
237 lines not on this page · raw message
Signature · 1 line
2.40.0
Quoted 3 lines · Jack Yu
This is the initial codec driver for rt722-sdca.
Patch v2 is to fix warning message from kernel test robot.
this version information should go below the --- line ...
Quoted 3 lines
Signed-off-by Jack Yu <[email protected]>---
... here
Quoted 7 lines
sound/soc/codecs/rt722-sdca-sdw.c new file +7
-0+static int rt722_sdca_read_prop (struct sdw_slave *slave) +{ +struct sdw_slave_prop *prop = &slave->prop; +int nval; +int i, j; +u32 bit; +unsigned long addr;
sound/soc/codecs/rt722-sdca-sdw.c line 214
Quoted 10 lines
sound/soc/codecs/rt722-sdca-sdw.c new file +10
-0+struct sdw_dpn_prop *dpn; + + prop->scp_int1_mask =SDW_SCP_INT1_BUS_CLASH |SDW_SCP_INT1_PARITY ; + prop->quirks =SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY ; + + prop->paging_support = true; + +/* first we need to allocate memory for set bits in port lists */ + prop->source_ports =BIT (6 ) |BIT (2 );/* BITMAP: 01000100 */ + prop->sink_ports =BIT (3 ) |BIT (1 );/* BITMAP: 00001010 */
which port is used for what?
Quoted 63 lines
sound/soc/codecs/rt722-sdca-sdw.c new file +62
-0+ + nval =hweight32 (prop->source_ports); + prop->src_dpn_prop =devm_kcalloc (&slave->dev, nval, +sizeof (*prop->src_dpn_prop),GFP_KERNEL ); +if (!prop->src_dpn_prop) +return -ENOMEM ; + + i =0 ; + dpn = prop->src_dpn_prop; + addr = prop->source_ports; +for_each_set_bit (bit, &addr,32 ) { + dpn[i].num = bit; + dpn[i].type =SDW_DPN_FULL ; + dpn[i].simple_ch_prep_sm = true; + dpn[i].ch_prep_timeout =10 ; + i++; + } + +/* do this again for sink now */ + nval =hweight32 (prop->sink_ports); + prop->sink_dpn_prop =devm_kcalloc (&slave->dev, nval, +sizeof (*prop->sink_dpn_prop),GFP_KERNEL ); +if (!prop->sink_dpn_prop) +return -ENOMEM ; + + j =0 ; + dpn = prop->sink_dpn_prop; + addr = prop->sink_ports; +for_each_set_bit (bit, &addr,32 ) { + dpn[j].num = bit; + dpn[j].type =SDW_DPN_FULL ; + dpn[j].simple_ch_prep_sm = true; + dpn[j].ch_prep_timeout =10 ; + j++; + } + +/* set the timeout values */ + prop->clk_stop_timeout =200 ; + +/* wake-up event */ + prop->wake_capable =1 ; + +return 0 ; +} +static int rt722_sdca_pcm_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params, +struct snd_soc_dai *dai) +{ +struct snd_soc_component *component = dai->component; +struct rt722_sdca_priv *rt722 =snd_soc_component_get_drvdata (component); +struct sdw_stream_config stream_config; +struct sdw_port_config port_config; +enum sdw_data_direction direction; +struct sdw_stream_runtime *sdw_stream; +int retval, port, num_channels; +unsigned int sampling_rate; + +dev_dbg (dai->dev,"%s %s" , __func__, dai->name); + sdw_stream =snd_soc_dai_get_dma_data (dai, substream); + +if (!sdw_stream) +return -EINVAL ;
sound/soc/codecs/rt722-sdca-sdw.c
Quoted 10 lines
sound/soc/codecs/rt722-sdca-sdw.c new file +10
-0+ +if (!rt722->slave) +return -EINVAL ; + +/* +* RT722_AIF1 with port = 1 for headphone playback +* RT722_AIF1 with port = 2 for headset-mic capture +* RT722_AIF2 with port = 3 for speaker playback +* RT722_AIF2 with port = 6 for digital-mic capture +*/
I guess the answer is here...
It wouldn't hurt to have the information above as well.
It's also an interesting partition because in theory the amplifier and mic 'functions' are supposed to be independent, yet they are on the same DAI.
Bard, would this work for the machine driver integration?
Quoted 66 lines
sound/soc/codecs/rt722-sdca.c new file +66
-0+if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { + direction =SDW_DATA_DIR_RX ; +if (dai->id ==RT722_AIF1 ) + port =1 ; +else if (dai->id ==RT722_AIF2 ) + port =3 ; +else +return -EINVAL ; + }else { + direction =SDW_DATA_DIR_TX ; +if (dai->id ==RT722_AIF1 ) + port =2 ; +else if (dai->id ==RT722_AIF2 ) + port =6 ; +else +return -EINVAL ; + } + stream_config.frame_rate =params_rate (params); + stream_config.ch_count =params_channels (params); + stream_config.bps =snd_pcm_format_width (params_format (params)); + stream_config.direction = direction; + + num_channels =params_channels (params); + port_config.ch_mask =GENMASK (num_channels -1 ,0 ); + port_config.num = port; + + retval =sdw_stream_add_slave (rt722->slave, &stream_config, + &port_config,1 , sdw_stream); +if (retval) { +dev_err (dai->dev,"Unable to configure port\n" ); +return retval; + } + +if (params_channels (params) >16 ) { +dev_err (component->dev,"Unsupported channels %d\n" , +params_channels (params)); +return -EINVAL ; + } + +/* sampling rate configuration */ +switch (params_rate (params)) { +case 44100 : + sampling_rate =RT722_SDCA_RATE_44100HZ ; +break ; +case 48000 : + sampling_rate =RT722_SDCA_RATE_48000HZ ; +break ; +case 96000 : + sampling_rate =RT722_SDCA_RATE_96000HZ ; +break ; +case 192000 : + sampling_rate =RT722_SDCA_RATE_192000HZ ; +break ; +default : +dev_err (component->dev,"Rate %d is not supported\n" , +params_rate (params)); +return -EINVAL ; + } + +/* set sampling frequency */ +if (dai->id ==RT722_AIF1 ) { +regmap_write (rt722->regmap, +SDW_SDCA_CTL (FUNC_NUM_JACK_CODEC ,RT722_SDCA_ENT_CS01 , +RT722_SDCA_CTL_SAMPLE_FREQ_INDEX ,0 ), sampling_rate); + regmap_write(rt722->regmap, + SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT722_SDCA_ENT_CS11,
sound/soc/codecs/rt722-sdca.c line 1261
Quoted 10 lines
sound/soc/codecs/rt722-sdca.c new file +10
-0+ RT722_SDCA_CTL_SAMPLE_FREQ_INDEX, 0), sampling_rate); + } + +if (dai->id ==RT722_AIF2 ) { +regmap_write (rt722->regmap, +SDW_SDCA_CTL (FUNC_NUM_MIC_ARRAY ,RT722_SDCA_ENT_CS1F , +RT722_SDCA_CTL_SAMPLE_FREQ_INDEX ,0 ), sampling_rate); +regmap_write (rt722->regmap, +SDW_SDCA_CTL (FUNC_NUM_AMP ,RT722_SDCA_ENT_CS31 , +RT722_SDCA_CTL_SAMPLE_FREQ_INDEX ,0 ), sampling_rate);
and that's precisely the sort of problems I had in mind earlier. Why would the sample-rate be aligned for both amplifier and dmic?
I don't think this follows the intent of the SDCA spec. The functions are supposed to be independent, so when we set hw_params for e.g. amplifiers we can't touch the microphone function.
I would recommend splitting the DAIs here to have self-contained operations that preserve the independence between functions - if the hardware can deal with independent functions we have no reason to rejoin these functions at the driver level, do we?
Quoted 72 lines
sound/soc/codecs/rt722-sdca.c new file +72
-0+ } + +return 0 ; +} + +static int rt722_sdca_pcm_hw_free (struct snd_pcm_substream *substream, +struct snd_soc_dai *dai) +{ +struct snd_soc_component *component = dai->component; +struct rt722_sdca_priv *rt722 =snd_soc_component_get_drvdata (component); +struct sdw_stream_runtime *sdw_stream = +snd_soc_dai_get_dma_data (dai, substream); + +if (!rt722->slave) +return -EINVAL ; + +sdw_stream_remove_slave (rt722->slave, sdw_stream); +return 0 ; +} + +#define RT722_STEREO_RATES (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | \ + SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_192000) +#define RT722_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ + SNDRV_PCM_FMTBIT_S24_LE) + +static const struct snd_soc_dai_ops rt722_sdca_ops = { + .hw_params = rt722_sdca_pcm_hw_params, + .hw_free = rt722_sdca_pcm_hw_free, + .set_stream = rt722_sdca_set_sdw_stream, + .shutdown = rt722_sdca_shutdown, +}; + +static struct snd_soc_dai_driver rt722_sdca_dai[] = { + { + .name ="rt722-sdca-aif1" , + .id =RT722_AIF1 , + .playback = { + .stream_name ="DP1 Headphone Playback" , + .channels_min =1 , + .channels_max =2 , + .rates =RT722_STEREO_RATES , + .formats =RT722_FORMATS , + }, + .capture = { + .stream_name ="DP2 Headset Capture" , + .channels_min =1 , + .channels_max =2 , + .rates =RT722_STEREO_RATES , + .formats =RT722_FORMATS , + }, + .ops = &rt722_sdca_ops, + }, + { + .name ="rt722-sdca-aif2" , + .id =RT722_AIF2 , + .playback = { + .stream_name ="DP3 Speaker Playback" , + .channels_min =1 , + .channels_max =2 , + .rates =RT722_STEREO_RATES , + .formats =RT722_FORMATS , + }, + .capture = { + .stream_name ="DP6 DMic Capture" , + .channels_min =1 , + .channels_max =2 , + .rates =RT722_STEREO_RATES , + .formats =RT722_FORMATS , + }, + .ops = &rt722_sdca_ops, + } +};
Quoted 17 lines
-----Original Message-----
From: Pierre-Louis Bossart <[email protected]>
Sent: Wednesday, April 19, 2023 10:24 PM
To: Jack Yu <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; Flove(HsinFu) <[email protected]>; Oder Chiou <[email protected]>; Shuming [范書 銘] <[email protected]>; Derek [方德義] <[email protected]>; Bard Liao <[email protected]>
Subject: Re: [PATCH v2] ASoC: rt722-sdca: Add RT722 SDCA driverExternal mail.
Quoted 7 lines
Quoted 3 lines · Jack Yu
This is the initial codec driver for rt722-sdca.
Patch v2 is to fix warning message from kernel test robot.
this version information should go below the --- line ...
Quoted 1 line
Ok, I'll fix it.
Quoted 16 lines
Quoted 2 lines
Signed-off-by Jack Yu <[email protected]>---
... here
sound/soc/codecs/rt722-sdca-sdw.c
Quoted 9 lines
sound/soc/codecs/rt722-sdca-sdw.c new file +9
-0+static int rt722_sdca_read_prop (struct sdw_slave *slave) { +struct sdw_slave_prop *prop = &slave->prop; +int nval; +int i, j; +u32 bit; +unsigned long addr; +struct sdw_dpn_prop *dpn; + + prop->scp_int1_mask = SDW_SCP_INT1_BUS_CLASH |
SDW_SCP_INT1_PARITY;
Quoted 9 lines
sound/soc/codecs/rt722-sdca-sdw.c line 214
Quoted 7 lines
sound/soc/codecs/rt722-sdca-sdw.c new file +7
-0+ prop->quirks =SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY ; + + prop->paging_support = true; + +/* first we need to allocate memory for set bits in port lists */ + prop->source_ports =BIT (6 ) |BIT (2 );/* BITMAP: 01000100 */ + prop->sink_ports =BIT (3 ) |BIT (1 );/* BITMAP: 00001010 */ which port is used for what?
I'll add some information regarding to port configuration.
Quoted 78 lines
Quoted 37 lines
sound/soc/codecs/rt722-sdca-sdw.c new file +36
-0+ + nval =hweight32 (prop->source_ports); + prop->src_dpn_prop =devm_kcalloc (&slave->dev, nval, +sizeof (*prop->src_dpn_prop),GFP_KERNEL ); +if (!prop->src_dpn_prop) +return -ENOMEM ; + + i =0 ; + dpn = prop->src_dpn_prop; + addr = prop->source_ports; +for_each_set_bit (bit, &addr,32 ) { + dpn[i].num = bit; + dpn[i].type =SDW_DPN_FULL ; + dpn[i].simple_ch_prep_sm = true; + dpn[i].ch_prep_timeout =10 ; + i++; + } + +/* do this again for sink now */ + nval =hweight32 (prop->sink_ports); + prop->sink_dpn_prop =devm_kcalloc (&slave->dev, nval, +sizeof (*prop->sink_dpn_prop),GFP_KERNEL ); +if (!prop->sink_dpn_prop) +return -ENOMEM ; + + j =0 ; + dpn = prop->sink_dpn_prop; + addr = prop->sink_ports; +for_each_set_bit (bit, &addr,32 ) { + dpn[j].num = bit; + dpn[j].type =SDW_DPN_FULL ; + dpn[j].simple_ch_prep_sm = true; + dpn[j].ch_prep_timeout =10 ; + j++; + } +sound/soc/codecs/rt722-sdca-sdw.c
Quoted 10 lines
sound/soc/codecs/rt722-sdca-sdw.c new file +9
-0+/* set the timeout values */ + prop->clk_stop_timeout =200 ; + +/* wake-up event */ + prop->wake_capable =1 ; + +return 0 ; +} +static int rt722_sdca_pcm_hw_params(struct snd_pcm_substream*substream,
sound/soc/codecs/rt722-sdca.c
Quoted 4 lines
sound/soc/codecs/rt722-sdca.c new file +4
-0+struct snd_pcm_hw_params *params, + struct snd_soc_dai *dai) { + struct snd_soc_component *component = dai->component; + struct rt722_sdca_priv *rt722 =
snd_soc_component_get_drvdata(component);Quoted 12 lines
sound/soc/codecs/rt722-sdca.c new file +12
-0+struct sdw_stream_config stream_config; +struct sdw_port_config port_config; +enum sdw_data_direction direction; +struct sdw_stream_runtime *sdw_stream; +int retval, port, num_channels; +unsigned int sampling_rate; + +dev_dbg (dai->dev,"%s %s" , __func__, dai->name); + sdw_stream =snd_soc_dai_get_dma_data (dai, substream); + +if (!sdw_stream) +return -EINVAL ;sound/soc/codecs/rt722-sdca.c line 1185
Quoted 10 lines
sound/soc/codecs/rt722-sdca.c new file +10
-0+ +if (!rt722->slave) +return -EINVAL ; + +/* +* RT722_AIF1 with port = 1 for headphone playback +* RT722_AIF1 with port = 2 for headset-mic capture +* RT722_AIF2 with port = 3 for speaker playback +* RT722_AIF2 with port = 6 for digital-mic capture +*/ I guess the answer is here...
Quoted 5 lines
It wouldn't hurt to have the information above as well.
It's also an interesting partition because in theory the amplifier and mic 'functions' are supposed to be independent, yet they are on the same DAI.
I can separate these two functions (dmic and speaker) into two DAIs like below
static struct snd_soc_dai_driver rt722_sdca_dai[] = {
...
{
.name = "rt722-sdca-aif2",
.id = RT722_AIF2,
.playback = {
.stream_name = "DP3 Speaker Playback",
.channels_min = 1,
.channels_max = 2,
.rates = RT722_STEREO_RATES,
.formats = RT722_FORMATS,
},
.ops = &rt722_sdca_ops,
},
{
.name = "rt722-sdca-aif3",
.id = RT722_AIF3,
.capture = {
.stream_name = "DP6 DMic Capture",
.channels_min = 1,
.channels_max = 2,
.rates = RT722_STEREO_RATES,
.formats = RT722_FORMATS,
},
.ops = &rt722_sdca_ops,
}...
};
Quoted 92 lines
Bard, would this work for the machine driver integration?
Quoted 10 lines
sound/soc/codecs/rt722-sdca.c new file +10
-0+if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { + direction =SDW_DATA_DIR_RX ; +if (dai->id ==RT722_AIF1 ) + port =1 ; +else if (dai->id ==RT722_AIF2 ) + port =3 ; +else +return -EINVAL ; + }else { + direction =SDW_DATA_DIR_TX ;sound/soc/codecs/rt722-sdca.c
Quoted 10 lines
sound/soc/codecs/rt722-sdca.c new file +10
-0+if (dai->id ==RT722_AIF1 ) + port =2 ; +else if (dai->id ==RT722_AIF2 ) + port =6 ; +else +return -EINVAL ; + } + stream_config.frame_rate =params_rate (params); + stream_config.ch_count =params_channels (params); + stream_config.bps =snd_pcm_format_width(params_format(params));
Quoted 33 lines
sound/soc/codecs/rt722-sdca.c new file +33
-0+ stream_config.direction = direction; + + num_channels =params_channels (params); + port_config.ch_mask =GENMASK (num_channels -1 ,0 ); + port_config.num = port; + + retval =sdw_stream_add_slave (rt722->slave, &stream_config, + &port_config,1 , sdw_stream); +if (retval) { +dev_err (dai->dev,"Unable to configure port\n" ); +return retval; + } + +if (params_channels (params) >16 ) { +dev_err (component->dev,"Unsupported channels %d\n" , +params_channels (params)); +return -EINVAL ; + } + +/* sampling rate configuration */ +switch (params_rate (params)) { +case 44100 : + sampling_rate =RT722_SDCA_RATE_44100HZ ; +break ; +case 48000 : + sampling_rate =RT722_SDCA_RATE_48000HZ ; +break ; +case 96000 : + sampling_rate =RT722_SDCA_RATE_96000HZ ; +break ; +case 192000 : + sampling_rate =RT722_SDCA_RATE_192000HZ ; +break ;sound/soc/codecs/rt722-sdca.c
Quoted 10 lines
sound/soc/codecs/rt722-sdca.c new file +10
-0+default : +dev_err (component->dev,"Rate %d is not supported\n" , +params_rate (params)); +return -EINVAL ; + } + +/* set sampling frequency */ +if (dai->id ==RT722_AIF1 ) { + regmap_write(rt722->regmap, + SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
RT722_SDCA_ENT_CS01,Quoted 1 line
+
RT722_SDCA_CTL_SAMPLE_FREQ_INDEX, 0),sampling_rate);Review
Quoted 2 lines
(quoted diff) +2
-0+ regmap_write(rt722->regmap, + SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
RT722_SDCA_ENT_CS11,Quoted 1 line
+
RT722_SDCA_CTL_SAMPLE_FREQ_INDEX, 0),sampling_rate);sound/soc/codecs/rt722-sdca.c
Quoted 5 lines
sound/soc/codecs/rt722-sdca.c new file +5
-0+ } + +if (dai->id ==RT722_AIF2 ) { + regmap_write(rt722->regmap, + SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY,
RT722_SDCA_ENT_CS1F,Quoted 1 line
+
RT722_SDCA_CTL_SAMPLE_FREQ_INDEX, 0),sampling_rate);Review
Quoted 2 lines
(quoted diff) +2
-0+ regmap_write(rt722->regmap, + SDW_SDCA_CTL(FUNC_NUM_AMP,
RT722_SDCA_ENT_CS31,Quoted 1 line
+
RT722_SDCA_CTL_SAMPLE_FREQ_INDEX, 0),Quoted 1 line
+
sampling_rate);and that's precisely the sort of problems I had in mind earlier. Why would the sample-rate be aligned for both amplifier and dmic?
Quoted 8 lines
I don't think this follows the intent of the SDCA spec. The functions are supposed to be independent, so when we set
hw_paramsfor e.g. amplifiers we can't touch the microphone function.I would recommend splitting the DAIs here to have self-contained operations that preserve the independence between functions - if the hardware can deal with independent functions we have no reason to rejoin these functions at the driver level, do we?
I'll separate the DAIs for dmic/speaker and hw_param settings will be independent as well.
Quoted 79 lines
sound/soc/codecs/rt722-sdca.c
Quoted 10 lines
sound/soc/codecs/rt722-sdca.c new file +9
-0+ } + +return 0 ; +} + +static int rt722_sdca_pcm_hw_free (struct snd_pcm_substream *substream, +struct snd_soc_dai *dai) { +struct snd_soc_component *component = dai->component; + struct rt722_sdca_priv *rt722 =
snd_soc_component_get_drvdata(component);sound/soc/codecs/rt722-sdca.c
Quoted 11 lines
sound/soc/codecs/rt722-sdca.c new file +11
-0+struct sdw_stream_runtime *sdw_stream = +snd_soc_dai_get_dma_data (dai, substream); + +if (!rt722->slave) +return -EINVAL ; + +sdw_stream_remove_slave (rt722->slave, sdw_stream); +return 0 ; +} + +#define RT722_STEREO_RATES (SNDRV_PCM_RATE_44100 |
SNDRV_PCM_RATE_48000| \Quoted 1 line
+
SNDRV_PCM_RATE_96000|
SNDRV_PCM_RATE_192000)Quoted 1 line
+#define
RT722_FORMATS(SNDRV_PCM_FMTBIT_S16_LE|
SNDRV_PCM_FMTBIT_S20_3LE| \Quoted 39 lines
sound/soc/codecs/rt722-sdca.c new file +39
-0+ SNDRV_PCM_FMTBIT_S24_LE) + +static const struct snd_soc_dai_ops rt722_sdca_ops = { + .hw_params = rt722_sdca_pcm_hw_params, + .hw_free = rt722_sdca_pcm_hw_free, + .set_stream = rt722_sdca_set_sdw_stream, + .shutdown = rt722_sdca_shutdown, +}; + +static struct snd_soc_dai_driver rt722_sdca_dai[] = { + { + .name ="rt722-sdca-aif1" , + .id =RT722_AIF1 , + .playback = { + .stream_name ="DP1 Headphone Playback" , + .channels_min =1 , + .channels_max =2 , + .rates =RT722_STEREO_RATES , + .formats =RT722_FORMATS , + }, + .capture = { + .stream_name ="DP2 Headset Capture" , + .channels_min =1 , + .channels_max =2 , + .rates =RT722_STEREO_RATES , + .formats =RT722_FORMATS , + }, + .ops = &rt722_sdca_ops, + }, + { + .name ="rt722-sdca-aif2" , + .id =RT722_AIF2 , + .playback = { + .stream_name ="DP3 Speaker Playback" , + .channels_min =1 , + .channels_max =2 , + .rates =RT722_STEREO_RATES , + .formats =RT722_FORMATS , + },sound/soc/codecs/rt722-sdca.c line 1333
Quoted 10 lines
sound/soc/codecs/rt722-sdca.c new file +10
-0+ .capture = { + .stream_name = "DP6 DMic Capture", + .channels_min = 1, + .channels_max = 2, + .rates = RT722_STEREO_RATES, + .formats = RT722_FORMATS, + }, + .ops = &rt722_sdca_ops, + } +};------Please consider the environment before printing this e-mail.