From: Greg Kroah-Hartman Date: Sat, 10 Apr 2021 11:15:14 +0000 (+0200) Subject: 4.4-stable patches X-Git-Tag: v4.14.230~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=066f1fcae6ae64643fd08a0c342f0bab3b5f115b;p=thirdparty%2Fkernel%2Fstable-queue.git 4.4-stable patches added patches: iio-hid-sensor-prox-fix-scale-not-correct-issue.patch --- diff --git a/queue-4.4/iio-hid-sensor-prox-fix-scale-not-correct-issue.patch b/queue-4.4/iio-hid-sensor-prox-fix-scale-not-correct-issue.patch new file mode 100644 index 00000000000..4b5bdefedef --- /dev/null +++ b/queue-4.4/iio-hid-sensor-prox-fix-scale-not-correct-issue.patch @@ -0,0 +1,63 @@ +From foo@baz Sat Apr 10 01:12:46 PM CEST 2021 +From: Ye Xiang +Date: Sat, 30 Jan 2021 18:25:30 +0800 +Subject: iio: hid-sensor-prox: Fix scale not correct issue + +From: Ye Xiang + +commit d68c592e02f6f49a88e705f13dfc1883432cf300 upstream + +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. + +Fixes: 39a3a0138f61 ("iio: hid-sensors: Added Proximity Sensor Driver") +Signed-off-by: Ye Xiang +Link: https://lore.kernel.org/r/20210130102530.31064-1-xiang.ye@intel.com +Cc: +Signed-off-by: Jonathan Cameron +[sudip: adjust context] +Signed-off-by: Sudip Mukherjee +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/light/hid-sensor-prox.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +--- a/drivers/iio/light/hid-sensor-prox.c ++++ b/drivers/iio/light/hid-sensor-prox.c +@@ -37,6 +37,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 */ +@@ -105,8 +108,9 @@ static int prox_read_raw(struct iio_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( +@@ -240,6 +244,12 @@ static int prox_parse_report(struct plat + st->common_attributes.sensitivity.index, + st->common_attributes.sensitivity.report_id); + } ++ ++ st->scale_precision = hid_sensor_format_scale( ++ hsdev->usage, ++ &st->prox_attr, ++ &st->scale_pre_decml, &st->scale_post_decml); ++ + return ret; + } + diff --git a/queue-4.4/series b/queue-4.4/series new file mode 100644 index 00000000000..a4acd38ee17 --- /dev/null +++ b/queue-4.4/series @@ -0,0 +1 @@ +iio-hid-sensor-prox-fix-scale-not-correct-issue.patch