Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E894C10F11 for ; Mon, 22 Apr 2019 14:21:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1459E20693 for ; Mon, 22 Apr 2019 14:21:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727450AbfDVOVV (ORCPT ); Mon, 22 Apr 2019 10:21:21 -0400 Received: from mga12.intel.com ([192.55.52.136]:48547 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726421AbfDVOVV (ORCPT ); Mon, 22 Apr 2019 10:21:21 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Apr 2019 07:21:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,382,1549958400"; d="p7s'?scan'208";a="152886091" Received: from orsmsx104.amr.corp.intel.com ([10.22.225.131]) by orsmga002.jf.intel.com with ESMTP; 22 Apr 2019 07:21:19 -0700 Received: from orsmsx109.amr.corp.intel.com ([169.254.11.52]) by ORSMSX104.amr.corp.intel.com ([169.254.4.183]) with mapi id 14.03.0415.000; Mon, 22 Apr 2019 07:21:18 -0700 From: "Pandruvada, Srinivas" To: "jic23@kernel.org" CC: "jikos@kernel.org" , "linux-input@vger.kernel.org" , "Song, Hongyan" , "linux-iio@vger.kernel.org" Subject: Re: [PATCH] drivers: iio: Add more data field for iio driver hysteresis parsing Thread-Topic: [PATCH] drivers: iio: Add more data field for iio driver hysteresis parsing Thread-Index: AQHU7nIwleYiOdt1pUS6nEYUQUpzvaY8FcGAgAJqWoCACeldAIAAXEcA Date: Mon, 22 Apr 2019 14:21:18 +0000 Message-ID: <95d950d24b9b0fef1e6d2259fb41413c9eafcd23.camel@intel.com> References: <1554773465-21882-1-git-send-email-hongyan.song@intel.com> <20190414133615.56be4eb1@archlinux> <20190422095100.59ce99af@archlinux> In-Reply-To: <20190422095100.59ce99af@archlinux> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-originating-ip: [10.251.7.130] Content-Type: multipart/signed; micalg=sha-1; protocol="application/x-pkcs7-signature"; boundary="=-eKdLQaepsJiqzM9dpilo" MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org --=-eKdLQaepsJiqzM9dpilo Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 2019-04-22 at 09:51 +0100, Jonathan Cameron wrote: > On Tue, 16 Apr 2019 01:29:28 +0000 > "Pandruvada, Srinivas" wrote: >=20 > > On Sun, 2019-04-14 at 13:36 +0100, Jonathan Cameron wrote: > > > On Tue, 9 Apr 2019 09:31:04 +0800 > > > hongyan.song@intel.com wrote: > > > =20 > > > > From: Song Hongyan > > > >=20 > > > > Add more data field support for als, incli_3d, rotation, press > > > > hysteresis parsing. In some implementation may uses them as > > > > sensitivity > > > > modifier, without this change hysteresis may not be able to > > > > read > > > > and > > > > write. > > > >=20 > > > > Signed-off-by: Song Hongyan =20 > > >=20 > > > Thanks for the patch. I'll be honest I'm lost in these > > > descriptors > > > sometimes! > > >=20 > > > Srinivas, could you give some input on this one? =20 > >=20 > > I don't see we have defined hysteresis attribute in > > "Documentation/ABI/testing/sysfs-bus-iio" for non events. > > The current hysteresis is taken a absolute raw value in relation to > > the > > other axes in the same unit. > >=20 > > But it is better if we add different hysteresis attributes for non > > absolute hysteresis. > >=20 > > For example > > in_xxx_hysteresis_pct_range for "Modifier: Change Sensitivity > > Percent > > of Range" usage id: 310 > > in_xxx_hysteresis_pct_relative for "Modifier: Change Sensitivity > > Percent Relative" usage id: 311 >=20 > Hmm. This is indeed a corner we don't often hit. Basically we are > looking > at a 'dead zone'. For most IIO devices we don't do this as it is > removing information some usecases might want. If people want to > do this on sensors, it's normally done using a motion detect type > event and then reading the sensor value to find out what the motion > was. >=20 > I'm not sure hysteresis is the right term to use here though. > We aren't dealing with offsets in a threshold depending on direction, > but rather at minimum change before reporting from the previous value > (in either direction). Mind you I'm not quite sure what the right > term would be! It may be that sensitivity is the term to use. In > some ways this is very like reducing the bit depth of the sensor, > which is what that term brings to mind for me. We can use=20 in_xxx_sensitivity_pct_range in_xxx_sensitivity_pct_rel in_xxx_sensitivity_abs Thanks, Srinivas >=20 > Thanks, >=20 > Jonathan >=20 > >=20 > >=20 > > Thanks, > > Srinivas > >=20 > >=20 > >=20 > > >=20 > > > I will note however, that from a quick look we tend to air these > > > queries with dev_dbg entries. We should be consistent with these > > > new > > > ones > > > as well.attaributes > > >=20 > > > Thanks, > > >=20 > > > Jonathan =20 > > > > --- > > > > drivers/iio/light/hid-sensor-als.c | 8 ++++++++ > > > > drivers/iio/orientation/hid-sensor-incl-3d.c | 8 ++++++++ > > > > drivers/iio/orientation/hid-sensor-rotation.c | 7 +++++++ > > > > drivers/iio/pressure/hid-sensor-press.c | 8 ++++++++ > > > > include/linux/hid-sensor-ids.h | 1 + > > > > 5 files changed, 32 insertions(+)attaributes > > > >=20 > > > > diff --git a/drivers/iio/light/hid-sensor-als.c > > > > b/drivers/iio/light/hid-sensor-als.c > > > > index 94f3325..bb19178 100644 > > > > --- a/drivers/iio/light/hid-sensor-als.c > > > > +++ b/drivers/iio/light/hid-sensor-als.c > > > > @@ -271,6 +271,14 @@ static int als_parse_report(struct > > > > platform_device *pdev, > > > > st- > > > > >common_attributes.sensitivity.index, > > > > st- > > > > >common_attributes.sensitivity.report_id); > > > > } > > > > + if (st->common_attributes.sensitivity.index < 0) { > > > > + sensor_hub_input_get_attribute_info(hsdev, > > > > + HID_FEATURE_REPORT, usage_id, > > > > + HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSIT > > > > IVITY_RE > > > > L_PCT | > > > > + HID_USAGE_SENSOR_LIGHT_ILLUM, > > > > + &st->common_attributes.sensitivity); > > > > + } > > > > + > > > > return ret; > > > > } > > > > =20 > > > > diff --git a/drivers/iio/orientation/hid-sensor-incl-3d.c > > > > b/drivers/iio/orientation/hid-sensor-incl-3d.c > > > > index bdc5e45..7da1e3f 100644 > > > > --- a/drivers/iio/orientation/hid-sensor-incl-3d.c > > > > +++ b/drivers/iio/orientation/hid-sensor-incl-3d.c > > > > @@ -305,6 +305,14 @@ static int incl_3d_parse_report(struct > > > > platform_device *pdev, > > > > st- > > > > >commpcton_attributes.sensitivity.index, > > > > st- > > > > >common_attributes.sensitivity.report_id); > > > > } > > > > + if (st->common_attributes.sensitivity.index < 0) { > > > > + sensor_hub_input_get_attribute_info(hsdev, > > > > + HID_FEATURE_REPORT, usage_id, > > > > + HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSIT > > > > IVITY_AB > > > > S | > > > > + HID_USAGE_SENSOR_ORIENT_TILT, > > > > + &st->common_attributes.sensitivity); > > > > + } > > > > + > > > > return ret; > > > > } > > > > =20 > > > > diff --git a/drivers/iio/orientation/hid-sensor-rotation.c > > > > b/drivers/iio/orientation/hid-sensor-rotation.c > > > > index a69db20..201e320 100644 > > > > --- a/drivers/iio/orientation/hid-sensor-rotation.c > > > > +++ b/drivers/iio/orientation/hid-sensor-rotation.c > > > > @@ -229,6 +229,13 @@ static int dev_rot_parse_report(struct > > > > platform_device *pdev, > > > > st- > > > > >common_attributes.sensitivity.index, > > > > st- > > > > >common_attributes.sensitivity.report_id); > > > > } > > > > + if (st->common_attributes.sensitivity.index < 0) { > > > > + sensor_hub_input_get_attribute_info(hsdev, > > > > + HID_FEATURE_REPORT, usage_id, > > > > + HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSIT > > > > IVITY_AB > > > > S | > > > > + HID_USAGE_SENSOR_ORIENT_QUATERNION, > > > > + &st->common_attributes.sensitivity); > > > > + } > > > > =20 > > > > return 0; > > > > } > > > > diff --git a/drivers/iio/pressure/hid-sensor-press.c > > > > b/drivers/iio/pressure/hid-sensor-press.c > > > > index d7b1c00..bf5d2ac 10064pct4 > > > > --- a/drivers/iio/pressure/hid-sensor-press.c > > > > +++ b/drivers/iio/pressure/hid-sensor-press.c > > > > @@ -250,6 +250,14 @@ static int press_parse_report(struct > > > > platform_device *pdev, > > > > st- > > > > >common_attributes.sensitivity.index, > > > > st- > > > > >common_attributes.sensitivity.report_id); > > > > } > > > > + if (st->common_attributes.sensitivity.index < 0) { > > > > + sensor_hub_input_get_attribute_info(hsdev, > > > > + HID_FEATURE_REPORT, usage_id, > > > > + HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSIT > > > > IVITY_AB > > > > S | > > > > + HID_USAGE_SENSOR_ATMOSPHERIC_PRESSURE, > > > > + &st->common_attributes.sensitivity); > > > > + } > > > > + > > > > return ret; > > > > } > > > > =20 > > > > diff --git a/include/linux/hid-sensor-ids.h > > > > b/include/linux/hid- > > > > sensor-ids.h > > > > index 76033e0..a875b9be 100644 > > > > --- a/include/linux/hid-sensor-ids.h > > > > +++ b/include/linux/hid-sensor-ids.h > > > > @@ -158,6 +158,7 @@ > > > > /* Per data field properties */ > > > > #define HID_USAGE_SENSOR_DATA_MOD_NONE =09 > > > > 0x00 > > > > #define HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS=09 > > > > =09 > > > > 0x1000 > > > > +#define > > > > HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_REL_PCT =20 > > > > 0xE > > > > 000 > > > > =20 > > > > /* Power state enumerations */ > > > > #define HID_USAGE_SENSOR_PROP_POWER_STATE_UNDEFINED_ENUM=09 > > > > 0x20085 > > > > 0 =20 > > >=20 > > > =20 >=20 >=20 --=-eKdLQaepsJiqzM9dpilo Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Disposition: attachment; filename="smime.p7s" Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIKhTCCBOsw ggPToAMCAQICEDabxALowUBS+21KC0JI8fcwDQYJKoZIhvcNAQEFBQAwbzELMAkGA1UEBhMCU0Ux FDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5hbCBUVFAgTmV0 d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0EgUm9vdDAeFw0xMzEyMTEwMDAwMDBa Fw0yMDA1MzAxMDQ4MzhaMHkxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEUMBIGA1UEBxMLU2Fu dGEgQ2xhcmExGjAYBgNVBAoTEUludGVsIENvcnBvcmF0aW9uMSswKQYDVQQDEyJJbnRlbCBFeHRl cm5hbCBCYXNpYyBJc3N1aW5nIENBIDRCMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA yzuW/y/g0bznz8BD48M94luFzqHaqY9yGN9H/W0J7hOVBpl0rTQJ6kZ7z7hyDb9kf2UW4ZU25alC i+q5m6NwHg+z9pcN7bQ84SSBueaYF7cXlAg7z3XyZbzSEYP7raeuWRf5fYvYzq8/uI7VNR8o/43w PtDP10YDdO/0J5xrHxnC/9/aU+wTFSVsPqxsd7C58mnu7G4VRJ0n9PG4SfmYNC0h/5fLWuOWhxAv 6MuiK7MmvTPHLMclULgJqVSqG1MbBs0FbzoRHne4Cx0w6rtzPTrzo+bTRqhruaU18lQkzBk6OnyJ Uth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