From: Jim Posen <jim.posen@gmail.com>
To: gupt21@gmail.com
Cc: benjamin.tissoires@redhat.com, jikos@kernel.org,
linus.walleij@linaro.org, linux-input@vger.kernel.org,
tobias.junghans@inhub.de
Subject: Re: [PATCH 2/2] HID: mcp2221: configure GP pins for GPIO function
Date: Fri, 24 Sep 2021 13:36:21 -0400 [thread overview]
Message-ID: <20210924173620.888507-1-jim.posen@gmail.com> (raw)
In-Reply-To: <CALUj-gvpwhYW8FuTaEjSmgNUhMTizYKvXDxAu6c6SNPbHNdOyg@mail.gmail.com>
Thanks for submitting this patch Tobias, I ran into the same issue using the GPIO pins on the MCP2221.
I don't have prior experience with Linux driver dev, but I'm going to add some thoughts anyway.
The approach of configuring the pins for GPIO operation on request/free makes sense to me as opposed to assuming they were already configured somehow beforehand. Aside from being inconvenient, assuming correct configuration seems like a recipe for accidentally shorting the pin, which Rishi is concerned about.
With regards to your patch, I find it odd that the handler for the MCP2221_SRAM_SETTINGS_GET event sets gp_default_settings. Instead, I suggest it set gp_runtime_settings then memcpys from gp_runtime_settings to gp_default_settings at the bottom of probe. And rename mcp_get_gp_default_settings to mcp_get_gp_settings.
I ran into another bug in this driver which I think makes sense to fix in this patch set: direction and value are flipped in the mcp_get_gpio struct. According to the data sheet, value comes before direction for each pin.
With this patch and that last bug fixed, I have tested the driver and GPIO operations are now working for me.
next prev parent reply other threads:[~2021-09-24 17:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-18 15:27 [PATCH 1/2] HID: mcp2221: enable HID I/O during probe Tobias Junghans
2021-08-18 15:27 ` [PATCH 2/2] HID: mcp2221: configure GP pins for GPIO function Tobias Junghans
[not found] ` <CALUj-gtmN70HwzvtsO7rss0LXboFC0h9Dgfakt6UEvC_6FdAwA@mail.gmail.com>
2021-08-20 7:18 ` Tobias Junghans
2021-08-30 9:11 ` rishi gupta
2021-08-30 13:09 ` Tobias Junghans
2021-08-30 13:17 ` rishi gupta
2021-08-30 13:30 ` Tobias Junghans
2021-09-02 7:13 ` rishi gupta
2021-09-16 23:13 ` Linus Walleij
2021-09-19 10:42 ` rishi gupta
2021-09-24 17:36 ` Jim Posen [this message]
2022-04-06 15:54 ` [PATCH 1/2] HID: mcp2221: enable HID I/O during probe rishi gupta
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=20210924173620.888507-1-jim.posen@gmail.com \
--to=jim.posen@gmail.com \
--cc=benjamin.tissoires@redhat.com \
--cc=gupt21@gmail.com \
--cc=jikos@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-input@vger.kernel.org \
--cc=tobias.junghans@inhub.de \
/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;
as well as URLs for NNTP newsgroup(s).