xref: /linux/include/sound/soc.h (revision a491a5c84f34febfebd4cb0b8c9add97977efa97)
1808db4a4SRichard Purdie /*
2808db4a4SRichard Purdie  * linux/sound/soc.h -- ALSA SoC Layer
3808db4a4SRichard Purdie  *
4808db4a4SRichard Purdie  * Author:		Liam Girdwood
5808db4a4SRichard Purdie  * Created:		Aug 11th 2005
6808db4a4SRichard Purdie  * Copyright:	Wolfson Microelectronics. PLC.
7808db4a4SRichard Purdie  *
8808db4a4SRichard Purdie  * This program is free software; you can redistribute it and/or modify
9808db4a4SRichard Purdie  * it under the terms of the GNU General Public License version 2 as
10808db4a4SRichard Purdie  * published by the Free Software Foundation.
11808db4a4SRichard Purdie  */
12808db4a4SRichard Purdie 
13808db4a4SRichard Purdie #ifndef __LINUX_SND_SOC_H
14808db4a4SRichard Purdie #define __LINUX_SND_SOC_H
15808db4a4SRichard Purdie 
16808db4a4SRichard Purdie #include <linux/platform_device.h>
17808db4a4SRichard Purdie #include <linux/types.h>
18d5021ec9SMark Brown #include <linux/notifier.h>
194484bb2eSAndrew Morton #include <linux/workqueue.h>
20ec67624dSLopez Cruz, Misael #include <linux/interrupt.h>
21ec67624dSLopez Cruz, Misael #include <linux/kernel.h>
22808db4a4SRichard Purdie #include <sound/core.h>
23808db4a4SRichard Purdie #include <sound/pcm.h>
24808db4a4SRichard Purdie #include <sound/control.h>
25808db4a4SRichard Purdie #include <sound/ac97_codec.h>
26808db4a4SRichard Purdie 
27808db4a4SRichard Purdie /*
28808db4a4SRichard Purdie  * Convenience kcontrol builders
29808db4a4SRichard Purdie  */
304eaa9819SJon Smirl #define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) \
314eaa9819SJon Smirl 	((unsigned long)&(struct soc_mixer_control) \
32762b8df7SMark Brown 	{.reg = xreg, .shift = xshift, .rshift = xshift, .max = xmax, \
33d11bb4a9SPeter Ujfalusi 	.platform_max = xmax, .invert = xinvert})
344eaa9819SJon Smirl #define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \
354eaa9819SJon Smirl 	((unsigned long)&(struct soc_mixer_control) \
36d11bb4a9SPeter Ujfalusi 	{.reg = xreg, .max = xmax, .platform_max = xmax, .invert = xinvert})
37a7a4ac86SPhilipp Zabel #define SOC_SINGLE(xname, reg, shift, max, invert) \
38808db4a4SRichard Purdie {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
39808db4a4SRichard Purdie 	.info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
40808db4a4SRichard Purdie 	.put = snd_soc_put_volsw, \
41a7a4ac86SPhilipp Zabel 	.private_value =  SOC_SINGLE_VALUE(reg, shift, max, invert) }
42a7a4ac86SPhilipp Zabel #define SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
43a7a4ac86SPhilipp Zabel {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
44a7a4ac86SPhilipp Zabel 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
45a7a4ac86SPhilipp Zabel 		 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
46a7a4ac86SPhilipp Zabel 	.tlv.p = (tlv_array), \
47a7a4ac86SPhilipp Zabel 	.info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
48a7a4ac86SPhilipp Zabel 	.put = snd_soc_put_volsw, \
49a7a4ac86SPhilipp Zabel 	.private_value =  SOC_SINGLE_VALUE(reg, shift, max, invert) }
504eaa9819SJon Smirl #define SOC_DOUBLE(xname, xreg, shift_left, shift_right, xmax, xinvert) \
51808db4a4SRichard Purdie {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
52808db4a4SRichard Purdie 	.info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
53808db4a4SRichard Purdie 	.put = snd_soc_put_volsw, \
544eaa9819SJon Smirl 	.private_value = (unsigned long)&(struct soc_mixer_control) \
554eaa9819SJon Smirl 		{.reg = xreg, .shift = shift_left, .rshift = shift_right, \
56d11bb4a9SPeter Ujfalusi 		 .max = xmax, .platform_max = xmax, .invert = xinvert} }
574eaa9819SJon Smirl #define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \
58808db4a4SRichard Purdie {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
59808db4a4SRichard Purdie 	.info = snd_soc_info_volsw_2r, \
60808db4a4SRichard Purdie 	.get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
614eaa9819SJon Smirl 	.private_value = (unsigned long)&(struct soc_mixer_control) \
624eaa9819SJon Smirl 		{.reg = reg_left, .rreg = reg_right, .shift = xshift, \
63d11bb4a9SPeter Ujfalusi 		.max = xmax, .platform_max = xmax, .invert = xinvert} }
644eaa9819SJon Smirl #define SOC_DOUBLE_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert, tlv_array) \
65a7a4ac86SPhilipp Zabel {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
66a7a4ac86SPhilipp Zabel 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
67a7a4ac86SPhilipp Zabel 		 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
68a7a4ac86SPhilipp Zabel 	.tlv.p = (tlv_array), \
69a7a4ac86SPhilipp Zabel 	.info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
70a7a4ac86SPhilipp Zabel 	.put = snd_soc_put_volsw, \
714eaa9819SJon Smirl 	.private_value = (unsigned long)&(struct soc_mixer_control) \
724eaa9819SJon Smirl 		{.reg = xreg, .shift = shift_left, .rshift = shift_right,\
73d11bb4a9SPeter Ujfalusi 		 .max = xmax, .platform_max = xmax, .invert = xinvert} }
744eaa9819SJon Smirl #define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \
75a7a4ac86SPhilipp Zabel {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
76a7a4ac86SPhilipp Zabel 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
77a7a4ac86SPhilipp Zabel 		 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
78a7a4ac86SPhilipp Zabel 	.tlv.p = (tlv_array), \
79a7a4ac86SPhilipp Zabel 	.info = snd_soc_info_volsw_2r, \
80a7a4ac86SPhilipp Zabel 	.get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
814eaa9819SJon Smirl 	.private_value = (unsigned long)&(struct soc_mixer_control) \
824eaa9819SJon Smirl 		{.reg = reg_left, .rreg = reg_right, .shift = xshift, \
83d11bb4a9SPeter Ujfalusi 		.max = xmax, .platform_max = xmax, .invert = xinvert} }
844eaa9819SJon Smirl #define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
85e13ac2e9SMark Brown {	.iface  = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
86e13ac2e9SMark Brown 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
87e13ac2e9SMark Brown 		  SNDRV_CTL_ELEM_ACCESS_READWRITE, \
88e13ac2e9SMark Brown 	.tlv.p  = (tlv_array), \
89e13ac2e9SMark Brown 	.info   = snd_soc_info_volsw_s8, .get = snd_soc_get_volsw_s8, \
90e13ac2e9SMark Brown 	.put    = snd_soc_put_volsw_s8, \
914eaa9819SJon Smirl 	.private_value = (unsigned long)&(struct soc_mixer_control) \
92d11bb4a9SPeter Ujfalusi 		{.reg = xreg, .min = xmin, .max = xmax, \
93d11bb4a9SPeter Ujfalusi 		 .platform_max = xmax} }
94f8ba0b7bSJon Smirl #define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmax, xtexts) \
95808db4a4SRichard Purdie {	.reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
96f8ba0b7bSJon Smirl 	.max = xmax, .texts = xtexts }
97f8ba0b7bSJon Smirl #define SOC_ENUM_SINGLE(xreg, xshift, xmax, xtexts) \
98f8ba0b7bSJon Smirl 	SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmax, xtexts)
99f8ba0b7bSJon Smirl #define SOC_ENUM_SINGLE_EXT(xmax, xtexts) \
100f8ba0b7bSJon Smirl {	.max = xmax, .texts = xtexts }
1012e72f8e3SPeter Ujfalusi #define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xmax, xtexts, xvalues) \
1022e72f8e3SPeter Ujfalusi {	.reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
1032e72f8e3SPeter Ujfalusi 	.mask = xmask, .max = xmax, .texts = xtexts, .values = xvalues}
1042e72f8e3SPeter Ujfalusi #define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xmax, xtexts, xvalues) \
1052e72f8e3SPeter Ujfalusi 	SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xmax, xtexts, xvalues)
106808db4a4SRichard Purdie #define SOC_ENUM(xname, xenum) \
107808db4a4SRichard Purdie {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
108808db4a4SRichard Purdie 	.info = snd_soc_info_enum_double, \
109808db4a4SRichard Purdie 	.get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \
110808db4a4SRichard Purdie 	.private_value = (unsigned long)&xenum }
1112e72f8e3SPeter Ujfalusi #define SOC_VALUE_ENUM(xname, xenum) \
1122e72f8e3SPeter Ujfalusi {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
11374155556SPeter Ujfalusi 	.info = snd_soc_info_enum_double, \
1142e72f8e3SPeter Ujfalusi 	.get = snd_soc_get_value_enum_double, \
1152e72f8e3SPeter Ujfalusi 	.put = snd_soc_put_value_enum_double, \
1162e72f8e3SPeter Ujfalusi 	.private_value = (unsigned long)&xenum }
117f8ba0b7bSJon Smirl #define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\
118808db4a4SRichard Purdie 	 xhandler_get, xhandler_put) \
119808db4a4SRichard Purdie {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
1201c433fbdSGraeme Gregory 	.info = snd_soc_info_volsw, \
121808db4a4SRichard Purdie 	.get = xhandler_get, .put = xhandler_put, \
122f8ba0b7bSJon Smirl 	.private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) }
1237629ad24SDaniel Mack #define SOC_DOUBLE_EXT(xname, xreg, shift_left, shift_right, xmax, xinvert,\
1247629ad24SDaniel Mack 	 xhandler_get, xhandler_put) \
1257629ad24SDaniel Mack {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
1267629ad24SDaniel Mack 	.info = snd_soc_info_volsw, \
1277629ad24SDaniel Mack 	.get = xhandler_get, .put = xhandler_put, \
1287629ad24SDaniel Mack 	.private_value = (unsigned long)&(struct soc_mixer_control) \
1297629ad24SDaniel Mack 		{.reg = xreg, .shift = shift_left, .rshift = shift_right, \
130d11bb4a9SPeter Ujfalusi 		 .max = xmax, .platform_max = xmax, .invert = xinvert} }
131f8ba0b7bSJon Smirl #define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\
13210144c09SMike Montour 	 xhandler_get, xhandler_put, tlv_array) \
13310144c09SMike Montour {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
13410144c09SMike Montour 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
13510144c09SMike Montour 		 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
13610144c09SMike Montour 	.tlv.p = (tlv_array), \
13710144c09SMike Montour 	.info = snd_soc_info_volsw, \
13810144c09SMike Montour 	.get = xhandler_get, .put = xhandler_put, \
139f8ba0b7bSJon Smirl 	.private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) }
140d0af93dbSJoonyoung Shim #define SOC_DOUBLE_EXT_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert,\
141d0af93dbSJoonyoung Shim 	 xhandler_get, xhandler_put, tlv_array) \
142d0af93dbSJoonyoung Shim {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
143d0af93dbSJoonyoung Shim 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
144d0af93dbSJoonyoung Shim 		 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
145d0af93dbSJoonyoung Shim 	.tlv.p = (tlv_array), \
146d0af93dbSJoonyoung Shim 	.info = snd_soc_info_volsw, \
147d0af93dbSJoonyoung Shim 	.get = xhandler_get, .put = xhandler_put, \
148d0af93dbSJoonyoung Shim 	.private_value = (unsigned long)&(struct soc_mixer_control) \
149d0af93dbSJoonyoung Shim 		{.reg = xreg, .shift = shift_left, .rshift = shift_right, \
150d11bb4a9SPeter Ujfalusi 		.max = xmax, .platform_max = xmax, .invert = xinvert} }
1513ce91d5aSJoonyoung Shim #define SOC_DOUBLE_R_EXT_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert,\
1523ce91d5aSJoonyoung Shim 	 xhandler_get, xhandler_put, tlv_array) \
1533ce91d5aSJoonyoung Shim {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
1543ce91d5aSJoonyoung Shim 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1553ce91d5aSJoonyoung Shim 		 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1563ce91d5aSJoonyoung Shim 	.tlv.p = (tlv_array), \
1573ce91d5aSJoonyoung Shim 	.info = snd_soc_info_volsw_2r, \
1583ce91d5aSJoonyoung Shim 	.get = xhandler_get, .put = xhandler_put, \
1593ce91d5aSJoonyoung Shim 	.private_value = (unsigned long)&(struct soc_mixer_control) \
1603ce91d5aSJoonyoung Shim 		{.reg = reg_left, .rreg = reg_right, .shift = xshift, \
161d11bb4a9SPeter Ujfalusi 		.max = xmax, .platform_max = xmax, .invert = xinvert} }
162808db4a4SRichard Purdie #define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \
163808db4a4SRichard Purdie {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
164808db4a4SRichard Purdie 	.info = snd_soc_info_bool_ext, \
165808db4a4SRichard Purdie 	.get = xhandler_get, .put = xhandler_put, \
166808db4a4SRichard Purdie 	.private_value = xdata }
167808db4a4SRichard Purdie #define SOC_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) \
168808db4a4SRichard Purdie {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
169808db4a4SRichard Purdie 	.info = snd_soc_info_enum_ext, \
170808db4a4SRichard Purdie 	.get = xhandler_get, .put = xhandler_put, \
171808db4a4SRichard Purdie 	.private_value = (unsigned long)&xenum }
172808db4a4SRichard Purdie 
173b6f4bb38Sapatard@mandriva.com #define SOC_DOUBLE_R_SX_TLV(xname, xreg_left, xreg_right, xshift,\
174b6f4bb38Sapatard@mandriva.com 		xmin, xmax, tlv_array) \
175b6f4bb38Sapatard@mandriva.com {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
176b6f4bb38Sapatard@mandriva.com 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
177b6f4bb38Sapatard@mandriva.com 		  SNDRV_CTL_ELEM_ACCESS_READWRITE, \
178b6f4bb38Sapatard@mandriva.com 	.tlv.p = (tlv_array), \
179b6f4bb38Sapatard@mandriva.com 	.info = snd_soc_info_volsw_2r_sx, \
180b6f4bb38Sapatard@mandriva.com 	.get = snd_soc_get_volsw_2r_sx, \
181b6f4bb38Sapatard@mandriva.com 	.put = snd_soc_put_volsw_2r_sx, \
182b6f4bb38Sapatard@mandriva.com 	.private_value = (unsigned long)&(struct soc_mixer_control) \
183b6f4bb38Sapatard@mandriva.com 		{.reg = xreg_left, \
184b6f4bb38Sapatard@mandriva.com 		 .rreg = xreg_right, .shift = xshift, \
185b6f4bb38Sapatard@mandriva.com 		 .min = xmin, .max = xmax} }
186b6f4bb38Sapatard@mandriva.com 
187b6f4bb38Sapatard@mandriva.com 
188808db4a4SRichard Purdie /*
1896c2fb6a8SGuennadi Liakhovetski  * Simplified versions of above macros, declaring a struct and calculating
1906c2fb6a8SGuennadi Liakhovetski  * ARRAY_SIZE internally
1916c2fb6a8SGuennadi Liakhovetski  */
1926c2fb6a8SGuennadi Liakhovetski #define SOC_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xtexts) \
1936c2fb6a8SGuennadi Liakhovetski 	struct soc_enum name = SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, \
1946c2fb6a8SGuennadi Liakhovetski 						ARRAY_SIZE(xtexts), xtexts)
1956c2fb6a8SGuennadi Liakhovetski #define SOC_ENUM_SINGLE_DECL(name, xreg, xshift, xtexts) \
1966c2fb6a8SGuennadi Liakhovetski 	SOC_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xtexts)
1976c2fb6a8SGuennadi Liakhovetski #define SOC_ENUM_SINGLE_EXT_DECL(name, xtexts) \
1986c2fb6a8SGuennadi Liakhovetski 	struct soc_enum name = SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(xtexts), xtexts)
1996c2fb6a8SGuennadi Liakhovetski #define SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xmask, xtexts, xvalues) \
2006c2fb6a8SGuennadi Liakhovetski 	struct soc_enum name = SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, \
2016c2fb6a8SGuennadi Liakhovetski 							ARRAY_SIZE(xtexts), xtexts, xvalues)
2026c2fb6a8SGuennadi Liakhovetski #define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \
2036c2fb6a8SGuennadi Liakhovetski 	SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues)
2046c2fb6a8SGuennadi Liakhovetski 
2056c2fb6a8SGuennadi Liakhovetski /*
2060168bf0dSLiam Girdwood  * Component probe and remove ordering levels for components with runtime
2070168bf0dSLiam Girdwood  * dependencies.
2080168bf0dSLiam Girdwood  */
2090168bf0dSLiam Girdwood #define SND_SOC_COMP_ORDER_FIRST		-2
2100168bf0dSLiam Girdwood #define SND_SOC_COMP_ORDER_EARLY		-1
2110168bf0dSLiam Girdwood #define SND_SOC_COMP_ORDER_NORMAL		0
2120168bf0dSLiam Girdwood #define SND_SOC_COMP_ORDER_LATE		1
2130168bf0dSLiam Girdwood #define SND_SOC_COMP_ORDER_LAST		2
2140168bf0dSLiam Girdwood 
2150168bf0dSLiam Girdwood /*
2160be9898aSMark Brown  * Bias levels
2170be9898aSMark Brown  *
2180be9898aSMark Brown  * @ON:      Bias is fully on for audio playback and capture operations.
2190be9898aSMark Brown  * @PREPARE: Prepare for audio operations. Called before DAPM switching for
2200be9898aSMark Brown  *           stream start and stop operations.
2210be9898aSMark Brown  * @STANDBY: Low power standby state when no playback/capture operations are
2220be9898aSMark Brown  *           in progress. NOTE: The transition time between STANDBY and ON
2230be9898aSMark Brown  *           should be as fast as possible and no longer than 10ms.
2240be9898aSMark Brown  * @OFF:     Power Off. No restrictions on transition times.
2250be9898aSMark Brown  */
2260be9898aSMark Brown enum snd_soc_bias_level {
22756fba41fSMark Brown 	SND_SOC_BIAS_OFF = 0,
22856fba41fSMark Brown 	SND_SOC_BIAS_STANDBY = 1,
22956fba41fSMark Brown 	SND_SOC_BIAS_PREPARE = 2,
23056fba41fSMark Brown 	SND_SOC_BIAS_ON = 3,
2310be9898aSMark Brown };
2320be9898aSMark Brown 
2338a2cd618SMark Brown struct snd_jack;
2348a2cd618SMark Brown struct snd_soc_card;
235808db4a4SRichard Purdie struct snd_soc_pcm_stream;
236808db4a4SRichard Purdie struct snd_soc_ops;
237808db4a4SRichard Purdie struct snd_soc_pcm_runtime;
2383c4b266fSLiam Girdwood struct snd_soc_dai;
239f0fba2adSLiam Girdwood struct snd_soc_dai_driver;
24012a48a8cSMark Brown struct snd_soc_platform;
241d273ebe7Sjassi brar struct snd_soc_dai_link;
242f0fba2adSLiam Girdwood struct snd_soc_platform_driver;
243808db4a4SRichard Purdie struct snd_soc_codec;
244f0fba2adSLiam Girdwood struct snd_soc_codec_driver;
245808db4a4SRichard Purdie struct soc_enum;
2468a2cd618SMark Brown struct snd_soc_jack;
247fa9879edSVinod Koul struct snd_soc_jack_zone;
2488a2cd618SMark Brown struct snd_soc_jack_pin;
2497a30a3dbSDimitris Papastamos struct snd_soc_cache_ops;
250ce6120ccSLiam Girdwood #include <sound/soc-dapm.h>
251f0fba2adSLiam Girdwood 
252ec67624dSLopez Cruz, Misael #ifdef CONFIG_GPIOLIB
253ec67624dSLopez Cruz, Misael struct snd_soc_jack_gpio;
254ec67624dSLopez Cruz, Misael #endif
255808db4a4SRichard Purdie 
256808db4a4SRichard Purdie typedef int (*hw_write_t)(void *,const char* ,int);
257808db4a4SRichard Purdie 
258808db4a4SRichard Purdie extern struct snd_ac97_bus_ops soc_ac97_ops;
259808db4a4SRichard Purdie 
2607084a42bSMark Brown enum snd_soc_control_type {
261e9c03905SMark Brown 	SND_SOC_I2C = 1,
2627084a42bSMark Brown 	SND_SOC_SPI,
2637084a42bSMark Brown };
2647084a42bSMark Brown 
2657a30a3dbSDimitris Papastamos enum snd_soc_compress_type {
266119bd789SDimitris Papastamos 	SND_SOC_FLAT_COMPRESSION = 1,
267a7f387d5SDimitris Papastamos 	SND_SOC_LZO_COMPRESSION,
268a7f387d5SDimitris Papastamos 	SND_SOC_RBTREE_COMPRESSION
2697a30a3dbSDimitris Papastamos };
2707a30a3dbSDimitris Papastamos 
271b8c0dab9SLiam Girdwood enum snd_soc_pcm_subclass {
272b8c0dab9SLiam Girdwood 	SND_SOC_PCM_CLASS_PCM	= 0,
273b8c0dab9SLiam Girdwood 	SND_SOC_PCM_CLASS_BE	= 1,
274b8c0dab9SLiam Girdwood };
275b8c0dab9SLiam Girdwood 
276ec4ee52aSMark Brown int snd_soc_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id,
277ec4ee52aSMark Brown 			     unsigned int freq, int dir);
278ec4ee52aSMark Brown int snd_soc_codec_set_pll(struct snd_soc_codec *codec, int pll_id, int source,
279ec4ee52aSMark Brown 			  unsigned int freq_in, unsigned int freq_out);
280ec4ee52aSMark Brown 
28170a7ca34SVinod Koul int snd_soc_register_card(struct snd_soc_card *card);
28270a7ca34SVinod Koul int snd_soc_unregister_card(struct snd_soc_card *card);
2836f8ab4acSMark Brown int snd_soc_suspend(struct device *dev);
2846f8ab4acSMark Brown int snd_soc_resume(struct device *dev);
2856f8ab4acSMark Brown int snd_soc_poweroff(struct device *dev);
286f0fba2adSLiam Girdwood int snd_soc_register_platform(struct device *dev,
287f0fba2adSLiam Girdwood 		struct snd_soc_platform_driver *platform_drv);
288f0fba2adSLiam Girdwood void snd_soc_unregister_platform(struct device *dev);
289f0fba2adSLiam Girdwood int snd_soc_register_codec(struct device *dev,
290001ae4c0SMark Brown 		const struct snd_soc_codec_driver *codec_drv,
291f0fba2adSLiam Girdwood 		struct snd_soc_dai_driver *dai_drv, int num_dai);
292f0fba2adSLiam Girdwood void snd_soc_unregister_codec(struct device *dev);
293181e055eSMark Brown int snd_soc_codec_volatile_register(struct snd_soc_codec *codec,
294181e055eSMark Brown 				    unsigned int reg);
295239c9706SDimitris Papastamos int snd_soc_codec_readable_register(struct snd_soc_codec *codec,
296239c9706SDimitris Papastamos 				    unsigned int reg);
297239c9706SDimitris Papastamos int snd_soc_codec_writable_register(struct snd_soc_codec *codec,
298239c9706SDimitris Papastamos 				    unsigned int reg);
29917a52fd6SMark Brown int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
3007084a42bSMark Brown 			       int addr_bits, int data_bits,
3017084a42bSMark Brown 			       enum snd_soc_control_type control);
3027a30a3dbSDimitris Papastamos int snd_soc_cache_sync(struct snd_soc_codec *codec);
3037a30a3dbSDimitris Papastamos int snd_soc_cache_init(struct snd_soc_codec *codec);
3047a30a3dbSDimitris Papastamos int snd_soc_cache_exit(struct snd_soc_codec *codec);
3057a30a3dbSDimitris Papastamos int snd_soc_cache_write(struct snd_soc_codec *codec,
3067a30a3dbSDimitris Papastamos 			unsigned int reg, unsigned int value);
3077a30a3dbSDimitris Papastamos int snd_soc_cache_read(struct snd_soc_codec *codec,
3087a30a3dbSDimitris Papastamos 		       unsigned int reg, unsigned int *value);
309066d16c3SDimitris Papastamos int snd_soc_default_volatile_register(struct snd_soc_codec *codec,
310066d16c3SDimitris Papastamos 				      unsigned int reg);
311066d16c3SDimitris Papastamos int snd_soc_default_readable_register(struct snd_soc_codec *codec,
312066d16c3SDimitris Papastamos 				      unsigned int reg);
3138020454cSDimitris Papastamos int snd_soc_default_writable_register(struct snd_soc_codec *codec,
3148020454cSDimitris Papastamos 				      unsigned int reg);
315f1442bc1SLiam Girdwood int snd_soc_platform_read(struct snd_soc_platform *platform,
316f1442bc1SLiam Girdwood 					unsigned int reg);
317f1442bc1SLiam Girdwood int snd_soc_platform_write(struct snd_soc_platform *platform,
318f1442bc1SLiam Girdwood 					unsigned int reg, unsigned int val);
31912a48a8cSMark Brown 
3207aae816dSMark Brown /* Utility functions to get clock rates from various things */
3217aae816dSMark Brown int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots);
3227aae816dSMark Brown int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params);
323c0fa59dfSMark Brown int snd_soc_calc_bclk(int fs, int sample_size, int channels, int tdm_slots);
3247aae816dSMark Brown int snd_soc_params_to_bclk(struct snd_pcm_hw_params *parms);
3257aae816dSMark Brown 
326808db4a4SRichard Purdie /* set runtime hw params */
327808db4a4SRichard Purdie int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
328808db4a4SRichard Purdie 	const struct snd_pcm_hardware *hw);
329808db4a4SRichard Purdie 
3308a2cd618SMark Brown /* Jack reporting */
331f0fba2adSLiam Girdwood int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type,
3328a2cd618SMark Brown 		     struct snd_soc_jack *jack);
3338a2cd618SMark Brown void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask);
3348a2cd618SMark Brown int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
3358a2cd618SMark Brown 			  struct snd_soc_jack_pin *pins);
336d5021ec9SMark Brown void snd_soc_jack_notifier_register(struct snd_soc_jack *jack,
337d5021ec9SMark Brown 				    struct notifier_block *nb);
338d5021ec9SMark Brown void snd_soc_jack_notifier_unregister(struct snd_soc_jack *jack,
339d5021ec9SMark Brown 				      struct notifier_block *nb);
340fa9879edSVinod Koul int snd_soc_jack_add_zones(struct snd_soc_jack *jack, int count,
341fa9879edSVinod Koul 			  struct snd_soc_jack_zone *zones);
342fa9879edSVinod Koul int snd_soc_jack_get_type(struct snd_soc_jack *jack, int micbias_voltage);
343ec67624dSLopez Cruz, Misael #ifdef CONFIG_GPIOLIB
344ec67624dSLopez Cruz, Misael int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
345ec67624dSLopez Cruz, Misael 			struct snd_soc_jack_gpio *gpios);
346ec67624dSLopez Cruz, Misael void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
347ec67624dSLopez Cruz, Misael 			struct snd_soc_jack_gpio *gpios);
348ec67624dSLopez Cruz, Misael #endif
3498a2cd618SMark Brown 
350808db4a4SRichard Purdie /* codec register bit access */
351808db4a4SRichard Purdie int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg,
35246f5822fSDaniel Ribeiro 				unsigned int mask, unsigned int value);
353dd1b3d53SMark Brown int snd_soc_update_bits_locked(struct snd_soc_codec *codec,
354dd1b3d53SMark Brown 			       unsigned short reg, unsigned int mask,
355dd1b3d53SMark Brown 			       unsigned int value);
356808db4a4SRichard Purdie int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg,
35746f5822fSDaniel Ribeiro 				unsigned int mask, unsigned int value);
358808db4a4SRichard Purdie 
359808db4a4SRichard Purdie int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
360808db4a4SRichard Purdie 	struct snd_ac97_bus_ops *ops, int num);
361808db4a4SRichard Purdie void snd_soc_free_ac97_codec(struct snd_soc_codec *codec);
362808db4a4SRichard Purdie 
363808db4a4SRichard Purdie /*
364808db4a4SRichard Purdie  *Controls
365808db4a4SRichard Purdie  */
366808db4a4SRichard Purdie struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
367efb7ac3fSMark Brown 				  void *data, char *long_name,
368efb7ac3fSMark Brown 				  const char *prefix);
3693e8e1952SIan Molton int snd_soc_add_controls(struct snd_soc_codec *codec,
3703e8e1952SIan Molton 	const struct snd_kcontrol_new *controls, int num_controls);
371*a491a5c8SLiam Girdwood int snd_soc_add_platform_controls(struct snd_soc_platform *platform,
372*a491a5c8SLiam Girdwood 	const struct snd_kcontrol_new *controls, int num_controls);
373808db4a4SRichard Purdie int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
374808db4a4SRichard Purdie 	struct snd_ctl_elem_info *uinfo);
375808db4a4SRichard Purdie int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol,
376808db4a4SRichard Purdie 	struct snd_ctl_elem_info *uinfo);
377808db4a4SRichard Purdie int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol,
378808db4a4SRichard Purdie 	struct snd_ctl_elem_value *ucontrol);
379808db4a4SRichard Purdie int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol,
380808db4a4SRichard Purdie 	struct snd_ctl_elem_value *ucontrol);
3812e72f8e3SPeter Ujfalusi int snd_soc_get_value_enum_double(struct snd_kcontrol *kcontrol,
3822e72f8e3SPeter Ujfalusi 	struct snd_ctl_elem_value *ucontrol);
3832e72f8e3SPeter Ujfalusi int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol,
3842e72f8e3SPeter Ujfalusi 	struct snd_ctl_elem_value *ucontrol);
385808db4a4SRichard Purdie int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
386808db4a4SRichard Purdie 	struct snd_ctl_elem_info *uinfo);
387808db4a4SRichard Purdie int snd_soc_info_volsw_ext(struct snd_kcontrol *kcontrol,
388808db4a4SRichard Purdie 	struct snd_ctl_elem_info *uinfo);
389392abe9cSPhilipp Zabel #define snd_soc_info_bool_ext		snd_ctl_boolean_mono_info
390808db4a4SRichard Purdie int snd_soc_get_volsw(struct snd_kcontrol *kcontrol,
391808db4a4SRichard Purdie 	struct snd_ctl_elem_value *ucontrol);
392808db4a4SRichard Purdie int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
393808db4a4SRichard Purdie 	struct snd_ctl_elem_value *ucontrol);
394808db4a4SRichard Purdie int snd_soc_info_volsw_2r(struct snd_kcontrol *kcontrol,
395808db4a4SRichard Purdie 	struct snd_ctl_elem_info *uinfo);
396808db4a4SRichard Purdie int snd_soc_get_volsw_2r(struct snd_kcontrol *kcontrol,
397808db4a4SRichard Purdie 	struct snd_ctl_elem_value *ucontrol);
398808db4a4SRichard Purdie int snd_soc_put_volsw_2r(struct snd_kcontrol *kcontrol,
399808db4a4SRichard Purdie 	struct snd_ctl_elem_value *ucontrol);
400e13ac2e9SMark Brown int snd_soc_info_volsw_s8(struct snd_kcontrol *kcontrol,
401e13ac2e9SMark Brown 	struct snd_ctl_elem_info *uinfo);
402e13ac2e9SMark Brown int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol,
403e13ac2e9SMark Brown 	struct snd_ctl_elem_value *ucontrol);
404e13ac2e9SMark Brown int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
405e13ac2e9SMark Brown 	struct snd_ctl_elem_value *ucontrol);
406637d3847SPeter Ujfalusi int snd_soc_limit_volume(struct snd_soc_codec *codec,
407637d3847SPeter Ujfalusi 	const char *name, int max);
408b6f4bb38Sapatard@mandriva.com int snd_soc_info_volsw_2r_sx(struct snd_kcontrol *kcontrol,
409b6f4bb38Sapatard@mandriva.com 	struct snd_ctl_elem_info *uinfo);
410b6f4bb38Sapatard@mandriva.com int snd_soc_get_volsw_2r_sx(struct snd_kcontrol *kcontrol,
411b6f4bb38Sapatard@mandriva.com 	struct snd_ctl_elem_value *ucontrol);
412b6f4bb38Sapatard@mandriva.com int snd_soc_put_volsw_2r_sx(struct snd_kcontrol *kcontrol,
413b6f4bb38Sapatard@mandriva.com 	struct snd_ctl_elem_value *ucontrol);
414808db4a4SRichard Purdie 
4158a2cd618SMark Brown /**
416066d16c3SDimitris Papastamos  * struct snd_soc_reg_access - Describes whether a given register is
417066d16c3SDimitris Papastamos  * readable, writable or volatile.
418066d16c3SDimitris Papastamos  *
419066d16c3SDimitris Papastamos  * @reg: the register number
420066d16c3SDimitris Papastamos  * @read: whether this register is readable
421066d16c3SDimitris Papastamos  * @write: whether this register is writable
422066d16c3SDimitris Papastamos  * @vol: whether this register is volatile
423066d16c3SDimitris Papastamos  */
424066d16c3SDimitris Papastamos struct snd_soc_reg_access {
425066d16c3SDimitris Papastamos 	u16 reg;
426066d16c3SDimitris Papastamos 	u16 read;
427066d16c3SDimitris Papastamos 	u16 write;
428066d16c3SDimitris Papastamos 	u16 vol;
429066d16c3SDimitris Papastamos };
430066d16c3SDimitris Papastamos 
431066d16c3SDimitris Papastamos /**
4328a2cd618SMark Brown  * struct snd_soc_jack_pin - Describes a pin to update based on jack detection
4338a2cd618SMark Brown  *
4348a2cd618SMark Brown  * @pin:    name of the pin to update
4358a2cd618SMark Brown  * @mask:   bits to check for in reported jack status
4368a2cd618SMark Brown  * @invert: if non-zero then pin is enabled when status is not reported
4378a2cd618SMark Brown  */
4388a2cd618SMark Brown struct snd_soc_jack_pin {
4398a2cd618SMark Brown 	struct list_head list;
4408a2cd618SMark Brown 	const char *pin;
4418a2cd618SMark Brown 	int mask;
4428a2cd618SMark Brown 	bool invert;
4438a2cd618SMark Brown };
4448a2cd618SMark Brown 
445ec67624dSLopez Cruz, Misael /**
446fa9879edSVinod Koul  * struct snd_soc_jack_zone - Describes voltage zones of jack detection
447fa9879edSVinod Koul  *
448fa9879edSVinod Koul  * @min_mv: start voltage in mv
449fa9879edSVinod Koul  * @max_mv: end voltage in mv
450fa9879edSVinod Koul  * @jack_type: type of jack that is expected for this voltage
451fa9879edSVinod Koul  * @debounce_time: debounce_time for jack, codec driver should wait for this
452fa9879edSVinod Koul  *		duration before reading the adc for voltages
453fa9879edSVinod Koul  * @:list: list container
454fa9879edSVinod Koul  */
455fa9879edSVinod Koul struct snd_soc_jack_zone {
456fa9879edSVinod Koul 	unsigned int min_mv;
457fa9879edSVinod Koul 	unsigned int max_mv;
458fa9879edSVinod Koul 	unsigned int jack_type;
459fa9879edSVinod Koul 	unsigned int debounce_time;
460fa9879edSVinod Koul 	struct list_head list;
461fa9879edSVinod Koul };
462fa9879edSVinod Koul 
463fa9879edSVinod Koul /**
464ec67624dSLopez Cruz, Misael  * struct snd_soc_jack_gpio - Describes a gpio pin for jack detection
465ec67624dSLopez Cruz, Misael  *
466ec67624dSLopez Cruz, Misael  * @gpio:         gpio number
467ec67624dSLopez Cruz, Misael  * @name:         gpio name
468ec67624dSLopez Cruz, Misael  * @report:       value to report when jack detected
469ec67624dSLopez Cruz, Misael  * @invert:       report presence in low state
470ec67624dSLopez Cruz, Misael  * @debouce_time: debouce time in ms
4717887ab3aSMark Brown  * @wake:	  enable as wake source
472fadddc87SMark Brown  * @jack_status_check: callback function which overrides the detection
473fadddc87SMark Brown  *		       to provide more complex checks (eg, reading an
474fadddc87SMark Brown  *		       ADC).
475ec67624dSLopez Cruz, Misael  */
476ec67624dSLopez Cruz, Misael #ifdef CONFIG_GPIOLIB
477ec67624dSLopez Cruz, Misael struct snd_soc_jack_gpio {
478ec67624dSLopez Cruz, Misael 	unsigned int gpio;
479ec67624dSLopez Cruz, Misael 	const char *name;
480ec67624dSLopez Cruz, Misael 	int report;
481ec67624dSLopez Cruz, Misael 	int invert;
482ec67624dSLopez Cruz, Misael 	int debounce_time;
4837887ab3aSMark Brown 	bool wake;
4847887ab3aSMark Brown 
485ec67624dSLopez Cruz, Misael 	struct snd_soc_jack *jack;
4864c14d78eSMark Brown 	struct delayed_work work;
487c871a053SJoonyoung Shim 
488c871a053SJoonyoung Shim 	int (*jack_status_check)(void);
489ec67624dSLopez Cruz, Misael };
490ec67624dSLopez Cruz, Misael #endif
491ec67624dSLopez Cruz, Misael 
4928a2cd618SMark Brown struct snd_soc_jack {
4938a2cd618SMark Brown 	struct snd_jack *jack;
494f0fba2adSLiam Girdwood 	struct snd_soc_codec *codec;
4958a2cd618SMark Brown 	struct list_head pins;
4968a2cd618SMark Brown 	int status;
497d5021ec9SMark Brown 	struct blocking_notifier_head notifier;
498fa9879edSVinod Koul 	struct list_head jack_zones;
4998a2cd618SMark Brown };
5008a2cd618SMark Brown 
501808db4a4SRichard Purdie /* SoC PCM stream information */
502808db4a4SRichard Purdie struct snd_soc_pcm_stream {
503f0fba2adSLiam Girdwood 	const char *stream_name;
5041c433fbdSGraeme Gregory 	u64 formats;			/* SNDRV_PCM_FMTBIT_* */
5051c433fbdSGraeme Gregory 	unsigned int rates;		/* SNDRV_PCM_RATE_* */
506808db4a4SRichard Purdie 	unsigned int rate_min;		/* min rate */
507808db4a4SRichard Purdie 	unsigned int rate_max;		/* max rate */
508808db4a4SRichard Purdie 	unsigned int channels_min;	/* min channels */
509808db4a4SRichard Purdie 	unsigned int channels_max;	/* max channels */
510808db4a4SRichard Purdie };
511808db4a4SRichard Purdie 
512808db4a4SRichard Purdie /* SoC audio ops */
513808db4a4SRichard Purdie struct snd_soc_ops {
514808db4a4SRichard Purdie 	int (*startup)(struct snd_pcm_substream *);
515808db4a4SRichard Purdie 	void (*shutdown)(struct snd_pcm_substream *);
516808db4a4SRichard Purdie 	int (*hw_params)(struct snd_pcm_substream *, struct snd_pcm_hw_params *);
517808db4a4SRichard Purdie 	int (*hw_free)(struct snd_pcm_substream *);
518808db4a4SRichard Purdie 	int (*prepare)(struct snd_pcm_substream *);
519808db4a4SRichard Purdie 	int (*trigger)(struct snd_pcm_substream *, int);
520808db4a4SRichard Purdie };
521808db4a4SRichard Purdie 
5227a30a3dbSDimitris Papastamos /* SoC cache ops */
5237a30a3dbSDimitris Papastamos struct snd_soc_cache_ops {
5240d735eaaSDimitris Papastamos 	const char *name;
5257a30a3dbSDimitris Papastamos 	enum snd_soc_compress_type id;
5267a30a3dbSDimitris Papastamos 	int (*init)(struct snd_soc_codec *codec);
5277a30a3dbSDimitris Papastamos 	int (*exit)(struct snd_soc_codec *codec);
5287a30a3dbSDimitris Papastamos 	int (*read)(struct snd_soc_codec *codec, unsigned int reg,
5297a30a3dbSDimitris Papastamos 		unsigned int *value);
5307a30a3dbSDimitris Papastamos 	int (*write)(struct snd_soc_codec *codec, unsigned int reg,
5317a30a3dbSDimitris Papastamos 		unsigned int value);
5327a30a3dbSDimitris Papastamos 	int (*sync)(struct snd_soc_codec *codec);
5337a30a3dbSDimitris Papastamos };
5347a30a3dbSDimitris Papastamos 
535f0fba2adSLiam Girdwood /* SoC Audio Codec device */
536808db4a4SRichard Purdie struct snd_soc_codec {
537f0fba2adSLiam Girdwood 	const char *name;
538ead9b919SJarkko Nikula 	const char *name_prefix;
539f0fba2adSLiam Girdwood 	int id;
5400d0cf00aSMark Brown 	struct device *dev;
541001ae4c0SMark Brown 	const struct snd_soc_codec_driver *driver;
5420d0cf00aSMark Brown 
543f0fba2adSLiam Girdwood 	struct mutex mutex;
544f0fba2adSLiam Girdwood 	struct snd_soc_card *card;
5450d0cf00aSMark Brown 	struct list_head list;
546f0fba2adSLiam Girdwood 	struct list_head card_list;
547f0fba2adSLiam Girdwood 	int num_dai;
54823bbce34SDimitris Papastamos 	enum snd_soc_compress_type compress_type;
549aea170a0SDimitris Papastamos 	size_t reg_size;	/* reg_cache_size * reg_word_size */
5501500b7b5SDimitris Papastamos 	int (*volatile_register)(struct snd_soc_codec *, unsigned int);
5511500b7b5SDimitris Papastamos 	int (*readable_register)(struct snd_soc_codec *, unsigned int);
5528020454cSDimitris Papastamos 	int (*writable_register)(struct snd_soc_codec *, unsigned int);
553808db4a4SRichard Purdie 
554808db4a4SRichard Purdie 	/* runtime */
555808db4a4SRichard Purdie 	struct snd_ac97 *ac97;  /* for ad-hoc ac97 devices */
556808db4a4SRichard Purdie 	unsigned int active;
557dad8e7aeSDimitris Papastamos 	unsigned int cache_bypass:1; /* Suppress access to the cache */
558f0fba2adSLiam Girdwood 	unsigned int suspended:1; /* Codec is in suspend PM state */
559f0fba2adSLiam Girdwood 	unsigned int probed:1; /* Codec has been probed */
560f0fba2adSLiam Girdwood 	unsigned int ac97_registered:1; /* Codec has been AC97 registered */
5610562f788SMika Westerberg 	unsigned int ac97_created:1; /* Codec has been created by SoC */
562f0fba2adSLiam Girdwood 	unsigned int sysfs_registered:1; /* codec has been sysfs registered */
563fdf0f54dSDimitris Papastamos 	unsigned int cache_init:1; /* codec cache has been initialized */
564aaee8ef1SMark Brown 	u32 cache_only;  /* Suppress writes to hardware */
565aaee8ef1SMark Brown 	u32 cache_sync; /* Cache needs to be synced to hardware */
566f0fba2adSLiam Girdwood 
567f0fba2adSLiam Girdwood 	/* codec IO */
568f0fba2adSLiam Girdwood 	void *control_data; /* codec control (i2c/3wire) data */
56967850a89SDimitris Papastamos 	enum snd_soc_control_type control_type;
570f0fba2adSLiam Girdwood 	hw_write_t hw_write;
571f0fba2adSLiam Girdwood 	unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int);
572c3acec26SMark Brown 	unsigned int (*read)(struct snd_soc_codec *, unsigned int);
573c3acec26SMark Brown 	int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
5745fb609d4SDimitris Papastamos 	int (*bulk_write_raw)(struct snd_soc_codec *, unsigned int, const void *, size_t);
575f0fba2adSLiam Girdwood 	void *reg_cache;
5763335ddcaSDimitris Papastamos 	const void *reg_def_copy;
5777a30a3dbSDimitris Papastamos 	const struct snd_soc_cache_ops *cache_ops;
5787a30a3dbSDimitris Papastamos 	struct mutex cache_rw_mutex;
579a96ca338SMark Brown 
580808db4a4SRichard Purdie 	/* dapm */
581ce6120ccSLiam Girdwood 	struct snd_soc_dapm_context dapm;
582808db4a4SRichard Purdie 
583384c89e2SMark Brown #ifdef CONFIG_DEBUG_FS
58488439ac7SPeter Ujfalusi 	struct dentry *debugfs_codec_root;
585384c89e2SMark Brown 	struct dentry *debugfs_reg;
58679fb9387SMark Brown 	struct dentry *debugfs_dapm;
587384c89e2SMark Brown #endif
588808db4a4SRichard Purdie };
589808db4a4SRichard Purdie 
590f0fba2adSLiam Girdwood /* codec driver */
591f0fba2adSLiam Girdwood struct snd_soc_codec_driver {
592f0fba2adSLiam Girdwood 
593f0fba2adSLiam Girdwood 	/* driver ops */
594f0fba2adSLiam Girdwood 	int (*probe)(struct snd_soc_codec *);
595f0fba2adSLiam Girdwood 	int (*remove)(struct snd_soc_codec *);
596f0fba2adSLiam Girdwood 	int (*suspend)(struct snd_soc_codec *,
597f0fba2adSLiam Girdwood 			pm_message_t state);
598f0fba2adSLiam Girdwood 	int (*resume)(struct snd_soc_codec *);
599f0fba2adSLiam Girdwood 
600b7af1dafSMark Brown 	/* Default control and setup, added after probe() is run */
601b7af1dafSMark Brown 	const struct snd_kcontrol_new *controls;
602b7af1dafSMark Brown 	int num_controls;
60389b95ac0SMark Brown 	const struct snd_soc_dapm_widget *dapm_widgets;
60489b95ac0SMark Brown 	int num_dapm_widgets;
60589b95ac0SMark Brown 	const struct snd_soc_dapm_route *dapm_routes;
60689b95ac0SMark Brown 	int num_dapm_routes;
60789b95ac0SMark Brown 
608ec4ee52aSMark Brown 	/* codec wide operations */
609ec4ee52aSMark Brown 	int (*set_sysclk)(struct snd_soc_codec *codec,
610ec4ee52aSMark Brown 			  int clk_id, unsigned int freq, int dir);
611ec4ee52aSMark Brown 	int (*set_pll)(struct snd_soc_codec *codec, int pll_id, int source,
612ec4ee52aSMark Brown 		unsigned int freq_in, unsigned int freq_out);
613ec4ee52aSMark Brown 
614f0fba2adSLiam Girdwood 	/* codec IO */
615f0fba2adSLiam Girdwood 	unsigned int (*read)(struct snd_soc_codec *, unsigned int);
616f0fba2adSLiam Girdwood 	int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
617f0fba2adSLiam Girdwood 	int (*display_register)(struct snd_soc_codec *, char *,
618f0fba2adSLiam Girdwood 				size_t, unsigned int);
619d4754ec9SDimitris Papastamos 	int (*volatile_register)(struct snd_soc_codec *, unsigned int);
620d4754ec9SDimitris Papastamos 	int (*readable_register)(struct snd_soc_codec *, unsigned int);
6218020454cSDimitris Papastamos 	int (*writable_register)(struct snd_soc_codec *, unsigned int);
622f0fba2adSLiam Girdwood 	short reg_cache_size;
623f0fba2adSLiam Girdwood 	short reg_cache_step;
624f0fba2adSLiam Girdwood 	short reg_word_size;
625f0fba2adSLiam Girdwood 	const void *reg_cache_default;
626066d16c3SDimitris Papastamos 	short reg_access_size;
627066d16c3SDimitris Papastamos 	const struct snd_soc_reg_access *reg_access_default;
6287a30a3dbSDimitris Papastamos 	enum snd_soc_compress_type compress_type;
629f0fba2adSLiam Girdwood 
630f0fba2adSLiam Girdwood 	/* codec bias level */
631f0fba2adSLiam Girdwood 	int (*set_bias_level)(struct snd_soc_codec *,
632f0fba2adSLiam Girdwood 			      enum snd_soc_bias_level level);
633474b62d6SMark Brown 
634474b62d6SMark Brown 	void (*seq_notifier)(struct snd_soc_dapm_context *,
635f85a9e0dSMark Brown 			     enum snd_soc_dapm_type, int);
6360168bf0dSLiam Girdwood 
6370168bf0dSLiam Girdwood 	/* probe ordering - for components with runtime dependencies */
6380168bf0dSLiam Girdwood 	int probe_order;
6390168bf0dSLiam Girdwood 	int remove_order;
640808db4a4SRichard Purdie };
641808db4a4SRichard Purdie 
642808db4a4SRichard Purdie /* SoC platform interface */
643f0fba2adSLiam Girdwood struct snd_soc_platform_driver {
644808db4a4SRichard Purdie 
645f0fba2adSLiam Girdwood 	int (*probe)(struct snd_soc_platform *);
646f0fba2adSLiam Girdwood 	int (*remove)(struct snd_soc_platform *);
647f0fba2adSLiam Girdwood 	int (*suspend)(struct snd_soc_dai *dai);
648f0fba2adSLiam Girdwood 	int (*resume)(struct snd_soc_dai *dai);
649808db4a4SRichard Purdie 
650808db4a4SRichard Purdie 	/* pcm creation and destruction */
651552d1ef6SLiam Girdwood 	int (*pcm_new)(struct snd_soc_pcm_runtime *);
652808db4a4SRichard Purdie 	void (*pcm_free)(struct snd_pcm *);
653808db4a4SRichard Purdie 
654258020d0SPeter Ujfalusi 	/*
655258020d0SPeter Ujfalusi 	 * For platform caused delay reporting.
656258020d0SPeter Ujfalusi 	 * Optional.
657258020d0SPeter Ujfalusi 	 */
658258020d0SPeter Ujfalusi 	snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *,
659258020d0SPeter Ujfalusi 		struct snd_soc_dai *);
660258020d0SPeter Ujfalusi 
661808db4a4SRichard Purdie 	/* platform stream ops */
662f0fba2adSLiam Girdwood 	struct snd_pcm_ops *ops;
6630168bf0dSLiam Girdwood 
6640168bf0dSLiam Girdwood 	/* probe ordering - for components with runtime dependencies */
6650168bf0dSLiam Girdwood 	int probe_order;
6660168bf0dSLiam Girdwood 	int remove_order;
667f1442bc1SLiam Girdwood 
668f1442bc1SLiam Girdwood 	/* platform IO - used for platform DAPM */
669f1442bc1SLiam Girdwood 	unsigned int (*read)(struct snd_soc_platform *, unsigned int);
670f1442bc1SLiam Girdwood 	int (*write)(struct snd_soc_platform *, unsigned int, unsigned int);
671808db4a4SRichard Purdie };
672808db4a4SRichard Purdie 
673f0fba2adSLiam Girdwood struct snd_soc_platform {
674f0fba2adSLiam Girdwood 	const char *name;
675f0fba2adSLiam Girdwood 	int id;
676f0fba2adSLiam Girdwood 	struct device *dev;
677f0fba2adSLiam Girdwood 	struct snd_soc_platform_driver *driver;
678f0fba2adSLiam Girdwood 
679f0fba2adSLiam Girdwood 	unsigned int suspended:1; /* platform is suspended */
680f0fba2adSLiam Girdwood 	unsigned int probed:1;
681f0fba2adSLiam Girdwood 
682f0fba2adSLiam Girdwood 	struct snd_soc_card *card;
683f0fba2adSLiam Girdwood 	struct list_head list;
684f0fba2adSLiam Girdwood 	struct list_head card_list;
685f0fba2adSLiam Girdwood };
686f0fba2adSLiam Girdwood 
687808db4a4SRichard Purdie struct snd_soc_dai_link {
688f0fba2adSLiam Girdwood 	/* config - must be set by machine driver */
689f0fba2adSLiam Girdwood 	const char *name;			/* Codec name */
690f0fba2adSLiam Girdwood 	const char *stream_name;		/* Stream name */
691f0fba2adSLiam Girdwood 	const char *codec_name;		/* for multi-codec */
692f0fba2adSLiam Girdwood 	const char *platform_name;	/* for multi-platform */
693f0fba2adSLiam Girdwood 	const char *cpu_dai_name;
694f0fba2adSLiam Girdwood 	const char *codec_dai_name;
6954ccab3e7SLiam Girdwood 
6963efab7dcSMark Brown 	/* Keep DAI active over suspend */
6973efab7dcSMark Brown 	unsigned int ignore_suspend:1;
6983efab7dcSMark Brown 
69906f409d7SMark Brown 	/* Symmetry requirements */
70006f409d7SMark Brown 	unsigned int symmetric_rates:1;
70106f409d7SMark Brown 
702f0fba2adSLiam Girdwood 	/* codec/machine specific init - e.g. add machine controls */
703f0fba2adSLiam Girdwood 	int (*init)(struct snd_soc_pcm_runtime *rtd);
70406f409d7SMark Brown 
705f0fba2adSLiam Girdwood 	/* machine stream operations */
706f0fba2adSLiam Girdwood 	struct snd_soc_ops *ops;
707808db4a4SRichard Purdie };
708808db4a4SRichard Purdie 
709ff819b83SDimitris Papastamos struct snd_soc_codec_conf {
710ead9b919SJarkko Nikula 	const char *dev_name;
711ff819b83SDimitris Papastamos 
712ff819b83SDimitris Papastamos 	/*
713ff819b83SDimitris Papastamos 	 * optional map of kcontrol, widget and path name prefixes that are
714ff819b83SDimitris Papastamos 	 * associated per device
715ff819b83SDimitris Papastamos 	 */
716ead9b919SJarkko Nikula 	const char *name_prefix;
717ff819b83SDimitris Papastamos 
718ff819b83SDimitris Papastamos 	/*
719ff819b83SDimitris Papastamos 	 * set this to the desired compression type if you want to
720ff819b83SDimitris Papastamos 	 * override the one supplied in codec->driver->compress_type
721ff819b83SDimitris Papastamos 	 */
722ff819b83SDimitris Papastamos 	enum snd_soc_compress_type compress_type;
723ead9b919SJarkko Nikula };
724ead9b919SJarkko Nikula 
7252eea392dSJarkko Nikula struct snd_soc_aux_dev {
7262eea392dSJarkko Nikula 	const char *name;		/* Codec name */
7272eea392dSJarkko Nikula 	const char *codec_name;		/* for multi-codec */
7282eea392dSJarkko Nikula 
7292eea392dSJarkko Nikula 	/* codec/machine specific init - e.g. add machine controls */
7302eea392dSJarkko Nikula 	int (*init)(struct snd_soc_dapm_context *dapm);
7312eea392dSJarkko Nikula };
7322eea392dSJarkko Nikula 
73387506549SMark Brown /* SoC card */
73487506549SMark Brown struct snd_soc_card {
735f0fba2adSLiam Girdwood 	const char *name;
73622de71baSLiam Girdwood 	const char *long_name;
73722de71baSLiam Girdwood 	const char *driver_name;
738c5af3a2eSMark Brown 	struct device *dev;
739f0fba2adSLiam Girdwood 	struct snd_card *snd_card;
740f0fba2adSLiam Girdwood 	struct module *owner;
741c5af3a2eSMark Brown 
742c5af3a2eSMark Brown 	struct list_head list;
743f0fba2adSLiam Girdwood 	struct mutex mutex;
744c5af3a2eSMark Brown 
745f0fba2adSLiam Girdwood 	bool instantiated;
746808db4a4SRichard Purdie 
747e7361ec4SMark Brown 	int (*probe)(struct snd_soc_card *card);
74828e9ad92SMark Brown 	int (*late_probe)(struct snd_soc_card *card);
749e7361ec4SMark Brown 	int (*remove)(struct snd_soc_card *card);
750808db4a4SRichard Purdie 
751808db4a4SRichard Purdie 	/* the pre and post PM functions are used to do any PM work before and
752808db4a4SRichard Purdie 	 * after the codec and DAI's do any PM work. */
75370b2ac12SMark Brown 	int (*suspend_pre)(struct snd_soc_card *card);
75470b2ac12SMark Brown 	int (*suspend_post)(struct snd_soc_card *card);
75570b2ac12SMark Brown 	int (*resume_pre)(struct snd_soc_card *card);
75670b2ac12SMark Brown 	int (*resume_post)(struct snd_soc_card *card);
757808db4a4SRichard Purdie 
7580b4d221bSLiam Girdwood 	/* callbacks */
75987506549SMark Brown 	int (*set_bias_level)(struct snd_soc_card *,
760d4c6005fSMark Brown 			      struct snd_soc_dapm_context *dapm,
7610be9898aSMark Brown 			      enum snd_soc_bias_level level);
7621badabd9SMark Brown 	int (*set_bias_level_post)(struct snd_soc_card *,
763d4c6005fSMark Brown 				   struct snd_soc_dapm_context *dapm,
7641badabd9SMark Brown 				   enum snd_soc_bias_level level);
7650b4d221bSLiam Girdwood 
7666c5f1fedSMark Brown 	long pmdown_time;
76796dd3622SMark Brown 
768808db4a4SRichard Purdie 	/* CPU <--> Codec DAI links  */
769808db4a4SRichard Purdie 	struct snd_soc_dai_link *dai_link;
770808db4a4SRichard Purdie 	int num_links;
771f0fba2adSLiam Girdwood 	struct snd_soc_pcm_runtime *rtd;
772f0fba2adSLiam Girdwood 	int num_rtd;
7736308419aSMark Brown 
774ff819b83SDimitris Papastamos 	/* optional codec specific configuration */
775ff819b83SDimitris Papastamos 	struct snd_soc_codec_conf *codec_conf;
776ff819b83SDimitris Papastamos 	int num_configs;
777ead9b919SJarkko Nikula 
7782eea392dSJarkko Nikula 	/*
7792eea392dSJarkko Nikula 	 * optional auxiliary devices such as amplifiers or codecs with DAI
7802eea392dSJarkko Nikula 	 * link unused
7812eea392dSJarkko Nikula 	 */
7822eea392dSJarkko Nikula 	struct snd_soc_aux_dev *aux_dev;
7832eea392dSJarkko Nikula 	int num_aux_devs;
7842eea392dSJarkko Nikula 	struct snd_soc_pcm_runtime *rtd_aux;
7852eea392dSJarkko Nikula 	int num_aux_rtd;
7862eea392dSJarkko Nikula 
787b7af1dafSMark Brown 	const struct snd_kcontrol_new *controls;
788b7af1dafSMark Brown 	int num_controls;
789b7af1dafSMark Brown 
790b8ad29deSMark Brown 	/*
791b8ad29deSMark Brown 	 * Card-specific routes and widgets.
792b8ad29deSMark Brown 	 */
793d06e48dbSLars-Peter Clausen 	const struct snd_soc_dapm_widget *dapm_widgets;
794b8ad29deSMark Brown 	int num_dapm_widgets;
795d06e48dbSLars-Peter Clausen 	const struct snd_soc_dapm_route *dapm_routes;
796b8ad29deSMark Brown 	int num_dapm_routes;
797b8ad29deSMark Brown 
7986308419aSMark Brown 	struct work_struct deferred_resume_work;
799f0fba2adSLiam Girdwood 
800f0fba2adSLiam Girdwood 	/* lists of probed devices belonging to this card */
801f0fba2adSLiam Girdwood 	struct list_head codec_dev_list;
802f0fba2adSLiam Girdwood 	struct list_head platform_dev_list;
803f0fba2adSLiam Girdwood 	struct list_head dai_dev_list;
804a6052154SJarkko Nikula 
80597c866deSJarkko Nikula 	struct list_head widgets;
8068ddab3f5SJarkko Nikula 	struct list_head paths;
8077be31be8SJarkko Nikula 	struct list_head dapm_list;
8088ddab3f5SJarkko Nikula 
809e37a4970SMark Brown 	/* Generic DAPM context for the card */
810e37a4970SMark Brown 	struct snd_soc_dapm_context dapm;
811e37a4970SMark Brown 
812a6052154SJarkko Nikula #ifdef CONFIG_DEBUG_FS
813a6052154SJarkko Nikula 	struct dentry *debugfs_card_root;
8143a45b867SJarkko Nikula 	struct dentry *debugfs_pop_time;
815a6052154SJarkko Nikula #endif
8163a45b867SJarkko Nikula 	u32 pop_time;
817dddf3e4cSMark Brown 
818dddf3e4cSMark Brown 	void *drvdata;
819808db4a4SRichard Purdie };
820808db4a4SRichard Purdie 
821f0fba2adSLiam Girdwood /* SoC machine DAI configuration, glues a codec and cpu DAI together */
822808db4a4SRichard Purdie struct snd_soc_pcm_runtime  {
823f0fba2adSLiam Girdwood 	struct device dev;
824f0fba2adSLiam Girdwood 	struct snd_soc_card *card;
825f0fba2adSLiam Girdwood 	struct snd_soc_dai_link *dai_link;
826b8c0dab9SLiam Girdwood 	struct mutex pcm_mutex;
827b8c0dab9SLiam Girdwood 	enum snd_soc_pcm_subclass pcm_subclass;
828b8c0dab9SLiam Girdwood 	struct snd_pcm_ops ops;
829f0fba2adSLiam Girdwood 
830f0fba2adSLiam Girdwood 	unsigned int complete:1;
831f0fba2adSLiam Girdwood 	unsigned int dev_registered:1;
832f0fba2adSLiam Girdwood 
833f0fba2adSLiam Girdwood 	/* Symmetry data - only valid if symmetry is being enforced */
834f0fba2adSLiam Girdwood 	unsigned int rate;
835f0fba2adSLiam Girdwood 	long pmdown_time;
836f0fba2adSLiam Girdwood 
837f0fba2adSLiam Girdwood 	/* runtime devices */
838f0fba2adSLiam Girdwood 	struct snd_pcm *pcm;
839f0fba2adSLiam Girdwood 	struct snd_soc_codec *codec;
840f0fba2adSLiam Girdwood 	struct snd_soc_platform *platform;
841f0fba2adSLiam Girdwood 	struct snd_soc_dai *codec_dai;
842f0fba2adSLiam Girdwood 	struct snd_soc_dai *cpu_dai;
843f0fba2adSLiam Girdwood 
844f0fba2adSLiam Girdwood 	struct delayed_work delayed_work;
845808db4a4SRichard Purdie };
846808db4a4SRichard Purdie 
8474eaa9819SJon Smirl /* mixer control */
8484eaa9819SJon Smirl struct soc_mixer_control {
849d11bb4a9SPeter Ujfalusi 	int min, max, platform_max;
850815ecf8dSJon Smirl 	unsigned int reg, rreg, shift, rshift, invert;
8514eaa9819SJon Smirl };
8524eaa9819SJon Smirl 
853808db4a4SRichard Purdie /* enumerated kcontrol */
854808db4a4SRichard Purdie struct soc_enum {
855808db4a4SRichard Purdie 	unsigned short reg;
856808db4a4SRichard Purdie 	unsigned short reg2;
857808db4a4SRichard Purdie 	unsigned char shift_l;
858808db4a4SRichard Purdie 	unsigned char shift_r;
859f8ba0b7bSJon Smirl 	unsigned int max;
8602e72f8e3SPeter Ujfalusi 	unsigned int mask;
86187023ff7STakashi Iwai 	const char * const *texts;
8622e72f8e3SPeter Ujfalusi 	const unsigned int *values;
8632e72f8e3SPeter Ujfalusi 	void *dapm;
8642e72f8e3SPeter Ujfalusi };
8652e72f8e3SPeter Ujfalusi 
8665c82f567SMark Brown /* codec IO */
867c3753707SMark Brown unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
868c3753707SMark Brown unsigned int snd_soc_write(struct snd_soc_codec *codec,
869c3753707SMark Brown 			   unsigned int reg, unsigned int val);
8705fb609d4SDimitris Papastamos unsigned int snd_soc_bulk_write_raw(struct snd_soc_codec *codec,
8715fb609d4SDimitris Papastamos 				    unsigned int reg, const void *data, size_t len);
8725c82f567SMark Brown 
873f0fba2adSLiam Girdwood /* device driver data */
874f0fba2adSLiam Girdwood 
875dddf3e4cSMark Brown static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
876dddf3e4cSMark Brown 		void *data)
877dddf3e4cSMark Brown {
878dddf3e4cSMark Brown 	card->drvdata = data;
879dddf3e4cSMark Brown }
880dddf3e4cSMark Brown 
881dddf3e4cSMark Brown static inline void *snd_soc_card_get_drvdata(struct snd_soc_card *card)
882dddf3e4cSMark Brown {
883dddf3e4cSMark Brown 	return card->drvdata;
884dddf3e4cSMark Brown }
885dddf3e4cSMark Brown 
886b2c812e2SMark Brown static inline void snd_soc_codec_set_drvdata(struct snd_soc_codec *codec,
887b2c812e2SMark Brown 		void *data)
888b2c812e2SMark Brown {
889f0fba2adSLiam Girdwood 	dev_set_drvdata(codec->dev, data);
890b2c812e2SMark Brown }
891b2c812e2SMark Brown 
892b2c812e2SMark Brown static inline void *snd_soc_codec_get_drvdata(struct snd_soc_codec *codec)
893b2c812e2SMark Brown {
894f0fba2adSLiam Girdwood 	return dev_get_drvdata(codec->dev);
895f0fba2adSLiam Girdwood }
896f0fba2adSLiam Girdwood 
897f0fba2adSLiam Girdwood static inline void snd_soc_platform_set_drvdata(struct snd_soc_platform *platform,
898f0fba2adSLiam Girdwood 		void *data)
899f0fba2adSLiam Girdwood {
900f0fba2adSLiam Girdwood 	dev_set_drvdata(platform->dev, data);
901f0fba2adSLiam Girdwood }
902f0fba2adSLiam Girdwood 
903f0fba2adSLiam Girdwood static inline void *snd_soc_platform_get_drvdata(struct snd_soc_platform *platform)
904f0fba2adSLiam Girdwood {
905f0fba2adSLiam Girdwood 	return dev_get_drvdata(platform->dev);
906f0fba2adSLiam Girdwood }
907f0fba2adSLiam Girdwood 
908f0fba2adSLiam Girdwood static inline void snd_soc_pcm_set_drvdata(struct snd_soc_pcm_runtime *rtd,
909f0fba2adSLiam Girdwood 		void *data)
910f0fba2adSLiam Girdwood {
911f0fba2adSLiam Girdwood 	dev_set_drvdata(&rtd->dev, data);
912f0fba2adSLiam Girdwood }
913f0fba2adSLiam Girdwood 
914f0fba2adSLiam Girdwood static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd)
915f0fba2adSLiam Girdwood {
916f0fba2adSLiam Girdwood 	return dev_get_drvdata(&rtd->dev);
917b2c812e2SMark Brown }
918b2c812e2SMark Brown 
9194e10bda0SVinod Koul static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
9204e10bda0SVinod Koul {
9214e10bda0SVinod Koul 	INIT_LIST_HEAD(&card->dai_dev_list);
9224e10bda0SVinod Koul 	INIT_LIST_HEAD(&card->codec_dev_list);
9234e10bda0SVinod Koul 	INIT_LIST_HEAD(&card->platform_dev_list);
9244e10bda0SVinod Koul 	INIT_LIST_HEAD(&card->widgets);
9254e10bda0SVinod Koul 	INIT_LIST_HEAD(&card->paths);
9264e10bda0SVinod Koul 	INIT_LIST_HEAD(&card->dapm_list);
9274e10bda0SVinod Koul }
9284e10bda0SVinod Koul 
929fb257897SMark Brown int snd_soc_util_init(void);
930fb257897SMark Brown void snd_soc_util_exit(void);
931fb257897SMark Brown 
932a47cbe72SMark Brown #include <sound/soc-dai.h>
933a47cbe72SMark Brown 
934faff4bb0SStephen Warren #ifdef CONFIG_DEBUG_FS
9358a9dab1aSMark Brown extern struct dentry *snd_soc_debugfs_root;
936faff4bb0SStephen Warren #endif
937faff4bb0SStephen Warren 
9386f8ab4acSMark Brown extern const struct dev_pm_ops snd_soc_pm_ops;
9396f8ab4acSMark Brown 
940808db4a4SRichard Purdie #endif
941