Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: hongyan.song@intel.com
Cc: jikos@kernel.org, linux-iio@vger.kernel.org,
	linux-input@vger.kernel.org, srinivas.pandruvada@intel.com
Subject: Re: [PATCH] drivers: iio: Add more data field for iio driver hysteresis parsing
Date: Sun, 14 Apr 2019 13:36:15 +0100	[thread overview]
Message-ID: <20190414133615.56be4eb1@archlinux> (raw)
In-Reply-To: <1554773465-21882-1-git-send-email-hongyan.song@intel.com>

On Tue,  9 Apr 2019 09:31:04 +0800
hongyan.song@intel.com wrote:

> From: Song Hongyan <hongyan.song@intel.com>
> 
> 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.
> 
> Signed-off-by: Song Hongyan <hongyan.song@intel.com>
Thanks for the patch. I'll be honest I'm lost in these descriptors
sometimes!

Srinivas, could you give some input on this one?

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.

Thanks,

Jonathan
> ---
>  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(+)
> 
> 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_SENSITIVITY_REL_PCT |
> +			HID_USAGE_SENSOR_LIGHT_ILLUM,
> +			&st->common_attributes.sensitivity);
> +	}
> +
>  	return ret;
>  }
>  
> 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->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_SENSITIVITY_ABS |
> +			HID_USAGE_SENSOR_ORIENT_TILT,
> +			&st->common_attributes.sensitivity);
> +	}
> +
>  	return ret;
>  }
>  
> 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_SENSITIVITY_ABS |
> +			HID_USAGE_SENSOR_ORIENT_QUATERNION,
> +			&st->common_attributes.sensitivity);
> +	}
>  
>  	return 0;
>  }
> diff --git a/drivers/iio/pressure/hid-sensor-press.c b/drivers/iio/pressure/hid-sensor-press.c
> index d7b1c00..bf5d2ac 100644
> --- 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_SENSITIVITY_ABS |
> +			HID_USAGE_SENSOR_ATMOSPHERIC_PRESSURE,
> +			&st->common_attributes.sensitivity);
> +	}
> +
>  	return ret;
>  }
>  
> 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					0x00
>  #define HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS		0x1000
> +#define HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_REL_PCT            0xE000
>  
>  /* Power state enumerations */
>  #define HID_USAGE_SENSOR_PROP_POWER_STATE_UNDEFINED_ENUM	0x200850


  reply	other threads:[~2019-04-14 12:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-09  1:31 [PATCH] drivers: iio: Add more data field for iio driver hysteresis parsing hongyan.song
2019-04-14 12:36 ` Jonathan Cameron [this message]
2019-04-16  1:29   ` Pandruvada, Srinivas
2019-04-22  8:51     ` Jonathan Cameron
2019-04-22 14:21       ` Pandruvada, Srinivas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190414133615.56be4eb1@archlinux \
    --to=jic23@kernel.org \
    --cc=hongyan.song@intel.com \
    --cc=jikos@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=srinivas.pandruvada@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox