cs35l45.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
  1. /* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
  2. /*
  3. * linux/sound/cs35l45.h -- Platform data for CS35L45
  4. *
  5. * Copyright 2019 Cirrus Logic, Inc.
  6. *
  7. * Author: James Schulman <[email protected]>
  8. *
  9. */
  10. #ifndef __CS35L45_H
  11. #define __CS35L45_H
  12. #define CS35L45_NUM_SUPPLIES 2
  13. struct bpe_inst_lvl_config {
  14. bool is_present;
  15. unsigned int thld;
  16. unsigned int attn;
  17. unsigned int atk_rate;
  18. unsigned int hold_time;
  19. unsigned int rls_rate;
  20. };
  21. struct bpe_inst_config {
  22. bool is_present;
  23. struct bpe_inst_lvl_config l0;
  24. struct bpe_inst_lvl_config l1;
  25. struct bpe_inst_lvl_config l2;
  26. struct bpe_inst_lvl_config l3;
  27. };
  28. struct bpe_misc_config {
  29. bool is_present;
  30. unsigned int bpe_inst_bpe_byp;
  31. unsigned int bpe_inst_inf_hold_rls;
  32. unsigned int bpe_inst_l3_byp;
  33. unsigned int bpe_inst_l2_byp;
  34. unsigned int bpe_inst_l1_byp;
  35. unsigned int bpe_mode_sel;
  36. unsigned int bpe_filt_sel;
  37. };
  38. struct bst_bpe_inst_lvl_config {
  39. unsigned int thld;
  40. unsigned int ilim;
  41. unsigned int ss_ilim;
  42. unsigned int atk_rate;
  43. unsigned int hold_time;
  44. unsigned int rls_rate;
  45. };
  46. struct bst_bpe_inst_config {
  47. bool is_present;
  48. struct bst_bpe_inst_lvl_config l0;
  49. struct bst_bpe_inst_lvl_config l1;
  50. struct bst_bpe_inst_lvl_config l2;
  51. struct bst_bpe_inst_lvl_config l3;
  52. struct bst_bpe_inst_lvl_config l4;
  53. };
  54. struct bst_bpe_misc_config {
  55. bool is_present;
  56. unsigned int bst_bpe_inst_inf_hold_rls;
  57. unsigned int bst_bpe_il_lim_mode;
  58. unsigned int bst_bpe_out_opmode_sel;
  59. unsigned int bst_bpe_inst_l3_byp;
  60. unsigned int bst_bpe_inst_l2_byp;
  61. unsigned int bst_bpe_inst_l1_byp;
  62. unsigned int bst_bpe_filt_sel;
  63. };
  64. struct bst_bpe_il_lim_config {
  65. bool is_present;
  66. unsigned int bst_bpe_il_lim_thld_del1;
  67. unsigned int bst_bpe_il_lim_thld_del2;
  68. unsigned int bst_bpe_il_lim1_thld;
  69. unsigned int bst_bpe_il_lim1_dly;
  70. unsigned int bst_bpe_il_lim2_dly;
  71. unsigned int bst_bpe_il_lim_dly_hyst;
  72. unsigned int bst_bpe_il_lim_thld_hyst;
  73. unsigned int bst_bpe_il_lim1_atk_rate;
  74. unsigned int bst_bpe_il_lim2_atk_rate;
  75. unsigned int bst_bpe_il_lim1_rls_rate;
  76. unsigned int bst_bpe_il_lim2_rls_rate;
  77. };
  78. struct hvlv_config {
  79. bool is_present;
  80. unsigned int hvlv_thld_hys;
  81. unsigned int hvlv_thld;
  82. unsigned int hvlv_dly;
  83. };
  84. struct ldpm_config {
  85. bool is_present;
  86. unsigned int ldpm_gp1_boost_sel;
  87. unsigned int ldpm_gp1_amp_sel;
  88. unsigned int ldpm_gp1_delay;
  89. unsigned int ldpm_gp1_pcm_thld;
  90. unsigned int ldpm_gp2_imon_sel;
  91. unsigned int ldpm_gp2_vmon_sel;
  92. unsigned int ldpm_gp2_delay;
  93. unsigned int ldpm_gp2_pcm_thld;
  94. };
  95. struct classh_config {
  96. bool is_present;
  97. unsigned int ch_hdrm;
  98. unsigned int ch_ratio;
  99. unsigned int ch_rel_rate;
  100. unsigned int ch_ovb_thld1;
  101. unsigned int ch_ovb_thlddelta;
  102. unsigned int ch_vdd_bst_max;
  103. unsigned int ch_ovb_ratio;
  104. unsigned int ch_thld1_offset;
  105. unsigned int aud_mem_depth;
  106. };
  107. struct gpio_ctrl {
  108. bool is_present;
  109. unsigned int dir;
  110. unsigned int lvl;
  111. unsigned int op_cfg;
  112. unsigned int pol;
  113. unsigned int ctrl;
  114. unsigned int invert;
  115. };
  116. struct cs35l45_irq_bit_monitor {
  117. unsigned int bitmask;
  118. const char *description;
  119. const char *info_msg;
  120. const char *dbg_msg;
  121. const char *warn_msg;
  122. const char *err_msg;
  123. int (*callback)(struct cs35l45_private *cs35l45);
  124. };
  125. struct cs35l45_irq_monitor {
  126. unsigned int reg;
  127. unsigned int mask;
  128. unsigned int nbits;
  129. struct cs35l45_irq_bit_monitor *bits;
  130. };
  131. #if IS_ENABLED(CONFIG_SND_SOC_CIRRUS_AMP)
  132. struct pwr_params_config {
  133. bool is_present;
  134. bool global_en;
  135. unsigned int target_temp;
  136. unsigned int exit_temp;
  137. };
  138. #endif
  139. struct cs35l45_platform_data {
  140. struct bpe_inst_config bpe_inst_cfg;
  141. struct bpe_misc_config bpe_misc_cfg;
  142. struct bst_bpe_inst_config bst_bpe_inst_cfg;
  143. struct bst_bpe_misc_config bst_bpe_misc_cfg;
  144. struct bst_bpe_il_lim_config bst_bpe_il_lim_cfg;
  145. struct hvlv_config hvlv_cfg;
  146. struct ldpm_config ldpm_cfg;
  147. struct classh_config classh_cfg;
  148. struct gpio_ctrl gpio_ctrl1;
  149. struct gpio_ctrl gpio_ctrl2;
  150. struct gpio_ctrl gpio_ctrl3;
  151. const char *dsp_part_name;
  152. unsigned int asp_sdout_hiz_ctrl;
  153. unsigned int ngate_ch1_hold;
  154. unsigned int ngate_ch1_thr;
  155. unsigned int ngate_ch2_hold;
  156. unsigned int ngate_ch2_thr;
  157. bool use_tdm_slots;
  158. bool allow_hibernate;
  159. #if IS_ENABLED(CONFIG_SND_SOC_CIRRUS_AMP)
  160. struct pwr_params_config pwr_params_cfg;
  161. const char *mfd_suffix;
  162. unsigned int bd_max_temp;
  163. #endif
  164. };
  165. struct cs35l45_compr {
  166. struct wm_adsp *dsp;
  167. struct snd_compr_stream *stream;
  168. struct snd_compressed_buffer size;
  169. struct work_struct start_work;
  170. struct work_struct stop_work;
  171. u32 *raw_buf;
  172. unsigned int copied_total;
  173. unsigned int sample_rate;
  174. int read_index;
  175. int last_read_index;
  176. int buffer_size;
  177. int avail;
  178. int buffer_count;
  179. };
  180. struct cs35l45_private {
  181. struct wm_adsp dsp; /* needs to be first member */
  182. struct device *dev;
  183. struct regmap *regmap;
  184. struct gpio_desc *reset_gpio;
  185. struct regulator_bulk_data supplies[CS35L45_NUM_SUPPLIES];
  186. struct cs35l45_platform_data pdata;
  187. struct cs35l45_compr *compr;
  188. struct work_struct dsp_pmu_work;
  189. struct work_struct dsp_pmd_work;
  190. struct delayed_work hb_work;
  191. struct workqueue_struct *wq;
  192. struct mutex dsp_power_lock;
  193. struct mutex hb_lock;
  194. struct completion virt2_mbox_comp;
  195. struct regmap_irq_chip_data *irq_data;
  196. enum control_bus_type bus_type;
  197. bool initialized;
  198. bool hibernate_state;
  199. unsigned int fast_switch_requested;
  200. unsigned int fast_switch_applied;
  201. unsigned int i2c_addr;
  202. unsigned int speaker_status;
  203. int irq;
  204. int slot_width;
  205. int amplifier_mode;
  206. int hibernate_mode;
  207. int max_quirks_read_nwords;
  208. struct snd_soc_component *component;
  209. };
  210. int cs35l45_initialize(struct cs35l45_private *cs35l45);
  211. int cs35l45_probe(struct cs35l45_private *cs35l45);
  212. int cs35l45_remove(struct cs35l45_private *cs35l45);
  213. struct of_entry {
  214. const char *name;
  215. unsigned int reg;
  216. unsigned int mask;
  217. unsigned int shift;
  218. };
  219. #define BPE_INST_LEVELS 4
  220. enum bst_bpe_inst_level {
  221. L0 = 0,
  222. L1,
  223. L2,
  224. L3,
  225. L4,
  226. BST_BPE_INST_LEVELS
  227. };
  228. enum bpe_inst_of_param {
  229. BPE_INST_THLD = 0,
  230. BPE_INST_ATTN,
  231. BPE_INST_ATK_RATE,
  232. BPE_INST_HOLD_TIME,
  233. BPE_INST_RLS_RATE,
  234. BPE_INST_PARAMS
  235. };
  236. enum bpe_misc_of_param {
  237. BPE_INST_BPE_BYP = 0,
  238. BPE_INST_INF_HOLD_RLS,
  239. BPE_INST_L3_BYP,
  240. BPE_INST_L2_BYP,
  241. BPE_INST_L1_BYP,
  242. BPE_MODE_SEL,
  243. BPE_FILT_SEL,
  244. BPE_MISC_PARAMS
  245. };
  246. enum bst_bpe_inst_of_param {
  247. BST_BPE_INST_THLD = 0,
  248. BST_BPE_INST_ILIM,
  249. BST_BPE_INST_SS_ILIM,
  250. BST_BPE_INST_ATK_RATE,
  251. BST_BPE_INST_HOLD_TIME,
  252. BST_BPE_INST_RLS_RATE,
  253. BST_BPE_INST_PARAMS
  254. };
  255. enum bst_bpe_misc_of_param {
  256. BST_BPE_INST_INF_HOLD_RLS = 0,
  257. BST_BPE_IL_LIM_MODE,
  258. BST_BPE_OUT_OPMODE_SEL,
  259. BST_BPE_INST_L3_BYP,
  260. BST_BPE_INST_L2_BYP,
  261. BST_BPE_INST_L1_BYP,
  262. BST_BPE_FILT_SEL,
  263. BST_BPE_MISC_PARAMS
  264. };
  265. enum bst_bpe_il_lim_of_param {
  266. BST_BPE_IL_LIM_THLD_DEL1 = 0,
  267. BST_BPE_IL_LIM_THLD_DEL2,
  268. BST_BPE_IL_LIM1_THLD,
  269. BST_BPE_IL_LIM1_DLY,
  270. BST_BPE_IL_LIM2_DLY,
  271. BST_BPE_IL_LIM_DLY_HYST,
  272. BST_BPE_IL_LIM_THLD_HYST,
  273. BST_BPE_IL_LIM1_ATK_RATE,
  274. BST_BPE_IL_LIM2_ATK_RATE,
  275. BST_BPE_IL_LIM1_RLS_RATE,
  276. BST_BPE_IL_LIM2_RLS_RATE,
  277. BST_BPE_IL_LIM_PARAMS
  278. };
  279. enum ldpm_of_param {
  280. LDPM_GP1_BOOST_SEL = 0,
  281. LDPM_GP1_AMP_SEL,
  282. LDPM_GP1_DELAY,
  283. LDPM_GP1_PCM_THLD,
  284. LDPM_GP2_IMON_SEL,
  285. LDPM_GP2_VMON_SEL,
  286. LDPM_GP2_DELAY,
  287. LDPM_GP2_PCM_THLD,
  288. LDPM_PARAMS
  289. };
  290. enum classh_of_param {
  291. CH_HDRM = 0,
  292. CH_RATIO,
  293. CH_REL_RATE,
  294. CH_OVB_THLD1,
  295. CH_OVB_THLDDELTA,
  296. CH_VDD_BST_MAX,
  297. CH_OVB_RATIO,
  298. CH_THLD1_OFFSET,
  299. AUD_MEM_DEPTH,
  300. CLASSH_PARAMS
  301. };
  302. extern const struct of_entry bpe_inst_thld_map[BPE_INST_LEVELS];
  303. extern const struct of_entry bpe_inst_attn_map[BPE_INST_LEVELS];
  304. extern const struct of_entry bpe_inst_atk_rate_map[BPE_INST_LEVELS];
  305. extern const struct of_entry bpe_inst_hold_time_map[BPE_INST_LEVELS];
  306. extern const struct of_entry bpe_inst_rls_rate_map[BPE_INST_LEVELS];
  307. extern const struct of_entry bpe_misc_map[BPE_MISC_PARAMS];
  308. extern const struct of_entry bst_bpe_inst_thld_map[BST_BPE_INST_LEVELS];
  309. extern const struct of_entry bst_bpe_inst_ilim_map[BST_BPE_INST_LEVELS];
  310. extern const struct of_entry bst_bpe_inst_ss_ilim_map[BST_BPE_INST_LEVELS];
  311. extern const struct of_entry bst_bpe_inst_atk_rate_map[BST_BPE_INST_LEVELS];
  312. extern const struct of_entry bst_bpe_inst_hold_time_map[BST_BPE_INST_LEVELS];
  313. extern const struct of_entry bst_bpe_inst_rls_rate_map[BST_BPE_INST_LEVELS];
  314. extern const struct of_entry bst_bpe_misc_map[BST_BPE_MISC_PARAMS];
  315. extern const struct of_entry bst_bpe_il_lim_map[BST_BPE_IL_LIM_PARAMS];
  316. extern const struct of_entry ldpm_map[LDPM_PARAMS];
  317. extern const struct of_entry classh_map[CLASSH_PARAMS];
  318. static inline const struct of_entry *cs35l45_get_bpe_inst_entry(
  319. enum bst_bpe_inst_level level,
  320. enum bpe_inst_of_param param)
  321. {
  322. if ((level < L0) || (level > L3))
  323. return NULL;
  324. switch (param) {
  325. case BPE_INST_THLD:
  326. return &bpe_inst_thld_map[level];
  327. case BPE_INST_ATTN:
  328. return &bpe_inst_attn_map[level];
  329. case BPE_INST_ATK_RATE:
  330. return &bpe_inst_atk_rate_map[level];
  331. case BPE_INST_HOLD_TIME:
  332. return &bpe_inst_hold_time_map[level];
  333. case BPE_INST_RLS_RATE:
  334. return &bpe_inst_rls_rate_map[level];
  335. default:
  336. return NULL;
  337. }
  338. }
  339. static inline u32 *cs35l45_get_bpe_inst_param(
  340. struct cs35l45_private *cs35l45,
  341. enum bst_bpe_inst_level level,
  342. enum bpe_inst_of_param param)
  343. {
  344. struct bpe_inst_lvl_config *cfg;
  345. switch (level) {
  346. case L0:
  347. cfg = &cs35l45->pdata.bpe_inst_cfg.l0;
  348. break;
  349. case L1:
  350. cfg = &cs35l45->pdata.bpe_inst_cfg.l1;
  351. break;
  352. case L2:
  353. cfg = &cs35l45->pdata.bpe_inst_cfg.l2;
  354. break;
  355. case L3:
  356. cfg = &cs35l45->pdata.bpe_inst_cfg.l3;
  357. break;
  358. default:
  359. return NULL;
  360. }
  361. switch (param) {
  362. case BPE_INST_THLD:
  363. return &cfg->thld;
  364. case BPE_INST_ATTN:
  365. return &cfg->attn;
  366. case BPE_INST_ATK_RATE:
  367. return &cfg->atk_rate;
  368. case BPE_INST_HOLD_TIME:
  369. return &cfg->hold_time;
  370. case BPE_INST_RLS_RATE:
  371. return &cfg->rls_rate;
  372. default:
  373. return NULL;
  374. }
  375. }
  376. static inline u32 *cs35l45_get_bpe_misc_param(
  377. struct cs35l45_private *cs35l45,
  378. enum bpe_misc_of_param param)
  379. {
  380. struct bpe_misc_config *cfg = &cs35l45->pdata.bpe_misc_cfg;
  381. switch (param) {
  382. case BPE_INST_BPE_BYP:
  383. return &cfg->bpe_inst_bpe_byp;
  384. case BPE_INST_INF_HOLD_RLS:
  385. return &cfg->bpe_inst_inf_hold_rls;
  386. case BPE_INST_L3_BYP:
  387. return &cfg->bpe_inst_l3_byp;
  388. case BPE_INST_L2_BYP:
  389. return &cfg->bpe_inst_l2_byp;
  390. case BPE_INST_L1_BYP:
  391. return &cfg->bpe_inst_l1_byp;
  392. case BPE_MODE_SEL:
  393. return &cfg->bpe_mode_sel;
  394. case BPE_FILT_SEL:
  395. return &cfg->bpe_filt_sel;
  396. default:
  397. return NULL;
  398. }
  399. }
  400. static inline const struct of_entry *cs35l45_get_bst_bpe_inst_entry(
  401. enum bst_bpe_inst_level level,
  402. enum bst_bpe_inst_of_param param)
  403. {
  404. if ((level < L0) || (level > L4))
  405. return NULL;
  406. switch (param) {
  407. case BST_BPE_INST_THLD:
  408. return &bst_bpe_inst_thld_map[level];
  409. case BST_BPE_INST_ILIM:
  410. return &bst_bpe_inst_ilim_map[level];
  411. case BST_BPE_INST_SS_ILIM:
  412. return &bst_bpe_inst_ss_ilim_map[level];
  413. case BST_BPE_INST_ATK_RATE:
  414. return &bst_bpe_inst_atk_rate_map[level];
  415. case BST_BPE_INST_HOLD_TIME:
  416. return &bst_bpe_inst_hold_time_map[level];
  417. case BST_BPE_INST_RLS_RATE:
  418. return &bst_bpe_inst_rls_rate_map[level];
  419. default:
  420. return NULL;
  421. }
  422. }
  423. static inline u32 *cs35l45_get_bst_bpe_inst_param(
  424. struct cs35l45_private *cs35l45,
  425. enum bst_bpe_inst_level level,
  426. enum bst_bpe_inst_of_param param)
  427. {
  428. struct bst_bpe_inst_lvl_config *cfg;
  429. switch (level) {
  430. case L0:
  431. cfg = &cs35l45->pdata.bst_bpe_inst_cfg.l0;
  432. break;
  433. case L1:
  434. cfg = &cs35l45->pdata.bst_bpe_inst_cfg.l1;
  435. break;
  436. case L2:
  437. cfg = &cs35l45->pdata.bst_bpe_inst_cfg.l2;
  438. break;
  439. case L3:
  440. cfg = &cs35l45->pdata.bst_bpe_inst_cfg.l3;
  441. break;
  442. case L4:
  443. cfg = &cs35l45->pdata.bst_bpe_inst_cfg.l4;
  444. break;
  445. default:
  446. return NULL;
  447. }
  448. switch (param) {
  449. case BST_BPE_INST_THLD:
  450. return &cfg->thld;
  451. case BST_BPE_INST_ILIM:
  452. return &cfg->ilim;
  453. case BST_BPE_INST_SS_ILIM:
  454. return &cfg->ss_ilim;
  455. case BST_BPE_INST_ATK_RATE:
  456. return &cfg->atk_rate;
  457. case BST_BPE_INST_HOLD_TIME:
  458. return &cfg->hold_time;
  459. case BST_BPE_INST_RLS_RATE:
  460. return &cfg->rls_rate;
  461. default:
  462. return NULL;
  463. }
  464. }
  465. static inline u32 *cs35l45_get_bst_bpe_misc_param(
  466. struct cs35l45_private *cs35l45,
  467. enum bst_bpe_misc_of_param param)
  468. {
  469. struct bst_bpe_misc_config *cfg = &cs35l45->pdata.bst_bpe_misc_cfg;
  470. switch (param) {
  471. case BST_BPE_INST_INF_HOLD_RLS:
  472. return &cfg->bst_bpe_inst_inf_hold_rls;
  473. case BST_BPE_IL_LIM_MODE:
  474. return &cfg->bst_bpe_il_lim_mode;
  475. case BST_BPE_OUT_OPMODE_SEL:
  476. return &cfg->bst_bpe_out_opmode_sel;
  477. case BST_BPE_INST_L3_BYP:
  478. return &cfg->bst_bpe_inst_l3_byp;
  479. case BST_BPE_INST_L2_BYP:
  480. return &cfg->bst_bpe_inst_l2_byp;
  481. case BST_BPE_INST_L1_BYP:
  482. return &cfg->bst_bpe_inst_l1_byp;
  483. case BST_BPE_FILT_SEL:
  484. return &cfg->bst_bpe_filt_sel;
  485. default:
  486. return NULL;
  487. }
  488. }
  489. static inline u32 *cs35l45_get_bst_bpe_il_lim_param(
  490. struct cs35l45_private *cs35l45,
  491. enum bst_bpe_il_lim_of_param param)
  492. {
  493. struct bst_bpe_il_lim_config *cfg = &cs35l45->pdata.bst_bpe_il_lim_cfg;
  494. switch (param) {
  495. case BST_BPE_IL_LIM_THLD_DEL1:
  496. return &cfg->bst_bpe_il_lim_thld_del1;
  497. case BST_BPE_IL_LIM_THLD_DEL2:
  498. return &cfg->bst_bpe_il_lim_thld_del2;
  499. case BST_BPE_IL_LIM1_THLD:
  500. return &cfg->bst_bpe_il_lim1_thld;
  501. case BST_BPE_IL_LIM1_DLY:
  502. return &cfg->bst_bpe_il_lim1_dly;
  503. case BST_BPE_IL_LIM2_DLY:
  504. return &cfg->bst_bpe_il_lim2_dly;
  505. case BST_BPE_IL_LIM_DLY_HYST:
  506. return &cfg->bst_bpe_il_lim_dly_hyst;
  507. case BST_BPE_IL_LIM_THLD_HYST:
  508. return &cfg->bst_bpe_il_lim_thld_hyst;
  509. case BST_BPE_IL_LIM1_ATK_RATE:
  510. return &cfg->bst_bpe_il_lim1_atk_rate;
  511. case BST_BPE_IL_LIM2_ATK_RATE:
  512. return &cfg->bst_bpe_il_lim2_atk_rate;
  513. case BST_BPE_IL_LIM1_RLS_RATE:
  514. return &cfg->bst_bpe_il_lim1_rls_rate;
  515. case BST_BPE_IL_LIM2_RLS_RATE:
  516. return &cfg->bst_bpe_il_lim2_rls_rate;
  517. default:
  518. return NULL;
  519. }
  520. }
  521. static inline u32 *cs35l45_get_ldpm_param(struct cs35l45_private *cs35l45,
  522. enum ldpm_of_param param)
  523. {
  524. struct ldpm_config *cfg = &cs35l45->pdata.ldpm_cfg;
  525. switch (param) {
  526. case LDPM_GP1_BOOST_SEL:
  527. return &cfg->ldpm_gp1_boost_sel;
  528. case LDPM_GP1_AMP_SEL:
  529. return &cfg->ldpm_gp1_amp_sel;
  530. case LDPM_GP1_DELAY:
  531. return &cfg->ldpm_gp1_delay;
  532. case LDPM_GP1_PCM_THLD:
  533. return &cfg->ldpm_gp1_pcm_thld;
  534. case LDPM_GP2_IMON_SEL:
  535. return &cfg->ldpm_gp2_imon_sel;
  536. case LDPM_GP2_VMON_SEL:
  537. return &cfg->ldpm_gp2_vmon_sel;
  538. case LDPM_GP2_DELAY:
  539. return &cfg->ldpm_gp2_delay;
  540. case LDPM_GP2_PCM_THLD:
  541. return &cfg->ldpm_gp2_pcm_thld;
  542. default:
  543. return NULL;
  544. }
  545. }
  546. static inline u32 *cs35l45_get_classh_param(struct cs35l45_private *cs35l45,
  547. enum classh_of_param param)
  548. {
  549. struct classh_config *cfg = &cs35l45->pdata.classh_cfg;
  550. switch (param) {
  551. case CH_HDRM:
  552. return &cfg->ch_hdrm;
  553. case CH_RATIO:
  554. return &cfg->ch_ratio;
  555. case CH_REL_RATE:
  556. return &cfg->ch_rel_rate;
  557. case CH_OVB_THLD1:
  558. return &cfg->ch_ovb_thld1;
  559. case CH_OVB_THLDDELTA:
  560. return &cfg->ch_ovb_thlddelta;
  561. case CH_VDD_BST_MAX:
  562. return &cfg->ch_vdd_bst_max;
  563. case CH_OVB_RATIO:
  564. return &cfg->ch_ovb_ratio;
  565. case CH_THLD1_OFFSET:
  566. return &cfg->ch_thld1_offset;
  567. case AUD_MEM_DEPTH:
  568. return &cfg->aud_mem_depth;
  569. default:
  570. return NULL;
  571. }
  572. }
  573. #endif /* __CS35L45_H */