* [PATCH 0/2] Fixes to amd_sfh driver
@ 2022-01-31 17:18 Basavaraj Natikar
2022-01-31 17:18 ` [PATCH 1/2] amd_sfh: Increase sensor command timeout Basavaraj Natikar
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Basavaraj Natikar @ 2022-01-31 17:18 UTC (permalink / raw)
To: jikos, benjamin.tissoires, linux-input, Nehal-Bakulchandra.shah
Cc: Basavaraj Natikar
Changes include increasing sensor command timeout and
adding illuminance mask value.
Basavaraj Natikar (2):
amd_sfh: Increase sensor command timeout
amd_sfh: Add illuminance mask to limit ALS max value
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 4 ++--
drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c | 4 +++-
2 files changed, 5 insertions(+), 3 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] amd_sfh: Increase sensor command timeout
2022-01-31 17:18 [PATCH 0/2] Fixes to amd_sfh driver Basavaraj Natikar
@ 2022-01-31 17:18 ` Basavaraj Natikar
2022-01-31 17:18 ` [PATCH 2/2] amd_sfh: Add illuminance mask to limit ALS max value Basavaraj Natikar
2022-02-02 14:05 ` [PATCH 0/2] Fixes to amd_sfh driver Jiri Kosina
2 siblings, 0 replies; 5+ messages in thread
From: Basavaraj Natikar @ 2022-01-31 17:18 UTC (permalink / raw)
To: jikos, benjamin.tissoires, linux-input, Nehal-Bakulchandra.shah
Cc: Basavaraj Natikar
HPD sensors take more time to initialize. Hence increasing sensor
command timeout to get response with status within a max timeout.
Fixes: 173709f50e98 ("HID: amd_sfh: Add command response to check command status")
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
---
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
index 2503be0253d3..d3f32ffe299a 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
@@ -37,11 +37,11 @@ static int amd_sfh_wait_response_v2(struct amd_mp2_dev *mp2, u8 sid, u32 sensor_
{
union cmd_response cmd_resp;
- /* Get response with status within a max of 800 ms timeout */
+ /* Get response with status within a max of 1600 ms timeout */
if (!readl_poll_timeout(mp2->mmio + AMD_P2C_MSG(0), cmd_resp.resp,
(cmd_resp.response_v2.response == sensor_sts &&
cmd_resp.response_v2.status == 0 && (sid == 0xff ||
- cmd_resp.response_v2.sensor_id == sid)), 500, 800000))
+ cmd_resp.response_v2.sensor_id == sid)), 500, 1600000))
return cmd_resp.response_v2.response;
return SENSOR_DISABLED;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] amd_sfh: Add illuminance mask to limit ALS max value
2022-01-31 17:18 [PATCH 0/2] Fixes to amd_sfh driver Basavaraj Natikar
2022-01-31 17:18 ` [PATCH 1/2] amd_sfh: Increase sensor command timeout Basavaraj Natikar
@ 2022-01-31 17:18 ` Basavaraj Natikar
2022-02-02 14:05 ` [PATCH 0/2] Fixes to amd_sfh driver Jiri Kosina
2 siblings, 0 replies; 5+ messages in thread
From: Basavaraj Natikar @ 2022-01-31 17:18 UTC (permalink / raw)
To: jikos, benjamin.tissoires, linux-input, Nehal-Bakulchandra.shah
Cc: Basavaraj Natikar
ALS illuminance value present only in first 15 bits from SFH firmware
for V2 platforms. Hence added a mask of 15 bit to limit ALS max
illuminance values to get correct illuminance value.
Fixes: 0aad9c95eb9a ("HID: amd_sfh: Extend ALS support for newer AMD platform")
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
---
drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c
index be41f83b0289..76095bd53c65 100644
--- a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c
+++ b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c
@@ -27,6 +27,7 @@
#define HID_USAGE_SENSOR_STATE_READY_ENUM 0x02
#define HID_USAGE_SENSOR_STATE_INITIALIZING_ENUM 0x05
#define HID_USAGE_SENSOR_EVENT_DATA_UPDATED_ENUM 0x04
+#define ILLUMINANCE_MASK GENMASK(14, 0)
int get_report_descriptor(int sensor_idx, u8 *rep_desc)
{
@@ -246,7 +247,8 @@ u8 get_input_report(u8 current_index, int sensor_idx, int report_id, struct amd_
get_common_inputs(&als_input.common_property, report_id);
/* For ALS ,V2 Platforms uses C2P_MSG5 register instead of DRAM access method */
if (supported_input == V2_STATUS)
- als_input.illuminance_value = (int)readl(privdata->mmio + AMD_C2P_MSG(5));
+ als_input.illuminance_value =
+ readl(privdata->mmio + AMD_C2P_MSG(5)) & ILLUMINANCE_MASK;
else
als_input.illuminance_value =
(int)sensor_virt_addr[0] / AMD_SFH_FW_MULTIPLIER;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] Fixes to amd_sfh driver
2022-01-31 17:18 [PATCH 0/2] Fixes to amd_sfh driver Basavaraj Natikar
2022-01-31 17:18 ` [PATCH 1/2] amd_sfh: Increase sensor command timeout Basavaraj Natikar
2022-01-31 17:18 ` [PATCH 2/2] amd_sfh: Add illuminance mask to limit ALS max value Basavaraj Natikar
@ 2022-02-02 14:05 ` Jiri Kosina
2022-02-02 15:35 ` Basavaraj Natikar
2 siblings, 1 reply; 5+ messages in thread
From: Jiri Kosina @ 2022-02-02 14:05 UTC (permalink / raw)
To: Basavaraj Natikar
Cc: benjamin.tissoires, linux-input, Nehal-Bakulchandra.shah
On Mon, 31 Jan 2022, Basavaraj Natikar wrote:
> Changes include increasing sensor command timeout and
> adding illuminance mask value.
>
> Basavaraj Natikar (2):
> amd_sfh: Increase sensor command timeout
> amd_sfh: Add illuminance mask to limit ALS max value
Please make sure to follow the convention and always prefix HID patches
with 'HID: ' in the shortlog.
I've fixed that up on my side now and applied for 5.17. Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] Fixes to amd_sfh driver
2022-02-02 14:05 ` [PATCH 0/2] Fixes to amd_sfh driver Jiri Kosina
@ 2022-02-02 15:35 ` Basavaraj Natikar
0 siblings, 0 replies; 5+ messages in thread
From: Basavaraj Natikar @ 2022-02-02 15:35 UTC (permalink / raw)
To: Jiri Kosina, Basavaraj Natikar
Cc: benjamin.tissoires, linux-input, Nehal-Bakulchandra.shah
On 2/2/2022 7:35 PM, Jiri Kosina wrote:
> On Mon, 31 Jan 2022, Basavaraj Natikar wrote:
>
>> Changes include increasing sensor command timeout and
>> adding illuminance mask value.
>>
>> Basavaraj Natikar (2):
>> amd_sfh: Increase sensor command timeout
>> amd_sfh: Add illuminance mask to limit ALS max value
> Please make sure to follow the convention and always prefix HID patches
> with 'HID: ' in the shortlog.
>
> I've fixed that up on my side now and applied for 5.17. Thanks,
>
Thanks for the feedback. Sure, I will follow this for future patches.
- Basavaraj
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-02-02 15:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-31 17:18 [PATCH 0/2] Fixes to amd_sfh driver Basavaraj Natikar
2022-01-31 17:18 ` [PATCH 1/2] amd_sfh: Increase sensor command timeout Basavaraj Natikar
2022-01-31 17:18 ` [PATCH 2/2] amd_sfh: Add illuminance mask to limit ALS max value Basavaraj Natikar
2022-02-02 14:05 ` [PATCH 0/2] Fixes to amd_sfh driver Jiri Kosina
2022-02-02 15:35 ` Basavaraj Natikar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).