patch "iio: hid-sensor-prox: Fix scale not correct issue" added to staging-linus
Subsystems (3)
This is a note to let you know that I've just added the patch titled
iio: hid-sensor-prox: Fix scale not correct issue
to my staging git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
in the staging-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
From d68c592e02f6f49a88e705f13dfc1883432cf300 Mon Sep 17 00:00:00 2001
From: Ye Xiang <[email protected]>
Date: Sat, 30 Jan 2021 18:25:30 +0800
Subject: iio: hid-sensor-prox: Fix scale not correct issue
Currently, the proxy sensor scale is zero because it just return the exponent directly. To fix this issue, this patch use hid_sensor_format_scale to process the scale first then return the output.
--- drivers/iio/light/hid-sensor-prox.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/iio/light/hid-sensor-prox.c +11 -2
@@ -23,6 +23,9 @@ struct prox_state {struct hid_sensor_common common_attributes;struct hid_sensor_hub_attribute_info prox_attr;u32 human_presence; +int scale_pre_decml; +int scale_post_decml; +int scale_precision; };/* Channel definitions */
@@ -93,8 +96,9 @@ static int prox_read_raw(struct iio_dev *indio_dev, ret_type =IIO_VAL_INT ;break ;case IIO_CHAN_INFO_SCALE : - *val = prox_state->prox_attr.units; - ret_type =IIO_VAL_INT ; + *val = prox_state->scale_pre_decml; + *val2 = prox_state->scale_post_decml; + ret_type = prox_state->scale_precision;break ;case IIO_CHAN_INFO_OFFSET : *val = hid_sensor_convert_exponent(
@@ -234,6 +238,11 @@ static int prox_parse_report(struct platform_device *pdev,HID_USAGE_SENSOR_HUMAN_PRESENCE , &st->common_attributes.sensitivity); + st->scale_precision =hid_sensor_format_scale ( + hsdev->usage, + &st->prox_attr, + &st->scale_pre_decml, &st->scale_post_decml); +return ret; }
Signature · 1 line
2.30.2