soc.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  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/workqueue.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/kernel.h>
  19. #include <sound/core.h>
  20. #include <sound/pcm.h>
  21. #include <sound/control.h>
  22. #include <sound/ac97_codec.h>
  23. /*
  24. * Convenience kcontrol builders
  25. */
  26. #define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) \
  27. ((unsigned long)&(struct soc_mixer_control) \
  28. {.reg = xreg, .shift = xshift, .rshift = xshift, .max = xmax, \
  29. .invert = xinvert})
  30. #define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \
  31. ((unsigned long)&(struct soc_mixer_control) \
  32. {.reg = xreg, .max = xmax, .invert = xinvert})
  33. #define SOC_SINGLE(xname, reg, shift, max, invert) \
  34. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
  35. .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
  36. .put = snd_soc_put_volsw, \
  37. .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
  38. #define SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
  39. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
  40. .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
  41. SNDRV_CTL_ELEM_ACCESS_READWRITE,\
  42. .tlv.p = (tlv_array), \
  43. .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
  44. .put = snd_soc_put_volsw, \
  45. .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
  46. #define SOC_DOUBLE(xname, xreg, shift_left, shift_right, xmax, xinvert) \
  47. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
  48. .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
  49. .put = snd_soc_put_volsw, \
  50. .private_value = (unsigned long)&(struct soc_mixer_control) \
  51. {.reg = xreg, .shift = shift_left, .rshift = shift_right, \
  52. .max = xmax, .invert = xinvert} }
  53. #define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \
  54. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
  55. .info = snd_soc_info_volsw_2r, \
  56. .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
  57. .private_value = (unsigned long)&(struct soc_mixer_control) \
  58. {.reg = reg_left, .rreg = reg_right, .shift = xshift, \
  59. .max = xmax, .invert = xinvert} }
  60. #define SOC_DOUBLE_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert, tlv_array) \
  61. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
  62. .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
  63. SNDRV_CTL_ELEM_ACCESS_READWRITE,\
  64. .tlv.p = (tlv_array), \
  65. .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
  66. .put = snd_soc_put_volsw, \
  67. .private_value = (unsigned long)&(struct soc_mixer_control) \
  68. {.reg = xreg, .shift = shift_left, .rshift = shift_right,\
  69. .max = xmax, .invert = xinvert} }
  70. #define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \
  71. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
  72. .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
  73. SNDRV_CTL_ELEM_ACCESS_READWRITE,\
  74. .tlv.p = (tlv_array), \
  75. .info = snd_soc_info_volsw_2r, \
  76. .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
  77. .private_value = (unsigned long)&(struct soc_mixer_control) \
  78. {.reg = reg_left, .rreg = reg_right, .shift = xshift, \
  79. .max = xmax, .invert = xinvert} }
  80. #define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
  81. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
  82. .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
  83. SNDRV_CTL_ELEM_ACCESS_READWRITE, \
  84. .tlv.p = (tlv_array), \
  85. .info = snd_soc_info_volsw_s8, .get = snd_soc_get_volsw_s8, \
  86. .put = snd_soc_put_volsw_s8, \
  87. .private_value = (unsigned long)&(struct soc_mixer_control) \
  88. {.reg = xreg, .min = xmin, .max = xmax} }
  89. #define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmax, xtexts) \
  90. { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
  91. .max = xmax, .texts = xtexts }
  92. #define SOC_ENUM_SINGLE(xreg, xshift, xmax, xtexts) \
  93. SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmax, xtexts)
  94. #define SOC_ENUM_SINGLE_EXT(xmax, xtexts) \
  95. { .max = xmax, .texts = xtexts }
  96. #define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xmax, xtexts, xvalues) \
  97. { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
  98. .mask = xmask, .max = xmax, .texts = xtexts, .values = xvalues}
  99. #define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xmax, xtexts, xvalues) \
  100. SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xmax, xtexts, xvalues)
  101. #define SOC_ENUM(xname, xenum) \
  102. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
  103. .info = snd_soc_info_enum_double, \
  104. .get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \
  105. .private_value = (unsigned long)&xenum }
  106. #define SOC_VALUE_ENUM(xname, xenum) \
  107. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
  108. .info = snd_soc_info_enum_double, \
  109. .get = snd_soc_get_value_enum_double, \
  110. .put = snd_soc_put_value_enum_double, \
  111. .private_value = (unsigned long)&xenum }
  112. #define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\
  113. xhandler_get, xhandler_put) \
  114. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
  115. .info = snd_soc_info_volsw, \
  116. .get = xhandler_get, .put = xhandler_put, \
  117. .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) }
  118. #define SOC_DOUBLE_EXT(xname, xreg, shift_left, shift_right, 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 = (unsigned long)&(struct soc_mixer_control) \
  124. {.reg = xreg, .shift = shift_left, .rshift = shift_right, \
  125. .max = xmax, .invert = xinvert} }
  126. #define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\
  127. xhandler_get, xhandler_put, tlv_array) \
  128. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
  129. .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
  130. SNDRV_CTL_ELEM_ACCESS_READWRITE,\
  131. .tlv.p = (tlv_array), \
  132. .info = snd_soc_info_volsw, \
  133. .get = xhandler_get, .put = xhandler_put, \
  134. .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) }
  135. #define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \
  136. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
  137. .info = snd_soc_info_bool_ext, \
  138. .get = xhandler_get, .put = xhandler_put, \
  139. .private_value = xdata }
  140. #define SOC_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) \
  141. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
  142. .info = snd_soc_info_enum_ext, \
  143. .get = xhandler_get, .put = xhandler_put, \
  144. .private_value = (unsigned long)&xenum }
  145. /*
  146. * Bias levels
  147. *
  148. * @ON: Bias is fully on for audio playback and capture operations.
  149. * @PREPARE: Prepare for audio operations. Called before DAPM switching for
  150. * stream start and stop operations.
  151. * @STANDBY: Low power standby state when no playback/capture operations are
  152. * in progress. NOTE: The transition time between STANDBY and ON
  153. * should be as fast as possible and no longer than 10ms.
  154. * @OFF: Power Off. No restrictions on transition times.
  155. */
  156. enum snd_soc_bias_level {
  157. SND_SOC_BIAS_ON,
  158. SND_SOC_BIAS_PREPARE,
  159. SND_SOC_BIAS_STANDBY,
  160. SND_SOC_BIAS_OFF,
  161. };
  162. struct snd_jack;
  163. struct snd_soc_card;
  164. struct snd_soc_device;
  165. struct snd_soc_pcm_stream;
  166. struct snd_soc_ops;
  167. struct snd_soc_dai_mode;
  168. struct snd_soc_pcm_runtime;
  169. struct snd_soc_dai;
  170. struct snd_soc_platform;
  171. struct snd_soc_codec;
  172. struct soc_enum;
  173. struct snd_soc_ac97_ops;
  174. struct snd_soc_jack;
  175. struct snd_soc_jack_pin;
  176. #ifdef CONFIG_GPIOLIB
  177. struct snd_soc_jack_gpio;
  178. #endif
  179. typedef int (*hw_write_t)(void *,const char* ,int);
  180. typedef int (*hw_read_t)(void *,char* ,int);
  181. extern struct snd_ac97_bus_ops soc_ac97_ops;
  182. int snd_soc_register_platform(struct snd_soc_platform *platform);
  183. void snd_soc_unregister_platform(struct snd_soc_platform *platform);
  184. int snd_soc_register_codec(struct snd_soc_codec *codec);
  185. void snd_soc_unregister_codec(struct snd_soc_codec *codec);
  186. /* pcm <-> DAI connect */
  187. void snd_soc_free_pcms(struct snd_soc_device *socdev);
  188. int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid);
  189. int snd_soc_init_card(struct snd_soc_device *socdev);
  190. /* set runtime hw params */
  191. int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
  192. const struct snd_pcm_hardware *hw);
  193. /* Jack reporting */
  194. int snd_soc_jack_new(struct snd_soc_card *card, const char *id, int type,
  195. struct snd_soc_jack *jack);
  196. void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask);
  197. int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
  198. struct snd_soc_jack_pin *pins);
  199. #ifdef CONFIG_GPIOLIB
  200. int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
  201. struct snd_soc_jack_gpio *gpios);
  202. void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
  203. struct snd_soc_jack_gpio *gpios);
  204. #endif
  205. /* codec register bit access */
  206. int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg,
  207. unsigned short mask, unsigned short value);
  208. int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg,
  209. unsigned short mask, unsigned short value);
  210. int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
  211. struct snd_ac97_bus_ops *ops, int num);
  212. void snd_soc_free_ac97_codec(struct snd_soc_codec *codec);
  213. /*
  214. *Controls
  215. */
  216. struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
  217. void *data, char *long_name);
  218. int snd_soc_add_controls(struct snd_soc_codec *codec,
  219. const struct snd_kcontrol_new *controls, int num_controls);
  220. int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
  221. struct snd_ctl_elem_info *uinfo);
  222. int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol,
  223. struct snd_ctl_elem_info *uinfo);
  224. int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol,
  225. struct snd_ctl_elem_value *ucontrol);
  226. int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol,
  227. struct snd_ctl_elem_value *ucontrol);
  228. int snd_soc_get_value_enum_double(struct snd_kcontrol *kcontrol,
  229. struct snd_ctl_elem_value *ucontrol);
  230. int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol,
  231. struct snd_ctl_elem_value *ucontrol);
  232. int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
  233. struct snd_ctl_elem_info *uinfo);
  234. int snd_soc_info_volsw_ext(struct snd_kcontrol *kcontrol,
  235. struct snd_ctl_elem_info *uinfo);
  236. #define snd_soc_info_bool_ext snd_ctl_boolean_mono_info
  237. int snd_soc_get_volsw(struct snd_kcontrol *kcontrol,
  238. struct snd_ctl_elem_value *ucontrol);
  239. int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
  240. struct snd_ctl_elem_value *ucontrol);
  241. int snd_soc_info_volsw_2r(struct snd_kcontrol *kcontrol,
  242. struct snd_ctl_elem_info *uinfo);
  243. int snd_soc_get_volsw_2r(struct snd_kcontrol *kcontrol,
  244. struct snd_ctl_elem_value *ucontrol);
  245. int snd_soc_put_volsw_2r(struct snd_kcontrol *kcontrol,
  246. struct snd_ctl_elem_value *ucontrol);
  247. int snd_soc_info_volsw_s8(struct snd_kcontrol *kcontrol,
  248. struct snd_ctl_elem_info *uinfo);
  249. int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol,
  250. struct snd_ctl_elem_value *ucontrol);
  251. int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
  252. struct snd_ctl_elem_value *ucontrol);
  253. /**
  254. * struct snd_soc_jack_pin - Describes a pin to update based on jack detection
  255. *
  256. * @pin: name of the pin to update
  257. * @mask: bits to check for in reported jack status
  258. * @invert: if non-zero then pin is enabled when status is not reported
  259. */
  260. struct snd_soc_jack_pin {
  261. struct list_head list;
  262. const char *pin;
  263. int mask;
  264. bool invert;
  265. };
  266. /**
  267. * struct snd_soc_jack_gpio - Describes a gpio pin for jack detection
  268. *
  269. * @gpio: gpio number
  270. * @name: gpio name
  271. * @report: value to report when jack detected
  272. * @invert: report presence in low state
  273. * @debouce_time: debouce time in ms
  274. */
  275. #ifdef CONFIG_GPIOLIB
  276. struct snd_soc_jack_gpio {
  277. unsigned int gpio;
  278. const char *name;
  279. int report;
  280. int invert;
  281. int debounce_time;
  282. struct snd_soc_jack *jack;
  283. struct work_struct work;
  284. };
  285. #endif
  286. struct snd_soc_jack {
  287. struct snd_jack *jack;
  288. struct snd_soc_card *card;
  289. struct list_head pins;
  290. int status;
  291. };
  292. /* SoC PCM stream information */
  293. struct snd_soc_pcm_stream {
  294. char *stream_name;
  295. u64 formats; /* SNDRV_PCM_FMTBIT_* */
  296. unsigned int rates; /* SNDRV_PCM_RATE_* */
  297. unsigned int rate_min; /* min rate */
  298. unsigned int rate_max; /* max rate */
  299. unsigned int channels_min; /* min channels */
  300. unsigned int channels_max; /* max channels */
  301. unsigned int active:1; /* stream is in use */
  302. };
  303. /* SoC audio ops */
  304. struct snd_soc_ops {
  305. int (*startup)(struct snd_pcm_substream *);
  306. void (*shutdown)(struct snd_pcm_substream *);
  307. int (*hw_params)(struct snd_pcm_substream *, struct snd_pcm_hw_params *);
  308. int (*hw_free)(struct snd_pcm_substream *);
  309. int (*prepare)(struct snd_pcm_substream *);
  310. int (*trigger)(struct snd_pcm_substream *, int);
  311. };
  312. /* SoC Audio Codec */
  313. struct snd_soc_codec {
  314. char *name;
  315. struct module *owner;
  316. struct mutex mutex;
  317. struct device *dev;
  318. struct snd_soc_device *socdev;
  319. struct list_head list;
  320. /* callbacks */
  321. int (*set_bias_level)(struct snd_soc_codec *,
  322. enum snd_soc_bias_level level);
  323. /* runtime */
  324. struct snd_card *card;
  325. struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
  326. unsigned int active;
  327. unsigned int pcm_devs;
  328. void *private_data;
  329. /* codec IO */
  330. void *control_data; /* codec control (i2c/3wire) data */
  331. unsigned int (*read)(struct snd_soc_codec *, unsigned int);
  332. int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
  333. int (*display_register)(struct snd_soc_codec *, char *,
  334. size_t, unsigned int);
  335. hw_write_t hw_write;
  336. hw_read_t hw_read;
  337. void *reg_cache;
  338. short reg_cache_size;
  339. short reg_cache_step;
  340. /* dapm */
  341. u32 pop_time;
  342. struct list_head dapm_widgets;
  343. struct list_head dapm_paths;
  344. enum snd_soc_bias_level bias_level;
  345. enum snd_soc_bias_level suspend_bias_level;
  346. struct delayed_work delayed_work;
  347. struct list_head up_list;
  348. struct list_head down_list;
  349. /* codec DAI's */
  350. struct snd_soc_dai *dai;
  351. unsigned int num_dai;
  352. #ifdef CONFIG_DEBUG_FS
  353. struct dentry *debugfs_reg;
  354. struct dentry *debugfs_pop_time;
  355. #endif
  356. };
  357. /* codec device */
  358. struct snd_soc_codec_device {
  359. int (*probe)(struct platform_device *pdev);
  360. int (*remove)(struct platform_device *pdev);
  361. int (*suspend)(struct platform_device *pdev, pm_message_t state);
  362. int (*resume)(struct platform_device *pdev);
  363. };
  364. /* SoC platform interface */
  365. struct snd_soc_platform {
  366. char *name;
  367. struct list_head list;
  368. int (*probe)(struct platform_device *pdev);
  369. int (*remove)(struct platform_device *pdev);
  370. int (*suspend)(struct snd_soc_dai *dai);
  371. int (*resume)(struct snd_soc_dai *dai);
  372. /* pcm creation and destruction */
  373. int (*pcm_new)(struct snd_card *, struct snd_soc_dai *,
  374. struct snd_pcm *);
  375. void (*pcm_free)(struct snd_pcm *);
  376. /* platform stream ops */
  377. struct snd_pcm_ops *pcm_ops;
  378. };
  379. /* SoC machine DAI configuration, glues a codec and cpu DAI together */
  380. struct snd_soc_dai_link {
  381. char *name; /* Codec name */
  382. char *stream_name; /* Stream name */
  383. /* DAI */
  384. struct snd_soc_dai *codec_dai;
  385. struct snd_soc_dai *cpu_dai;
  386. /* machine stream operations */
  387. struct snd_soc_ops *ops;
  388. /* codec/machine specific init - e.g. add machine controls */
  389. int (*init)(struct snd_soc_codec *codec);
  390. /* Symmetry requirements */
  391. unsigned int symmetric_rates:1;
  392. /* Symmetry data - only valid if symmetry is being enforced */
  393. unsigned int rate;
  394. /* DAI pcm */
  395. struct snd_pcm *pcm;
  396. };
  397. /* SoC card */
  398. struct snd_soc_card {
  399. char *name;
  400. struct device *dev;
  401. struct list_head list;
  402. int instantiated;
  403. int (*probe)(struct platform_device *pdev);
  404. int (*remove)(struct platform_device *pdev);
  405. /* the pre and post PM functions are used to do any PM work before and
  406. * after the codec and DAI's do any PM work. */
  407. int (*suspend_pre)(struct platform_device *pdev, pm_message_t state);
  408. int (*suspend_post)(struct platform_device *pdev, pm_message_t state);
  409. int (*resume_pre)(struct platform_device *pdev);
  410. int (*resume_post)(struct platform_device *pdev);
  411. /* callbacks */
  412. int (*set_bias_level)(struct snd_soc_card *,
  413. enum snd_soc_bias_level level);
  414. /* CPU <--> Codec DAI links */
  415. struct snd_soc_dai_link *dai_link;
  416. int num_links;
  417. struct snd_soc_device *socdev;
  418. struct snd_soc_codec *codec;
  419. struct snd_soc_platform *platform;
  420. struct delayed_work delayed_work;
  421. struct work_struct deferred_resume_work;
  422. };
  423. /* SoC Device - the audio subsystem */
  424. struct snd_soc_device {
  425. struct device *dev;
  426. struct snd_soc_card *card;
  427. struct snd_soc_codec_device *codec_dev;
  428. void *codec_data;
  429. };
  430. /* runtime channel data */
  431. struct snd_soc_pcm_runtime {
  432. struct snd_soc_dai_link *dai;
  433. struct snd_soc_device *socdev;
  434. };
  435. /* mixer control */
  436. struct soc_mixer_control {
  437. int min, max;
  438. unsigned int reg, rreg, shift, rshift, invert;
  439. };
  440. /* enumerated kcontrol */
  441. struct soc_enum {
  442. unsigned short reg;
  443. unsigned short reg2;
  444. unsigned char shift_l;
  445. unsigned char shift_r;
  446. unsigned int max;
  447. unsigned int mask;
  448. const char **texts;
  449. const unsigned int *values;
  450. void *dapm;
  451. };
  452. /* codec IO */
  453. static inline unsigned int snd_soc_read(struct snd_soc_codec *codec,
  454. unsigned int reg)
  455. {
  456. return codec->read(codec, reg);
  457. }
  458. static inline unsigned int snd_soc_write(struct snd_soc_codec *codec,
  459. unsigned int reg, unsigned int val)
  460. {
  461. return codec->write(codec, reg, val);
  462. }
  463. #include <sound/soc-dai.h>
  464. #endif