smi_internal.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include <asm/io.h>
  2. /* Define SMI_INTERNAL_CCF_SUPPORT when CCF needs to be enabled */
  3. #if !defined(CONFIG_MTK_CLKMGR)
  4. #define SMI_INTERNAL_CCF_SUPPORT
  5. #endif
  6. #if defined(SMI_INTERNAL_CCF_SUPPORT)
  7. #include <linux/clk.h>
  8. /* for ccf clk CB */
  9. #if defined(SMI_D1)
  10. #include "clk-mt6735-pg.h"
  11. #elif defined(SMI_J)
  12. #include "clk-mt6755-pg.h"
  13. #endif
  14. /* notify clk is enabled/disabled for m4u*/
  15. #include "m4u.h"
  16. #else
  17. #include <mach/mt_clkmgr.h>
  18. #endif /* defined(SMI_INTERNAL_CCF_SUPPORT) */
  19. #include "smi_configuration.h"
  20. #include "smi_common.h"
  21. int smi_larb_clock_is_on(unsigned int larb_index)
  22. {
  23. int result = 0;
  24. #if defined(SMI_INTERNAL_CCF_SUPPORT)
  25. result = 1;
  26. #elif !defined(CONFIG_MTK_FPGA) && !defined(CONFIG_FPGA_EARLY_PORTING)
  27. switch (larb_index) {
  28. case 0:
  29. result = clock_is_on(MT_CG_DISP0_SMI_LARB0);
  30. break;
  31. case 1:
  32. #if defined(SMI_R)
  33. result = clock_is_on(MT_CG_LARB1_SMI_CKPDN);
  34. #else
  35. result = clock_is_on(MT_CG_VDEC1_LARB);
  36. #endif
  37. break;
  38. case 2:
  39. #if !defined(SMI_R)
  40. result = clock_is_on(MT_CG_IMAGE_LARB2_SMI);
  41. #endif
  42. break;
  43. case 3:
  44. #if defined(SMI_D1)
  45. result = clock_is_on(MT_CG_VENC_LARB);
  46. #elif defined(SMI_D3)
  47. result = clock_is_on(MT_CG_VENC_VENC);
  48. #endif
  49. break;
  50. default:
  51. result = 0;
  52. break;
  53. }
  54. #endif /* !defined (CONFIG_MTK_FPGA) && !defined (CONFIG_FPGA_EARLY_PORTING) */
  55. return result;
  56. }