Go to file
Uwe Kleine-König 9aff206cfc pwm: mediatek: Fix duty and period setting
[ Upstream commit f21d136caf ]

The period generated by the hardware is

	(PWMDWIDTH + 1) << CLKDIV) / freq

according to my tests with a signal analyser and also the documentation.

The current algorithm doesn't consider the `+ 1` part and so configures
slightly too high periods. The same issue exists for the duty cycle
setting. So subtract 1 from both the register values for period and
duty cycle. If period is 0, bail out, if duty_cycle is 0, just disable
the PWM which results in a constant low output.

Fixes: caf065f8fd ("pwm: Add MediaTek PWM support")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/6d1fa87a76f8020bfe3171529b8e19baffceab10.1753717973.git.u.kleine-koenig@baylibre.com
Cc: stable@vger.kernel.org
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-08-28 16:24:36 +02:00
arch KVM: arm64: Fix kernel BUG() due to bad backport of FPSIMD/SVE/SME fix 2025-08-28 16:24:34 +02:00
block block: avoid possible overflow for chunk_sectors check in blk_stack_limits() 2025-08-28 16:24:25 +02:00
certs
crypto crypto: xts - Only add ecb if it is not already there 2025-06-27 11:05:10 +01:00
Documentation asm-generic: Add memory barrier dma_mb() 2025-08-28 16:24:36 +02:00
drivers pwm: mediatek: Fix duty and period setting 2025-08-28 16:24:36 +02:00
fs f2fs: fix to avoid out-of-boundary access in dnode page 2025-08-28 16:24:36 +02:00
include asm-generic: Add memory barrier dma_mb() 2025-08-28 16:24:36 +02:00
init sched/isolation: Make CONFIG_CPU_ISOLATION depend on CONFIG_SMP 2025-05-02 07:44:36 +02:00
io_uring io_uring: fix possible deadlock in io_register_iowq_max_workers() 2024-11-17 15:06:25 +01:00
ipc ipc: fix to protect IPCS lookups using RCU 2025-06-27 11:05:26 +01:00
kernel ftrace: Also allocate and copy hash for reading of filter files 2025-08-28 16:24:34 +02:00
lib lib: bitmap: Introduce node-aware alloc API 2025-08-28 16:24:02 +02:00
LICENSES
mm mm/debug_vm_pgtable: clear page table entries at destroy_args() 2025-08-28 16:24:34 +02:00
net mptcp: disable add_addr retransmission when timeout is 0 2025-08-28 16:24:35 +02:00
samples samples: mei: Fix building on musl libc 2025-08-28 16:24:07 +02:00
scripts kconfig: lxdialog: fix 'space' to (de)select options 2025-08-28 16:24:25 +02:00
security securityfs: don't pin dentries twice, once is enough... 2025-08-28 16:24:17 +02:00
sound ALSA: hda/realtek: Add support for HP EliteBook x360 830 G6 and EliteBook 830 G6 2025-08-28 16:24:34 +02:00
tools selftests: mptcp: Initialize variables to quiet gcc 12 warnings 2025-08-28 16:24:33 +02:00
usr kbuild: hdrcheck: fix cross build with clang 2025-06-27 11:05:22 +01:00
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile kbuild: userprogs: use correct linker when mixing clang and GNU ld 2025-08-28 16:24:33 +02:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.