All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	Andy Shevchenko <andy@kernel.org>
Subject: [PATCH v1 08/12] HID: cp2112: Define all GPIO mask and use it
Date: Mon,  3 Jul 2023 21:52:18 +0300	[thread overview]
Message-ID: <20230703185222.50554-9-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20230703185222.50554-1-andriy.shevchenko@linux.intel.com>

Define all GPIO mask and use it in the driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/hid/hid-cp2112.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c
index c8c59d70500e..37ed7fc54770 100644
--- a/drivers/hid/hid-cp2112.c
+++ b/drivers/hid/hid-cp2112.c
@@ -32,6 +32,7 @@
 #define CP2112_GPIO_GET_LENGTH			2
 #define CP2112_GPIO_SET_LENGTH			3
 #define CP2112_GPIO_MAX_GPIO			8
+#define CP2112_GPIO_ALL_GPIO_MASK		GENMASK(7, 0)
 
 enum {
 	CP2112_GPIO_CONFIG		= 0x02,
@@ -173,7 +174,7 @@ struct cp2112_device {
 	u8 gpio_prev_state;
 };
 
-static int gpio_push_pull = 0xFF;
+static int gpio_push_pull = CP2112_GPIO_ALL_GPIO_MASK;
 module_param(gpio_push_pull, int, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(gpio_push_pull, "GPIO push-pull configuration bitmask");
 
@@ -226,7 +227,7 @@ static void cp2112_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 	mutex_lock(&dev->lock);
 
 	buf[0] = CP2112_GPIO_SET;
-	buf[1] = value ? 0xff : 0;
+	buf[1] = value ? CP2112_GPIO_ALL_GPIO_MASK : 0;
 	buf[2] = 1 << offset;
 
 	ret = hid_hw_raw_request(hdev, CP2112_GPIO_SET, buf,
-- 
2.40.0.1.gaa8946217a0b


  parent reply	other threads:[~2023-07-03 18:52 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-03 18:52 [PATCH v1 00/12] HID: cp2112: Cleanups and refactorings Andy Shevchenko
2023-07-03 18:52 ` [PATCH v1 01/12] lib/string_choices: Add str_write_read() helper Andy Shevchenko
2023-07-03 18:52 ` [PATCH v1 02/12] HID: cp2112: Use str_write_read() and str_read_write() Andy Shevchenko
2023-07-03 18:52 ` [PATCH v1 03/12] HID: cp2112: Make irq_chip immutable Andy Shevchenko
2023-07-03 18:52 ` [PATCH v1 04/12] HID: cp2112: Switch to for_each_set_bit() to simplify the code Andy Shevchenko
2023-07-03 18:52 ` [PATCH v1 05/12] HID: cp2112: Don't call ->to_irq() explicitly Andy Shevchenko
2023-07-03 18:52 ` [PATCH v1 06/12] HID: cp2112: Remove dead code Andy Shevchenko
2023-08-26 18:29   ` Christophe JAILLET
2023-08-28  8:52     ` Andy Shevchenko
2023-07-03 18:52 ` [PATCH v1 07/12] HID: cp2112: Define maximum GPIO constant and use it Andy Shevchenko
2023-07-03 18:52 ` Andy Shevchenko [this message]
2023-07-03 18:52 ` [PATCH v1 09/12] HID: cp2112: Use BIT() in GPIO setter and getter Andy Shevchenko
2023-07-03 18:52 ` [PATCH v1 10/12] HID: cp2112: Use sysfs_emit() to instead of scnprintf() Andy Shevchenko
2023-07-03 18:52 ` [PATCH v1 11/12] HID: cp2112: Convert to DEVICE_ATTR_RW() Andy Shevchenko
2023-07-03 18:52 ` [PATCH v1 12/12] HID: cp2112: Use octal permissions Andy Shevchenko
2023-07-27 18:43 ` [PATCH v1 00/12] HID: cp2112: Cleanups and refactorings Andy Shevchenko
2023-08-04  6:40   ` Andy Shevchenko
2023-08-07 11:19     ` Jiri Kosina
2023-08-07 14:30       ` Andy Shevchenko
2023-08-14  9:28         ` Jiri Kosina
2023-08-21  8:11           ` Andy Shevchenko
2023-08-21  8:51             ` Benjamin Tissoires
2023-08-21  9:34               ` Andy Shevchenko
2023-08-21  9:35                 ` Andy Shevchenko
2023-08-21 10:19                   ` Benjamin Tissoires
2023-08-21 10:27                     ` Benjamin Tissoires
2023-08-21 10:37                       ` Andy Shevchenko
2023-08-21 13:56                         ` Benjamin Tissoires
2023-08-21 10:32                     ` Andy Shevchenko
2023-08-21 12:06                       ` Benjamin Tissoires

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=20230703185222.50554-9-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=andy@kernel.org \
    --cc=benjamin.tissoires@redhat.com \
    --cc=jikos@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.