Skip to content

Commit

Permalink
HID: amd_sfh: Fix illuminance value
Browse files Browse the repository at this point in the history
[ Upstream commit a33e5e3 ]

Illuminance value is actually 32 bits, but is incorrectly trancated to
16 bits. Hence convert to integer illuminace accordingly to reflect
correct values.

Fixes: 93ce5e0 ("HID: amd_sfh: Implement SFH1.1 functionality")
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Basavaraj Natikar authored and gregkh committed May 11, 2023
1 parent dfa2769 commit 7e1e71d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ struct sfh_mag_data {

struct sfh_als_data {
struct sfh_common_data commondata;
u16 lux;
u32 lux;
};

struct hpd_status {
Expand Down

0 comments on commit 7e1e71d

Please sign in to comment.