Lines Matching full:pwm

2  * QTests for Nuvoton NPCM7xx PWM Modules.
58 /* MFT (PWM fan) related */
106 typedef struct PWM { struct
111 } PWM; argument
115 const PWM *pwm; member
129 static const PWM pwm_list[] = {
201 /* Returns the index of the PWM module. */
211 /* Returns the index of the PWM entry. */
212 static int pwm_index(const PWM *pwm) in pwm_index() argument
214 ptrdiff_t diff = pwm - pwm_list; in pwm_index()
244 sprintf(path, "/machine/soc/pwm[%d]", module_index); in pwm_get_freq()
255 sprintf(path, "/machine/soc/pwm[%d]", module_index); in pwm_get_duty()
348 /* PWM is stopped. */ in pwm_compute_duty()
398 return extract32(pwm_read(qts, td, PPR), ppr_base[pwm_index(td->pwm)], 8); in pwm_read_ppr()
403 pwm_write(qts, td, PPR, value << ppr_base[pwm_index(td->pwm)]); in pwm_write_ppr()
408 return extract32(pwm_read(qts, td, CSR), csr_base[pwm_index(td->pwm)], 3); in pwm_read_csr()
413 pwm_write(qts, td, CSR, value << csr_base[pwm_index(td->pwm)]); in pwm_write_csr()
418 return extract32(pwm_read(qts, td, PCR), pcr_base[pwm_index(td->pwm)], 4); in pwm_read_pcr()
423 pwm_write(qts, td, PCR, value << pcr_base[pwm_index(td->pwm)]); in pwm_write_pcr()
428 return pwm_read(qts, td, td->pwm->cnr_offset); in pwm_read_cnr()
433 pwm_write(qts, td, td->pwm->cnr_offset, value); in pwm_write_cnr()
438 return pwm_read(qts, td, td->pwm->cmr_offset); in pwm_read_cmr()
443 pwm_write(qts, td, td->pwm->cmr_offset, value); in pwm_write_cmr()
449 pwm_index(td->pwm); in mft_compute_index()
554 /* Check pwm registers can be reset to default value */
560 int pwm = pwm_index(td->pwm); in test_init() local
562 g_assert_cmpuint(pwm_get_freq(qts, module, pwm), ==, 0); in test_init()
563 g_assert_cmpuint(pwm_get_duty(qts, module, pwm), ==, 0); in test_init()
574 int pwm = pwm_index(td->pwm); in test_oneshot() local
591 g_assert_cmpuint(pwm_get_freq(qts, module, pwm), ==, 0); in test_oneshot()
592 g_assert_cmpuint(pwm_get_duty(qts, module, pwm), ==, 0); in test_oneshot()
599 /* In toggle mode, the PWM generates correct outputs. */
605 int pwm = pwm_index(td->pwm); in test_toggle() local
638 g_assert_cmpuint(pwm_get_duty(qts, module, pwm), in test_toggle()
642 g_assert_cmpuint(pwm_get_freq(qts, module, pwm), in test_toggle()
653 g_assert_cmpuint(pwm_get_duty(qts, module, pwm), in test_toggle()
657 g_assert_cmpuint(pwm_get_freq(qts, module, pwm), in test_toggle()
673 "npcm7xx_pwm/module[%d]/pwm[%d]/%s", pwm_module_index(td->module), in pwm_add_test()
674 pwm_index(td->pwm), name); in pwm_add_test()
702 td->pwm = &pwm_list[j]; in main()