summaryrefslogtreecommitdiffstats
path: root/drivers/pwm
diff options
context:
space:
mode:
authorThierry Reding <thierry.reding@gmail.com>2019-10-16 09:30:33 +0200
committerThierry Reding <thierry.reding@gmail.com>2019-10-21 16:50:05 +0200
commit9e1b4999a1693d67cc87a887057d8012c28fb12b (patch)
treef028a615a887224509ff8811251b92fa38e3abdd /drivers/pwm
parent8e53622594f5530b5a86094464937dda47fc6e3b (diff)
downloadlinux-9e1b4999a1693d67cc87a887057d8012c28fb12b.tar.bz2
pwm: stm32: Pass breakinput instead of its values
Instead of passing the individual values of the breakpoint, pass a pointer to the breakpoint. Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'drivers/pwm')
-rw-r--r--drivers/pwm/pwm-stm32.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c
index 7a2be0453824..7ff48c14fae8 100644
--- a/drivers/pwm/pwm-stm32.c
+++ b/drivers/pwm/pwm-stm32.c
@@ -491,18 +491,18 @@ static const struct pwm_ops stm32pwm_ops = {
};
static int stm32_pwm_set_breakinput(struct stm32_pwm *priv,
- int index, int level, int filter)
+ const struct stm32_breakinput *bi)
{
- u32 shift = TIM_BDTR_BKF_SHIFT(index);
- u32 bke = TIM_BDTR_BKE(index);
- u32 bkp = TIM_BDTR_BKP(index);
- u32 bkf = TIM_BDTR_BKF(index);
+ u32 shift = TIM_BDTR_BKF_SHIFT(bi->index);
+ u32 bke = TIM_BDTR_BKE(bi->index);
+ u32 bkp = TIM_BDTR_BKP(bi->index);
+ u32 bkf = TIM_BDTR_BKF(bi->index);
u32 mask = bkf | bkp | bke;
u32 bdtr;
- bdtr = (filter & TIM_BDTR_BKF_MASK) << shift | bke;
+ bdtr = (bi->filter & TIM_BDTR_BKF_MASK) << shift | bke;
- if (level)
+ if (bi->level)
bdtr |= bkp;
regmap_update_bits(priv->regmap, TIM_BDTR, mask, bdtr);
@@ -518,10 +518,7 @@ static int stm32_pwm_apply_breakinputs(struct stm32_pwm *priv)
int ret;
for (i = 0; i < priv->num_breakinputs; i++) {
- ret = stm32_pwm_set_breakinput(priv,
- priv->breakinputs[i].index,
- priv->breakinputs[i].level,
- priv->breakinputs[i].filter);
+ ret = stm32_pwm_set_breakinput(priv, &priv->breakinputs[i]);
if (ret < 0)
return ret;
}