wcd9306.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef WCD9306_H
  13. #define WCD9306_H
  14. #include <sound/soc.h>
  15. #include <sound/jack.h>
  16. #include <sound/apr_audio-v2.h>
  17. #include <linux/mfd/wcd9xxx/wcd9xxx-slimslave.h>
  18. #include "wcd9xxx-mbhc.h"
  19. #include "wcd9xxx-resmgr.h"
  20. #include "wcd9xxx-common.h"
  21. #define TAPAN_NUM_REGISTERS 0x400
  22. #define TAPAN_MAX_REGISTER (TAPAN_NUM_REGISTERS-1)
  23. #define TAPAN_CACHE_SIZE TAPAN_NUM_REGISTERS
  24. #define TAPAN_REG_VAL(reg, val) {reg, 0, val}
  25. #define TAPAN_CDC_ZDET_SUPPORTED true
  26. extern const u8 tapan_reg_readable[TAPAN_CACHE_SIZE];
  27. extern const u8 tapan_reset_reg_defaults[TAPAN_CACHE_SIZE];
  28. struct tapan_codec_dai_data {
  29. u32 rate;
  30. u32 *ch_num;
  31. u32 ch_act;
  32. u32 ch_tot;
  33. };
  34. enum tapan_pid_current {
  35. TAPAN_PID_MIC_2P5_UA,
  36. TAPAN_PID_MIC_5_UA,
  37. TAPAN_PID_MIC_10_UA,
  38. TAPAN_PID_MIC_20_UA,
  39. };
  40. struct tapan_reg_mask_val {
  41. u16 reg;
  42. u8 mask;
  43. u8 val;
  44. };
  45. enum tapan_mbhc_analog_pwr_cfg {
  46. TAPAN_ANALOG_PWR_COLLAPSED = 0,
  47. TAPAN_ANALOG_PWR_ON,
  48. TAPAN_NUM_ANALOG_PWR_CONFIGS,
  49. };
  50. /* Number of input and output Slimbus port */
  51. enum {
  52. TAPAN_RX1 = 0,
  53. TAPAN_RX2,
  54. TAPAN_RX3,
  55. TAPAN_RX4,
  56. TAPAN_RX5,
  57. TAPAN_RX_MAX,
  58. };
  59. enum {
  60. TAPAN_TX1 = 0,
  61. TAPAN_TX2,
  62. TAPAN_TX3,
  63. TAPAN_TX4,
  64. TAPAN_TX5,
  65. TAPAN_TX_MAX,
  66. };
  67. extern int tapan_mclk_enable(struct snd_soc_codec *codec, int mclk_enable,
  68. bool dapm);
  69. extern int tapan_hs_detect(struct snd_soc_codec *codec,
  70. struct wcd9xxx_mbhc_config *mbhc_cfg);
  71. extern void *tapan_get_afe_config(struct snd_soc_codec *codec,
  72. enum afe_config_type config_type);
  73. extern void tapan_event_register(
  74. int (*machine_event_cb)(struct snd_soc_codec *codec,
  75. enum wcd9xxx_codec_event),
  76. struct snd_soc_codec *codec);
  77. extern void tapan_register_mclk_cb(struct snd_soc_codec *codec,
  78. int (*mclk_cb_fn) (struct snd_soc_codec*, int, bool));
  79. #endif