Lines Matching full:pwm
9 #include <zephyr/drivers/pwm.h>
11 #include <reg/pwm.h>
15 /* pwm controller base address */
16 struct pwm_regs *pwm; member
22 /* PWM cycles per second */
26 /* PWM api functions */
30 /* Single channel for each pwm device */ in pwm_kb1200_set_cycles()
38 * Calculate PWM prescaler that let period_cycles map to in pwm_kb1200_set_cycles()
39 * maximum pwm period cycles and won't exceed it. in pwm_kb1200_set_cycles()
47 /* If pulse_cycles is 0, switch PWM off and return. */ in pwm_kb1200_set_cycles()
49 config->pwm->PWMCFG &= ~PWM_ENABLE; in pwm_kb1200_set_cycles()
56 /* Select PWM inverted polarity (ie. active-low pulse). */ in pwm_kb1200_set_cycles()
61 /* Set PWM prescaler. */ in pwm_kb1200_set_cycles()
62 config->pwm->PWMCFG = (config->pwm->PWMCFG & ~GENMASK(13, 8)) | ((prescaler - 1) << 8); in pwm_kb1200_set_cycles()
65 * period_cycles: PWM Cycle Length in pwm_kb1200_set_cycles()
66 * pulse_cycles : PWM High Length in pwm_kb1200_set_cycles()
68 config->pwm->PWMHIGH = high_len; in pwm_kb1200_set_cycles()
69 config->pwm->PWMCYC = cycle_len; in pwm_kb1200_set_cycles()
71 /* Start pwm */ in pwm_kb1200_set_cycles()
72 config->pwm->PWMCFG |= PWM_ENABLE; in pwm_kb1200_set_cycles()
80 /* Single channel for each pwm device */ in pwm_kb1200_get_cycles_per_sec()
93 static DEVICE_API(pwm, pwm_kb1200_driver_api) = {
107 config->pwm->PWMCFG = PWM_SOURCE_CLK_32M | PWM_RULE1 | PWM_PUSHPULL; in pwm_kb1200_init()
115 .pwm = (struct pwm_regs *)DT_INST_REG_ADDR(inst), \