From mboxrd@z Thu Jan 1 00:00:00 1970 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=5IuqRNsRT4NphrTzX9MVj3aZmmVlciheUd4g0KBT7qmHMOPBOywLbnDOEkEUq+lkLmNw GZ8X1k4ZkQOo0T2zpxK8E3KiY7isyalOKR7qUxVHusDjICSkYaE9ZbDcCxwWx/73quxPR i5NlLIygqEgKSnUvfjHETpzDHGLPsa2CrZuvspQ5JmSWCA2hD9CdNS08slAgYlbRNTdY2 vZZIwVZyVPn4+7RD9YgDaQhETXzfzgVQSZVS3tjn3GqacJpN0deORCufxPgjgPs6F07aS xAb9MGUFBiH6KXZkJfTdMFXF/FwqO9gI7JWAPkc1KBmZ7V/SX0DUSNxogNZuAs9GBkw== 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=cx7UI2Ft6ofCa+HyCbHYHiNc2xegBods+f0xi/1//lr//DMDTgAsg591b6HzVt3y1rIA TkWrn5Ww4NRN/eTeV6JPTw58lMVSGiuy7tkQI/fAd7jqkpOEGHjwp01WzzL8lwWi8158c 42KEgaghc4qgffZPCD+lMOYv6TaN4y2ECt67IqDBGlxfcKR+ZKdvnXrJYJtg3GkFCw2nc dyrolfG60mRT8BobHkbNjA0TyXCst8J7dqriBvwKBM4pxCe82Va9JJZVnozXtqcZW70ph YgVIdvryshPuZ+qndTAuW1TLV1UrgACqjGDi4I8UUulpixyXaBG5USSEy3iGx6+K6Kw== 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 2D159606A32D for ; Thu, 3 Dec 2026 15:38:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2D159606A32D 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-91c847584b8so11918666d6.0 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=v4GmKCZAZCP/ECNCFIT6GBXr0hRMKmTVUGZbDyPXAXuNK9GYzxox943swsNaJHoPE9 IR7LQIxr+lLBK6Ts9J+tNrtEXC7QTXgafKlB1SENkm7PasO2p3DARYiUNIsy3z6FkBwD 5W6hmzBuBDooXf7tCpwbGf1JQpjgmGBVcuyz8lNFgBqHj45R58sgzG4r7rYFDiRngxsb NutPkvNGRtTmb26K5EsWu2IPJSfsg87KFvBiKFeTUmPP9NDLmC56j08/kAkqUWldMwp1 1UksqA5W7iPir8A4sAZs7ynyiHwgVV86OUhj+U3PjrH7k2fpn/j2UNl4AHTTNaHWRejg oD5g== X-Forwarded-Encrypted: i=1; AL+hErFwp0J9n4fLQeamB5npwRIC7Q+YAxPo+8dTrvlOl7I2JeTW2t4z3LQe80PayOXFqiW+1mIYcoVasEZRydI=@vger.kernel.org X-Gm-Message-State: APuU4Z86ogDc/+eUMIObuS8giWILMVEG/DdQ8vpQ/E98C2kPaxf4wXZY aQnvvBCGHn1USu/ll6GjH6DOrMa23zqYo7eZwYHe5a/kYsyTtzqYxXIJ4zkbtSz++rk= X-Gm-Gg: AZFdTZddF4kN88kTjarhiBcbzd5Zbm625BlN7Y6Wu/hjAS/Oe156pQX1YZ07nls9S0C f65Rj8uDi0FYKIxxpHNTHJEsazKCnIxpZ0/hdyfDnl5k6edqwE97DM1Q6456y7ObwI74JTjFsJv 3hGKPpNm9UvPSZlHIwGW+TM83mwmlu4ROUFCg9puJXCzwbp2IoYte0/W0Aq4JNpEzSUgBHQfpSw xPghu0Tkye82gNCXwz5Q3rE4nM3V7rSDML1ggxwZE582SuML/JOBcV6SdUKrdSfeYfG5AeHl0xt dO6bocwBVtLseTsiETP0pG3gsMjeE85TDLOabM265IwP3FBAcjSrGSrvL1A6GfLQgLRhyIMDlTc F3dBwFuaOTr23q85sB3eRIoWrEXBR08csZMEw3rZaOCVFisZtW9u/oDm/TcDxw4GuqhHixNmqgW 10RHQZrDyB7QfIvrY9LQtUNHy33nTZEpzJxiFGbtZioNsbqLu+IQmQ60m22dEIc+RxkaBfp3j5c 3tTOhQo0An6n6t9uKCZbDMfRtmKww0PPacMI8/BCVvbY2AJIJ8/ejZtUclBGfSpeqiWaGzzjcoE tEo2rQ4nBn2vcwITHo9q1jrY7OmwYB/sHi/toJfnb7SakdqeqZIS9roiXP0IaQ== 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-kernel@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