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)
commitfa759a9395ea81c17db613dde43c46f0607df7e7
tree1706f3ba2d84c6a7c0c1748031ff6c0a2859cec4
parente8060f08cd69d1d692cfb9f0a2808477a501f35a
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