Commit aa051d36 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'for-linus-2022052401' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid

Pull HID updates from Jiri Kosina:

 - support for pens with 3 buttons with Wacom driver (Joshua Dickens)

 - support for HID_DG_SCANTIME to report the timestamp for pen and touch
   events in Wacom driver (Joshua Dickens)

 - support for sensor discovery in amd-sfh driver (Basavaraj Natikar)

 - support for wider variety of Huion tablets ported from DIGImend
   project (José Expósito, Nikolai Kondrashov)

 - new device IDs and other assorted small code cleanups

* tag 'for-linus-2022052401' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: (44 commits)
  HID: apple: Properly handle function keys on Keychron keyboards
  HID: uclogic: Switch to Digitizer usage for styluses
  HID: uclogic: Add pen support for XP-PEN Star 06
  HID: uclogic: Differentiate touch ring and touch strip
  HID: uclogic: Always shift touch reports to zero
  HID: uclogic: Do not focus on touch ring only
  HID: uclogic: Return raw parameters from v2 pen init
  HID: uclogic: Move param printing to a function
  HID: core: Display "SENSOR HUB" for sensor hub bus string in hid_info
  HID: amd_sfh: Move bus declaration outside of amd-sfh
  HID: amd_sfh: Add physical location to HID device
  HID: amd_sfh: Modify the hid name
  HID: amd_sfh: Modify the bus name
  HID: amd_sfh: Add sensor name by index for debug info
  HID: amd_sfh: Add support for sensor discovery
  HID: bigben: fix slab-out-of-bounds Write in bigben_probe
  Hid: wacom: Fix kernel test robot warning
  HID: uclogic: Disable pen usage for Huion keyboard interfaces
  HID: uclogic: Support disabling pen usage
  HID: uclogic: Pass keyboard reports as is
  ...
parents d8e0f976 07d17217
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -1044,7 +1044,6 @@ F: arch/arm64/boot/dts/amd/amd-seattle-xgbe*.dtsi
F:	drivers/net/ethernet/amd/xgbe/
AMD SENSOR FUSION HUB DRIVER
M:	Nehal Shah <nehal-bakulchandra.shah@amd.com>
M:	Basavaraj Natikar <basavaraj.natikar@amd.com>
L:	linux-input@vger.kernel.org
S:	Maintained
@@ -8766,6 +8765,14 @@ F: drivers/hid/hid-sensor-*
F:	drivers/iio/*/hid-*
F:	include/linux/hid-sensor-*
HID WACOM DRIVER
M:	Ping Cheng <ping.cheng@wacom.com>
M:	Jason Gerecke  <jason.gerecke@wacom.com>
L:	linux-input@vger.kernel.org
S:	Maintained
F:	drivers/hid/wacom.h
F:	drivers/hid/wacom_*
HIGH-RESOLUTION TIMERS, CLOCKEVENTS
M:	Thomas Gleixner <tglx@linutronix.de>
L:	linux-kernel@vger.kernel.org
+8 −0
Original line number Diff line number Diff line
@@ -697,6 +697,14 @@ config HID_MAYFLASH
	Say Y here if you have HJZ Mayflash PS3 game controller adapters
	and want to enable force feedback support.

config HID_MEGAWORLD_FF
	tristate "Mega World based game controller force feedback support"
	depends on USB_HID
	select INPUT_FF_MEMLESS
	help
	Say Y here if you have a Mega World based game controller and want
	to have force feedback support for it.

config HID_REDRAGON
	tristate "Redragon keyboards"
	depends on HID
+1 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ obj-$(CONFIG_HID_MAGICMOUSE) += hid-magicmouse.o
obj-$(CONFIG_HID_MALTRON)	+= hid-maltron.o
obj-$(CONFIG_HID_MCP2221)	+= hid-mcp2221.o
obj-$(CONFIG_HID_MAYFLASH)	+= hid-mf.o
obj-$(CONFIG_HID_MEGAWORLD_FF)	+= hid-megaworld.o
obj-$(CONFIG_HID_MICROSOFT)	+= hid-microsoft.o
obj-$(CONFIG_HID_MONTEREY)	+= hid-monterey.o
obj-$(CONFIG_HID_MULTITOUCH)	+= hid-multitouch.o
+39 −6
Original line number Diff line number Diff line
@@ -141,6 +141,24 @@ u32 amd_sfh_wait_for_response(struct amd_mp2_dev *mp2, u8 sid, u32 sensor_sts)
	return sensor_sts;
}

const char *get_sensor_name(int idx)
{
	switch (idx) {
	case accel_idx:
		return "accelerometer";
	case gyro_idx:
		return "gyroscope";
	case mag_idx:
		return "magnetometer";
	case als_idx:
		return "ALS";
	case HPD_IDX:
		return "HPD";
	default:
		return "unknown sensor type";
	}
}

int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata)
{
	struct amd_input_data *in_data = &privdata->in_data;
@@ -219,13 +237,27 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata)
					(privdata, cl_data->sensor_idx[i], SENSOR_DISABLED);
				if (status != SENSOR_ENABLED)
					cl_data->sensor_sts[i] = SENSOR_DISABLED;
				dev_dbg(dev, "sid 0x%x status 0x%x\n",
					cl_data->sensor_idx[i], cl_data->sensor_sts[i]);
				dev_dbg(dev, "sid 0x%x (%s) status 0x%x\n",
					cl_data->sensor_idx[i],
					get_sensor_name(cl_data->sensor_idx[i]),
					cl_data->sensor_sts[i]);
				goto cleanup;
			}
		}
		dev_dbg(dev, "sid 0x%x status 0x%x\n",
			cl_data->sensor_idx[i], cl_data->sensor_sts[i]);
		dev_dbg(dev, "sid 0x%x (%s) status 0x%x\n",
			cl_data->sensor_idx[i], get_sensor_name(cl_data->sensor_idx[i]),
			cl_data->sensor_sts[i]);
	}
	if (privdata->mp2_ops->discovery_status &&
	    privdata->mp2_ops->discovery_status(privdata) == 0) {
		amd_sfh_hid_client_deinit(privdata);
		for (i = 0; i < cl_data->num_hid_devices; i++) {
			devm_kfree(dev, cl_data->feature_report[i]);
			devm_kfree(dev, in_data->input_report[i]);
			devm_kfree(dev, cl_data->report_descr[i]);
		}
		dev_warn(dev, "Failed to discover, sensors not enabled\n");
		return -EOPNOTSUPP;
	}
	schedule_delayed_work(&cl_data->work_buffer, msecs_to_jiffies(AMD_SFH_IDLE_LOOP));
	return 0;
@@ -257,8 +289,9 @@ int amd_sfh_hid_client_deinit(struct amd_mp2_dev *privdata)
					(privdata, cl_data->sensor_idx[i], SENSOR_DISABLED);
			if (status != SENSOR_ENABLED)
				cl_data->sensor_sts[i] = SENSOR_DISABLED;
			dev_dbg(&privdata->pdev->dev, "stopping sid 0x%x status 0x%x\n",
				cl_data->sensor_idx[i], cl_data->sensor_sts[i]);
			dev_dbg(&privdata->pdev->dev, "stopping sid 0x%x (%s) status 0x%x\n",
				cl_data->sensor_idx[i], get_sensor_name(cl_data->sensor_idx[i]),
				cl_data->sensor_sts[i]);
		}
	}

+7 −2
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
#include <linux/sched.h>

#include "amd_sfh_hid.h"
#include "amd_sfh_pcie.h"

#define AMD_SFH_RESPONSE_TIMEOUT	1500

@@ -120,6 +121,8 @@ static struct hid_ll_driver amdtp_hid_ll_driver = {

int amdtp_hid_probe(u32 cur_hid_dev, struct amdtp_cl_data *cli_data)
{
	struct amd_mp2_dev *mp2 = container_of(cli_data->in_data, struct amd_mp2_dev, in_data);
	struct device *dev = &mp2->pdev->dev;
	struct hid_device *hid;
	struct amdtp_hid_data *hid_data;
	int rc;
@@ -141,10 +144,12 @@ int amdtp_hid_probe(u32 cur_hid_dev, struct amdtp_cl_data *cli_data)

	hid->driver_data = hid_data;
	cli_data->hid_sensor_hubs[cur_hid_dev] = hid;
	hid->bus = BUS_AMD_AMDTP;
	strscpy(hid->phys, dev->driver ? dev->driver->name : dev_name(dev),
		sizeof(hid->phys));
	hid->bus = BUS_AMD_SFH;
	hid->vendor = AMD_SFH_HID_VENDOR;
	hid->product = AMD_SFH_HID_PRODUCT;
	snprintf(hid->name, sizeof(hid->name), "%s %04X:%04X", "hid-amdtp",
	snprintf(hid->name, sizeof(hid->name), "%s %04X:%04X", "hid-amdsfh",
		 hid->vendor, hid->product);

	rc = hid_add_device(hid);
Loading