Skip to contentSkip to conversation

HID: shield

PATCH RESEND Superseded Rahul Rameshbabu 2 participants 4 messages Apr 1, 2023 – Apr 2, 2023 HID

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover HID: shield

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
Signature · 1 line
2.38.3
#1 lore raw

PATCH RESEND 1/1 HID: shield: Initial driver implementation with Thunderstrike support

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.

---
 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
MAINTAINERS +6 -0
index a36df9ed283d..e8064131466d 100644
@@ -9234,6 +9234,12 @@ F:	drivers/hid/hid-sensor-*
 F:	drivers/iio/*/hid-*
 F:	include/linux/hid-sensor-*
 
+HID SHIELD DRIVER
+M:	Rahul Rameshbabu <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/hid/hid-shield.c
+
 HID VRC-2 CAR CONTROLLER DRIVER
 M:	Marcus Folkesson <[email protected]>
 L:	[email protected]
drivers/hid/Kconfig +18 -0
index e2a5d30c8895..a886e620a214 100644
@@ -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
drivers/hid/Makefile +1 -0
index e8014c1a2f8b..7d79c91f2503 100644
@@ -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
drivers/hid/hid-ids.h +3 -0
index 82713ef3aaa6..1cfec6bd542d 100644
@@ -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
 
drivers/hid/hid-shield.c new file +587 -0

587 lines not on this page · raw message

Signature · 1 line
2.38.3
#2 lore raw

Re: [PATCH v1 RESEND 1/1] HID: shield: Initial driver implementation with Thunderstrike support

I love your patch! Perhaps something to improve:

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/[email protected]/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 <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

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

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
#3 lore raw

Re: [PATCH v1 RESEND 1/1] HID: shield: Initial driver implementation with Thunderstrike support

In reply to Rahul Rameshbabu
I love your patch! Perhaps something to improve:

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/[email protected]/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 <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

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

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests