Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3929902imm; Mon, 8 Oct 2018 11:52:02 -0700 (PDT) X-Google-Smtp-Source: ACcGV63/dbu3pybEVC9zPnSnuKBfeqVWGHBAkICbrTQ98kfKvOmm4tCL2TkDomvK4VFlwaiyLcsV X-Received: by 2002:a62:2e02:: with SMTP id u2-v6mr27226037pfu.134.1539024722596; Mon, 08 Oct 2018 11:52:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539024722; cv=none; d=google.com; s=arc-20160816; b=bTofGM539FHt3TJQr1vbfPbQS+Ok+pw1UQgYCa4Er/PV5cEkyLx6M7295/8mgR3wuD hm9b8HM64E6QYB7IexXZ1oNBSE6TpgQ9pfzBaE8Rm3M/XzZU3EHm1P/vK2WuuvB/yji6 oxE/+xzupHbw2w89279OuIN8uDyqrkRRNs5IOSRHRUDDoXKwLHgnA8FIgAInxO7s1BUb CxZmz9Ffc7T6HeIFo7HqGIGdCvZXm6dvg92z77jR+rnHxCBf+3QQkQOSL2531SisCRyt OIPsbl1LEGescQcxUt45aXgL9uw91tJIhaNzkivEpCkuXgniEuMVDPyjzXWYCcx0L82m 80SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HWl7wN3naihdqzOAvhAp/OirmIr5q5K5Sfiv7rdlM+Q=; b=SR60XCeozMRweRHaSds9QQxllrta00TdnSmM/Ch/ugzygX2F0Fm6bWyTtcRdEUR6fH 7/QjInm6LsotlTGmmPqsOKtVwYk9XlafZq6Ue2H8XeD0DseCcvtxh5j/lQ9cd9AQrtC9 zuYPHd4Ovlz0lyFQl0aCI1yQXyzo0VZ1CTfCznSf+V/Ef9blvHWBudVh5fwgaDxABEel KuX8rHRPA4c2R7rbfjSvCUcU4wcRobZWmSS7laoCi3hIrerUvTpU8M7ijAw4SE8vsomC f5QsDydHIBExDvWtMIBFJ3UL1cFm2E++6KPX3fTSyHTIPVPVf0NczdviwP9pvtKw8y/q 4ydg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Bb0vNN4c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f23-v6si3982188pgh.250.2018.10.08.11.51.48; Mon, 08 Oct 2018 11:52:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Bb0vNN4c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732080AbeJICDc (ORCPT + 99 others); Mon, 8 Oct 2018 22:03:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:53040 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726391AbeJICDb (ORCPT ); Mon, 8 Oct 2018 22:03:31 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3B41E2087D; Mon, 8 Oct 2018 18:50:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539024623; bh=ez3WgfJyNGmw6vKExAJBad92V3aPK0l2+16BlahxA3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bb0vNN4c6IvjOpAckmJ2hpa586d71YwkUYcUQeNdFJz2e9WHWhxlKe0R2SDdr4Ziv /wBvcEsz0ZHF/Ex5hu8/bVEeR0MVVlXE2FA5OTadgwMmaOadKSJSk8bkfKxibMlPsV 3ufZKzVDBBigtkXpg44XZTtHCok+uTij/TtZ4aw0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Pandruvada , Fernando D S Lima , Hans de Goede , Jiri Kosina , Sasha Levin Subject: [PATCH 4.18 100/168] HID: sensor-hub: Restore fixup for Lenovo ThinkPad Helix 2 sensor hub report Date: Mon, 8 Oct 2018 20:31:20 +0200 Message-Id: <20181008175623.864452686@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175620.043587728@linuxfoundation.org> References: <20181008175620.043587728@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hans de Goede [ Upstream commit ade573eb1e03d1ee5abcb3359b1259469ab6e8ed ] Commit b0f847e16c1e ("HID: hid-sensor-hub: Force logical minimum to 1 for power and report state") not only replaced the descriptor fixup done for devices with the HID_SENSOR_HUB_ENUM_QUIRK with a generic fix, but also accidentally removed the unrelated descriptor fixup for the Lenovo ThinkPad Helix 2 sensor hub. This commit restores this fixup. Restoring this fixup not only fixes the Lenovo ThinkPad Helix 2's sensors, but also the Lenovo ThinkPad 8's sensors. Fixes: b0f847e16c1e ("HID: hid-sensor-hub: Force logical minimum ...") Cc: Srinivas Pandruvada Cc: Fernando D S Lima Acked-by: Srinivas Pandruvada Signed-off-by: Hans de Goede Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/hid/hid-sensor-hub.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c @@ -579,6 +579,28 @@ void sensor_hub_device_close(struct hid_ } EXPORT_SYMBOL_GPL(sensor_hub_device_close); +static __u8 *sensor_hub_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int *rsize) +{ + /* + * Checks if the report descriptor of Thinkpad Helix 2 has a logical + * minimum for magnetic flux axis greater than the maximum. + */ + if (hdev->product == USB_DEVICE_ID_TEXAS_INSTRUMENTS_LENOVO_YOGA && + *rsize == 2558 && rdesc[913] == 0x17 && rdesc[914] == 0x40 && + rdesc[915] == 0x81 && rdesc[916] == 0x08 && + rdesc[917] == 0x00 && rdesc[918] == 0x27 && + rdesc[921] == 0x07 && rdesc[922] == 0x00) { + /* Sets negative logical minimum for mag x, y and z */ + rdesc[914] = rdesc[935] = rdesc[956] = 0xc0; + rdesc[915] = rdesc[936] = rdesc[957] = 0x7e; + rdesc[916] = rdesc[937] = rdesc[958] = 0xf7; + rdesc[917] = rdesc[938] = rdesc[959] = 0xff; + } + + return rdesc; +} + static int sensor_hub_probe(struct hid_device *hdev, const struct hid_device_id *id) { @@ -743,6 +765,7 @@ static struct hid_driver sensor_hub_driv .probe = sensor_hub_probe, .remove = sensor_hub_remove, .raw_event = sensor_hub_raw_event, + .report_fixup = sensor_hub_report_fixup, #ifdef CONFIG_PM .suspend = sensor_hub_suspend, .resume = sensor_hub_resume,