WSL2-Linux-Kernel/drivers/pwm
AngeloGioacchino Del Regno 1cccf7c5c7 pwm: mtk-disp: Configure double buffering before reading in .get_state()
[ Upstream commit b16c310115 ]

The DISP_PWM controller's default behavior is to always use register
double buffering: all reads/writes are then performed on shadow
registers instead of working registers and this becomes an issue
in case our chosen configuration in Linux is different from the
default (or from the one that was pre-applied by the bootloader).

An example of broken behavior is when the controller is configured
to use shadow registers, but this driver wants to configure it
otherwise: what happens is that the .get_state() callback is called
right after registering the pwmchip and checks whether the PWM is
enabled by reading the DISP_PWM_EN register;
At this point, if shadow registers are enabled but their content
was not committed before booting Linux, we are *not* reading the
current PWM enablement status, leading to the kernel knowing that
the hardware is actually enabled when, in reality, it's not.

The aforementioned issue emerged since this driver was fixed with
commit 0b5ef3429d ("pwm: mtk-disp: Fix the parameters calculated
by the enabled flag of disp_pwm") making it to read the enablement
status from the right register.

Configure the controller in the .get_state() callback to avoid
this desync issue and get the backlight properly working again.

Fixes: 3f2b167349 ("pwm: mtk-disp: Implement atomic API .get_state()")
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Tested-by: Alexandre Mergnat <amergnat@baylibre.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-05-11 23:00:38 +09:00
..
Kconfig
Makefile
core.c
pwm-ab8500.c
pwm-atmel-hlcdc.c
pwm-atmel-tcb.c
pwm-atmel.c
pwm-bcm-iproc.c
pwm-bcm-kona.c
pwm-bcm2835.c
pwm-berlin.c
pwm-brcmstb.c
pwm-clps711x.c
pwm-crc.c
pwm-cros-ec.c pwm: cros-ec: Explicitly set .polarity in .get_state() 2023-04-13 16:48:17 +02:00
pwm-dwc.c
pwm-ep93xx.c
pwm-fsl-ftm.c
pwm-hibvt.c pwm: hibvt: Explicitly set .polarity in .get_state() 2023-04-26 13:51:55 +02:00
pwm-img.c
pwm-imx-tpm.c
pwm-imx1.c
pwm-imx27.c
pwm-intel-lgm.c
pwm-iqs620a.c pwm: iqs620a: Explicitly set .polarity in .get_state() 2023-04-26 13:51:55 +02:00
pwm-jz4740.c
pwm-keembay.c
pwm-lp3943.c
pwm-lpc18xx-sct.c
pwm-lpc32xx.c
pwm-lpss-pci.c
pwm-lpss-platform.c
pwm-lpss.c
pwm-lpss.h
pwm-mediatek.c pwm: mediatek: always use bus clock for PWM on MT7622 2022-12-31 13:14:36 +01:00
pwm-meson.c pwm: meson: Fix g12a ao clk81 name 2023-05-11 23:00:17 +09:00
pwm-mtk-disp.c pwm: mtk-disp: Configure double buffering before reading in .get_state() 2023-05-11 23:00:38 +09:00
pwm-mxs.c
pwm-ntxec.c
pwm-omap-dmtimer.c
pwm-pca9685.c
pwm-pxa.c
pwm-raspberrypi-poe.c
pwm-rcar.c
pwm-renesas-tpu.c
pwm-rockchip.c
pwm-samsung.c
pwm-sifive.c pwm: sifive: Always let the first pwm_apply_state succeed 2023-03-11 13:57:23 +01:00
pwm-sl28cpld.c
pwm-spear.c
pwm-sprd.c pwm: sprd: Explicitly set .polarity in .get_state() 2023-04-13 16:48:17 +02:00
pwm-sti.c
pwm-stm32-lp.c pwm: stm32-lp: fix the check on arr and cmp registers update 2023-03-11 13:57:23 +01:00
pwm-stm32.c
pwm-stmpe.c
pwm-sun4i.c
pwm-tegra.c pwm: tegra: Fix 32 bit build 2022-12-31 13:14:48 +01:00
pwm-tiecap.c
pwm-tiehrpwm.c
pwm-twl-led.c
pwm-twl.c
pwm-visconti.c
pwm-vt8500.c
sysfs.c