Commit c637d87a authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Thierry Reding

pwm: fsl-ftm: Use regmap_clear_bits and regmap_set_bits where applicable

Found using coccinelle and the following semantic patch:

@@
expression map, reg, bits;
@@

- regmap_update_bits(map, reg, bits, bits)
+ regmap_set_bits(map, reg, bits)

@@
expression map, reg, bits;
@@

- regmap_update_bits(map, reg, bits, 0)
+ regmap_clear_bits(map, reg, bits)

Link: https://lore.kernel.org/r/20221115111347.3705732-2-u.kleine-koenig@pengutronix.deSigned-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
parent 55f363e1
...@@ -65,13 +65,12 @@ static void ftm_clear_write_protection(struct fsl_pwm_chip *fpc) ...@@ -65,13 +65,12 @@ static void ftm_clear_write_protection(struct fsl_pwm_chip *fpc)
regmap_read(fpc->regmap, FTM_FMS, &val); regmap_read(fpc->regmap, FTM_FMS, &val);
if (val & FTM_FMS_WPEN) if (val & FTM_FMS_WPEN)
regmap_update_bits(fpc->regmap, FTM_MODE, FTM_MODE_WPDIS, regmap_set_bits(fpc->regmap, FTM_MODE, FTM_MODE_WPDIS);
FTM_MODE_WPDIS);
} }
static void ftm_set_write_protection(struct fsl_pwm_chip *fpc) static void ftm_set_write_protection(struct fsl_pwm_chip *fpc)
{ {
regmap_update_bits(fpc->regmap, FTM_FMS, FTM_FMS_WPEN, FTM_FMS_WPEN); regmap_set_bits(fpc->regmap, FTM_FMS, FTM_FMS_WPEN);
} }
static bool fsl_pwm_periodcfg_are_equal(const struct fsl_pwm_periodcfg *a, static bool fsl_pwm_periodcfg_are_equal(const struct fsl_pwm_periodcfg *a,
...@@ -94,8 +93,7 @@ static int fsl_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm) ...@@ -94,8 +93,7 @@ static int fsl_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
ret = clk_prepare_enable(fpc->ipg_clk); ret = clk_prepare_enable(fpc->ipg_clk);
if (!ret && fpc->soc->has_enable_bits) { if (!ret && fpc->soc->has_enable_bits) {
mutex_lock(&fpc->lock); mutex_lock(&fpc->lock);
regmap_update_bits(fpc->regmap, FTM_SC, BIT(pwm->hwpwm + 16), regmap_set_bits(fpc->regmap, FTM_SC, BIT(pwm->hwpwm + 16));
BIT(pwm->hwpwm + 16));
mutex_unlock(&fpc->lock); mutex_unlock(&fpc->lock);
} }
...@@ -108,8 +106,7 @@ static void fsl_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) ...@@ -108,8 +106,7 @@ static void fsl_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)
if (fpc->soc->has_enable_bits) { if (fpc->soc->has_enable_bits) {
mutex_lock(&fpc->lock); mutex_lock(&fpc->lock);
regmap_update_bits(fpc->regmap, FTM_SC, BIT(pwm->hwpwm + 16), regmap_clear_bits(fpc->regmap, FTM_SC, BIT(pwm->hwpwm + 16));
0);
mutex_unlock(&fpc->lock); mutex_unlock(&fpc->lock);
} }
...@@ -317,8 +314,8 @@ static int fsl_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -317,8 +314,8 @@ static int fsl_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
if (!newstate->enabled) { if (!newstate->enabled) {
if (oldstate->enabled) { if (oldstate->enabled) {
regmap_update_bits(fpc->regmap, FTM_OUTMASK, regmap_set_bits(fpc->regmap, FTM_OUTMASK,
BIT(pwm->hwpwm), BIT(pwm->hwpwm)); BIT(pwm->hwpwm));
clk_disable_unprepare(fpc->clk[FSL_PWM_CLK_CNTEN]); clk_disable_unprepare(fpc->clk[FSL_PWM_CLK_CNTEN]);
clk_disable_unprepare(fpc->clk[fpc->period.clk_select]); clk_disable_unprepare(fpc->clk[fpc->period.clk_select]);
} }
...@@ -342,8 +339,7 @@ static int fsl_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -342,8 +339,7 @@ static int fsl_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
goto end_mutex; goto end_mutex;
} }
regmap_update_bits(fpc->regmap, FTM_OUTMASK, BIT(pwm->hwpwm), regmap_clear_bits(fpc->regmap, FTM_OUTMASK, BIT(pwm->hwpwm));
0);
} }
end_mutex: end_mutex:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment