Lines Matching refs:config
88 int32_t HiPwmSetConfig(struct PwmDev *pwm, struct PwmConfig *config)
91 if (hp == NULL || hp->reg == NULL || config == NULL) {
92 HDF_LOGE("%s: hp reg or config is null", __func__);
95 if (config->polarity != PWM_NORMAL_POLARITY && config->polarity != PWM_INVERTED_POLARITY) {
96 HDF_LOGE("%s: polarity %hhu is invalid", __func__, config->polarity);
100 if (config->period < PWM_MIN_PERIOD) {
101 HDF_LOGE("%s: period %u is not support, min period %d", __func__, config->period, PWM_MIN_PERIOD);
105 if (config->duty < 1 || config->duty > config->period) {
107 __func__, config->duty, config->period);
112 if (pwm->cfg.polarity != config->polarity && hp->supportPolarity) {
113 HiPwmSetPolarity(hp->reg, config->polarity);
114 HDF_LOGI("%s: [HiPwmSetPolarity] done, polarity: %hhu -> %hhu.", __func__, pwm->cfg.polarity, config->polarity);
116 if (pwm->cfg.period != config->period) {
117 HiPwmSetPeriod(hp->reg, config->period);
118 HDF_LOGI("%s: [HiPwmSetPeriod] done, period: %u -> %u", __func__, pwm->cfg.period, config->period);
120 if (pwm->cfg.duty != config->duty) {
121 HiPwmSetDuty(hp->reg, config->duty);
122 HDF_LOGI("%s: [HiPwmSetDuty] done, duty: %u -> %u", __func__, pwm->cfg.duty, config->duty);
124 if (config->status == PWM_ENABLE_STATUS) {
125 if (config->number == 0) {
129 HiPwmOutputNumberSquareWaves(hp->reg, config->number);
134 __func__, config->number, config->period, config->duty, config->polarity, config->status);