sst-dsp.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Intel Smart Sound Technology (SST) Core
  4. *
  5. * Copyright (C) 2013, Intel Corporation. All rights reserved.
  6. */
  7. #ifndef __SOUND_SOC_SST_DSP_H
  8. #define __SOUND_SOC_SST_DSP_H
  9. #include <linux/kernel.h>
  10. #include <linux/types.h>
  11. #include <linux/interrupt.h>
  12. struct sst_dsp;
  13. /*
  14. * SST Device.
  15. *
  16. * This structure is populated by the SST core driver.
  17. */
  18. struct sst_dsp_device {
  19. /* Mandatory fields */
  20. struct sst_ops *ops;
  21. irqreturn_t (*thread)(int irq, void *context);
  22. void *thread_context;
  23. };
  24. /* SHIM Read / Write */
  25. void sst_dsp_shim_write(struct sst_dsp *sst, u32 offset, u32 value);
  26. u32 sst_dsp_shim_read(struct sst_dsp *sst, u32 offset);
  27. int sst_dsp_shim_update_bits(struct sst_dsp *sst, u32 offset,
  28. u32 mask, u32 value);
  29. void sst_dsp_shim_update_bits_forced(struct sst_dsp *sst, u32 offset,
  30. u32 mask, u32 value);
  31. /* SHIM Read / Write Unlocked for callers already holding sst lock */
  32. void sst_dsp_shim_write_unlocked(struct sst_dsp *sst, u32 offset, u32 value);
  33. u32 sst_dsp_shim_read_unlocked(struct sst_dsp *sst, u32 offset);
  34. int sst_dsp_shim_update_bits_unlocked(struct sst_dsp *sst, u32 offset,
  35. u32 mask, u32 value);
  36. void sst_dsp_shim_update_bits_forced_unlocked(struct sst_dsp *sst, u32 offset,
  37. u32 mask, u32 value);
  38. /* Internal generic low-level SST IO functions - can be overidden */
  39. void sst_shim32_write(void __iomem *addr, u32 offset, u32 value);
  40. u32 sst_shim32_read(void __iomem *addr, u32 offset);
  41. void sst_shim32_write64(void __iomem *addr, u32 offset, u64 value);
  42. u64 sst_shim32_read64(void __iomem *addr, u32 offset);
  43. /* Mailbox management */
  44. int sst_dsp_mailbox_init(struct sst_dsp *sst, u32 inbox_offset,
  45. size_t inbox_size, u32 outbox_offset, size_t outbox_size);
  46. void sst_dsp_inbox_write(struct sst_dsp *sst, void *message, size_t bytes);
  47. void sst_dsp_inbox_read(struct sst_dsp *sst, void *message, size_t bytes);
  48. void sst_dsp_outbox_write(struct sst_dsp *sst, void *message, size_t bytes);
  49. void sst_dsp_outbox_read(struct sst_dsp *sst, void *message, size_t bytes);
  50. int sst_dsp_register_poll(struct sst_dsp *ctx, u32 offset, u32 mask,
  51. u32 target, u32 time, char *operation);
  52. #endif