aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiu Ying <Ying.Liu@freescale.com>2014-06-08 23:07:28 -0400
committerLiu Ying <Ying.Liu@freescale.com>2014-06-08 23:09:34 -0400
commit8c6e77f395676686bbf33af19da25e048cf823a9 (patch)
tree774ec0508dc9959fec644b9fabe46d1c3f13f5a3
parentfa3f525fa079abb61e139bb2b84b477db6238e02 (diff)
ENGR00317376-1 pwm: i.MX: Don't reset PWMv2 when doing configuration
The patch for ENGR00308394 resets PWMv2 every time we do configuration. This may make the PWM period unstable if we only tune duty period continuously, and finally cause unstable PWM backlight light issue happen. Revert "ENGR00308394 pwm: i.MX: Avoid sample fifo overflow for i.MX pwm version2" This reverts commit 545c7383dfba874180b394f8b00b563a6541e158. Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
-rw-r--r--drivers/pwm/pwm-imx.c19
1 files changed, 1 insertions, 18 deletions
diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c
index 0b59694a2f01..517f933fe490 100644
--- a/drivers/pwm/pwm-imx.c
+++ b/drivers/pwm/pwm-imx.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2013 Freescale Semiconductor, Inc. 2 * Copyright (C) 2013-2014 Freescale Semiconductor, Inc.
3 * simple driver for PWM (Pulse Width Modulator) controller 3 * simple driver for PWM (Pulse Width Modulator) controller
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
@@ -15,7 +15,6 @@
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/err.h> 16#include <linux/err.h>
17#include <linux/clk.h> 17#include <linux/clk.h>
18#include <linux/delay.h>
19#include <linux/io.h> 18#include <linux/io.h>
20#include <linux/pwm.h> 19#include <linux/pwm.h>
21#include <linux/of_device.h> 20#include <linux/of_device.h>
@@ -39,11 +38,8 @@
39#define MX3_PWMCR_DBGEN (1 << 22) 38#define MX3_PWMCR_DBGEN (1 << 22)
40#define MX3_PWMCR_CLKSRC_IPG_HIGH (2 << 16) 39#define MX3_PWMCR_CLKSRC_IPG_HIGH (2 << 16)
41#define MX3_PWMCR_CLKSRC_IPG (1 << 16) 40#define MX3_PWMCR_CLKSRC_IPG (1 << 16)
42#define MX3_PWMCR_SWR (1 << 3)
43#define MX3_PWMCR_EN (1 << 0) 41#define MX3_PWMCR_EN (1 << 0)
44 42
45#define MX3_PWM_SWR_LOOP 5
46
47struct imx_chip { 43struct imx_chip {
48 struct clk *clk_per; 44 struct clk *clk_per;
49 struct clk *clk_ipg; 45 struct clk *clk_ipg;
@@ -107,23 +103,10 @@ static int imx_pwm_config_v2(struct pwm_chip *chip,
107 struct pwm_device *pwm, int duty_ns, int period_ns) 103 struct pwm_device *pwm, int duty_ns, int period_ns)
108{ 104{
109 struct imx_chip *imx = to_imx_chip(chip); 105 struct imx_chip *imx = to_imx_chip(chip);
110 struct device *dev = chip->dev;
111 unsigned long long c; 106 unsigned long long c;
112 unsigned long period_cycles, duty_cycles, prescale; 107 unsigned long period_cycles, duty_cycles, prescale;
113 int wait_count = 0;
114 u32 cr; 108 u32 cr;
115 109
116 /* do software reset in case fifo overflows */
117 writel(MX3_PWMCR_SWR, imx->mmio_base + MX3_PWMCR);
118 do {
119 usleep_range(200, 1000);
120 cr = readl(imx->mmio_base + MX3_PWMCR);
121 } while ((cr & MX3_PWMCR_SWR) &&
122 (wait_count++ < MX3_PWM_SWR_LOOP));
123
124 if (cr & MX3_PWMCR_SWR)
125 dev_warn(dev, "software reset timeout\n");
126
127 c = clk_get_rate(imx->clk_per); 110 c = clk_get_rate(imx->clk_per);
128 c = c * period_ns; 111 c = c * period_ns;
129 do_div(c, 1000000000); 112 do_div(c, 1000000000);