diff options
author | Basavaraj Natikar <Basavaraj.Natikar@amd.com> | 2023-04-11 21:40:26 +0530 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2023-04-13 15:55:22 +0200 |
commit | a33e5e393171ae8384d3381db5cd159ba877cfcb (patch) | |
tree | 41862adb0d92ca70d1a0f0e1de8d37383c5adb1a /drivers/hid/amd-sfh-hid | |
parent | 0b9255bf11baa61cd526e6bd24d6c8e6d1eabf8d (diff) |
HID: amd_sfh: Fix illuminance value
Illuminance value is actually 32 bits, but is incorrectly trancated to
16 bits. Hence convert to integer illuminace accordingly to reflect
correct values.
Fixes: 93ce5e0231d7 ("HID: amd_sfh: Implement SFH1.1 functionality")
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/amd-sfh-hid')
-rw-r--r-- | drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c | 2 | ||||
-rw-r--r-- | drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c index 0609fea581c9..6f0d332ccf51 100644 --- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c +++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c @@ -218,7 +218,7 @@ static u8 get_input_rep(u8 current_index, int sensor_idx, int report_id, OFFSET_SENSOR_DATA_DEFAULT; memcpy_fromio(&als_data, sensoraddr, sizeof(struct sfh_als_data)); get_common_inputs(&als_input.common_property, report_id); - als_input.illuminance_value = als_data.lux; + als_input.illuminance_value = float_to_int(als_data.lux); report_size = sizeof(als_input); memcpy(input_report, &als_input, sizeof(als_input)); break; diff --git a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h index a3e0ec289e3f..9d31d5b510eb 100644 --- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h +++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h @@ -133,7 +133,7 @@ struct sfh_mag_data { struct sfh_als_data { struct sfh_common_data commondata; - u16 lux; + u32 lux; }; struct hpd_status { |