Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp203393pxu; Wed, 2 Dec 2020 19:57:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJxzFuz1s1HLbuTrlRo10M2akBagThqUUhhzIVleLzVxMo/oO3tB7YprV5rKyKYnCgTE1Nos X-Received: by 2002:a05:6402:1d18:: with SMTP id dg24mr1080353edb.221.1606967837959; Wed, 02 Dec 2020 19:57:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606967837; cv=none; d=google.com; s=arc-20160816; b=mfc7uJWvnmdRY9lirDnM+PYhfFjb0KpWigKHUOKf0KtO+bqbTvV6iEnLQOHXlrGijK Im+/kk+NGdQ9MFi0aSMbWOlfJWWkVRTBhl/II2eqGV68Q4E/cNB4IEfIwH6SCpSUVr1t K09+M4ilPlFRhujphs8gQuWcDueWlc3AVdZsQIMw3HBuTs4zwqJzDbUckOCDh5iDQLfO V/QUQiDjEPdCshNX/48iDUykchRsYdTTc6plztUZMhh8hdGUSopLrbV1kB50nuLOVgUT SsQFGJv/SL7dZQ77FrsfmvtquuDqk1nTPfxFUT0e7Y1WSrSHo6/SuOUkKnNPgapk7q/F vMNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from:ironport-sdr :ironport-sdr; bh=0HcRUrLwN0S2bB+r+BjOlQfYQuQrL8bKaAasieMydR0=; b=WCnankvYcF6nBp4I0yuRZLLMncfHsv7OROPdrZJ6o1bAnX6swRN/PZ7kZD//XsoR4c eTyEpWT3IoV/Cr1HTtPImZRbr4ZhY34AiVvZ5DghRm18FRE5wA6exE76OxvvR94SIDxn X/ovvKQh/LC8m17LL3zGBSl2DboA8fNdCVg8EKh4dY2ILSq8C7YUmR+2gZV9C1J1fSPj FNff6glEgfVOos4Q3+BcVYJH3cdvklKho8ETSkQgViT8Asz7R+IiYO7kSkAFsAblk4Rl 4EUbx86yl0fM6iX3bpsVMWqV+6d8scvUZBuJD/9Q1LkMDI+d9ME3dAwQYUIut2U1fJKi j2EA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gq3si360225ejb.706.2020.12.02.19.56.48; Wed, 02 Dec 2020 19:57:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387930AbgLCDxc (ORCPT + 99 others); Wed, 2 Dec 2020 22:53:32 -0500 Received: from mga05.intel.com ([192.55.52.43]:12273 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729770AbgLCDxc (ORCPT ); Wed, 2 Dec 2020 22:53:32 -0500 IronPort-SDR: jEJqWFdUzzKNjbJTyh0d3TBEHsSV0QLz15hZhUHJwRgKnynlYctt72oSPyE4TUDsLGmwGjMqhn 2wA5kIHBXsTw== X-IronPort-AV: E=McAfee;i="6000,8403,9823"; a="257842976" X-IronPort-AV: E=Sophos;i="5.78,388,1599548400"; d="scan'208";a="257842976" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2020 19:52:51 -0800 IronPort-SDR: l0YdXfNiKZsWtjx681fhtTA9zLIPjGYM4qZ5ZjxSD3RmrJmDR0QTHPI8mw2m4GHPhibwsOxQAy ZfxzIMzll37w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,388,1599548400"; d="scan'208";a="550330025" Received: from host.sh.intel.com ([10.239.154.115]) by orsmga005.jf.intel.com with ESMTP; 02 Dec 2020 19:52:49 -0800 From: Ye Xiang To: jikos@kernel.org, jic23@kernel.org, srinivas.pandruvada@linux.intel.com Cc: linux-input@vger.kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Ye Xiang Subject: add custom hinge sensor support Date: Thu, 3 Dec 2020 11:53:49 +0800 Message-Id: <20201203035352.13918-1-xiang.ye@intel.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Here three separate iio devices are presented which presents angle for hinge, keyboard and screen. This driver works on devices with Intel integrated sensor hub, where hinge sensor is presented using a custom sensor usage id. Here the angle is presented in degrees, which is converted to radians. Changes since v2: - use 1 iio device instead of 3 for hinge sensor. - use indexed channel instead of modified channel and added channel labels. - remove 2,3 patch in last version, add a document patch to describe the hinge channels. - hid-sensor-custom: use meaningful return value in get_known_custom_sensor_index and checked in call side. - hid-sensor-ids.h: use HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE(x) to define custom sensor value. Changes since v1: - fixed errors reported by lkp Ye Xiang (3): HID: hid-sensor-custom: Add custom sensor iio support iio: hid-sensors: Add hinge sensor driver iio:Documentation: Add documentation for hinge sensor channels Documentation/ABI/testing/sysfs-bus-iio | 17 + drivers/hid/hid-sensor-custom.c | 181 ++++++++ .../hid-sensors/hid-sensor-attributes.c | 2 + drivers/iio/position/Kconfig | 16 + drivers/iio/position/Makefile | 1 + .../position/hid-sensor-custom-intel-hinge.c | 393 ++++++++++++++++++ include/linux/hid-sensor-ids.h | 14 + 7 files changed, 624 insertions(+) create mode 100644 drivers/iio/position/hid-sensor-custom-intel-hinge.c -- 2.17.1