Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp707397rwb; Sun, 6 Nov 2022 12:26:39 -0800 (PST) X-Google-Smtp-Source: AMsMyM4KKjSlW1xIi0DGM0oDhsPtLgoQaIlLBndcotKR/ALv2uJagDlu18GM6iIPq91iI0cu6NGj X-Received: by 2002:a17:906:9c82:b0:781:5752:4f2b with SMTP id fj2-20020a1709069c8200b0078157524f2bmr43710013ejc.561.1667766399552; Sun, 06 Nov 2022 12:26:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667766399; cv=none; d=google.com; s=arc-20160816; b=Br22UWlyUJ8x+d0PCvaRUr477vKgid4/VnlDNYZzz6eq68qTjEPleelAG1YmPPVEgK I+Acrsrwl4/UqqJLlrrB3gVXbXAsLErSEZcCoKaKjPehLPVV8VG58+aaUdU0dHCJb3nV kxhOgDs8y54NAeAZgL31zcB9fQsvarOQBAfmFqEXo+pPCAx30Dg+QlzBYWpwgj6mVxqg yRfRNR/P3UQtuynFpEKhVUViK/9Q4to7QA+g7ChAd6tx3/gLhIe2DwK3ekrv1LPDWYgL ZoLLlFaQzyosU3SuXxN3pnVszu8xoEoXJkJzQcLNWTIHd/bMxO6EiG4SbhbALWlzYfzy OHAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=YdIXD62YRYwd2o9Gpu39oSjQE9YhzoJodAvTFDp9pKc=; b=kac9s/VuwuXgztEb450+Bt2gT5fwqkvKADPPBgwXmMSe/6JFnFMMfrpTgsraH/oiyg /R9JR/dRo3JU1HpfB2Il+KhSooxY0zdPqNFsSfPQs9WZRP+fc9Q9ieQFgqVK0ByAVL8B 8+Mpa1yXKYWvqzuwNBMZgENFXjqVc0+TFE6eOzORqYPaU+g8SVSoF/K7W8j69dYHfjVm /8zmhKJ9t95c7JxbhynjGmVm9kQvtKXFN9CrQwV6LhMZNaqxoo/aOilBTAOB72L2e9jT UMZOq86Cu22zb8Qx/AlUds3cgSj8B0sTZK4jGKw2LQtRteQWDvtaiwCO8h0BSJbeQqFd tQQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=U5DOEN7g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg11-20020a170907a40b00b0078db5170767si7362203ejc.18.2022.11.06.12.26.02; Sun, 06 Nov 2022 12:26:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=U5DOEN7g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229926AbiKFUAX (ORCPT + 95 others); Sun, 6 Nov 2022 15:00:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229463AbiKFUAU (ORCPT ); Sun, 6 Nov 2022 15:00:20 -0500 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29B3910FF7; Sun, 6 Nov 2022 12:00:18 -0800 (PST) Received: by mail-lj1-x232.google.com with SMTP id z24so13407460ljn.4; Sun, 06 Nov 2022 12:00:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=YdIXD62YRYwd2o9Gpu39oSjQE9YhzoJodAvTFDp9pKc=; b=U5DOEN7gFVqJ6jH+vtI8yJP+hq91bUZ0eQseTZCqbvW/ecO5gwtvcwwa9xHT4IXO+9 G3/jWYbXho+5ZpGDiO7BHuAdHDMHI14cCA6oMAPWc45YyhZ9Ys6J+W/3Zjcw1G/fE2QI fGYF1J6wIwmMJMV7QUrpJoY3vGrGdsZMcdIoUxq6Z/M53AKoukK0LoGYPflYVNyPHJtj dE4bxl0sN8lEB/lg/6REU/nOU9JdY12SAZo3szKAOzlipzM/F0osRMs5WCV0y1SUFtH8 j2UN+jhztd8eHrhC4tU+fRwWyoWqSxTfwCEv71po66+mllAgrusJMFZTFV/YdEu9W3QV whTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=YdIXD62YRYwd2o9Gpu39oSjQE9YhzoJodAvTFDp9pKc=; b=20OO0UadjBqJx0mw63QyDFzscZpaY63oXvXEXqUA3Qkq4WabfamjUeDzT9KS5aZaq0 HquyGZgl+xmFG4M/Nryv31CCyHAzkJdUgFUdD28OJXByfmHkLOapBQU3nggxAvMn3+BZ LEUZTOYD+M2XGuUQo47OTryy39P6oQ46pcqL5fkAeaDVXN3h6EeEUGAwRV5eeRA6mIU1 MvccjSqtyeSvkIcjLtaO7wN7mIS/qGcrd/8n4gO5CSk3xCAUCfkd92yXHR/cJsPPZ9Av XB6j2oqVvjdR/33VZd9jaZZ/KF/ugnrc9zzwKcioMyjLrpl82QY4sLIVje59e4S/uE+H wPAQ== X-Gm-Message-State: ACrzQf2gzp04md3SaN4sc1piLdMjSgKcgZr/k2iNaAfPwl5kztflFQDJ k4YL3Eyb5f+sPYupHj8Jm0eBuTpGa96pMQ== X-Received: by 2002:a05:651c:110e:b0:277:4a04:ad9a with SMTP id e14-20020a05651c110e00b002774a04ad9amr15371286ljo.379.1667764815944; Sun, 06 Nov 2022 12:00:15 -0800 (PST) Received: from localhost.localdomain (static.9.224.99.88.clients.your-server.de. [88.99.224.9]) by smtp.gmail.com with ESMTPSA id o13-20020ac24e8d000000b0048aa9d67483sm841196lfr.160.2022.11.06.12.00.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Nov 2022 12:00:15 -0800 (PST) Received: from jek by localhost.localdomain with local (Exim 4.96) (envelope-from ) id 1orlmO-001x4s-07; Sun, 06 Nov 2022 21:58:04 +0200 Date: Sun, 6 Nov 2022 21:58:04 +0200 From: Yauhen Kharuzhy To: Jonathan Cameron Cc: linux-input@vger.kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Benjamin Tissoires , Srinivas Pandruvada , Jiri Kosina Subject: Re: [PATCH] HID: hid-sensor-custom: Allow more than one hinge angle sensor Message-ID: References: <20221105223422.417316-1-jekhor@gmail.com> <20221106173643.5b4f2a0b@jic23-huawei> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221106173643.5b4f2a0b@jic23-huawei> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Nov 06, 2022 at 05:36:43PM +0000, Jonathan Cameron wrote: > On Sun, 6 Nov 2022 00:34:22 +0200 > Yauhen Kharuzhy wrote: > > > Some devices has two sets of accelerometers and the sensor hub exports > > two hinge angle 'sensors' based on accelerometer values. To allow more > > than one sensor of the same type, use PLATFORM_DEVID_AUTO instead of > > PLATFORM_DEVID_NONE when registering platform device for it. > > > > Checked on the Lenovo Yoga Book YB1-X91L tablet. > > > > Signed-off-by: Yauhen Kharuzhy > > Purely for curiosity sake, but where are the two sets of sensors? > Doesn't look like it has two hinges at first glance! It sounds crazy, yes :) The Lenovo Yoga Book YB1-X91L looks to be strange device in many ways. There are two accelerometers at display side and two at keyboard side (for detecting the rotation movement as I understand). For some reasons ISH exposed two virtual hinge angle sensors (I guess that one for each pair of accelerometers): ... [ 6.230627] Registering platform device 'HID-SENSOR-INT-020b.35.auto'. Parent at 001F:8087:0AC2.0005 [ 6.230658] device: 'HID-SENSOR-INT-020b.35.auto': device_add [ 6.230705] bus: 'platform': add device HID-SENSOR-INT-020b.35.auto [ 6.230737] PM: Adding info for platform:HID-SENSOR-INT-020b.35.auto ... [ 6.249248] Registering platform device 'HID-SENSOR-INT-020b.36.auto'. Parent at 001F:8087:8AC2.0006 [ 6.249266] device: 'HID-SENSOR-INT-020b.36.auto': device_add [ 6.249295] bus: 'platform': add device HID-SENSOR-INT-020b.36.auto [ 6.249394] PM: Adding info for platform:HID-SENSOR-INT-020b.36.auto This is senseless but it is what it is. Moreover, this 'sensor' is always returns 360 degrees angle, although display and keyboard 'absolute' angles are reported correctly. In any way, this patch is generic and will be useful for other custom HID sensors if they will be added in the future. > > Jonathan > > > --- > > drivers/hid/hid-sensor-custom.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c > > index 32c2306e240d6..a6fc89ee1287c 100644 > > --- a/drivers/hid/hid-sensor-custom.c > > +++ b/drivers/hid/hid-sensor-custom.c > > @@ -862,7 +862,7 @@ hid_sensor_register_platform_device(struct platform_device *pdev, > > return ERR_PTR(-ENOMEM); > > > > custom_pdev = platform_device_register_data(pdev->dev.parent, dev_name, > > - PLATFORM_DEVID_NONE, hsdev, > > + PLATFORM_DEVID_AUTO, hsdev, > > sizeof(*hsdev)); > > kfree(dev_name); > > return custom_pdev; > -- Yauhen Kharuzhy