can: dev: add CAN interface termination API
authorOliver Hartkopp <socketcan@hartkopp.net>
Tue, 10 Jan 2017 17:52:06 +0000 (18:52 +0100)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Tue, 24 Jan 2017 12:52:00 +0000 (13:52 +0100)
commit12a6075cabc0d9ffbc0366b44daa22f278606312
treee57621aa1b8b591f869d7313d4bb5c55a5c9884b
parentd140199af510ad4749dc5e38b7922135258ba5fd
can: dev: add CAN interface termination API

This patch adds a netlink interface to configure the CAN bus termination of
CAN interfaces.

Inside the driver an array of supported termination values is defined:

const u16 drvname_termination[] = { 60, 120, CAN_TERMINATION_DISABLED };

struct drvname_priv *priv;
priv = netdev_priv(dev);

priv->termination_const = drvname_termination;
priv->termination_const_cnt = ARRAY_SIZE(drvname_termination);
priv->termination = CAN_TERMINATION_DISABLED;

And the funtion to set the value has to be defined:

priv->do_set_termination = drvname_set_termination;

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Reviewed-by: Ramesh Shanmugasundaram <Ramesh.shanmugasundaram@bp.renesas.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/dev.c
include/linux/can/dev.h
include/uapi/linux/can/netlink.h