* [PATCH] HID: amd_sfh: Support for additional light sensor
@ 2023-04-11 16:19 Basavaraj Natikar
2023-04-13 13:57 ` Jiri Kosina
0 siblings, 1 reply; 4+ messages in thread
From: Basavaraj Natikar @ 2023-04-11 16:19 UTC (permalink / raw)
To: jikos, benjamin.tissoires, linux-input; +Cc: Basavaraj Natikar
There is support for additional light sensors in the SFH firmware.
As a result, add support for additional light sensors.
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
---
drivers/hid/amd-sfh-hid/amd_sfh_client.c | 1 +
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 4 ++++
drivers/hid/amd-sfh-hid/amd_sfh_pcie.h | 1 +
drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c | 4 ++++
4 files changed, 10 insertions(+)
diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_client.c b/drivers/hid/amd-sfh-hid/amd_sfh_client.c
index c751d12f5df8..d9b7b01900b5 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_client.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_client.c
@@ -147,6 +147,7 @@ static const char *get_sensor_name(int idx)
case mag_idx:
return "magnetometer";
case als_idx:
+ case ACS_IDX: /* ambient color sensor */
return "ALS";
case HPD_IDX:
return "HPD";
diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
index 47774b9ab3de..f37f817737f2 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
@@ -29,6 +29,7 @@
#define MAGNO_EN BIT(2)
#define HPD_EN BIT(16)
#define ALS_EN BIT(19)
+#define ACS_EN BIT(22)
static int sensor_mask_override = -1;
module_param_named(sensor_mask, sensor_mask_override, int, 0444);
@@ -233,6 +234,9 @@ int amd_mp2_get_sensor_num(struct amd_mp2_dev *privdata, u8 *sensor_id)
if (HPD_EN & activestatus)
sensor_id[num_of_sensors++] = HPD_IDX;
+ if (ACS_EN & activestatus)
+ sensor_id[num_of_sensors++] = ACS_IDX;
+
return num_of_sensors;
}
diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h
index dfb7cabd82ef..70add75fc506 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h
@@ -23,6 +23,7 @@
#define V2_STATUS 0x2
#define HPD_IDX 16
+#define ACS_IDX 22
#define SENSOR_DISCOVERY_STATUS_MASK GENMASK(5, 3)
#define SENSOR_DISCOVERY_STATUS_SHIFT 3
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 f9a8c02d5a7b..8716a05950c8 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
@@ -48,6 +48,7 @@ static int get_report_descriptor(int sensor_idx, u8 *rep_desc)
sizeof(comp3_report_descriptor));
break;
case als_idx: /* ambient light sensor */
+ case ACS_IDX: /* ambient color sensor */
memset(rep_desc, 0, sizeof(als_report_descriptor));
memcpy(rep_desc, als_report_descriptor,
sizeof(als_report_descriptor));
@@ -97,6 +98,7 @@ static u32 get_descr_sz(int sensor_idx, int descriptor_name)
}
break;
case als_idx:
+ case ACS_IDX: /* ambient color sensor */
switch (descriptor_name) {
case descr_size:
return sizeof(als_report_descriptor);
@@ -174,6 +176,7 @@ static u8 get_feature_report(int sensor_idx, int report_id, u8 *feature_report)
report_size = sizeof(magno_feature);
break;
case als_idx: /* ambient light sensor */
+ case ACS_IDX: /* ambient color sensor */
get_common_features(&als_feature.common_property, report_id);
als_feature.als_change_sesnitivity = HID_DEFAULT_SENSITIVITY;
als_feature.als_sensitivity_min = HID_DEFAULT_MIN_VALUE;
@@ -245,6 +248,7 @@ static u8 get_input_report(u8 current_index, int sensor_idx, int report_id,
report_size = sizeof(magno_input);
break;
case als_idx: /* Als */
+ case ACS_IDX: /* ambient color sensor */
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)
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] HID: amd_sfh: Support for additional light sensor
2023-04-11 16:19 [PATCH] HID: amd_sfh: Support for additional light sensor Basavaraj Natikar
@ 2023-04-13 13:57 ` Jiri Kosina
2023-04-24 8:32 ` Linux regression tracking (Thorsten Leemhuis)
0 siblings, 1 reply; 4+ messages in thread
From: Jiri Kosina @ 2023-04-13 13:57 UTC (permalink / raw)
To: Basavaraj Natikar; +Cc: benjamin.tissoires, linux-input
On Tue, 11 Apr 2023, Basavaraj Natikar wrote:
> There is support for additional light sensors in the SFH firmware.
> As a result, add support for additional light sensors.
>
> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Applied.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] HID: amd_sfh: Support for additional light sensor
2023-04-13 13:57 ` Jiri Kosina
@ 2023-04-24 8:32 ` Linux regression tracking (Thorsten Leemhuis)
2023-04-24 16:13 ` Basavaraj Natikar
0 siblings, 1 reply; 4+ messages in thread
From: Linux regression tracking (Thorsten Leemhuis) @ 2023-04-24 8:32 UTC (permalink / raw)
To: Jiri Kosina, Basavaraj Natikar
Cc: benjamin.tissoires, linux-input, Linux kernel regressions list
On 13.04.23 15:57, Jiri Kosina wrote:
> On Tue, 11 Apr 2023, Basavaraj Natikar wrote:
>
>> There is support for additional light sensors in the SFH firmware.
>> As a result, add support for additional light sensors.
>>
>> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
>
> Applied.
FWIW, there is a report about a hang at boot that was bisected to this
patch. For details see:
https://bugzilla.kernel.org/show_bug.cgi?id=217354
Ciao, Thorsten
P.S. I normally don't track regressions in -next, I just noticed that
report and wanted to let you know about it.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] HID: amd_sfh: Support for additional light sensor
2023-04-24 8:32 ` Linux regression tracking (Thorsten Leemhuis)
@ 2023-04-24 16:13 ` Basavaraj Natikar
0 siblings, 0 replies; 4+ messages in thread
From: Basavaraj Natikar @ 2023-04-24 16:13 UTC (permalink / raw)
To: Linux regressions mailing list, Jiri Kosina, Basavaraj Natikar
Cc: benjamin.tissoires, linux-input
On 4/24/2023 2:02 PM, Linux regression tracking (Thorsten Leemhuis) wrote:
> On 13.04.23 15:57, Jiri Kosina wrote:
>> On Tue, 11 Apr 2023, Basavaraj Natikar wrote:
>>
>>> There is support for additional light sensors in the SFH firmware.
>>> As a result, add support for additional light sensors.
>>>
>>> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
>> Applied.
> FWIW, there is a report about a hang at boot that was bisected to this
> patch. For details see:
> https://bugzilla.kernel.org/show_bug.cgi?id=217354
Thanks a lot for information.
Added a Fix in
https://lore.kernel.org/all/20230424160406.2579888-1-Basavaraj.Natikar@amd.com/
Thanks,
--
Basavaraj
>
> Ciao, Thorsten
>
> P.S. I normally don't track regressions in -next, I just noticed that
> report and wanted to let you know about it.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-04-24 16:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-11 16:19 [PATCH] HID: amd_sfh: Support for additional light sensor Basavaraj Natikar
2023-04-13 13:57 ` Jiri Kosina
2023-04-24 8:32 ` Linux regression tracking (Thorsten Leemhuis)
2023-04-24 16:13 ` 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).