1 /*******************************************************************************
2 * mt6575_pwm.h PWM Drvier
4 * Copyright (c) 2010, Media Teck.inc
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.
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
16 ********************************************************************************
17 * Author : Chagnlei Gao (changlei.gao@mediatek.com)
18 ********************************************************************************
21 #ifndef __MT_PWM_HAL_H__
22 #define __MT_PWM_HAL_H__
24 #include <mach/mt_reg_base.h>
25 #include <mach/mt_typedefs.h>
26 #include <mach/mt_clkmgr.h>
27 #include <mach/mt_gpio.h>
28 #include <mach/irqs.h>
29 #include <mach/upmu_common.h>
30 #include <mach/sync_write.h>
32 /**********************************
34 ***********************************/
51 enum PWM_CON_MODE_BIT
{
56 enum PWM_CON_SRCSEL_BIT
{
61 enum PWM_CON_IDLE_BIT
{
67 enum PWM_CON_GUARD_BIT
{
78 enum PWM_BUF_VALID_BIT
{
88 CLK_BLOCK_BY_1625_OR_32K
93 CLK_DIV1
= CLK_DIV_MIN
,
104 enum PWM_INT_ENABLE_BITS
{
106 PWM1_INT_UNDERFLOW_EN
,
108 PWM2_INT_UNDERFLOW_EN
,
110 PWM3_INT_UNDERFLOW_EN
,
112 PWM4_INT_UNDERFLOW_EN
,
114 PWM5_INT_UNDERFLOW_EN
,
115 PWM_INT_ENABLE_BITS_MAX
,
118 enum PWM_INT_STATUS_BITS
{
120 PWM1_INT_UNDERFLOW_ST
,
122 PWM2_INT_UNDERFLOW_ST
,
124 PWM3_INT_UNDERFLOW_ST
,
126 PWM4_INT_UNDERFLOW_ST
,
128 PWM5_INT_UNDERFLOW_ST
,
129 PWM_INT_STATUS_BITS_MAX
,
132 enum PWM_INT_ACK_BITS
{
134 PWM1_INT_UNDERFLOW_ACK
,
136 PWM2_INT_UNDERFLOW_ACK
,
138 PWM3_INT_UNDERFLOW_ACK
,
140 PWM4_INT_UNDERFLOW_ACK
,
142 PWM5_INT_UNDERFLOW_ACK
,
143 PWM_INT_ACK_BITS_MAX
,
146 enum PWM_CLOCK_SRC_ENUM
{
148 PWM_CLK_OLD_MODE_BLOCK
= PWM_CLK_SRC_MIN
,
149 PWM_CLK_OLD_MODE_32K
,
150 PWM_CLK_NEW_MODE_BLOCK
,
151 PWM_CLK_NEW_MODE_BLOCK_DIV_BY_1625
,
158 PWM_MODE_OLD
= PWM_MODE_MIN
,
166 #define PWM_NEW_MODE_DUTY_TOTAL_BITS 64
168 void mt_set_pwm_3dlcm_enable_hal(BOOL enable
);
169 void mt_set_pwm_3dlcm_inv_hal(U32 pwm_no
, BOOL inv
);
170 void mt_set_pwm_3dlcm_base_hal(U32 pwm_no
);
172 void mt_pwm_26M_clk_enable_hal(U32 enable
);