xref: /linux/sound/soc/intel/boards/bytcht_da7213.c (revision 42b16d3ac371a2fac9b6f08fd75f23f34ba3955a)
18e8e69d6SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
282cf89deSPierre-Louis Bossart /*
382cf89deSPierre-Louis Bossart  *  bytcht-da7213.c - ASoc Machine driver for Intel Baytrail and
482cf89deSPierre-Louis Bossart  *             Cherrytrail-based platforms, with Dialog DA7213 codec
582cf89deSPierre-Louis Bossart  *
682cf89deSPierre-Louis Bossart  *  Copyright (C) 2017 Intel Corporation
782cf89deSPierre-Louis Bossart  *  Author: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
882cf89deSPierre-Louis Bossart  *
982cf89deSPierre-Louis Bossart  *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1082cf89deSPierre-Louis Bossart  *
1182cf89deSPierre-Louis Bossart  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1282cf89deSPierre-Louis Bossart  */
1382cf89deSPierre-Louis Bossart 
1482cf89deSPierre-Louis Bossart #include <linux/module.h>
1582cf89deSPierre-Louis Bossart #include <linux/acpi.h>
1682cf89deSPierre-Louis Bossart #include <linux/platform_device.h>
1782cf89deSPierre-Louis Bossart #include <linux/slab.h>
1882cf89deSPierre-Louis Bossart #include <sound/pcm.h>
1982cf89deSPierre-Louis Bossart #include <sound/pcm_params.h>
2082cf89deSPierre-Louis Bossart #include <sound/soc.h>
217feb2f78SPierre-Louis Bossart #include <sound/soc-acpi.h>
2282cf89deSPierre-Louis Bossart #include "../../codecs/da7213.h"
2382cf89deSPierre-Louis Bossart #include "../atom/sst-atom-controls.h"
2482cf89deSPierre-Louis Bossart 
2582cf89deSPierre-Louis Bossart static const struct snd_kcontrol_new controls[] = {
2682cf89deSPierre-Louis Bossart 	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
2782cf89deSPierre-Louis Bossart 	SOC_DAPM_PIN_SWITCH("Headset Mic"),
2882cf89deSPierre-Louis Bossart 	SOC_DAPM_PIN_SWITCH("Mic"),
2982cf89deSPierre-Louis Bossart 	SOC_DAPM_PIN_SWITCH("Aux In"),
3082cf89deSPierre-Louis Bossart };
3182cf89deSPierre-Louis Bossart 
3282cf89deSPierre-Louis Bossart static const struct snd_soc_dapm_widget dapm_widgets[] = {
3382cf89deSPierre-Louis Bossart 	SND_SOC_DAPM_HP("Headphone Jack", NULL),
3482cf89deSPierre-Louis Bossart 	SND_SOC_DAPM_MIC("Headset Mic", NULL),
3582cf89deSPierre-Louis Bossart 	SND_SOC_DAPM_MIC("Mic", NULL),
3682cf89deSPierre-Louis Bossart 	SND_SOC_DAPM_LINE("Aux In", NULL),
3782cf89deSPierre-Louis Bossart };
3882cf89deSPierre-Louis Bossart 
3982cf89deSPierre-Louis Bossart static const struct snd_soc_dapm_route audio_map[] = {
4082cf89deSPierre-Louis Bossart 	{"Headphone Jack", NULL, "HPL"},
4182cf89deSPierre-Louis Bossart 	{"Headphone Jack", NULL, "HPR"},
4282cf89deSPierre-Louis Bossart 
4382cf89deSPierre-Louis Bossart 	{"AUXL", NULL, "Aux In"},
4482cf89deSPierre-Louis Bossart 	{"AUXR", NULL, "Aux In"},
4582cf89deSPierre-Louis Bossart 
4682cf89deSPierre-Louis Bossart 	/* Assume Mic1 is linked to Headset and Mic2 to on-board mic */
4782cf89deSPierre-Louis Bossart 	{"MIC1", NULL, "Headset Mic"},
4882cf89deSPierre-Louis Bossart 	{"MIC2", NULL, "Mic"},
4982cf89deSPierre-Louis Bossart 
5082cf89deSPierre-Louis Bossart 	/* SOC-codec link */
5182cf89deSPierre-Louis Bossart 	{"ssp2 Tx", NULL, "codec_out0"},
5282cf89deSPierre-Louis Bossart 	{"ssp2 Tx", NULL, "codec_out1"},
5382cf89deSPierre-Louis Bossart 	{"codec_in0", NULL, "ssp2 Rx"},
5482cf89deSPierre-Louis Bossart 	{"codec_in1", NULL, "ssp2 Rx"},
5582cf89deSPierre-Louis Bossart 
5682cf89deSPierre-Louis Bossart 	{"Playback", NULL, "ssp2 Tx"},
5782cf89deSPierre-Louis Bossart 	{"ssp2 Rx", NULL, "Capture"},
5882cf89deSPierre-Louis Bossart };
5982cf89deSPierre-Louis Bossart 
codec_fixup(struct snd_soc_pcm_runtime * rtd,struct snd_pcm_hw_params * params)6082cf89deSPierre-Louis Bossart static int codec_fixup(struct snd_soc_pcm_runtime *rtd,
6182cf89deSPierre-Louis Bossart 		       struct snd_pcm_hw_params *params)
6282cf89deSPierre-Louis Bossart {
6382cf89deSPierre-Louis Bossart 	int ret;
6482cf89deSPierre-Louis Bossart 	struct snd_interval *rate = hw_param_interval(params,
6582cf89deSPierre-Louis Bossart 			SNDRV_PCM_HW_PARAM_RATE);
6682cf89deSPierre-Louis Bossart 	struct snd_interval *channels = hw_param_interval(params,
6782cf89deSPierre-Louis Bossart 						SNDRV_PCM_HW_PARAM_CHANNELS);
6882cf89deSPierre-Louis Bossart 
6982cf89deSPierre-Louis Bossart 	/* The DSP will convert the FE rate to 48k, stereo, 24bits */
7082cf89deSPierre-Louis Bossart 	rate->min = rate->max = 48000;
7182cf89deSPierre-Louis Bossart 	channels->min = channels->max = 2;
7282cf89deSPierre-Louis Bossart 
7382cf89deSPierre-Louis Bossart 	/* set SSP2 to 24-bit */
7482cf89deSPierre-Louis Bossart 	params_set_format(params, SNDRV_PCM_FORMAT_S24_LE);
7582cf89deSPierre-Louis Bossart 
7682cf89deSPierre-Louis Bossart 	/*
7782cf89deSPierre-Louis Bossart 	 * Default mode for SSP configuration is TDM 4 slot, override config
7882cf89deSPierre-Louis Bossart 	 * with explicit setting to I2S 2ch 24-bit. The word length is set with
7982cf89deSPierre-Louis Bossart 	 * dai_set_tdm_slot() since there is no other API exposed
8082cf89deSPierre-Louis Bossart 	 */
81a2c1125eSKuninori Morimoto 	ret = snd_soc_dai_set_fmt(snd_soc_rtd_to_cpu(rtd, 0),
8282cf89deSPierre-Louis Bossart 				  SND_SOC_DAIFMT_I2S     |
8382cf89deSPierre-Louis Bossart 				  SND_SOC_DAIFMT_NB_NF   |
84add9ee8cSCharles Keepax 				  SND_SOC_DAIFMT_BP_FP);
8582cf89deSPierre-Louis Bossart 	if (ret < 0) {
8682cf89deSPierre-Louis Bossart 		dev_err(rtd->dev, "can't set format to I2S, err %d\n", ret);
8782cf89deSPierre-Louis Bossart 		return ret;
8882cf89deSPierre-Louis Bossart 	}
8982cf89deSPierre-Louis Bossart 
90a2c1125eSKuninori Morimoto 	ret = snd_soc_dai_set_tdm_slot(snd_soc_rtd_to_cpu(rtd, 0), 0x3, 0x3, 2, 24);
9182cf89deSPierre-Louis Bossart 	if (ret < 0) {
9282cf89deSPierre-Louis Bossart 		dev_err(rtd->dev, "can't set I2S config, err %d\n", ret);
9382cf89deSPierre-Louis Bossart 		return ret;
9482cf89deSPierre-Louis Bossart 	}
9582cf89deSPierre-Louis Bossart 
9682cf89deSPierre-Louis Bossart 	return 0;
9782cf89deSPierre-Louis Bossart }
9882cf89deSPierre-Louis Bossart 
aif1_startup(struct snd_pcm_substream * substream)9982cf89deSPierre-Louis Bossart static int aif1_startup(struct snd_pcm_substream *substream)
10082cf89deSPierre-Louis Bossart {
10182cf89deSPierre-Louis Bossart 	return snd_pcm_hw_constraint_single(substream->runtime,
10282cf89deSPierre-Louis Bossart 			SNDRV_PCM_HW_PARAM_RATE, 48000);
10382cf89deSPierre-Louis Bossart }
10482cf89deSPierre-Louis Bossart 
aif1_hw_params(struct snd_pcm_substream * substream,struct snd_pcm_hw_params * params)10582cf89deSPierre-Louis Bossart static int aif1_hw_params(struct snd_pcm_substream *substream,
10682cf89deSPierre-Louis Bossart 			  struct snd_pcm_hw_params *params)
10782cf89deSPierre-Louis Bossart {
108a2c1125eSKuninori Morimoto 	struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
109a2c1125eSKuninori Morimoto 	struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
11082cf89deSPierre-Louis Bossart 	int ret;
11182cf89deSPierre-Louis Bossart 
11282cf89deSPierre-Louis Bossart 	ret = snd_soc_dai_set_sysclk(codec_dai, DA7213_CLKSRC_MCLK,
11382cf89deSPierre-Louis Bossart 				     19200000, SND_SOC_CLOCK_IN);
11482cf89deSPierre-Louis Bossart 	if (ret < 0)
11582cf89deSPierre-Louis Bossart 		dev_err(codec_dai->dev, "can't set codec sysclk configuration\n");
11682cf89deSPierre-Louis Bossart 
11782cf89deSPierre-Louis Bossart 	ret = snd_soc_dai_set_pll(codec_dai, 0,
11882cf89deSPierre-Louis Bossart 			DA7213_SYSCLK_PLL_SRM, 0, DA7213_PLL_FREQ_OUT_98304000);
11982cf89deSPierre-Louis Bossart 	if (ret < 0) {
12082cf89deSPierre-Louis Bossart 		dev_err(codec_dai->dev, "failed to start PLL: %d\n", ret);
12182cf89deSPierre-Louis Bossart 		return -EIO;
12282cf89deSPierre-Louis Bossart 	}
12382cf89deSPierre-Louis Bossart 
12482cf89deSPierre-Louis Bossart 	return ret;
12582cf89deSPierre-Louis Bossart }
12682cf89deSPierre-Louis Bossart 
aif1_hw_free(struct snd_pcm_substream * substream)12782cf89deSPierre-Louis Bossart static int aif1_hw_free(struct snd_pcm_substream *substream)
12882cf89deSPierre-Louis Bossart {
129a2c1125eSKuninori Morimoto 	struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
130a2c1125eSKuninori Morimoto 	struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
13182cf89deSPierre-Louis Bossart 	int ret;
13282cf89deSPierre-Louis Bossart 
13382cf89deSPierre-Louis Bossart 	ret = snd_soc_dai_set_pll(codec_dai, 0,
13482cf89deSPierre-Louis Bossart 				  DA7213_SYSCLK_MCLK, 0, 0);
13582cf89deSPierre-Louis Bossart 	if (ret < 0) {
13682cf89deSPierre-Louis Bossart 		dev_err(codec_dai->dev, "failed to stop PLL: %d\n", ret);
13782cf89deSPierre-Louis Bossart 		return -EIO;
13882cf89deSPierre-Louis Bossart 	}
13982cf89deSPierre-Louis Bossart 
14082cf89deSPierre-Louis Bossart 	return ret;
14182cf89deSPierre-Louis Bossart }
14282cf89deSPierre-Louis Bossart 
14382cf89deSPierre-Louis Bossart static const struct snd_soc_ops aif1_ops = {
14482cf89deSPierre-Louis Bossart 	.startup = aif1_startup,
14582cf89deSPierre-Louis Bossart };
14682cf89deSPierre-Louis Bossart 
14782cf89deSPierre-Louis Bossart static const struct snd_soc_ops ssp2_ops = {
14882cf89deSPierre-Louis Bossart 	.hw_params = aif1_hw_params,
14982cf89deSPierre-Louis Bossart 	.hw_free = aif1_hw_free,
15082cf89deSPierre-Louis Bossart 
15182cf89deSPierre-Louis Bossart };
15282cf89deSPierre-Louis Bossart 
153fb1d4861SKuninori Morimoto SND_SOC_DAILINK_DEF(dummy,
154fb1d4861SKuninori Morimoto 	DAILINK_COMP_ARRAY(COMP_DUMMY()));
155fb1d4861SKuninori Morimoto 
156fb1d4861SKuninori Morimoto SND_SOC_DAILINK_DEF(media,
157fb1d4861SKuninori Morimoto 	DAILINK_COMP_ARRAY(COMP_CPU("media-cpu-dai")));
158fb1d4861SKuninori Morimoto 
159fb1d4861SKuninori Morimoto SND_SOC_DAILINK_DEF(deepbuffer,
160fb1d4861SKuninori Morimoto 	DAILINK_COMP_ARRAY(COMP_CPU("deepbuffer-cpu-dai")));
161fb1d4861SKuninori Morimoto 
162fb1d4861SKuninori Morimoto SND_SOC_DAILINK_DEF(ssp2_port,
163fb1d4861SKuninori Morimoto 	DAILINK_COMP_ARRAY(COMP_CPU("ssp2-port")));
164fb1d4861SKuninori Morimoto SND_SOC_DAILINK_DEF(ssp2_codec,
165fb1d4861SKuninori Morimoto 	DAILINK_COMP_ARRAY(COMP_CODEC("i2c-DLGS7213:00",
166fb1d4861SKuninori Morimoto 				      "da7213-hifi")));
167fb1d4861SKuninori Morimoto 
168fb1d4861SKuninori Morimoto SND_SOC_DAILINK_DEF(platform,
169fb1d4861SKuninori Morimoto 	DAILINK_COMP_ARRAY(COMP_PLATFORM("sst-mfld-platform")));
170fb1d4861SKuninori Morimoto 
17182cf89deSPierre-Louis Bossart static struct snd_soc_dai_link dailink[] = {
17282cf89deSPierre-Louis Bossart 	[MERR_DPCM_AUDIO] = {
17382cf89deSPierre-Louis Bossart 		.name = "Audio Port",
17482cf89deSPierre-Louis Bossart 		.stream_name = "Audio",
17582cf89deSPierre-Louis Bossart 		.nonatomic = true,
17682cf89deSPierre-Louis Bossart 		.dynamic = 1,
17782cf89deSPierre-Louis Bossart 		.dpcm_playback = 1,
17882cf89deSPierre-Louis Bossart 		.dpcm_capture = 1,
17982cf89deSPierre-Louis Bossart 		.ops = &aif1_ops,
180fb1d4861SKuninori Morimoto 		SND_SOC_DAILINK_REG(media, dummy, platform),
18182cf89deSPierre-Louis Bossart 	},
18282cf89deSPierre-Louis Bossart 	[MERR_DPCM_DEEP_BUFFER] = {
18382cf89deSPierre-Louis Bossart 		.name = "Deep-Buffer Audio Port",
18482cf89deSPierre-Louis Bossart 		.stream_name = "Deep-Buffer Audio",
18582cf89deSPierre-Louis Bossart 		.nonatomic = true,
18682cf89deSPierre-Louis Bossart 		.dynamic = 1,
18782cf89deSPierre-Louis Bossart 		.dpcm_playback = 1,
18882cf89deSPierre-Louis Bossart 		.ops = &aif1_ops,
189fb1d4861SKuninori Morimoto 		SND_SOC_DAILINK_REG(deepbuffer, dummy, platform),
19082cf89deSPierre-Louis Bossart 	},
19182cf89deSPierre-Louis Bossart 	/* CODEC<->CODEC link */
19282cf89deSPierre-Louis Bossart 	/* back ends */
19382cf89deSPierre-Louis Bossart 	{
19482cf89deSPierre-Louis Bossart 		.name = "SSP2-Codec",
195149f7757SPierre-Louis Bossart 		.id = 0,
19682cf89deSPierre-Louis Bossart 		.no_pcm = 1,
19782cf89deSPierre-Louis Bossart 		.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
1985374b921SPeter Ujfalusi 						| SND_SOC_DAIFMT_CBC_CFC,
19982cf89deSPierre-Louis Bossart 		.be_hw_params_fixup = codec_fixup,
20082cf89deSPierre-Louis Bossart 		.dpcm_playback = 1,
20182cf89deSPierre-Louis Bossart 		.dpcm_capture = 1,
20282cf89deSPierre-Louis Bossart 		.ops = &ssp2_ops,
203fb1d4861SKuninori Morimoto 		SND_SOC_DAILINK_REG(ssp2_port, ssp2_codec, platform),
20482cf89deSPierre-Louis Bossart 	},
20582cf89deSPierre-Louis Bossart };
20682cf89deSPierre-Louis Bossart 
207b4ecd58bSPierre-Louis Bossart /* use space before codec name to simplify card ID, and simplify driver name */
20841656c3dSPierre-Louis Bossart #define SOF_CARD_NAME "bytcht da7213" /* card name will be 'sof-bytcht da7213' */
20941656c3dSPierre-Louis Bossart #define SOF_DRIVER_NAME "SOF"
21041656c3dSPierre-Louis Bossart 
211b4ecd58bSPierre-Louis Bossart #define CARD_NAME "bytcht-da7213"
212b4ecd58bSPierre-Louis Bossart #define DRIVER_NAME NULL /* card name will be used for driver name */
213b4ecd58bSPierre-Louis Bossart 
21482cf89deSPierre-Louis Bossart /* SoC card */
21582cf89deSPierre-Louis Bossart static struct snd_soc_card bytcht_da7213_card = {
216b4ecd58bSPierre-Louis Bossart 	.name = CARD_NAME,
217b4ecd58bSPierre-Louis Bossart 	.driver_name = DRIVER_NAME,
21882cf89deSPierre-Louis Bossart 	.owner = THIS_MODULE,
21982cf89deSPierre-Louis Bossart 	.dai_link = dailink,
22082cf89deSPierre-Louis Bossart 	.num_links = ARRAY_SIZE(dailink),
22182cf89deSPierre-Louis Bossart 	.controls = controls,
22282cf89deSPierre-Louis Bossart 	.num_controls = ARRAY_SIZE(controls),
22382cf89deSPierre-Louis Bossart 	.dapm_widgets = dapm_widgets,
22482cf89deSPierre-Louis Bossart 	.num_dapm_widgets = ARRAY_SIZE(dapm_widgets),
22582cf89deSPierre-Louis Bossart 	.dapm_routes = audio_map,
22682cf89deSPierre-Louis Bossart 	.num_dapm_routes = ARRAY_SIZE(audio_map),
22782cf89deSPierre-Louis Bossart };
22882cf89deSPierre-Louis Bossart 
2292be2d579SPierre-Louis Bossart static char codec_name[SND_ACPI_I2C_ID_LEN];
23082cf89deSPierre-Louis Bossart 
bytcht_da7213_probe(struct platform_device * pdev)23182cf89deSPierre-Louis Bossart static int bytcht_da7213_probe(struct platform_device *pdev)
23282cf89deSPierre-Louis Bossart {
23382cf89deSPierre-Louis Bossart 	struct snd_soc_card *card;
2347feb2f78SPierre-Louis Bossart 	struct snd_soc_acpi_mach *mach;
235686338c1SPierre-Louis Bossart 	const char *platform_name;
2361b55f1c6SAndy Shevchenko 	struct acpi_device *adev;
23741656c3dSPierre-Louis Bossart 	bool sof_parent;
23882cf89deSPierre-Louis Bossart 	int dai_index = 0;
23922a317a0SPierre-Louis Bossart 	int ret_val = 0;
24022a317a0SPierre-Louis Bossart 	int i;
24182cf89deSPierre-Louis Bossart 
24242432196SGuennadi Liakhovetski 	mach = pdev->dev.platform_data;
24382cf89deSPierre-Louis Bossart 	card = &bytcht_da7213_card;
24482cf89deSPierre-Louis Bossart 	card->dev = &pdev->dev;
24582cf89deSPierre-Louis Bossart 
24682cf89deSPierre-Louis Bossart 	/* fix index of codec dai */
24782cf89deSPierre-Louis Bossart 	for (i = 0; i < ARRAY_SIZE(dailink); i++) {
248*0cc65482SHans de Goede 		if (dailink[i].num_codecs &&
2497d99a70bSHans de Goede 		    !strcmp(dailink[i].codecs->name, "i2c-DLGS7213:00")) {
25082cf89deSPierre-Louis Bossart 			dai_index = i;
25182cf89deSPierre-Louis Bossart 			break;
25282cf89deSPierre-Louis Bossart 		}
25382cf89deSPierre-Louis Bossart 	}
25482cf89deSPierre-Louis Bossart 
25582cf89deSPierre-Louis Bossart 	/* fixup codec name based on HID */
2561b55f1c6SAndy Shevchenko 	adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1);
2571b55f1c6SAndy Shevchenko 	if (adev) {
25882cf89deSPierre-Louis Bossart 		snprintf(codec_name, sizeof(codec_name),
2591b55f1c6SAndy Shevchenko 			 "i2c-%s", acpi_dev_name(adev));
260fb1d4861SKuninori Morimoto 		dailink[dai_index].codecs->name = codec_name;
26182cf89deSPierre-Louis Bossart 	} else {
2624afda6deSAndy Shevchenko 		dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id);
26382cf89deSPierre-Louis Bossart 		return -ENOENT;
264f1eebb3bSPierre-Louis Bossart 	}
265686338c1SPierre-Louis Bossart 
266686338c1SPierre-Louis Bossart 	acpi_dev_put(adev);
267686338c1SPierre-Louis Bossart 
268686338c1SPierre-Louis Bossart 	/* override platform name, if required */
269686338c1SPierre-Louis Bossart 	platform_name = mach->mach_params.platform;
270686338c1SPierre-Louis Bossart 
27141656c3dSPierre-Louis Bossart 	ret_val = snd_soc_fixup_dai_links_platform_name(card, platform_name);
27241656c3dSPierre-Louis Bossart 	if (ret_val)
27341656c3dSPierre-Louis Bossart 		return ret_val;
27441656c3dSPierre-Louis Bossart 
27541656c3dSPierre-Louis Bossart 	sof_parent = snd_soc_acpi_sof_parent(&pdev->dev);
27641656c3dSPierre-Louis Bossart 
27741656c3dSPierre-Louis Bossart 	/* set card and driver name */
27841656c3dSPierre-Louis Bossart 	if (sof_parent) {
27941656c3dSPierre-Louis Bossart 		bytcht_da7213_card.name = SOF_CARD_NAME;
28041656c3dSPierre-Louis Bossart 		bytcht_da7213_card.driver_name = SOF_DRIVER_NAME;
28141656c3dSPierre-Louis Bossart 	} else {
28205ff312bSPierre-Louis Bossart 		bytcht_da7213_card.name = CARD_NAME;
28305ff312bSPierre-Louis Bossart 		bytcht_da7213_card.driver_name = DRIVER_NAME;
28405ff312bSPierre-Louis Bossart 	}
28505ff312bSPierre-Louis Bossart 
28682cf89deSPierre-Louis Bossart 	/* set pm ops */
28782cf89deSPierre-Louis Bossart 	if (sof_parent)
28882cf89deSPierre-Louis Bossart 		pdev->dev.driver->pm = &snd_soc_pm_ops;
28982cf89deSPierre-Louis Bossart 
29082cf89deSPierre-Louis Bossart 	ret_val = devm_snd_soc_register_card(&pdev->dev, card);
29182cf89deSPierre-Louis Bossart 	if (ret_val) {
29282cf89deSPierre-Louis Bossart 		dev_err(&pdev->dev,
29382cf89deSPierre-Louis Bossart 			"snd_soc_register_card failed %d\n", ret_val);
29482cf89deSPierre-Louis Bossart 		return ret_val;
29582cf89deSPierre-Louis Bossart 	}
29682cf89deSPierre-Louis Bossart 	platform_set_drvdata(pdev, card);
29782cf89deSPierre-Louis Bossart 	return ret_val;
29882cf89deSPierre-Louis Bossart }
29982cf89deSPierre-Louis Bossart 
30082cf89deSPierre-Louis Bossart static struct platform_driver bytcht_da7213_driver = {
30182cf89deSPierre-Louis Bossart 	.driver = {
30282cf89deSPierre-Louis Bossart 		.name = "bytcht_da7213",
30382cf89deSPierre-Louis Bossart 	},
30482cf89deSPierre-Louis Bossart 	.probe = bytcht_da7213_probe,
30582cf89deSPierre-Louis Bossart };
30682cf89deSPierre-Louis Bossart module_platform_driver(bytcht_da7213_driver);
30782cf89deSPierre-Louis Bossart 
308 MODULE_DESCRIPTION("ASoC Intel(R) Baytrail/Cherrytrail+DA7213 Machine driver");
309 MODULE_AUTHOR("Pierre-Louis Bossart");
310 MODULE_LICENSE("GPL v2");
311 MODULE_ALIAS("platform:bytcht_da7213");
312