soc.h 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039
  1. /*
  2. * linux/sound/soc.h -- ALSA SoC Layer
  3. *
  4. * Author: Liam Girdwood
  5. * Created: Aug 11th 2005
  6. * Copyright: Wolfson Microelectronics. PLC.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #ifndef __LINUX_SND_SOC_H
  13. #define __LINUX_SND_SOC_H
  14. #include <linux/platform_device.h>
  15. #include <linux/types.h>
  16. #include <linux/notifier.h>
  17. #include <linux/workqueue.h>
  18. #include <linux/interrupt.h>
  19. #include <linux/kernel.h>
  20. #include <linux/regmap.h>
  21. #include <sound/core.h>
  22. #include <sound/pcm.h>
  23. #include <sound/control.h>
  24. #include <sound/ac97_codec.h>
  25. /*
  26. * Convenience kcontrol builders
  27. */
  28. #define SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, xmax, xinvert) \
  29. ((unsigned long)&(struct soc_mixer_control) \
  30. {.reg = xreg, .rreg = xreg, .shift = shift_left, \
  31. .rshift = shift_right, .max = xmax, .platform_max = xmax, \
  32. .invert = xinvert})
  33. #define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) \
  34. SOC_DOUBLE_VALUE(xreg, xshift, xshift, xmax, xinvert)
  35. #define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \
  36. ((unsigned long)&(struct soc_mixer_control) \
  37. {.reg = xreg, .max = xmax, .platform_max = xmax, .invert = xinvert})
  38. #define SOC_DOUBLE_R_VALUE(xlreg, xrreg, xshift, xmax, xinvert) \
  39. ((unsigned long)&(struct soc_mixer_control) \
  40. {.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \
  41. .max = xmax, .platform_max = xmax, .invert = xinvert})
  42. #define SOC_SINGLE(xname, reg, shift, max, invert) \
  43. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
  44. .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
  45. .put = snd_soc_put_volsw, \
  46. .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
  47. #define SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
  48. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
  49. .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
  50. SNDRV_CTL_ELEM_ACCESS_READWRITE,\
  51. .tlv.p = (tlv_array), \
  52. .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
  53. .put = snd_soc_put_volsw, \
  54. .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
  55. #define SOC_SINGLE_SX_TLV(xname, xreg, xshift, xmin, xmax, tlv_array) \
  56. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
  57. .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
  58. SNDRV_CTL_ELEM_ACCESS_READWRITE, \
  59. .tlv.p = (tlv_array),\
  60. .info = snd_soc_info_volsw, \
  61. .get = snd_soc_get_volsw_sx,\
  62. .put = snd_soc_put_volsw_sx, \
  63. .private_value = (unsigned long)&(struct soc_mixer_control) \
  64. {.reg = xreg, .rreg = xreg, \
  65. .shift = xshift, .rshift = xshift, \
  66. .max = xmax, .min = xmin} }
  67. #define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \
  68. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
  69. .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
  70. .put = snd_soc_put_volsw, \
  71. .private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \
  72. max, invert) }
  73. #define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \
  74. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
  75. .info = snd_soc_info_volsw, \
  76. .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \
  77. .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \
  78. xmax, xinvert) }
  79. #define SOC_DOUBLE_TLV(xname, reg, shift_left, shift_right, max, invert, tlv_array) \
  80. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
  81. .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
  82. SNDRV_CTL_ELEM_ACCESS_READWRITE,\
  83. .tlv.p = (tlv_array), \
  84. .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
  85. .put = snd_soc_put_volsw, \
  86. .private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \
  87. max, invert) }
  88. #define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \
  89. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
  90. .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
  91. SNDRV_CTL_ELEM_ACCESS_READWRITE,\
  92. .tlv.p = (tlv_array), \
  93. .info = snd_soc_info_volsw, \
  94. .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \
  95. .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \
  96. xmax, xinvert) }
  97. #define SOC_DOUBLE_R_SX_TLV(xname, xreg, xrreg, xshift, xmin, xmax, tlv_array) \
  98. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
  99. .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
  100. SNDRV_CTL_ELEM_ACCESS_READWRITE, \
  101. .tlv.p = (tlv_array), \
  102. .info = snd_soc_info_volsw, \
  103. .get = snd_soc_get_volsw_sx, \
  104. .put = snd_soc_put_volsw_sx, \
  105. .private_value = (unsigned long)&(struct soc_mixer_control) \
  106. {.reg = xreg, .rreg = xrreg, \
  107. .shift = xshift, .rshift = xshift, \
  108. .max = xmax, .min = xmin} }
  109. #define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
  110. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
  111. .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
  112. SNDRV_CTL_ELEM_ACCESS_READWRITE, \
  113. .tlv.p = (tlv_array), \
  114. .info = snd_soc_info_volsw_s8, .get = snd_soc_get_volsw_s8, \
  115. .put = snd_soc_put_volsw_s8, \
  116. .private_value = (unsigned long)&(struct soc_mixer_control) \
  117. {.reg = xreg, .min = xmin, .max = xmax, \
  118. .platform_max = xmax} }
  119. #define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmax, xtexts) \
  120. { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
  121. .max = xmax, .texts = xtexts }
  122. #define SOC_ENUM_SINGLE(xreg, xshift, xmax, xtexts) \
  123. SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmax, xtexts)
  124. #define SOC_ENUM_SINGLE_EXT(xmax, xtexts) \
  125. { .max = xmax, .texts = xtexts }
  126. #define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xmax, xtexts, xvalues) \
  127. { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
  128. .mask = xmask, .max = xmax, .texts = xtexts, .values = xvalues}
  129. #define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xmax, xtexts, xvalues) \
  130. SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xmax, xtexts, xvalues)
  131. #define SOC_ENUM(xname, xenum) \
  132. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
  133. .info = snd_soc_info_enum_double, \
  134. .get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \
  135. .private_value = (unsigned long)&xenum }
  136. #define SOC_VALUE_ENUM(xname, xenum) \
  137. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
  138. .info = snd_soc_info_enum_double, \
  139. .get = snd_soc_get_value_enum_double, \
  140. .put = snd_soc_put_value_enum_double, \
  141. .private_value = (unsigned long)&xenum }
  142. #define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\
  143. xhandler_get, xhandler_put) \
  144. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
  145. .info = snd_soc_info_volsw, \
  146. .get = xhandler_get, .put = xhandler_put, \
  147. .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) }
  148. #define SOC_DOUBLE_EXT(xname, reg, shift_left, shift_right, max, invert,\
  149. xhandler_get, xhandler_put) \
  150. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
  151. .info = snd_soc_info_volsw, \
  152. .get = xhandler_get, .put = xhandler_put, \
  153. .private_value = \
  154. SOC_DOUBLE_VALUE(reg, shift_left, shift_right, max, invert) }
  155. #define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\
  156. xhandler_get, xhandler_put, tlv_array) \
  157. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
  158. .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
  159. SNDRV_CTL_ELEM_ACCESS_READWRITE,\
  160. .tlv.p = (tlv_array), \
  161. .info = snd_soc_info_volsw, \
  162. .get = xhandler_get, .put = xhandler_put, \
  163. .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) }
  164. #define SOC_DOUBLE_EXT_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert,\
  165. xhandler_get, xhandler_put, tlv_array) \
  166. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
  167. .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
  168. SNDRV_CTL_ELEM_ACCESS_READWRITE, \
  169. .tlv.p = (tlv_array), \
  170. .info = snd_soc_info_volsw, \
  171. .get = xhandler_get, .put = xhandler_put, \
  172. .private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
  173. xmax, xinvert) }
  174. #define SOC_DOUBLE_R_EXT_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert,\
  175. xhandler_get, xhandler_put, tlv_array) \
  176. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
  177. .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
  178. SNDRV_CTL_ELEM_ACCESS_READWRITE, \
  179. .tlv.p = (tlv_array), \
  180. .info = snd_soc_info_volsw, \
  181. .get = xhandler_get, .put = xhandler_put, \
  182. .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \
  183. xmax, xinvert) }
  184. #define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \
  185. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
  186. .info = snd_soc_info_bool_ext, \
  187. .get = xhandler_get, .put = xhandler_put, \
  188. .private_value = xdata }
  189. #define SOC_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) \
  190. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
  191. .info = snd_soc_info_enum_ext, \
  192. .get = xhandler_get, .put = xhandler_put, \
  193. .private_value = (unsigned long)&xenum }
  194. #define SND_SOC_BYTES(xname, xbase, xregs) \
  195. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
  196. .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \
  197. .put = snd_soc_bytes_put, .private_value = \
  198. ((unsigned long)&(struct soc_bytes) \
  199. {.base = xbase, .num_regs = xregs }) }
  200. #define SND_SOC_BYTES_MASK(xname, xbase, xregs, xmask) \
  201. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
  202. .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \
  203. .put = snd_soc_bytes_put, .private_value = \
  204. ((unsigned long)&(struct soc_bytes) \
  205. {.base = xbase, .num_regs = xregs, \
  206. .mask = xmask }) }
  207. /*
  208. * Simplified versions of above macros, declaring a struct and calculating
  209. * ARRAY_SIZE internally
  210. */
  211. #define SOC_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xtexts) \
  212. struct soc_enum name = SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, \
  213. ARRAY_SIZE(xtexts), xtexts)
  214. #define SOC_ENUM_SINGLE_DECL(name, xreg, xshift, xtexts) \
  215. SOC_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xtexts)
  216. #define SOC_ENUM_SINGLE_EXT_DECL(name, xtexts) \
  217. struct soc_enum name = SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(xtexts), xtexts)
  218. #define SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xmask, xtexts, xvalues) \
  219. struct soc_enum name = SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, \
  220. ARRAY_SIZE(xtexts), xtexts, xvalues)
  221. #define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \
  222. SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues)
  223. /*
  224. * Component probe and remove ordering levels for components with runtime
  225. * dependencies.
  226. */
  227. #define SND_SOC_COMP_ORDER_FIRST -2
  228. #define SND_SOC_COMP_ORDER_EARLY -1
  229. #define SND_SOC_COMP_ORDER_NORMAL 0
  230. #define SND_SOC_COMP_ORDER_LATE 1
  231. #define SND_SOC_COMP_ORDER_LAST 2
  232. /*
  233. * Bias levels
  234. *
  235. * @ON: Bias is fully on for audio playback and capture operations.
  236. * @PREPARE: Prepare for audio operations. Called before DAPM switching for
  237. * stream start and stop operations.
  238. * @STANDBY: Low power standby state when no playback/capture operations are
  239. * in progress. NOTE: The transition time between STANDBY and ON
  240. * should be as fast as possible and no longer than 10ms.
  241. * @OFF: Power Off. No restrictions on transition times.
  242. */
  243. enum snd_soc_bias_level {
  244. SND_SOC_BIAS_OFF = 0,
  245. SND_SOC_BIAS_STANDBY = 1,
  246. SND_SOC_BIAS_PREPARE = 2,
  247. SND_SOC_BIAS_ON = 3,
  248. };
  249. struct device_node;
  250. struct snd_jack;
  251. struct snd_soc_card;
  252. struct snd_soc_pcm_stream;
  253. struct snd_soc_ops;
  254. struct snd_soc_pcm_runtime;
  255. struct snd_soc_dai;
  256. struct snd_soc_dai_driver;
  257. struct snd_soc_platform;
  258. struct snd_soc_dai_link;
  259. struct snd_soc_platform_driver;
  260. struct snd_soc_codec;
  261. struct snd_soc_codec_driver;
  262. struct soc_enum;
  263. struct snd_soc_jack;
  264. struct snd_soc_jack_zone;
  265. struct snd_soc_jack_pin;
  266. struct snd_soc_cache_ops;
  267. #include <sound/soc-dapm.h>
  268. #ifdef CONFIG_GPIOLIB
  269. struct snd_soc_jack_gpio;
  270. #endif
  271. typedef int (*hw_write_t)(void *,const char* ,int);
  272. extern struct snd_ac97_bus_ops soc_ac97_ops;
  273. enum snd_soc_control_type {
  274. SND_SOC_I2C = 1,
  275. SND_SOC_SPI,
  276. SND_SOC_REGMAP,
  277. };
  278. enum snd_soc_compress_type {
  279. SND_SOC_FLAT_COMPRESSION = 1,
  280. };
  281. enum snd_soc_pcm_subclass {
  282. SND_SOC_PCM_CLASS_PCM = 0,
  283. SND_SOC_PCM_CLASS_BE = 1,
  284. };
  285. enum snd_soc_card_subclass {
  286. SND_SOC_CARD_CLASS_INIT = 0,
  287. SND_SOC_CARD_CLASS_RUNTIME = 1,
  288. };
  289. int snd_soc_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id,
  290. int source, unsigned int freq, int dir);
  291. int snd_soc_codec_set_pll(struct snd_soc_codec *codec, int pll_id, int source,
  292. unsigned int freq_in, unsigned int freq_out);
  293. int snd_soc_register_card(struct snd_soc_card *card);
  294. int snd_soc_unregister_card(struct snd_soc_card *card);
  295. int snd_soc_suspend(struct device *dev);
  296. int snd_soc_resume(struct device *dev);
  297. int snd_soc_poweroff(struct device *dev);
  298. int snd_soc_register_platform(struct device *dev,
  299. struct snd_soc_platform_driver *platform_drv);
  300. void snd_soc_unregister_platform(struct device *dev);
  301. int snd_soc_register_codec(struct device *dev,
  302. const struct snd_soc_codec_driver *codec_drv,
  303. struct snd_soc_dai_driver *dai_drv, int num_dai);
  304. void snd_soc_unregister_codec(struct device *dev);
  305. int snd_soc_codec_volatile_register(struct snd_soc_codec *codec,
  306. unsigned int reg);
  307. int snd_soc_codec_readable_register(struct snd_soc_codec *codec,
  308. unsigned int reg);
  309. int snd_soc_codec_writable_register(struct snd_soc_codec *codec,
  310. unsigned int reg);
  311. int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
  312. int addr_bits, int data_bits,
  313. enum snd_soc_control_type control);
  314. int snd_soc_cache_sync(struct snd_soc_codec *codec);
  315. int snd_soc_cache_init(struct snd_soc_codec *codec);
  316. int snd_soc_cache_exit(struct snd_soc_codec *codec);
  317. int snd_soc_cache_write(struct snd_soc_codec *codec,
  318. unsigned int reg, unsigned int value);
  319. int snd_soc_cache_read(struct snd_soc_codec *codec,
  320. unsigned int reg, unsigned int *value);
  321. int snd_soc_default_volatile_register(struct snd_soc_codec *codec,
  322. unsigned int reg);
  323. int snd_soc_default_readable_register(struct snd_soc_codec *codec,
  324. unsigned int reg);
  325. int snd_soc_default_writable_register(struct snd_soc_codec *codec,
  326. unsigned int reg);
  327. int snd_soc_platform_read(struct snd_soc_platform *platform,
  328. unsigned int reg);
  329. int snd_soc_platform_write(struct snd_soc_platform *platform,
  330. unsigned int reg, unsigned int val);
  331. int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num);
  332. /* Utility functions to get clock rates from various things */
  333. int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots);
  334. int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params);
  335. int snd_soc_calc_bclk(int fs, int sample_size, int channels, int tdm_slots);
  336. int snd_soc_params_to_bclk(struct snd_pcm_hw_params *parms);
  337. /* set runtime hw params */
  338. int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
  339. const struct snd_pcm_hardware *hw);
  340. /* Jack reporting */
  341. int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type,
  342. struct snd_soc_jack *jack);
  343. void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask);
  344. int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
  345. struct snd_soc_jack_pin *pins);
  346. void snd_soc_jack_notifier_register(struct snd_soc_jack *jack,
  347. struct notifier_block *nb);
  348. void snd_soc_jack_notifier_unregister(struct snd_soc_jack *jack,
  349. struct notifier_block *nb);
  350. int snd_soc_jack_add_zones(struct snd_soc_jack *jack, int count,
  351. struct snd_soc_jack_zone *zones);
  352. int snd_soc_jack_get_type(struct snd_soc_jack *jack, int micbias_voltage);
  353. #ifdef CONFIG_GPIOLIB
  354. int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
  355. struct snd_soc_jack_gpio *gpios);
  356. void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
  357. struct snd_soc_jack_gpio *gpios);
  358. #endif
  359. /* codec register bit access */
  360. int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg,
  361. unsigned int mask, unsigned int value);
  362. int snd_soc_update_bits_locked(struct snd_soc_codec *codec,
  363. unsigned short reg, unsigned int mask,
  364. unsigned int value);
  365. int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg,
  366. unsigned int mask, unsigned int value);
  367. int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
  368. struct snd_ac97_bus_ops *ops, int num);
  369. void snd_soc_free_ac97_codec(struct snd_soc_codec *codec);
  370. /*
  371. *Controls
  372. */
  373. struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
  374. void *data, const char *long_name,
  375. const char *prefix);
  376. int snd_soc_add_codec_controls(struct snd_soc_codec *codec,
  377. const struct snd_kcontrol_new *controls, int num_controls);
  378. int snd_soc_add_platform_controls(struct snd_soc_platform *platform,
  379. const struct snd_kcontrol_new *controls, int num_controls);
  380. int snd_soc_add_card_controls(struct snd_soc_card *soc_card,
  381. const struct snd_kcontrol_new *controls, int num_controls);
  382. int snd_soc_add_dai_controls(struct snd_soc_dai *dai,
  383. const struct snd_kcontrol_new *controls, int num_controls);
  384. int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
  385. struct snd_ctl_elem_info *uinfo);
  386. int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol,
  387. struct snd_ctl_elem_info *uinfo);
  388. int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol,
  389. struct snd_ctl_elem_value *ucontrol);
  390. int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol,
  391. struct snd_ctl_elem_value *ucontrol);
  392. int snd_soc_get_value_enum_double(struct snd_kcontrol *kcontrol,
  393. struct snd_ctl_elem_value *ucontrol);
  394. int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol,
  395. struct snd_ctl_elem_value *ucontrol);
  396. int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
  397. struct snd_ctl_elem_info *uinfo);
  398. int snd_soc_info_volsw_ext(struct snd_kcontrol *kcontrol,
  399. struct snd_ctl_elem_info *uinfo);
  400. #define snd_soc_info_bool_ext snd_ctl_boolean_mono_info
  401. int snd_soc_get_volsw(struct snd_kcontrol *kcontrol,
  402. struct snd_ctl_elem_value *ucontrol);
  403. int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
  404. struct snd_ctl_elem_value *ucontrol);
  405. #define snd_soc_get_volsw_2r snd_soc_get_volsw
  406. #define snd_soc_put_volsw_2r snd_soc_put_volsw
  407. int snd_soc_get_volsw_sx(struct snd_kcontrol *kcontrol,
  408. struct snd_ctl_elem_value *ucontrol);
  409. int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
  410. struct snd_ctl_elem_value *ucontrol);
  411. int snd_soc_info_volsw_s8(struct snd_kcontrol *kcontrol,
  412. struct snd_ctl_elem_info *uinfo);
  413. int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol,
  414. struct snd_ctl_elem_value *ucontrol);
  415. int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
  416. struct snd_ctl_elem_value *ucontrol);
  417. int snd_soc_limit_volume(struct snd_soc_codec *codec,
  418. const char *name, int max);
  419. int snd_soc_bytes_info(struct snd_kcontrol *kcontrol,
  420. struct snd_ctl_elem_info *uinfo);
  421. int snd_soc_bytes_get(struct snd_kcontrol *kcontrol,
  422. struct snd_ctl_elem_value *ucontrol);
  423. int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
  424. struct snd_ctl_elem_value *ucontrol);
  425. /**
  426. * struct snd_soc_reg_access - Describes whether a given register is
  427. * readable, writable or volatile.
  428. *
  429. * @reg: the register number
  430. * @read: whether this register is readable
  431. * @write: whether this register is writable
  432. * @vol: whether this register is volatile
  433. */
  434. struct snd_soc_reg_access {
  435. u16 reg;
  436. u16 read;
  437. u16 write;
  438. u16 vol;
  439. };
  440. /**
  441. * struct snd_soc_jack_pin - Describes a pin to update based on jack detection
  442. *
  443. * @pin: name of the pin to update
  444. * @mask: bits to check for in reported jack status
  445. * @invert: if non-zero then pin is enabled when status is not reported
  446. */
  447. struct snd_soc_jack_pin {
  448. struct list_head list;
  449. const char *pin;
  450. int mask;
  451. bool invert;
  452. };
  453. /**
  454. * struct snd_soc_jack_zone - Describes voltage zones of jack detection
  455. *
  456. * @min_mv: start voltage in mv
  457. * @max_mv: end voltage in mv
  458. * @jack_type: type of jack that is expected for this voltage
  459. * @debounce_time: debounce_time for jack, codec driver should wait for this
  460. * duration before reading the adc for voltages
  461. * @:list: list container
  462. */
  463. struct snd_soc_jack_zone {
  464. unsigned int min_mv;
  465. unsigned int max_mv;
  466. unsigned int jack_type;
  467. unsigned int debounce_time;
  468. struct list_head list;
  469. };
  470. /**
  471. * struct snd_soc_jack_gpio - Describes a gpio pin for jack detection
  472. *
  473. * @gpio: gpio number
  474. * @name: gpio name
  475. * @report: value to report when jack detected
  476. * @invert: report presence in low state
  477. * @debouce_time: debouce time in ms
  478. * @wake: enable as wake source
  479. * @jack_status_check: callback function which overrides the detection
  480. * to provide more complex checks (eg, reading an
  481. * ADC).
  482. */
  483. #ifdef CONFIG_GPIOLIB
  484. struct snd_soc_jack_gpio {
  485. unsigned int gpio;
  486. const char *name;
  487. int report;
  488. int invert;
  489. int debounce_time;
  490. bool wake;
  491. struct snd_soc_jack *jack;
  492. struct delayed_work work;
  493. int (*jack_status_check)(void);
  494. };
  495. #endif
  496. struct snd_soc_jack {
  497. struct mutex mutex;
  498. struct snd_jack *jack;
  499. struct snd_soc_codec *codec;
  500. struct list_head pins;
  501. int status;
  502. struct blocking_notifier_head notifier;
  503. struct list_head jack_zones;
  504. };
  505. /* SoC PCM stream information */
  506. struct snd_soc_pcm_stream {
  507. const char *stream_name;
  508. u64 formats; /* SNDRV_PCM_FMTBIT_* */
  509. unsigned int rates; /* SNDRV_PCM_RATE_* */
  510. unsigned int rate_min; /* min rate */
  511. unsigned int rate_max; /* max rate */
  512. unsigned int channels_min; /* min channels */
  513. unsigned int channels_max; /* max channels */
  514. unsigned int sig_bits; /* number of bits of content */
  515. };
  516. /* SoC audio ops */
  517. struct snd_soc_ops {
  518. int (*startup)(struct snd_pcm_substream *);
  519. void (*shutdown)(struct snd_pcm_substream *);
  520. int (*hw_params)(struct snd_pcm_substream *, struct snd_pcm_hw_params *);
  521. int (*hw_free)(struct snd_pcm_substream *);
  522. int (*prepare)(struct snd_pcm_substream *);
  523. int (*trigger)(struct snd_pcm_substream *, int);
  524. };
  525. /* SoC cache ops */
  526. struct snd_soc_cache_ops {
  527. const char *name;
  528. enum snd_soc_compress_type id;
  529. int (*init)(struct snd_soc_codec *codec);
  530. int (*exit)(struct snd_soc_codec *codec);
  531. int (*read)(struct snd_soc_codec *codec, unsigned int reg,
  532. unsigned int *value);
  533. int (*write)(struct snd_soc_codec *codec, unsigned int reg,
  534. unsigned int value);
  535. int (*sync)(struct snd_soc_codec *codec);
  536. };
  537. /* SoC Audio Codec device */
  538. struct snd_soc_codec {
  539. const char *name;
  540. const char *name_prefix;
  541. int id;
  542. struct device *dev;
  543. const struct snd_soc_codec_driver *driver;
  544. struct mutex mutex;
  545. struct snd_soc_card *card;
  546. struct list_head list;
  547. struct list_head card_list;
  548. int num_dai;
  549. enum snd_soc_compress_type compress_type;
  550. size_t reg_size; /* reg_cache_size * reg_word_size */
  551. int (*volatile_register)(struct snd_soc_codec *, unsigned int);
  552. int (*readable_register)(struct snd_soc_codec *, unsigned int);
  553. int (*writable_register)(struct snd_soc_codec *, unsigned int);
  554. /* runtime */
  555. struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
  556. unsigned int active;
  557. unsigned int cache_bypass:1; /* Suppress access to the cache */
  558. unsigned int suspended:1; /* Codec is in suspend PM state */
  559. unsigned int probed:1; /* Codec has been probed */
  560. unsigned int ac97_registered:1; /* Codec has been AC97 registered */
  561. unsigned int ac97_created:1; /* Codec has been created by SoC */
  562. unsigned int sysfs_registered:1; /* codec has been sysfs registered */
  563. unsigned int cache_init:1; /* codec cache has been initialized */
  564. unsigned int using_regmap:1; /* using regmap access */
  565. u32 cache_only; /* Suppress writes to hardware */
  566. u32 cache_sync; /* Cache needs to be synced to hardware */
  567. /* codec IO */
  568. void *control_data; /* codec control (i2c/3wire) data */
  569. enum snd_soc_control_type control_type;
  570. hw_write_t hw_write;
  571. unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int);
  572. unsigned int (*read)(struct snd_soc_codec *, unsigned int);
  573. int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
  574. int (*bulk_write_raw)(struct snd_soc_codec *, unsigned int, const void *, size_t);
  575. void *reg_cache;
  576. const void *reg_def_copy;
  577. const struct snd_soc_cache_ops *cache_ops;
  578. struct mutex cache_rw_mutex;
  579. int val_bytes;
  580. /* dapm */
  581. struct snd_soc_dapm_context dapm;
  582. unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */
  583. #ifdef CONFIG_DEBUG_FS
  584. struct dentry *debugfs_codec_root;
  585. struct dentry *debugfs_reg;
  586. struct dentry *debugfs_dapm;
  587. #endif
  588. };
  589. /* codec driver */
  590. struct snd_soc_codec_driver {
  591. /* driver ops */
  592. int (*probe)(struct snd_soc_codec *);
  593. int (*remove)(struct snd_soc_codec *);
  594. int (*suspend)(struct snd_soc_codec *);
  595. int (*resume)(struct snd_soc_codec *);
  596. /* Default control and setup, added after probe() is run */
  597. const struct snd_kcontrol_new *controls;
  598. int num_controls;
  599. const struct snd_soc_dapm_widget *dapm_widgets;
  600. int num_dapm_widgets;
  601. const struct snd_soc_dapm_route *dapm_routes;
  602. int num_dapm_routes;
  603. /* codec wide operations */
  604. int (*set_sysclk)(struct snd_soc_codec *codec,
  605. int clk_id, int source, unsigned int freq, int dir);
  606. int (*set_pll)(struct snd_soc_codec *codec, int pll_id, int source,
  607. unsigned int freq_in, unsigned int freq_out);
  608. /* codec IO */
  609. unsigned int (*read)(struct snd_soc_codec *, unsigned int);
  610. int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
  611. int (*display_register)(struct snd_soc_codec *, char *,
  612. size_t, unsigned int);
  613. int (*volatile_register)(struct snd_soc_codec *, unsigned int);
  614. int (*readable_register)(struct snd_soc_codec *, unsigned int);
  615. int (*writable_register)(struct snd_soc_codec *, unsigned int);
  616. unsigned int reg_cache_size;
  617. short reg_cache_step;
  618. short reg_word_size;
  619. const void *reg_cache_default;
  620. short reg_access_size;
  621. const struct snd_soc_reg_access *reg_access_default;
  622. enum snd_soc_compress_type compress_type;
  623. /* codec bias level */
  624. int (*set_bias_level)(struct snd_soc_codec *,
  625. enum snd_soc_bias_level level);
  626. bool idle_bias_off;
  627. void (*seq_notifier)(struct snd_soc_dapm_context *,
  628. enum snd_soc_dapm_type, int);
  629. /* codec stream completion event */
  630. int (*stream_event)(struct snd_soc_dapm_context *dapm, int event);
  631. bool ignore_pmdown_time; /* Doesn't benefit from pmdown delay */
  632. /* probe ordering - for components with runtime dependencies */
  633. int probe_order;
  634. int remove_order;
  635. };
  636. /* SoC platform interface */
  637. struct snd_soc_platform_driver {
  638. int (*probe)(struct snd_soc_platform *);
  639. int (*remove)(struct snd_soc_platform *);
  640. int (*suspend)(struct snd_soc_dai *dai);
  641. int (*resume)(struct snd_soc_dai *dai);
  642. /* pcm creation and destruction */
  643. int (*pcm_new)(struct snd_soc_pcm_runtime *);
  644. void (*pcm_free)(struct snd_pcm *);
  645. /* Default control and setup, added after probe() is run */
  646. const struct snd_kcontrol_new *controls;
  647. int num_controls;
  648. const struct snd_soc_dapm_widget *dapm_widgets;
  649. int num_dapm_widgets;
  650. const struct snd_soc_dapm_route *dapm_routes;
  651. int num_dapm_routes;
  652. /*
  653. * For platform caused delay reporting.
  654. * Optional.
  655. */
  656. snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *,
  657. struct snd_soc_dai *);
  658. /* platform stream ops */
  659. struct snd_pcm_ops *ops;
  660. /* platform stream completion event */
  661. int (*stream_event)(struct snd_soc_dapm_context *dapm, int event);
  662. /* probe ordering - for components with runtime dependencies */
  663. int probe_order;
  664. int remove_order;
  665. /* platform IO - used for platform DAPM */
  666. unsigned int (*read)(struct snd_soc_platform *, unsigned int);
  667. int (*write)(struct snd_soc_platform *, unsigned int, unsigned int);
  668. };
  669. struct snd_soc_platform {
  670. const char *name;
  671. int id;
  672. struct device *dev;
  673. struct snd_soc_platform_driver *driver;
  674. struct mutex mutex;
  675. unsigned int suspended:1; /* platform is suspended */
  676. unsigned int probed:1;
  677. struct snd_soc_card *card;
  678. struct list_head list;
  679. struct list_head card_list;
  680. struct snd_soc_dapm_context dapm;
  681. #ifdef CONFIG_DEBUG_FS
  682. struct dentry *debugfs_platform_root;
  683. struct dentry *debugfs_dapm;
  684. #endif
  685. };
  686. struct snd_soc_dai_link {
  687. /* config - must be set by machine driver */
  688. const char *name; /* Codec name */
  689. const char *stream_name; /* Stream name */
  690. const char *codec_name; /* for multi-codec */
  691. const struct device_node *codec_of_node;
  692. const char *platform_name; /* for multi-platform */
  693. const struct device_node *platform_of_node;
  694. const char *cpu_dai_name;
  695. const struct device_node *cpu_dai_of_node;
  696. const char *codec_dai_name;
  697. const struct snd_soc_pcm_stream *params;
  698. unsigned int dai_fmt; /* format to set on init */
  699. /* Keep DAI active over suspend */
  700. unsigned int ignore_suspend:1;
  701. /* Symmetry requirements */
  702. unsigned int symmetric_rates:1;
  703. /* pmdown_time is ignored at stop */
  704. unsigned int ignore_pmdown_time:1;
  705. /* codec/machine specific init - e.g. add machine controls */
  706. int (*init)(struct snd_soc_pcm_runtime *rtd);
  707. /* machine stream operations */
  708. struct snd_soc_ops *ops;
  709. };
  710. struct snd_soc_codec_conf {
  711. const char *dev_name;
  712. /*
  713. * optional map of kcontrol, widget and path name prefixes that are
  714. * associated per device
  715. */
  716. const char *name_prefix;
  717. /*
  718. * set this to the desired compression type if you want to
  719. * override the one supplied in codec->driver->compress_type
  720. */
  721. enum snd_soc_compress_type compress_type;
  722. };
  723. struct snd_soc_aux_dev {
  724. const char *name; /* Codec name */
  725. const char *codec_name; /* for multi-codec */
  726. /* codec/machine specific init - e.g. add machine controls */
  727. int (*init)(struct snd_soc_dapm_context *dapm);
  728. };
  729. /* SoC card */
  730. struct snd_soc_card {
  731. const char *name;
  732. const char *long_name;
  733. const char *driver_name;
  734. struct device *dev;
  735. struct snd_card *snd_card;
  736. struct module *owner;
  737. struct list_head list;
  738. struct mutex mutex;
  739. struct mutex dapm_mutex;
  740. bool instantiated;
  741. int (*probe)(struct snd_soc_card *card);
  742. int (*late_probe)(struct snd_soc_card *card);
  743. int (*remove)(struct snd_soc_card *card);
  744. /* the pre and post PM functions are used to do any PM work before and
  745. * after the codec and DAI's do any PM work. */
  746. int (*suspend_pre)(struct snd_soc_card *card);
  747. int (*suspend_post)(struct snd_soc_card *card);
  748. int (*resume_pre)(struct snd_soc_card *card);
  749. int (*resume_post)(struct snd_soc_card *card);
  750. /* callbacks */
  751. int (*set_bias_level)(struct snd_soc_card *,
  752. struct snd_soc_dapm_context *dapm,
  753. enum snd_soc_bias_level level);
  754. int (*set_bias_level_post)(struct snd_soc_card *,
  755. struct snd_soc_dapm_context *dapm,
  756. enum snd_soc_bias_level level);
  757. long pmdown_time;
  758. /* CPU <--> Codec DAI links */
  759. struct snd_soc_dai_link *dai_link;
  760. int num_links;
  761. struct snd_soc_pcm_runtime *rtd;
  762. int num_rtd;
  763. /* optional codec specific configuration */
  764. struct snd_soc_codec_conf *codec_conf;
  765. int num_configs;
  766. /*
  767. * optional auxiliary devices such as amplifiers or codecs with DAI
  768. * link unused
  769. */
  770. struct snd_soc_aux_dev *aux_dev;
  771. int num_aux_devs;
  772. struct snd_soc_pcm_runtime *rtd_aux;
  773. int num_aux_rtd;
  774. const struct snd_kcontrol_new *controls;
  775. int num_controls;
  776. /*
  777. * Card-specific routes and widgets.
  778. */
  779. const struct snd_soc_dapm_widget *dapm_widgets;
  780. int num_dapm_widgets;
  781. const struct snd_soc_dapm_route *dapm_routes;
  782. int num_dapm_routes;
  783. bool fully_routed;
  784. struct work_struct deferred_resume_work;
  785. /* lists of probed devices belonging to this card */
  786. struct list_head codec_dev_list;
  787. struct list_head platform_dev_list;
  788. struct list_head dai_dev_list;
  789. struct list_head widgets;
  790. struct list_head paths;
  791. struct list_head dapm_list;
  792. struct list_head dapm_dirty;
  793. /* Generic DAPM context for the card */
  794. struct snd_soc_dapm_context dapm;
  795. struct snd_soc_dapm_stats dapm_stats;
  796. #ifdef CONFIG_DEBUG_FS
  797. struct dentry *debugfs_card_root;
  798. struct dentry *debugfs_pop_time;
  799. #endif
  800. u32 pop_time;
  801. void *drvdata;
  802. };
  803. /* SoC machine DAI configuration, glues a codec and cpu DAI together */
  804. struct snd_soc_pcm_runtime {
  805. struct device *dev;
  806. struct snd_soc_card *card;
  807. struct snd_soc_dai_link *dai_link;
  808. struct mutex pcm_mutex;
  809. enum snd_soc_pcm_subclass pcm_subclass;
  810. struct snd_pcm_ops ops;
  811. unsigned int dev_registered:1;
  812. long pmdown_time;
  813. /* runtime devices */
  814. struct snd_pcm *pcm;
  815. struct snd_soc_codec *codec;
  816. struct snd_soc_platform *platform;
  817. struct snd_soc_dai *codec_dai;
  818. struct snd_soc_dai *cpu_dai;
  819. struct delayed_work delayed_work;
  820. };
  821. /* mixer control */
  822. struct soc_mixer_control {
  823. int min, max, platform_max;
  824. unsigned int reg, rreg, shift, rshift, invert;
  825. };
  826. struct soc_bytes {
  827. int base;
  828. int num_regs;
  829. u32 mask;
  830. };
  831. /* enumerated kcontrol */
  832. struct soc_enum {
  833. unsigned short reg;
  834. unsigned short reg2;
  835. unsigned char shift_l;
  836. unsigned char shift_r;
  837. unsigned int max;
  838. unsigned int mask;
  839. const char * const *texts;
  840. const unsigned int *values;
  841. void *dapm;
  842. };
  843. /* codec IO */
  844. unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
  845. unsigned int snd_soc_write(struct snd_soc_codec *codec,
  846. unsigned int reg, unsigned int val);
  847. unsigned int snd_soc_bulk_write_raw(struct snd_soc_codec *codec,
  848. unsigned int reg, const void *data, size_t len);
  849. /* device driver data */
  850. static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
  851. void *data)
  852. {
  853. card->drvdata = data;
  854. }
  855. static inline void *snd_soc_card_get_drvdata(struct snd_soc_card *card)
  856. {
  857. return card->drvdata;
  858. }
  859. static inline void snd_soc_codec_set_drvdata(struct snd_soc_codec *codec,
  860. void *data)
  861. {
  862. dev_set_drvdata(codec->dev, data);
  863. }
  864. static inline void *snd_soc_codec_get_drvdata(struct snd_soc_codec *codec)
  865. {
  866. return dev_get_drvdata(codec->dev);
  867. }
  868. static inline void snd_soc_platform_set_drvdata(struct snd_soc_platform *platform,
  869. void *data)
  870. {
  871. dev_set_drvdata(platform->dev, data);
  872. }
  873. static inline void *snd_soc_platform_get_drvdata(struct snd_soc_platform *platform)
  874. {
  875. return dev_get_drvdata(platform->dev);
  876. }
  877. static inline void snd_soc_pcm_set_drvdata(struct snd_soc_pcm_runtime *rtd,
  878. void *data)
  879. {
  880. dev_set_drvdata(rtd->dev, data);
  881. }
  882. static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd)
  883. {
  884. return dev_get_drvdata(rtd->dev);
  885. }
  886. static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
  887. {
  888. INIT_LIST_HEAD(&card->dai_dev_list);
  889. INIT_LIST_HEAD(&card->codec_dev_list);
  890. INIT_LIST_HEAD(&card->platform_dev_list);
  891. INIT_LIST_HEAD(&card->widgets);
  892. INIT_LIST_HEAD(&card->paths);
  893. INIT_LIST_HEAD(&card->dapm_list);
  894. }
  895. static inline bool snd_soc_volsw_is_stereo(struct soc_mixer_control *mc)
  896. {
  897. if (mc->reg == mc->rreg && mc->shift == mc->rshift)
  898. return 0;
  899. /*
  900. * mc->reg == mc->rreg && mc->shift != mc->rshift, or
  901. * mc->reg != mc->rreg means that the control is
  902. * stereo (bits in one register or in two registers)
  903. */
  904. return 1;
  905. }
  906. int snd_soc_util_init(void);
  907. void snd_soc_util_exit(void);
  908. int snd_soc_of_parse_card_name(struct snd_soc_card *card,
  909. const char *propname);
  910. int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
  911. const char *propname);
  912. #include <sound/soc-dai.h>
  913. #ifdef CONFIG_DEBUG_FS
  914. extern struct dentry *snd_soc_debugfs_root;
  915. #endif
  916. extern const struct dev_pm_ops snd_soc_pm_ops;
  917. #endif