Skip to content

Commit 1ac86e1

Browse files
committed
ASoC: Intel: make cnl_rt274 work with SOF
(0)fix alignment issues for upstream (1)refine machine driver to make it work with sof (2)disable DMIC for it is not ready now Signed-off-by: Rander Wang <rander.wang@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
1 parent 18ba099 commit 1ac86e1

File tree

1 file changed

+22
-27
lines changed

1 file changed

+22
-27
lines changed

sound/soc/intel/boards/cnl_rt274.c

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#define RT274_CODEC_DAI "rt274-aif1"
3030

3131
static int cnl_rt274_clock_control(struct snd_soc_dapm_widget *w,
32-
struct snd_kcontrol *k, int event)
32+
struct snd_kcontrol *k, int event)
3333
{
3434
struct snd_soc_dapm_context *dapm = w->dapm;
3535
struct snd_soc_card *card = dapm->card;
@@ -42,8 +42,8 @@ static int cnl_rt274_clock_control(struct snd_soc_dapm_widget *w,
4242
return -EINVAL;
4343

4444
ret = snd_soc_dai_set_sysclk(codec_dai, RT274_SCLK_S_PLL1,
45-
CNL_FREQ_OUT,
46-
SND_SOC_CLOCK_IN);
45+
CNL_FREQ_OUT,
46+
SND_SOC_CLOCK_IN);
4747
if (ret) {
4848
dev_err(codec_dai->dev,
4949
"failed to enable PLL1: %d\n", ret);
@@ -76,8 +76,8 @@ static const struct snd_soc_dapm_widget cnl_rt274_widgets[] = {
7676
SND_SOC_DAPM_MIC("Mic Jack", NULL),
7777
SND_SOC_DAPM_MIC("SoC DMIC", NULL),
7878
SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0,
79-
cnl_rt274_clock_control, SND_SOC_DAPM_PRE_PMU |
80-
SND_SOC_DAPM_POST_PMD),
79+
cnl_rt274_clock_control, SND_SOC_DAPM_PRE_PMU |
80+
SND_SOC_DAPM_POST_PMD),
8181
};
8282

8383
static const struct snd_soc_pcm_stream dai_params_codec = {
@@ -116,8 +116,9 @@ static int cnl_rt274_init(struct snd_soc_pcm_runtime *runtime)
116116
struct snd_soc_dai *codec_dai = runtime->codec_dai;
117117

118118
ret = snd_soc_card_jack_new(runtime->card, "Headset",
119-
SND_JACK_HEADSET, &cnl_headset,
120-
cnl_headset_pins, ARRAY_SIZE(cnl_headset_pins));
119+
SND_JACK_HEADSET, &cnl_headset,
120+
cnl_headset_pins,
121+
ARRAY_SIZE(cnl_headset_pins));
121122

122123
if (ret)
123124
return ret;
@@ -137,42 +138,45 @@ static int cnl_rt274_init(struct snd_soc_pcm_runtime *runtime)
137138
}
138139

139140
static int cnl_be_fixup(struct snd_soc_pcm_runtime *rtd,
140-
struct snd_pcm_hw_params *params)
141+
struct snd_pcm_hw_params *params)
141142
{
142143
struct snd_interval *rate = hw_param_interval(params,
143144
SNDRV_PCM_HW_PARAM_RATE);
144145
struct snd_interval *channels = hw_param_interval(params,
145146
SNDRV_PCM_HW_PARAM_CHANNELS);
146147

147-
rate->min = rate->max = CNL_BE_FIXUP_RATE;
148-
channels->min = channels->max = 2;
148+
rate->min = CNL_BE_FIXUP_RATE;
149+
rate->max = CNL_BE_FIXUP_RATE;
150+
channels->min = 2;
151+
channels->max = 2;
149152
snd_mask_none(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT));
150153
snd_mask_set(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT),
151-
SNDRV_PCM_FORMAT_S24_LE);
154+
SNDRV_PCM_FORMAT_S24_LE);
152155

153156
return 0;
154157
}
155158

159+
#if !IS_ENABLED(CONFIG_SND_SOC_SOF_INTEL)
156160
static int cnl_dmic_fixup(struct snd_soc_pcm_runtime *rtd,
157-
struct snd_pcm_hw_params *params)
161+
struct snd_pcm_hw_params *params)
158162
{
159163
struct snd_interval *channels = hw_param_interval(params,
160164
SNDRV_PCM_HW_PARAM_CHANNELS);
161-
channels->min = channels->max = 2;
165+
channels->min = 2;
166+
channels->max = 2;
162167

163168
return 0;
164169
}
170+
#endif
165171

166-
static const char pname[] = "0000:00:1f.3";
167172
static const char cname[] = "i2c-INT34C2:00";
168173

169-
struct snd_soc_dai_link cnl_rt274_dailink[] = {
174+
static struct snd_soc_dai_link cnl_rt274_dailink[] = {
170175
{
171176
.name = "SSP0-Codec",
172177
.cpu_dai_name = "SSP0 Pin",
173178
.codec_name = cname,
174179
.codec_dai_name = "rt274-aif1",
175-
.platform_name = pname,
176180
.be_hw_params_fixup = cnl_be_fixup,
177181
.ignore_pmdown_time = 1,
178182
.no_pcm = 1,
@@ -182,28 +186,20 @@ struct snd_soc_dai_link cnl_rt274_dailink[] = {
182186
.dpcm_capture = 1,
183187
.init = cnl_rt274_init,
184188
},
189+
#if !IS_ENABLED(CONFIG_SND_SOC_SOF_INTEL)
185190
{
186191
.name = "dmic01",
187192
.cpu_dai_name = "DMIC01 Pin",
188193
.codec_name = "dmic-codec",
189194
.codec_dai_name = "dmic-hifi",
190-
.platform_name = pname,
191195
.ignore_suspend = 1,
192196
.no_pcm = 1,
193197
.dpcm_capture = 1,
194198
.be_hw_params_fixup = cnl_dmic_fixup,
195199
},
200+
#endif
196201
};
197202

198-
static int
199-
cnl_add_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *link)
200-
{
201-
link->platform_name = pname;
202-
link->nonatomic = 1;
203-
204-
return 0;
205-
}
206-
207203
/* SoC card */
208204
static struct snd_soc_card snd_soc_card_cnl = {
209205
.name = "cnl-audio",
@@ -215,7 +211,6 @@ static struct snd_soc_card snd_soc_card_cnl = {
215211
.num_dapm_routes = ARRAY_SIZE(cnl_map),
216212
.controls = cnl_controls,
217213
.num_controls = ARRAY_SIZE(cnl_controls),
218-
.add_dai_link = cnl_add_dai_link,
219214
.fully_routed = true,
220215
};
221216

0 commit comments

Comments
 (0)