linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Louis Morhet <lmorhet@kalrayinc.com>
To: gupt21@gmail.com, jikos@kernel.org, benjamin.tissoires@redhat.com
Cc: linux-i2c@vger.kernel.org, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 0/2] Fixes for the mcp2221 gpiochip get_* calls
Date: Tue, 4 Apr 2023 14:14:58 +0200	[thread overview]
Message-ID: <cover.1680602387.git.lmorhet@kalrayinc.com> (raw)

The mcp2221 HID driver exposes a gpiochip device.
While gpioset seemed to work fine, gpioget always returned 1 on all 4
GPIOs of the component (0x01 for input in the field "direction",
according to the documentation).

This patch series addresses this issue by fixing the order of the fields
in the driver's representation of the chip answer, and adding
consistency to the way the callbacks prepare their command and the way
the hid event handler gets these fields.
The set callbacks use a similar mechanism, but work for now because
setting a direction/value only requires gpio-specific positioning in the
command preparation, and not in the raw_event handler.

The core of this issue being a discrepancy in the way the command and
the answer fetch their fields of interest, I would also like to ask if
we should uniformize a bit the way this driver handles gpio, and how.
I thought about several possible implementations for that:
Use mcp->gp_idx as the base offset of the gpio for set too, and modify
the raw_event handler to fetch all relevant data based on that; or set
the buffers in the mcp structure as unions of the various commands
handled and use gp_idx simply as the gpio index to access relevant data
directly from the structured representation everywhere; or go back to ye
old defines to ensure portability...

Louis Morhet (2):
  HID: mcp2221: fix report layout for gpio get
  HID: mcp2221: fix get and get_direction for gpio

 drivers/hid/hid-mcp2221.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.17.1






             reply	other threads:[~2023-04-04 12:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-04 12:14 Louis Morhet [this message]
2023-04-04 12:15 ` [PATCH 1/2] HID: mcp2221: fix report layout for gpio get Louis Morhet
2023-04-04 12:15 ` [PATCH 2/2] HID: mcp2221: fix get and get_direction for gpio Louis Morhet
2023-04-13 14:43 ` [PATCH 0/2] Fixes for the mcp2221 gpiochip get_* calls Benjamin Tissoires
2023-04-13 14:49 ` Benjamin Tissoires
2023-04-13 16:46   ` Louis Morhet

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=cover.1680602387.git.lmorhet@kalrayinc.com \
    --to=lmorhet@kalrayinc.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=gupt21@gmail.com \
    --cc=jikos@kernel.org \
    --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).