X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=target%2Flinux%2Framips%2Fpatches-6.1%2F845-pwm-add-mediatek-support.patch;h=15c7cf39a29e1471e8f837784771609c4abbe2eb;hb=eeeb0b53494ec08da8b5c746890158834b5ff263;hp=06074d6031028e91c7a0bea4da8b639462d9957c;hpb=31b3e61d77eccf62b13340013eae6aea40940444;p=openwrt%2Fstaging%2Fjow.git diff --git a/target/linux/ramips/patches-6.1/845-pwm-add-mediatek-support.patch b/target/linux/ramips/patches-6.1/845-pwm-add-mediatek-support.patch index 06074d6031..15c7cf39a2 100644 --- a/target/linux/ramips/patches-6.1/845-pwm-add-mediatek-support.patch +++ b/target/linux/ramips/patches-6.1/845-pwm-add-mediatek-support.patch @@ -41,7 +41,7 @@ Signed-off-by: John Crispin obj-$(CONFIG_PWM_NTXEC) += pwm-ntxec.o --- /dev/null +++ b/drivers/pwm/pwm-mediatek-ramips.c -@@ -0,0 +1,175 @@ +@@ -0,0 +1,197 @@ +/* + * Mediatek Pulse Width Modulator driver + * @@ -146,10 +146,32 @@ Signed-off-by: John Crispin + iowrite32(val, pc->mmio_base); +} + ++static int mtk_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ++ const struct pwm_state *state) ++{ ++ int err; ++ bool enabled = pwm->state.enabled; ++ ++ if (!state->enabled) { ++ if (enabled) ++ mtk_pwm_disable(chip, pwm); ++ ++ return 0; ++ } ++ ++ err = mtk_pwm_config(pwm->chip, pwm, ++ state->duty_cycle, state->period); ++ if (err) ++ return err; ++ ++ if (!enabled) ++ err = mtk_pwm_enable(chip, pwm); ++ ++ return err; ++} ++ +static const struct pwm_ops mtk_pwm_ops = { -+ .config = mtk_pwm_config, -+ .enable = mtk_pwm_enable, -+ .disable = mtk_pwm_disable, ++ .apply = mtk_pwm_apply, + .owner = THIS_MODULE, +}; +