linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Lars Povlsen <lars.povlsen@microchip.com>
Cc: Rishi Gupta <gupt21@gmail.com>, Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	UNGLinuxDriver <UNGLinuxDriver@microchip.com>,
	linux-i2c@vger.kernel.org, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
Subject: Re: [PATCH] HID: mcp2221: Fix GPIO output handling
Date: Tue, 29 Nov 2022 09:39:33 -0600	[thread overview]
Message-ID: <20221129153933.GA716319@bhelgaas> (raw)
In-Reply-To: <20201104220223.293253-1-lars.povlsen@microchip.com>

[+cc Takayuki, thanks for your report!]

On Wed, Nov 04, 2020 at 11:02:23PM +0100, Lars Povlsen wrote:
> The mcp2221 driver GPIO output handling has has several issues.
> 
> * A wrong value is used for the GPIO direction.
> 
> * Wrong offsets are calculated for some GPIO set value/set direction
>   operations, when offset is larger than 0.
> 
> This has been fixed by introducing proper manifest constants for the
> direction encoding, and using 'offsetof' when calculating GPIO
> register offsets.
> 
> The updated driver has been tested with the Sparx5 pcb134/pcb135
> board, which has the mcp2221 device with several (output) GPIO's.
> 
> Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com>
> ---
>  drivers/hid/hid-mcp2221.c | 48 +++++++++++++++++++++++++++++++--------
>  1 file changed, 39 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/hid/hid-mcp2221.c b/drivers/hid/hid-mcp2221.c
> index 0d27ccb55dd9..4211b9839209 100644
> --- a/drivers/hid/hid-mcp2221.c
> +++ b/drivers/hid/hid-mcp2221.c

> +/* MCP GPIO get command layout */
> +struct mcp_get_gpio {
> +	u8 cmd;
> +	u8 dummy;
> +	struct {
> +		u8 direction;
> +		u8 value;
> +	} gpio[MCP_NGPIO];
> +} __packed;

This bug report: https://bugzilla.kernel.org/show_bug.cgi?id=216736
suggests that direction and value may be reversed here.

Mentioning here in case nobody actively monitors the bugzilla.

Bjorn

  parent reply	other threads:[~2022-11-29 15:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-04 22:02 [PATCH] HID: mcp2221: Fix GPIO output handling Lars Povlsen
2020-11-05  2:46 ` rishi gupta
2020-11-05 10:15 ` Jiri Kosina
2022-11-29 15:39 ` Bjorn Helgaas [this message]
2022-12-13 13:53   ` Sven Zühlsdorf

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=20221129153933.GA716319@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=gupt21@gmail.com \
    --cc=jikos@kernel.org \
    --cc=jjsuwa_sys3175@yahoo.co.jp \
    --cc=lars.povlsen@microchip.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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).