xref: /openbmc/linux/sound/soc/codecs/hdac_hda.c (revision 3fd63658)
16bae5ea9SRakesh Ughreja // SPDX-License-Identifier: GPL-2.0
26bae5ea9SRakesh Ughreja // Copyright(c) 2015-18 Intel Corporation.
36bae5ea9SRakesh Ughreja 
46bae5ea9SRakesh Ughreja /*
56bae5ea9SRakesh Ughreja  * hdac_hda.c - ASoC extensions to reuse the legacy HDA codec drivers
66bae5ea9SRakesh Ughreja  * with ASoC platform drivers. These APIs are called by the legacy HDA
76bae5ea9SRakesh Ughreja  * codec drivers using hdac_ext_bus_ops ops.
86bae5ea9SRakesh Ughreja  */
96bae5ea9SRakesh Ughreja 
106bae5ea9SRakesh Ughreja #include <linux/init.h>
116bae5ea9SRakesh Ughreja #include <linux/delay.h>
126bae5ea9SRakesh Ughreja #include <linux/module.h>
136bae5ea9SRakesh Ughreja #include <linux/pm_runtime.h>
146bae5ea9SRakesh Ughreja #include <sound/pcm_params.h>
156bae5ea9SRakesh Ughreja #include <sound/soc.h>
166bae5ea9SRakesh Ughreja #include <sound/hdaudio_ext.h>
17608b8c36SKai Vehmanen #include <sound/hda_i915.h>
186bae5ea9SRakesh Ughreja #include <sound/hda_codec.h>
196bae5ea9SRakesh Ughreja #include <sound/hda_register.h>
206bae5ea9SRakesh Ughreja 
21608b8c36SKai Vehmanen #include "hdac_hda.h"
226bae5ea9SRakesh Ughreja 
236bae5ea9SRakesh Ughreja #define STUB_FORMATS	(SNDRV_PCM_FMTBIT_S8 | \
246bae5ea9SRakesh Ughreja 			SNDRV_PCM_FMTBIT_U8 | \
256bae5ea9SRakesh Ughreja 			SNDRV_PCM_FMTBIT_S16_LE | \
266bae5ea9SRakesh Ughreja 			SNDRV_PCM_FMTBIT_U16_LE | \
276bae5ea9SRakesh Ughreja 			SNDRV_PCM_FMTBIT_S24_LE | \
286bae5ea9SRakesh Ughreja 			SNDRV_PCM_FMTBIT_U24_LE | \
296bae5ea9SRakesh Ughreja 			SNDRV_PCM_FMTBIT_S32_LE | \
306bae5ea9SRakesh Ughreja 			SNDRV_PCM_FMTBIT_U32_LE | \
316bae5ea9SRakesh Ughreja 			SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE)
326bae5ea9SRakesh Ughreja 
33608b8c36SKai Vehmanen #define STUB_HDMI_RATES	(SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |\
34608b8c36SKai Vehmanen 				 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 |\
35608b8c36SKai Vehmanen 				 SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 |\
36608b8c36SKai Vehmanen 				 SNDRV_PCM_RATE_192000)
37608b8c36SKai Vehmanen 
386bae5ea9SRakesh Ughreja static int hdac_hda_dai_open(struct snd_pcm_substream *substream,
396bae5ea9SRakesh Ughreja 			     struct snd_soc_dai *dai);
406bae5ea9SRakesh Ughreja static void hdac_hda_dai_close(struct snd_pcm_substream *substream,
416bae5ea9SRakesh Ughreja 			       struct snd_soc_dai *dai);
426bae5ea9SRakesh Ughreja static int hdac_hda_dai_prepare(struct snd_pcm_substream *substream,
436bae5ea9SRakesh Ughreja 				struct snd_soc_dai *dai);
4403d0aa4dSRander Wang static int hdac_hda_dai_hw_params(struct snd_pcm_substream *substream,
4503d0aa4dSRander Wang 				  struct snd_pcm_hw_params *params,
4603d0aa4dSRander Wang 				  struct snd_soc_dai *dai);
476bae5ea9SRakesh Ughreja static int hdac_hda_dai_hw_free(struct snd_pcm_substream *substream,
486bae5ea9SRakesh Ughreja 				struct snd_soc_dai *dai);
4963611041SPierre-Louis Bossart static int hdac_hda_dai_set_stream(struct snd_soc_dai *dai, void *stream,
5063611041SPierre-Louis Bossart 				   int direction);
516bae5ea9SRakesh Ughreja static struct hda_pcm *snd_soc_find_pcm_from_dai(struct hdac_hda_priv *hda_pvt,
526bae5ea9SRakesh Ughreja 						 struct snd_soc_dai *dai);
536bae5ea9SRakesh Ughreja 
54704a9fc2SJulia Lawall static const struct snd_soc_dai_ops hdac_hda_dai_ops = {
556bae5ea9SRakesh Ughreja 	.startup = hdac_hda_dai_open,
566bae5ea9SRakesh Ughreja 	.shutdown = hdac_hda_dai_close,
576bae5ea9SRakesh Ughreja 	.prepare = hdac_hda_dai_prepare,
5803d0aa4dSRander Wang 	.hw_params = hdac_hda_dai_hw_params,
596bae5ea9SRakesh Ughreja 	.hw_free = hdac_hda_dai_hw_free,
6063611041SPierre-Louis Bossart 	.set_stream = hdac_hda_dai_set_stream,
616bae5ea9SRakesh Ughreja };
626bae5ea9SRakesh Ughreja 
636bae5ea9SRakesh Ughreja static struct snd_soc_dai_driver hdac_hda_dais[] = {
646bae5ea9SRakesh Ughreja {
656bae5ea9SRakesh Ughreja 	.id = HDAC_ANALOG_DAI_ID,
666bae5ea9SRakesh Ughreja 	.name = "Analog Codec DAI",
676bae5ea9SRakesh Ughreja 	.ops = &hdac_hda_dai_ops,
686bae5ea9SRakesh Ughreja 	.playback = {
696bae5ea9SRakesh Ughreja 		.stream_name	= "Analog Codec Playback",
706bae5ea9SRakesh Ughreja 		.channels_min	= 1,
716bae5ea9SRakesh Ughreja 		.channels_max	= 16,
726bae5ea9SRakesh Ughreja 		.rates		= SNDRV_PCM_RATE_8000_192000,
736bae5ea9SRakesh Ughreja 		.formats	= STUB_FORMATS,
746bae5ea9SRakesh Ughreja 		.sig_bits	= 24,
756bae5ea9SRakesh Ughreja 	},
766bae5ea9SRakesh Ughreja 	.capture = {
776bae5ea9SRakesh Ughreja 		.stream_name    = "Analog Codec Capture",
786bae5ea9SRakesh Ughreja 		.channels_min   = 1,
796bae5ea9SRakesh Ughreja 		.channels_max   = 16,
806bae5ea9SRakesh Ughreja 		.rates = SNDRV_PCM_RATE_8000_192000,
816bae5ea9SRakesh Ughreja 		.formats = STUB_FORMATS,
826bae5ea9SRakesh Ughreja 		.sig_bits = 24,
836bae5ea9SRakesh Ughreja 	},
846bae5ea9SRakesh Ughreja },
856bae5ea9SRakesh Ughreja {
866bae5ea9SRakesh Ughreja 	.id = HDAC_DIGITAL_DAI_ID,
876bae5ea9SRakesh Ughreja 	.name = "Digital Codec DAI",
886bae5ea9SRakesh Ughreja 	.ops = &hdac_hda_dai_ops,
896bae5ea9SRakesh Ughreja 	.playback = {
906bae5ea9SRakesh Ughreja 		.stream_name    = "Digital Codec Playback",
916bae5ea9SRakesh Ughreja 		.channels_min   = 1,
926bae5ea9SRakesh Ughreja 		.channels_max   = 16,
936bae5ea9SRakesh Ughreja 		.rates          = SNDRV_PCM_RATE_8000_192000,
946bae5ea9SRakesh Ughreja 		.formats        = STUB_FORMATS,
956bae5ea9SRakesh Ughreja 		.sig_bits = 24,
966bae5ea9SRakesh Ughreja 	},
976bae5ea9SRakesh Ughreja 	.capture = {
986bae5ea9SRakesh Ughreja 		.stream_name    = "Digital Codec Capture",
996bae5ea9SRakesh Ughreja 		.channels_min   = 1,
1006bae5ea9SRakesh Ughreja 		.channels_max   = 16,
1016bae5ea9SRakesh Ughreja 		.rates = SNDRV_PCM_RATE_8000_192000,
1026bae5ea9SRakesh Ughreja 		.formats = STUB_FORMATS,
1036bae5ea9SRakesh Ughreja 		.sig_bits = 24,
1046bae5ea9SRakesh Ughreja 	},
1056bae5ea9SRakesh Ughreja },
1066bae5ea9SRakesh Ughreja {
1076bae5ea9SRakesh Ughreja 	.id = HDAC_ALT_ANALOG_DAI_ID,
1086bae5ea9SRakesh Ughreja 	.name = "Alt Analog Codec DAI",
1096bae5ea9SRakesh Ughreja 	.ops = &hdac_hda_dai_ops,
1106bae5ea9SRakesh Ughreja 	.playback = {
1116bae5ea9SRakesh Ughreja 		.stream_name	= "Alt Analog Codec Playback",
1126bae5ea9SRakesh Ughreja 		.channels_min	= 1,
1136bae5ea9SRakesh Ughreja 		.channels_max	= 16,
1146bae5ea9SRakesh Ughreja 		.rates		= SNDRV_PCM_RATE_8000_192000,
1156bae5ea9SRakesh Ughreja 		.formats	= STUB_FORMATS,
1166bae5ea9SRakesh Ughreja 		.sig_bits	= 24,
1176bae5ea9SRakesh Ughreja 	},
1186bae5ea9SRakesh Ughreja 	.capture = {
1196bae5ea9SRakesh Ughreja 		.stream_name    = "Alt Analog Codec Capture",
1206bae5ea9SRakesh Ughreja 		.channels_min   = 1,
1216bae5ea9SRakesh Ughreja 		.channels_max   = 16,
1226bae5ea9SRakesh Ughreja 		.rates = SNDRV_PCM_RATE_8000_192000,
1236bae5ea9SRakesh Ughreja 		.formats = STUB_FORMATS,
1246bae5ea9SRakesh Ughreja 		.sig_bits = 24,
1256bae5ea9SRakesh Ughreja 	},
126608b8c36SKai Vehmanen },
127608b8c36SKai Vehmanen {
128608b8c36SKai Vehmanen 	.id = HDAC_HDMI_0_DAI_ID,
129608b8c36SKai Vehmanen 	.name = "intel-hdmi-hifi1",
130608b8c36SKai Vehmanen 	.ops = &hdac_hda_dai_ops,
131608b8c36SKai Vehmanen 	.playback = {
132608b8c36SKai Vehmanen 		.stream_name    = "hifi1",
133608b8c36SKai Vehmanen 		.channels_min   = 1,
134608b8c36SKai Vehmanen 		.channels_max   = 32,
135608b8c36SKai Vehmanen 		.rates          = STUB_HDMI_RATES,
136608b8c36SKai Vehmanen 		.formats        = STUB_FORMATS,
137608b8c36SKai Vehmanen 		.sig_bits = 24,
138608b8c36SKai Vehmanen 	},
139608b8c36SKai Vehmanen },
140608b8c36SKai Vehmanen {
141608b8c36SKai Vehmanen 	.id = HDAC_HDMI_1_DAI_ID,
142608b8c36SKai Vehmanen 	.name = "intel-hdmi-hifi2",
143608b8c36SKai Vehmanen 	.ops = &hdac_hda_dai_ops,
144608b8c36SKai Vehmanen 	.playback = {
145608b8c36SKai Vehmanen 		.stream_name    = "hifi2",
146608b8c36SKai Vehmanen 		.channels_min   = 1,
147608b8c36SKai Vehmanen 		.channels_max   = 32,
148608b8c36SKai Vehmanen 		.rates          = STUB_HDMI_RATES,
149608b8c36SKai Vehmanen 		.formats        = STUB_FORMATS,
150608b8c36SKai Vehmanen 		.sig_bits = 24,
151608b8c36SKai Vehmanen 	},
152608b8c36SKai Vehmanen },
153608b8c36SKai Vehmanen {
154608b8c36SKai Vehmanen 	.id = HDAC_HDMI_2_DAI_ID,
155608b8c36SKai Vehmanen 	.name = "intel-hdmi-hifi3",
156608b8c36SKai Vehmanen 	.ops = &hdac_hda_dai_ops,
157608b8c36SKai Vehmanen 	.playback = {
158608b8c36SKai Vehmanen 		.stream_name    = "hifi3",
159608b8c36SKai Vehmanen 		.channels_min   = 1,
160608b8c36SKai Vehmanen 		.channels_max   = 32,
161608b8c36SKai Vehmanen 		.rates          = STUB_HDMI_RATES,
162608b8c36SKai Vehmanen 		.formats        = STUB_FORMATS,
163608b8c36SKai Vehmanen 		.sig_bits = 24,
164608b8c36SKai Vehmanen 	},
165608b8c36SKai Vehmanen },
1664bb16cd8SSathyanarayana Nujella {
1674bb16cd8SSathyanarayana Nujella 	.id = HDAC_HDMI_3_DAI_ID,
1684bb16cd8SSathyanarayana Nujella 	.name = "intel-hdmi-hifi4",
1694bb16cd8SSathyanarayana Nujella 	.ops = &hdac_hda_dai_ops,
1704bb16cd8SSathyanarayana Nujella 	.playback = {
1714bb16cd8SSathyanarayana Nujella 		.stream_name    = "hifi4",
1724bb16cd8SSathyanarayana Nujella 		.channels_min   = 1,
1734bb16cd8SSathyanarayana Nujella 		.channels_max   = 32,
1744bb16cd8SSathyanarayana Nujella 		.rates          = STUB_HDMI_RATES,
1754bb16cd8SSathyanarayana Nujella 		.formats        = STUB_FORMATS,
1764bb16cd8SSathyanarayana Nujella 		.sig_bits = 24,
1774bb16cd8SSathyanarayana Nujella 	},
1784bb16cd8SSathyanarayana Nujella },
1796bae5ea9SRakesh Ughreja 
1806bae5ea9SRakesh Ughreja };
1816bae5ea9SRakesh Ughreja 
18263611041SPierre-Louis Bossart static int hdac_hda_dai_set_stream(struct snd_soc_dai *dai,
18363611041SPierre-Louis Bossart 				   void *stream, int direction)
1846bae5ea9SRakesh Ughreja {
1856bae5ea9SRakesh Ughreja 	struct snd_soc_component *component = dai->component;
1866bae5ea9SRakesh Ughreja 	struct hdac_hda_priv *hda_pvt;
1876bae5ea9SRakesh Ughreja 	struct hdac_hda_pcm *pcm;
18863611041SPierre-Louis Bossart 	struct hdac_stream *hstream;
18963611041SPierre-Louis Bossart 
19063611041SPierre-Louis Bossart 	if (!stream)
19163611041SPierre-Louis Bossart 		return -EINVAL;
1926bae5ea9SRakesh Ughreja 
1936bae5ea9SRakesh Ughreja 	hda_pvt = snd_soc_component_get_drvdata(component);
1946bae5ea9SRakesh Ughreja 	pcm = &hda_pvt->pcm[dai->id];
19563611041SPierre-Louis Bossart 	hstream = (struct hdac_stream *)stream;
196608b8c36SKai Vehmanen 
19763611041SPierre-Louis Bossart 	pcm->stream_tag[direction] = hstream->stream_tag;
1986bae5ea9SRakesh Ughreja 
1996bae5ea9SRakesh Ughreja 	return 0;
2006bae5ea9SRakesh Ughreja }
2016bae5ea9SRakesh Ughreja 
20203d0aa4dSRander Wang static int hdac_hda_dai_hw_params(struct snd_pcm_substream *substream,
20303d0aa4dSRander Wang 				  struct snd_pcm_hw_params *params,
20403d0aa4dSRander Wang 				  struct snd_soc_dai *dai)
20503d0aa4dSRander Wang {
20603d0aa4dSRander Wang 	struct snd_soc_component *component = dai->component;
20703d0aa4dSRander Wang 	struct hdac_hda_priv *hda_pvt;
20803d0aa4dSRander Wang 	unsigned int format_val;
20903d0aa4dSRander Wang 	unsigned int maxbps;
21003d0aa4dSRander Wang 
21103d0aa4dSRander Wang 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
21203d0aa4dSRander Wang 		maxbps = dai->driver->playback.sig_bits;
21303d0aa4dSRander Wang 	else
21403d0aa4dSRander Wang 		maxbps = dai->driver->capture.sig_bits;
21503d0aa4dSRander Wang 
21603d0aa4dSRander Wang 	hda_pvt = snd_soc_component_get_drvdata(component);
21703d0aa4dSRander Wang 	format_val = snd_hdac_calc_stream_format(params_rate(params),
21803d0aa4dSRander Wang 						 params_channels(params),
21903d0aa4dSRander Wang 						 params_format(params),
22003d0aa4dSRander Wang 						 maxbps,
22103d0aa4dSRander Wang 						 0);
22203d0aa4dSRander Wang 	if (!format_val) {
22303d0aa4dSRander Wang 		dev_err(dai->dev,
22403d0aa4dSRander Wang 			"invalid format_val, rate=%d, ch=%d, format=%d, maxbps=%d\n",
22503d0aa4dSRander Wang 			params_rate(params), params_channels(params),
22603d0aa4dSRander Wang 			params_format(params), maxbps);
22703d0aa4dSRander Wang 
22803d0aa4dSRander Wang 		return -EINVAL;
22903d0aa4dSRander Wang 	}
23003d0aa4dSRander Wang 
23103d0aa4dSRander Wang 	hda_pvt->pcm[dai->id].format_val[substream->stream] = format_val;
23203d0aa4dSRander Wang 	return 0;
23303d0aa4dSRander Wang }
23403d0aa4dSRander Wang 
2356bae5ea9SRakesh Ughreja static int hdac_hda_dai_hw_free(struct snd_pcm_substream *substream,
2366bae5ea9SRakesh Ughreja 				struct snd_soc_dai *dai)
2376bae5ea9SRakesh Ughreja {
2386bae5ea9SRakesh Ughreja 	struct snd_soc_component *component = dai->component;
2396bae5ea9SRakesh Ughreja 	struct hdac_hda_priv *hda_pvt;
2406bae5ea9SRakesh Ughreja 	struct hda_pcm_stream *hda_stream;
2416bae5ea9SRakesh Ughreja 	struct hda_pcm *pcm;
2426bae5ea9SRakesh Ughreja 
2436bae5ea9SRakesh Ughreja 	hda_pvt = snd_soc_component_get_drvdata(component);
2446bae5ea9SRakesh Ughreja 	pcm = snd_soc_find_pcm_from_dai(hda_pvt, dai);
2456bae5ea9SRakesh Ughreja 	if (!pcm)
2466bae5ea9SRakesh Ughreja 		return -EINVAL;
2476bae5ea9SRakesh Ughreja 
2486bae5ea9SRakesh Ughreja 	hda_stream = &pcm->stream[substream->stream];
249*3fd63658SCezary Rojewski 	snd_hda_codec_cleanup(hda_pvt->codec, hda_stream, substream);
2506bae5ea9SRakesh Ughreja 
2516bae5ea9SRakesh Ughreja 	return 0;
2526bae5ea9SRakesh Ughreja }
2536bae5ea9SRakesh Ughreja 
2546bae5ea9SRakesh Ughreja static int hdac_hda_dai_prepare(struct snd_pcm_substream *substream,
2556bae5ea9SRakesh Ughreja 				struct snd_soc_dai *dai)
2566bae5ea9SRakesh Ughreja {
2576bae5ea9SRakesh Ughreja 	struct snd_soc_component *component = dai->component;
2586bae5ea9SRakesh Ughreja 	struct hda_pcm_stream *hda_stream;
25903d0aa4dSRander Wang 	struct hdac_hda_priv *hda_pvt;
26003d0aa4dSRander Wang 	struct hdac_device *hdev;
2616bae5ea9SRakesh Ughreja 	unsigned int format_val;
2626bae5ea9SRakesh Ughreja 	struct hda_pcm *pcm;
2636bae5ea9SRakesh Ughreja 	unsigned int stream;
2646bae5ea9SRakesh Ughreja 	int ret = 0;
2656bae5ea9SRakesh Ughreja 
2666bae5ea9SRakesh Ughreja 	hda_pvt = snd_soc_component_get_drvdata(component);
267*3fd63658SCezary Rojewski 	hdev = &hda_pvt->codec->core;
2686bae5ea9SRakesh Ughreja 	pcm = snd_soc_find_pcm_from_dai(hda_pvt, dai);
2696bae5ea9SRakesh Ughreja 	if (!pcm)
2706bae5ea9SRakesh Ughreja 		return -EINVAL;
2716bae5ea9SRakesh Ughreja 
2726bae5ea9SRakesh Ughreja 	hda_stream = &pcm->stream[substream->stream];
2736bae5ea9SRakesh Ughreja 
2746bae5ea9SRakesh Ughreja 	stream = hda_pvt->pcm[dai->id].stream_tag[substream->stream];
27503d0aa4dSRander Wang 	format_val = hda_pvt->pcm[dai->id].format_val[substream->stream];
2766bae5ea9SRakesh Ughreja 
277*3fd63658SCezary Rojewski 	ret = snd_hda_codec_prepare(hda_pvt->codec, hda_stream,
2786bae5ea9SRakesh Ughreja 				    stream, format_val, substream);
2796bae5ea9SRakesh Ughreja 	if (ret < 0)
2806bae5ea9SRakesh Ughreja 		dev_err(&hdev->dev, "codec prepare failed %d\n", ret);
2816bae5ea9SRakesh Ughreja 
2826bae5ea9SRakesh Ughreja 	return ret;
2836bae5ea9SRakesh Ughreja }
2846bae5ea9SRakesh Ughreja 
2856bae5ea9SRakesh Ughreja static int hdac_hda_dai_open(struct snd_pcm_substream *substream,
2866bae5ea9SRakesh Ughreja 			     struct snd_soc_dai *dai)
2876bae5ea9SRakesh Ughreja {
2886bae5ea9SRakesh Ughreja 	struct snd_soc_component *component = dai->component;
2896bae5ea9SRakesh Ughreja 	struct hdac_hda_priv *hda_pvt;
2906bae5ea9SRakesh Ughreja 	struct hda_pcm_stream *hda_stream;
2916bae5ea9SRakesh Ughreja 	struct hda_pcm *pcm;
2926bae5ea9SRakesh Ughreja 
2936bae5ea9SRakesh Ughreja 	hda_pvt = snd_soc_component_get_drvdata(component);
2946bae5ea9SRakesh Ughreja 	pcm = snd_soc_find_pcm_from_dai(hda_pvt, dai);
2956bae5ea9SRakesh Ughreja 	if (!pcm)
2966bae5ea9SRakesh Ughreja 		return -EINVAL;
2976bae5ea9SRakesh Ughreja 
2986bae5ea9SRakesh Ughreja 	snd_hda_codec_pcm_get(pcm);
2996bae5ea9SRakesh Ughreja 
3006bae5ea9SRakesh Ughreja 	hda_stream = &pcm->stream[substream->stream];
3016bae5ea9SRakesh Ughreja 
302*3fd63658SCezary Rojewski 	return hda_stream->ops.open(hda_stream, hda_pvt->codec, substream);
3036bae5ea9SRakesh Ughreja }
3046bae5ea9SRakesh Ughreja 
3056bae5ea9SRakesh Ughreja static void hdac_hda_dai_close(struct snd_pcm_substream *substream,
3066bae5ea9SRakesh Ughreja 			       struct snd_soc_dai *dai)
3076bae5ea9SRakesh Ughreja {
3086bae5ea9SRakesh Ughreja 	struct snd_soc_component *component = dai->component;
3096bae5ea9SRakesh Ughreja 	struct hdac_hda_priv *hda_pvt;
3106bae5ea9SRakesh Ughreja 	struct hda_pcm_stream *hda_stream;
3116bae5ea9SRakesh Ughreja 	struct hda_pcm *pcm;
3126bae5ea9SRakesh Ughreja 
3136bae5ea9SRakesh Ughreja 	hda_pvt = snd_soc_component_get_drvdata(component);
3146bae5ea9SRakesh Ughreja 	pcm = snd_soc_find_pcm_from_dai(hda_pvt, dai);
3156bae5ea9SRakesh Ughreja 	if (!pcm)
3166bae5ea9SRakesh Ughreja 		return;
3176bae5ea9SRakesh Ughreja 
3186bae5ea9SRakesh Ughreja 	hda_stream = &pcm->stream[substream->stream];
3196bae5ea9SRakesh Ughreja 
320*3fd63658SCezary Rojewski 	hda_stream->ops.close(hda_stream, hda_pvt->codec, substream);
3216bae5ea9SRakesh Ughreja 
3226bae5ea9SRakesh Ughreja 	snd_hda_codec_pcm_put(pcm);
3236bae5ea9SRakesh Ughreja }
3246bae5ea9SRakesh Ughreja 
3256bae5ea9SRakesh Ughreja static struct hda_pcm *snd_soc_find_pcm_from_dai(struct hdac_hda_priv *hda_pvt,
3266bae5ea9SRakesh Ughreja 						 struct snd_soc_dai *dai)
3276bae5ea9SRakesh Ughreja {
328*3fd63658SCezary Rojewski 	struct hda_codec *hcodec = hda_pvt->codec;
3296bae5ea9SRakesh Ughreja 	struct hda_pcm *cpcm;
3306bae5ea9SRakesh Ughreja 	const char *pcm_name;
3316bae5ea9SRakesh Ughreja 
332608b8c36SKai Vehmanen 	/*
333608b8c36SKai Vehmanen 	 * map DAI ID to the closest matching PCM name, using the naming
334608b8c36SKai Vehmanen 	 * scheme used by hda-codec snd_hda_gen_build_pcms() and for
335608b8c36SKai Vehmanen 	 * HDMI in hda_codec patch_hdmi.c)
336608b8c36SKai Vehmanen 	 */
337608b8c36SKai Vehmanen 
3386bae5ea9SRakesh Ughreja 	switch (dai->id) {
3396bae5ea9SRakesh Ughreja 	case HDAC_ANALOG_DAI_ID:
3406bae5ea9SRakesh Ughreja 		pcm_name = "Analog";
3416bae5ea9SRakesh Ughreja 		break;
3426bae5ea9SRakesh Ughreja 	case HDAC_DIGITAL_DAI_ID:
3436bae5ea9SRakesh Ughreja 		pcm_name = "Digital";
3446bae5ea9SRakesh Ughreja 		break;
3456bae5ea9SRakesh Ughreja 	case HDAC_ALT_ANALOG_DAI_ID:
3466bae5ea9SRakesh Ughreja 		pcm_name = "Alt Analog";
3476bae5ea9SRakesh Ughreja 		break;
348608b8c36SKai Vehmanen 	case HDAC_HDMI_0_DAI_ID:
349608b8c36SKai Vehmanen 		pcm_name = "HDMI 0";
350608b8c36SKai Vehmanen 		break;
351608b8c36SKai Vehmanen 	case HDAC_HDMI_1_DAI_ID:
352608b8c36SKai Vehmanen 		pcm_name = "HDMI 1";
353608b8c36SKai Vehmanen 		break;
354608b8c36SKai Vehmanen 	case HDAC_HDMI_2_DAI_ID:
355608b8c36SKai Vehmanen 		pcm_name = "HDMI 2";
356608b8c36SKai Vehmanen 		break;
3574bb16cd8SSathyanarayana Nujella 	case HDAC_HDMI_3_DAI_ID:
3584bb16cd8SSathyanarayana Nujella 		pcm_name = "HDMI 3";
3594bb16cd8SSathyanarayana Nujella 		break;
3606bae5ea9SRakesh Ughreja 	default:
3616bae5ea9SRakesh Ughreja 		dev_err(&hcodec->core.dev, "invalid dai id %d\n", dai->id);
3626bae5ea9SRakesh Ughreja 		return NULL;
3636bae5ea9SRakesh Ughreja 	}
3646bae5ea9SRakesh Ughreja 
3656bae5ea9SRakesh Ughreja 	list_for_each_entry(cpcm, &hcodec->pcm_list_head, list) {
366e9476990SMeng Tang 		if (strstr(cpcm->name, pcm_name)) {
367e9476990SMeng Tang 			if (strcmp(pcm_name, "Analog") == 0) {
368e9476990SMeng Tang 				if (strstr(cpcm->name, "Alt Analog"))
369e9476990SMeng Tang 					continue;
370e9476990SMeng Tang 			}
3716bae5ea9SRakesh Ughreja 			return cpcm;
3726bae5ea9SRakesh Ughreja 		}
373e9476990SMeng Tang 	}
3746bae5ea9SRakesh Ughreja 
3756bae5ea9SRakesh Ughreja 	dev_err(&hcodec->core.dev, "didn't find PCM for DAI %s\n", dai->name);
3766bae5ea9SRakesh Ughreja 	return NULL;
3776bae5ea9SRakesh Ughreja }
3786bae5ea9SRakesh Ughreja 
379608b8c36SKai Vehmanen static bool is_hdmi_codec(struct hda_codec *hcodec)
380608b8c36SKai Vehmanen {
381608b8c36SKai Vehmanen 	struct hda_pcm *cpcm;
382608b8c36SKai Vehmanen 
383608b8c36SKai Vehmanen 	list_for_each_entry(cpcm, &hcodec->pcm_list_head, list) {
384608b8c36SKai Vehmanen 		if (cpcm->pcm_type == HDA_PCM_TYPE_HDMI)
385608b8c36SKai Vehmanen 			return true;
386608b8c36SKai Vehmanen 	}
387608b8c36SKai Vehmanen 
388608b8c36SKai Vehmanen 	return false;
389608b8c36SKai Vehmanen }
390608b8c36SKai Vehmanen 
3916bae5ea9SRakesh Ughreja static int hdac_hda_codec_probe(struct snd_soc_component *component)
3926bae5ea9SRakesh Ughreja {
3936bae5ea9SRakesh Ughreja 	struct hdac_hda_priv *hda_pvt =
3946bae5ea9SRakesh Ughreja 			snd_soc_component_get_drvdata(component);
3956bae5ea9SRakesh Ughreja 	struct snd_soc_dapm_context *dapm =
3966bae5ea9SRakesh Ughreja 			snd_soc_component_get_dapm(component);
397*3fd63658SCezary Rojewski 	struct hdac_device *hdev = &hda_pvt->codec->core;
398*3fd63658SCezary Rojewski 	struct hda_codec *hcodec = hda_pvt->codec;
3996bae5ea9SRakesh Ughreja 	struct hdac_ext_link *hlink;
4006bae5ea9SRakesh Ughreja 	hda_codec_patch_t patch;
4016bae5ea9SRakesh Ughreja 	int ret;
4026bae5ea9SRakesh Ughreja 
4036bae5ea9SRakesh Ughreja 	hlink = snd_hdac_ext_bus_get_link(hdev->bus, dev_name(&hdev->dev));
4046bae5ea9SRakesh Ughreja 	if (!hlink) {
4056bae5ea9SRakesh Ughreja 		dev_err(&hdev->dev, "hdac link not found\n");
4066bae5ea9SRakesh Ughreja 		return -EIO;
4076bae5ea9SRakesh Ughreja 	}
4086bae5ea9SRakesh Ughreja 
4096bae5ea9SRakesh Ughreja 	snd_hdac_ext_bus_link_get(hdev->bus, hlink);
4106bae5ea9SRakesh Ughreja 
411608b8c36SKai Vehmanen 	/*
412608b8c36SKai Vehmanen 	 * Ensure any HDA display is powered at codec probe.
413608b8c36SKai Vehmanen 	 * After snd_hda_codec_device_new(), display power is
414608b8c36SKai Vehmanen 	 * managed by runtime PM.
415608b8c36SKai Vehmanen 	 */
416608b8c36SKai Vehmanen 	if (hda_pvt->need_display_power)
417608b8c36SKai Vehmanen 		snd_hdac_display_power(hdev->bus,
418608b8c36SKai Vehmanen 				       HDA_CODEC_IDX_CONTROLLER, true);
419608b8c36SKai Vehmanen 
4206bae5ea9SRakesh Ughreja 	ret = snd_hda_codec_device_new(hcodec->bus, component->card->snd_card,
42117e0c4cbSCezary Rojewski 				       hdev->addr, hcodec, true);
4226bae5ea9SRakesh Ughreja 	if (ret < 0) {
4236bae5ea9SRakesh Ughreja 		dev_err(&hdev->dev, "failed to create hda codec %d\n", ret);
4246bae5ea9SRakesh Ughreja 		goto error_no_pm;
4256bae5ea9SRakesh Ughreja 	}
426b60ee2e2SBard liao 	/*
427b60ee2e2SBard liao 	 * Overwrite type to HDA_DEV_ASOC since it is a ASoC driver
428b60ee2e2SBard liao 	 * hda_codec.c will check this flag to determine if unregister
429b60ee2e2SBard liao 	 * device is needed.
430b60ee2e2SBard liao 	 */
431b60ee2e2SBard liao 	hdev->type = HDA_DEV_ASOC;
4326bae5ea9SRakesh Ughreja 
4336bae5ea9SRakesh Ughreja 	/*
4346bae5ea9SRakesh Ughreja 	 * snd_hda_codec_device_new decrements the usage count so call get pm
4356bae5ea9SRakesh Ughreja 	 * else the device will be powered off
4366bae5ea9SRakesh Ughreja 	 */
4376bae5ea9SRakesh Ughreja 	pm_runtime_get_noresume(&hdev->dev);
4386bae5ea9SRakesh Ughreja 
4396bae5ea9SRakesh Ughreja 	hcodec->bus->card = dapm->card->snd_card;
4406bae5ea9SRakesh Ughreja 
4416bae5ea9SRakesh Ughreja 	ret = snd_hda_codec_set_name(hcodec, hcodec->preset->name);
4426bae5ea9SRakesh Ughreja 	if (ret < 0) {
4436bae5ea9SRakesh Ughreja 		dev_err(&hdev->dev, "name failed %s\n", hcodec->preset->name);
444a94eacceSPierre-Louis Bossart 		goto error_pm;
4456bae5ea9SRakesh Ughreja 	}
4466bae5ea9SRakesh Ughreja 
4476bae5ea9SRakesh Ughreja 	ret = snd_hdac_regmap_init(&hcodec->core);
4486bae5ea9SRakesh Ughreja 	if (ret < 0) {
4496bae5ea9SRakesh Ughreja 		dev_err(&hdev->dev, "regmap init failed\n");
450a94eacceSPierre-Louis Bossart 		goto error_pm;
4516bae5ea9SRakesh Ughreja 	}
4526bae5ea9SRakesh Ughreja 
4536bae5ea9SRakesh Ughreja 	patch = (hda_codec_patch_t)hcodec->preset->driver_data;
4546bae5ea9SRakesh Ughreja 	if (patch) {
4556bae5ea9SRakesh Ughreja 		ret = patch(hcodec);
4566bae5ea9SRakesh Ughreja 		if (ret < 0) {
4576bae5ea9SRakesh Ughreja 			dev_err(&hdev->dev, "patch failed %d\n", ret);
458a94eacceSPierre-Louis Bossart 			goto error_regmap;
4596bae5ea9SRakesh Ughreja 		}
4606bae5ea9SRakesh Ughreja 	} else {
4616bae5ea9SRakesh Ughreja 		dev_dbg(&hdev->dev, "no patch file found\n");
4626bae5ea9SRakesh Ughreja 	}
4636bae5ea9SRakesh Ughreja 
464608b8c36SKai Vehmanen 	/* configure codec for 1:1 PCM:DAI mapping */
465608b8c36SKai Vehmanen 	hcodec->mst_no_extra_pcms = 1;
466608b8c36SKai Vehmanen 
4676bae5ea9SRakesh Ughreja 	ret = snd_hda_codec_parse_pcms(hcodec);
4686bae5ea9SRakesh Ughreja 	if (ret < 0) {
4696bae5ea9SRakesh Ughreja 		dev_err(&hdev->dev, "unable to map pcms to dai %d\n", ret);
470640f835cSKai Vehmanen 		goto error_patch;
4716bae5ea9SRakesh Ughreja 	}
4726bae5ea9SRakesh Ughreja 
473608b8c36SKai Vehmanen 	/* HDMI controls need to be created in machine drivers */
474608b8c36SKai Vehmanen 	if (!is_hdmi_codec(hcodec)) {
4756bae5ea9SRakesh Ughreja 		ret = snd_hda_codec_build_controls(hcodec);
4766bae5ea9SRakesh Ughreja 		if (ret < 0) {
477608b8c36SKai Vehmanen 			dev_err(&hdev->dev, "unable to create controls %d\n",
478608b8c36SKai Vehmanen 				ret);
479640f835cSKai Vehmanen 			goto error_patch;
4806bae5ea9SRakesh Ughreja 		}
481608b8c36SKai Vehmanen 	}
4826bae5ea9SRakesh Ughreja 
4836bae5ea9SRakesh Ughreja 	hcodec->core.lazy_cache = true;
4846bae5ea9SRakesh Ughreja 
485608b8c36SKai Vehmanen 	if (hda_pvt->need_display_power)
486608b8c36SKai Vehmanen 		snd_hdac_display_power(hdev->bus,
487608b8c36SKai Vehmanen 				       HDA_CODEC_IDX_CONTROLLER, false);
488608b8c36SKai Vehmanen 
4897a2ba46fSKai Vehmanen 	/* match for forbid call in snd_hda_codec_device_new() */
4907a2ba46fSKai Vehmanen 	pm_runtime_allow(&hdev->dev);
4917a2ba46fSKai Vehmanen 
4926bae5ea9SRakesh Ughreja 	/*
4936bae5ea9SRakesh Ughreja 	 * hdac_device core already sets the state to active and calls
4946bae5ea9SRakesh Ughreja 	 * get_noresume. So enable runtime and set the device to suspend.
4956bae5ea9SRakesh Ughreja 	 * pm_runtime_enable is also called during codec registeration
4966bae5ea9SRakesh Ughreja 	 */
4976bae5ea9SRakesh Ughreja 	pm_runtime_put(&hdev->dev);
4986bae5ea9SRakesh Ughreja 	pm_runtime_suspend(&hdev->dev);
4996bae5ea9SRakesh Ughreja 
5006bae5ea9SRakesh Ughreja 	return 0;
5016bae5ea9SRakesh Ughreja 
502640f835cSKai Vehmanen error_patch:
503640f835cSKai Vehmanen 	if (hcodec->patch_ops.free)
504640f835cSKai Vehmanen 		hcodec->patch_ops.free(hcodec);
505a94eacceSPierre-Louis Bossart error_regmap:
506a94eacceSPierre-Louis Bossart 	snd_hdac_regmap_exit(hdev);
507a94eacceSPierre-Louis Bossart error_pm:
5086bae5ea9SRakesh Ughreja 	pm_runtime_put(&hdev->dev);
5096bae5ea9SRakesh Ughreja error_no_pm:
5106bae5ea9SRakesh Ughreja 	snd_hdac_ext_bus_link_put(hdev->bus, hlink);
5116bae5ea9SRakesh Ughreja 	return ret;
5126bae5ea9SRakesh Ughreja }
5136bae5ea9SRakesh Ughreja 
5146bae5ea9SRakesh Ughreja static void hdac_hda_codec_remove(struct snd_soc_component *component)
5156bae5ea9SRakesh Ughreja {
5166bae5ea9SRakesh Ughreja 	struct hdac_hda_priv *hda_pvt =
5176bae5ea9SRakesh Ughreja 		      snd_soc_component_get_drvdata(component);
518*3fd63658SCezary Rojewski 	struct hdac_device *hdev = &hda_pvt->codec->core;
519*3fd63658SCezary Rojewski 	struct hda_codec *codec = hda_pvt->codec;
5206bae5ea9SRakesh Ughreja 	struct hdac_ext_link *hlink = NULL;
5216bae5ea9SRakesh Ughreja 
5226bae5ea9SRakesh Ughreja 	hlink = snd_hdac_ext_bus_get_link(hdev->bus, dev_name(&hdev->dev));
5236bae5ea9SRakesh Ughreja 	if (!hlink) {
5246bae5ea9SRakesh Ughreja 		dev_err(&hdev->dev, "hdac link not found\n");
5256bae5ea9SRakesh Ughreja 		return;
5266bae5ea9SRakesh Ughreja 	}
5276bae5ea9SRakesh Ughreja 
5286bae5ea9SRakesh Ughreja 	pm_runtime_disable(&hdev->dev);
5295dc7d5bcSKai Vehmanen 	snd_hdac_ext_bus_link_put(hdev->bus, hlink);
530a94eacceSPierre-Louis Bossart 
531c3ec8ac8SKai Vehmanen 	if (codec->patch_ops.free)
532c3ec8ac8SKai Vehmanen 		codec->patch_ops.free(codec);
533c3ec8ac8SKai Vehmanen 
534c3ec8ac8SKai Vehmanen 	snd_hda_codec_cleanup_for_unbind(codec);
5356bae5ea9SRakesh Ughreja }
5366bae5ea9SRakesh Ughreja 
5376bae5ea9SRakesh Ughreja static const struct snd_soc_dapm_route hdac_hda_dapm_routes[] = {
5386bae5ea9SRakesh Ughreja 	{"AIF1TX", NULL, "Codec Input Pin1"},
5396bae5ea9SRakesh Ughreja 	{"AIF2TX", NULL, "Codec Input Pin2"},
5406bae5ea9SRakesh Ughreja 	{"AIF3TX", NULL, "Codec Input Pin3"},
5416bae5ea9SRakesh Ughreja 
5426bae5ea9SRakesh Ughreja 	{"Codec Output Pin1", NULL, "AIF1RX"},
5436bae5ea9SRakesh Ughreja 	{"Codec Output Pin2", NULL, "AIF2RX"},
5446bae5ea9SRakesh Ughreja 	{"Codec Output Pin3", NULL, "AIF3RX"},
5456bae5ea9SRakesh Ughreja };
5466bae5ea9SRakesh Ughreja 
5476bae5ea9SRakesh Ughreja static const struct snd_soc_dapm_widget hdac_hda_dapm_widgets[] = {
5486bae5ea9SRakesh Ughreja 	/* Audio Interface */
5496bae5ea9SRakesh Ughreja 	SND_SOC_DAPM_AIF_IN("AIF1RX", "Analog Codec Playback", 0,
5506bae5ea9SRakesh Ughreja 			    SND_SOC_NOPM, 0, 0),
5516bae5ea9SRakesh Ughreja 	SND_SOC_DAPM_AIF_IN("AIF2RX", "Digital Codec Playback", 0,
5526bae5ea9SRakesh Ughreja 			    SND_SOC_NOPM, 0, 0),
5536bae5ea9SRakesh Ughreja 	SND_SOC_DAPM_AIF_IN("AIF3RX", "Alt Analog Codec Playback", 0,
5546bae5ea9SRakesh Ughreja 			    SND_SOC_NOPM, 0, 0),
5556bae5ea9SRakesh Ughreja 	SND_SOC_DAPM_AIF_OUT("AIF1TX", "Analog Codec Capture", 0,
5566bae5ea9SRakesh Ughreja 			     SND_SOC_NOPM, 0, 0),
5576bae5ea9SRakesh Ughreja 	SND_SOC_DAPM_AIF_OUT("AIF2TX", "Digital Codec Capture", 0,
5586bae5ea9SRakesh Ughreja 			     SND_SOC_NOPM, 0, 0),
5596bae5ea9SRakesh Ughreja 	SND_SOC_DAPM_AIF_OUT("AIF3TX", "Alt Analog Codec Capture", 0,
5606bae5ea9SRakesh Ughreja 			     SND_SOC_NOPM, 0, 0),
5616bae5ea9SRakesh Ughreja 
5626bae5ea9SRakesh Ughreja 	/* Input Pins */
5636bae5ea9SRakesh Ughreja 	SND_SOC_DAPM_INPUT("Codec Input Pin1"),
5646bae5ea9SRakesh Ughreja 	SND_SOC_DAPM_INPUT("Codec Input Pin2"),
5656bae5ea9SRakesh Ughreja 	SND_SOC_DAPM_INPUT("Codec Input Pin3"),
5666bae5ea9SRakesh Ughreja 
5676bae5ea9SRakesh Ughreja 	/* Output Pins */
5686bae5ea9SRakesh Ughreja 	SND_SOC_DAPM_OUTPUT("Codec Output Pin1"),
5696bae5ea9SRakesh Ughreja 	SND_SOC_DAPM_OUTPUT("Codec Output Pin2"),
5706bae5ea9SRakesh Ughreja 	SND_SOC_DAPM_OUTPUT("Codec Output Pin3"),
5716bae5ea9SRakesh Ughreja };
5726bae5ea9SRakesh Ughreja 
5736bae5ea9SRakesh Ughreja static const struct snd_soc_component_driver hdac_hda_codec = {
5746bae5ea9SRakesh Ughreja 	.probe			= hdac_hda_codec_probe,
5756bae5ea9SRakesh Ughreja 	.remove			= hdac_hda_codec_remove,
5766bae5ea9SRakesh Ughreja 	.dapm_widgets		= hdac_hda_dapm_widgets,
5776bae5ea9SRakesh Ughreja 	.num_dapm_widgets	= ARRAY_SIZE(hdac_hda_dapm_widgets),
5786bae5ea9SRakesh Ughreja 	.dapm_routes		= hdac_hda_dapm_routes,
5796bae5ea9SRakesh Ughreja 	.num_dapm_routes	= ARRAY_SIZE(hdac_hda_dapm_routes),
5801324cd8dSCharles Keepax 	.idle_bias_on		= false,
5811324cd8dSCharles Keepax 	.endianness		= 1,
5826bae5ea9SRakesh Ughreja };
5836bae5ea9SRakesh Ughreja 
5846bae5ea9SRakesh Ughreja static int hdac_hda_dev_probe(struct hdac_device *hdev)
5856bae5ea9SRakesh Ughreja {
5866bae5ea9SRakesh Ughreja 	struct hdac_ext_link *hlink;
5876bae5ea9SRakesh Ughreja 	int ret;
5886bae5ea9SRakesh Ughreja 
5896bae5ea9SRakesh Ughreja 	/* hold the ref while we probe */
5906bae5ea9SRakesh Ughreja 	hlink = snd_hdac_ext_bus_get_link(hdev->bus, dev_name(&hdev->dev));
5916bae5ea9SRakesh Ughreja 	if (!hlink) {
5926bae5ea9SRakesh Ughreja 		dev_err(&hdev->dev, "hdac link not found\n");
5936bae5ea9SRakesh Ughreja 		return -EIO;
5946bae5ea9SRakesh Ughreja 	}
5956bae5ea9SRakesh Ughreja 	snd_hdac_ext_bus_link_get(hdev->bus, hlink);
5966bae5ea9SRakesh Ughreja 
5976bae5ea9SRakesh Ughreja 	/* ASoC specific initialization */
59810ccaa39SKuninori Morimoto 	ret = devm_snd_soc_register_component(&hdev->dev,
5996bae5ea9SRakesh Ughreja 					 &hdac_hda_codec, hdac_hda_dais,
6006bae5ea9SRakesh Ughreja 					 ARRAY_SIZE(hdac_hda_dais));
6016bae5ea9SRakesh Ughreja 	if (ret < 0) {
6026bae5ea9SRakesh Ughreja 		dev_err(&hdev->dev, "failed to register HDA codec %d\n", ret);
6036bae5ea9SRakesh Ughreja 		return ret;
6046bae5ea9SRakesh Ughreja 	}
6056bae5ea9SRakesh Ughreja 
6066bae5ea9SRakesh Ughreja 	snd_hdac_ext_bus_link_put(hdev->bus, hlink);
6076bae5ea9SRakesh Ughreja 
6086bae5ea9SRakesh Ughreja 	return ret;
6096bae5ea9SRakesh Ughreja }
6106bae5ea9SRakesh Ughreja 
6116bae5ea9SRakesh Ughreja static int hdac_hda_dev_remove(struct hdac_device *hdev)
6126bae5ea9SRakesh Ughreja {
613c3ec8ac8SKai Vehmanen 	/*
614c3ec8ac8SKai Vehmanen 	 * Resources are freed in hdac_hda_codec_remove(). This
615c3ec8ac8SKai Vehmanen 	 * function is kept to keep hda_codec_driver_remove() happy.
616c3ec8ac8SKai Vehmanen 	 */
6176bae5ea9SRakesh Ughreja 	return 0;
6186bae5ea9SRakesh Ughreja }
6196bae5ea9SRakesh Ughreja 
6206bae5ea9SRakesh Ughreja static struct hdac_ext_bus_ops hdac_ops = {
6216bae5ea9SRakesh Ughreja 	.hdev_attach = hdac_hda_dev_probe,
6226bae5ea9SRakesh Ughreja 	.hdev_detach = hdac_hda_dev_remove,
6236bae5ea9SRakesh Ughreja };
6246bae5ea9SRakesh Ughreja 
6256bae5ea9SRakesh Ughreja struct hdac_ext_bus_ops *snd_soc_hdac_hda_get_ops(void)
6266bae5ea9SRakesh Ughreja {
6276bae5ea9SRakesh Ughreja 	return &hdac_ops;
6286bae5ea9SRakesh Ughreja }
6296bae5ea9SRakesh Ughreja EXPORT_SYMBOL_GPL(snd_soc_hdac_hda_get_ops);
6306bae5ea9SRakesh Ughreja 
6316bae5ea9SRakesh Ughreja MODULE_LICENSE("GPL v2");
6326bae5ea9SRakesh Ughreja MODULE_DESCRIPTION("ASoC Extensions for legacy HDA Drivers");
6336bae5ea9SRakesh Ughreja MODULE_AUTHOR("Rakesh Ughreja<rakesh.a.ughreja@intel.com>");
634