aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pwm/pwm-imx27.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pwm/pwm-imx27.c')
-rw-r--r--drivers/pwm/pwm-imx27.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/pwm/pwm-imx27.c b/drivers/pwm/pwm-imx27.c
index 55666cca4cee..806130654211 100644
--- a/drivers/pwm/pwm-imx27.c
+++ b/drivers/pwm/pwm-imx27.c
@@ -125,14 +125,10 @@ static void pwm_imx27_get_state(struct pwm_chip *chip,
125 125
126 val = readl(imx->mmio_base + MX3_PWMCR); 126 val = readl(imx->mmio_base + MX3_PWMCR);
127 127
128 if (val & MX3_PWMCR_EN) { 128 if (val & MX3_PWMCR_EN)
129 state->enabled = true; 129 state->enabled = true;
130 ret = pwm_imx27_clk_prepare_enable(chip); 130 else
131 if (ret)
132 return;
133 } else {
134 state->enabled = false; 131 state->enabled = false;
135 }
136 132
137 switch (FIELD_GET(MX3_PWMCR_POUTC, val)) { 133 switch (FIELD_GET(MX3_PWMCR_POUTC, val)) {
138 case MX3_PWMCR_POUTC_NORMAL: 134 case MX3_PWMCR_POUTC_NORMAL:
@@ -164,7 +160,8 @@ static void pwm_imx27_get_state(struct pwm_chip *chip,
164 state->duty_cycle = 0; 160 state->duty_cycle = 0;
165 } 161 }
166 162
167 pwm_imx27_clk_disable_unprepare(chip); 163 if (!state->enabled)
164 pwm_imx27_clk_disable_unprepare(chip);
168} 165}
169 166
170static void pwm_imx27_sw_reset(struct pwm_chip *chip) 167static void pwm_imx27_sw_reset(struct pwm_chip *chip)