]> git.baikalelectronics.ru Git - kernel.git/commit
can: dev: add can_tdc_get_relative_tdco() helper function
authorVincent Mailhol <mailhol.vincent@wanadoo.fr>
Sat, 18 Sep 2021 09:56:37 +0000 (18:56 +0900)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Sun, 24 Oct 2021 14:24:29 +0000 (16:24 +0200)
commit83664089dc79a57afe1d0d9f9f1a572bbff1621e
tree1706f3ba2d84c6a7c0c1748031ff6c0a2859cec4
parentb3b1c679deffefe162dae7984f9b229baa6c96f7
can: dev: add can_tdc_get_relative_tdco() helper function

struct can_tdc::tdco represents the absolute offset from TDCV. Some
controllers use instead an offset relative to the Sample Point (SP)
such that:
| SSP = TDCV + absolute TDCO
|     = TDCV + SP + relative TDCO

Consequently:
| relative TDCO = absolute TDCO - SP

The function can_tdc_get_relative_tdco() allow to retrieve this
relative TDCO value.

Link: https://lore.kernel.org/all/20210918095637.20108-7-mailhol.vincent@wanadoo.fr
CC: Stefan Mätje <Stefan.Maetje@esd.eu>
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
include/linux/can/dev.h