22
22
struct avs_dma_data {
23
23
struct avs_tplg_path_template * template ;
24
24
struct avs_path * path ;
25
+ struct avs_dev * adev ;
25
26
/*
26
27
* link stream is stored within substream's runtime
27
28
* private_data to fulfill the needs of codec BE path
@@ -60,7 +61,7 @@ static int avs_dai_startup(struct snd_pcm_substream *substream, struct snd_soc_d
60
61
const struct snd_soc_dai_ops * ops )
61
62
{
62
63
struct snd_soc_pcm_runtime * rtd = snd_soc_substream_to_rtd (substream );
63
- struct avs_dev * adev = to_avs_dev (dai -> dev );
64
+ struct avs_dev * adev = to_avs_dev (dai -> component -> dev );
64
65
struct avs_tplg_path_template * template ;
65
66
struct avs_dma_data * data ;
66
67
@@ -77,6 +78,7 @@ static int avs_dai_startup(struct snd_pcm_substream *substream, struct snd_soc_d
77
78
78
79
data -> substream = substream ;
79
80
data -> template = template ;
81
+ data -> adev = adev ;
80
82
snd_soc_dai_set_dma_data (dai , substream , data );
81
83
82
84
if (rtd -> dai_link -> ignore_suspend )
@@ -88,13 +90,12 @@ static int avs_dai_startup(struct snd_pcm_substream *substream, struct snd_soc_d
88
90
static void avs_dai_shutdown (struct snd_pcm_substream * substream , struct snd_soc_dai * dai )
89
91
{
90
92
struct snd_soc_pcm_runtime * rtd = snd_soc_substream_to_rtd (substream );
91
- struct avs_dev * adev = to_avs_dev (dai -> dev );
92
93
struct avs_dma_data * data ;
93
94
94
95
data = snd_soc_dai_get_dma_data (dai , substream );
95
96
96
97
if (rtd -> dai_link -> ignore_suspend )
97
- adev -> num_lp_paths -- ;
98
+ data -> adev -> num_lp_paths -- ;
98
99
99
100
snd_soc_dai_set_dma_data (dai , substream , NULL );
100
101
kfree (data );
@@ -107,7 +108,6 @@ static int avs_dai_hw_params(struct snd_pcm_substream *substream,
107
108
{
108
109
struct avs_dma_data * data ;
109
110
struct avs_path * path ;
110
- struct avs_dev * adev = to_avs_dev (dai -> dev );
111
111
int ret ;
112
112
113
113
data = snd_soc_dai_get_dma_data (dai , substream );
@@ -124,7 +124,7 @@ static int avs_dai_hw_params(struct snd_pcm_substream *substream,
124
124
params_rate (be_hw_params ), params_channels (be_hw_params ),
125
125
params_width (be_hw_params ), params_physical_width (be_hw_params ));
126
126
127
- path = avs_path_create (adev , dma_id , data -> template , fe_hw_params , be_hw_params );
127
+ path = avs_path_create (data -> adev , dma_id , data -> template , fe_hw_params , be_hw_params );
128
128
if (IS_ERR (path )) {
129
129
ret = PTR_ERR (path );
130
130
dev_err (dai -> dev , "create path failed: %d\n" , ret );
@@ -505,8 +505,7 @@ static int avs_dai_fe_startup(struct snd_pcm_substream *substream, struct snd_so
505
505
{
506
506
struct snd_pcm_runtime * runtime = substream -> runtime ;
507
507
struct avs_dma_data * data ;
508
- struct avs_dev * adev = to_avs_dev (dai -> dev );
509
- struct hdac_bus * bus = & adev -> base .core ;
508
+ struct hdac_bus * bus ;
510
509
struct hdac_ext_stream * host_stream ;
511
510
int ret ;
512
511
@@ -515,6 +514,7 @@ static int avs_dai_fe_startup(struct snd_pcm_substream *substream, struct snd_so
515
514
return ret ;
516
515
517
516
data = snd_soc_dai_get_dma_data (dai , substream );
517
+ bus = & data -> adev -> base .core ;
518
518
519
519
host_stream = snd_hdac_ext_stream_assign (bus , substream , HDAC_EXT_STREAM_TYPE_HOST );
520
520
if (!host_stream ) {
@@ -655,7 +655,6 @@ static int avs_dai_fe_prepare(struct snd_pcm_substream *substream, struct snd_so
655
655
struct snd_pcm_runtime * runtime = substream -> runtime ;
656
656
struct snd_soc_pcm_stream * stream_info ;
657
657
struct avs_dma_data * data ;
658
- struct avs_dev * adev = to_avs_dev (dai -> dev );
659
658
struct hdac_ext_stream * host_stream ;
660
659
unsigned int format_val ;
661
660
struct hdac_bus * bus ;
@@ -685,7 +684,7 @@ static int avs_dai_fe_prepare(struct snd_pcm_substream *substream, struct snd_so
685
684
if (ret < 0 )
686
685
return ret ;
687
686
688
- ret = avs_dai_prepare (adev , substream , dai );
687
+ ret = avs_dai_prepare (data -> adev , substream , dai );
689
688
if (ret )
690
689
return ret ;
691
690
0 commit comments