]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mfd: stm32-timers: Add some register definitions with a parameter
authorUwe Kleine-König <u.kleine-koenig@baylibre.com>
Wed, 19 Jun 2024 10:11:43 +0000 (12:11 +0200)
committerLee Jones <lee@kernel.org>
Wed, 26 Jun 2024 15:09:52 +0000 (16:09 +0100)
commit796b942f65967af55684bf520812787b97522151
tree58fa2aebb37b4792cd3c641094be30cb0cdae6ce
parenta6143bdcaf7e37ecce05df2a3d3c1c5d587f87b1
mfd: stm32-timers: Add some register definitions with a parameter

There are some registers that belong together and are numbered from 1 to
4. Introduce a macro definition for these that takes the channel number
as parameter and define the previously available constants using the new
ones.

This allows to simplify some users that up to now use constructs like

TIM_CCER_CC1NE << (ch * 4)

which is an ugly mix of using a predefined value and still knowing
internal details about it.

Note that there are several decrements by 1 involved. These are
necessary because software guys start counting at 0 while the hardware
designer started at 1 (and having TIM_CCER_CCxE(1) be TIM_CCER_CC2E
isn't a sane option). The compiler is expected to optimize these out
nicely.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/05df15f61dde81033407d3b4fcb67ee403ecc8db.1718791090.git.u.kleine-koenig@baylibre.com
Signed-off-by: Lee Jones <lee@kernel.org>
include/linux/mfd/stm32-timers.h