wm_adsp.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * wm_adsp.h -- Wolfson ADSP support
  3. *
  4. * Copyright 2012 Wolfson Microelectronics plc
  5. *
  6. * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
  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 __WM_ADSP_H
  13. #define __WM_ADSP_H
  14. #include <sound/soc.h>
  15. #include <sound/soc-dapm.h>
  16. #include "wmfw.h"
  17. struct regulator;
  18. struct wm_adsp_region {
  19. int type;
  20. unsigned int base;
  21. };
  22. struct wm_adsp_alg_region {
  23. struct list_head list;
  24. unsigned int alg;
  25. int type;
  26. unsigned int base;
  27. size_t len;
  28. };
  29. struct wm_adsp {
  30. const char *part;
  31. int num;
  32. int type;
  33. struct device *dev;
  34. struct regmap *regmap;
  35. int base;
  36. int sysclk_reg;
  37. int sysclk_mask;
  38. int sysclk_shift;
  39. struct list_head alg_regions;
  40. int fw_id;
  41. const struct wm_adsp_region *mem;
  42. int num_mems;
  43. int fw;
  44. bool running;
  45. struct regulator *dvfs;
  46. struct wm_coeff *wm_coeff;
  47. };
  48. #define WM_ADSP1(wname, num) \
  49. { .id = snd_soc_dapm_pga, .name = wname, .reg = SND_SOC_NOPM, \
  50. .shift = num, .event = wm_adsp1_event, \
  51. .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD }
  52. #define WM_ADSP2(wname, num) \
  53. { .id = snd_soc_dapm_pga, .name = wname, .reg = SND_SOC_NOPM, \
  54. .shift = num, .event = wm_adsp2_event, \
  55. .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD }
  56. extern const struct snd_kcontrol_new wm_adsp1_fw_controls[];
  57. extern const struct snd_kcontrol_new wm_adsp2_fw_controls[];
  58. int wm_adsp1_init(struct wm_adsp *adsp);
  59. int wm_adsp2_init(struct wm_adsp *adsp, bool dvfs);
  60. int wm_adsp1_event(struct snd_soc_dapm_widget *w,
  61. struct snd_kcontrol *kcontrol, int event);
  62. int wm_adsp2_event(struct snd_soc_dapm_widget *w,
  63. struct snd_kcontrol *kcontrol, int event);
  64. #endif