summaryrefslogtreecommitdiff
path: root/drivers/net/can/slcan.c
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2016-05-09 15:13:06 +0300
committerMarc Kleine-Budde <mkl@pengutronix.de>2016-06-17 16:39:42 +0300
commit7da29f97d6c816f5f95f964f4ced0dae14968cce (patch)
tree6022ba055fe32cfc046491cae990f85c0b49596d /drivers/net/can/slcan.c
parenta20fadf85312f7e999c7279af3e038e4f3539fbf (diff)
downloadlinux-7da29f97d6c816f5f95f964f4ced0dae14968cce.tar.xz
can: dev: can-calc-bit-timing(): better sample point calculation
This patch optimizes the calculation of the sample point. To understand what it does have a look at the original implementation. If there is a combination of timing parameters where both the bitrate and sample point error are 0 the current implementation will find it. However if the reference clock doesn't allow an optimal bitrate (this means the bitrate error is always != 0) there might be several timing parameter combinations having the same bitrate error. The original implementation will allways choose the one with the highest brp. The actual sample point error isn't taken into account. This patch changes the algorithm to minimize the sample point error, too. Now a brp/tseg combination is accepted as better if one of these condition are fulfilled: 1) the bit rate error must be smaller, or 2) the bit rate error must be equal and the sample point error must be equal or smaller If a smaller bit rate error is found the sample point error is reset. This ensures that we first optimize for small bit rate error and then for small sample point errors. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/slcan.c')
0 files changed, 0 insertions, 0 deletions