[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221129153933.GA716319@bhelgaas>
Date: Tue, 29 Nov 2022 09:39:33 -0600
From: Bjorn Helgaas <helgaas@...nel.org>
To: Lars Povlsen <lars.povlsen@...rochip.com>
Cc: Rishi Gupta <gupt21@...il.com>, Jiri Kosina <jikos@...nel.org>,
Benjamin Tissoires <benjamin.tissoires@...hat.com>,
UNGLinuxDriver <UNGLinuxDriver@...rochip.com>,
linux-i2c@...r.kernel.org, linux-input@...r.kernel.org,
linux-kernel@...r.kernel.org,
Takayuki 'January June' Suwa <jjsuwa_sys3175@...oo.co.jp>
Subject: Re: [PATCH] HID: mcp2221: Fix GPIO output handling
[+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@...rochip.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
Powered by blists - more mailing lists