wm_adsp.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. struct snd_soc_card *card;
  36. int base;
  37. int sysclk_reg;
  38. int sysclk_mask;
  39. int sysclk_shift;
  40. struct list_head alg_regions;
  41. int fw_id;
  42. const struct wm_adsp_region *mem;
  43. int num_mems;
  44. int fw;
  45. bool running;
  46. struct regulator *dvfs;
  47. struct list_head ctl_list;
  48. struct work_struct boot_work;
  49. };
  50. #define WM_ADSP1(wname, num) \
  51. SND_SOC_DAPM_PGA_E(wname, SND_SOC_NOPM, num, 0, NULL, 0, \
  52. wm_adsp1_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD)
  53. #define WM_ADSP2(wname, num) \
  54. { .id = snd_soc_dapm_dai_link, .name = wname " Preloader", \
  55. .reg = SND_SOC_NOPM, .shift = num, .event = wm_adsp2_early_event, \
  56. .event_flags = SND_SOC_DAPM_PRE_PMU }, \
  57. { .id = snd_soc_dapm_out_drv, .name = wname, \
  58. .reg = SND_SOC_NOPM, .shift = num, .event = wm_adsp2_event, \
  59. .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD }
  60. extern const struct snd_kcontrol_new wm_adsp1_fw_controls[];
  61. extern const struct snd_kcontrol_new wm_adsp2_fw_controls[];
  62. int wm_adsp1_init(struct wm_adsp *adsp);
  63. int wm_adsp2_init(struct wm_adsp *adsp, bool dvfs);
  64. int wm_adsp1_event(struct snd_soc_dapm_widget *w,
  65. struct snd_kcontrol *kcontrol, int event);
  66. int wm_adsp2_early_event(struct snd_soc_dapm_widget *w,
  67. struct snd_kcontrol *kcontrol, int event);
  68. int wm_adsp2_event(struct snd_soc_dapm_widget *w,
  69. struct snd_kcontrol *kcontrol, int event);
  70. #endif