dsp.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright 2019 NXP
  4. *
  5. * Header file for the DSP IPC implementation
  6. */
  7. #ifndef _IMX_DSP_IPC_H
  8. #define _IMX_DSP_IPC_H
  9. #include <linux/device.h>
  10. #include <linux/types.h>
  11. #include <linux/mailbox_client.h>
  12. #define DSP_MU_CHAN_NUM 4
  13. struct imx_dsp_chan {
  14. struct imx_dsp_ipc *ipc;
  15. struct mbox_client cl;
  16. struct mbox_chan *ch;
  17. char *name;
  18. int idx;
  19. };
  20. struct imx_dsp_ops {
  21. void (*handle_reply)(struct imx_dsp_ipc *ipc);
  22. void (*handle_request)(struct imx_dsp_ipc *ipc);
  23. };
  24. struct imx_dsp_ipc {
  25. /* Host <-> DSP communication uses 2 txdb and 2 rxdb channels */
  26. struct imx_dsp_chan chans[DSP_MU_CHAN_NUM];
  27. struct device *dev;
  28. struct imx_dsp_ops *ops;
  29. void *private_data;
  30. };
  31. static inline void imx_dsp_set_data(struct imx_dsp_ipc *ipc, void *data)
  32. {
  33. if (!ipc)
  34. return;
  35. ipc->private_data = data;
  36. }
  37. static inline void *imx_dsp_get_data(struct imx_dsp_ipc *ipc)
  38. {
  39. if (!ipc)
  40. return NULL;
  41. return ipc->private_data;
  42. }
  43. #if IS_ENABLED(CONFIG_IMX_DSP)
  44. int imx_dsp_ring_doorbell(struct imx_dsp_ipc *dsp, unsigned int chan_idx);
  45. #else
  46. static inline int imx_dsp_ring_doorbell(struct imx_dsp_ipc *ipc,
  47. unsigned int chan_idx)
  48. {
  49. return -ENOTSUPP;
  50. }
  51. #endif
  52. #endif /* _IMX_DSP_IPC_H */