mt_pwm.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*******************************************************************************
  2. * mt6575_pwm.h PWM Drvier
  3. *
  4. * Copyright (c) 2010, Media Teck.inc
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms and conditions of the GNU General Public Licence,
  8. * version 2, as publish by the Free Software Foundation.
  9. *
  10. * This program is distributed and in hope it will be useful, but WITHOUT
  11. * ANY WARRNTY; without even the implied warranty of MERCHANTABITLITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. *
  15. */
  16. #ifndef __MT_PWM_H__
  17. #define __MT_PWM_H__
  18. #include <linux/types.h>
  19. #include <mach/mt_pwm_hal.h>
  20. struct pwm_easy_config {
  21. u32 pwm_no;
  22. u32 duty;
  23. u32 clk_src;
  24. u32 clk_div;
  25. u16 duration;
  26. u8 pmic_pad;
  27. };
  28. struct pwm_spec_config {
  29. u32 pwm_no;
  30. u32 mode;
  31. u32 clk_div;
  32. u32 clk_src;
  33. u8 intr;
  34. u8 pmic_pad;
  35. union {
  36. /* for old mode */
  37. struct _PWM_OLDMODE_REGS {
  38. u16 IDLE_VALUE;
  39. u16 GUARD_VALUE;
  40. u16 GDURATION;
  41. u16 WAVE_NUM;
  42. u16 DATA_WIDTH;
  43. u16 THRESH;
  44. } PWM_MODE_OLD_REGS;
  45. /* for fifo mode */
  46. struct _PWM_MODE_FIFO_REGS {
  47. u32 IDLE_VALUE;
  48. u32 GUARD_VALUE;
  49. u32 STOP_BITPOS_VALUE;
  50. u16 HDURATION;
  51. u16 LDURATION;
  52. u32 GDURATION;
  53. u32 SEND_DATA0;
  54. u32 SEND_DATA1;
  55. u32 WAVE_NUM;
  56. } PWM_MODE_FIFO_REGS;
  57. /* for memory mode */
  58. struct _PWM_MODE_MEMORY_REGS {
  59. u32 IDLE_VALUE;
  60. u32 GUARD_VALUE;
  61. u32 STOP_BITPOS_VALUE;
  62. u16 HDURATION;
  63. u16 LDURATION;
  64. u16 GDURATION;
  65. u32 *BUF0_BASE_ADDR;
  66. u32 BUF0_SIZE;
  67. u16 WAVE_NUM;
  68. } PWM_MODE_MEMORY_REGS;
  69. /* for RANDOM mode */
  70. struct _PWM_MODE_RANDOM_REGS {
  71. u16 IDLE_VALUE;
  72. u16 GUARD_VALUE;
  73. u32 STOP_BITPOS_VALUE;
  74. u16 HDURATION;
  75. u16 LDURATION;
  76. u16 GDURATION;
  77. u32 *BUF0_BASE_ADDR;
  78. u32 BUF0_SIZE;
  79. u32 *BUF1_BASE_ADDR;
  80. u32 BUF1_SIZE;
  81. u16 WAVE_NUM;
  82. u32 VALID;
  83. } PWM_MODE_RANDOM_REGS;
  84. /* for seq mode */
  85. struct _PWM_MODE_DELAY_REGS {
  86. /* u32 ENABLE_DELAY_VALUE; */
  87. u16 PWM3_DELAY_DUR;
  88. u32 PWM3_DELAY_CLK; /* 0: block clock source, 1: block/1625 clock source */
  89. u16 PWM4_DELAY_DUR;
  90. u32 PWM4_DELAY_CLK;
  91. u16 PWM5_DELAY_DUR;
  92. u32 PWM5_DELAY_CLK;
  93. } PWM_MODE_DELAY_REGS;
  94. };
  95. };
  96. s32 pwm_set_easy_config(struct pwm_easy_config *conf);
  97. s32 pwm_set_spec_config(struct pwm_spec_config *conf);
  98. void mt_pwm_dump_regs(void);
  99. void mt_pwm_disable(u32 pwm_no, u8 pmic_pad);
  100. /*----------3dLCM support-----------*/
  101. void mt_set_pwm_3dlcm_enable(u8 enable);
  102. /*
  103. set "pwm_no" inversion of pwm base or not
  104. */
  105. void mt_set_pwm_3dlcm_inv(u32 pwm_no, u8 inv);
  106. /* void mt_set_pwm_3dlcm_base(u32 pwm_no); */
  107. /* void mt_pwm_26M_clk_enable(u32 enable); */
  108. s32 mt_set_intr_ack(u32 pwm_intr_ack_bit);
  109. s32 mt_set_intr_enable(u32 pwm_intr_enable_bit);
  110. s32 mt_get_intr_status(u32 pwm_intr_status_bit);
  111. #endif