@@ -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;
@@ -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
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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);
@@ -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;
}
@@ -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);
@@ -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);
@@ -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);
@@ -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;
@@ -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;
@@ -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);
@@ -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;
@@ -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;
@@ -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);
@@ -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 {
@@ -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;
};
@@ -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 */
};
@@ -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)
),
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(-)