mtk-smi.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (c) 2014-2015 MediaTek Inc.
  3. * Author: Yong Wu <yong.wu@mediatek.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. */
  14. #ifndef MTK_IOMMU_SMI_H
  15. #define MTK_IOMMU_SMI_H
  16. #include <linux/device.h>
  17. #ifdef CONFIG_MTK_SMI
  18. /*
  19. * Record the iommu info for each port in the local arbiter.
  20. * It is only for iommu.
  21. *
  22. * Returns 0 if successfully, others if failed.
  23. */
  24. int mtk_smi_config_port(struct device *larbdev, unsigned int larbportid,
  25. bool enable);
  26. /*
  27. * The two function below config iommu and enable/disable the clock
  28. * for the larb.
  29. *
  30. * mtk_smi_larb_get must be called before the multimedia HW work.
  31. * mtk_smi_larb_put must be called after HW done.
  32. * Both should be called in non-atomic context.
  33. *
  34. * Returns 0 if successfully, others if failed.
  35. */
  36. int mtk_smi_larb_get(struct device *larbdev);
  37. void mtk_smi_larb_put(struct device *larbdev);
  38. #else
  39. static int
  40. mtk_smi_config_port(struct device *larbdev, unsigned int larbportid,
  41. bool enable)
  42. {
  43. return 0;
  44. }
  45. static inline int mtk_smi_larb_get(struct device *larbdev)
  46. {
  47. return 0;
  48. }
  49. static inline void mtk_smi_larb_put(struct device *larbdev) { }
  50. #endif
  51. #endif