Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp829509rdb; Fri, 22 Dec 2023 06:25:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IEaRy84Owtxx6AaYV17z0VMOiOm03V5TAX3Mj/gY61w0ThgtIEKCzrrpBpaBuJjmhd0nkmz X-Received: by 2002:a05:6402:22ef:b0:553:63af:7284 with SMTP id dn15-20020a05640222ef00b0055363af7284mr392724edb.162.1703255100012; Fri, 22 Dec 2023 06:25:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703255099; cv=none; d=google.com; s=arc-20160816; b=TDvCUIWGE0zkn3zwBCE1q+N5SXKjAdhSYgkxCRguEChKIfyjn2blJJIwbrRxmrdC6k ZgoCUDu5p2UyUn7QjqAsG6r8wDwc7c2XX7sNCszZW8tYbtj2SynnAFbnLQ+f/owBAhPm RBOqeOSa5WPMl22F6I/RYKdvN7NioYNx96o1AQNnfURIQvS2yx4ESzICTS2sZNLH2rbn LPIC1mq51x7s5vF0+GdDOAI8CEiRcXYbfsKG2Ji83ujUm5AKdQpZOuxEq8dezkD5APsT RCuXgTaHLOFr5eyRHfchx8i6dUF6H9xRl6YjLxQYmM2vT8Rrj8Zv9TgHi6WsCngWa29D o3Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature; bh=5IQoWpfQ/5wHHHuIPnsgD6NLgOG/1QPwwdB95s66PEg=; fh=QYeJQJ9glkBFhxMVjfnnQd4Zm9Ijq9/FGCYIltmcpYY=; b=oWcbY+sZHkSw+30w7eoEFkE1eCPR0CutucFgyfeLq5tnnzY8sVznfydS2lrzc9DiA8 ZqOtmfR5wvYH9rRuW1hAHQY1zDbuOFceyFTiY9IPwT49/R88+tAfGjnFhXpAA1kKs8VH nOIVI2zdUvADVNzP+Ds0666z3iuEBEYlkIOdl0LguRwIB7MWRS/oMIG3xRk9DNi7vCQq CP5z5AWXXFQD+/0w9/DIRek+s/VUAK65PfGMbQxAcBHFs45Ot1ARThzpOpNVZT1lZO6n H7kSMEm9XwGhfNR7CwQyGMi1n+AsCs03HK/4JQ/ZYHIkXII8GUnoMmi9vvMG4ubjLTwT KObA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GDWZVVd4; spf=pass (google.com: domain of linux-kernel+bounces-9777-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9777-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id s5-20020a056402036500b005533e0d0e6csi1886614edw.630.2023.12.22.06.24.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 06:24:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9777-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GDWZVVd4; spf=pass (google.com: domain of linux-kernel+bounces-9777-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9777-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C01FC1F21604 for ; Fri, 22 Dec 2023 14:24:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 405711D53A; Fri, 22 Dec 2023 14:24:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="GDWZVVd4" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 523E71C693; Fri, 22 Dec 2023 14:24:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703255087; x=1734791087; h=message-id:subject:from:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=5IQoWpfQ/5wHHHuIPnsgD6NLgOG/1QPwwdB95s66PEg=; b=GDWZVVd4ntpXsKcyCLnQjPMOCcQo1BuxnRkRADYDeRg2xOQ+THicfl/u aN+kPbX8TKnAumTAZFf9I+d3fncl79vZO/pO7mwktZblvRmTYldmP+U0D zMfB0q7jwgYKmXiVfyXyYj63RoMaGpLOHAKY0+iMWKntUyjAZ133xYE// Lc3S5MNm1j73Vd/GWD1ct0+UBlA/8GreiMK6OrHxCdvGq7bTbAO9XRp+n o+fLGk3e0kCE2aaMWRGKuMReOQeYRCMiouTUtd96aExkjmnOBtsFg87Lc TZQlwDqo/og9Q+B3F5QHz8aTUp0y/VoLoPVz74mBRjOd29QhEeEQr+jHA g==; X-IronPort-AV: E=McAfee;i="6600,9927,10932"; a="462559382" X-IronPort-AV: E=Sophos;i="6.04,296,1695711600"; d="scan'208";a="462559382" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2023 06:24:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,296,1695711600"; d="scan'208";a="11471189" Received: from spandruv-desk.jf.intel.com (HELO spandruv-desk.amr.corp.intel.com) ([10.54.75.14]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2023 06:24:46 -0800 Message-ID: Subject: Re: [PATCH] HID: sensor-hub: Enable hid core report processing for all devices From: srinivas pandruvada To: Benjamin Tissoires Cc: Yauhen Kharuzhy , Jonathan Cameron , linux-input@vger.kernel.org, linux-iio@vger.kernel.org, Daniel Thompson , linux-kernel@vger.kernel.org, Jiri Kosina Date: Fri, 22 Dec 2023 06:24:45 -0800 In-Reply-To: References: <20231219231503.1506801-1-jekhor@gmail.com> <20231220145229.020abe62@jic23-huawei> <38313826939a468ff8c7eee24e2cf07e9eef6768.camel@linux.intel.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4 (3.44.4-3.fc36) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Fri, 2023-12-22 at 14:28 +0100, Benjamin Tissoires wrote: > On Fri, Dec 22, 2023 at 1:44=E2=80=AFPM srinivas pandruvada > wrote: > >=20 > > On Wed, 2023-12-20 at 17:04 +0200, Yauhen Kharuzhy wrote: > > > =D1=81=D1=80, 20 =D0=B4=D0=B5=D0=BA. 2023=E2=80=AF=D0=B3. =D0=B2 16:5= 2, Jonathan Cameron : > > > >=20 > > > > On Wed, 20 Dec 2023 01:15:03 +0200 > > > > Yauhen Kharuzhy wrote: > > > >=20 > > > > > After the commit 666cf30a589a ("HID: sensor-hub: Allow multi- > > > > > function > > > > > sensor devices") hub devices are claimed by hidraw driver in > > > > > hid_connect(). > > > > > This causes stoppping of processing HID reports by hid core > > > > > due > > > > > to > > > > > optimization. > > > > >=20 > > > > > In such case, the hid-sensor-custom driver cannot match a > > > > > known > > > > > custom > > > > > sensor in hid_sensor_custom_get_known() because it try to > > > > > check > > > > > custom > > > > > properties which weren't filled from the report because hid > > > > > core > > > > > didn't > > > > > parsed it. > > > > >=20 > > > > > As result, custom sensors like hinge angle sensor and LISS > > > > > sensors > > > > > don't work. > > > > >=20 > > > > > Mark the sensor hub devices claimed by some driver to avoid > > > > > hidraw-related > > > > > optimizations. > > > > >=20 > > > > > Signed-off-by: Yauhen Kharuzhy > > > > Fixes tag? > > >=20 > > > Fixes: 666cf30a589a ("HID: sensor-hub: Allow multi-function > > > sensor > > > devices") > > >=20 > > This flag causes > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 hdev->claimed |=3D HID_CLAIMED_DRIVER; > > I don't see the flag is used anywhere after this assignment in hid > > core. Only two other drivers are setting this flag. We need Jiri's > > help > > here why this is a special case. >=20 > It's used in hid_report_raw_event()[0]: > ``` > =C2=A0=C2=A0=C2=A0 if (hid->claimed !=3D HID_CLAIMED_HIDRAW && report->ma= xfield) { > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 hid_process_report(hid, report= , cdata, interrupt); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 hdrv =3D hid->driver; > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (hdrv && hdrv->report) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 hdrv->= report(hid, report); > =C2=A0=C2=A0=C2=A0 } > ``` >=20 > The whole point of setting HID_CLAIMED_DRIVER is to have hid->claimed > not equal to HID_CLAIMED_HIDRAW, in case we need the hid core > processing. Thanks Benjamin for explaining. Then this change looks fine as sensor hub driver will claim this device and it needs hid core to process report. Acked-by: Srinivas Pandruvada Thanks, Srinivas >=20 > Cheers, > Benjamin >=20 >=20 > [0] > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/d= rivers/hid/hid-core.c#n2015 >=20 > >=20 > > Thanks, > > Srinivas > >=20 > > > >=20 > > > > > --- > > > > > =C2=A0drivers/hid/hid-sensor-hub.c | 2 +- > > > > > =C2=A01 file changed, 1 insertion(+), 1 deletion(-) > > > > >=20 > > > > > diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid- > > > > > sensor-hub.c > > > > > index 2eba152e8b90..26e93a331a51 100644 > > > > > --- a/drivers/hid/hid-sensor-hub.c > > > > > +++ b/drivers/hid/hid-sensor-hub.c > > > > > @@ -632,7 +632,7 @@ static int sensor_hub_probe(struct > > > > > hid_device > > > > > *hdev, > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 INIT_LIST_HEAD(&hdev->inputs); > > > > >=20 > > > > > -=C2=A0=C2=A0=C2=A0=C2=A0 ret =3D hid_hw_start(hdev, HID_CONNECT_= DEFAULT); > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0 ret =3D hid_hw_start(hdev, HID_CONNECT_= DEFAULT | > > > > > HID_CONNECT_DRIVER); > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (ret) { > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 hid_err(hdev, "hw start failed\n"); > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 return ret; > > > >=20 > > >=20 > > >=20 > >=20 >=20