soc.h 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037
  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. unsigned int dai_fmt; /* format to set on init */
  698. /* Keep DAI active over suspend */
  699. unsigned int ignore_suspend:1;
  700. /* Symmetry requirements */
  701. unsigned int symmetric_rates:1;
  702. /* pmdown_time is ignored at stop */
  703. unsigned int ignore_pmdown_time:1;
  704. /* codec/machine specific init - e.g. add machine controls */
  705. int (*init)(struct snd_soc_pcm_runtime *rtd);
  706. /* machine stream operations */
  707. struct snd_soc_ops *ops;
  708. };
  709. struct snd_soc_codec_conf {
  710. const char *dev_name;
  711. /*
  712. * optional map of kcontrol, widget and path name prefixes that are
  713. * associated per device
  714. */
  715. const char *name_prefix;
  716. /*
  717. * set this to the desired compression type if you want to
  718. * override the one supplied in codec->driver->compress_type
  719. */
  720. enum snd_soc_compress_type compress_type;
  721. };
  722. struct snd_soc_aux_dev {
  723. const char *name; /* Codec name */
  724. const char *codec_name; /* for multi-codec */
  725. /* codec/machine specific init - e.g. add machine controls */
  726. int (*init)(struct snd_soc_dapm_context *dapm);
  727. };
  728. /* SoC card */
  729. struct snd_soc_card {
  730. const char *name;
  731. const char *long_name;
  732. const char *driver_name;
  733. struct device *dev;
  734. struct snd_card *snd_card;
  735. struct module *owner;
  736. struct list_head list;
  737. struct mutex mutex;
  738. struct mutex dapm_mutex;
  739. bool instantiated;
  740. int (*probe)(struct snd_soc_card *card);
  741. int (*late_probe)(struct snd_soc_card *card);
  742. int (*remove)(struct snd_soc_card *card);
  743. /* the pre and post PM functions are used to do any PM work before and
  744. * after the codec and DAI's do any PM work. */
  745. int (*suspend_pre)(struct snd_soc_card *card);
  746. int (*suspend_post)(struct snd_soc_card *card);
  747. int (*resume_pre)(struct snd_soc_card *card);
  748. int (*resume_post)(struct snd_soc_card *card);
  749. /* callbacks */
  750. int (*set_bias_level)(struct snd_soc_card *,
  751. struct snd_soc_dapm_context *dapm,
  752. enum snd_soc_bias_level level);
  753. int (*set_bias_level_post)(struct snd_soc_card *,
  754. struct snd_soc_dapm_context *dapm,
  755. enum snd_soc_bias_level level);
  756. long pmdown_time;
  757. /* CPU <--> Codec DAI links */
  758. struct snd_soc_dai_link *dai_link;
  759. int num_links;
  760. struct snd_soc_pcm_runtime *rtd;
  761. int num_rtd;
  762. /* optional codec specific configuration */
  763. struct snd_soc_codec_conf *codec_conf;
  764. int num_configs;
  765. /*
  766. * optional auxiliary devices such as amplifiers or codecs with DAI
  767. * link unused
  768. */
  769. struct snd_soc_aux_dev *aux_dev;
  770. int num_aux_devs;
  771. struct snd_soc_pcm_runtime *rtd_aux;
  772. int num_aux_rtd;
  773. const struct snd_kcontrol_new *controls;
  774. int num_controls;
  775. /*
  776. * Card-specific routes and widgets.
  777. */
  778. const struct snd_soc_dapm_widget *dapm_widgets;
  779. int num_dapm_widgets;
  780. const struct snd_soc_dapm_route *dapm_routes;
  781. int num_dapm_routes;
  782. bool fully_routed;
  783. struct work_struct deferred_resume_work;
  784. /* lists of probed devices belonging to this card */
  785. struct list_head codec_dev_list;
  786. struct list_head platform_dev_list;
  787. struct list_head dai_dev_list;
  788. struct list_head widgets;
  789. struct list_head paths;
  790. struct list_head dapm_list;
  791. struct list_head dapm_dirty;
  792. /* Generic DAPM context for the card */
  793. struct snd_soc_dapm_context dapm;
  794. struct snd_soc_dapm_stats dapm_stats;
  795. #ifdef CONFIG_DEBUG_FS
  796. struct dentry *debugfs_card_root;
  797. struct dentry *debugfs_pop_time;
  798. #endif
  799. u32 pop_time;
  800. void *drvdata;
  801. };
  802. /* SoC machine DAI configuration, glues a codec and cpu DAI together */
  803. struct snd_soc_pcm_runtime {
  804. struct device *dev;
  805. struct snd_soc_card *card;
  806. struct snd_soc_dai_link *dai_link;
  807. struct mutex pcm_mutex;
  808. enum snd_soc_pcm_subclass pcm_subclass;
  809. struct snd_pcm_ops ops;
  810. unsigned int dev_registered:1;
  811. long pmdown_time;
  812. /* runtime devices */
  813. struct snd_pcm *pcm;
  814. struct snd_soc_codec *codec;
  815. struct snd_soc_platform *platform;
  816. struct snd_soc_dai *codec_dai;
  817. struct snd_soc_dai *cpu_dai;
  818. struct delayed_work delayed_work;
  819. };
  820. /* mixer control */
  821. struct soc_mixer_control {
  822. int min, max, platform_max;
  823. unsigned int reg, rreg, shift, rshift, invert;
  824. };
  825. struct soc_bytes {
  826. int base;
  827. int num_regs;
  828. u32 mask;
  829. };
  830. /* enumerated kcontrol */
  831. struct soc_enum {
  832. unsigned short reg;
  833. unsigned short reg2;
  834. unsigned char shift_l;
  835. unsigned char shift_r;
  836. unsigned int max;
  837. unsigned int mask;
  838. const char * const *texts;
  839. const unsigned int *values;
  840. void *dapm;
  841. };
  842. /* codec IO */
  843. unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
  844. unsigned int snd_soc_write(struct snd_soc_codec *codec,
  845. unsigned int reg, unsigned int val);
  846. unsigned int snd_soc_bulk_write_raw(struct snd_soc_codec *codec,
  847. unsigned int reg, const void *data, size_t len);
  848. /* device driver data */
  849. static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
  850. void *data)
  851. {
  852. card->drvdata = data;
  853. }
  854. static inline void *snd_soc_card_get_drvdata(struct snd_soc_card *card)
  855. {
  856. return card->drvdata;
  857. }
  858. static inline void snd_soc_codec_set_drvdata(struct snd_soc_codec *codec,
  859. void *data)
  860. {
  861. dev_set_drvdata(codec->dev, data);
  862. }
  863. static inline void *snd_soc_codec_get_drvdata(struct snd_soc_codec *codec)
  864. {
  865. return dev_get_drvdata(codec->dev);
  866. }
  867. static inline void snd_soc_platform_set_drvdata(struct snd_soc_platform *platform,
  868. void *data)
  869. {
  870. dev_set_drvdata(platform->dev, data);
  871. }
  872. static inline void *snd_soc_platform_get_drvdata(struct snd_soc_platform *platform)
  873. {
  874. return dev_get_drvdata(platform->dev);
  875. }
  876. static inline void snd_soc_pcm_set_drvdata(struct snd_soc_pcm_runtime *rtd,
  877. void *data)
  878. {
  879. dev_set_drvdata(rtd->dev, data);
  880. }
  881. static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd)
  882. {
  883. return dev_get_drvdata(rtd->dev);
  884. }
  885. static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
  886. {
  887. INIT_LIST_HEAD(&card->dai_dev_list);
  888. INIT_LIST_HEAD(&card->codec_dev_list);
  889. INIT_LIST_HEAD(&card->platform_dev_list);
  890. INIT_LIST_HEAD(&card->widgets);
  891. INIT_LIST_HEAD(&card->paths);
  892. INIT_LIST_HEAD(&card->dapm_list);
  893. }
  894. static inline bool snd_soc_volsw_is_stereo(struct soc_mixer_control *mc)
  895. {
  896. if (mc->reg == mc->rreg && mc->shift == mc->rshift)
  897. return 0;
  898. /*
  899. * mc->reg == mc->rreg && mc->shift != mc->rshift, or
  900. * mc->reg != mc->rreg means that the control is
  901. * stereo (bits in one register or in two registers)
  902. */
  903. return 1;
  904. }
  905. int snd_soc_util_init(void);
  906. void snd_soc_util_exit(void);
  907. int snd_soc_of_parse_card_name(struct snd_soc_card *card,
  908. const char *propname);
  909. int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
  910. const char *propname);
  911. #include <sound/soc-dai.h>
  912. #ifdef CONFIG_DEBUG_FS
  913. extern struct dentry *snd_soc_debugfs_root;
  914. #endif
  915. extern const struct dev_pm_ops snd_soc_pm_ops;
  916. #endif