Skip to content

Commit 32f5efe

Browse files
RanderWanglgirdwood
authored andcommitted
ASOC: Intel: refine hda machine driver to make it work with SOF
Signed-off-by: Rander Wang <rander.wang@linux.intel.com> Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
1 parent 9fd4421 commit 32f5efe

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

sound/soc/intel/boards/Kconfig

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,10 @@ config SND_SOC_INTEL_KBL_DA7219_MAX98357A_MACH
326326
create an alsa sound card for DA7219 + MAX98357A I2S audio codec.
327327
Say Y if you have such a device.
328328

329+
endif ## SND_SOC_INTEL_SKYLAKE
330+
331+
if SND_SOC_INTEL_SKYLAKE || SND_SOC_SOF_HDA
332+
329333
config SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH
330334
tristate "SKL/KBL/BXT/APL with HDA Codecs"
331335
select SND_SOC_HDAC_HDMI
@@ -335,8 +339,7 @@ config SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH
335339
SKL/KBL/BXT/APL with iDisp, HDA audio codecs.
336340
Say Y or m if you have such a device. This is a recommended option.
337341
If unsure select "N".
338-
339-
endif ## SND_SOC_INTEL_SKYLAKE
342+
endif ## SND_SOC_INTEL_SKYLAKE || SND_SOC_SOF_HDA
340343

341344
if SND_SOC_INTEL_SKYLAKE || SND_SOC_SOF_CANNONLAKE
342345

sound/soc/intel/boards/skl_hda_dsp_generic.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
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

134135
static 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

Comments
 (0)