36 #ifndef __MHAL_PWM_H__
37 #define __MHAL_PWM_H__
39 #include "mhal_osai.h"
116 #define PWM_EPARAMETER 2
124 #define PWM_ETIMEOUT 6
129 #define MAX_GROUP_NUM 3
353 u32 channel_bit_map);
368 u32 channel_bit_map);
u32 total_count
PWM total count calculator according to PWM frequency and clock.
Definition: mhal_pwm.h:248
int mtk_mhal_pwm_dpsel(struct mtk_pwm_controller *ctlr, pwm_channels channel_num)
This function is used to set PWM channel's differential mode.
int mtk_mhal_pwm_get_duty_cycle(struct mtk_pwm_controller *ctlr, pwm_channels channel_num)
This function is used to get the current duty cycle of the PWM.
u32 current_frequency
PWM hardware current's output frequency.
Definition: mhal_pwm.h:252
PWM status is busy.
Definition: mhal_pwm.h:161
u32 frequency
PWM output frequency.
Definition: mhal_pwm.h:246
u8 replay_mode
Enable replay mode or one shot mode.
Definition: mhal_pwm.h:240
PWM channel0 bit map.
Definition: mhal_pwm.h:145
PWM channel2 bit map.
Definition: mhal_pwm.h:149
int mtk_mhal_pwm_global_kick(struct mtk_pwm_controller *ctlr)
This function is used to reset PWM hardware by group.
int mtk_mhal_pwm_start(struct mtk_pwm_controller *ctlr, pwm_channels channel_num)
This function is used to start the PWM hardware.
void __iomem * base
PWM controller base address.
Definition: mhal_pwm.h:268
PWM max channel <invalid>
Definition: mhal_pwm.h:189
int mtk_mhal_pwm_feature_enable(struct mtk_pwm_controller *ctlr, pwm_channels channel_num)
This function is used to select PWM global kick, IO ctrl, polarity setting.
PWM differential mode select PWM channel3.
Definition: mhal_pwm.h:173
char group_number
PWM controller group number.
Definition: mhal_pwm.h:270
PWM differential mode select PWM channel2.
Definition: mhal_pwm.h:171
u32 current_duty_cycle
PWM hardware current's output duty cycle,typical value(0~100)
Definition: mhal_pwm.h:250
int mtk_mhal_pwm_kick(struct mtk_pwm_controller *ctlr, pwm_channels channel_num)
This function is used to kick PWM hardware output waveform in 2-state mode.
32K clock source
Definition: mhal_pwm.h:194
int mtk_mhal_pwm_deinit(struct mtk_pwm_controller *ctlr, u32 channel_bit_map)
This function is used to de-initialize PWM hardware.
pwm_s0_s1_stages
Definition: mhal_pwm.h:204
pwm_channels
Defines the PWM channel number.
Definition: mhal_pwm.h:180
int mtk_mhal_pwm_set_duty_cycle(struct mtk_pwm_controller *ctlr, pwm_channels channel_num)
This function is used to set PWM duty cycle.
max clock source <invalid>
Definition: mhal_pwm.h:200
int mtk_mhal_pwm_disable_clk(struct mtk_pwm_controller *ctlr, pwm_channels channel_num)
This function is used to disable PWM clock.
u32 s1_stay_cycle
The stay cycles of S1.
Definition: mhal_pwm.h:238
int mtk_mhal_pwm_config_s0_s1_freq_duty(struct mtk_pwm_controller *ctlr, pwm_channels channel_num)
This function is used to set PWM frequency and duty cycle in 2-state mode.
PWM differential mode select max <invalid>
Definition: mhal_pwm.h:175
u32 duty_cycle
PWM duty cycle,typical value(0~100)
Definition: mhal_pwm.h:244
PWM channel1.
Definition: mhal_pwm.h:183
u32 pwm_nums
PWM controller's channel number.
Definition: mhal_pwm.h:230
2M clock source
Definition: mhal_pwm.h:196
int mtk_mhal_pwm_clock_select(struct mtk_pwm_controller *ctlr)
This function is used to select PWM clock source of the PWM controller.
pwm_clks
Definition: mhal_pwm.h:193
PWM channel2.
Definition: mhal_pwm.h:185
PWM max channel <invalid>
Definition: mhal_pwm.h:153
u8 polarity_set
PWM polarity setting.
Definition: mhal_pwm.h:258
PWM channel1 bit map.
Definition: mhal_pwm.h:147
u8 io_ctrl_sel
PWM IO ctrl function setting.
Definition: mhal_pwm.h:256
pwm_differential_select mode
Defines the PWM channel's differential mode.
Definition: mhal_pwm.h:234
PWM channel3.
Definition: mhal_pwm.h:187
int mtk_mhal_pwm_get_running_status(struct mtk_pwm_controller *ctlr, pwm_channels channel_num)
This function is used to get the current status of PWM.
Interface to PWM, used to store the hardware register base address, group information and clock...
Definition: mhal_pwm.h:266
u8 global_kick_enable
PWM group global kick function.
Definition: mhal_pwm.h:254
pwm_s0_s1_stages stage
Select PWM S0 or S1 stage to configure.
Definition: mhal_pwm.h:242
pwm_channels_bit_map
Defines the PWM channel bit map.
Definition: mhal_pwm.h:144
xtal clock source
Definition: mhal_pwm.h:198
pwm_running_status running_status
PWM in busy or idle status.
Definition: mhal_pwm.h:260
int mtk_mhal_pwm_s0_s1_stay_cycle_config(struct mtk_pwm_controller *ctlr, pwm_channels channel_num)
This function is used to set PWM stay cycles of S0 and S1 in 2-state mode.
pwm_clks group_clock
Clock source of this PWM controller.
Definition: mhal_pwm.h:272
max pwm 2-state stage <invalid>
Definition: mhal_pwm.h:209
pwm_differential_select
Defines the PWM channel's differential mode.
Definition: mhal_pwm.h:166
struct mtk_com_pwm_data * data
M-HAL pwm channel common structure information.
Definition: mhal_pwm.h:274
int mtk_mhal_pwm_get_frequency(struct mtk_pwm_controller *ctlr, pwm_channels channel_num)
This function is used to get current frequency of the PWM with the unit of frequency being Hz...
pwm_running_status
Defines the PWM running status.
Definition: mhal_pwm.h:158
PWM channel3 bit map.
Definition: mhal_pwm.h:151
Used to store the PWM base address, group number, clock source, pwm channel common structure informat...
Definition: mhal_pwm.h:226
PWM channel0.
Definition: mhal_pwm.h:181
u32 index
PWM controller's channel index.
Definition: mhal_pwm.h:232
PWM differential mode select PWM channel0.
Definition: mhal_pwm.h:167
int mtk_mhal_pwm_enable_clk(struct mtk_pwm_controller *ctlr, pwm_channels channel_num)
This function is used to enable PWM clock before operating hardware.
S1 stage.
Definition: mhal_pwm.h:207
u32 s0_stay_cycle
The stay cycles of S0.
Definition: mhal_pwm.h:236
int mtk_mhal_pwm_stop(struct mtk_pwm_controller *ctlr, pwm_channels channel_num)
This function is used to stop the PWM hardware.
PWM status is idle.
Definition: mhal_pwm.h:159
const void __iomem * pwm_register
PWM controller register offset by channel.
Definition: mhal_pwm.h:228
int mtk_mhal_pwm_init(struct mtk_pwm_controller *ctlr, u32 channel_bit_map)
This function is used to initialize the PWM hardware.
int mtk_mhal_pwm_set_frequency(struct mtk_pwm_controller *ctlr, pwm_channels channel_num)
This function is used to set PWM frequency.
S0 stage.
Definition: mhal_pwm.h:205
PWM differential mode select PWM channel1.
Definition: mhal_pwm.h:169