* Re: [PATCH] Input: Add KUnit tests for some of the input core helper functions
From: Javier Martinez Canillas @ 2023-03-30 8:09 UTC (permalink / raw)
To: Daniel Latypov
Cc: linux-kernel, Brendan Higgins, Maxime Ripard, linux-kselftest,
Enric Balletbo i Serra, David Gow, kunit-dev, Dmitry Torokhov,
linux-input
In-Reply-To: <CAGS_qxpEzXRWqy2Xd8qJn7GRxv+8HF40Lxt8esD-59CzeePZSw@mail.gmail.com>
Daniel Latypov <dlatypov@google.com> writes:
Hello Daniel,
Thanks a lot for your feedback!
> On Wed, Mar 29, 2023 at 2:23 AM Javier Martinez Canillas
> <javierm@redhat.com> wrote:
[...]
>>
>> $ ./tools/testing/kunit/kunit.py run \
>> --kunitconfig=drivers/input/tests/.kunitconfig
>
> Nice!
> A few small suggestions below as someone who has worked on KUnit.
>
> FYI, to save a few keystrokes, you can omit the "/.kunitconfig" and
> just pass the dir, i.e.
> --kunitconfig=drivers/input/tests
>
Ah, cool. I didn't know that.
[...]
>> drivers/input/tests/input_test.c | 144 +++++++++++++++++++++++++++++++
>
> I don't see the .kunitconfig in the diff.
> Was it accidentally forgotten or does this patch apply to a tree that
> already has the file?
>
> (it's easy to forget since git will still ignore it by default, IIRC)
>
I did indeed forgot because as you mentioned git add complained and I
missed that needed to force to add it.
[...]
>> + Say Y here if you want to build the KUnit tests for the input
>> + subsystem. For more information about KUnit and unit tests in
>> + general, please refer to the KUnit documentation in
>> + Documentation/dev-tools/kunit/.
>> +
>> + If in doubt, say "N".
>
> FYI, I know this is in the style guide, but I'd personally feel free
> to leave out this paragraph.
>
> Having such "advertising" about what KUnit is made more sense when
> less people knew about it.
> It's not known by everyone in the community yet, but we might be
> getting to a point where this turns into repetitive bloat.
>
Ok, I'll drop these.
[...]
>> +
>> + ret = input_register_device(input_dev);
>> + KUNIT_ASSERT_EQ(test, ret, 0);
>
> (very unlikely that this matters, but...)
> Hmm, should we call input_free_device() if this fails?
> i.e. something like
>
> ret = ...;
> if (ret) {
> input_free_device(input_dev);
> KUNIT_ASSERT_FAILURE(test, "failed to register device: %d", ret);
> }
>
Indeed. I'll do this too.
[...]
>> +
>> + ret = input_get_poll_interval(input_dev);
>> + KUNIT_ASSERT_EQ(test, ret, -EINVAL);
>
> minor suggestion: can we inline these? E.g.
> KUNIT_ASSERT_EQ(test, -EINVAL, input_get_poll_interval(input_dev));
> This way on failure, KUnit can print the function call instead of just `ret`.
>
> Users could always find out what failed by the line #, but including
> it in the output would be a bit nicer.
>
> E.g. w/ KUNIT_EXPECT_EQ(test, 0, ...)
>
> # example_simple_test: EXPECTATION FAILED at
> lib/kunit/kunit-example-test.c:29
> Expected 0 == input_get_poll_interval(input_dev), but
> input_get_poll_interval(input_dev) == 42 (0x2a)
>
> verus
>
> # example_simple_test: EXPECTATION FAILED at
> lib/kunit/kunit-example-test.c:28
> Expected ret == 0, but
> ret == 42 (0x2a)
>
Great suggestion. I'll change too, it would also get rid of the ret variable.
--
Best regards,
Javier Martinez Canillas
Core Platforms
Red Hat
^ permalink raw reply
* [PATCH v2] Input: Add KUnit tests for some of the input core helper functions
From: Javier Martinez Canillas @ 2023-03-30 8:18 UTC (permalink / raw)
To: linux-kernel
Cc: Enric Balletbo i Serra, Brendan Higgins, linux-kselftest,
Maíra Canal, David Gow, Daniel Latypov, kunit-dev,
Maxime Ripard, Javier Martinez Canillas, Dmitry Torokhov,
linux-input
The input subsystem doesn't currently have any unit tests, let's add a
CONFIG_INPUT_KUNIT_TEST option that builds a test suite to be executed
with the KUnit test infrastructure.
For now, only three tests were added for some of the input core helper
functions that are trivial to test:
* input_test_polling: set/get poll interval and set-up a poll handler.
* input_test_timestamp: set/get input event timestamps.
* input_test_match_device_id: match a device by bus, vendor, product,
version and events capable of handling.
But having the minimal KUnit support allows to add more tests and suites
as follow-up changes. The tests can be run with the following command:
$ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/input/tests/
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Tested-by: Enric Balletbo i Serra <eballetbo@redhat.com>
---
Changes in v2:
- Add Enric's Tested-by tag.
- Drop the .kunitconfig from the example command (Daniel Latypov).
- Add .kunitconfig that wasn't added by mistake (Daniel Latypov).
- Remove ref to KUnit docs in the Kconfig help text (Daniel Latypov).
- Inline function calls in the KUNIT_ASSERT_*() calls (Daniel Latypov).
- Add some comments to explain why a fail or success is expected.
drivers/input/Kconfig | 10 +++
drivers/input/Makefile | 1 +
drivers/input/tests/.kunitconfig | 3 +
drivers/input/tests/Makefile | 3 +
drivers/input/tests/input_test.c | 150 +++++++++++++++++++++++++++++++
5 files changed, 167 insertions(+)
create mode 100644 drivers/input/tests/.kunitconfig
create mode 100644 drivers/input/tests/Makefile
create mode 100644 drivers/input/tests/input_test.c
diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig
index e2752f7364bc..735f90b74ee5 100644
--- a/drivers/input/Kconfig
+++ b/drivers/input/Kconfig
@@ -166,6 +166,16 @@ config INPUT_EVBUG
To compile this driver as a module, choose M here: the
module will be called evbug.
+config INPUT_KUNIT_TEST
+ tristate "KUnit tests for Input" if !KUNIT_ALL_TESTS
+ depends on INPUT && KUNIT=y
+ default KUNIT_ALL_TESTS
+ help
+ Say Y here if you want to build the KUnit tests for the input
+ subsystem.
+
+ If in doubt, say "N".
+
config INPUT_APMPOWER
tristate "Input Power Event -> APM Bridge" if EXPERT
depends on INPUT && APM_EMULATION
diff --git a/drivers/input/Makefile b/drivers/input/Makefile
index 2266c7d010ef..c78753274921 100644
--- a/drivers/input/Makefile
+++ b/drivers/input/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_INPUT_JOYSTICK) += joystick/
obj-$(CONFIG_INPUT_TABLET) += tablet/
obj-$(CONFIG_INPUT_TOUCHSCREEN) += touchscreen/
obj-$(CONFIG_INPUT_MISC) += misc/
+obj-$(CONFIG_INPUT_KUNIT_TEST) += tests/
obj-$(CONFIG_INPUT_APMPOWER) += apm-power.o
diff --git a/drivers/input/tests/.kunitconfig b/drivers/input/tests/.kunitconfig
new file mode 100644
index 000000000000..2f5bedf8028e
--- /dev/null
+++ b/drivers/input/tests/.kunitconfig
@@ -0,0 +1,3 @@
+CONFIG_KUNIT=y
+CONFIG_INPUT=y
+CONFIG_INPUT_KUNIT_TEST=y
diff --git a/drivers/input/tests/Makefile b/drivers/input/tests/Makefile
new file mode 100644
index 000000000000..90cf954181bc
--- /dev/null
+++ b/drivers/input/tests/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-$(CONFIG_INPUT_KUNIT_TEST) += input_test.o
diff --git a/drivers/input/tests/input_test.c b/drivers/input/tests/input_test.c
new file mode 100644
index 000000000000..e5a6c1ad2167
--- /dev/null
+++ b/drivers/input/tests/input_test.c
@@ -0,0 +1,150 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * KUnit test for the input core.
+ *
+ * Copyright (c) 2023 Red Hat Inc
+ */
+
+#include <linux/delay.h>
+#include <linux/input.h>
+
+#include <kunit/test.h>
+
+#define POLL_INTERVAL 100
+
+static int input_test_init(struct kunit *test)
+{
+ struct input_dev *input_dev;
+ int ret;
+
+ input_dev = input_allocate_device();
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, input_dev);
+
+ input_dev->name = "Test input device";
+ input_dev->id.bustype = BUS_VIRTUAL;
+ input_dev->id.vendor = 1;
+ input_dev->id.product = 1;
+ input_dev->id.version = 1;
+ input_set_capability(input_dev, EV_KEY, BTN_LEFT);
+ input_set_capability(input_dev, EV_KEY, BTN_RIGHT);
+
+ ret = input_register_device(input_dev);
+ if (ret) {
+ input_free_device(input_dev);
+ KUNIT_ASSERT_FAILURE(test, "Register device failed: %d", ret);
+ }
+
+ test->priv = input_dev;
+
+ return 0;
+}
+
+static void input_test_exit(struct kunit *test)
+{
+ struct input_dev *input_dev = test->priv;
+
+ input_unregister_device(input_dev);
+ input_free_device(input_dev);
+}
+
+static void input_test_poll(struct input_dev *input) { }
+
+static void input_test_polling(struct kunit *test)
+{
+ struct input_dev *input_dev = test->priv;
+
+ /* Must fail because a poll handler has not been set-up yet */
+ KUNIT_ASSERT_EQ(test, input_get_poll_interval(input_dev), -EINVAL);
+
+ KUNIT_ASSERT_EQ(test, input_setup_polling(input_dev, input_test_poll), 0);
+
+ input_set_poll_interval(input_dev, POLL_INTERVAL);
+
+ /* Must succeed because poll handler was set-up and poll interval set */
+ KUNIT_ASSERT_EQ(test, input_get_poll_interval(input_dev), POLL_INTERVAL);
+}
+
+static void input_test_timestamp(struct kunit *test)
+{
+ const ktime_t invalid_timestamp = ktime_set(0, 0);
+ struct input_dev *input_dev = test->priv;
+ ktime_t *timestamp, time;
+
+ timestamp = input_get_timestamp(input_dev);
+ time = timestamp[INPUT_CLK_MONO];
+
+ /* The returned timestamp must always be valid */
+ KUNIT_ASSERT_EQ(test, ktime_compare(time, invalid_timestamp), 1);
+
+ time = ktime_get();
+ input_set_timestamp(input_dev, time);
+
+ timestamp = input_get_timestamp(input_dev);
+ /* The timestamp must be the same than set before */
+ KUNIT_ASSERT_EQ(test, ktime_compare(timestamp[INPUT_CLK_MONO], time), 0);
+}
+
+static void input_test_match_device_id(struct kunit *test)
+{
+ struct input_dev *input_dev = test->priv;
+ struct input_device_id id;
+
+ /*
+ * Must match when the input device bus, vendor, product, version
+ * and events capable of handling are the same and fail to match
+ * otherwise.
+ */
+ id.flags = INPUT_DEVICE_ID_MATCH_BUS;
+ id.bustype = BUS_VIRTUAL;
+ KUNIT_ASSERT_TRUE(test, input_match_device_id(input_dev, &id));
+
+ id.bustype = BUS_I2C;
+ KUNIT_ASSERT_FALSE(test, input_match_device_id(input_dev, &id));
+
+ id.flags = INPUT_DEVICE_ID_MATCH_VENDOR;
+ id.vendor = 1;
+ KUNIT_ASSERT_TRUE(test, input_match_device_id(input_dev, &id));
+
+ id.vendor = 2;
+ KUNIT_ASSERT_FALSE(test, input_match_device_id(input_dev, &id));
+
+ id.flags = INPUT_DEVICE_ID_MATCH_PRODUCT;
+ id.product = 1;
+ KUNIT_ASSERT_TRUE(test, input_match_device_id(input_dev, &id));
+
+ id.product = 2;
+ KUNIT_ASSERT_FALSE(test, input_match_device_id(input_dev, &id));
+
+ id.flags = INPUT_DEVICE_ID_MATCH_VERSION;
+ id.version = 1;
+ KUNIT_ASSERT_TRUE(test, input_match_device_id(input_dev, &id));
+
+ id.version = 2;
+ KUNIT_ASSERT_FALSE(test, input_match_device_id(input_dev, &id));
+
+ id.flags = INPUT_DEVICE_ID_MATCH_EVBIT;
+ __set_bit(EV_KEY, id.evbit);
+ KUNIT_ASSERT_TRUE(test, input_match_device_id(input_dev, &id));
+
+ __set_bit(EV_ABS, id.evbit);
+ KUNIT_ASSERT_FALSE(test, input_match_device_id(input_dev, &id));
+}
+
+static struct kunit_case input_tests[] = {
+ KUNIT_CASE(input_test_polling),
+ KUNIT_CASE(input_test_timestamp),
+ KUNIT_CASE(input_test_match_device_id),
+ { /* sentinel */ }
+};
+
+static struct kunit_suite input_test_suite = {
+ .name = "input_core",
+ .init = input_test_init,
+ .exit = input_test_exit,
+ .test_cases = input_tests,
+};
+
+kunit_test_suite(input_test_suite);
+
+MODULE_AUTHOR("Javier Martinez Canillas <javierm@redhat.com>");
+MODULE_LICENSE("GPL");
base-commit: 3a93e40326c8f470e71d20b4c42d36767450f38f
--
2.40.0
^ permalink raw reply related
* Re: [REGRESSION] wrong coord from Thinkpad TrackPoint since 6.2 kernel
From: Takashi Iwai @ 2023-03-30 8:23 UTC (permalink / raw)
To: Hans de Goede
Cc: Pali Rohár, Dmitry Torokhov, regressions, linux-input,
linux-kernel
In-Reply-To: <874jq3q52i.wl-tiwai@suse.de>
On Wed, 29 Mar 2023 11:28:53 +0200,
Takashi Iwai wrote:
>
> On Wed, 29 Mar 2023 11:22:18 +0200,
> Hans de Goede wrote:
> >
> > Hi Takashi,
> >
> > On 3/29/23 10:16, Takashi Iwai wrote:
> > > Hi,
> > >
> > > we've received a bug report about Thinkpad TrackPoint (ALPS DualPoint
> > > Stick) on 6.2 kernel:
> > > https://bugzilla.opensuse.org/show_bug.cgi?id=1209805
> > >
> > > The device reports the wrong values as the movements, e.g. sometimes a
> > > value such as 255, 254 or -255 is returned while usually it should be
> > > a smaller value like -1 or 2.
> > >
> > > The evtest on 6.2.x kernel shows the wrong values like:
> > >
> > > Event: time 1680037542.898747, type 2 (EV_REL), code 0 (REL_X), value 255
> > > Event: time 1680037542.898747, -------------- SYN_REPORT ------------
> > > Event: time 1680037543.145196, type 2 (EV_REL), code 0 (REL_X), value 1
> > > Event: time 1680037543.145196, -------------- SYN_REPORT ------------
> > > Event: time 1680037543.175087, type 2 (EV_REL), code 1 (REL_Y), value -255
> > > Event: time 1680037543.175087, -------------- SYN_REPORT ------------
> > > Event: time 1680037543.185421, type 2 (EV_REL), code 0 (REL_X), value 1
> > > Event: time 1680037543.185421, type 2 (EV_REL), code 1 (REL_Y), value -255
> > > Event: time 1680037543.185421, -------------- SYN_REPORT ------------
> > >
> > > while 6.1.x kernel shows the correct values like:
> > >
> > > Event: time 1680037386.318058, type 2 (EV_REL), code 0 (REL_X), value -1
> > > Event: time 1680037386.318058, type 2 (EV_REL), code 1 (REL_Y), value -1
> > > Event: time 1680037386.318058, -------------- SYN_REPORT ------------
> > > Event: time 1680037386.328087, type 2 (EV_REL), code 0 (REL_X), value -1
> > > Event: time 1680037386.328087, type 2 (EV_REL), code 1 (REL_Y), value -1
> > > Event: time 1680037386.328087, -------------- SYN_REPORT ------------
> > > Event: time 1680037386.338046, type 2 (EV_REL), code 0 (REL_X), value -1
> > > Event: time 1680037386.338046, type 2 (EV_REL), code 1 (REL_Y), value -2
> > > Event: time 1680037386.338046, -------------- SYN_REPORT ------------
> > >
> > > I couldn't see any relevant changes in alps.c between those versions,
> > > so this is likely a breakage in a lower layer.
> > >
> > > Could you guys take a look?
> >
> > I believe this is caused by the kernel now using -funsigned-char
> > everywhere and this should be fixed by this commit:
> >
> > https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git/commit/?h=for-linus&id=754ff5060daf5a1cf4474eff9b4edeb6c17ef7ab
>
> Ah, that makes sense!
>
> I'll build a test kernel with this fix and ask the reporter for
> testing.
And it's confirmed that the commit above fixes the problem indeed.
thanks,
Takashi
^ permalink raw reply
* Re: [PATCH v2] Input: Add KUnit tests for some of the input core helper functions
From: kernel test robot @ 2023-03-30 10:53 UTC (permalink / raw)
To: Javier Martinez Canillas, linux-kernel
Cc: oe-kbuild-all, Enric Balletbo i Serra, Brendan Higgins,
linux-kselftest, Maíra Canal, David Gow, Daniel Latypov,
kunit-dev, Maxime Ripard, Javier Martinez Canillas,
Dmitry Torokhov, linux-input
In-Reply-To: <20230330081831.2291351-1-javierm@redhat.com>
Hi Javier,
I love your patch! Perhaps something to improve:
[auto build test WARNING on 3a93e40326c8f470e71d20b4c42d36767450f38f]
url: https://github.com/intel-lab-lkp/linux/commits/Javier-Martinez-Canillas/Input-Add-KUnit-tests-for-some-of-the-input-core-helper-functions/20230330-162045
base: 3a93e40326c8f470e71d20b4c42d36767450f38f
patch link: https://lore.kernel.org/r/20230330081831.2291351-1-javierm%40redhat.com
patch subject: [PATCH v2] Input: Add KUnit tests for some of the input core helper functions
config: powerpc-allnoconfig (https://download.01.org/0day-ci/archive/20230330/202303301815.kRKFM3NH-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/c0455fa125039a03d011836a8f82a2427591e51c
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Javier-Martinez-Canillas/Input-Add-KUnit-tests-for-some-of-the-input-core-helper-functions/20230330-162045
git checkout c0455fa125039a03d011836a8f82a2427591e51c
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303301815.kRKFM3NH-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/clk/.kunitconfig: warning: ignored by one of the .gitignore files
drivers/gpu/drm/tests/.kunitconfig: warning: ignored by one of the .gitignore files
drivers/gpu/drm/vc4/tests/.kunitconfig: warning: ignored by one of the .gitignore files
drivers/hid/.kunitconfig: warning: ignored by one of the .gitignore files
>> drivers/input/tests/.kunitconfig: warning: ignored by one of the .gitignore files
fs/ext4/.kunitconfig: warning: ignored by one of the .gitignore files
fs/fat/.kunitconfig: warning: ignored by one of the .gitignore files
kernel/kcsan/.kunitconfig: warning: ignored by one of the .gitignore files
lib/kunit/.kunitconfig: warning: ignored by one of the .gitignore files
mm/kfence/.kunitconfig: warning: ignored by one of the .gitignore files
net/sunrpc/.kunitconfig: warning: ignored by one of the .gitignore files
tools/testing/selftests/arm64/tags/.gitignore: warning: ignored by one of the .gitignore files
tools/testing/selftests/arm64/tags/Makefile: warning: ignored by one of the .gitignore files
tools/testing/selftests/arm64/tags/run_tags_test.sh: warning: ignored by one of the .gitignore files
tools/testing/selftests/arm64/tags/tags_test.c: warning: ignored by one of the .gitignore files
tools/testing/selftests/kvm/.gitignore: warning: ignored by one of the .gitignore files
tools/testing/selftests/kvm/Makefile: warning: ignored by one of the .gitignore files
tools/testing/selftests/kvm/config: warning: ignored by one of the .gitignore files
tools/testing/selftests/kvm/settings: warning: ignored by one of the .gitignore files
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply
* Re: [PATCH v2] Input: Add KUnit tests for some of the input core helper functions
From: Javier Martinez Canillas @ 2023-03-30 11:12 UTC (permalink / raw)
To: kernel test robot, linux-kernel
Cc: oe-kbuild-all, Enric Balletbo i Serra, Brendan Higgins,
linux-kselftest, Maíra Canal, David Gow, Daniel Latypov,
kunit-dev, Maxime Ripard, Dmitry Torokhov, linux-input
In-Reply-To: <202303301815.kRKFM3NH-lkp@intel.com>
kernel test robot <lkp@intel.com> writes:
Hello,
[...]
>
> All warnings (new ones prefixed by >>):
>
> drivers/clk/.kunitconfig: warning: ignored by one of the .gitignore files
> drivers/gpu/drm/tests/.kunitconfig: warning: ignored by one of the .gitignore files
> drivers/gpu/drm/vc4/tests/.kunitconfig: warning: ignored by one of the .gitignore files
> drivers/hid/.kunitconfig: warning: ignored by one of the .gitignore files
>>> drivers/input/tests/.kunitconfig: warning: ignored by one of the .gitignore files
KUnit folks, what should we do about this? I believe the correct thing
here would be for these dot-files to not be ignored by git.
Not only to prevent these reports, but also to avoid the need to add
them using `git add -f`, since is quite error prone and easy to miss.
I was thinking about posting the following patch:
From f1dc1733001682886458c23b676123635bc29da0 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Thu, 30 Mar 2023 13:04:42 +0200
Subject: [PATCH] .gitignore: Exclude KUnit config dot-files
There's a rule to ignore all the dot-files (.*) but we want to exclude the
config files used by KUnit (.kunitconfig) since those are usually added to
allow executing test suites without having to enable custom config options.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitignore b/.gitignore
index 70ec6037fa7a..7f86e0837909 100644
--- a/.gitignore
+++ b/.gitignore
@@ -103,6 +103,7 @@ modules.order
!.get_maintainer.ignore
!.gitattributes
!.gitignore
+!.kunitconfig
!.mailmap
!.rustfmt.toml
base-commit: 197b6b60ae7bc51dd0814953c562833143b292aa
--
2.40.0
--
Best regards,
Javier Martinez Canillas
Core Platforms
Red Hat
^ permalink raw reply related
* [PATCH v1] HID: Ignore battery for ELAN touchscreen on ROG Flow X13 GV301RA
From: weiliang1503 @ 2023-03-30 11:56 UTC (permalink / raw)
To: jikos; +Cc: benjamin.tissoires, rydberg, linux-input, linux-kernel,
weiliang1503
Ignore the reported battery level of the built-in touchscreen to suppress
battery warnings when a stylus is used. The device ID was added and the
battery ignore quirk was enabled.
Signed-off-by: weiliang1503 <weiliang1503@gmail.com>
---
drivers/hid/hid-ids.h | 1 +
drivers/hid/hid-input.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 63545cd30..6e111cb19 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -415,6 +415,7 @@
#define I2C_DEVICE_ID_HP_SPECTRE_X360_15 0x2817
#define I2C_DEVICE_ID_HP_SPECTRE_X360_13_AW0020NG 0x29DF
#define I2C_DEVICE_ID_ASUS_TP420IA_TOUCHSCREEN 0x2BC8
+#define I2C_DEVICE_ID_ASUS_GV301RA_TOUCHSCREEN 0x2C82
#define USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN 0x2544
#define USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN 0x2706
#define I2C_DEVICE_ID_SURFACE_GO_TOUCHSCREEN 0x261A
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 7fc967964..4ff422f28 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -372,6 +372,8 @@ static const struct hid_device_id hid_battery_quirks[] = {
HID_BATTERY_QUIRK_IGNORE },
{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_ASUS_TP420IA_TOUCHSCREEN),
HID_BATTERY_QUIRK_IGNORE },
+ { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_ASUS_GV301RA_TOUCHSCREEN),
+ HID_BATTERY_QUIRK_IGNORE },
{ HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN),
HID_BATTERY_QUIRK_IGNORE },
{ HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN),
--
2.40.0
^ permalink raw reply related
* Re: [PATCH] HID: Recognize "Digitizer" as a valid input application
From: Benjamin Tissoires @ 2023-03-30 15:59 UTC (permalink / raw)
To: linux-input, Jiri Kosina, Gerecke, Jason
Cc: Ping Cheng, Aaron Armstrong Skomra, Joshua Dickens, Jason Gerecke,
Ping Cheng
In-Reply-To: <20221019151832.44522-1-jason.gerecke@wacom.com>
On Wed, 19 Oct 2022 08:18:32 -0700, Gerecke, Jason wrote:
> "Digitizer" is a generic usage that may be used by various devices but
> which is particularly used by non-display pen tablets. This patch adds the
> usage to the list of values matched by the IS_INPUT_APPLICATION() macro
> that determines if an input device should be allocated or not.
>
>
Applied to hid/hid.git (for-6.4/core), thanks!
[1/1] HID: Recognize "Digitizer" as a valid input application
https://git.kernel.org/hid/hid/c/a0f5276716c8
Cheers,
--
Benjamin Tissoires <benjamin.tissoires@redhat.com>
^ permalink raw reply
* Re: [PATCH v2] Input: Add KUnit tests for some of the input core helper functions
From: Daniel Latypov @ 2023-03-30 16:00 UTC (permalink / raw)
To: Javier Martinez Canillas
Cc: kernel test robot, linux-kernel, oe-kbuild-all,
Enric Balletbo i Serra, Brendan Higgins, linux-kselftest,
Maíra Canal, David Gow, kunit-dev, Maxime Ripard,
Dmitry Torokhov, linux-input
In-Reply-To: <87a5zufq7n.fsf@minerva.mail-host-address-is-not-set>
On Thu, Mar 30, 2023 at 4:12 AM Javier Martinez Canillas
<javierm@redhat.com> wrote:
>
> kernel test robot <lkp@intel.com> writes:
>
> Hello,
>
> [...]
>
> >
> > All warnings (new ones prefixed by >>):
> >
> > drivers/clk/.kunitconfig: warning: ignored by one of the .gitignore files
> > drivers/gpu/drm/tests/.kunitconfig: warning: ignored by one of the .gitignore files
> > drivers/gpu/drm/vc4/tests/.kunitconfig: warning: ignored by one of the .gitignore files
> > drivers/hid/.kunitconfig: warning: ignored by one of the .gitignore files
> >>> drivers/input/tests/.kunitconfig: warning: ignored by one of the .gitignore files
>
> KUnit folks, what should we do about this? I believe the correct thing
> here would be for these dot-files to not be ignored by git.
>
> Not only to prevent these reports, but also to avoid the need to add
> them using `git add -f`, since is quite error prone and easy to miss.
>
> I was thinking about posting the following patch:
>
> From f1dc1733001682886458c23b676123635bc29da0 Mon Sep 17 00:00:00 2001
> From: Javier Martinez Canillas <javierm@redhat.com>
> Date: Thu, 30 Mar 2023 13:04:42 +0200
> Subject: [PATCH] .gitignore: Exclude KUnit config dot-files
Ah, I forgot/didn't realize lkp bot was complaining about .kunitconfig's.
Agreed, we should go with something like that.
As I noted in my reply on the patch, there was a previous patch to do
just the same thing here,
https://lore.kernel.org/linux-kselftest/20230127145708.12915-1-andriy.shevchenko@linux.intel.com/
I'm not sure who is intended to pick up the patch, but maybe bringing
up the fact this causes spurious warnings will help argue for the
change.
Thanks,
Daniel
^ permalink raw reply
* [PATCH v4] Input: tsc2007 - enable cansleep pendown GPIO
From: Benjamin Bara @ 2023-03-30 19:10 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: hns, richard.leitner, christophe.jaillet, linux-input,
linux-kernel, Benjamin Bara, Richard Leitner
From: Benjamin Bara <benjamin.bara@skidata.com>
When a hard IRQ is triggered, the soft IRQ, which decides if an actual
pen down happened, should always be triggered. This enables the usage of
"can_sleep" GPIO chips as "pen down" GPIO, as the value is not read
during the hard IRQ anymore. This might be the case if the GPIO chip is
an expander behind i2c.
Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com>
Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
---
Hi!
I found a different approach to my problem:
If the primary IRQ handler is set to NULL, the default primary IRQ
handler simply triggers a soft IRQ handler wake up. As the hard IRQ is
only triggered when a pen down is detected, the gpiod_get_value() inside
tsc2007_is_pen_down() always returns true and therefore can be
neglected.
v3: https://lore.kernel.org/lkml/20230328-tsc2007-sleep-v3-1-5941e8dc0411@skidata.com/
----
v4:
- don't read value in hard IRQ
v3:
- extend commit message
v2:
- fix style mentioned by Christophe
---
drivers/input/touchscreen/tsc2007_core.c | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/drivers/input/touchscreen/tsc2007_core.c b/drivers/input/touchscreen/tsc2007_core.c
index 3c793fb70a0e..fa4a71e3ad52 100644
--- a/drivers/input/touchscreen/tsc2007_core.c
+++ b/drivers/input/touchscreen/tsc2007_core.c
@@ -172,19 +172,6 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
return IRQ_HANDLED;
}
-static irqreturn_t tsc2007_hard_irq(int irq, void *handle)
-{
- struct tsc2007 *ts = handle;
-
- if (tsc2007_is_pen_down(ts))
- return IRQ_WAKE_THREAD;
-
- if (ts->clear_penirq)
- ts->clear_penirq();
-
- return IRQ_HANDLED;
-}
-
static void tsc2007_stop(struct tsc2007 *ts)
{
ts->stopped = true;
@@ -376,7 +363,7 @@ static int tsc2007_probe(struct i2c_client *client)
}
err = devm_request_threaded_irq(&client->dev, ts->irq,
- tsc2007_hard_irq, tsc2007_soft_irq,
+ NULL, tsc2007_soft_irq,
IRQF_ONESHOT,
client->dev.driver->name, ts);
if (err) {
---
base-commit: 197b6b60ae7bc51dd0814953c562833143b292aa
change-id: 20230328-tsc2007-sleep-f65953ae32d0
Best regards,
--
Benjamin Bara <benjamin.bara@skidata.com>
^ permalink raw reply related
* Nawiązanie współpracy
From: Maciej Telka @ 2023-03-31 7:45 UTC (permalink / raw)
To: linux-input
Dzień dobry,
Czy jest możliwość nawiązania współpracy z Państwem?
Z chęcią porozmawiam z osobą zajmującą się działaniami związanymi ze sprzedażą.
Pomagamy skutecznie pozyskiwać nowych klientów.
Zapraszam do kontaktu.
Pozdrawiam serdecznie
Maciej Telka
^ permalink raw reply
* Re: [REGRESSION] wrong coord from Thinkpad TrackPoint since 6.2 kernel
From: Linux regression tracking (Thorsten Leemhuis) @ 2023-03-31 13:38 UTC (permalink / raw)
To: Hans de Goede, Takashi Iwai, Pali Rohár, Dmitry Torokhov
Cc: regressions, linux-input, linux-kernel, Jonathan Cameron
In-Reply-To: <3dec29bf-b772-d82d-fff9-6c8bcca5f464@redhat.com>
On 29.03.23 11:22, Hans de Goede wrote:
> On 3/29/23 10:16, Takashi Iwai wrote:
>> we've received a bug report about Thinkpad TrackPoint (ALPS DualPoint
>> Stick) on 6.2 kernel:
>> https://bugzilla.opensuse.org/show_bug.cgi?id=1209805
>
> [...]
>
> I believe this is caused by the kernel now using -funsigned-char
> everywhere and this should be fixed by this commit:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git/commit/?h=for-linus&id=754ff5060daf5a1cf4474eff9b4edeb6c17ef7ab
>
> And there is a similar issue in the focaltech touchpad driver:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git/commit/?h=for-linus&id=8980f190947ba29f23110408e712444884b74251
>
> Dmitry, since this is hitting 6.2 users, perhaps you can send
> a pull-req for your current for-linus branch to get the fix
> on its way to stable ?
Hmm, no reply from Dmitry here or any other mail from him on lore since
a week. No big deal, but nevertheless a bit unfortunate, as I totally
agree: it would be really good to get this regressions fixed rather
sooner than later.
Is there any in-official de-facto co-maintainer for input that could
help out? CCing Jonathan, who according to get_maintainer.pl regularly
contributes to the input subsystem.
Guess if nothing happens soon I'll ask Linus to merge those two changes
directly, maybe he'll take them.
Ciao, Thorsten
^ permalink raw reply
* Re: [PATCH v3 0/2] platform/x86: Add driver for Yoga Tablet mode switch
From: Armin Wolf @ 2023-03-31 17:48 UTC (permalink / raw)
To: Andrew Kallmeyer, platform-driver-x86
Cc: Gergo Koteles, Ike Panhc, linux-input, Hans de Goede,
Barnabás Pőcze
In-Reply-To: <20230329014559.44494-1-kallmeyeras@gmail.com>
Am 29.03.23 um 03:45 schrieb Andrew Kallmeyer:
> This driver maps the Lenovo Yoga tablet mode switch to a SW_TABLET_MODE input
> device. This will make the tablet status available to desktop environments.
>
> This patch series is the result of the discussion at
> https://lore.kernel.org/r/CAG4kvq9US=-NjyXFMzJYu2zCJryJWtOc7FGZbrewpgCDjdAkbg@mail.gmail.com/
>
> I decided to follow-up on the patch Gergo wrote and respond to the review
> comments to get it merged and available for everyone.
>
> Gergo and I have tested this on the Yoga 7 14ARB7, and the Yoga 7 14AIL7
> respectively. Additionally, according to reports at
> https://github.com/lukas-w/yoga-usage-mode, which uses the same WMI devices,
> this driver should work with:
> Yoga C940, Ideapad flex 14API, Yoga 9 14IAP7, Yoga 7 14ARB7, etc.
>
> v1: https://lore.kernel.org/r/20230310041726.217447-1-kallmeyeras@gmail.com/
> v2: https://lore.kernel.org/r/20230323025200.5462-1-kallmeyeras@gmail.com/
> The diff since v2 is as follows:
>
> --- a/drivers/platform/x86/lenovo-ymc.c
> +++ b/drivers/platform/x86/lenovo-ymc.c
> @@ -21,8 +21,8 @@
> #define LENOVO_YMC_QUERY_METHOD 0x01
>
> static bool ec_trigger __read_mostly;
> -module_param(ec_trigger, bool, 0644);
> -MODULE_PARM_DESC(ec_trigger, "Enable EC triggering to emit YMC events");
> +module_param(ec_trigger, bool, 0444);
> +MODULE_PARM_DESC(ec_trigger, "Enable EC triggering work-around to force emitting tablet mode events");
>
> static const struct dmi_system_id ec_trigger_quirk_dmi_table[] = {
> {
> @@ -43,8 +43,7 @@ struct lenovo_ymc_private {
> static void lenovo_ymc_trigger_ec(struct wmi_device *wdev, struct lenovo_ymc_private *priv)
> {
> int err;
> -
> - if (!ec_trigger || !priv || !priv->ec_acpi_dev)
> + if (!priv->ec_acpi_dev)
> return;
> err = write_ec_cmd(priv->ec_acpi_dev->handle, VPCCMD_W_YMC, 1);
> if (err)
> @@ -103,11 +102,7 @@ static void lenovo_ymc_notify(struct wmi_device *wdev, union acpi_object *data)
> lenovo_ymc_trigger_ec(wdev, priv);
> }
>
> -static void lenovo_ymc_remove(struct wmi_device *wdev)
> -{
> - struct lenovo_ymc_private *priv = dev_get_drvdata(&wdev->dev);
> - acpi_dev_put(priv->ec_acpi_dev);
> -}
> +static void acpi_dev_put_helper(void *p) { acpi_dev_put(p); }
>
> static int lenovo_ymc_probe(struct wmi_device *wdev, const void *ctx)
> {
> @@ -124,10 +119,18 @@ static int lenovo_ymc_probe(struct wmi_device *wdev, const void *ctx)
> if (ec_trigger) {
> pr_debug("Lenovo YMC enable EC triggering.\n");
> priv->ec_acpi_dev = acpi_dev_get_first_match_dev("VPC2004", NULL, -1);
> +
> if (!priv->ec_acpi_dev) {
> dev_err(&wdev->dev, "Could not find EC ACPI device.\n");
> return -ENODEV;
> }
> + err = devm_add_action_or_reset(&wdev->dev,
> + acpi_dev_put_helper, priv->ec_acpi_dev);
> + if (err) {
> + dev_err(&wdev->dev,
> + "Could not clean up EC ACPI device: %d\n", err);
> + return err;
> + }
> }
>
> input_dev = devm_input_allocate_device(&wdev->dev);
> @@ -138,9 +141,6 @@ static int lenovo_ymc_probe(struct wmi_device *wdev, const void *ctx)
> input_dev->phys = LENOVO_YMC_EVENT_GUID "/input0";
> input_dev->id.bustype = BUS_HOST;
> input_dev->dev.parent = &wdev->dev;
> -
> - input_set_capability(input_dev, EV_SW, SW_TABLET_MODE);
> -
> err = sparse_keymap_setup(input_dev, lenovo_ymc_keymap, NULL);
> if (err) {
> dev_err(&wdev->dev,
> @@ -177,7 +177,6 @@ static struct wmi_driver lenovo_ymc_driver = {
> .id_table = lenovo_ymc_wmi_id_table,
> .probe = lenovo_ymc_probe,
> .notify = lenovo_ymc_notify,
> - .remove = lenovo_ymc_remove,
> };
>
> module_wmi_driver(lenovo_ymc_driver);
>
> Andrew Kallmeyer (1):
> platform/x86: Move ideapad ACPI helpers to a new header
>
> Gergo Koteles (1):
> platform/x86: Add driver for Yoga Tablet Mode switch
>
> drivers/platform/x86/Kconfig | 10 ++
> drivers/platform/x86/Makefile | 1 +
> drivers/platform/x86/ideapad-laptop.c | 135 +------------------
> drivers/platform/x86/ideapad-laptop.h | 152 +++++++++++++++++++++
> drivers/platform/x86/lenovo-ymc.c | 185 ++++++++++++++++++++++++++
> 5 files changed, 349 insertions(+), 134 deletions(-)
> create mode 100644 drivers/platform/x86/ideapad-laptop.h
> create mode 100644 drivers/platform/x86/lenovo-ymc.c
>
Hi,
while compile-testing your patch series, i noticed that there are a couple of checkpatch warnings.
For lenovo-ymc.c:
WARNING: Missing a blank line after declarations
#46: FILE: drivers/platform/x86/lenovo-ymc.c:46:
+ int err;
+ if (!priv->ec_acpi_dev)
CHECK: Alignment should match open parenthesis
#77: FILE: drivers/platform/x86/lenovo-ymc.c:77:
+ status = wmi_evaluate_method(LENOVO_YMC_QUERY_GUID,
+ LENOVO_YMC_QUERY_INSTANCE,
CHECK: Alignment should match open parenthesis
#83: FILE: drivers/platform/x86/lenovo-ymc.c:83:
+ dev_warn(&wdev->dev,
+ "Failed to evaluate query method: %s\n",
CHECK: Alignment should match open parenthesis
#92: FILE: drivers/platform/x86/lenovo-ymc.c:92:
+ dev_warn(&wdev->dev,
+ "WMI event data is not an integer\n");
CHECK: Alignment should match open parenthesis
#128: FILE: drivers/platform/x86/lenovo-ymc.c:128:
+ err = devm_add_action_or_reset(&wdev->dev,
+ acpi_dev_put_helper, priv->ec_acpi_dev);
For ideapad-laptop.h:
WARNING: Improper SPDX comment style for 'drivers/platform/x86/ideapad-laptop.h', please use '/*' instead
#1: FILE: drivers/platform/x86/ideapad-laptop.h:1:
+// SPDX-License-Identifier: GPL-2.0-or-later
WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
#1: FILE: drivers/platform/x86/ideapad-laptop.h:1:
+// SPDX-License-Identifier: GPL-2.0-or-later
CHECK: line length of 112 exceeds 100 columns
#44: FILE: drivers/platform/x86/ideapad-laptop.h:44:
+static inline int eval_int_with_arg(acpi_handle handle, const char *name, unsigned long arg, unsigned long *res)
All these checkpatch warnings are minor style issues (except the malformed SPDX tag in ideapad-laptop.h),
but it would be nice if those would get fixed too.
Armin Wolf
^ permalink raw reply
* [PATCH] Series-to: LKML <linux-kernel@vger.kernel.org>
From: Torsha Banerjee @ 2023-03-31 22:45 UTC (permalink / raw)
To: u-boot
Cc: Jing, Sean, Jora Jacobi, Harry Cutts, Torsha Banerjee,
Benjamin Tissoires, Jiri Kosina, linux-input, linux-kernel
From: Jora Jacobi <jora@google.com>
Restore missing cursor for digitizer devices
A previously committed patch to remove cursors for HID Digitizer-Pen
devices also removed the cursors for some tablets which have incorrect HID
descriptors. These devices should enumerate with Usage ID "Digitizer"
instead of Usage ID "Pen".
Patch which introduced the issue: commit 8473a93d1ba5
("HID: input: Set INPUT_PROP_-property for HID_UP_DIGITIZERS")
Changes-
Add HID quirk HID_QUIRK_DEVICE_IS_DIGITIZER
Quirk will force INPUT_PROP_POINTER for HID Digitizers
Apply quirk to Huion tablets
Apply quirk to UGEE/XP-Pen tablets based on device ID
Tested with Huion H640P and H430P. Connected the digitizer to the
Chromebook and confirmed with a drawing program that the cursor appears and
moves when the digitizer's stylus is hovering over the surface of the
digitizer.
Signed-off-by: Jora Jacobi <jora@google.com>
Reviewed-by: Harry Cutts <hcutts@chromium.org>
Signed-off-by: Torsha Banerjee <torsha@google.com>
---
drivers/hid/hid-input.c | 3 ++-
drivers/hid/hid-quirks.c | 9 +++++++++
include/linux/hid.h | 1 +
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 7fc967964dd8..f0c67baddc8d 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -927,7 +927,8 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
break;
case HID_UP_DIGITIZER:
- if ((field->application & 0xff) == 0x01) /* Digitizer */
+ if (((field->application & 0xff) == 0x01) ||
+ (device->quirks & HID_QUIRK_DEVICE_IS_DIGITIZER)) /* Digitizer */
__set_bit(INPUT_PROP_POINTER, input->propbit);
else if ((field->application & 0xff) == 0x02) /* Pen */
__set_bit(INPUT_PROP_DIRECT, input->propbit);
diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
index 66e64350f138..094fe4c4f3b3 100644
--- a/drivers/hid/hid-quirks.c
+++ b/drivers/hid/hid-quirks.c
@@ -102,6 +102,8 @@ static const struct hid_device_id hid_quirks[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_0941), HID_QUIRK_ALWAYS_POLL },
{ HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_0641), HID_QUIRK_ALWAYS_POLL },
{ HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_1f4a), HID_QUIRK_ALWAYS_POLL },
+ { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_HS64), HID_QUIRK_DEVICE_IS_DIGITIZER },
+ { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_TABLET), HID_QUIRK_DEVICE_IS_DIGITIZER },
{ HID_USB_DEVICE(USB_VENDOR_ID_IDEACOM, USB_DEVICE_ID_IDEACOM_IDC6680), HID_QUIRK_MULTI_INPUT },
{ HID_USB_DEVICE(USB_VENDOR_ID_INNOMEDIA, USB_DEVICE_ID_INNEX_GENESIS_ATARI), HID_QUIRK_MULTI_INPUT },
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X), HID_QUIRK_MULTI_INPUT },
@@ -1298,6 +1300,13 @@ unsigned long hid_lookup_quirk(const struct hid_device *hdev)
quirks = hid_gets_squirk(hdev);
mutex_unlock(&dquirks_lock);
+ /*
+ * UGEE/XP-Pen HID Pen devices which have 0x0-0x9 as the low nibble
+ * of the device ID are actually digitizers, not HID Pen devices
+ */
+ if (hdev->vendor == USB_VENDOR_ID_UGEE && (hdev->product & 0x0F) <= 0x09)
+ quirks |= HID_QUIRK_DEVICE_IS_DIGITIZER;
+
return quirks;
}
EXPORT_SYMBOL_GPL(hid_lookup_quirk);
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 1ea8c7a3570b..1653359002b3 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -354,6 +354,7 @@ struct hid_item {
#define HID_QUIRK_INPUT_PER_APP BIT(11)
#define HID_QUIRK_X_INVERT BIT(12)
#define HID_QUIRK_Y_INVERT BIT(13)
+#define HID_QUIRK_DEVICE_IS_DIGITIZER BIT(14)
#define HID_QUIRK_SKIP_OUTPUT_REPORTS BIT(16)
#define HID_QUIRK_SKIP_OUTPUT_REPORT_ID BIT(17)
#define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP BIT(18)
--
2.40.0.348.gf938b09366-goog
^ permalink raw reply related
* [PATCH v1 RESEND 0/1] HID: shield
From: Rahul Rameshbabu @ 2023-04-01 3:21 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires
Cc: linux-input, linux-kernel, Rahul Rameshbabu
Hi.
This is an initial driver implementation for supporting NVIDIA SHIELD
peripherals. Currently supports the following functionality for the
THUNDERSTRIKE (SHIELD 2017) controller.
- Haptics (ff_memless)
- Serial number query (sysfs)
- Hardware information query (sysfs)
- Firmware version query (sysfs)
Rahul Rameshbabu (1):
HID: shield: Initial driver implementation with Thunderstrike support
MAINTAINERS | 6 +
drivers/hid/Kconfig | 18 ++
drivers/hid/Makefile | 1 +
drivers/hid/hid-ids.h | 3 +
drivers/hid/hid-shield.c | 587 +++++++++++++++++++++++++++++++++++++++
5 files changed, 615 insertions(+)
create mode 100644 drivers/hid/hid-shield.c
Link: https://lore.kernel.org/linux-input/20230311010940.57585-1-rrameshbabu@nvidia.com/
--
2.38.3
^ permalink raw reply
* [PATCH v1 RESEND 1/1] HID: shield: Initial driver implementation with Thunderstrike support
From: Rahul Rameshbabu @ 2023-04-01 3:21 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires
Cc: linux-input, linux-kernel, Rahul Rameshbabu
In-Reply-To: <20230401032150.7424-1-rrameshbabu@nvidia.com>
Supports the Thunderstrike (SHIELD 2017) controller. Implements support for
the Thunderstrike HOSTCMD firmware interface. Adds sysfs attributes about a
SHIELD device and introduces haptics support for controllers.
Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
---
MAINTAINERS | 6 +
drivers/hid/Kconfig | 18 ++
drivers/hid/Makefile | 1 +
drivers/hid/hid-ids.h | 3 +
drivers/hid/hid-shield.c | 587 +++++++++++++++++++++++++++++++++++++++
5 files changed, 615 insertions(+)
create mode 100644 drivers/hid/hid-shield.c
diff --git a/MAINTAINERS b/MAINTAINERS
index a36df9ed283d..e8064131466d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9234,6 +9234,12 @@ F: drivers/hid/hid-sensor-*
F: drivers/iio/*/hid-*
F: include/linux/hid-sensor-*
+HID SHIELD DRIVER
+M: Rahul Rameshbabu <rrameshbabu@nvidia.com>
+L: linux-input@vger.kernel.org
+S: Maintained
+F: drivers/hid/hid-shield.c
+
HID VRC-2 CAR CONTROLLER DRIVER
M: Marcus Folkesson <marcus.folkesson@gmail.com>
L: linux-input@vger.kernel.org
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index e2a5d30c8895..a886e620a214 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -976,6 +976,24 @@ config HID_SEMITEK
- Woo-dy
- X-Bows Nature/Knight
+config HID_SHIELD
+ tristate "SHIELD HID Driver"
+ depends on USB_HID
+ depends on BT_HIDP
+ help
+ Support for NVIDIA SHIELD accessories.
+
+ Supported devices:
+ - Thunderstrike (NVIDIA SHIELD Controller 2017)
+
+config SHIELD_FF
+ bool "SHIELD force feedback support"
+ depends on HID_SHIELD
+ select INPUT_FF_MEMLESS
+ help
+ Say Y here if you would like to enable force feedback support for
+ NVIDIA SHIELD accessories with haptics capabilities.
+
config HID_SIGMAMICRO
tristate "SiGma Micro-based keyboards"
depends on USB_HID
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index e8014c1a2f8b..7d79c91f2503 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -113,6 +113,7 @@ obj-$(CONFIG_HID_RMI) += hid-rmi.o
obj-$(CONFIG_HID_SAITEK) += hid-saitek.o
obj-$(CONFIG_HID_SAMSUNG) += hid-samsung.o
obj-$(CONFIG_HID_SEMITEK) += hid-semitek.o
+obj-$(CONFIG_HID_SHIELD) += hid-shield.o
obj-$(CONFIG_HID_SIGMAMICRO) += hid-sigmamicro.o
obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o
obj-$(CONFIG_HID_SONY) += hid-sony.o
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 82713ef3aaa6..1cfec6bd542d 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -987,6 +987,9 @@
#define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18 0x0014
#define USB_DEVICE_ID_NTRIG_DUOSENSE 0x1500
+#define USB_VENDOR_ID_NVIDIA 0x0955
+#define USB_DEVICE_ID_NVIDIA_THUNDERSTRIKE_CONTROLLER 0x7214
+
#define USB_VENDOR_ID_ONTRAK 0x0a07
#define USB_DEVICE_ID_ONTRAK_ADU100 0x0064
diff --git a/drivers/hid/hid-shield.c b/drivers/hid/hid-shield.c
new file mode 100644
index 000000000000..b29af579868f
--- /dev/null
+++ b/drivers/hid/hid-shield.c
@@ -0,0 +1,587 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ *
+ * HID driver for NVIDIA SHIELD peripherals.
+ */
+
+#include <linux/hid.h>
+#include <linux/input-event-codes.h>
+#include <linux/input.h>
+#include <linux/module.h>
+#include <linux/spinlock.h>
+#include <linux/workqueue.h>
+
+#include "hid-ids.h"
+
+#define NOT_INIT_STR "NOT INITIALIZED"
+
+enum {
+ SHIELD_FW_VERSION_INITIALIZED = 0,
+ SHIELD_BOARD_INFO_INITIALIZED,
+};
+
+enum {
+ THUNDERSTRIKE_FW_VERSION_UPDATE = 0,
+ THUNDERSTRIKE_BOARD_INFO_UPDATE,
+ THUNDERSTRIKE_HAPTICS_UPDATE,
+};
+
+enum {
+ THUNDERSTRIKE_HOSTCMD_REPORT_SIZE = 33,
+ THUNDERSTRIKE_HOSTCMD_REQ_REPORT_ID = 0x4,
+ THUNDERSTRIKE_HOSTCMD_RESP_REPORT_ID = 0x3,
+};
+
+enum {
+ THUNDERSTRIKE_HOSTCMD_ID_FW_VERSION = 1,
+ THUNDERSTRIKE_HOSTCMD_ID_BOARD_INFO = 16,
+ THUNDERSTRIKE_HOSTCMD_ID_USB_INIT = 53,
+ THUNDERSTRIKE_HOSTCMD_ID_HAPTICS = 57,
+ THUNDERSTRIKE_HOSTCMD_ID_BLUETOOTH_INIT = 58,
+};
+
+struct thunderstrike_hostcmd_board_info {
+ __le16 revision;
+ __le16 serial[7];
+};
+
+struct thunderstrike_hostcmd_haptics {
+ u8 motor_left;
+ u8 motor_right;
+};
+
+struct thunderstrike_hostcmd_resp_report {
+ u8 report_id; /* THUNDERSTRIKE_HOSTCMD_RESP_REPORT_ID */
+ u8 cmd_id;
+ u8 reserved_at_10;
+
+ union {
+ struct thunderstrike_hostcmd_board_info board_info;
+ struct thunderstrike_hostcmd_haptics motors;
+ __le16 fw_version;
+ u8 payload[30];
+ };
+} __packed;
+static_assert(sizeof(struct thunderstrike_hostcmd_resp_report) ==
+ THUNDERSTRIKE_HOSTCMD_REPORT_SIZE);
+
+struct thunderstrike_hostcmd_req_report {
+ u8 report_id; /* THUNDERSTRIKE_HOSTCMD_REQ_REPORT_ID */
+ u8 cmd_id;
+ u8 reserved_at_10;
+
+ struct {
+ u8 update;
+ struct thunderstrike_hostcmd_haptics motors;
+ } haptics;
+ u8 reserved_at_30[27];
+} __packed;
+static_assert(sizeof(struct thunderstrike_hostcmd_req_report) ==
+ THUNDERSTRIKE_HOSTCMD_REPORT_SIZE);
+
+/* Common struct for shield accessories. */
+struct shield_device {
+ struct hid_device *hdev;
+
+ unsigned long initialized_flags;
+ const char *codename;
+ u16 fw_version;
+ struct {
+ u16 revision;
+ char serial_number[15];
+ } board_info;
+};
+
+struct thunderstrike {
+ struct shield_device base;
+
+ /* Sub-devices */
+ struct input_dev *haptics_dev;
+
+ /* Resources */
+ void *req_report_dmabuf;
+ unsigned long update_flags;
+ struct thunderstrike_hostcmd_haptics haptics_val;
+ spinlock_t haptics_update_lock;
+ struct work_struct hostcmd_req_work;
+};
+
+static inline void thunderstrike_hostcmd_req_report_init(
+ struct thunderstrike_hostcmd_req_report *report, u8 cmd_id)
+{
+ memset(report, 0, sizeof(*report));
+ report->report_id = THUNDERSTRIKE_HOSTCMD_REQ_REPORT_ID;
+ report->cmd_id = cmd_id;
+}
+
+static inline void shield_strrev(char *dest, size_t len, u16 rev)
+{
+ dest[0] = ('A' - 1) + (rev >> 8);
+ snprintf(&dest[1], len - 1, "%02X", 0xff & rev);
+}
+
+static struct input_dev *shield_allocate_input_dev(struct hid_device *hdev,
+ const char *name_suffix)
+{
+ struct input_dev *idev;
+
+ idev = input_allocate_device();
+ if (!idev)
+ goto err_device;
+
+ idev->id.bustype = hdev->bus;
+ idev->id.vendor = hdev->vendor;
+ idev->id.product = hdev->product;
+ idev->id.version = hdev->version;
+ idev->uniq = hdev->uniq;
+ idev->name = devm_kasprintf(&idev->dev, GFP_KERNEL, "%s %s", hdev->name,
+ name_suffix);
+ if (!idev->name)
+ goto err_name;
+
+ input_set_drvdata(idev, hdev);
+
+ return idev;
+
+err_name:
+ input_free_device(idev);
+err_device:
+ return ERR_PTR(-ENOMEM);
+}
+
+static struct input_dev *shield_haptics_create(
+ struct shield_device *dev,
+ int (*play_effect)(struct input_dev *, void *, struct ff_effect *))
+{
+ struct input_dev *haptics;
+ int ret;
+
+ if (!IS_ENABLED(CONFIG_SHIELD_FF))
+ return NULL;
+
+ haptics = shield_allocate_input_dev(dev->hdev, "Haptics");
+ if (IS_ERR(haptics))
+ return haptics;
+
+ input_set_capability(haptics, EV_FF, FF_RUMBLE);
+ input_ff_create_memless(haptics, NULL, play_effect);
+
+ ret = input_register_device(haptics);
+ if (ret)
+ goto err;
+
+ return haptics;
+
+ err:
+ input_free_device(haptics);
+ return ERR_PTR(ret);
+}
+
+static inline void thunderstrike_send_hostcmd_request(struct thunderstrike *ts)
+{
+ struct thunderstrike_hostcmd_req_report *report = ts->req_report_dmabuf;
+ struct shield_device *shield_dev = &ts->base;
+ int ret;
+
+ ret = hid_hw_raw_request(shield_dev->hdev, report->report_id,
+ ts->req_report_dmabuf,
+ THUNDERSTRIKE_HOSTCMD_REPORT_SIZE,
+ HID_OUTPUT_REPORT, HID_REQ_SET_REPORT);
+
+ if (ret < 0) {
+ hid_err(shield_dev->hdev,
+ "Failed to output Thunderstrike HOSTCMD request HID report due to %pe\n",
+ ERR_PTR(ret));
+ }
+}
+
+void thunderstrike_hostcmd_req_work_handler(struct work_struct *work)
+{
+ struct thunderstrike *ts =
+ container_of(work, struct thunderstrike, hostcmd_req_work);
+ struct thunderstrike_hostcmd_req_report *report;
+ unsigned long flags;
+
+ report = ts->req_report_dmabuf;
+
+ if (test_and_clear_bit(THUNDERSTRIKE_FW_VERSION_UPDATE, &ts->update_flags)) {
+ thunderstrike_hostcmd_req_report_init(
+ report, THUNDERSTRIKE_HOSTCMD_ID_FW_VERSION);
+ thunderstrike_send_hostcmd_request(ts);
+ }
+
+ if (test_and_clear_bit(THUNDERSTRIKE_BOARD_INFO_UPDATE, &ts->update_flags)) {
+ thunderstrike_hostcmd_req_report_init(
+ report, THUNDERSTRIKE_HOSTCMD_ID_BOARD_INFO);
+ thunderstrike_send_hostcmd_request(ts);
+ }
+
+ if (test_and_clear_bit(THUNDERSTRIKE_HAPTICS_UPDATE, &ts->update_flags)) {
+ thunderstrike_hostcmd_req_report_init(
+ report, THUNDERSTRIKE_HOSTCMD_ID_HAPTICS);
+
+ report->haptics.update = 1;
+ spin_lock_irqsave(&ts->haptics_update_lock, flags);
+ report->haptics.motors = ts->haptics_val;
+ spin_unlock_irqrestore(&ts->haptics_update_lock, flags);
+
+ thunderstrike_send_hostcmd_request(ts);
+ }
+}
+
+static inline void thunderstrike_request_firmware_version(struct thunderstrike *ts)
+{
+ set_bit(THUNDERSTRIKE_FW_VERSION_UPDATE, &ts->update_flags);
+ schedule_work(&ts->hostcmd_req_work);
+}
+
+static inline void thunderstrike_request_board_info(struct thunderstrike *ts)
+{
+ set_bit(THUNDERSTRIKE_BOARD_INFO_UPDATE, &ts->update_flags);
+ schedule_work(&ts->hostcmd_req_work);
+}
+
+static inline int
+thunderstrike_update_haptics(struct thunderstrike *ts,
+ struct thunderstrike_hostcmd_haptics *motors)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(&ts->haptics_update_lock, flags);
+ ts->haptics_val = *motors;
+ spin_unlock_irqrestore(&ts->haptics_update_lock, flags);
+
+ set_bit(THUNDERSTRIKE_HAPTICS_UPDATE, &ts->update_flags);
+ schedule_work(&ts->hostcmd_req_work);
+
+ return 0;
+}
+
+static int thunderstrike_play_effect(struct input_dev *idev, void *data,
+ struct ff_effect *effect)
+{
+ struct hid_device *hdev = input_get_drvdata(idev);
+ struct thunderstrike_hostcmd_haptics motors;
+ struct shield_device *shield_dev;
+ struct thunderstrike *ts;
+
+ if (effect->type != FF_RUMBLE)
+ return 0;
+
+ shield_dev = hid_get_drvdata(hdev);
+ ts = container_of(shield_dev, struct thunderstrike, base);
+
+ /* Thunderstrike motor values range from 0 to 32 inclusively */
+ motors.motor_left = effect->u.rumble.strong_magnitude / 2047;
+ motors.motor_right = effect->u.rumble.weak_magnitude / 2047;
+
+ hid_dbg(hdev, "Thunderstrike FF_RUMBLE request, left: %u right: %u\n",
+ motors.motor_left, motors.motor_right);
+
+ return thunderstrike_update_haptics(ts, &motors);
+}
+
+static void
+thunderstrike_parse_fw_version_payload(struct shield_device *shield_dev,
+ __le16 fw_version)
+{
+ shield_dev->fw_version = le16_to_cpu(fw_version);
+
+ set_bit(SHIELD_FW_VERSION_INITIALIZED, &shield_dev->initialized_flags);
+
+ hid_dbg(shield_dev->hdev, "Thunderstrike firmware version 0x%04X\n",
+ shield_dev->fw_version);
+}
+
+static void
+thunderstrike_parse_board_info_payload(struct shield_device *shield_dev,
+ struct thunderstrike_hostcmd_board_info *board_info)
+{
+ char board_revision_str[4];
+ int i;
+
+ shield_dev->board_info.revision = le16_to_cpu(board_info->revision);
+ for (i = 0; i < 7; ++i) {
+ u16 val = le16_to_cpu(board_info->serial[i]);
+
+ shield_dev->board_info.serial_number[2 * i] = val & 0xFF;
+ shield_dev->board_info.serial_number[2 * i + 1] = val >> 8;
+ }
+ shield_dev->board_info.serial_number[14] = '\0';
+
+ set_bit(SHIELD_BOARD_INFO_INITIALIZED, &shield_dev->initialized_flags);
+
+ shield_strrev(board_revision_str, 4, shield_dev->board_info.revision);
+ hid_dbg(shield_dev->hdev,
+ "Thunderstrike BOARD_REVISION_%s (0x%04X) S/N: %s\n",
+ board_revision_str, shield_dev->board_info.revision,
+ shield_dev->board_info.serial_number);
+}
+
+static inline void
+thunderstrike_parse_haptics_payload(struct shield_device *shield_dev,
+ struct thunderstrike_hostcmd_haptics *haptics)
+{
+ hid_dbg(shield_dev->hdev,
+ "Thunderstrike haptics HOSTCMD response, left: %u right: %u\n",
+ haptics->motor_left, haptics->motor_right);
+}
+
+static int thunderstrike_parse_report(struct shield_device *shield_dev,
+ struct hid_report *report, u8 *data,
+ int size)
+{
+ struct thunderstrike_hostcmd_resp_report *hostcmd_resp_report;
+ struct thunderstrike *ts =
+ container_of(shield_dev, struct thunderstrike, base);
+ struct hid_device *hdev = shield_dev->hdev;
+
+ switch (report->id) {
+ case THUNDERSTRIKE_HOSTCMD_RESP_REPORT_ID:
+ if (size != THUNDERSTRIKE_HOSTCMD_REPORT_SIZE) {
+ hid_err(hdev,
+ "Encountered Thunderstrike HOSTCMD HID report with unexpected size %d\n",
+ size);
+ return -EINVAL;
+ }
+
+ hostcmd_resp_report =
+ (struct thunderstrike_hostcmd_resp_report *)data;
+
+ switch (hostcmd_resp_report->cmd_id) {
+ case THUNDERSTRIKE_HOSTCMD_ID_FW_VERSION:
+ thunderstrike_parse_fw_version_payload(
+ shield_dev, hostcmd_resp_report->fw_version);
+ break;
+ case THUNDERSTRIKE_HOSTCMD_ID_BOARD_INFO:
+ thunderstrike_parse_board_info_payload(
+ shield_dev, &hostcmd_resp_report->board_info);
+ break;
+ case THUNDERSTRIKE_HOSTCMD_ID_HAPTICS:
+ thunderstrike_parse_haptics_payload(
+ shield_dev, &hostcmd_resp_report->motors);
+ break;
+
+ case THUNDERSTRIKE_HOSTCMD_ID_USB_INIT:
+ case THUNDERSTRIKE_HOSTCMD_ID_BLUETOOTH_INIT:
+ /* May block HOSTCMD requests till received initially */
+ thunderstrike_request_firmware_version(ts);
+ thunderstrike_request_board_info(ts);
+ /* Only HOSTCMD that can be triggered without a request */
+ return 0;
+ default:
+ hid_warn(hdev,
+ "Unhandled Thunderstrike HOSTCMD id %d\n",
+ hostcmd_resp_report->cmd_id);
+ return -ENOENT;
+ }
+
+ break;
+ default:
+ return 0;
+ }
+
+ return 0;
+}
+
+static struct shield_device *thunderstrike_create(struct hid_device *hdev)
+{
+ struct shield_device *shield_dev;
+ struct thunderstrike *ts;
+
+ ts = devm_kzalloc(&hdev->dev, sizeof(*ts), GFP_KERNEL);
+ if (!ts)
+ return ERR_PTR(-ENOMEM);
+
+ ts->req_report_dmabuf = devm_kzalloc(
+ &hdev->dev, THUNDERSTRIKE_HOSTCMD_REPORT_SIZE, GFP_KERNEL);
+ if (!ts->req_report_dmabuf)
+ return ERR_PTR(-ENOMEM);
+
+ shield_dev = &ts->base;
+ shield_dev->hdev = hdev;
+ shield_dev->codename = "Thunderstrike";
+
+ spin_lock_init(&ts->haptics_update_lock);
+ INIT_WORK(&ts->hostcmd_req_work, thunderstrike_hostcmd_req_work_handler);
+
+ hid_set_drvdata(hdev, shield_dev);
+
+ ts->haptics_dev = shield_haptics_create(shield_dev, thunderstrike_play_effect);
+ if (IS_ERR(ts->haptics_dev))
+ return ERR_CAST(ts->haptics_dev);
+
+ hid_info(hdev, "Registered Thunderstrike controller\n");
+ return shield_dev;
+}
+
+static ssize_t firmware_version_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct hid_device *hdev = to_hid_device(dev);
+ struct shield_device *shield_dev;
+ int ret;
+
+ shield_dev = hid_get_drvdata(hdev);
+
+ if (test_bit(SHIELD_FW_VERSION_INITIALIZED, &shield_dev->initialized_flags))
+ ret = sysfs_emit(buf, "0x%04X\n", shield_dev->fw_version);
+ else
+ ret = sysfs_emit(buf, NOT_INIT_STR "\n");
+
+ return ret;
+}
+
+static DEVICE_ATTR_RO(firmware_version);
+
+static ssize_t hardware_version_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct hid_device *hdev = to_hid_device(dev);
+ struct shield_device *shield_dev;
+ char board_revision_str[4];
+ int ret;
+
+ shield_dev = hid_get_drvdata(hdev);
+
+ if (test_bit(SHIELD_BOARD_INFO_INITIALIZED, &shield_dev->initialized_flags)) {
+ shield_strrev(board_revision_str, 4, shield_dev->board_info.revision);
+ ret = sysfs_emit(buf, "%s BOARD_REVISION_%s (0x%04X)\n",
+ shield_dev->codename, board_revision_str,
+ shield_dev->board_info.revision);
+ } else
+ ret = sysfs_emit(buf, NOT_INIT_STR "\n");
+
+ return ret;
+}
+
+static DEVICE_ATTR_RO(hardware_version);
+
+static ssize_t serial_number_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct hid_device *hdev = to_hid_device(dev);
+ struct shield_device *shield_dev;
+ int ret;
+
+ shield_dev = hid_get_drvdata(hdev);
+
+ if (test_bit(SHIELD_BOARD_INFO_INITIALIZED, &shield_dev->initialized_flags))
+ ret = sysfs_emit(buf, "%s\n", shield_dev->board_info.serial_number);
+ else
+ ret = sysfs_emit(buf, NOT_INIT_STR "\n");
+
+ return ret;
+}
+
+static DEVICE_ATTR_RO(serial_number);
+
+static struct attribute *shield_device_attrs[] = {
+ &dev_attr_firmware_version.attr,
+ &dev_attr_hardware_version.attr,
+ &dev_attr_serial_number.attr,
+ NULL,
+};
+ATTRIBUTE_GROUPS(shield_device);
+
+static int shield_raw_event(struct hid_device *hdev, struct hid_report *report,
+ u8 *data, int size)
+{
+ struct shield_device *dev = hid_get_drvdata(hdev);
+
+ return thunderstrike_parse_report(dev, report, data, size);
+}
+
+static int shield_probe(struct hid_device *hdev, const struct hid_device_id *id)
+{
+ struct shield_device *shield_dev = NULL;
+ struct thunderstrike *ts;
+ int ret;
+
+ ret = hid_parse(hdev);
+ if (ret) {
+ hid_err(hdev, "Parse failed\n");
+ return ret;
+ }
+
+ switch (id->product) {
+ case USB_DEVICE_ID_NVIDIA_THUNDERSTRIKE_CONTROLLER:
+ shield_dev = thunderstrike_create(hdev);
+ break;
+ }
+
+ if (unlikely(!shield_dev)) {
+ hid_err(hdev, "Failed to identify SHIELD device\n");
+ return -ENODEV;
+ }
+ if (IS_ERR(shield_dev)) {
+ hid_err(hdev, "Failed to create SHIELD device\n");
+ return PTR_ERR(shield_dev);
+ }
+
+ ts = container_of(shield_dev, struct thunderstrike, base);
+
+ ret = hid_hw_start(hdev, HID_CONNECT_HIDINPUT);
+ if (ret) {
+ hid_err(hdev, "Failed to start HID device\n");
+ goto err_haptics;
+ }
+
+ ret = hid_hw_open(hdev);
+ if (ret) {
+ hid_err(hdev, "Failed to open HID device\n");
+ goto err_stop;
+ }
+
+ thunderstrike_request_firmware_version(ts);
+ thunderstrike_request_board_info(ts);
+
+ return ret;
+
+err_stop:
+ hid_hw_stop(hdev);
+err_haptics:
+ if (ts->haptics_dev)
+ input_unregister_device(ts->haptics_dev);
+ return ret;
+}
+
+static void shield_remove(struct hid_device *hdev)
+{
+ struct shield_device *dev = hid_get_drvdata(hdev);
+ struct thunderstrike *ts;
+
+ ts = container_of(dev, struct thunderstrike, base);
+
+ hid_hw_close(hdev);
+ if (ts->haptics_dev)
+ input_unregister_device(ts->haptics_dev);
+ cancel_work_sync(&ts->hostcmd_req_work);
+ hid_hw_stop(hdev);
+}
+
+static const struct hid_device_id shield_devices[] = {
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NVIDIA,
+ USB_DEVICE_ID_NVIDIA_THUNDERSTRIKE_CONTROLLER) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_NVIDIA,
+ USB_DEVICE_ID_NVIDIA_THUNDERSTRIKE_CONTROLLER) },
+ {}
+};
+MODULE_DEVICE_TABLE(hid, shield_devices);
+
+static struct hid_driver shield_driver = {
+ .name = "shield",
+ .id_table = shield_devices,
+ .probe = shield_probe,
+ .remove = shield_remove,
+ .raw_event = shield_raw_event,
+ .driver = {
+ .dev_groups = shield_device_groups,
+ },
+};
+module_hid_driver(shield_driver);
+
+MODULE_AUTHOR("Rahul Rameshbabu <rrameshbabu@nvidia.com>");
+MODULE_DESCRIPTION("HID Driver for NVIDIA SHIELD peripherals.");
+MODULE_LICENSE("GPL");
--
2.38.3
^ permalink raw reply related
* Re: [PATCH v1 RESEND 1/1] HID: shield: Initial driver implementation with Thunderstrike support
From: kernel test robot @ 2023-04-01 5:47 UTC (permalink / raw)
To: Rahul Rameshbabu, Jiri Kosina, Benjamin Tissoires
Cc: oe-kbuild-all, linux-input, linux-kernel, Rahul Rameshbabu
In-Reply-To: <20230401032150.7424-2-rrameshbabu@nvidia.com>
Hi Rahul,
I love your patch! Perhaps something to improve:
[auto build test WARNING on hid/for-next]
[also build test WARNING on linus/master v6.3-rc4 next-20230331]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Rahul-Rameshbabu/HID-shield-Initial-driver-implementation-with-Thunderstrike-support/20230401-112438
base: https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-next
patch link: https://lore.kernel.org/r/20230401032150.7424-2-rrameshbabu%40nvidia.com
patch subject: [PATCH v1 RESEND 1/1] HID: shield: Initial driver implementation with Thunderstrike support
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20230401/202304011342.6Bh3cWhA-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/febf8c75cc77baaf26a8ae869201cb1df6d67124
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Rahul-Rameshbabu/HID-shield-Initial-driver-implementation-with-Thunderstrike-support/20230401-112438
git checkout febf8c75cc77baaf26a8ae869201cb1df6d67124
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304011342.6Bh3cWhA-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/hid/hid-shield.c:199:6: warning: no previous prototype for 'thunderstrike_hostcmd_req_work_handler' [-Wmissing-prototypes]
199 | void thunderstrike_hostcmd_req_work_handler(struct work_struct *work)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/thunderstrike_hostcmd_req_work_handler +199 drivers/hid/hid-shield.c
198
> 199 void thunderstrike_hostcmd_req_work_handler(struct work_struct *work)
200 {
201 struct thunderstrike *ts =
202 container_of(work, struct thunderstrike, hostcmd_req_work);
203 struct thunderstrike_hostcmd_req_report *report;
204 unsigned long flags;
205
206 report = ts->req_report_dmabuf;
207
208 if (test_and_clear_bit(THUNDERSTRIKE_FW_VERSION_UPDATE, &ts->update_flags)) {
209 thunderstrike_hostcmd_req_report_init(
210 report, THUNDERSTRIKE_HOSTCMD_ID_FW_VERSION);
211 thunderstrike_send_hostcmd_request(ts);
212 }
213
214 if (test_and_clear_bit(THUNDERSTRIKE_BOARD_INFO_UPDATE, &ts->update_flags)) {
215 thunderstrike_hostcmd_req_report_init(
216 report, THUNDERSTRIKE_HOSTCMD_ID_BOARD_INFO);
217 thunderstrike_send_hostcmd_request(ts);
218 }
219
220 if (test_and_clear_bit(THUNDERSTRIKE_HAPTICS_UPDATE, &ts->update_flags)) {
221 thunderstrike_hostcmd_req_report_init(
222 report, THUNDERSTRIKE_HOSTCMD_ID_HAPTICS);
223
224 report->haptics.update = 1;
225 spin_lock_irqsave(&ts->haptics_update_lock, flags);
226 report->haptics.motors = ts->haptics_val;
227 spin_unlock_irqrestore(&ts->haptics_update_lock, flags);
228
229 thunderstrike_send_hostcmd_request(ts);
230 }
231 }
232
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply
* TPPS/2 IBM TrackPoint not working in Linux 6.1 and 5.14
From: Daniel Bareiro @ 2023-04-01 15:49 UTC (permalink / raw)
To: linux-input
Dear Linux developers,
First of all, thank you for the work you do with your contributions every day.
Much appreciated.
I have been having problems for some time to be able to use the trackpoint
(the red button with mouse functions) that the keyboard of my Thinkpad T530 has.
I have had this problem in Debian 11 with Linux 5.14 and now in Debian
Testing with Linux 6.1.
I think this setting should enable the Trackpoint:
root@orion:~# cat /etc/modprobe.d/psmouse.conf
options psmouse synaptics_intertouch=1 proto=any
In fact, after this configuration I am able to see it with xinput:
viper@orion:~$ xinput
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ USB OPTICAL MOUSE id=9 [slave pointer (2)]
⎜ ↳ TPPS/2 IBM TrackPoint id=12 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Sleep Button id=8 [slave keyboard (3)]
↳ Integrated Camera: Integrated C id=10 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=11 [slave keyboard (3)]
↳ ThinkPad Extra Buttons id=13 [slave keyboard (3)]
But it does not work. A look in syslog shows the following:
root@orion:~# tail -F /var/log/syslog
2023-04-01T11:48:57.295761-03:00 orion kernel: [ 634.652388] psmouse
serio1: Failed to enable mouse on isa0060/serio1
2023-04-01T11:48:57.959746-03:00 orion kernel: [ 635.316599] psmouse
serio1: Failed to enable mouse on isa0060/serio1
2023-04-01T11:48:58.623769-03:00 orion kernel: [ 635.978783] psmouse
serio1: Failed to enable mouse on isa0060/serio1
2023-04-01T11:48:59.287780-03:00 orion kernel: [ 636.642962] psmouse
serio1: Failed to enable mouse on isa0060/serio1
2023-04-01T11:48:59.955781-03:00 orion kernel: [ 637.311116] psmouse
serio1: Failed to enable mouse on isa0060/serio1
2023-04-01T11:49:00.619767-03:00 orion kernel: [ 637.975234] psmouse
serio1: Failed to enable mouse on isa0060/serio1
2023-04-01T11:49:01.279768-03:00 orion kernel: [ 638.636391] psmouse
serio1: Failed to enable mouse on isa0060/serio1
2023-04-01T11:49:01.951713-03:00 orion kernel: [ 639.306422] psmouse
serio1: Failed to enable mouse on isa0060/serio1
2023-04-01T11:49:02.615760-03:00 orion kernel: [ 639.970611] psmouse
serio1: Failed to enable mouse on isa0060/serio1
---------------
Using this setup I am able to enable the Trackpoint, although it is
detected as a
PS/2 mouse and it is extremely slow:
root@orion:~# cat /etc/modprobe.d/psmouse.conf
options psmouse synaptics_intertouch=1 proto=exps
viper@orion:~$ xinput
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ USB OPTICAL MOUSE id=9 [slave pointer (2)]
⎜ ↳ PS/2 Generic Mouse id=12 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Sleep Button id=8 [slave keyboard (3)]
↳ Integrated Camera: Integrated C id=10 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=11 [slave keyboard (3)]
↳ ThinkPad Extra Buttons id=13 [slave keyboard (3)]
root@orion:~# tail -F /var/log/syslog
2023-04-01T11:50:59.559695-03:00 orion kernel: [ 756.915044] psmouse
serio1: Failed to enable mouse on isa0060/serio1
2023-04-01T11:51:03.475677-03:00 orion kernel: [ 760.833751] input:
PS/2 Generic Mouse as /devices/platform/i8042/serio1/input/input23
2023-04-01T11:51:06.334813-03:00 orion (udev-worker)[4466]: input23:
/etc/udev/rules.d/10-trackpoint.rules:1 Failed to write
ATTR{/sys/devices/platform/i8042/serio1/i>
2023-04-01T11:51:06.967054-03:00 orion kded5[4476]: Initializing
"/usr/lib/x86_64-linux-gnu/qt5/plugins/plasma/kcms/systemsettings/kcm_mouse.so"
2023-04-01T11:51:07.884147-03:00 orion kded5[4476]: Initializing
"/usr/lib/x86_64-linux-gnu/qt5/plugins/plasma/kcms/systemsettings/kcm_touchpad.so"
2023-04-01T11:51:07.884468-03:00 orion kded5[4476]: kcm_touchpad:
Using X11 backend
2023-04-01T11:51:07.885260-03:00 orion kwin_x11[2328]: qt.qpa.xcb:
QXcbConnection: XCB error: 3 (BadWindow), sequence: 6268, resource id:
60817413, major code: 18 (Ch>
Here's some more information, though if there's anything else I can provide to
help resolve this, please let me know:
root@orion:~# dmesg | grep -i Trackpoint
[ 535.610685] psmouse serio1: trackpoint: IBM TrackPoint firmware:
0x0e, buttons: 3/3
[ 535.661460] input: TPPS/2 IBM TrackPoint as
/devices/platform/i8042/serio1/input/input20
Since the Trankpoint works perfectly in KDE under FreeBSD detecting it as
"TPPS/2 IBM TrackPoint", I think this is more of a software problem than a
hardware one.
Thanks in advance.
Kind regards,
Daniel
^ permalink raw reply
* [git pull] Input updates for v6.3-rc4
From: Dmitry Torokhov @ 2023-04-01 20:50 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, linux-input
Hi Linus,
Please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git tags/input-for-v6.3-rc4
to receive updates for the input subsystem. You will get:
- fixes to ALPS and Focaltech PS/2 drivers dealing with the breakage of
switching to -funsigned-char
- quirks to i8042 to better handle Lifebook A574/H and TUXEDO devices
- a quirk to Goodix touchscreen driver to handle Yoga Book X90F
- a fix for incorrectly merged patch to xpad game controller driver
Changelog:
---------
Hans de Goede (1):
Input: goodix - add Lenovo Yoga Book X90F to nine_bytes_report DMI table
Jason A. Donenfeld (1):
Input: focaltech - use explicitly signed char type
Jonathan Denose (1):
Input: i8042 - add quirk for Fujitsu Lifebook A574/H
Matthias Benkmann (1):
Input: xpad - fix incorrectly applied patch for MAP_PROFILE_BUTTON
Werner Sembach (1):
Input: i8042 - add TUXEDO devices to i8042 quirk tables for partial fix
msizanoen (1):
Input: alps - fix compatibility with -funsigned-char
Diffstat:
--------
drivers/input/joystick/xpad.c | 7 ++++---
drivers/input/mouse/alps.c | 16 ++++++++--------
drivers/input/mouse/focaltech.c | 8 ++++----
drivers/input/serio/i8042-acpipnpio.h | 36 +++++++++++++++++++++++++++++++++++
drivers/input/touchscreen/goodix.c | 14 +++++++++++---
5 files changed, 63 insertions(+), 18 deletions(-)
Thanks.
--
Dmitry
^ permalink raw reply
* Re: [git pull] Input updates for v6.3-rc4
From: pr-tracker-bot @ 2023-04-01 21:16 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Linus Torvalds, linux-kernel, linux-input
In-Reply-To: <ZCiZArzK41q5/IDR@google.com>
The pull request you sent on Sat, 1 Apr 2023 13:50:10 -0700:
> git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git tags/input-for-v6.3-rc4
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/00c7b5f4ddc5b346df62b757ec73f9357bb452af
Thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html
^ permalink raw reply
* Re: [REGRESSION] wrong coord from Thinkpad TrackPoint since 6.2 kernel
From: Dmitry Torokhov @ 2023-04-01 21:17 UTC (permalink / raw)
To: Takashi Iwai
Cc: Hans de Goede, Pali Rohár, regressions, linux-input,
linux-kernel
In-Reply-To: <87mt3umyui.wl-tiwai@suse.de>
On Thu, Mar 30, 2023 at 10:23:49AM +0200, Takashi Iwai wrote:
> On Wed, 29 Mar 2023 11:28:53 +0200,
> Takashi Iwai wrote:
> >
> > On Wed, 29 Mar 2023 11:22:18 +0200,
> > Hans de Goede wrote:
> > >
> > > Hi Takashi,
> > >
> > > On 3/29/23 10:16, Takashi Iwai wrote:
> > > > Hi,
> > > >
> > > > we've received a bug report about Thinkpad TrackPoint (ALPS DualPoint
> > > > Stick) on 6.2 kernel:
> > > > https://bugzilla.opensuse.org/show_bug.cgi?id=1209805
> > > >
> > > > The device reports the wrong values as the movements, e.g. sometimes a
> > > > value such as 255, 254 or -255 is returned while usually it should be
> > > > a smaller value like -1 or 2.
> > > >
> > > > The evtest on 6.2.x kernel shows the wrong values like:
> > > >
> > > > Event: time 1680037542.898747, type 2 (EV_REL), code 0 (REL_X), value 255
> > > > Event: time 1680037542.898747, -------------- SYN_REPORT ------------
> > > > Event: time 1680037543.145196, type 2 (EV_REL), code 0 (REL_X), value 1
> > > > Event: time 1680037543.145196, -------------- SYN_REPORT ------------
> > > > Event: time 1680037543.175087, type 2 (EV_REL), code 1 (REL_Y), value -255
> > > > Event: time 1680037543.175087, -------------- SYN_REPORT ------------
> > > > Event: time 1680037543.185421, type 2 (EV_REL), code 0 (REL_X), value 1
> > > > Event: time 1680037543.185421, type 2 (EV_REL), code 1 (REL_Y), value -255
> > > > Event: time 1680037543.185421, -------------- SYN_REPORT ------------
> > > >
> > > > while 6.1.x kernel shows the correct values like:
> > > >
> > > > Event: time 1680037386.318058, type 2 (EV_REL), code 0 (REL_X), value -1
> > > > Event: time 1680037386.318058, type 2 (EV_REL), code 1 (REL_Y), value -1
> > > > Event: time 1680037386.318058, -------------- SYN_REPORT ------------
> > > > Event: time 1680037386.328087, type 2 (EV_REL), code 0 (REL_X), value -1
> > > > Event: time 1680037386.328087, type 2 (EV_REL), code 1 (REL_Y), value -1
> > > > Event: time 1680037386.328087, -------------- SYN_REPORT ------------
> > > > Event: time 1680037386.338046, type 2 (EV_REL), code 0 (REL_X), value -1
> > > > Event: time 1680037386.338046, type 2 (EV_REL), code 1 (REL_Y), value -2
> > > > Event: time 1680037386.338046, -------------- SYN_REPORT ------------
> > > >
> > > > I couldn't see any relevant changes in alps.c between those versions,
> > > > so this is likely a breakage in a lower layer.
> > > >
> > > > Could you guys take a look?
> > >
> > > I believe this is caused by the kernel now using -funsigned-char
> > > everywhere and this should be fixed by this commit:
> > >
> > > https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git/commit/?h=for-linus&id=754ff5060daf5a1cf4474eff9b4edeb6c17ef7ab
> >
> > Ah, that makes sense!
> >
> > I'll build a test kernel with this fix and ask the reporter for
> > testing.
>
> And it's confirmed that the commit above fixes the problem indeed.
Sorry for sitting on this, I just sent a pull request and it was merged.
Thanks.
--
Dmitry
^ permalink raw reply
* Re: [PATCH 2/2] Input: xpad - fix PowerA EnWired Controller guide button
From: Dmitry Torokhov @ 2023-04-01 21:41 UTC (permalink / raw)
To: Vicki Pfau; +Cc: Benjamin Tissoires, linux-input, Pavel Rojtberg
In-Reply-To: <20230330024752.2405603-3-vi@endrift.com>
On Wed, Mar 29, 2023 at 07:47:52PM -0700, Vicki Pfau wrote:
> This commit explicitly disables the audio interface the same way the official
> driver does. This is needed for some controllers, such as the PowerA Enhanced
> Wired Controller for Series X|S (0x20d6:0x200e) to report the guide button.
>
> Signed-off-by: Vicki Pfau <vi@endrift.com>
> ---
> drivers/input/joystick/xpad.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
> index 698224e1948f..c31fc4e9b310 100644
> --- a/drivers/input/joystick/xpad.c
> +++ b/drivers/input/joystick/xpad.c
> @@ -1396,6 +1396,14 @@ static int xpad_start_xbox_one(struct usb_xpad *xpad)
> unsigned long flags;
> int retval;
>
> + /* Explicitly disable the audio interface. This is needed for some
> + * controllers, such as the PowerA Enhanced Wired Controller
> + * for Series X|S (0x20d6:0x200e) to report the guide button */
> + retval = usb_set_interface(xpad->udev, GIP_WIRED_INTF_AUDIO, 0);
> + if (retval)
> + dev_warn(&xpad->dev->dev,
> + "unable to disable audio interface: %d\n", retval);
I would prefer if we first validated that the interface is in fact
present. Can we do something like:
if (usb_ifnum_to_if(xpad->udev, GIP_WIRED_INTF_AUDIO)) {
error = usb_set_interface(xpad->udev, GIP_WIRED_INTF_AUDIO, 0);
if (error)
...
}
> +
> spin_lock_irqsave(&xpad->odata_lock, flags);
>
> /*
> --
> 2.40.0
>
Thanks.
--
Dmitry
^ permalink raw reply
* Re: [PATCH] Input: cma3000_d0x - Clean up some inconsistent indenting
From: Dmitry Torokhov @ 2023-04-02 1:46 UTC (permalink / raw)
To: Jiapeng Chong; +Cc: linux-input, linux-kernel, Abaci Robot
In-Reply-To: <20230322064158.4043-1-jiapeng.chong@linux.alibaba.com>
Hi Jiapeng,
On Wed, Mar 22, 2023 at 02:41:58PM +0800, Jiapeng Chong wrote:
> No functional modification involved.
>
> drivers/input/misc/cma3000_d0x.c:328 cma3000_init() warn: inconsistent indenting.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4588
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
> drivers/input/misc/cma3000_d0x.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/input/misc/cma3000_d0x.c b/drivers/input/misc/cma3000_d0x.c
> index e6feb73bb52b..c444a44e4576 100644
> --- a/drivers/input/misc/cma3000_d0x.c
> +++ b/drivers/input/misc/cma3000_d0x.c
> @@ -325,7 +325,7 @@ struct cma3000_accl_data *cma3000_init(struct device *dev, int irq,
> input_dev->open = cma3000_open;
> input_dev->close = cma3000_close;
>
> - __set_bit(EV_ABS, input_dev->evbit);
> + __set_bit(EV_ABS, input_dev->evbit);
We should simply remove this, as input_set_abs_params() will set EV_ABS
bit for us.
>
> input_set_abs_params(input_dev, ABS_X,
> -data->g_range, data->g_range, pdata->fuzz_x, 0);
> --
> 2.20.1.7.g153144c
>
Thanks.
--
Dmitry
^ permalink raw reply
* Re: [PATCH v1 RESEND 1/1] HID: shield: Initial driver implementation with Thunderstrike support
From: kernel test robot @ 2023-04-02 2:11 UTC (permalink / raw)
To: Rahul Rameshbabu, Jiri Kosina, Benjamin Tissoires
Cc: llvm, oe-kbuild-all, linux-input, linux-kernel, Rahul Rameshbabu
In-Reply-To: <20230401032150.7424-2-rrameshbabu@nvidia.com>
Hi Rahul,
I love your patch! Perhaps something to improve:
[auto build test WARNING on hid/for-next]
[also build test WARNING on linus/master v6.3-rc4 next-20230331]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Rahul-Rameshbabu/HID-shield-Initial-driver-implementation-with-Thunderstrike-support/20230401-112438
base: https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-next
patch link: https://lore.kernel.org/r/20230401032150.7424-2-rrameshbabu%40nvidia.com
patch subject: [PATCH v1 RESEND 1/1] HID: shield: Initial driver implementation with Thunderstrike support
config: x86_64-allmodconfig (https://download.01.org/0day-ci/archive/20230402/202304020922.vsngJnBT-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/febf8c75cc77baaf26a8ae869201cb1df6d67124
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Rahul-Rameshbabu/HID-shield-Initial-driver-implementation-with-Thunderstrike-support/20230401-112438
git checkout febf8c75cc77baaf26a8ae869201cb1df6d67124
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/hid/ drivers/iio/pressure/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304020922.vsngJnBT-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/hid/hid-shield.c:199:6: warning: no previous prototype for function 'thunderstrike_hostcmd_req_work_handler' [-Wmissing-prototypes]
void thunderstrike_hostcmd_req_work_handler(struct work_struct *work)
^
drivers/hid/hid-shield.c:199:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void thunderstrike_hostcmd_req_work_handler(struct work_struct *work)
^
static
1 warning generated.
vim +/thunderstrike_hostcmd_req_work_handler +199 drivers/hid/hid-shield.c
198
> 199 void thunderstrike_hostcmd_req_work_handler(struct work_struct *work)
200 {
201 struct thunderstrike *ts =
202 container_of(work, struct thunderstrike, hostcmd_req_work);
203 struct thunderstrike_hostcmd_req_report *report;
204 unsigned long flags;
205
206 report = ts->req_report_dmabuf;
207
208 if (test_and_clear_bit(THUNDERSTRIKE_FW_VERSION_UPDATE, &ts->update_flags)) {
209 thunderstrike_hostcmd_req_report_init(
210 report, THUNDERSTRIKE_HOSTCMD_ID_FW_VERSION);
211 thunderstrike_send_hostcmd_request(ts);
212 }
213
214 if (test_and_clear_bit(THUNDERSTRIKE_BOARD_INFO_UPDATE, &ts->update_flags)) {
215 thunderstrike_hostcmd_req_report_init(
216 report, THUNDERSTRIKE_HOSTCMD_ID_BOARD_INFO);
217 thunderstrike_send_hostcmd_request(ts);
218 }
219
220 if (test_and_clear_bit(THUNDERSTRIKE_HAPTICS_UPDATE, &ts->update_flags)) {
221 thunderstrike_hostcmd_req_report_init(
222 report, THUNDERSTRIKE_HOSTCMD_ID_HAPTICS);
223
224 report->haptics.update = 1;
225 spin_lock_irqsave(&ts->haptics_update_lock, flags);
226 report->haptics.motors = ts->haptics_val;
227 spin_unlock_irqrestore(&ts->haptics_update_lock, flags);
228
229 thunderstrike_send_hostcmd_request(ts);
230 }
231 }
232
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply
* Re: [PATCH v2] Input: Add KUnit tests for some of the input core helper functions
From: Dmitry Torokhov @ 2023-04-02 5:47 UTC (permalink / raw)
To: Javier Martinez Canillas
Cc: linux-kernel, Enric Balletbo i Serra, Brendan Higgins,
linux-kselftest, Maíra Canal, David Gow, Daniel Latypov,
kunit-dev, Maxime Ripard, linux-input
In-Reply-To: <20230330081831.2291351-1-javierm@redhat.com>
On Thu, Mar 30, 2023 at 10:18:31AM +0200, Javier Martinez Canillas wrote:
> The input subsystem doesn't currently have any unit tests, let's add a
> CONFIG_INPUT_KUNIT_TEST option that builds a test suite to be executed
> with the KUnit test infrastructure.
>
> For now, only three tests were added for some of the input core helper
> functions that are trivial to test:
>
> * input_test_polling: set/get poll interval and set-up a poll handler.
>
> * input_test_timestamp: set/get input event timestamps.
>
> * input_test_match_device_id: match a device by bus, vendor, product,
> version and events capable of handling.
>
> But having the minimal KUnit support allows to add more tests and suites
> as follow-up changes. The tests can be run with the following command:
>
> $ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/input/tests/
>
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> Tested-by: Enric Balletbo i Serra <eballetbo@redhat.com>
Applied, thank you.
--
Dmitry
^ permalink raw reply
* Re: [PATCH v4] Input: tsc2007 - enable cansleep pendown GPIO
From: Dmitry Torokhov @ 2023-04-02 5:51 UTC (permalink / raw)
To: Benjamin Bara
Cc: hns, richard.leitner, christophe.jaillet, linux-input,
linux-kernel, Benjamin Bara
In-Reply-To: <20230328-tsc2007-sleep-v4-1-2ede92ec9b71@skidata.com>
Hi Benjamin,
On Thu, Mar 30, 2023 at 09:10:37PM +0200, Benjamin Bara wrote:
> From: Benjamin Bara <benjamin.bara@skidata.com>
>
> When a hard IRQ is triggered, the soft IRQ, which decides if an actual
> pen down happened, should always be triggered. This enables the usage of
> "can_sleep" GPIO chips as "pen down" GPIO, as the value is not read
> during the hard IRQ anymore. This might be the case if the GPIO chip is
> an expander behind i2c.
>
> Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com>
> Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
> ---
> Hi!
>
> I found a different approach to my problem:
> If the primary IRQ handler is set to NULL, the default primary IRQ
> handler simply triggers a soft IRQ handler wake up. As the hard IRQ is
> only triggered when a pen down is detected, the gpiod_get_value() inside
> tsc2007_is_pen_down() always returns true and therefore can be
> neglected.
Don't you need to switch to gpio_get_valued_cansleep() in
tsc2007_is_pen_down() to actually allow sleeping gpios?
Thanks.
--
Dmitry
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox