lpass-cdc-comp.c 927 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* Copyright (c) 2020, The Linux Foundation. All rights reserved.
  3. */
  4. #include "lpass-cdc-comp.h"
  5. int lpass_cdc_load_compander_coeff(struct snd_soc_component *component,
  6. u16 lsb_reg, u16 msb_reg,
  7. struct comp_coeff_val *comp_coeff_table,
  8. u16 arr_size)
  9. {
  10. int i = 0;
  11. /* Load Compander Coeff */
  12. for (i = 0; i < arr_size; i++) {
  13. snd_soc_component_write(component, lsb_reg,
  14. comp_coeff_table[i].lsb);
  15. snd_soc_component_write(component, msb_reg,
  16. comp_coeff_table[i].msb);
  17. }
  18. return 0;
  19. }
  20. EXPORT_SYMBOL(lpass_cdc_load_compander_coeff);
  21. int lpass_cdc_update_compander_setting(struct snd_soc_component *component,
  22. u16 start_addr, u8 *reg_val)
  23. {
  24. u16 i = 0;
  25. for (i = 0; i < COMP_MAX_SETTING; i++)
  26. snd_soc_component_write(component,
  27. start_addr + i * 4,
  28. reg_val[i]);
  29. return 0;
  30. }
  31. EXPORT_SYMBOL(lpass_cdc_update_compander_setting);