remarkable-linux/drivers/pwm
Liu Ying 137fd45ffe pwm: imx: Avoid sample FIFO overflow for i.MX PWM version2
The i.MX PWM version2 is embedded in several i.MX SoCs, such as i.MX27,
i.MX51 and i.MX6SL.  There is a 4-word (16 bit) sample FIFO in this IP.
Each FIFO slot determines the duty period of a PWM waveform in one full
cycle.  The IP spec mentions that we should not write a fourth sample
because the FIFO will become full and triggers a FIFO write error (FWE)
which will prevent the PWM from starting once it is enabled.  In order
to avoid any sample FIFO overflow issue, this patch clears all sample
FIFO by doing software reset in the configuration hook when the
controller is disabled or waits for a full PWM cycle to get a
relinquished FIFO slot when the controller is enabled and the FIFO is
fully loaded.

The FIFO overflow issue can be reproduced by the following commands on
the i.MX6SL EVK platform, assuming we use PWM2 for the debug LED which
is driven by the pin HSIC_STROBE and the maximal brightness is 255.

	echo 0   > /sys/class/leds/user/brightness
	echo 0   > /sys/class/leds/user/brightness
	echo 0   > /sys/class/leds/user/brightness
	echo 0   > /sys/class/leds/user/brightness
	echo 255 > /sys/class/leds/user/brightness

Here, FWE happens (PWMSR register reads 0x58) and the LED can not be
lighten.

Another way to reproduce the FIFO overflow issue is to run this script:

	while true;
		do echo 255 > /sys/class/leds/user/brightness;
	done

Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Shawn Guo <shawn.guo@freescale.com>
Cc: Lothar Waßmann <LW@KARO-electronics.de>
Cc: linux-pwm@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
Acked-by: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2014-08-25 15:46:42 +02:00
..
core.c pwm: Fix possible ZERO_SIZE_PTR pointer dereferencing error. 2014-08-25 14:38:12 +02:00
Kconfig pwm: lpss: make it buildable only on X86 2014-08-25 11:46:37 +02:00
Makefile pwm: lpss: Properly split driver to parts 2014-08-23 00:25:47 +02:00
pwm-ab8500.c pwm: ab8500: Fix wrong value shift for disable/enable PWM 2014-05-21 12:29:58 +02:00
pwm-atmel-tcb.c pwm: atmel-tcb: fix max time computation for slow clk source 2013-09-19 14:04:32 +02:00
pwm-atmel.c pwm: atmel: set pwm_chip can_sleep flag 2014-05-21 12:08:57 +02:00
pwm-bcm-kona.c pwm: kona: Introduce Kona PWM controller support 2014-04-28 13:07:44 +02:00
pwm-bfin.c
pwm-clps711x.c pwm: Add CLPS711X PWM support 2014-03-18 21:15:16 +01:00
pwm-ep93xx.c pwm: ep93xx: split module author names 2013-12-20 10:53:50 +01:00
pwm-fsl-ftm.c pwm: fsl-ftm: Convert to direct regmap API usage 2014-08-20 10:10:12 +02:00
pwm-imx.c pwm: imx: Avoid sample FIFO overflow for i.MX PWM version2 2014-08-25 15:46:42 +02:00
pwm-jz4740.c pwm: jz4740: Use devm_clk_get() 2013-12-12 13:23:23 +01:00
pwm-lp3943.c pwm: lp3943: Set pwm_chip can_sleep flag 2014-05-21 12:09:09 +02:00
pwm-lpc32xx.c pwm: lpc32xx: Remove redundant of_match_ptr 2013-10-08 15:49:19 +02:00
pwm-lpss-pci.c pwm: lpss: pci: Move to use pcim_enable_device() 2014-08-23 00:25:51 +02:00
pwm-lpss-platform.c pwm: lpss: Properly split driver to parts 2014-08-23 00:25:47 +02:00
pwm-lpss.c pwm: lpss: use c99 initializers in structures 2014-08-25 11:45:34 +02:00
pwm-lpss.h pwm: lpss: Properly split driver to parts 2014-08-23 00:25:47 +02:00
pwm-mxs.c pwm: mxs: set pwm_chip can_sleep flag 2014-05-21 12:08:27 +02:00
pwm-pca9685.c
pwm-puv3.c
pwm-pxa.c pwm: pxa: Remove unnecessary OOM messages 2014-04-28 13:37:48 +02:00
pwm-renesas-tpu.c pwm: renesas-tpu: remove unused struct tpu_pwm_platform_data 2014-05-21 11:19:29 +02:00
pwm-rockchip.c pwm: rockchip: Added to support for RK3288 SoC 2014-08-08 13:12:47 +02:00
pwm-samsung.c pwm: samsung: do not set manual update bit in pwm_samsung_config 2014-05-21 12:24:00 +02:00
pwm-spear.c pwm: Changes for v3.16-rc1 2014-06-11 14:06:55 -07:00
pwm-sti.c pwm: sti: Remove PWM period table 2014-08-08 13:12:46 +02:00
pwm-tegra.c pwm: tegra: Remove unnecessary OOM messages 2014-04-28 13:37:48 +02:00
pwm-tiecap.c pwm: pwm-tiecap: Remove unnecessary OOM messages 2014-04-28 13:37:48 +02:00
pwm-tiehrpwm.c pwm: tiehrpwm: inline accessor functions 2014-05-21 11:51:26 +02:00
pwm-tipwmss.c pwm: pwm-tipwmss: remove unnecessary OOM messages 2014-08-07 13:14:33 +02:00
pwm-tipwmss.h
pwm-twl-led.c pwm: twl-led: Include linux/of.h header 2013-10-08 15:45:44 +02:00
pwm-twl.c pwm: twl: Really disable twl6030 PWMs 2014-05-08 23:41:47 +02:00
pwm-vt8500.c pwm: vt8500: Remove unnecessary OOM messages 2014-04-28 13:37:48 +02:00
sysfs.c pwm: sysfs: Convert to use ATTRIBUTE_GROUPS macro 2013-12-04 11:35:28 +01:00