ubwcp.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  4. */
  5. #ifndef __UBWCP_H_
  6. #define __UBWCP_H_
  7. #include <linux/types.h>
  8. #include <linux/dma-buf.h>
  9. #include "include/uapi/ubwcp_ioctl.h"
  10. typedef int (*configure_mmap)(struct dma_buf *dmabuf, bool linear, phys_addr_t ula_pa_addr,
  11. size_t ula_pa_size);
  12. /**
  13. * Get UBWCP hardware version
  14. *
  15. * @param ver : ptr to ver struct where hw version will be
  16. * copied
  17. *
  18. * @return int : 0 on success, otherwise error code
  19. */
  20. int ubwcp_get_hw_version(struct ubwcp_ioctl_hw_version *ver);
  21. /**
  22. * Configures ubwcp buffer with the provided buffer image
  23. * attributes. This call must be done at least once before
  24. * ubwcp_lock(). Attributes can be configured multiple times,
  25. * but only during unlocked state.
  26. *
  27. * @param dmabuf : ptr to the dma buf
  28. * @param attr : buffer attributes to set
  29. *
  30. * @return int : 0 on success, otherwise error code
  31. */
  32. int ubwcp_set_buf_attrs(struct dma_buf *dmabuf, struct ubwcp_buffer_attrs *attr);
  33. /**
  34. * Get the currently configured attributes for the buffer
  35. *
  36. * @param dmabuf : ptr to the dma buf
  37. * @param attr : pointer to location where image attributes
  38. * for this buffer will be copied to.
  39. *
  40. * @return int : 0 on success, otherwise error code
  41. */
  42. int ubwcp_get_buf_attrs(struct dma_buf *dmabuf, struct ubwcp_buffer_attrs *attr);
  43. /**
  44. * Set permanent range translation for the buffer. This reserves
  45. * ubwcp address translation resources for the buffer until free
  46. * is called. This may speed up lock()/unlock() calls as they
  47. * don't need to configure address translations for the buffer.
  48. *
  49. * @param dmabuf : ptr to the dma buf
  50. * @param enable : true == enable, false == disable
  51. *
  52. * @return int : 0 on success, otherwise error code
  53. */
  54. int ubwcp_set_perm_range_translation(struct dma_buf *dmabuf, bool enable);
  55. #endif /* __UBWCP_H_ */