cs35l56.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Common definitions for Cirrus Logic CS35L56 smart amp
  4. *
  5. * Copyright (C) 2023 Cirrus Logic, Inc. and
  6. * Cirrus Logic International Semiconductor Ltd.
  7. */
  8. #ifndef __CS35L56_H
  9. #define __CS35L56_H
  10. #include <linux/bits.h>
  11. #include <linux/debugfs.h>
  12. #include <linux/firmware/cirrus/cs_dsp.h>
  13. #include <linux/regulator/consumer.h>
  14. #include <linux/regmap.h>
  15. #include <linux/spi/spi.h>
  16. #include <sound/cs-amp-lib.h>
  17. struct snd_ctl_elem_value;
  18. #define CS35L56_DEVID 0x0000000
  19. #define CS35L56_REVID 0x0000004
  20. #define CS35L56_RELID 0x000000C
  21. #define CS35L56_OTPID 0x0000010
  22. #define CS35L56_SFT_RESET 0x0000020
  23. #define CS35L56_GLOBAL_ENABLES 0x0002014
  24. #define CS35L56_BLOCK_ENABLES 0x0002018
  25. #define CS35L56_BLOCK_ENABLES2 0x000201C
  26. #define CS35L56_SYNC_GPIO1_CFG 0x0002410
  27. #define CS35L56_ASP2_DIO_GPIO13_CFG 0x0002440
  28. #define CS35L56_UPDATE_REGS 0x0002A0C
  29. #define CS35L56_REFCLK_INPUT 0x0002C04
  30. #define CS35L56_GLOBAL_SAMPLE_RATE 0x0002C0C
  31. #define CS35L56_OTP_MEM_53 0x00300D4
  32. #define CS35L56_OTP_MEM_54 0x00300D8
  33. #define CS35L56_OTP_MEM_55 0x00300DC
  34. #define CS35L56_ASP1_ENABLES1 0x0004800
  35. #define CS35L56_ASP1_CONTROL1 0x0004804
  36. #define CS35L56_ASP1_CONTROL2 0x0004808
  37. #define CS35L56_ASP1_CONTROL3 0x000480C
  38. #define CS35L56_ASP1_FRAME_CONTROL1 0x0004810
  39. #define CS35L56_ASP1_FRAME_CONTROL5 0x0004820
  40. #define CS35L56_ASP1_DATA_CONTROL1 0x0004830
  41. #define CS35L56_ASP1_DATA_CONTROL5 0x0004840
  42. #define CS35L56_DACPCM1_INPUT 0x0004C00
  43. #define CS35L56_DACPCM2_INPUT 0x0004C08
  44. #define CS35L56_ASP1TX1_INPUT 0x0004C20
  45. #define CS35L56_ASP1TX2_INPUT 0x0004C24
  46. #define CS35L56_ASP1TX3_INPUT 0x0004C28
  47. #define CS35L56_ASP1TX4_INPUT 0x0004C2C
  48. #define CS35L56_DSP1RX1_INPUT 0x0004C40
  49. #define CS35L56_DSP1RX2_INPUT 0x0004C44
  50. #define CS35L56_SWIRE_DP3_CH1_INPUT 0x0004C70
  51. #define CS35L56_SWIRE_DP3_CH2_INPUT 0x0004C74
  52. #define CS35L56_SWIRE_DP3_CH3_INPUT 0x0004C78
  53. #define CS35L56_SWIRE_DP3_CH4_INPUT 0x0004C7C
  54. #define CS35L56_IRQ1_CFG 0x000E000
  55. #define CS35L56_IRQ1_STATUS 0x000E004
  56. #define CS35L56_IRQ1_EINT_1 0x000E010
  57. #define CS35L56_IRQ1_EINT_2 0x000E014
  58. #define CS35L56_IRQ1_EINT_4 0x000E01C
  59. #define CS35L56_IRQ1_EINT_8 0x000E02C
  60. #define CS35L56_IRQ1_EINT_18 0x000E054
  61. #define CS35L56_IRQ1_EINT_20 0x000E05C
  62. #define CS35L56_IRQ1_MASK_1 0x000E090
  63. #define CS35L56_IRQ1_MASK_2 0x000E094
  64. #define CS35L56_IRQ1_MASK_4 0x000E09C
  65. #define CS35L56_IRQ1_MASK_8 0x000E0AC
  66. #define CS35L56_IRQ1_MASK_18 0x000E0D4
  67. #define CS35L56_IRQ1_MASK_20 0x000E0DC
  68. #define CS35L56_GPIO_STATUS1 0x000F000
  69. #define CS35L56_GPIO1_CTRL1 0x000F008
  70. #define CS35L56_GPIO13_CTRL1 0x000F038
  71. #define CS35L56_MIXER_NGATE_CH1_CFG 0x0010004
  72. #define CS35L56_MIXER_NGATE_CH2_CFG 0x0010008
  73. #define CS35L56_DSP_MBOX_1_RAW 0x0011000
  74. #define CS35L56_DSP_VIRTUAL1_MBOX_1 0x0011020
  75. #define CS35L56_DSP_VIRTUAL1_MBOX_2 0x0011024
  76. #define CS35L56_DSP_VIRTUAL1_MBOX_3 0x0011028
  77. #define CS35L56_DSP_VIRTUAL1_MBOX_4 0x001102C
  78. #define CS35L56_DSP_VIRTUAL1_MBOX_5 0x0011030
  79. #define CS35L56_DSP_VIRTUAL1_MBOX_6 0x0011034
  80. #define CS35L56_DSP_VIRTUAL1_MBOX_7 0x0011038
  81. #define CS35L56_DSP_VIRTUAL1_MBOX_8 0x001103C
  82. #define CS35L56_DIE_STS1 0x0017040
  83. #define CS35L56_DIE_STS2 0x0017044
  84. #define CS35L56_DSP_RESTRICT_STS1 0x00190F0
  85. #define CS35L56_DSP1_XMEM_PACKED_0 0x2000000
  86. #define CS35L56_DSP1_XMEM_PACKED_6143 0x2005FFC
  87. #define CS35L56_DSP1_XMEM_UNPACKED32_0 0x2400000
  88. #define CS35L56_DSP1_XMEM_UNPACKED32_4095 0x2403FFC
  89. #define CS35L56_DSP1_SYS_INFO_ID 0x25E0000
  90. #define CS35L56_DSP1_SYS_INFO_END 0x25E004C
  91. #define CS35L56_DSP1_AHBM_WINDOW_DEBUG_0 0x25E2040
  92. #define CS35L56_DSP1_AHBM_WINDOW_DEBUG_1 0x25E2044
  93. #define CS35L56_DSP1_XMEM_UNPACKED24_0 0x2800000
  94. #define CS35L56_DSP1_FW_VER 0x2800010
  95. #define CS35L56_DSP1_HALO_STATE 0x28021E0
  96. #define CS35L56_B2_DSP1_HALO_STATE 0x2803D20
  97. #define CS35L56_DSP1_PM_CUR_STATE 0x2804308
  98. #define CS35L56_B2_DSP1_PM_CUR_STATE 0x2804678
  99. #define CS35L56_DSP1_XMEM_UNPACKED24_8191 0x2807FFC
  100. #define CS35L56_DSP1_CORE_BASE 0x2B80000
  101. #define CS35L56_DSP1_SCRATCH1 0x2B805C0
  102. #define CS35L56_DSP1_SCRATCH2 0x2B805C8
  103. #define CS35L56_DSP1_SCRATCH3 0x2B805D0
  104. #define CS35L56_DSP1_SCRATCH4 0x2B805D8
  105. #define CS35L56_DSP1_YMEM_PACKED_0 0x2C00000
  106. #define CS35L56_DSP1_YMEM_PACKED_4604 0x2C047F0
  107. #define CS35L56_DSP1_YMEM_UNPACKED32_0 0x3000000
  108. #define CS35L56_DSP1_YMEM_UNPACKED32_3070 0x3002FF8
  109. #define CS35L56_DSP1_YMEM_UNPACKED24_0 0x3400000
  110. #define CS35L56_MAIN_RENDER_USER_MUTE 0x3400024
  111. #define CS35L56_MAIN_RENDER_USER_VOLUME 0x340002C
  112. #define CS35L56_MAIN_POSTURE_NUMBER 0x3400094
  113. #define CS35L56_PROTECTION_STATUS 0x34000D8
  114. #define CS35L56_TRANSDUCER_ACTUAL_PS 0x3400150
  115. #define CS35L56_DSP1_YMEM_UNPACKED24_6141 0x3405FF4
  116. #define CS35L56_DSP1_PMEM_0 0x3800000
  117. #define CS35L56_DSP1_PMEM_5114 0x3804FE8
  118. #define CS35L63_DSP1_FW_VER CS35L56_DSP1_FW_VER
  119. #define CS35L63_DSP1_HALO_STATE 0x2803C04
  120. #define CS35L63_DSP1_PM_CUR_STATE 0x2804518
  121. #define CS35L63_PROTECTION_STATUS 0x340009C
  122. #define CS35L63_TRANSDUCER_ACTUAL_PS 0x34000F4
  123. #define CS35L63_MAIN_RENDER_USER_MUTE 0x3400020
  124. #define CS35L63_MAIN_RENDER_USER_VOLUME 0x3400028
  125. #define CS35L63_MAIN_POSTURE_NUMBER 0x3400068
  126. /* DEVID */
  127. #define CS35L56_DEVID_MASK 0x00FFFFFF
  128. /* REVID */
  129. #define CS35L56_AREVID_MASK 0x000000F0
  130. #define CS35L56_MTLREVID_MASK 0x0000000F
  131. #define CS35L56_REVID_B0 0x000000B0
  132. /* PAD_INTF */
  133. #define CS35L56_PAD_GPIO_PULL_MASK GENMASK(3, 2)
  134. #define CS35L56_PAD_GPIO_IE BIT(0)
  135. #define CS35L56_PAD_PULL_NONE 0
  136. #define CS35L56_PAD_PULL_UP 1
  137. #define CS35L56_PAD_PULL_DOWN 2
  138. /* UPDATE_REGS */
  139. #define CS35L56_UPDT_GPIO_PRES BIT(6)
  140. /* ASP_ENABLES1 */
  141. #define CS35L56_ASP_RX2_EN_SHIFT 17
  142. #define CS35L56_ASP_RX1_EN_SHIFT 16
  143. #define CS35L56_ASP_TX4_EN_SHIFT 3
  144. #define CS35L56_ASP_TX3_EN_SHIFT 2
  145. #define CS35L56_ASP_TX2_EN_SHIFT 1
  146. #define CS35L56_ASP_TX1_EN_SHIFT 0
  147. /* ASP_CONTROL1 */
  148. #define CS35L56_ASP_BCLK_FREQ_MASK 0x0000003F
  149. #define CS35L56_ASP_BCLK_FREQ_SHIFT 0
  150. /* ASP_CONTROL2 */
  151. #define CS35L56_ASP_RX_WIDTH_MASK 0xFF000000
  152. #define CS35L56_ASP_RX_WIDTH_SHIFT 24
  153. #define CS35L56_ASP_TX_WIDTH_MASK 0x00FF0000
  154. #define CS35L56_ASP_TX_WIDTH_SHIFT 16
  155. #define CS35L56_ASP_FMT_MASK 0x00000700
  156. #define CS35L56_ASP_FMT_SHIFT 8
  157. #define CS35L56_ASP_BCLK_INV_MASK 0x00000040
  158. #define CS35L56_ASP_FSYNC_INV_MASK 0x00000004
  159. /* ASP_CONTROL3 */
  160. #define CS35L56_ASP1_DOUT_HIZ_CTRL_MASK 0x00000003
  161. /* ASP_DATA_CONTROL1 */
  162. #define CS35L56_ASP_TX_WL_MASK 0x0000003F
  163. /* ASP_DATA_CONTROL5 */
  164. #define CS35L56_ASP_RX_WL_MASK 0x0000003F
  165. /* ASPTXn_INPUT */
  166. #define CS35L56_ASP_TXn_SRC_MASK 0x0000007F
  167. /* SWIRETX[1..7]_SRC SDWTXn INPUT */
  168. #define CS35L56_SWIRETXn_SRC_MASK 0x0000007F
  169. /* IRQ1_STATUS */
  170. #define CS35L56_IRQ1_STS_MASK 0x00000001
  171. /* IRQ1_EINT_1 */
  172. #define CS35L56_AMP_SHORT_ERR_EINT1_MASK 0x80000000
  173. /* IRQ1_EINT_2 */
  174. #define CS35L56_DSP_VIRTUAL2_MBOX_WR_EINT1_MASK 0x00200000
  175. /* IRQ1_EINT_4 */
  176. #define CS35L56_OTP_BOOT_DONE_MASK 0x00000002
  177. /* IRQ1_EINT_8 */
  178. #define CS35L56_TEMP_ERR_EINT1_MASK 0x80000000
  179. /* MIXER_NGATE_CHn_CFG */
  180. #define CS35L56_AUX_NGATE_CHn_EN 0x00000001
  181. /* GPIOn_CTRL1 */
  182. #define CS35L56_GPIO_DIR_MASK BIT(31)
  183. #define CS35L56_GPIO_FN_MASK GENMASK(2, 0)
  184. #define CS35L56_GPIO_FN_GPIO 0x00000001
  185. /* Mixer input sources */
  186. #define CS35L56_INPUT_SRC_NONE 0x00
  187. #define CS35L56_INPUT_SRC_ASP1RX1 0x08
  188. #define CS35L56_INPUT_SRC_ASP1RX2 0x09
  189. #define CS35L56_INPUT_SRC_VMON 0x18
  190. #define CS35L56_INPUT_SRC_IMON 0x19
  191. #define CS35L56_INPUT_SRC_ERR_VOL 0x20
  192. #define CS35L56_INPUT_SRC_CLASSH 0x21
  193. #define CS35L56_INPUT_SRC_VDDBMON 0x28
  194. #define CS35L56_INPUT_SRC_VBSTMON 0x29
  195. #define CS35L56_INPUT_SRC_DSP1TX1 0x32
  196. #define CS35L56_INPUT_SRC_DSP1TX2 0x33
  197. #define CS35L56_INPUT_SRC_DSP1TX3 0x34
  198. #define CS35L56_INPUT_SRC_DSP1TX4 0x35
  199. #define CS35L56_INPUT_SRC_DSP1TX5 0x36
  200. #define CS35L56_INPUT_SRC_DSP1TX6 0x37
  201. #define CS35L56_INPUT_SRC_DSP1TX7 0x38
  202. #define CS35L56_INPUT_SRC_DSP1TX8 0x39
  203. #define CS35L56_INPUT_SRC_TEMPMON 0x3A
  204. #define CS35L56_INPUT_SRC_INTERPOLATOR 0x40
  205. #define CS35L56_INPUT_SRC_SWIRE_DP1_CHANNEL1 0x44
  206. #define CS35L56_INPUT_SRC_SWIRE_DP1_CHANNEL2 0x45
  207. #define CS35L56_INPUT_MASK 0x7F
  208. #define CS35L56_NUM_INPUT_SRC 21
  209. /* ASP formats */
  210. #define CS35L56_ASP_FMT_DSP_A 0
  211. #define CS35L56_ASP_FMT_I2S 2
  212. /* ASP HiZ modes */
  213. #define CS35L56_ASP_UNUSED_HIZ_OFF_HIZ 3
  214. /* MAIN_RENDER_ACTUAL_PS */
  215. #define CS35L56_PS0 0
  216. #define CS35L56_PS3 3
  217. /* CS35L56_DSP_RESTRICT_STS1 */
  218. #define CS35L56_RESTRICTED_MASK 0x7
  219. /* CS35L56_MAIN_RENDER_USER_MUTE */
  220. #define CS35L56_MAIN_RENDER_USER_MUTE_MASK 1
  221. /* CS35L56_MAIN_RENDER_USER_VOLUME */
  222. #define CS35L56_MAIN_RENDER_USER_VOLUME_MIN -400
  223. #define CS35L56_MAIN_RENDER_USER_VOLUME_MAX 48
  224. #define CS35L56_MAIN_RENDER_USER_VOLUME_MASK 0x0000FFC0
  225. #define CS35L56_MAIN_RENDER_USER_VOLUME_SHIFT 6
  226. #define CS35L56_MAIN_RENDER_USER_VOLUME_SIGNBIT 9
  227. /* CS35L56_MAIN_POSTURE_NUMBER */
  228. #define CS35L56_MAIN_POSTURE_MIN 0
  229. #define CS35L56_MAIN_POSTURE_MAX 255
  230. #define CS35L56_MAIN_POSTURE_MASK CS35L56_MAIN_POSTURE_MAX
  231. /* CS35L56_PROTECTION_STATUS */
  232. #define CS35L56_FIRMWARE_MISSING BIT(0)
  233. /* Software Values */
  234. #define CS35L56_HALO_STATE_SHUTDOWN 1
  235. #define CS35L56_HALO_STATE_BOOT_DONE 2
  236. #define CS35L56_MBOX_CMD_PING 0x0A000000
  237. #define CS35L56_MBOX_CMD_AUDIO_PLAY 0x0B000001
  238. #define CS35L56_MBOX_CMD_AUDIO_PAUSE 0x0B000002
  239. #define CS35L56_MBOX_CMD_AUDIO_REINIT 0x0B000003
  240. #define CS35L56_MBOX_CMD_AUDIO_CALIBRATION 0x0B000006
  241. #define CS35L56_MBOX_CMD_HIBERNATE_NOW 0x02000001
  242. #define CS35L56_MBOX_CMD_WAKEUP 0x02000002
  243. #define CS35L56_MBOX_CMD_PREVENT_AUTO_HIBERNATE 0x02000003
  244. #define CS35L56_MBOX_CMD_ALLOW_AUTO_HIBERNATE 0x02000004
  245. #define CS35L56_MBOX_CMD_SHUTDOWN 0x02000005
  246. #define CS35L56_MBOX_CMD_SYSTEM_RESET 0x02000007
  247. #define CS35L56_MBOX_TIMEOUT_US 5000
  248. #define CS35L56_MBOX_POLL_US 250
  249. #define CS35L56_PS0_POLL_US 500
  250. #define CS35L56_PS0_TIMEOUT_US 50000
  251. #define CS35L56_PS3_POLL_US 500
  252. #define CS35L56_PS3_TIMEOUT_US 300000
  253. #define CS35L56_CAL_STATUS_SUCCESS 1
  254. #define CS35L56_CAL_STATUS_OUT_OF_RANGE 3
  255. #define CS35L56_CAL_SET_STATUS_UNKNOWN 0
  256. #define CS35L56_CAL_SET_STATUS_DEFAULT 1
  257. #define CS35L56_CAL_SET_STATUS_SET 2
  258. #define CS35L56_CONTROL_PORT_READY_US 2200
  259. #define CS35L56_HALO_STATE_POLL_US 1000
  260. #define CS35L56_HALO_STATE_TIMEOUT_US 250000
  261. #define CS35L56_RESET_PULSE_MIN_US 1100
  262. #define CS35L56_WAKE_HOLD_TIME_US 1000
  263. #define CS35L56_PAD_PULL_SETTLE_US 10
  264. #define CS35L56_CALIBRATION_POLL_US (100 * USEC_PER_MSEC)
  265. #define CS35L56_CALIBRATION_TIMEOUT_US (5 * USEC_PER_SEC)
  266. #define CS35L56_SDW1_PLAYBACK_PORT 1
  267. #define CS35L56_SDW1_CAPTURE_PORT 3
  268. #define CS35L56_NUM_BULK_SUPPLIES 3
  269. #define CS35L56_NUM_DSP_REGIONS 5
  270. #define CS35L56_MAX_GPIO 13
  271. #define CS35L63_MAX_GPIO 9
  272. /* Additional margin for SYSTEM_RESET to control port ready on SPI */
  273. #define CS35L56_SPI_RESET_TO_PORT_READY_US (CS35L56_CONTROL_PORT_READY_US + 2500)
  274. struct cs35l56_spi_payload {
  275. __be32 addr;
  276. __be16 pad;
  277. __be32 value;
  278. } __packed;
  279. static_assert(sizeof(struct cs35l56_spi_payload) == 10);
  280. struct cs35l56_fw_reg {
  281. unsigned int fw_ver;
  282. unsigned int halo_state;
  283. unsigned int pm_cur_stat;
  284. unsigned int prot_sts;
  285. unsigned int transducer_actual_ps;
  286. unsigned int user_mute;
  287. unsigned int user_volume;
  288. unsigned int posture_number;
  289. };
  290. struct cs35l56_cal_debugfs_fops {
  291. const struct debugfs_short_fops calibrate;
  292. const struct debugfs_short_fops cal_temperature;
  293. const struct debugfs_short_fops cal_data;
  294. };
  295. struct cs35l56_base {
  296. struct device *dev;
  297. struct regmap *regmap;
  298. struct cs_dsp *dsp;
  299. int irq;
  300. struct mutex irq_lock;
  301. u8 type;
  302. u8 rev;
  303. bool init_done;
  304. bool fw_patched;
  305. bool secured;
  306. bool can_hibernate;
  307. bool cal_data_valid;
  308. s8 cal_index;
  309. u8 num_amps;
  310. struct cirrus_amp_cal_data cal_data;
  311. struct gpio_desc *reset_gpio;
  312. struct cs35l56_spi_payload *spi_payload_buf;
  313. const struct cs35l56_fw_reg *fw_reg;
  314. const struct cirrus_amp_cal_controls *calibration_controls;
  315. struct dentry *debugfs;
  316. u64 silicon_uid;
  317. u8 onchip_spkid_gpios[5];
  318. u8 num_onchip_spkid_gpios;
  319. u8 onchip_spkid_pulls[5];
  320. u8 num_onchip_spkid_pulls;
  321. };
  322. static inline bool cs35l56_is_otp_register(unsigned int reg)
  323. {
  324. return (reg >> 16) == 3;
  325. }
  326. static inline int cs35l56_init_config_for_spi(struct cs35l56_base *cs35l56,
  327. struct spi_device *spi)
  328. {
  329. cs35l56->spi_payload_buf = devm_kzalloc(&spi->dev,
  330. sizeof(*cs35l56->spi_payload_buf),
  331. GFP_KERNEL | GFP_DMA);
  332. if (!cs35l56->spi_payload_buf)
  333. return -ENOMEM;
  334. return 0;
  335. }
  336. static inline bool cs35l56_is_spi(struct cs35l56_base *cs35l56)
  337. {
  338. return IS_ENABLED(CONFIG_SPI_MASTER) && !!cs35l56->spi_payload_buf;
  339. }
  340. extern const struct regmap_config cs35l56_regmap_i2c;
  341. extern const struct regmap_config cs35l56_regmap_spi;
  342. extern const struct regmap_config cs35l56_regmap_sdw;
  343. extern const struct regmap_config cs35l63_regmap_i2c;
  344. extern const struct regmap_config cs35l63_regmap_sdw;
  345. extern const struct cirrus_amp_cal_controls cs35l56_calibration_controls;
  346. extern const char * const cs35l56_cal_set_status_text[3];
  347. extern const char * const cs35l56_tx_input_texts[CS35L56_NUM_INPUT_SRC];
  348. extern const unsigned int cs35l56_tx_input_values[CS35L56_NUM_INPUT_SRC];
  349. int cs35l56_set_asp_patch(struct cs35l56_base *cs35l56_base);
  350. int cs35l56_set_patch(struct cs35l56_base *cs35l56_base);
  351. int cs35l56_mbox_send(struct cs35l56_base *cs35l56_base, unsigned int command);
  352. int cs35l56_firmware_shutdown(struct cs35l56_base *cs35l56_base);
  353. int cs35l56_wait_for_firmware_boot(struct cs35l56_base *cs35l56_base);
  354. void cs35l56_wait_control_port_ready(void);
  355. void cs35l56_wait_min_reset_pulse(void);
  356. void cs35l56_system_reset(struct cs35l56_base *cs35l56_base, bool is_soundwire);
  357. int cs35l56_irq_request(struct cs35l56_base *cs35l56_base, int irq);
  358. irqreturn_t cs35l56_irq(int irq, void *data);
  359. int cs35l56_is_fw_reload_needed(struct cs35l56_base *cs35l56_base);
  360. int cs35l56_runtime_suspend_common(struct cs35l56_base *cs35l56_base);
  361. int cs35l56_runtime_resume_common(struct cs35l56_base *cs35l56_base, bool is_soundwire);
  362. void cs35l56_init_cs_dsp(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp);
  363. int cs35l56_get_calibration(struct cs35l56_base *cs35l56_base);
  364. int cs35l56_stash_calibration(struct cs35l56_base *cs35l56_base,
  365. const struct cirrus_amp_cal_data *data);
  366. ssize_t cs35l56_calibrate_debugfs_write(struct cs35l56_base *cs35l56_base,
  367. const char __user *from, size_t count,
  368. loff_t *ppos);
  369. ssize_t cs35l56_cal_ambient_debugfs_write(struct cs35l56_base *cs35l56_base,
  370. const char __user *from, size_t count,
  371. loff_t *ppos);
  372. ssize_t cs35l56_cal_data_debugfs_read(struct cs35l56_base *cs35l56_base,
  373. char __user *to, size_t count,
  374. loff_t *ppos);
  375. ssize_t cs35l56_cal_data_debugfs_write(struct cs35l56_base *cs35l56_base,
  376. const char __user *from, size_t count,
  377. loff_t *ppos);
  378. void cs35l56_create_cal_debugfs(struct cs35l56_base *cs35l56_base,
  379. const struct cs35l56_cal_debugfs_fops *fops);
  380. void cs35l56_remove_cal_debugfs(struct cs35l56_base *cs35l56_base);
  381. int cs35l56_cal_set_status_get(struct cs35l56_base *cs35l56_base,
  382. struct snd_ctl_elem_value *uvalue);
  383. int cs35l56_read_prot_status(struct cs35l56_base *cs35l56_base,
  384. bool *fw_missing, unsigned int *fw_version);
  385. void cs35l56_warn_if_firmware_missing(struct cs35l56_base *cs35l56_base);
  386. void cs35l56_log_tuning(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp);
  387. int cs35l56_hw_init(struct cs35l56_base *cs35l56_base);
  388. int cs35l56_get_speaker_id(struct cs35l56_base *cs35l56_base);
  389. int cs35l56_check_and_save_onchip_spkid_gpios(struct cs35l56_base *cs35l56_base,
  390. const u32 *gpios, int num_gpios,
  391. const u32 *pulls, int num_pulls);
  392. int cs35l56_configure_onchip_spkid_pads(struct cs35l56_base *cs35l56_base);
  393. int cs35l56_read_onchip_spkid(struct cs35l56_base *cs35l56_base);
  394. int cs35l56_get_bclk_freq_id(unsigned int freq);
  395. void cs35l56_fill_supply_names(struct regulator_bulk_data *data);
  396. #endif /* ifndef __CS35L56_H */