xref: /linux/include/sound/soc.h (revision da1c6ea6cf85544292c30295c70a89e8555358bc)
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>
22be3ea3b9SMark Brown #include <linux/regmap.h>
23808db4a4SRichard Purdie #include <sound/core.h>
24808db4a4SRichard Purdie #include <sound/pcm.h>
25808db4a4SRichard Purdie #include <sound/control.h>
26808db4a4SRichard Purdie #include <sound/ac97_codec.h>
27808db4a4SRichard Purdie 
28808db4a4SRichard Purdie /*
29808db4a4SRichard Purdie  * Convenience kcontrol builders
30808db4a4SRichard Purdie  */
314eaa9819SJon Smirl #define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) \
324eaa9819SJon Smirl 	((unsigned long)&(struct soc_mixer_control) \
33762b8df7SMark Brown 	{.reg = xreg, .shift = xshift, .rshift = xshift, .max = xmax, \
34d11bb4a9SPeter Ujfalusi 	.platform_max = xmax, .invert = xinvert})
354eaa9819SJon Smirl #define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \
364eaa9819SJon Smirl 	((unsigned long)&(struct soc_mixer_control) \
37d11bb4a9SPeter Ujfalusi 	{.reg = xreg, .max = xmax, .platform_max = xmax, .invert = xinvert})
38a7a4ac86SPhilipp Zabel #define SOC_SINGLE(xname, reg, shift, max, invert) \
39808db4a4SRichard Purdie {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
40808db4a4SRichard Purdie 	.info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
41808db4a4SRichard Purdie 	.put = snd_soc_put_volsw, \
42a7a4ac86SPhilipp Zabel 	.private_value =  SOC_SINGLE_VALUE(reg, shift, max, invert) }
43a7a4ac86SPhilipp Zabel #define SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
44a7a4ac86SPhilipp Zabel {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
45a7a4ac86SPhilipp Zabel 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
46a7a4ac86SPhilipp Zabel 		 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
47a7a4ac86SPhilipp Zabel 	.tlv.p = (tlv_array), \
48a7a4ac86SPhilipp Zabel 	.info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
49a7a4ac86SPhilipp Zabel 	.put = snd_soc_put_volsw, \
50a7a4ac86SPhilipp Zabel 	.private_value =  SOC_SINGLE_VALUE(reg, shift, max, invert) }
514eaa9819SJon Smirl #define SOC_DOUBLE(xname, xreg, shift_left, shift_right, xmax, xinvert) \
52808db4a4SRichard Purdie {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
53808db4a4SRichard Purdie 	.info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
54808db4a4SRichard Purdie 	.put = snd_soc_put_volsw, \
554eaa9819SJon Smirl 	.private_value = (unsigned long)&(struct soc_mixer_control) \
564eaa9819SJon Smirl 		{.reg = xreg, .shift = shift_left, .rshift = shift_right, \
57d11bb4a9SPeter Ujfalusi 		 .max = xmax, .platform_max = xmax, .invert = xinvert} }
584eaa9819SJon Smirl #define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \
59808db4a4SRichard Purdie {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
60808db4a4SRichard Purdie 	.info = snd_soc_info_volsw_2r, \
61808db4a4SRichard Purdie 	.get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
624eaa9819SJon Smirl 	.private_value = (unsigned long)&(struct soc_mixer_control) \
634eaa9819SJon Smirl 		{.reg = reg_left, .rreg = reg_right, .shift = xshift, \
64d11bb4a9SPeter Ujfalusi 		.max = xmax, .platform_max = xmax, .invert = xinvert} }
654eaa9819SJon Smirl #define SOC_DOUBLE_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert, tlv_array) \
66a7a4ac86SPhilipp Zabel {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
67a7a4ac86SPhilipp Zabel 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
68a7a4ac86SPhilipp Zabel 		 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
69a7a4ac86SPhilipp Zabel 	.tlv.p = (tlv_array), \
70a7a4ac86SPhilipp Zabel 	.info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
71a7a4ac86SPhilipp Zabel 	.put = snd_soc_put_volsw, \
724eaa9819SJon Smirl 	.private_value = (unsigned long)&(struct soc_mixer_control) \
734eaa9819SJon Smirl 		{.reg = xreg, .shift = shift_left, .rshift = shift_right,\
74d11bb4a9SPeter Ujfalusi 		 .max = xmax, .platform_max = xmax, .invert = xinvert} }
754eaa9819SJon Smirl #define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \
76a7a4ac86SPhilipp Zabel {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
77a7a4ac86SPhilipp Zabel 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
78a7a4ac86SPhilipp Zabel 		 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
79a7a4ac86SPhilipp Zabel 	.tlv.p = (tlv_array), \
80a7a4ac86SPhilipp Zabel 	.info = snd_soc_info_volsw_2r, \
81a7a4ac86SPhilipp Zabel 	.get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
824eaa9819SJon Smirl 	.private_value = (unsigned long)&(struct soc_mixer_control) \
834eaa9819SJon Smirl 		{.reg = reg_left, .rreg = reg_right, .shift = xshift, \
84d11bb4a9SPeter Ujfalusi 		.max = xmax, .platform_max = xmax, .invert = xinvert} }
854eaa9819SJon Smirl #define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
86e13ac2e9SMark Brown {	.iface  = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
87e13ac2e9SMark Brown 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
88e13ac2e9SMark Brown 		  SNDRV_CTL_ELEM_ACCESS_READWRITE, \
89e13ac2e9SMark Brown 	.tlv.p  = (tlv_array), \
90e13ac2e9SMark Brown 	.info   = snd_soc_info_volsw_s8, .get = snd_soc_get_volsw_s8, \
91e13ac2e9SMark Brown 	.put    = snd_soc_put_volsw_s8, \
924eaa9819SJon Smirl 	.private_value = (unsigned long)&(struct soc_mixer_control) \
93d11bb4a9SPeter Ujfalusi 		{.reg = xreg, .min = xmin, .max = xmax, \
94d11bb4a9SPeter Ujfalusi 		 .platform_max = xmax} }
95f8ba0b7bSJon Smirl #define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmax, xtexts) \
96808db4a4SRichard Purdie {	.reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
97f8ba0b7bSJon Smirl 	.max = xmax, .texts = xtexts }
98f8ba0b7bSJon Smirl #define SOC_ENUM_SINGLE(xreg, xshift, xmax, xtexts) \
99f8ba0b7bSJon Smirl 	SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmax, xtexts)
100f8ba0b7bSJon Smirl #define SOC_ENUM_SINGLE_EXT(xmax, xtexts) \
101f8ba0b7bSJon Smirl {	.max = xmax, .texts = xtexts }
1022e72f8e3SPeter Ujfalusi #define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xmax, xtexts, xvalues) \
1032e72f8e3SPeter Ujfalusi {	.reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
1042e72f8e3SPeter Ujfalusi 	.mask = xmask, .max = xmax, .texts = xtexts, .values = xvalues}
1052e72f8e3SPeter Ujfalusi #define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xmax, xtexts, xvalues) \
1062e72f8e3SPeter Ujfalusi 	SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xmax, xtexts, xvalues)
107808db4a4SRichard Purdie #define SOC_ENUM(xname, xenum) \
108808db4a4SRichard Purdie {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
109808db4a4SRichard Purdie 	.info = snd_soc_info_enum_double, \
110808db4a4SRichard Purdie 	.get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \
111808db4a4SRichard Purdie 	.private_value = (unsigned long)&xenum }
1122e72f8e3SPeter Ujfalusi #define SOC_VALUE_ENUM(xname, xenum) \
1132e72f8e3SPeter Ujfalusi {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
11474155556SPeter Ujfalusi 	.info = snd_soc_info_enum_double, \
1152e72f8e3SPeter Ujfalusi 	.get = snd_soc_get_value_enum_double, \
1162e72f8e3SPeter Ujfalusi 	.put = snd_soc_put_value_enum_double, \
1172e72f8e3SPeter Ujfalusi 	.private_value = (unsigned long)&xenum }
118f8ba0b7bSJon Smirl #define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\
119808db4a4SRichard Purdie 	 xhandler_get, xhandler_put) \
120808db4a4SRichard Purdie {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
1211c433fbdSGraeme Gregory 	.info = snd_soc_info_volsw, \
122808db4a4SRichard Purdie 	.get = xhandler_get, .put = xhandler_put, \
123f8ba0b7bSJon Smirl 	.private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) }
1247629ad24SDaniel Mack #define SOC_DOUBLE_EXT(xname, xreg, shift_left, shift_right, xmax, xinvert,\
1257629ad24SDaniel Mack 	 xhandler_get, xhandler_put) \
1267629ad24SDaniel Mack {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
1277629ad24SDaniel Mack 	.info = snd_soc_info_volsw, \
1287629ad24SDaniel Mack 	.get = xhandler_get, .put = xhandler_put, \
1297629ad24SDaniel Mack 	.private_value = (unsigned long)&(struct soc_mixer_control) \
1307629ad24SDaniel Mack 		{.reg = xreg, .shift = shift_left, .rshift = shift_right, \
131d11bb4a9SPeter Ujfalusi 		 .max = xmax, .platform_max = xmax, .invert = xinvert} }
132f8ba0b7bSJon Smirl #define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\
13310144c09SMike Montour 	 xhandler_get, xhandler_put, tlv_array) \
13410144c09SMike Montour {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
13510144c09SMike Montour 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
13610144c09SMike Montour 		 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
13710144c09SMike Montour 	.tlv.p = (tlv_array), \
13810144c09SMike Montour 	.info = snd_soc_info_volsw, \
13910144c09SMike Montour 	.get = xhandler_get, .put = xhandler_put, \
140f8ba0b7bSJon Smirl 	.private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) }
141d0af93dbSJoonyoung Shim #define SOC_DOUBLE_EXT_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert,\
142d0af93dbSJoonyoung Shim 	 xhandler_get, xhandler_put, tlv_array) \
143d0af93dbSJoonyoung Shim {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
144d0af93dbSJoonyoung Shim 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
145d0af93dbSJoonyoung Shim 		 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
146d0af93dbSJoonyoung Shim 	.tlv.p = (tlv_array), \
147d0af93dbSJoonyoung Shim 	.info = snd_soc_info_volsw, \
148d0af93dbSJoonyoung Shim 	.get = xhandler_get, .put = xhandler_put, \
149d0af93dbSJoonyoung Shim 	.private_value = (unsigned long)&(struct soc_mixer_control) \
150d0af93dbSJoonyoung Shim 		{.reg = xreg, .shift = shift_left, .rshift = shift_right, \
151d11bb4a9SPeter Ujfalusi 		.max = xmax, .platform_max = xmax, .invert = xinvert} }
1523ce91d5aSJoonyoung Shim #define SOC_DOUBLE_R_EXT_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert,\
1533ce91d5aSJoonyoung Shim 	 xhandler_get, xhandler_put, tlv_array) \
1543ce91d5aSJoonyoung Shim {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
1553ce91d5aSJoonyoung Shim 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1563ce91d5aSJoonyoung Shim 		 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1573ce91d5aSJoonyoung Shim 	.tlv.p = (tlv_array), \
1583ce91d5aSJoonyoung Shim 	.info = snd_soc_info_volsw_2r, \
1593ce91d5aSJoonyoung Shim 	.get = xhandler_get, .put = xhandler_put, \
1603ce91d5aSJoonyoung Shim 	.private_value = (unsigned long)&(struct soc_mixer_control) \
1613ce91d5aSJoonyoung Shim 		{.reg = reg_left, .rreg = reg_right, .shift = xshift, \
162d11bb4a9SPeter Ujfalusi 		.max = xmax, .platform_max = xmax, .invert = xinvert} }
163808db4a4SRichard Purdie #define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \
164808db4a4SRichard Purdie {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
165808db4a4SRichard Purdie 	.info = snd_soc_info_bool_ext, \
166808db4a4SRichard Purdie 	.get = xhandler_get, .put = xhandler_put, \
167808db4a4SRichard Purdie 	.private_value = xdata }
168808db4a4SRichard Purdie #define SOC_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) \
169808db4a4SRichard Purdie {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
170808db4a4SRichard Purdie 	.info = snd_soc_info_enum_ext, \
171808db4a4SRichard Purdie 	.get = xhandler_get, .put = xhandler_put, \
172808db4a4SRichard Purdie 	.private_value = (unsigned long)&xenum }
173808db4a4SRichard Purdie 
174b6f4bb38Sapatard@mandriva.com #define SOC_DOUBLE_R_SX_TLV(xname, xreg_left, xreg_right, xshift,\
175b6f4bb38Sapatard@mandriva.com 		xmin, xmax, tlv_array) \
176b6f4bb38Sapatard@mandriva.com {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
177b6f4bb38Sapatard@mandriva.com 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
178b6f4bb38Sapatard@mandriva.com 		  SNDRV_CTL_ELEM_ACCESS_READWRITE, \
179b6f4bb38Sapatard@mandriva.com 	.tlv.p = (tlv_array), \
180b6f4bb38Sapatard@mandriva.com 	.info = snd_soc_info_volsw_2r_sx, \
181b6f4bb38Sapatard@mandriva.com 	.get = snd_soc_get_volsw_2r_sx, \
182b6f4bb38Sapatard@mandriva.com 	.put = snd_soc_put_volsw_2r_sx, \
183b6f4bb38Sapatard@mandriva.com 	.private_value = (unsigned long)&(struct soc_mixer_control) \
184b6f4bb38Sapatard@mandriva.com 		{.reg = xreg_left, \
185b6f4bb38Sapatard@mandriva.com 		 .rreg = xreg_right, .shift = xshift, \
186b6f4bb38Sapatard@mandriva.com 		 .min = xmin, .max = xmax} }
187b6f4bb38Sapatard@mandriva.com 
188b6f4bb38Sapatard@mandriva.com 
189808db4a4SRichard Purdie /*
1906c2fb6a8SGuennadi Liakhovetski  * Simplified versions of above macros, declaring a struct and calculating
1916c2fb6a8SGuennadi Liakhovetski  * ARRAY_SIZE internally
1926c2fb6a8SGuennadi Liakhovetski  */
1936c2fb6a8SGuennadi Liakhovetski #define SOC_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xtexts) \
1946c2fb6a8SGuennadi Liakhovetski 	struct soc_enum name = SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, \
1956c2fb6a8SGuennadi Liakhovetski 						ARRAY_SIZE(xtexts), xtexts)
1966c2fb6a8SGuennadi Liakhovetski #define SOC_ENUM_SINGLE_DECL(name, xreg, xshift, xtexts) \
1976c2fb6a8SGuennadi Liakhovetski 	SOC_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xtexts)
1986c2fb6a8SGuennadi Liakhovetski #define SOC_ENUM_SINGLE_EXT_DECL(name, xtexts) \
1996c2fb6a8SGuennadi Liakhovetski 	struct soc_enum name = SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(xtexts), xtexts)
2006c2fb6a8SGuennadi Liakhovetski #define SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xmask, xtexts, xvalues) \
2016c2fb6a8SGuennadi Liakhovetski 	struct soc_enum name = SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, \
2026c2fb6a8SGuennadi Liakhovetski 							ARRAY_SIZE(xtexts), xtexts, xvalues)
2036c2fb6a8SGuennadi Liakhovetski #define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \
2046c2fb6a8SGuennadi Liakhovetski 	SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues)
2056c2fb6a8SGuennadi Liakhovetski 
2066c2fb6a8SGuennadi Liakhovetski /*
2070168bf0dSLiam Girdwood  * Component probe and remove ordering levels for components with runtime
2080168bf0dSLiam Girdwood  * dependencies.
2090168bf0dSLiam Girdwood  */
2100168bf0dSLiam Girdwood #define SND_SOC_COMP_ORDER_FIRST		-2
2110168bf0dSLiam Girdwood #define SND_SOC_COMP_ORDER_EARLY		-1
2120168bf0dSLiam Girdwood #define SND_SOC_COMP_ORDER_NORMAL		0
2130168bf0dSLiam Girdwood #define SND_SOC_COMP_ORDER_LATE		1
2140168bf0dSLiam Girdwood #define SND_SOC_COMP_ORDER_LAST		2
2150168bf0dSLiam Girdwood 
2160168bf0dSLiam Girdwood /*
2170be9898aSMark Brown  * Bias levels
2180be9898aSMark Brown  *
2190be9898aSMark Brown  * @ON:      Bias is fully on for audio playback and capture operations.
2200be9898aSMark Brown  * @PREPARE: Prepare for audio operations. Called before DAPM switching for
2210be9898aSMark Brown  *           stream start and stop operations.
2220be9898aSMark Brown  * @STANDBY: Low power standby state when no playback/capture operations are
2230be9898aSMark Brown  *           in progress. NOTE: The transition time between STANDBY and ON
2240be9898aSMark Brown  *           should be as fast as possible and no longer than 10ms.
2250be9898aSMark Brown  * @OFF:     Power Off. No restrictions on transition times.
2260be9898aSMark Brown  */
2270be9898aSMark Brown enum snd_soc_bias_level {
22856fba41fSMark Brown 	SND_SOC_BIAS_OFF = 0,
22956fba41fSMark Brown 	SND_SOC_BIAS_STANDBY = 1,
23056fba41fSMark Brown 	SND_SOC_BIAS_PREPARE = 2,
23156fba41fSMark Brown 	SND_SOC_BIAS_ON = 3,
2320be9898aSMark Brown };
2330be9898aSMark Brown 
2348a2cd618SMark Brown struct snd_jack;
2358a2cd618SMark Brown struct snd_soc_card;
236808db4a4SRichard Purdie struct snd_soc_pcm_stream;
237808db4a4SRichard Purdie struct snd_soc_ops;
238808db4a4SRichard Purdie struct snd_soc_pcm_runtime;
2393c4b266fSLiam Girdwood struct snd_soc_dai;
240f0fba2adSLiam Girdwood struct snd_soc_dai_driver;
24112a48a8cSMark Brown struct snd_soc_platform;
242d273ebe7Sjassi brar struct snd_soc_dai_link;
243f0fba2adSLiam Girdwood struct snd_soc_platform_driver;
244808db4a4SRichard Purdie struct snd_soc_codec;
245f0fba2adSLiam Girdwood struct snd_soc_codec_driver;
246808db4a4SRichard Purdie struct soc_enum;
2478a2cd618SMark Brown struct snd_soc_jack;
248fa9879edSVinod Koul struct snd_soc_jack_zone;
2498a2cd618SMark Brown struct snd_soc_jack_pin;
2507a30a3dbSDimitris Papastamos struct snd_soc_cache_ops;
251ce6120ccSLiam Girdwood #include <sound/soc-dapm.h>
252f0fba2adSLiam Girdwood 
253ec67624dSLopez Cruz, Misael #ifdef CONFIG_GPIOLIB
254ec67624dSLopez Cruz, Misael struct snd_soc_jack_gpio;
255ec67624dSLopez Cruz, Misael #endif
256808db4a4SRichard Purdie 
257808db4a4SRichard Purdie typedef int (*hw_write_t)(void *,const char* ,int);
258808db4a4SRichard Purdie 
259808db4a4SRichard Purdie extern struct snd_ac97_bus_ops soc_ac97_ops;
260808db4a4SRichard Purdie 
2617084a42bSMark Brown enum snd_soc_control_type {
262e9c03905SMark Brown 	SND_SOC_I2C = 1,
2637084a42bSMark Brown 	SND_SOC_SPI,
2640671da18SMark Brown 	SND_SOC_REGMAP,
2657084a42bSMark Brown };
2667084a42bSMark Brown 
2677a30a3dbSDimitris Papastamos enum snd_soc_compress_type {
268119bd789SDimitris Papastamos 	SND_SOC_FLAT_COMPRESSION = 1,
269a7f387d5SDimitris Papastamos 	SND_SOC_LZO_COMPRESSION,
270a7f387d5SDimitris Papastamos 	SND_SOC_RBTREE_COMPRESSION
2717a30a3dbSDimitris Papastamos };
2727a30a3dbSDimitris Papastamos 
273b8c0dab9SLiam Girdwood enum snd_soc_pcm_subclass {
274b8c0dab9SLiam Girdwood 	SND_SOC_PCM_CLASS_PCM	= 0,
275b8c0dab9SLiam Girdwood 	SND_SOC_PCM_CLASS_BE	= 1,
276b8c0dab9SLiam Girdwood };
277b8c0dab9SLiam Girdwood 
278ec4ee52aSMark Brown int snd_soc_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id,
279*da1c6ea6SMark Brown 			     int source, unsigned int freq, int dir);
280ec4ee52aSMark Brown int snd_soc_codec_set_pll(struct snd_soc_codec *codec, int pll_id, int source,
281ec4ee52aSMark Brown 			  unsigned int freq_in, unsigned int freq_out);
282ec4ee52aSMark Brown 
28370a7ca34SVinod Koul int snd_soc_register_card(struct snd_soc_card *card);
28470a7ca34SVinod Koul int snd_soc_unregister_card(struct snd_soc_card *card);
2856f8ab4acSMark Brown int snd_soc_suspend(struct device *dev);
2866f8ab4acSMark Brown int snd_soc_resume(struct device *dev);
2876f8ab4acSMark Brown int snd_soc_poweroff(struct device *dev);
288f0fba2adSLiam Girdwood int snd_soc_register_platform(struct device *dev,
289f0fba2adSLiam Girdwood 		struct snd_soc_platform_driver *platform_drv);
290f0fba2adSLiam Girdwood void snd_soc_unregister_platform(struct device *dev);
291f0fba2adSLiam Girdwood int snd_soc_register_codec(struct device *dev,
292001ae4c0SMark Brown 		const struct snd_soc_codec_driver *codec_drv,
293f0fba2adSLiam Girdwood 		struct snd_soc_dai_driver *dai_drv, int num_dai);
294f0fba2adSLiam Girdwood void snd_soc_unregister_codec(struct device *dev);
295181e055eSMark Brown int snd_soc_codec_volatile_register(struct snd_soc_codec *codec,
296181e055eSMark Brown 				    unsigned int reg);
297239c9706SDimitris Papastamos int snd_soc_codec_readable_register(struct snd_soc_codec *codec,
298239c9706SDimitris Papastamos 				    unsigned int reg);
299239c9706SDimitris Papastamos int snd_soc_codec_writable_register(struct snd_soc_codec *codec,
300239c9706SDimitris Papastamos 				    unsigned int reg);
30117a52fd6SMark Brown int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
3027084a42bSMark Brown 			       int addr_bits, int data_bits,
3037084a42bSMark Brown 			       enum snd_soc_control_type control);
3047a30a3dbSDimitris Papastamos int snd_soc_cache_sync(struct snd_soc_codec *codec);
3057a30a3dbSDimitris Papastamos int snd_soc_cache_init(struct snd_soc_codec *codec);
3067a30a3dbSDimitris Papastamos int snd_soc_cache_exit(struct snd_soc_codec *codec);
3077a30a3dbSDimitris Papastamos int snd_soc_cache_write(struct snd_soc_codec *codec,
3087a30a3dbSDimitris Papastamos 			unsigned int reg, unsigned int value);
3097a30a3dbSDimitris Papastamos int snd_soc_cache_read(struct snd_soc_codec *codec,
3107a30a3dbSDimitris Papastamos 		       unsigned int reg, unsigned int *value);
311066d16c3SDimitris Papastamos int snd_soc_default_volatile_register(struct snd_soc_codec *codec,
312066d16c3SDimitris Papastamos 				      unsigned int reg);
313066d16c3SDimitris Papastamos int snd_soc_default_readable_register(struct snd_soc_codec *codec,
314066d16c3SDimitris Papastamos 				      unsigned int reg);
3158020454cSDimitris Papastamos int snd_soc_default_writable_register(struct snd_soc_codec *codec,
3168020454cSDimitris Papastamos 				      unsigned int reg);
317f1442bc1SLiam Girdwood int snd_soc_platform_read(struct snd_soc_platform *platform,
318f1442bc1SLiam Girdwood 					unsigned int reg);
319f1442bc1SLiam Girdwood int snd_soc_platform_write(struct snd_soc_platform *platform,
320f1442bc1SLiam Girdwood 					unsigned int reg, unsigned int val);
32112a48a8cSMark Brown 
3227aae816dSMark Brown /* Utility functions to get clock rates from various things */
3237aae816dSMark Brown int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots);
3247aae816dSMark Brown int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params);
325c0fa59dfSMark Brown int snd_soc_calc_bclk(int fs, int sample_size, int channels, int tdm_slots);
3267aae816dSMark Brown int snd_soc_params_to_bclk(struct snd_pcm_hw_params *parms);
3277aae816dSMark Brown 
328808db4a4SRichard Purdie /* set runtime hw params */
329808db4a4SRichard Purdie int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
330808db4a4SRichard Purdie 	const struct snd_pcm_hardware *hw);
331808db4a4SRichard Purdie 
3328a2cd618SMark Brown /* Jack reporting */
333f0fba2adSLiam Girdwood int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type,
3348a2cd618SMark Brown 		     struct snd_soc_jack *jack);
3358a2cd618SMark Brown void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask);
3368a2cd618SMark Brown int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
3378a2cd618SMark Brown 			  struct snd_soc_jack_pin *pins);
338d5021ec9SMark Brown void snd_soc_jack_notifier_register(struct snd_soc_jack *jack,
339d5021ec9SMark Brown 				    struct notifier_block *nb);
340d5021ec9SMark Brown void snd_soc_jack_notifier_unregister(struct snd_soc_jack *jack,
341d5021ec9SMark Brown 				      struct notifier_block *nb);
342fa9879edSVinod Koul int snd_soc_jack_add_zones(struct snd_soc_jack *jack, int count,
343fa9879edSVinod Koul 			  struct snd_soc_jack_zone *zones);
344fa9879edSVinod Koul int snd_soc_jack_get_type(struct snd_soc_jack *jack, int micbias_voltage);
345ec67624dSLopez Cruz, Misael #ifdef CONFIG_GPIOLIB
346ec67624dSLopez Cruz, Misael int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
347ec67624dSLopez Cruz, Misael 			struct snd_soc_jack_gpio *gpios);
348ec67624dSLopez Cruz, Misael void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
349ec67624dSLopez Cruz, Misael 			struct snd_soc_jack_gpio *gpios);
350ec67624dSLopez Cruz, Misael #endif
3518a2cd618SMark Brown 
352808db4a4SRichard Purdie /* codec register bit access */
353808db4a4SRichard Purdie int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg,
35446f5822fSDaniel Ribeiro 				unsigned int mask, unsigned int value);
355dd1b3d53SMark Brown int snd_soc_update_bits_locked(struct snd_soc_codec *codec,
356dd1b3d53SMark Brown 			       unsigned short reg, unsigned int mask,
357dd1b3d53SMark Brown 			       unsigned int value);
358808db4a4SRichard Purdie int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg,
35946f5822fSDaniel Ribeiro 				unsigned int mask, unsigned int value);
360808db4a4SRichard Purdie 
361808db4a4SRichard Purdie int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
362808db4a4SRichard Purdie 	struct snd_ac97_bus_ops *ops, int num);
363808db4a4SRichard Purdie void snd_soc_free_ac97_codec(struct snd_soc_codec *codec);
364808db4a4SRichard Purdie 
365808db4a4SRichard Purdie /*
366808db4a4SRichard Purdie  *Controls
367808db4a4SRichard Purdie  */
368808db4a4SRichard Purdie struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
369efb7ac3fSMark Brown 				  void *data, char *long_name,
370efb7ac3fSMark Brown 				  const char *prefix);
3713e8e1952SIan Molton int snd_soc_add_controls(struct snd_soc_codec *codec,
3723e8e1952SIan Molton 	const struct snd_kcontrol_new *controls, int num_controls);
373a491a5c8SLiam Girdwood int snd_soc_add_platform_controls(struct snd_soc_platform *platform,
374a491a5c8SLiam Girdwood 	const struct snd_kcontrol_new *controls, int num_controls);
375808db4a4SRichard Purdie int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
376808db4a4SRichard Purdie 	struct snd_ctl_elem_info *uinfo);
377808db4a4SRichard Purdie int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol,
378808db4a4SRichard Purdie 	struct snd_ctl_elem_info *uinfo);
379808db4a4SRichard Purdie int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol,
380808db4a4SRichard Purdie 	struct snd_ctl_elem_value *ucontrol);
381808db4a4SRichard Purdie int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol,
382808db4a4SRichard Purdie 	struct snd_ctl_elem_value *ucontrol);
3832e72f8e3SPeter Ujfalusi int snd_soc_get_value_enum_double(struct snd_kcontrol *kcontrol,
3842e72f8e3SPeter Ujfalusi 	struct snd_ctl_elem_value *ucontrol);
3852e72f8e3SPeter Ujfalusi int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol,
3862e72f8e3SPeter Ujfalusi 	struct snd_ctl_elem_value *ucontrol);
387808db4a4SRichard Purdie int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
388808db4a4SRichard Purdie 	struct snd_ctl_elem_info *uinfo);
389808db4a4SRichard Purdie int snd_soc_info_volsw_ext(struct snd_kcontrol *kcontrol,
390808db4a4SRichard Purdie 	struct snd_ctl_elem_info *uinfo);
391392abe9cSPhilipp Zabel #define snd_soc_info_bool_ext		snd_ctl_boolean_mono_info
392808db4a4SRichard Purdie int snd_soc_get_volsw(struct snd_kcontrol *kcontrol,
393808db4a4SRichard Purdie 	struct snd_ctl_elem_value *ucontrol);
394808db4a4SRichard Purdie int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
395808db4a4SRichard Purdie 	struct snd_ctl_elem_value *ucontrol);
396808db4a4SRichard Purdie int snd_soc_info_volsw_2r(struct snd_kcontrol *kcontrol,
397808db4a4SRichard Purdie 	struct snd_ctl_elem_info *uinfo);
398808db4a4SRichard Purdie int snd_soc_get_volsw_2r(struct snd_kcontrol *kcontrol,
399808db4a4SRichard Purdie 	struct snd_ctl_elem_value *ucontrol);
400808db4a4SRichard Purdie int snd_soc_put_volsw_2r(struct snd_kcontrol *kcontrol,
401808db4a4SRichard Purdie 	struct snd_ctl_elem_value *ucontrol);
402e13ac2e9SMark Brown int snd_soc_info_volsw_s8(struct snd_kcontrol *kcontrol,
403e13ac2e9SMark Brown 	struct snd_ctl_elem_info *uinfo);
404e13ac2e9SMark Brown int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol,
405e13ac2e9SMark Brown 	struct snd_ctl_elem_value *ucontrol);
406e13ac2e9SMark Brown int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
407e13ac2e9SMark Brown 	struct snd_ctl_elem_value *ucontrol);
408637d3847SPeter Ujfalusi int snd_soc_limit_volume(struct snd_soc_codec *codec,
409637d3847SPeter Ujfalusi 	const char *name, int max);
410b6f4bb38Sapatard@mandriva.com int snd_soc_info_volsw_2r_sx(struct snd_kcontrol *kcontrol,
411b6f4bb38Sapatard@mandriva.com 	struct snd_ctl_elem_info *uinfo);
412b6f4bb38Sapatard@mandriva.com int snd_soc_get_volsw_2r_sx(struct snd_kcontrol *kcontrol,
413b6f4bb38Sapatard@mandriva.com 	struct snd_ctl_elem_value *ucontrol);
414b6f4bb38Sapatard@mandriva.com int snd_soc_put_volsw_2r_sx(struct snd_kcontrol *kcontrol,
415b6f4bb38Sapatard@mandriva.com 	struct snd_ctl_elem_value *ucontrol);
416808db4a4SRichard Purdie 
4178a2cd618SMark Brown /**
418066d16c3SDimitris Papastamos  * struct snd_soc_reg_access - Describes whether a given register is
419066d16c3SDimitris Papastamos  * readable, writable or volatile.
420066d16c3SDimitris Papastamos  *
421066d16c3SDimitris Papastamos  * @reg: the register number
422066d16c3SDimitris Papastamos  * @read: whether this register is readable
423066d16c3SDimitris Papastamos  * @write: whether this register is writable
424066d16c3SDimitris Papastamos  * @vol: whether this register is volatile
425066d16c3SDimitris Papastamos  */
426066d16c3SDimitris Papastamos struct snd_soc_reg_access {
427066d16c3SDimitris Papastamos 	u16 reg;
428066d16c3SDimitris Papastamos 	u16 read;
429066d16c3SDimitris Papastamos 	u16 write;
430066d16c3SDimitris Papastamos 	u16 vol;
431066d16c3SDimitris Papastamos };
432066d16c3SDimitris Papastamos 
433066d16c3SDimitris Papastamos /**
4348a2cd618SMark Brown  * struct snd_soc_jack_pin - Describes a pin to update based on jack detection
4358a2cd618SMark Brown  *
4368a2cd618SMark Brown  * @pin:    name of the pin to update
4378a2cd618SMark Brown  * @mask:   bits to check for in reported jack status
4388a2cd618SMark Brown  * @invert: if non-zero then pin is enabled when status is not reported
4398a2cd618SMark Brown  */
4408a2cd618SMark Brown struct snd_soc_jack_pin {
4418a2cd618SMark Brown 	struct list_head list;
4428a2cd618SMark Brown 	const char *pin;
4438a2cd618SMark Brown 	int mask;
4448a2cd618SMark Brown 	bool invert;
4458a2cd618SMark Brown };
4468a2cd618SMark Brown 
447ec67624dSLopez Cruz, Misael /**
448fa9879edSVinod Koul  * struct snd_soc_jack_zone - Describes voltage zones of jack detection
449fa9879edSVinod Koul  *
450fa9879edSVinod Koul  * @min_mv: start voltage in mv
451fa9879edSVinod Koul  * @max_mv: end voltage in mv
452fa9879edSVinod Koul  * @jack_type: type of jack that is expected for this voltage
453fa9879edSVinod Koul  * @debounce_time: debounce_time for jack, codec driver should wait for this
454fa9879edSVinod Koul  *		duration before reading the adc for voltages
455fa9879edSVinod Koul  * @:list: list container
456fa9879edSVinod Koul  */
457fa9879edSVinod Koul struct snd_soc_jack_zone {
458fa9879edSVinod Koul 	unsigned int min_mv;
459fa9879edSVinod Koul 	unsigned int max_mv;
460fa9879edSVinod Koul 	unsigned int jack_type;
461fa9879edSVinod Koul 	unsigned int debounce_time;
462fa9879edSVinod Koul 	struct list_head list;
463fa9879edSVinod Koul };
464fa9879edSVinod Koul 
465fa9879edSVinod Koul /**
466ec67624dSLopez Cruz, Misael  * struct snd_soc_jack_gpio - Describes a gpio pin for jack detection
467ec67624dSLopez Cruz, Misael  *
468ec67624dSLopez Cruz, Misael  * @gpio:         gpio number
469ec67624dSLopez Cruz, Misael  * @name:         gpio name
470ec67624dSLopez Cruz, Misael  * @report:       value to report when jack detected
471ec67624dSLopez Cruz, Misael  * @invert:       report presence in low state
472ec67624dSLopez Cruz, Misael  * @debouce_time: debouce time in ms
4737887ab3aSMark Brown  * @wake:	  enable as wake source
474fadddc87SMark Brown  * @jack_status_check: callback function which overrides the detection
475fadddc87SMark Brown  *		       to provide more complex checks (eg, reading an
476fadddc87SMark Brown  *		       ADC).
477ec67624dSLopez Cruz, Misael  */
478ec67624dSLopez Cruz, Misael #ifdef CONFIG_GPIOLIB
479ec67624dSLopez Cruz, Misael struct snd_soc_jack_gpio {
480ec67624dSLopez Cruz, Misael 	unsigned int gpio;
481ec67624dSLopez Cruz, Misael 	const char *name;
482ec67624dSLopez Cruz, Misael 	int report;
483ec67624dSLopez Cruz, Misael 	int invert;
484ec67624dSLopez Cruz, Misael 	int debounce_time;
4857887ab3aSMark Brown 	bool wake;
4867887ab3aSMark Brown 
487ec67624dSLopez Cruz, Misael 	struct snd_soc_jack *jack;
4884c14d78eSMark Brown 	struct delayed_work work;
489c871a053SJoonyoung Shim 
490c871a053SJoonyoung Shim 	int (*jack_status_check)(void);
491ec67624dSLopez Cruz, Misael };
492ec67624dSLopez Cruz, Misael #endif
493ec67624dSLopez Cruz, Misael 
4948a2cd618SMark Brown struct snd_soc_jack {
4958a2cd618SMark Brown 	struct snd_jack *jack;
496f0fba2adSLiam Girdwood 	struct snd_soc_codec *codec;
4978a2cd618SMark Brown 	struct list_head pins;
4988a2cd618SMark Brown 	int status;
499d5021ec9SMark Brown 	struct blocking_notifier_head notifier;
500fa9879edSVinod Koul 	struct list_head jack_zones;
5018a2cd618SMark Brown };
5028a2cd618SMark Brown 
503808db4a4SRichard Purdie /* SoC PCM stream information */
504808db4a4SRichard Purdie struct snd_soc_pcm_stream {
505f0fba2adSLiam Girdwood 	const char *stream_name;
5061c433fbdSGraeme Gregory 	u64 formats;			/* SNDRV_PCM_FMTBIT_* */
5071c433fbdSGraeme Gregory 	unsigned int rates;		/* SNDRV_PCM_RATE_* */
508808db4a4SRichard Purdie 	unsigned int rate_min;		/* min rate */
509808db4a4SRichard Purdie 	unsigned int rate_max;		/* max rate */
510808db4a4SRichard Purdie 	unsigned int channels_min;	/* min channels */
511808db4a4SRichard Purdie 	unsigned int channels_max;	/* max channels */
512808db4a4SRichard Purdie };
513808db4a4SRichard Purdie 
514808db4a4SRichard Purdie /* SoC audio ops */
515808db4a4SRichard Purdie struct snd_soc_ops {
516808db4a4SRichard Purdie 	int (*startup)(struct snd_pcm_substream *);
517808db4a4SRichard Purdie 	void (*shutdown)(struct snd_pcm_substream *);
518808db4a4SRichard Purdie 	int (*hw_params)(struct snd_pcm_substream *, struct snd_pcm_hw_params *);
519808db4a4SRichard Purdie 	int (*hw_free)(struct snd_pcm_substream *);
520808db4a4SRichard Purdie 	int (*prepare)(struct snd_pcm_substream *);
521808db4a4SRichard Purdie 	int (*trigger)(struct snd_pcm_substream *, int);
522808db4a4SRichard Purdie };
523808db4a4SRichard Purdie 
5247a30a3dbSDimitris Papastamos /* SoC cache ops */
5257a30a3dbSDimitris Papastamos struct snd_soc_cache_ops {
5260d735eaaSDimitris Papastamos 	const char *name;
5277a30a3dbSDimitris Papastamos 	enum snd_soc_compress_type id;
5287a30a3dbSDimitris Papastamos 	int (*init)(struct snd_soc_codec *codec);
5297a30a3dbSDimitris Papastamos 	int (*exit)(struct snd_soc_codec *codec);
5307a30a3dbSDimitris Papastamos 	int (*read)(struct snd_soc_codec *codec, unsigned int reg,
5317a30a3dbSDimitris Papastamos 		unsigned int *value);
5327a30a3dbSDimitris Papastamos 	int (*write)(struct snd_soc_codec *codec, unsigned int reg,
5337a30a3dbSDimitris Papastamos 		unsigned int value);
5347a30a3dbSDimitris Papastamos 	int (*sync)(struct snd_soc_codec *codec);
5357a30a3dbSDimitris Papastamos };
5367a30a3dbSDimitris Papastamos 
537f0fba2adSLiam Girdwood /* SoC Audio Codec device */
538808db4a4SRichard Purdie struct snd_soc_codec {
539f0fba2adSLiam Girdwood 	const char *name;
540ead9b919SJarkko Nikula 	const char *name_prefix;
541f0fba2adSLiam Girdwood 	int id;
5420d0cf00aSMark Brown 	struct device *dev;
543001ae4c0SMark Brown 	const struct snd_soc_codec_driver *driver;
5440d0cf00aSMark Brown 
545f0fba2adSLiam Girdwood 	struct mutex mutex;
546f0fba2adSLiam Girdwood 	struct snd_soc_card *card;
5470d0cf00aSMark Brown 	struct list_head list;
548f0fba2adSLiam Girdwood 	struct list_head card_list;
549f0fba2adSLiam Girdwood 	int num_dai;
55023bbce34SDimitris Papastamos 	enum snd_soc_compress_type compress_type;
551aea170a0SDimitris Papastamos 	size_t reg_size;	/* reg_cache_size * reg_word_size */
5521500b7b5SDimitris Papastamos 	int (*volatile_register)(struct snd_soc_codec *, unsigned int);
5531500b7b5SDimitris Papastamos 	int (*readable_register)(struct snd_soc_codec *, unsigned int);
5548020454cSDimitris Papastamos 	int (*writable_register)(struct snd_soc_codec *, unsigned int);
555808db4a4SRichard Purdie 
556808db4a4SRichard Purdie 	/* runtime */
557808db4a4SRichard Purdie 	struct snd_ac97 *ac97;  /* for ad-hoc ac97 devices */
558808db4a4SRichard Purdie 	unsigned int active;
559dad8e7aeSDimitris Papastamos 	unsigned int cache_bypass:1; /* Suppress access to the cache */
560f0fba2adSLiam Girdwood 	unsigned int suspended:1; /* Codec is in suspend PM state */
561f0fba2adSLiam Girdwood 	unsigned int probed:1; /* Codec has been probed */
562f0fba2adSLiam Girdwood 	unsigned int ac97_registered:1; /* Codec has been AC97 registered */
5630562f788SMika Westerberg 	unsigned int ac97_created:1; /* Codec has been created by SoC */
564f0fba2adSLiam Girdwood 	unsigned int sysfs_registered:1; /* codec has been sysfs registered */
565fdf0f54dSDimitris Papastamos 	unsigned int cache_init:1; /* codec cache has been initialized */
566aaee8ef1SMark Brown 	u32 cache_only;  /* Suppress writes to hardware */
567aaee8ef1SMark Brown 	u32 cache_sync; /* Cache needs to be synced to hardware */
568f0fba2adSLiam Girdwood 
569f0fba2adSLiam Girdwood 	/* codec IO */
570f0fba2adSLiam Girdwood 	void *control_data; /* codec control (i2c/3wire) data */
57167850a89SDimitris Papastamos 	enum snd_soc_control_type control_type;
572f0fba2adSLiam Girdwood 	hw_write_t hw_write;
573f0fba2adSLiam Girdwood 	unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int);
574c3acec26SMark Brown 	unsigned int (*read)(struct snd_soc_codec *, unsigned int);
575c3acec26SMark Brown 	int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
5765fb609d4SDimitris Papastamos 	int (*bulk_write_raw)(struct snd_soc_codec *, unsigned int, const void *, size_t);
577f0fba2adSLiam Girdwood 	void *reg_cache;
5783335ddcaSDimitris Papastamos 	const void *reg_def_copy;
5797a30a3dbSDimitris Papastamos 	const struct snd_soc_cache_ops *cache_ops;
5807a30a3dbSDimitris Papastamos 	struct mutex cache_rw_mutex;
581be3ea3b9SMark Brown 	int val_bytes;
582a96ca338SMark Brown 
583808db4a4SRichard Purdie 	/* dapm */
584ce6120ccSLiam Girdwood 	struct snd_soc_dapm_context dapm;
585808db4a4SRichard Purdie 
586384c89e2SMark Brown #ifdef CONFIG_DEBUG_FS
58788439ac7SPeter Ujfalusi 	struct dentry *debugfs_codec_root;
588384c89e2SMark Brown 	struct dentry *debugfs_reg;
58979fb9387SMark Brown 	struct dentry *debugfs_dapm;
590384c89e2SMark Brown #endif
591808db4a4SRichard Purdie };
592808db4a4SRichard Purdie 
593f0fba2adSLiam Girdwood /* codec driver */
594f0fba2adSLiam Girdwood struct snd_soc_codec_driver {
595f0fba2adSLiam Girdwood 
596f0fba2adSLiam Girdwood 	/* driver ops */
597f0fba2adSLiam Girdwood 	int (*probe)(struct snd_soc_codec *);
598f0fba2adSLiam Girdwood 	int (*remove)(struct snd_soc_codec *);
599f0fba2adSLiam Girdwood 	int (*suspend)(struct snd_soc_codec *,
600f0fba2adSLiam Girdwood 			pm_message_t state);
601f0fba2adSLiam Girdwood 	int (*resume)(struct snd_soc_codec *);
602f0fba2adSLiam Girdwood 
603b7af1dafSMark Brown 	/* Default control and setup, added after probe() is run */
604b7af1dafSMark Brown 	const struct snd_kcontrol_new *controls;
605b7af1dafSMark Brown 	int num_controls;
60689b95ac0SMark Brown 	const struct snd_soc_dapm_widget *dapm_widgets;
60789b95ac0SMark Brown 	int num_dapm_widgets;
60889b95ac0SMark Brown 	const struct snd_soc_dapm_route *dapm_routes;
60989b95ac0SMark Brown 	int num_dapm_routes;
61089b95ac0SMark Brown 
611ec4ee52aSMark Brown 	/* codec wide operations */
612ec4ee52aSMark Brown 	int (*set_sysclk)(struct snd_soc_codec *codec,
613*da1c6ea6SMark Brown 			  int clk_id, int source, unsigned int freq, int dir);
614ec4ee52aSMark Brown 	int (*set_pll)(struct snd_soc_codec *codec, int pll_id, int source,
615ec4ee52aSMark Brown 		unsigned int freq_in, unsigned int freq_out);
616ec4ee52aSMark Brown 
617f0fba2adSLiam Girdwood 	/* codec IO */
618f0fba2adSLiam Girdwood 	unsigned int (*read)(struct snd_soc_codec *, unsigned int);
619f0fba2adSLiam Girdwood 	int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
620f0fba2adSLiam Girdwood 	int (*display_register)(struct snd_soc_codec *, char *,
621f0fba2adSLiam Girdwood 				size_t, unsigned int);
622d4754ec9SDimitris Papastamos 	int (*volatile_register)(struct snd_soc_codec *, unsigned int);
623d4754ec9SDimitris Papastamos 	int (*readable_register)(struct snd_soc_codec *, unsigned int);
6248020454cSDimitris Papastamos 	int (*writable_register)(struct snd_soc_codec *, unsigned int);
6254a8923baSMark Brown 	unsigned int reg_cache_size;
626f0fba2adSLiam Girdwood 	short reg_cache_step;
627f0fba2adSLiam Girdwood 	short reg_word_size;
628f0fba2adSLiam Girdwood 	const void *reg_cache_default;
629066d16c3SDimitris Papastamos 	short reg_access_size;
630066d16c3SDimitris Papastamos 	const struct snd_soc_reg_access *reg_access_default;
6317a30a3dbSDimitris Papastamos 	enum snd_soc_compress_type compress_type;
632f0fba2adSLiam Girdwood 
633f0fba2adSLiam Girdwood 	/* codec bias level */
634f0fba2adSLiam Girdwood 	int (*set_bias_level)(struct snd_soc_codec *,
635f0fba2adSLiam Girdwood 			      enum snd_soc_bias_level level);
63633c5f969SMark Brown 	bool idle_bias_off;
637474b62d6SMark Brown 
638474b62d6SMark Brown 	void (*seq_notifier)(struct snd_soc_dapm_context *,
639f85a9e0dSMark Brown 			     enum snd_soc_dapm_type, int);
6400168bf0dSLiam Girdwood 
64164a648c2SLiam Girdwood 	/* codec stream completion event */
64264a648c2SLiam Girdwood 	int (*stream_event)(struct snd_soc_dapm_context *dapm, int event);
64364a648c2SLiam Girdwood 
6440168bf0dSLiam Girdwood 	/* probe ordering - for components with runtime dependencies */
6450168bf0dSLiam Girdwood 	int probe_order;
6460168bf0dSLiam Girdwood 	int remove_order;
647808db4a4SRichard Purdie };
648808db4a4SRichard Purdie 
649808db4a4SRichard Purdie /* SoC platform interface */
650f0fba2adSLiam Girdwood struct snd_soc_platform_driver {
651808db4a4SRichard Purdie 
652f0fba2adSLiam Girdwood 	int (*probe)(struct snd_soc_platform *);
653f0fba2adSLiam Girdwood 	int (*remove)(struct snd_soc_platform *);
654f0fba2adSLiam Girdwood 	int (*suspend)(struct snd_soc_dai *dai);
655f0fba2adSLiam Girdwood 	int (*resume)(struct snd_soc_dai *dai);
656808db4a4SRichard Purdie 
657808db4a4SRichard Purdie 	/* pcm creation and destruction */
658552d1ef6SLiam Girdwood 	int (*pcm_new)(struct snd_soc_pcm_runtime *);
659808db4a4SRichard Purdie 	void (*pcm_free)(struct snd_pcm *);
660808db4a4SRichard Purdie 
661cb2cf612SLiam Girdwood 	/* Default control and setup, added after probe() is run */
662cb2cf612SLiam Girdwood 	const struct snd_kcontrol_new *controls;
663cb2cf612SLiam Girdwood 	int num_controls;
664cb2cf612SLiam Girdwood 	const struct snd_soc_dapm_widget *dapm_widgets;
665cb2cf612SLiam Girdwood 	int num_dapm_widgets;
666cb2cf612SLiam Girdwood 	const struct snd_soc_dapm_route *dapm_routes;
667cb2cf612SLiam Girdwood 	int num_dapm_routes;
668cb2cf612SLiam Girdwood 
669258020d0SPeter Ujfalusi 	/*
670258020d0SPeter Ujfalusi 	 * For platform caused delay reporting.
671258020d0SPeter Ujfalusi 	 * Optional.
672258020d0SPeter Ujfalusi 	 */
673258020d0SPeter Ujfalusi 	snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *,
674258020d0SPeter Ujfalusi 		struct snd_soc_dai *);
675258020d0SPeter Ujfalusi 
676808db4a4SRichard Purdie 	/* platform stream ops */
677f0fba2adSLiam Girdwood 	struct snd_pcm_ops *ops;
6780168bf0dSLiam Girdwood 
67964a648c2SLiam Girdwood 	/* platform stream completion event */
68064a648c2SLiam Girdwood 	int (*stream_event)(struct snd_soc_dapm_context *dapm, int event);
68164a648c2SLiam Girdwood 
6820168bf0dSLiam Girdwood 	/* probe ordering - for components with runtime dependencies */
6830168bf0dSLiam Girdwood 	int probe_order;
6840168bf0dSLiam Girdwood 	int remove_order;
685f1442bc1SLiam Girdwood 
686f1442bc1SLiam Girdwood 	/* platform IO - used for platform DAPM */
687f1442bc1SLiam Girdwood 	unsigned int (*read)(struct snd_soc_platform *, unsigned int);
688f1442bc1SLiam Girdwood 	int (*write)(struct snd_soc_platform *, unsigned int, unsigned int);
689808db4a4SRichard Purdie };
690808db4a4SRichard Purdie 
691f0fba2adSLiam Girdwood struct snd_soc_platform {
692f0fba2adSLiam Girdwood 	const char *name;
693f0fba2adSLiam Girdwood 	int id;
694f0fba2adSLiam Girdwood 	struct device *dev;
695f0fba2adSLiam Girdwood 	struct snd_soc_platform_driver *driver;
696f0fba2adSLiam Girdwood 
697f0fba2adSLiam Girdwood 	unsigned int suspended:1; /* platform is suspended */
698f0fba2adSLiam Girdwood 	unsigned int probed:1;
699f0fba2adSLiam Girdwood 
700f0fba2adSLiam Girdwood 	struct snd_soc_card *card;
701f0fba2adSLiam Girdwood 	struct list_head list;
702f0fba2adSLiam Girdwood 	struct list_head card_list;
703b7950641SLiam Girdwood 
704b7950641SLiam Girdwood 	struct snd_soc_dapm_context dapm;
705f0fba2adSLiam Girdwood };
706f0fba2adSLiam Girdwood 
707808db4a4SRichard Purdie struct snd_soc_dai_link {
708f0fba2adSLiam Girdwood 	/* config - must be set by machine driver */
709f0fba2adSLiam Girdwood 	const char *name;			/* Codec name */
710f0fba2adSLiam Girdwood 	const char *stream_name;		/* Stream name */
711f0fba2adSLiam Girdwood 	const char *codec_name;		/* for multi-codec */
712f0fba2adSLiam Girdwood 	const char *platform_name;	/* for multi-platform */
713f0fba2adSLiam Girdwood 	const char *cpu_dai_name;
714f0fba2adSLiam Girdwood 	const char *codec_dai_name;
7154ccab3e7SLiam Girdwood 
7163efab7dcSMark Brown 	/* Keep DAI active over suspend */
7173efab7dcSMark Brown 	unsigned int ignore_suspend:1;
7183efab7dcSMark Brown 
71906f409d7SMark Brown 	/* Symmetry requirements */
72006f409d7SMark Brown 	unsigned int symmetric_rates:1;
72106f409d7SMark Brown 
722f0fba2adSLiam Girdwood 	/* codec/machine specific init - e.g. add machine controls */
723f0fba2adSLiam Girdwood 	int (*init)(struct snd_soc_pcm_runtime *rtd);
72406f409d7SMark Brown 
725f0fba2adSLiam Girdwood 	/* machine stream operations */
726f0fba2adSLiam Girdwood 	struct snd_soc_ops *ops;
727808db4a4SRichard Purdie };
728808db4a4SRichard Purdie 
729ff819b83SDimitris Papastamos struct snd_soc_codec_conf {
730ead9b919SJarkko Nikula 	const char *dev_name;
731ff819b83SDimitris Papastamos 
732ff819b83SDimitris Papastamos 	/*
733ff819b83SDimitris Papastamos 	 * optional map of kcontrol, widget and path name prefixes that are
734ff819b83SDimitris Papastamos 	 * associated per device
735ff819b83SDimitris Papastamos 	 */
736ead9b919SJarkko Nikula 	const char *name_prefix;
737ff819b83SDimitris Papastamos 
738ff819b83SDimitris Papastamos 	/*
739ff819b83SDimitris Papastamos 	 * set this to the desired compression type if you want to
740ff819b83SDimitris Papastamos 	 * override the one supplied in codec->driver->compress_type
741ff819b83SDimitris Papastamos 	 */
742ff819b83SDimitris Papastamos 	enum snd_soc_compress_type compress_type;
743ead9b919SJarkko Nikula };
744ead9b919SJarkko Nikula 
7452eea392dSJarkko Nikula struct snd_soc_aux_dev {
7462eea392dSJarkko Nikula 	const char *name;		/* Codec name */
7472eea392dSJarkko Nikula 	const char *codec_name;		/* for multi-codec */
7482eea392dSJarkko Nikula 
7492eea392dSJarkko Nikula 	/* codec/machine specific init - e.g. add machine controls */
7502eea392dSJarkko Nikula 	int (*init)(struct snd_soc_dapm_context *dapm);
7512eea392dSJarkko Nikula };
7522eea392dSJarkko Nikula 
75387506549SMark Brown /* SoC card */
75487506549SMark Brown struct snd_soc_card {
755f0fba2adSLiam Girdwood 	const char *name;
75622de71baSLiam Girdwood 	const char *long_name;
75722de71baSLiam Girdwood 	const char *driver_name;
758c5af3a2eSMark Brown 	struct device *dev;
759f0fba2adSLiam Girdwood 	struct snd_card *snd_card;
760f0fba2adSLiam Girdwood 	struct module *owner;
761c5af3a2eSMark Brown 
762c5af3a2eSMark Brown 	struct list_head list;
763f0fba2adSLiam Girdwood 	struct mutex mutex;
764c5af3a2eSMark Brown 
765f0fba2adSLiam Girdwood 	bool instantiated;
766808db4a4SRichard Purdie 
767e7361ec4SMark Brown 	int (*probe)(struct snd_soc_card *card);
76828e9ad92SMark Brown 	int (*late_probe)(struct snd_soc_card *card);
769e7361ec4SMark Brown 	int (*remove)(struct snd_soc_card *card);
770808db4a4SRichard Purdie 
771808db4a4SRichard Purdie 	/* the pre and post PM functions are used to do any PM work before and
772808db4a4SRichard Purdie 	 * after the codec and DAI's do any PM work. */
77370b2ac12SMark Brown 	int (*suspend_pre)(struct snd_soc_card *card);
77470b2ac12SMark Brown 	int (*suspend_post)(struct snd_soc_card *card);
77570b2ac12SMark Brown 	int (*resume_pre)(struct snd_soc_card *card);
77670b2ac12SMark Brown 	int (*resume_post)(struct snd_soc_card *card);
777808db4a4SRichard Purdie 
7780b4d221bSLiam Girdwood 	/* callbacks */
77987506549SMark Brown 	int (*set_bias_level)(struct snd_soc_card *,
780d4c6005fSMark Brown 			      struct snd_soc_dapm_context *dapm,
7810be9898aSMark Brown 			      enum snd_soc_bias_level level);
7821badabd9SMark Brown 	int (*set_bias_level_post)(struct snd_soc_card *,
783d4c6005fSMark Brown 				   struct snd_soc_dapm_context *dapm,
7841badabd9SMark Brown 				   enum snd_soc_bias_level level);
7850b4d221bSLiam Girdwood 
7866c5f1fedSMark Brown 	long pmdown_time;
78796dd3622SMark Brown 
788808db4a4SRichard Purdie 	/* CPU <--> Codec DAI links  */
789808db4a4SRichard Purdie 	struct snd_soc_dai_link *dai_link;
790808db4a4SRichard Purdie 	int num_links;
791f0fba2adSLiam Girdwood 	struct snd_soc_pcm_runtime *rtd;
792f0fba2adSLiam Girdwood 	int num_rtd;
7936308419aSMark Brown 
794ff819b83SDimitris Papastamos 	/* optional codec specific configuration */
795ff819b83SDimitris Papastamos 	struct snd_soc_codec_conf *codec_conf;
796ff819b83SDimitris Papastamos 	int num_configs;
797ead9b919SJarkko Nikula 
7982eea392dSJarkko Nikula 	/*
7992eea392dSJarkko Nikula 	 * optional auxiliary devices such as amplifiers or codecs with DAI
8002eea392dSJarkko Nikula 	 * link unused
8012eea392dSJarkko Nikula 	 */
8022eea392dSJarkko Nikula 	struct snd_soc_aux_dev *aux_dev;
8032eea392dSJarkko Nikula 	int num_aux_devs;
8042eea392dSJarkko Nikula 	struct snd_soc_pcm_runtime *rtd_aux;
8052eea392dSJarkko Nikula 	int num_aux_rtd;
8062eea392dSJarkko Nikula 
807b7af1dafSMark Brown 	const struct snd_kcontrol_new *controls;
808b7af1dafSMark Brown 	int num_controls;
809b7af1dafSMark Brown 
810b8ad29deSMark Brown 	/*
811b8ad29deSMark Brown 	 * Card-specific routes and widgets.
812b8ad29deSMark Brown 	 */
813d06e48dbSLars-Peter Clausen 	const struct snd_soc_dapm_widget *dapm_widgets;
814b8ad29deSMark Brown 	int num_dapm_widgets;
815d06e48dbSLars-Peter Clausen 	const struct snd_soc_dapm_route *dapm_routes;
816b8ad29deSMark Brown 	int num_dapm_routes;
817b8ad29deSMark Brown 
8186308419aSMark Brown 	struct work_struct deferred_resume_work;
819f0fba2adSLiam Girdwood 
820f0fba2adSLiam Girdwood 	/* lists of probed devices belonging to this card */
821f0fba2adSLiam Girdwood 	struct list_head codec_dev_list;
822f0fba2adSLiam Girdwood 	struct list_head platform_dev_list;
823f0fba2adSLiam Girdwood 	struct list_head dai_dev_list;
824a6052154SJarkko Nikula 
82597c866deSJarkko Nikula 	struct list_head widgets;
8268ddab3f5SJarkko Nikula 	struct list_head paths;
8277be31be8SJarkko Nikula 	struct list_head dapm_list;
8288ddab3f5SJarkko Nikula 
829e37a4970SMark Brown 	/* Generic DAPM context for the card */
830e37a4970SMark Brown 	struct snd_soc_dapm_context dapm;
831e37a4970SMark Brown 
832a6052154SJarkko Nikula #ifdef CONFIG_DEBUG_FS
833a6052154SJarkko Nikula 	struct dentry *debugfs_card_root;
8343a45b867SJarkko Nikula 	struct dentry *debugfs_pop_time;
835a6052154SJarkko Nikula #endif
8363a45b867SJarkko Nikula 	u32 pop_time;
837dddf3e4cSMark Brown 
838dddf3e4cSMark Brown 	void *drvdata;
839808db4a4SRichard Purdie };
840808db4a4SRichard Purdie 
841f0fba2adSLiam Girdwood /* SoC machine DAI configuration, glues a codec and cpu DAI together */
842808db4a4SRichard Purdie struct snd_soc_pcm_runtime  {
843f0fba2adSLiam Girdwood 	struct device dev;
844f0fba2adSLiam Girdwood 	struct snd_soc_card *card;
845f0fba2adSLiam Girdwood 	struct snd_soc_dai_link *dai_link;
846b8c0dab9SLiam Girdwood 	struct mutex pcm_mutex;
847b8c0dab9SLiam Girdwood 	enum snd_soc_pcm_subclass pcm_subclass;
848b8c0dab9SLiam Girdwood 	struct snd_pcm_ops ops;
849f0fba2adSLiam Girdwood 
850f0fba2adSLiam Girdwood 	unsigned int complete:1;
851f0fba2adSLiam Girdwood 	unsigned int dev_registered:1;
852f0fba2adSLiam Girdwood 
853f0fba2adSLiam Girdwood 	/* Symmetry data - only valid if symmetry is being enforced */
854f0fba2adSLiam Girdwood 	unsigned int rate;
855f0fba2adSLiam Girdwood 	long pmdown_time;
856f0fba2adSLiam Girdwood 
857f0fba2adSLiam Girdwood 	/* runtime devices */
858f0fba2adSLiam Girdwood 	struct snd_pcm *pcm;
859f0fba2adSLiam Girdwood 	struct snd_soc_codec *codec;
860f0fba2adSLiam Girdwood 	struct snd_soc_platform *platform;
861f0fba2adSLiam Girdwood 	struct snd_soc_dai *codec_dai;
862f0fba2adSLiam Girdwood 	struct snd_soc_dai *cpu_dai;
863f0fba2adSLiam Girdwood 
864f0fba2adSLiam Girdwood 	struct delayed_work delayed_work;
865808db4a4SRichard Purdie };
866808db4a4SRichard Purdie 
8674eaa9819SJon Smirl /* mixer control */
8684eaa9819SJon Smirl struct soc_mixer_control {
869d11bb4a9SPeter Ujfalusi 	int min, max, platform_max;
870815ecf8dSJon Smirl 	unsigned int reg, rreg, shift, rshift, invert;
8714eaa9819SJon Smirl };
8724eaa9819SJon Smirl 
873808db4a4SRichard Purdie /* enumerated kcontrol */
874808db4a4SRichard Purdie struct soc_enum {
875808db4a4SRichard Purdie 	unsigned short reg;
876808db4a4SRichard Purdie 	unsigned short reg2;
877808db4a4SRichard Purdie 	unsigned char shift_l;
878808db4a4SRichard Purdie 	unsigned char shift_r;
879f8ba0b7bSJon Smirl 	unsigned int max;
8802e72f8e3SPeter Ujfalusi 	unsigned int mask;
88187023ff7STakashi Iwai 	const char * const *texts;
8822e72f8e3SPeter Ujfalusi 	const unsigned int *values;
8832e72f8e3SPeter Ujfalusi 	void *dapm;
8842e72f8e3SPeter Ujfalusi };
8852e72f8e3SPeter Ujfalusi 
8865c82f567SMark Brown /* codec IO */
887c3753707SMark Brown unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
888c3753707SMark Brown unsigned int snd_soc_write(struct snd_soc_codec *codec,
889c3753707SMark Brown 			   unsigned int reg, unsigned int val);
8905fb609d4SDimitris Papastamos unsigned int snd_soc_bulk_write_raw(struct snd_soc_codec *codec,
8915fb609d4SDimitris Papastamos 				    unsigned int reg, const void *data, size_t len);
8925c82f567SMark Brown 
893f0fba2adSLiam Girdwood /* device driver data */
894f0fba2adSLiam Girdwood 
895dddf3e4cSMark Brown static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
896dddf3e4cSMark Brown 		void *data)
897dddf3e4cSMark Brown {
898dddf3e4cSMark Brown 	card->drvdata = data;
899dddf3e4cSMark Brown }
900dddf3e4cSMark Brown 
901dddf3e4cSMark Brown static inline void *snd_soc_card_get_drvdata(struct snd_soc_card *card)
902dddf3e4cSMark Brown {
903dddf3e4cSMark Brown 	return card->drvdata;
904dddf3e4cSMark Brown }
905dddf3e4cSMark Brown 
906b2c812e2SMark Brown static inline void snd_soc_codec_set_drvdata(struct snd_soc_codec *codec,
907b2c812e2SMark Brown 		void *data)
908b2c812e2SMark Brown {
909f0fba2adSLiam Girdwood 	dev_set_drvdata(codec->dev, data);
910b2c812e2SMark Brown }
911b2c812e2SMark Brown 
912b2c812e2SMark Brown static inline void *snd_soc_codec_get_drvdata(struct snd_soc_codec *codec)
913b2c812e2SMark Brown {
914f0fba2adSLiam Girdwood 	return dev_get_drvdata(codec->dev);
915f0fba2adSLiam Girdwood }
916f0fba2adSLiam Girdwood 
917f0fba2adSLiam Girdwood static inline void snd_soc_platform_set_drvdata(struct snd_soc_platform *platform,
918f0fba2adSLiam Girdwood 		void *data)
919f0fba2adSLiam Girdwood {
920f0fba2adSLiam Girdwood 	dev_set_drvdata(platform->dev, data);
921f0fba2adSLiam Girdwood }
922f0fba2adSLiam Girdwood 
923f0fba2adSLiam Girdwood static inline void *snd_soc_platform_get_drvdata(struct snd_soc_platform *platform)
924f0fba2adSLiam Girdwood {
925f0fba2adSLiam Girdwood 	return dev_get_drvdata(platform->dev);
926f0fba2adSLiam Girdwood }
927f0fba2adSLiam Girdwood 
928f0fba2adSLiam Girdwood static inline void snd_soc_pcm_set_drvdata(struct snd_soc_pcm_runtime *rtd,
929f0fba2adSLiam Girdwood 		void *data)
930f0fba2adSLiam Girdwood {
931f0fba2adSLiam Girdwood 	dev_set_drvdata(&rtd->dev, data);
932f0fba2adSLiam Girdwood }
933f0fba2adSLiam Girdwood 
934f0fba2adSLiam Girdwood static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd)
935f0fba2adSLiam Girdwood {
936f0fba2adSLiam Girdwood 	return dev_get_drvdata(&rtd->dev);
937b2c812e2SMark Brown }
938b2c812e2SMark Brown 
9394e10bda0SVinod Koul static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
9404e10bda0SVinod Koul {
9414e10bda0SVinod Koul 	INIT_LIST_HEAD(&card->dai_dev_list);
9424e10bda0SVinod Koul 	INIT_LIST_HEAD(&card->codec_dev_list);
9434e10bda0SVinod Koul 	INIT_LIST_HEAD(&card->platform_dev_list);
9444e10bda0SVinod Koul 	INIT_LIST_HEAD(&card->widgets);
9454e10bda0SVinod Koul 	INIT_LIST_HEAD(&card->paths);
9464e10bda0SVinod Koul 	INIT_LIST_HEAD(&card->dapm_list);
9474e10bda0SVinod Koul }
9484e10bda0SVinod Koul 
949fb257897SMark Brown int snd_soc_util_init(void);
950fb257897SMark Brown void snd_soc_util_exit(void);
951fb257897SMark Brown 
952a47cbe72SMark Brown #include <sound/soc-dai.h>
953a47cbe72SMark Brown 
954faff4bb0SStephen Warren #ifdef CONFIG_DEBUG_FS
9558a9dab1aSMark Brown extern struct dentry *snd_soc_debugfs_root;
956faff4bb0SStephen Warren #endif
957faff4bb0SStephen Warren 
9586f8ab4acSMark Brown extern const struct dev_pm_ops snd_soc_pm_ops;
9596f8ab4acSMark Brown 
960808db4a4SRichard Purdie #endif
961