PWM_POLARITY_* flags were defined in include/linux/pwm.h as a enum and in include/dt-bindings/pwm/pwm.h as macros.
This patchset fixes duplication and introduces using PWM_POLARITY_NORMAL flag instead of '0' constant in DT files.
Oleksandr Suvorov (7): pwm: rename the PWM_POLARITY_INVERSED enum dt-bindings: pwm: document the PWM polarity flag dt-bindings: pwm: add normal PWM polarity flag dt-bindings: pwm: add description of PWM polarity pwm: replace polarity enum with macros arm64: dts: pwm: replace polarity constant with macro arm: dts: pwm: replace polarity constant with macro
Documentation/devicetree/bindings/pwm/pwm.txt | 1 + arch/arm/boot/dts/am335x-cm-t335.dts | 2 +- arch/arm/boot/dts/am335x-evm.dts | 2 +- arch/arm/boot/dts/am3517-evm.dts | 2 +- arch/arm/boot/dts/at91-dvk_su60_somc_lcm.dtsi | 2 +- arch/arm/boot/dts/at91-kizbox2-common.dtsi | 6 ++-- arch/arm/boot/dts/at91-kizbox3_common.dtsi | 8 ++--- arch/arm/boot/dts/at91-kizboxmini-common.dtsi | 6 ++-- arch/arm/boot/dts/at91-nattis-2-natte-2.dts | 2 +- arch/arm/boot/dts/at91-sama5d4_ma5d4evk.dts | 2 +- arch/arm/boot/dts/at91sam9n12ek.dts | 2 +- arch/arm/boot/dts/at91sam9x5dm.dtsi | 2 +- .../boot/dts/berlin2cd-google-chromecast.dts | 4 +-- arch/arm/boot/dts/da850-evm.dts | 2 +- arch/arm/boot/dts/da850-lego-ev3.dts | 4 +-- arch/arm/boot/dts/exynos4412-midas.dtsi | 2 +- arch/arm/boot/dts/exynos4412-odroidu3.dts | 2 +- arch/arm/boot/dts/exynos5250-snow-common.dtsi | 2 +- arch/arm/boot/dts/exynos5410-odroidxu.dts | 2 +- arch/arm/boot/dts/exynos5420-peach-pit.dts | 2 +- arch/arm/boot/dts/exynos5422-odroidhc1.dts | 2 +- .../boot/dts/exynos5422-odroidxu3-common.dtsi | 2 +- arch/arm/boot/dts/exynos5422-odroidxu4.dts | 2 +- .../boot/dts/exynos54xx-odroidxu-leds.dtsi | 4 +-- arch/arm/boot/dts/exynos5800-peach-pi.dts | 2 +- arch/arm/boot/dts/imx53-tx53-x13x.dts | 5 ++-- arch/arm/boot/dts/imx6dl-tx6dl-comtft.dts | 2 +- arch/arm/boot/dts/imx6q-display5.dtsi | 2 +- arch/arm/boot/dts/imx6q-tx6q-1010-comtft.dts | 2 +- arch/arm/boot/dts/imx6q-tx6q-1020-comtft.dts | 2 +- arch/arm/boot/dts/imx6qdl-tx6-lvds.dtsi | 4 +-- arch/arm/boot/dts/imx7-colibri.dtsi | 4 ++- arch/arm/boot/dts/imx7d-nitrogen7.dts | 3 +- arch/arm/boot/dts/imx7d-pico.dtsi | 3 +- arch/arm/boot/dts/imx7d-sdb.dts | 3 +- arch/arm/boot/dts/imx7ulp-evk.dts | 3 +- arch/arm/boot/dts/iwg20d-q7-common.dtsi | 2 +- .../boot/dts/logicpd-torpedo-baseboard.dtsi | 2 +- arch/arm/boot/dts/meson8b-ec100.dts | 4 +-- arch/arm/boot/dts/meson8b-mxq.dts | 4 +-- arch/arm/boot/dts/meson8b-odroidc1.dts | 4 +-- .../boot/dts/motorola-mapphone-common.dtsi | 3 +- arch/arm/boot/dts/omap3-gta04.dtsi | 2 +- arch/arm/boot/dts/omap3-n900.dts | 2 +- arch/arm/boot/dts/rk3288-veyron-edp.dtsi | 2 +- arch/arm/boot/dts/rk3288-veyron.dtsi | 2 +- arch/arm/boot/dts/rv1108-evb.dts | 2 +- arch/arm/boot/dts/s3c6410-mini6410.dts | 2 +- arch/arm/boot/dts/s5pv210-aries.dtsi | 2 +- arch/arm/boot/dts/s5pv210-smdkv210.dts | 2 +- arch/arm/boot/dts/sun5i-gr8-evb.dts | 2 +- arch/arm/boot/dts/vf-colibri.dtsi | 4 ++- .../dts/allwinner/sun50i-a64-pinebook.dts | 2 +- .../boot/dts/allwinner/sun50i-a64-teres-i.dts | 2 +- .../arm64/boot/dts/amlogic/meson-axg-s400.dts | 3 +- arch/arm64/boot/dts/amlogic/meson-axg.dtsi | 1 + .../boot/dts/amlogic/meson-g12-common.dtsi | 1 + .../boot/dts/amlogic/meson-g12a-sei510.dts | 5 ++-- .../boot/dts/amlogic/meson-g12a-u200.dts | 2 +- .../boot/dts/amlogic/meson-g12a-x96-max.dts | 5 ++-- .../dts/amlogic/meson-g12b-khadas-vim3.dtsi | 4 +-- .../boot/dts/amlogic/meson-g12b-odroid-n2.dts | 4 +-- .../boot/dts/amlogic/meson-g12b-ugoos-am6.dts | 7 +++-- .../boot/dts/amlogic/meson-gx-p23x-q20x.dtsi | 3 +- arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 1 + .../boot/dts/amlogic/meson-gxbb-nanopi-k2.dts | 3 +- .../dts/amlogic/meson-gxbb-nexbox-a95x.dts | 3 +- .../boot/dts/amlogic/meson-gxbb-p20x.dtsi | 3 +- .../boot/dts/amlogic/meson-gxbb-vega-s95.dtsi | 3 +- .../boot/dts/amlogic/meson-gxbb-wetek.dtsi | 3 +- .../boot/dts/amlogic/meson-gxl-s805x-p241.dts | 3 +- .../meson-gxl-s905x-hwacom-amazetv.dts | 3 +- .../amlogic/meson-gxl-s905x-khadas-vim.dts | 2 +- .../amlogic/meson-gxl-s905x-nexbox-a95x.dts | 3 +- .../dts/amlogic/meson-gxl-s905x-p212.dtsi | 3 +- .../dts/amlogic/meson-gxm-khadas-vim2.dts | 5 ++-- .../boot/dts/amlogic/meson-gxm-rbox-pro.dts | 3 +- .../boot/dts/amlogic/meson-khadas-vim3.dtsi | 4 ++- .../dts/amlogic/meson-sm1-khadas-vim3l.dts | 2 +- .../boot/dts/amlogic/meson-sm1-sei610.dts | 7 +++-- .../dts/exynos/exynos5433-tm2-common.dtsi | 3 +- arch/arm64/boot/dts/rockchip/px30-evb.dts | 2 +- arch/arm64/boot/dts/rockchip/px30.dtsi | 1 + .../arm64/boot/dts/rockchip/rk3308-roc-cc.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3308.dtsi | 1 + arch/arm64/boot/dts/rockchip/rk3399-evb.dts | 4 +-- .../boot/dts/rockchip/rk3399-firefly.dts | 2 +- .../dts/rockchip/rk3399-gru-chromebook.dtsi | 2 +- .../boot/dts/rockchip/rk3399-gru-scarlet.dtsi | 4 +-- arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi | 6 ++-- .../boot/dts/rockchip/rk3399-khadas-edge.dtsi | 2 +- .../boot/dts/rockchip/rk3399-nanopc-t4.dts | 2 +- .../boot/dts/rockchip/rk3399-roc-pc.dtsi | 2 +- .../boot/dts/rockchip/rk3399-rockpro64.dtsi | 2 +- .../rockchip/rk3399-sapphire-excavator.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3399.dtsi | 1 + drivers/pwm/core.c | 6 ++-- drivers/pwm/pwm-atmel-hlcdc.c | 2 +- drivers/pwm/pwm-atmel-tcb.c | 24 +++++++-------- drivers/pwm/pwm-atmel.c | 2 +- drivers/pwm/pwm-bcm-iproc.c | 2 +- drivers/pwm/pwm-bcm-kona.c | 4 +-- drivers/pwm/pwm-bcm2835.c | 2 +- drivers/pwm/pwm-berlin.c | 2 +- drivers/pwm/pwm-ep93xx.c | 4 +-- drivers/pwm/pwm-fsl-ftm.c | 2 +- drivers/pwm/pwm-hibvt.c | 4 +-- drivers/pwm/pwm-imx-tpm.c | 2 +- drivers/pwm/pwm-imx27.c | 4 +-- drivers/pwm/pwm-jz4740.c | 2 +- drivers/pwm/pwm-lpc18xx-sct.c | 2 +- drivers/pwm/pwm-meson.c | 6 ++-- drivers/pwm/pwm-omap-dmtimer.c | 6 ++-- drivers/pwm/pwm-renesas-tpu.c | 10 +++---- drivers/pwm/pwm-rockchip.c | 4 +-- drivers/pwm/pwm-samsung.c | 2 +- drivers/pwm/pwm-sifive.c | 4 +-- drivers/pwm/pwm-stm32.c | 2 +- drivers/pwm/pwm-sun4i.c | 2 +- drivers/pwm/pwm-tiecap.c | 4 +-- drivers/pwm/pwm-tiehrpwm.c | 8 ++--- drivers/pwm/pwm-vt8500.c | 4 +-- drivers/pwm/pwm-zx.c | 4 +-- drivers/pwm/sysfs.c | 6 ++-- drivers/staging/greybus/pwm.c | 2 +- drivers/video/backlight/lp8788_bl.c | 2 +- include/dt-bindings/pwm/pwm.h | 10 +++++++ include/linux/mfd/lp8788.h | 2 +- include/linux/pwm.h | 29 +++++-------------- include/trace/events/pwm.h | 2 +- 130 files changed, 239 insertions(+), 205 deletions(-)
To avoid duplication of pwm polarity definitions, remove "enum pwm_polarity" and use macros instead.
Prepare to use both polarity flags in DTs.
Signed-off-by: Oleksandr Suvorov oleksandr.suvorov@toradex.com ---
drivers/pwm/core.c | 2 +- drivers/pwm/pwm-atmel-tcb.c | 8 ++++---- drivers/pwm/pwm-bcm-kona.c | 2 +- drivers/pwm/pwm-bcm2835.c | 2 +- drivers/pwm/pwm-berlin.c | 2 +- drivers/pwm/pwm-ep93xx.c | 2 +- drivers/pwm/pwm-hibvt.c | 2 +- drivers/pwm/pwm-lpc18xx-sct.c | 2 +- drivers/pwm/pwm-omap-dmtimer.c | 2 +- drivers/pwm/pwm-renesas-tpu.c | 4 ++-- drivers/pwm/pwm-samsung.c | 2 +- drivers/pwm/pwm-stm32.c | 2 +- drivers/pwm/pwm-tiecap.c | 2 +- drivers/pwm/pwm-tiehrpwm.c | 4 ++-- drivers/pwm/pwm-vt8500.c | 2 +- drivers/pwm/sysfs.c | 2 +- drivers/staging/greybus/pwm.c | 2 +- drivers/video/backlight/lp8788_bl.c | 2 +- include/linux/mfd/lp8788.h | 2 +- include/linux/pwm.h | 29 ++++++++--------------------- include/trace/events/pwm.h | 2 +- 21 files changed, 33 insertions(+), 46 deletions(-)
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index 08afbb5b98aa..2cb9db8d545b 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -257,7 +257,7 @@ static bool pwm_ops_check(const struct pwm_ops *ops) * Returns: 0 on success or a negative error code on failure. */ int pwmchip_add_with_polarity(struct pwm_chip *chip, - enum pwm_polarity polarity) + unsigned int polarity) { struct pwm_device *pwm; unsigned int i; diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c index 98526a286347..9e8a0b4b1751 100644 --- a/drivers/pwm/pwm-atmel-tcb.c +++ b/drivers/pwm/pwm-atmel-tcb.c @@ -31,7 +31,7 @@ ATMEL_TC_BEEVT | ATMEL_TC_BSWTRG)
struct atmel_tcb_pwm_device { - enum pwm_polarity polarity; /* PWM polarity */ + unsigned int polarity; /* PWM polarity */ unsigned div; /* PWM clock divider */ unsigned duty; /* PWM duty expressed in clk cycles */ unsigned period; /* PWM period expressed in clk cycles */ @@ -60,7 +60,7 @@ static inline struct atmel_tcb_pwm_chip *to_tcb_chip(struct pwm_chip *chip)
static int atmel_tcb_pwm_set_polarity(struct pwm_chip *chip, struct pwm_device *pwm, - enum pwm_polarity polarity) + unsigned int polarity) { struct atmel_tcb_pwm_device *tcbpwm = pwm_get_chip_data(pwm);
@@ -147,7 +147,7 @@ static void atmel_tcb_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) unsigned group = pwm->hwpwm / 2; unsigned index = pwm->hwpwm % 2; unsigned cmr; - enum pwm_polarity polarity = tcbpwm->polarity; + unsigned int polarity = tcbpwm->polarity;
/* * If duty is 0 the timer will be stopped and we have to @@ -206,7 +206,7 @@ static int atmel_tcb_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) unsigned group = pwm->hwpwm / 2; unsigned index = pwm->hwpwm % 2; u32 cmr; - enum pwm_polarity polarity = tcbpwm->polarity; + unsigned int polarity = tcbpwm->polarity;
/* * If duty is 0 the timer will be stopped and we have to diff --git a/drivers/pwm/pwm-bcm-kona.c b/drivers/pwm/pwm-bcm-kona.c index 02da511814f1..83eab0cc51ce 100644 --- a/drivers/pwm/pwm-bcm-kona.c +++ b/drivers/pwm/pwm-bcm-kona.c @@ -174,7 +174,7 @@ static int kona_pwmc_config(struct pwm_chip *chip, struct pwm_device *pwm, }
static int kona_pwmc_set_polarity(struct pwm_chip *chip, struct pwm_device *pwm, - enum pwm_polarity polarity) + unsigned int polarity) { struct kona_pwmc *kp = to_kona_pwmc(chip); unsigned int chan = pwm->hwpwm; diff --git a/drivers/pwm/pwm-bcm2835.c b/drivers/pwm/pwm-bcm2835.c index 91e24f01b54e..2110aef85f19 100644 --- a/drivers/pwm/pwm-bcm2835.c +++ b/drivers/pwm/pwm-bcm2835.c @@ -107,7 +107,7 @@ static void bcm2835_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) }
static int bcm2835_set_polarity(struct pwm_chip *chip, struct pwm_device *pwm, - enum pwm_polarity polarity) + unsigned int polarity) { struct bcm2835_pwm *pc = to_bcm2835_pwm(chip); u32 value; diff --git a/drivers/pwm/pwm-berlin.c b/drivers/pwm/pwm-berlin.c index b91c477cc84b..1a080bf33047 100644 --- a/drivers/pwm/pwm-berlin.c +++ b/drivers/pwm/pwm-berlin.c @@ -127,7 +127,7 @@ static int berlin_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm_dev,
static int berlin_pwm_set_polarity(struct pwm_chip *chip, struct pwm_device *pwm_dev, - enum pwm_polarity polarity) + unsigned int polarity) { struct berlin_pwm_chip *pwm = to_berlin_pwm_chip(chip); u32 value; diff --git a/drivers/pwm/pwm-ep93xx.c b/drivers/pwm/pwm-ep93xx.c index 02345b6f9fe8..71897ad5f6a0 100644 --- a/drivers/pwm/pwm-ep93xx.c +++ b/drivers/pwm/pwm-ep93xx.c @@ -111,7 +111,7 @@ static int ep93xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, }
static int ep93xx_pwm_polarity(struct pwm_chip *chip, struct pwm_device *pwm, - enum pwm_polarity polarity) + unsigned int polarity) { struct ep93xx_pwm *ep93xx_pwm = to_ep93xx_pwm(chip); int ret; diff --git a/drivers/pwm/pwm-hibvt.c b/drivers/pwm/pwm-hibvt.c index c57a94e7da0f..7e39abce0c14 100644 --- a/drivers/pwm/pwm-hibvt.c +++ b/drivers/pwm/pwm-hibvt.c @@ -116,7 +116,7 @@ static void hibvt_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
static void hibvt_pwm_set_polarity(struct pwm_chip *chip, struct pwm_device *pwm, - enum pwm_polarity polarity) + unsigned int polarity) { struct hibvt_pwm_chip *hi_pwm_chip = to_hibvt_pwm_chip(chip);
diff --git a/drivers/pwm/pwm-lpc18xx-sct.c b/drivers/pwm/pwm-lpc18xx-sct.c index 5ff11145c1a3..3ebb7cca0204 100644 --- a/drivers/pwm/pwm-lpc18xx-sct.c +++ b/drivers/pwm/pwm-lpc18xx-sct.c @@ -225,7 +225,7 @@ static int lpc18xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
static int lpc18xx_pwm_set_polarity(struct pwm_chip *chip, struct pwm_device *pwm, - enum pwm_polarity polarity) + unsigned int polarity) { return 0; } diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c index 082ccec93133..ebbd1fe57d57 100644 --- a/drivers/pwm/pwm-omap-dmtimer.c +++ b/drivers/pwm/pwm-omap-dmtimer.c @@ -210,7 +210,7 @@ static int pwm_omap_dmtimer_config(struct pwm_chip *chip,
static int pwm_omap_dmtimer_set_polarity(struct pwm_chip *chip, struct pwm_device *pwm, - enum pwm_polarity polarity) + unsigned int polarity) { struct pwm_omap_dmtimer_chip *omap = to_pwm_omap_dmtimer_chip(chip);
diff --git a/drivers/pwm/pwm-renesas-tpu.c b/drivers/pwm/pwm-renesas-tpu.c index 32beeb93ade1..3c594cef2d5a 100644 --- a/drivers/pwm/pwm-renesas-tpu.c +++ b/drivers/pwm/pwm-renesas-tpu.c @@ -72,7 +72,7 @@ struct tpu_pwm_device { struct tpu_device *tpu; unsigned int channel; /* Channel number in the TPU */
- enum pwm_polarity polarity; + unsigned int polarity; unsigned int prescaler; u16 period; u16 duty; @@ -325,7 +325,7 @@ static int tpu_pwm_config(struct pwm_chip *chip, struct pwm_device *_pwm, }
static int tpu_pwm_set_polarity(struct pwm_chip *chip, struct pwm_device *_pwm, - enum pwm_polarity polarity) + unsigned int polarity) { struct tpu_pwm_device *pwm = pwm_get_chip_data(_pwm);
diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c index 87a886f7dc2f..7bf4f76e25bc 100644 --- a/drivers/pwm/pwm-samsung.c +++ b/drivers/pwm/pwm-samsung.c @@ -413,7 +413,7 @@ static void pwm_samsung_set_invert(struct samsung_pwm_chip *chip,
static int pwm_samsung_set_polarity(struct pwm_chip *chip, struct pwm_device *pwm, - enum pwm_polarity polarity) + unsigned int polarity) { struct samsung_pwm_chip *our_chip = to_samsung_pwm_chip(chip); bool invert = (polarity == PWM_POLARITY_NORMAL); diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c index d3be944f2ae9..a83ea66f36c9 100644 --- a/drivers/pwm/pwm-stm32.c +++ b/drivers/pwm/pwm-stm32.c @@ -383,7 +383,7 @@ static int stm32_pwm_config(struct stm32_pwm *priv, int ch, }
static int stm32_pwm_set_polarity(struct stm32_pwm *priv, int ch, - enum pwm_polarity polarity) + unsigned int polarity) { u32 mask;
diff --git a/drivers/pwm/pwm-tiecap.c b/drivers/pwm/pwm-tiecap.c index b96b388f0969..744144f83355 100644 --- a/drivers/pwm/pwm-tiecap.c +++ b/drivers/pwm/pwm-tiecap.c @@ -109,7 +109,7 @@ static int ecap_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, }
static int ecap_pwm_set_polarity(struct pwm_chip *chip, struct pwm_device *pwm, - enum pwm_polarity polarity) + unsigned int polarity) { struct ecap_pwm_chip *pc = to_ecap_pwm_chip(chip); u16 value; diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c index 71c337443dd5..cde0231e835a 100644 --- a/drivers/pwm/pwm-tiehrpwm.c +++ b/drivers/pwm/pwm-tiehrpwm.c @@ -109,7 +109,7 @@ struct ehrpwm_pwm_chip { unsigned long clk_rate; void __iomem *mmio_base; unsigned long period_cycles[NUM_PWM_CHANNEL]; - enum pwm_polarity polarity[NUM_PWM_CHANNEL]; + unsigned int polarity[NUM_PWM_CHANNEL]; struct clk *tbclk; struct ehrpwm_context ctx; }; @@ -306,7 +306,7 @@ static int ehrpwm_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
static int ehrpwm_pwm_set_polarity(struct pwm_chip *chip, struct pwm_device *pwm, - enum pwm_polarity polarity) + unsigned int polarity) { struct ehrpwm_pwm_chip *pc = to_ehrpwm_pwm_chip(chip);
diff --git a/drivers/pwm/pwm-vt8500.c b/drivers/pwm/pwm-vt8500.c index fc434965c5ed..076c9f207d64 100644 --- a/drivers/pwm/pwm-vt8500.c +++ b/drivers/pwm/pwm-vt8500.c @@ -158,7 +158,7 @@ static void vt8500_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
static int vt8500_pwm_set_polarity(struct pwm_chip *chip, struct pwm_device *pwm, - enum pwm_polarity polarity) + unsigned int polarity) { struct vt8500_chip *vt8500 = to_vt8500_chip(chip); u32 val; diff --git a/drivers/pwm/sysfs.c b/drivers/pwm/sysfs.c index 769ac09c56c2..7cf787ac5e23 100644 --- a/drivers/pwm/sysfs.c +++ b/drivers/pwm/sysfs.c @@ -180,7 +180,7 @@ static ssize_t polarity_store(struct device *child, { struct pwm_export *export = child_to_pwm_export(child); struct pwm_device *pwm = export->pwm; - enum pwm_polarity polarity; + unsigned int polarity; struct pwm_state state; int ret;
diff --git a/drivers/staging/greybus/pwm.c b/drivers/staging/greybus/pwm.c index 891a6a672378..338c76c4be9b 100644 --- a/drivers/staging/greybus/pwm.c +++ b/drivers/staging/greybus/pwm.c @@ -213,7 +213,7 @@ static int gb_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, };
static int gb_pwm_set_polarity(struct pwm_chip *chip, struct pwm_device *pwm, - enum pwm_polarity polarity) + unsigned int polarity) { struct gb_pwm_chip *pwmc = pwm_chip_to_gb_pwm_chip(chip);
diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/lp8788_bl.c index ba42f3fe0c73..a589d5e51865 100644 --- a/drivers/video/backlight/lp8788_bl.c +++ b/drivers/video/backlight/lp8788_bl.c @@ -37,7 +37,7 @@ struct lp8788_bl_config { enum lp8788_bl_full_scale_current full_scale; enum lp8788_bl_ramp_step rise_time; enum lp8788_bl_ramp_step fall_time; - enum pwm_polarity pwm_pol; + unsigned int pwm_pol; };
struct lp8788_bl { diff --git a/include/linux/mfd/lp8788.h b/include/linux/mfd/lp8788.h index 3d5c480d58ea..e0321aedf4c0 100644 --- a/include/linux/mfd/lp8788.h +++ b/include/linux/mfd/lp8788.h @@ -227,7 +227,7 @@ struct lp8788_backlight_platform_data { enum lp8788_bl_full_scale_current full_scale; enum lp8788_bl_ramp_step rise_time; enum lp8788_bl_ramp_step fall_time; - enum pwm_polarity pwm_pol; + unsigned int pwm_pol; unsigned int period_ns; };
diff --git a/include/linux/pwm.h b/include/linux/pwm.h index 38b7ed8ef913..c7b35f0602fa 100644 --- a/include/linux/pwm.h +++ b/include/linux/pwm.h @@ -5,26 +5,13 @@ #include <linux/err.h> #include <linux/mutex.h> #include <linux/of.h> +#include <dt-bindings/pwm/pwm.h>
struct pwm_capture; struct seq_file;
struct pwm_chip;
-/** - * enum pwm_polarity - polarity of a PWM signal - * @PWM_POLARITY_NORMAL: a high signal for the duration of the duty- - * cycle, followed by a low signal for the remainder of the pulse - * period - * @PWM_POLARITY_INVERTED: a low signal for the duration of the duty- - * cycle, followed by a high signal for the remainder of the pulse - * period - */ -enum pwm_polarity { - PWM_POLARITY_NORMAL, - PWM_POLARITY_INVERTED, -}; - /** * struct pwm_args - board-dependent PWM arguments * @period: reference period @@ -40,7 +27,7 @@ enum pwm_polarity { */ struct pwm_args { unsigned int period; - enum pwm_polarity polarity; + unsigned int polarity; };
enum { @@ -58,7 +45,7 @@ enum { struct pwm_state { unsigned int period; unsigned int duty_cycle; - enum pwm_polarity polarity; + unsigned int polarity; bool enabled; };
@@ -135,7 +122,7 @@ static inline unsigned int pwm_get_duty_cycle(const struct pwm_device *pwm) return state.duty_cycle; }
-static inline enum pwm_polarity pwm_get_polarity(const struct pwm_device *pwm) +static inline unsigned int pwm_get_polarity(const struct pwm_device *pwm) { struct pwm_state state;
@@ -268,7 +255,7 @@ struct pwm_ops { int (*config)(struct pwm_chip *chip, struct pwm_device *pwm, int duty_ns, int period_ns); int (*set_polarity)(struct pwm_chip *chip, struct pwm_device *pwm, - enum pwm_polarity polarity); + unsigned int polarity); int (*enable)(struct pwm_chip *chip, struct pwm_device *pwm); void (*disable)(struct pwm_chip *chip, struct pwm_device *pwm); }; @@ -391,7 +378,7 @@ int pwm_set_chip_data(struct pwm_device *pwm, void *data); void *pwm_get_chip_data(struct pwm_device *pwm);
int pwmchip_add_with_polarity(struct pwm_chip *chip, - enum pwm_polarity polarity); + unsigned int polarity); int pwmchip_add(struct pwm_chip *chip); int pwmchip_remove(struct pwm_chip *chip); struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip, @@ -471,7 +458,7 @@ static inline int pwmchip_add(struct pwm_chip *chip) return -EINVAL; }
-static inline int pwmchip_add_inversed(struct pwm_chip *chip) +static inline int pwmchip_add_inverted(struct pwm_chip *chip) { return -EINVAL; } @@ -569,7 +556,7 @@ struct pwm_lookup { const char *dev_id; const char *con_id; unsigned int period; - enum pwm_polarity polarity; + unsigned int polarity; const char *module; /* optional, may be NULL */ };
diff --git a/include/trace/events/pwm.h b/include/trace/events/pwm.h index cf243de41cc8..e3f40ba2ab9c 100644 --- a/include/trace/events/pwm.h +++ b/include/trace/events/pwm.h @@ -18,7 +18,7 @@ DECLARE_EVENT_CLASS(pwm, __field(struct pwm_device *, pwm) __field(u64, period) __field(u64, duty_cycle) - __field(enum pwm_polarity, polarity) + __field(unsigned int, polarity) __field(bool, enabled) ),