soc.h 34 KB

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