From: "Trevitz, Daniel" <Daniel.Trevitz@wika.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: "linux-can@vger.kernel.org" <linux-can@vger.kernel.org>,
Ryan Edwards <ryan.edwards@gmail.com>
Subject: RE: [PATCH v2 3/3] can: gs_usb: add switchable termination support
Date: Tue, 20 Sep 2022 11:48:54 +0000 [thread overview]
Message-ID: <d5116175927a48fdad6c5fbedc34e418@wika.com> (raw)
In-Reply-To: <20220919193343.jcepx2lccia6lmdn@pengutronix.de>
Looks good!
Once my hardware comes in with the termination resistor built in I'll run this latest version.
I've been doing all my tests on an earlier version without it, just monitoring the gpio state.
It probably won't be for a few weeks till they get in.
BR,
Daniel
**CONFIDENTIALITY NOTICE**
This communication, including any attachments, is from WIKA Mobile Control, LP and contains confidential information intended only for the addressee(s). If you are not the intended recipient, any use, dissemination, distribution or copying of this document or its contents is strictly prohibited. If you have received this communication in error, please contact the sender by reply e-mail immediately and destroy all copies of the original message.
-----Original Message-----
From: Marc Kleine-Budde <mkl@pengutronix.de>
Sent: Monday, September 19, 2022 3:34 PM
To: Trevitz, Daniel <Daniel.Trevitz@wika.com>
Cc: linux-can@vger.kernel.org; Ryan Edwards <ryan.edwards@gmail.com>
Subject: Re: [PATCH v2 3/3] can: gs_usb: add switchable termination support
On 19.09.2022 17:14:39, Trevitz, Daniel wrote:
> + if (feature & GS_CAN_FEATURE_TERMINATION) {
> + dev->can.termination_const = gs_usb_termination_const;
> + dev->can.termination_const_cnt = ARRAY_SIZE(gs_usb_termination_const);
> + dev->can.do_set_termination = gs_usb_set_termination;
> +
> + rc = gs_usb_get_termination(netdev, &dev->can.termination);
> + if (rc) {
> + dev_err(&intf->dev,
> + "Couldn't get current termination state for channel %d (%pe)\n",
> + channel, ERR_PTR(rc));
> + goto out_free_candev;
> + }
> + }
>
> Does it make sense to check if we have the termination support, then
> set the values? My logic is that just because the termination is not
> working correctly, it does not mean everything is broken.
Makes sense!
> This way you could have a multi-can-channel USB device but with only
> specific channels supporting configurable termination resistors.
At least from the Linux driver's perspective the feature bits are per channel not per device.
> Something like:
>
> rc = gs_usb_get_termination(netdev, &dev->can.termination); if (rc) {
> dev_err(&intf->dev,
> "Couldn't get current termination state for channel %d (%pe). Not enabling termination support for this channel\n",
> channel, ERR_PTR(rc));
> } else {
> dev->can.termination_const = gs_usb_termination_const;
> dev->can.termination_const_cnt = ARRAY_SIZE(gs_usb_termination_const);
> dev->can.do_set_termination = gs_usb_set_termination; }
I've reduced the dev_err() to dev_info() and tried to keep the error message short. Also I remove the termination feature flag. The incremental patch looks like this:
diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c index 5c988e528734..b0273fab1843 100644
--- a/drivers/net/can/usb/gs_usb.c
+++ b/drivers/net/can/usb/gs_usb.c
@@ -1287,16 +1287,17 @@ static struct gs_can *gs_make_candev(unsigned int channel,
}
if (feature & GS_CAN_FEATURE_TERMINATION) {
- dev->can.termination_const = gs_usb_termination_const;
- dev->can.termination_const_cnt = ARRAY_SIZE(gs_usb_termination_const);
- dev->can.do_set_termination = gs_usb_set_termination;
-
rc = gs_usb_get_termination(netdev, &dev->can.termination);
if (rc) {
- dev_err(&intf->dev,
- "Couldn't get current termination state for channel %d (%pe)\n",
- channel, ERR_PTR(rc));
- goto out_free_candev;
+ dev->feature &= ~GS_CAN_FEATURE_TERMINATION;
+
+ dev_info(&intf->dev,
+ "Disabling termination support for channel %d (%pe)\n",
+ channel, ERR_PTR(rc));
+ } else {
+ dev->can.termination_const = gs_usb_termination_const;
+ dev->can.termination_const_cnt = ARRAY_SIZE(gs_usb_termination_const);
+ dev->can.do_set_termination =
+ gs_usb_set_termination;
}
}
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | BLOCKEDpengutronix[.]deBLOCKED |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2022-09-20 11:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-18 21:17 [PATCH v2 0/3] can: gs_usb: cleanups and termination support Marc Kleine-Budde
2022-09-18 21:18 ` [PATCH v2 1/3] can: gs_usb: gs_make_candev(): convert from usb_control_msg() to usb_control_msg_recv() Marc Kleine-Budde
2022-09-18 21:18 ` [PATCH v2 2/3] can: gs_usb: gs_make_candev(): clean up error handling Marc Kleine-Budde
2022-09-18 21:18 ` [PATCH v2 3/3] can: gs_usb: add switchable termination support Marc Kleine-Budde
2022-09-19 17:14 ` Trevitz, Daniel
2022-09-19 19:33 ` Marc Kleine-Budde
2022-09-20 11:48 ` Trevitz, Daniel [this message]
2022-09-18 22:00 ` [PATCH v2 0/3] can: gs_usb: cleanups and " Trevitz, Daniel
2022-09-19 7:34 ` Marc Kleine-Budde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d5116175927a48fdad6c5fbedc34e418@wika.com \
--to=daniel.trevitz@wika.com \
--cc=linux-can@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=ryan.edwards@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox