1212#include <sound/pcm.h>
1313#include <sound/pcm_params.h>
1414#include <sound/soc.h>
15+ #include <sound/sof.h>
1516#include "../../codecs/hdac_hdmi.h"
1617#include "../skylake/skl.h"
1718#include "skl_hda_dsp_common.h"
@@ -101,16 +102,16 @@ static struct snd_soc_card hda_soc_card = {
101102#define IDISP_ROUTE_COUNT (IDISP_DAI_COUNT * 2)
102103#define IDISP_CODEC_MASK 0x4
103104
104- static int skl_hda_fill_card_info (struct skl_machine_pdata * pdata )
105+ static int skl_hda_fill_card_info (const char * platform ,
106+ unsigned long codec_mask )
105107{
106108 struct snd_soc_card * card = & hda_soc_card ;
107- u32 codec_count , codec_mask ;
109+ u32 codec_count ;
108110 int i , num_links , num_route ;
109111
110- codec_mask = pdata -> codec_mask ;
111112 codec_count = hweight_long (codec_mask );
112113
113- if (codec_count == 1 && pdata -> codec_mask & IDISP_CODEC_MASK ) {
114+ if (codec_count == 1 && codec_mask & IDISP_CODEC_MASK ) {
114115 num_links = IDISP_DAI_COUNT ;
115116 num_route = IDISP_ROUTE_COUNT ;
116117 } else if (codec_count == 2 && codec_mask & IDISP_CODEC_MASK ) {
@@ -126,17 +127,22 @@ static int skl_hda_fill_card_info(struct skl_machine_pdata *pdata)
126127 card -> num_dapm_routes = num_route ;
127128
128129 for (i = 0 ; i < num_links ; i ++ )
129- skl_hda_be_dai_links [i ].platform_name = pdata -> platform ;
130+ skl_hda_be_dai_links [i ].platform_name = platform ;
130131
131132 return 0 ;
132133}
133134
134135static int skl_hda_audio_probe (struct platform_device * pdev )
135136{
136- struct skl_machine_pdata * pdata ;
137137 struct skl_hda_private * ctx ;
138138 int ret ;
139139
140+ #if IS_ENABLED (CONFIG_SND_SOC_SOF_INTEL )
141+ struct snd_sof_pdata * pdata = dev_get_platdata (& pdev -> dev );
142+ #else
143+ struct skl_machine_pdata * pdata = dev_get_drvdata (& pdev -> dev );
144+ #endif
145+
140146 dev_dbg (& pdev -> dev , "%s: entry\n" , __func__ );
141147
142148 ctx = devm_kzalloc (& pdev -> dev , sizeof (* ctx ), GFP_ATOMIC );
@@ -145,11 +151,10 @@ static int skl_hda_audio_probe(struct platform_device *pdev)
145151
146152 INIT_LIST_HEAD (& ctx -> hdmi_pcm_list );
147153
148- pdata = dev_get_drvdata (& pdev -> dev );
149154 if (!pdata )
150155 return - EINVAL ;
151156
152- ret = skl_hda_fill_card_info (pdata );
157+ ret = skl_hda_fill_card_info (pdata -> platform , pdata -> codec_mask );
153158 if (ret < 0 ) {
154159 dev_err (& pdev -> dev , "Unsupported HDAudio/iDisp configuration found\n" );
155160 return ret ;
0 commit comments