Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.219.54 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796312326; b=lTDP8Phpny5+aI76bKCPCHrjI+1UHUljro6NN79wPdP1F1dqdKLgFQpCm+w+6XqHJKVM 3p+MFIg/fuado7kuYheuC4WHpptJ/tXCjxU3bCStKJqibue7YmmB+8f/PuXclVD/b7+4Q QMpcDYnSLQNZ0iZeMrz1kbW8JsQzJ/GhPJ1yE6h28yQDnR58cn0RMJksLumKVU082lh7K wRwS0VEsnVSEJpr89Xp9542GdTEfck6bpEpgIpBTLFTUMB4IA+KoAelJ154lrUXjG9yaJ hP+vXlIMUGEZmWZtg1yeR5sYPl3DonDuie+DSFPgx9fGTZlnejum0Nt7scBUlbAlxqA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796312326; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=gYdKiFqD/GrDupflTijUvvS9n4l4jV9Eq/EjlfL/al4=; b=Q3RJ+V71GMyDHJJB6uBCBtWzp4KeAeLOmkGtAxXv/qYHxnRT0D4YXfVVbd2I7R71/T52 +ynWEmt2NNFE3M8zzm74v8bEKUAOqR0ZLtEzqlr7lDo+vO5+DxbSXpxPszVVgGlzxihj8 PxHLQIloDQw6B4Hiol/Q1YFEcTvxGmRh9LPIYgkct+HoIYehRysgs4cn0h5SqwWVF20Gj rUBZguwrewT1wZJbeSzzzhFIfiFncQSEp8yat+14VuP6BXDDize70IcaAnANxqL95CwU8 Z8yI9dgcai1pqiqPZOzcv6dN45F8ibOoO0/0wjFaMB9K6M/t0q6VR5+TyZ4X3WPGhvg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=rizvi.nu; spf=pass smtp.mailfrom=rizvi.nu; dkim=pass header.d=rizvi-nu.20260707.gappssmtp.com header.i=@rizvi-nu.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=CcPa0myy; arc=none smtp.remote-ip=209.85.219.54 Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D174606A32F for ; Thu, 3 Dec 2026 15:38:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2D174606A32F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rizvi.nu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rizvi.nu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rizvi-nu.20260707.gappssmtp.com header.i=@rizvi-nu.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=CcPa0myy Received: by mail-qv1-f54.google.com with SMTP id 6a1803df08f44-92106d5371dso13105746d6.1 for ; Thu, 03 Dec 2026 07:38:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rizvi-nu.20260707.gappssmtp.com; s=20260707; t=1796312324; x=1796917124; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=gYdKiFqD/GrDupflTijUvvS9n4l4jV9Eq/EjlfL/al4=; b=CcPa0myyP3E07LYijEXHni0BBWwIWLvZivJ8pcwTTV1nrxc/u6tBYAm3DhrMQWzkLA xjSocNxZ5cVEKLFnkdDFL8cr3virqVzjDXVMUQH0WNVi2ahv65t1EweJSKs5Km3vQ8kH X1wq/OG76Q4brbc4ujW8w7RLqAal/lvQUNQfDRnuUJIFjIhAdNvHrMsnHi9p/LHqrbND 1eZ2Y8PAixKsFsxEGK8xsABCpSqvez/IsG6+v2EnNeOFyqEMH4T2W64gJqxONhtdjuKS 2xL7I0hTip3E+kRbZSX4IK/7T2IFU8CUOF6npzlRi9BYzD0B5dS/bbGmq1az7DcRdBZ1 8QCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796312324; x=1796917124; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=gYdKiFqD/GrDupflTijUvvS9n4l4jV9Eq/EjlfL/al4=; b=jSquqRgNyxKmTz6/OpiSsUA+SCLfrm4UPEbn1yy9YoN1ykTPA6Exm0BlPts7Ws36CP tu6jIzW1An5ySuhxwoV+TKAZnJnklv0REI260Z5hyQPBIud/bG3/jzXRa58qO4sG+wq2 u7/RrReTcE9jmqYVs9iFWaRULvtZtbWwtH828+nY4MgOxXqcYYttMJXoqj0Z1gzwPyGF uOz5AYKSB+etbnmoXE5fbZ7+BPB2aRvGe7JFTaJVbUqUnVxoegJMhUrQOZGd6ai5mHMN WL/Lq0HLNrSqb4zlvvjws6BH4vprQK9T/PKNa/SJbl0x7cnCYBZihQrmedbkkoid54CL oofg== X-Forwarded-Encrypted: i=1; AL+hErE8ShVlPgaLvE4yn+HO3y6zK7hWUwis5zgjktR6ig9i/o0Ch9CyBnLMvNtZnayqv+oOtH2kC/HcuEk=@vger.kernel.org X-Gm-Message-State: APuU4Z9H4RwUKlFkJ1hoy37fsUIHDHPvrOHVs8SpdBiSup2ywA6Q48vI JpYv4gjQXUGndYmTlx0Lih9LyVEigI6lrqOzz9/1Iy+vdO8Cd8plgbUqRiZhjsMn3vE= X-Gm-Gg: AZFdTZfx3q2v7czZZdWXQSUciPKkaxGL6g5Fi2V/PYg1UnDZ5nVwUrpo4vpSzlaxhIc Q4sw7xhXhzGsl0exAWmykGGjpNoWy0tNXl32tvc/A94Pz18dWbTwgi8Ti2CrNEKvBDJHglXUtGp ertDgRRRdVIt2KKtxmQmv2i1cA259pUTIfpkrW97xlscoBPZnkmmAtVGQ0STxdCQ3O1+9YgczR2 ZwQ/Ta+JhoKkCV+WeP08Zu+rHJ0JUJAcLTJ1j9FN63QR6RhlRBsk5cXYhA3zLRfxQM7zOOhm7Ji QeNi+cKI09p+FAsq+qOIecFFzuP/3iPfT7cmQOslc3QkbpXpWC+miRRuktaubiS6YjarsBJ/4QQ bysOYVcus8BGZlJbcB3/1nhS+U052wqZGFgNWtJ59fv2wmqifGkapIwimgWEQiMwXvYod3WbzHi FsDYO0x8Z3NCJVqxtDA0DgZC/h+OIXqLjbmPPczpkiZnYs/fvZmRhKoH/S60Upe5op2AvPnC6aN Av6ef1ZwV0GoNEIfillZXRWCNkgvooAbYz8KPkWhGKoIDP8nvip0Ivjo7BTy6iURr27eTNqsDyo X00xkLPQ0CG4aogmKzuWcFZADJIKInMrXX/t8M/BvSfeq8TZuyTVya/WtbobvQ== X-Received: by 2002:ad4:594b:0:b0:921:2465:f232 with SMTP id 6a1803df08f44-921d4e167f4mr36307106d6.17.1796312323650; Thu, 03 Dec 2026 07:38:43 -0800 (PST) Received: from localhost (pool-100-38-3-176.nycmny.fios.verizon.net. [100.38.3.176]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-921349eae11sm381343946d6.25.2026.12.03.07.38.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 07:38:43 -0800 (PST) From: Shan Rizvi To: Jiri Kosina , Benjamin Tissoires , Jonathan Cameron , Srinivas Pandruvada Cc: linux-input@vger.kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Chia-Lin Kao , Shan Rizvi , stable@vger.kernel.org Subject: [PATCH] HID: sensor-hub: Fix report 17 interval size on Chicony 04f2:b872 Date: Thu, 3 Dec 2026 10:38:42 -0500 Message-ID: <20261203153842.565409-1-shan@rizvi.nu> X-Mailer: git-send-email 2.56.0 X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On the Chicony HP 5MP Camera sensor hub (04f2:b872, bcdDevice 0x1020, HP OmniBook X Flip 16 8EA2, BIOS F.07), probing the secondary proximity sensor (feature report 17) via iio_info or iio-sensor-proxy stalls runtime PM resume for hours. All byte offsets below include the leading report ID at byte 0. Report 17 declares Report Interval (usage 0x030e) and Minimum Report Interval (usage 0x0304) as 32-bit fields for a 122-byte report. On the wire, GET_REPORT returns 120 bytes: a 16-bit Report Interval at bytes 6..7 followed immediately by the 32-bit Minimum Report Interval (100 ms) at bytes 8..11 and the remaining fields, shifting every subsequent field left by two bytes (including Friendly Name and Persistent Unique ID): parsed at declared offsets (bytes 26..57): "P AI SENSOR" actual wire layout (bytes 24..55): "HP AI SENSOR" Because hid-sensor-hub parses Report Interval as 32 bits, the default wire bytes (d0 07 64 00) decode as 6,555,600 ms instead of 2000 ms, causing in_proximity0_sampling_frequency to read 0.000100 and stalling hid-sensor-trigger's runtime PM resume in msleep_interruptible(poll_value * 2) for ~3.64 hours. On the write path, hid-sensor-hub likewise constructs a 122-byte SET_REPORT with every field after Report Interval shifted right by two bytes. Because this device exposes working ALS (report 10) and primary proximity (report 1) sensors, adding 04f2:b872 to hid_ignore_list would regress working sensors. Fix report 17's Report Size (32 -> 16) and Logical Maximum (0x7fffffff -> 0x0000ffff) in-place in sensor_hub_report_fixup(), matching the 1846-byte descriptor and the 18-byte item sequence at offset 1553. Tested on kernel 7.2.15 with stock hid-sensor-trigger: in_proximity0_sampling_frequency reads 0.500000 and round-trips across 10, 1, and 0.5 Hz; raw HIDIOCGFEATURE dumps confirm SET_REPORT updates bytes 6..7 without altering trailing fields; warm reads of in_proximity0_raw return a live value (~212 ms) without stalling runtime PM resume. After runtime autosuspend, a raw read can still hit the pre-existing 5 s completion timeout in sensor_hub_input_attr_get_raw_value() (returning 0), which is a separate issue not addressed by this patch. Primary proximity and ALS continue working. Link: https://lore.kernel.org/r/179591783777.39.15448655394533903125@rizvi.nu Cc: stable@vger.kernel.org Signed-off-by: Shan Rizvi --- Notes: - Based on hid.git for-next; runtime-tested on 7.2.15 against stock hid-sensor-trigger. - In the linked thread, Srinivas noted he plans to send a generic hid-sensor-trigger poll-interval clamp. Even with trigger-side clamping, report 17 still needs this descriptor fixup so GET_REPORT and SET_REPORT field offsets align. - Kept in-kernel in sensor_hub_report_fixup() rather than HID-BPF because probing this sensor can stall runtime PM resume for hours on systems without udev-hid-bpf installed. drivers/hid/hid-ids.h | 1 + drivers/hid/hid-sensor-hub.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index f841667..a6d84a7 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -349,6 +349,7 @@ #define USB_DEVICE_ID_CHICONY_HP_5MP_CAMERA 0xb824 #define USB_DEVICE_ID_CHICONY_HP_5MP_CAMERA2 0xb82c #define USB_DEVICE_ID_CHICONY_HP_5MP_CAMERA3 0xb882 +#define USB_DEVICE_ID_CHICONY_HP_5MP_CAMERA4 0xb872 #define USB_VENDOR_ID_CHUNGHWAT 0x2247 #define USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH 0x0001 diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index 2a7f247..8fdee5a 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c @@ -674,6 +674,34 @@ static const __u8 *sensor_hub_report_fixup(struct hid_device *hdev, __u8 *rdesc, rdesc[917] = rdesc[938] = rdesc[959] = 0xff; } + /* + * Chicony HP 5MP Camera (04f2:b872) declares report 17's Report + * Interval (usage 0x030e) as 32-bit, but firmware sends and expects + * 16 bits (119-byte feature payload instead of 121). Fix Report Size + * and Logical Maximum so report 17 matches the wire layout. + */ + if (hdev->vendor == USB_VENDOR_ID_CHICONY && + hdev->product == USB_DEVICE_ID_CHICONY_HP_5MP_CAMERA4 && + *rsize == 1846) { + static const __u8 report17_interval[] = { + 0x0a, 0x0e, 0x03, /* Usage (Report Interval) */ + 0x15, 0x00, /* Logical Minimum (0) */ + 0x27, 0xff, 0xff, 0xff, 0x7f, /* Logical Maximum (0x7fffffff) */ + 0x75, 0x20, /* Report Size (32) */ + 0x95, 0x01, /* Report Count (1) */ + 0x55, 0x00, /* Unit Exponent (0) */ + 0xb1, 0x02, /* Feature (Data,Var,Abs) */ + }; + + if (!memcmp(&rdesc[1553], report17_interval, + sizeof(report17_interval))) { + hid_info(hdev, "fixing up Chicony HP 5MP Camera report 17 interval size\n"); + rdesc[1561] = 0x00; + rdesc[1562] = 0x00; + rdesc[1564] = 0x10; + } + } + return rdesc; } base-commit: 47d0d5ce3cfca63a04eabcbeef7086d06240ff97 -- 2.56.0