[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240509171736.2048414-12-christoph.fritz@hexdev.de>
Date: Thu, 9 May 2024 19:17:36 +0200
From: Christoph Fritz <christoph.fritz@...dev.de>
To: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
Jiri Slaby <jirislaby@...nel.org>,
Simon Horman <horms@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Marc Kleine-Budde <mkl@...gutronix.de>,
Oliver Hartkopp <socketcan@...tkopp.net>,
Vincent Mailhol <mailhol.vincent@...adoo.fr>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Jiri Kosina <jikos@...nel.org>,
Benjamin Tissoires <bentiss@...nel.org>,
Sebastian Reichel <sre@...nel.org>,
Linus Walleij <linus.walleij@...aro.org>
Cc: Andreas Lauser <andreas.lauser@...cedes-benz.com>,
Jonathan Corbet <corbet@....net>,
Pavel Pisa <pisa@....felk.cvut.cz>,
linux-can@...r.kernel.org,
netdev@...r.kernel.org,
devicetree@...r.kernel.org,
linux-input@...r.kernel.org,
linux-serial@...r.kernel.org
Subject: [PATCH v4 11/11] HID: hexLIN: Implement ability to update lin mode
Enhance the hexLIN driver by implementing the newly introduced
update_lin_mode() callback. So that either commander or responder mode
can be configured on this hardware.
Signed-off-by: Christoph Fritz <christoph.fritz@...dev.de>
---
drivers/hid/hid-hexdev-hexlin.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/hid/hid-hexdev-hexlin.c b/drivers/hid/hid-hexdev-hexlin.c
index a9ed080b3e33e..48fcb1e5b6e41 100644
--- a/drivers/hid/hid-hexdev-hexlin.c
+++ b/drivers/hid/hid-hexdev-hexlin.c
@@ -164,6 +164,8 @@ HEXLIN_GET_CMD(get_baudrate, HEXLIN_GET_BAUDRATE)
}
HEXLIN_VAL_CMD(send_break, HEXLIN_SEND_BREAK, hexlin_val8_req, u8)
+HEXLIN_VAL_CMD(set_mode_controller, HEXLIN_SET_MODE_CONTROLLER, hexlin_val8_req,
+ bool)
static int hexlin_send_unconditional(struct hexlin_priv_data *priv,
const struct hexlin_frame *hxf)
@@ -322,6 +324,14 @@ static int hexlin_ldo_tx(struct lin_device *ldev,
return ret;
}
+static int hexlin_update_lin_mode(struct lin_device *ldev, enum lin_mode lm)
+{
+ struct hid_device *hdev = to_hid_device(ldev->dev);
+ struct hexlin_priv_data *priv = hid_get_drvdata(hdev);
+
+ return hexlin_set_mode_controller(priv, lm == LINBUS_COMMANDER);
+}
+
static int hexlin_update_bitrate(struct lin_device *ldev, u16 bitrate)
{
struct hid_device *hdev = to_hid_device(ldev->dev);
@@ -393,6 +403,7 @@ static const struct lin_device_ops hexlin_ldo = {
.ldo_open = hexlin_open,
.ldo_stop = hexlin_stop,
.ldo_tx = hexlin_ldo_tx,
+ .update_lin_mode = hexlin_update_lin_mode,
.update_bitrate = hexlin_update_bitrate,
.get_responder_answer = hexlin_get_responder_answer,
.update_responder_answer = hexlin_update_resp_answer,
--
2.39.2
Powered by blists - more mailing lists